ARM / Samsung: Use struct syscore_ops for "core" power management

Replace sysdev classes and struct sys_device objects used for "core"
power management by Samsung platforms with struct syscore_ops objects
that are simpler.

This generally reduces the code size and the kernel memory footprint.
It also is necessary for removing sysdevs entirely from the kernel in
the future.

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Acked-by: Greg Kroah-Hartman <gregkh@suse.de>
Acked-by: Kukjin Kim <kgene.kim@samsung.com>
This commit is contained in:
Rafael J. Wysocki 2011-04-22 22:03:21 +02:00
parent 2eaa03b5be
commit bb072c3cf2
24 changed files with 205 additions and 230 deletions

View File

@ -16,6 +16,7 @@
#include <linux/init.h> #include <linux/init.h>
#include <linux/suspend.h> #include <linux/suspend.h>
#include <linux/syscore_ops.h>
#include <linux/io.h> #include <linux/io.h>
#include <asm/cacheflush.h> #include <asm/cacheflush.h>
@ -372,7 +373,27 @@ void exynos4_scu_enable(void __iomem *scu_base)
flush_cache_all(); flush_cache_all();
} }
static int exynos4_pm_resume(struct sys_device *dev) static struct sysdev_driver exynos4_pm_driver = {
.add = exynos4_pm_add,
};
static __init int exynos4_pm_drvinit(void)
{
unsigned int tmp;
s3c_pm_init();
/* All wakeup disable */
tmp = __raw_readl(S5P_WAKEUP_MASK);
tmp |= ((0xFF << 8) | (0x1F << 1));
__raw_writel(tmp, S5P_WAKEUP_MASK);
return sysdev_driver_register(&exynos4_sysclass, &exynos4_pm_driver);
}
arch_initcall(exynos4_pm_drvinit);
static void exynos4_pm_resume(void)
{ {
/* For release retention */ /* For release retention */
@ -394,27 +415,15 @@ static int exynos4_pm_resume(struct sys_device *dev)
/* enable L2X0*/ /* enable L2X0*/
writel_relaxed(1, S5P_VA_L2CC + L2X0_CTRL); writel_relaxed(1, S5P_VA_L2CC + L2X0_CTRL);
#endif #endif
return 0;
} }
static struct sysdev_driver exynos4_pm_driver = { static struct syscore_ops exynos4_pm_syscore_ops = {
.add = exynos4_pm_add,
.resume = exynos4_pm_resume, .resume = exynos4_pm_resume,
}; };
static __init int exynos4_pm_drvinit(void) static __init int exynos4_pm_syscore_init(void)
{ {
unsigned int tmp; register_syscore_ops(&exynos4_pm_syscore_ops);
return 0;
s3c_pm_init();
/* All wakeup disable */
tmp = __raw_readl(S5P_WAKEUP_MASK);
tmp |= ((0xFF << 8) | (0x1F << 1));
__raw_writel(tmp, S5P_WAKEUP_MASK);
return sysdev_driver_register(&exynos4_sysclass, &exynos4_pm_driver);
} }
arch_initcall(exynos4_pm_drvinit); arch_initcall(exynos4_pm_syscore_init);

View File

@ -23,38 +23,12 @@
#include <linux/module.h> #include <linux/module.h>
#include <linux/interrupt.h> #include <linux/interrupt.h>
#include <linux/ioport.h> #include <linux/ioport.h>
#include <linux/sysdev.h> #include <linux/syscore_ops.h>
#include <plat/cpu.h> #include <plat/cpu.h>
#include <plat/pm.h> #include <plat/pm.h>
static int s3c2410_irq_add(struct sys_device *sysdev) struct syscore_ops s3c24xx_irq_syscore_ops = {
{
return 0;
}
static struct sysdev_driver s3c2410_irq_driver = {
.add = s3c2410_irq_add,
.suspend = s3c24xx_irq_suspend, .suspend = s3c24xx_irq_suspend,
.resume = s3c24xx_irq_resume, .resume = s3c24xx_irq_resume,
}; };
static int __init s3c2410_irq_init(void)
{
return sysdev_driver_register(&s3c2410_sysclass, &s3c2410_irq_driver);
}
arch_initcall(s3c2410_irq_init);
static struct sysdev_driver s3c2410a_irq_driver = {
.add = s3c2410_irq_add,
.suspend = s3c24xx_irq_suspend,
.resume = s3c24xx_irq_resume,
};
static int __init s3c2410a_irq_init(void)
{
return sysdev_driver_register(&s3c2410a_sysclass, &s3c2410a_irq_driver);
}
arch_initcall(s3c2410a_irq_init);

View File

@ -17,7 +17,7 @@
#include <linux/timer.h> #include <linux/timer.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/gpio.h> #include <linux/gpio.h>
#include <linux/sysdev.h> #include <linux/syscore_ops.h>
#include <linux/serial_core.h> #include <linux/serial_core.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/dm9000.h> #include <linux/dm9000.h>
@ -214,17 +214,16 @@ static struct s3c2410_uartcfg bast_uartcfgs[] __initdata = {
/* NAND Flash on BAST board */ /* NAND Flash on BAST board */
#ifdef CONFIG_PM #ifdef CONFIG_PM
static int bast_pm_suspend(struct sys_device *sd, pm_message_t state) static int bast_pm_suspend(void)
{ {
/* ensure that an nRESET is not generated on resume. */ /* ensure that an nRESET is not generated on resume. */
gpio_direction_output(S3C2410_GPA(21), 1); gpio_direction_output(S3C2410_GPA(21), 1);
return 0; return 0;
} }
static int bast_pm_resume(struct sys_device *sd) static void bast_pm_resume(void)
{ {
s3c_gpio_cfgpin(S3C2410_GPA(21), S3C2410_GPA21_nRSTOUT); s3c_gpio_cfgpin(S3C2410_GPA(21), S3C2410_GPA21_nRSTOUT);
return 0;
} }
#else #else
@ -232,16 +231,11 @@ static int bast_pm_resume(struct sys_device *sd)
#define bast_pm_resume NULL #define bast_pm_resume NULL
#endif #endif
static struct sysdev_class bast_pm_sysclass = { static struct syscore_ops bast_pm_syscore_ops = {
.name = "mach-bast",
.suspend = bast_pm_suspend, .suspend = bast_pm_suspend,
.resume = bast_pm_resume, .resume = bast_pm_resume,
}; };
static struct sys_device bast_pm_sysdev = {
.cls = &bast_pm_sysclass,
};
static int smartmedia_map[] = { 0 }; static int smartmedia_map[] = { 0 };
static int chip0_map[] = { 1 }; static int chip0_map[] = { 1 };
static int chip1_map[] = { 2 }; static int chip1_map[] = { 2 };
@ -642,8 +636,7 @@ static void __init bast_map_io(void)
static void __init bast_init(void) static void __init bast_init(void)
{ {
sysdev_class_register(&bast_pm_sysclass); register_syscore_ops(&bast_pm_syscore_ops);
sysdev_register(&bast_pm_sysdev);
s3c_i2c0_set_platdata(&bast_i2c_info); s3c_i2c0_set_platdata(&bast_i2c_info);
s3c_nand_set_platdata(&bast_nand_info); s3c_nand_set_platdata(&bast_nand_info);

View File

@ -25,6 +25,7 @@
#include <linux/errno.h> #include <linux/errno.h>
#include <linux/time.h> #include <linux/time.h>
#include <linux/sysdev.h> #include <linux/sysdev.h>
#include <linux/syscore_ops.h>
#include <linux/gpio.h> #include <linux/gpio.h>
#include <linux/io.h> #include <linux/io.h>
@ -92,7 +93,7 @@ static void s3c2410_pm_prepare(void)
} }
} }
static int s3c2410_pm_resume(struct sys_device *dev) static void s3c2410_pm_resume(void)
{ {
unsigned long tmp; unsigned long tmp;
@ -104,10 +105,12 @@ static int s3c2410_pm_resume(struct sys_device *dev)
if ( machine_is_aml_m5900() ) if ( machine_is_aml_m5900() )
s3c2410_gpio_setpin(S3C2410_GPF(2), 0); s3c2410_gpio_setpin(S3C2410_GPF(2), 0);
return 0;
} }
struct syscore_ops s3c2410_pm_syscore_ops = {
.resume = s3c2410_pm_resume,
};
static int s3c2410_pm_add(struct sys_device *dev) static int s3c2410_pm_add(struct sys_device *dev)
{ {
pm_cpu_prep = s3c2410_pm_prepare; pm_cpu_prep = s3c2410_pm_prepare;
@ -119,7 +122,6 @@ static int s3c2410_pm_add(struct sys_device *dev)
#if defined(CONFIG_CPU_S3C2410) #if defined(CONFIG_CPU_S3C2410)
static struct sysdev_driver s3c2410_pm_driver = { static struct sysdev_driver s3c2410_pm_driver = {
.add = s3c2410_pm_add, .add = s3c2410_pm_add,
.resume = s3c2410_pm_resume,
}; };
/* register ourselves */ /* register ourselves */
@ -133,7 +135,6 @@ arch_initcall(s3c2410_pm_drvinit);
static struct sysdev_driver s3c2410a_pm_driver = { static struct sysdev_driver s3c2410a_pm_driver = {
.add = s3c2410_pm_add, .add = s3c2410_pm_add,
.resume = s3c2410_pm_resume,
}; };
static int __init s3c2410a_pm_drvinit(void) static int __init s3c2410a_pm_drvinit(void)
@ -147,7 +148,6 @@ arch_initcall(s3c2410a_pm_drvinit);
#if defined(CONFIG_CPU_S3C2440) #if defined(CONFIG_CPU_S3C2440)
static struct sysdev_driver s3c2440_pm_driver = { static struct sysdev_driver s3c2440_pm_driver = {
.add = s3c2410_pm_add, .add = s3c2410_pm_add,
.resume = s3c2410_pm_resume,
}; };
static int __init s3c2440_pm_drvinit(void) static int __init s3c2440_pm_drvinit(void)
@ -161,7 +161,6 @@ arch_initcall(s3c2440_pm_drvinit);
#if defined(CONFIG_CPU_S3C2442) #if defined(CONFIG_CPU_S3C2442)
static struct sysdev_driver s3c2442_pm_driver = { static struct sysdev_driver s3c2442_pm_driver = {
.add = s3c2410_pm_add, .add = s3c2410_pm_add,
.resume = s3c2410_pm_resume,
}; };
static int __init s3c2442_pm_drvinit(void) static int __init s3c2442_pm_drvinit(void)

View File

@ -19,6 +19,7 @@
#include <linux/gpio.h> #include <linux/gpio.h>
#include <linux/clk.h> #include <linux/clk.h>
#include <linux/sysdev.h> #include <linux/sysdev.h>
#include <linux/syscore_ops.h>
#include <linux/serial_core.h> #include <linux/serial_core.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/io.h> #include <linux/io.h>
@ -40,6 +41,7 @@
#include <plat/devs.h> #include <plat/devs.h>
#include <plat/clock.h> #include <plat/clock.h>
#include <plat/pll.h> #include <plat/pll.h>
#include <plat/pm.h>
#include <plat/gpio-core.h> #include <plat/gpio-core.h>
#include <plat/gpio-cfg.h> #include <plat/gpio-cfg.h>
@ -168,6 +170,9 @@ int __init s3c2410_init(void)
{ {
printk("S3C2410: Initialising architecture\n"); printk("S3C2410: Initialising architecture\n");
register_syscore_ops(&s3c2410_pm_syscore_ops);
register_syscore_ops(&s3c24xx_irq_syscore_ops);
return sysdev_register(&s3c2410_sysdev); return sysdev_register(&s3c2410_sysdev);
} }

View File

@ -202,8 +202,6 @@ static int s3c2412_irq_add(struct sys_device *sysdev)
static struct sysdev_driver s3c2412_irq_driver = { static struct sysdev_driver s3c2412_irq_driver = {
.add = s3c2412_irq_add, .add = s3c2412_irq_add,
.suspend = s3c24xx_irq_suspend,
.resume = s3c24xx_irq_resume,
}; };
static int s3c2412_irq_init(void) static int s3c2412_irq_init(void)

View File

@ -17,7 +17,7 @@
#include <linux/timer.h> #include <linux/timer.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/gpio.h> #include <linux/gpio.h>
#include <linux/sysdev.h> #include <linux/syscore_ops.h>
#include <linux/serial_core.h> #include <linux/serial_core.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/i2c.h> #include <linux/i2c.h>
@ -486,7 +486,7 @@ static struct s3c2410_udc_mach_info jive_udc_cfg __initdata = {
/* Jive power management device */ /* Jive power management device */
#ifdef CONFIG_PM #ifdef CONFIG_PM
static int jive_pm_suspend(struct sys_device *sd, pm_message_t state) static int jive_pm_suspend(void)
{ {
/* Write the magic value u-boot uses to check for resume into /* Write the magic value u-boot uses to check for resume into
* the INFORM0 register, and ensure INFORM1 is set to the * the INFORM0 register, and ensure INFORM1 is set to the
@ -498,10 +498,9 @@ static int jive_pm_suspend(struct sys_device *sd, pm_message_t state)
return 0; return 0;
} }
static int jive_pm_resume(struct sys_device *sd) static void jive_pm_resume(void)
{ {
__raw_writel(0x0, S3C2412_INFORM0); __raw_writel(0x0, S3C2412_INFORM0);
return 0;
} }
#else #else
@ -509,16 +508,11 @@ static int jive_pm_resume(struct sys_device *sd)
#define jive_pm_resume NULL #define jive_pm_resume NULL
#endif #endif
static struct sysdev_class jive_pm_sysclass = { static struct syscore_ops jive_pm_syscore_ops = {
.name = "jive-pm",
.suspend = jive_pm_suspend, .suspend = jive_pm_suspend,
.resume = jive_pm_resume, .resume = jive_pm_resume,
}; };
static struct sys_device jive_pm_sysdev = {
.cls = &jive_pm_sysclass,
};
static void __init jive_map_io(void) static void __init jive_map_io(void)
{ {
s3c24xx_init_io(jive_iodesc, ARRAY_SIZE(jive_iodesc)); s3c24xx_init_io(jive_iodesc, ARRAY_SIZE(jive_iodesc));
@ -536,10 +530,9 @@ static void jive_power_off(void)
static void __init jive_machine_init(void) static void __init jive_machine_init(void)
{ {
/* register system devices for managing low level suspend */ /* register system core operations for managing low level suspend */
sysdev_class_register(&jive_pm_sysclass); register_syscore_ops(&jive_pm_syscore_ops);
sysdev_register(&jive_pm_sysdev);
/* write our sleep configurations for the IO. Pull down all unused /* write our sleep configurations for the IO. Pull down all unused
* IO, ensure that we have turned off all peripherals we do not * IO, ensure that we have turned off all peripherals we do not

View File

@ -17,6 +17,7 @@
#include <linux/timer.h> #include <linux/timer.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/sysdev.h> #include <linux/sysdev.h>
#include <linux/syscore_ops.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/io.h> #include <linux/io.h>
@ -86,13 +87,24 @@ static struct sleep_save s3c2412_sleep[] = {
SAVE_ITEM(S3C2413_GPJSLPCON), SAVE_ITEM(S3C2413_GPJSLPCON),
}; };
static int s3c2412_pm_suspend(struct sys_device *dev, pm_message_t state) static struct sysdev_driver s3c2412_pm_driver = {
.add = s3c2412_pm_add,
};
static __init int s3c2412_pm_init(void)
{
return sysdev_driver_register(&s3c2412_sysclass, &s3c2412_pm_driver);
}
arch_initcall(s3c2412_pm_init);
static int s3c2412_pm_suspend(void)
{ {
s3c_pm_do_save(s3c2412_sleep, ARRAY_SIZE(s3c2412_sleep)); s3c_pm_do_save(s3c2412_sleep, ARRAY_SIZE(s3c2412_sleep));
return 0; return 0;
} }
static int s3c2412_pm_resume(struct sys_device *dev) static void s3c2412_pm_resume(void)
{ {
unsigned long tmp; unsigned long tmp;
@ -102,18 +114,9 @@ static int s3c2412_pm_resume(struct sys_device *dev)
__raw_writel(tmp, S3C2412_PWRCFG); __raw_writel(tmp, S3C2412_PWRCFG);
s3c_pm_do_restore(s3c2412_sleep, ARRAY_SIZE(s3c2412_sleep)); s3c_pm_do_restore(s3c2412_sleep, ARRAY_SIZE(s3c2412_sleep));
return 0;
} }
static struct sysdev_driver s3c2412_pm_driver = { struct syscore_ops s3c2412_pm_syscore_ops = {
.add = s3c2412_pm_add,
.suspend = s3c2412_pm_suspend, .suspend = s3c2412_pm_suspend,
.resume = s3c2412_pm_resume, .resume = s3c2412_pm_resume,
}; };
static __init int s3c2412_pm_init(void)
{
return sysdev_driver_register(&s3c2412_sysclass, &s3c2412_pm_driver);
}
arch_initcall(s3c2412_pm_init);

View File

@ -19,6 +19,7 @@
#include <linux/clk.h> #include <linux/clk.h>
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/sysdev.h> #include <linux/sysdev.h>
#include <linux/syscore_ops.h>
#include <linux/serial_core.h> #include <linux/serial_core.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/io.h> #include <linux/io.h>
@ -244,5 +245,8 @@ int __init s3c2412_init(void)
{ {
printk("S3C2412: Initialising architecture\n"); printk("S3C2412: Initialising architecture\n");
register_syscore_ops(&s3c2412_pm_syscore_ops);
register_syscore_ops(&s3c24xx_irq_syscore_ops);
return sysdev_register(&s3c2412_sysdev); return sysdev_register(&s3c2412_sysdev);
} }

View File

@ -236,8 +236,6 @@ static int __init s3c2416_irq_add(struct sys_device *sysdev)
static struct sysdev_driver s3c2416_irq_driver = { static struct sysdev_driver s3c2416_irq_driver = {
.add = s3c2416_irq_add, .add = s3c2416_irq_add,
.suspend = s3c24xx_irq_suspend,
.resume = s3c24xx_irq_resume,
}; };
static int __init s3c2416_irq_init(void) static int __init s3c2416_irq_init(void)

View File

@ -11,6 +11,7 @@
*/ */
#include <linux/sysdev.h> #include <linux/sysdev.h>
#include <linux/syscore_ops.h>
#include <linux/io.h> #include <linux/io.h>
#include <asm/cacheflush.h> #include <asm/cacheflush.h>
@ -55,25 +56,8 @@ static int s3c2416_pm_add(struct sys_device *sysdev)
return 0; return 0;
} }
static int s3c2416_pm_suspend(struct sys_device *dev, pm_message_t state)
{
return 0;
}
static int s3c2416_pm_resume(struct sys_device *dev)
{
/* unset the return-from-sleep amd inform flags */
__raw_writel(0x0, S3C2443_PWRMODE);
__raw_writel(0x0, S3C2412_INFORM0);
__raw_writel(0x0, S3C2412_INFORM1);
return 0;
}
static struct sysdev_driver s3c2416_pm_driver = { static struct sysdev_driver s3c2416_pm_driver = {
.add = s3c2416_pm_add, .add = s3c2416_pm_add,
.suspend = s3c2416_pm_suspend,
.resume = s3c2416_pm_resume,
}; };
static __init int s3c2416_pm_init(void) static __init int s3c2416_pm_init(void)
@ -82,3 +66,16 @@ static __init int s3c2416_pm_init(void)
} }
arch_initcall(s3c2416_pm_init); arch_initcall(s3c2416_pm_init);
static void s3c2416_pm_resume(void)
{
/* unset the return-from-sleep amd inform flags */
__raw_writel(0x0, S3C2443_PWRMODE);
__raw_writel(0x0, S3C2412_INFORM0);
__raw_writel(0x0, S3C2412_INFORM1);
}
struct syscore_ops s3c2416_pm_syscore_ops = {
.resume = s3c2416_pm_resume,
};

View File

@ -32,6 +32,7 @@
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/serial_core.h> #include <linux/serial_core.h>
#include <linux/sysdev.h> #include <linux/sysdev.h>
#include <linux/syscore_ops.h>
#include <linux/clk.h> #include <linux/clk.h>
#include <linux/io.h> #include <linux/io.h>
@ -54,6 +55,7 @@
#include <plat/devs.h> #include <plat/devs.h>
#include <plat/cpu.h> #include <plat/cpu.h>
#include <plat/sdhci.h> #include <plat/sdhci.h>
#include <plat/pm.h>
#include <plat/iic-core.h> #include <plat/iic-core.h>
#include <plat/fb-core.h> #include <plat/fb-core.h>
@ -95,6 +97,9 @@ int __init s3c2416_init(void)
s3c_fb_setname("s3c2443-fb"); s3c_fb_setname("s3c2443-fb");
register_syscore_ops(&s3c2416_pm_syscore_ops);
register_syscore_ops(&s3c24xx_irq_syscore_ops);
return sysdev_register(&s3c2416_sysdev); return sysdev_register(&s3c2416_sysdev);
} }

View File

@ -17,7 +17,7 @@
#include <linux/init.h> #include <linux/init.h>
#include <linux/gpio.h> #include <linux/gpio.h>
#include <linux/device.h> #include <linux/device.h>
#include <linux/sysdev.h> #include <linux/syscore_ops.h>
#include <linux/serial_core.h> #include <linux/serial_core.h>
#include <linux/clk.h> #include <linux/clk.h>
#include <linux/i2c.h> #include <linux/i2c.h>
@ -284,7 +284,7 @@ static struct platform_device osiris_pcmcia = {
#ifdef CONFIG_PM #ifdef CONFIG_PM
static unsigned char pm_osiris_ctrl0; static unsigned char pm_osiris_ctrl0;
static int osiris_pm_suspend(struct sys_device *sd, pm_message_t state) static int osiris_pm_suspend(void)
{ {
unsigned int tmp; unsigned int tmp;
@ -304,7 +304,7 @@ static int osiris_pm_suspend(struct sys_device *sd, pm_message_t state)
return 0; return 0;
} }
static int osiris_pm_resume(struct sys_device *sd) static void osiris_pm_resume(void)
{ {
if (pm_osiris_ctrl0 & OSIRIS_CTRL0_FIX8) if (pm_osiris_ctrl0 & OSIRIS_CTRL0_FIX8)
__raw_writeb(OSIRIS_CTRL1_FIX8, OSIRIS_VA_CTRL1); __raw_writeb(OSIRIS_CTRL1_FIX8, OSIRIS_VA_CTRL1);
@ -312,8 +312,6 @@ static int osiris_pm_resume(struct sys_device *sd)
__raw_writeb(pm_osiris_ctrl0, OSIRIS_VA_CTRL0); __raw_writeb(pm_osiris_ctrl0, OSIRIS_VA_CTRL0);
s3c_gpio_cfgpin(S3C2410_GPA(21), S3C2410_GPA21_nRSTOUT); s3c_gpio_cfgpin(S3C2410_GPA(21), S3C2410_GPA21_nRSTOUT);
return 0;
} }
#else #else
@ -321,16 +319,11 @@ static int osiris_pm_resume(struct sys_device *sd)
#define osiris_pm_resume NULL #define osiris_pm_resume NULL
#endif #endif
static struct sysdev_class osiris_pm_sysclass = { static struct syscore_ops osiris_pm_syscore_ops = {
.name = "mach-osiris",
.suspend = osiris_pm_suspend, .suspend = osiris_pm_suspend,
.resume = osiris_pm_resume, .resume = osiris_pm_resume,
}; };
static struct sys_device osiris_pm_sysdev = {
.cls = &osiris_pm_sysclass,
};
/* Link for DVS driver to TPS65011 */ /* Link for DVS driver to TPS65011 */
static void osiris_tps_release(struct device *dev) static void osiris_tps_release(struct device *dev)
@ -439,8 +432,7 @@ static void __init osiris_map_io(void)
static void __init osiris_init(void) static void __init osiris_init(void)
{ {
sysdev_class_register(&osiris_pm_sysclass); register_syscore_ops(&osiris_pm_syscore_ops);
sysdev_register(&osiris_pm_sysdev);
s3c_i2c0_set_platdata(NULL); s3c_i2c0_set_platdata(NULL);
s3c_nand_set_platdata(&osiris_nand_info); s3c_nand_set_platdata(&osiris_nand_info);

View File

@ -19,6 +19,7 @@
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/serial_core.h> #include <linux/serial_core.h>
#include <linux/sysdev.h> #include <linux/sysdev.h>
#include <linux/syscore_ops.h>
#include <linux/gpio.h> #include <linux/gpio.h>
#include <linux/clk.h> #include <linux/clk.h>
#include <linux/io.h> #include <linux/io.h>
@ -33,6 +34,7 @@
#include <plat/devs.h> #include <plat/devs.h>
#include <plat/cpu.h> #include <plat/cpu.h>
#include <plat/s3c244x.h> #include <plat/s3c244x.h>
#include <plat/pm.h>
#include <plat/gpio-core.h> #include <plat/gpio-core.h>
#include <plat/gpio-cfg.h> #include <plat/gpio-cfg.h>
@ -51,6 +53,12 @@ int __init s3c2440_init(void)
s3c_device_wdt.resource[1].start = IRQ_S3C2440_WDT; s3c_device_wdt.resource[1].start = IRQ_S3C2440_WDT;
s3c_device_wdt.resource[1].end = IRQ_S3C2440_WDT; s3c_device_wdt.resource[1].end = IRQ_S3C2440_WDT;
/* register suspend/resume handlers */
register_syscore_ops(&s3c2410_pm_syscore_ops);
register_syscore_ops(&s3c244x_pm_syscore_ops);
register_syscore_ops(&s3c24xx_irq_syscore_ops);
/* register our system device for everything else */ /* register our system device for everything else */
return sysdev_register(&s3c2440_sysdev); return sysdev_register(&s3c2440_sysdev);

View File

@ -29,6 +29,7 @@
#include <linux/err.h> #include <linux/err.h>
#include <linux/device.h> #include <linux/device.h>
#include <linux/sysdev.h> #include <linux/sysdev.h>
#include <linux/syscore_ops.h>
#include <linux/interrupt.h> #include <linux/interrupt.h>
#include <linux/ioport.h> #include <linux/ioport.h>
#include <linux/mutex.h> #include <linux/mutex.h>
@ -45,6 +46,7 @@
#include <plat/clock.h> #include <plat/clock.h>
#include <plat/cpu.h> #include <plat/cpu.h>
#include <plat/s3c244x.h> #include <plat/s3c244x.h>
#include <plat/pm.h>
#include <plat/gpio-core.h> #include <plat/gpio-core.h>
#include <plat/gpio-cfg.h> #include <plat/gpio-cfg.h>
@ -167,6 +169,10 @@ int __init s3c2442_init(void)
{ {
printk("S3C2442: Initialising architecture\n"); printk("S3C2442: Initialising architecture\n");
register_syscore_ops(&s3c2410_pm_syscore_ops);
register_syscore_ops(&s3c244x_pm_syscore_ops);
register_syscore_ops(&s3c24xx_irq_syscore_ops);
return sysdev_register(&s3c2442_sysdev); return sysdev_register(&s3c2442_sysdev);
} }

View File

@ -116,8 +116,6 @@ static int s3c244x_irq_add(struct sys_device *sysdev)
static struct sysdev_driver s3c2440_irq_driver = { static struct sysdev_driver s3c2440_irq_driver = {
.add = s3c244x_irq_add, .add = s3c244x_irq_add,
.suspend = s3c24xx_irq_suspend,
.resume = s3c24xx_irq_resume,
}; };
static int s3c2440_irq_init(void) static int s3c2440_irq_init(void)
@ -129,8 +127,6 @@ arch_initcall(s3c2440_irq_init);
static struct sysdev_driver s3c2442_irq_driver = { static struct sysdev_driver s3c2442_irq_driver = {
.add = s3c244x_irq_add, .add = s3c244x_irq_add,
.suspend = s3c24xx_irq_suspend,
.resume = s3c24xx_irq_resume,
}; };

View File

@ -19,6 +19,7 @@
#include <linux/serial_core.h> #include <linux/serial_core.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/sysdev.h> #include <linux/sysdev.h>
#include <linux/syscore_ops.h>
#include <linux/clk.h> #include <linux/clk.h>
#include <linux/io.h> #include <linux/io.h>
@ -134,45 +135,14 @@ void __init s3c244x_init_clocks(int xtal)
s3c2410_baseclk_add(); s3c2410_baseclk_add();
} }
#ifdef CONFIG_PM
static struct sleep_save s3c244x_sleep[] = {
SAVE_ITEM(S3C2440_DSC0),
SAVE_ITEM(S3C2440_DSC1),
SAVE_ITEM(S3C2440_GPJDAT),
SAVE_ITEM(S3C2440_GPJCON),
SAVE_ITEM(S3C2440_GPJUP)
};
static int s3c244x_suspend(struct sys_device *dev, pm_message_t state)
{
s3c_pm_do_save(s3c244x_sleep, ARRAY_SIZE(s3c244x_sleep));
return 0;
}
static int s3c244x_resume(struct sys_device *dev)
{
s3c_pm_do_restore(s3c244x_sleep, ARRAY_SIZE(s3c244x_sleep));
return 0;
}
#else
#define s3c244x_suspend NULL
#define s3c244x_resume NULL
#endif
/* Since the S3C2442 and S3C2440 share items, put both sysclasses here */ /* Since the S3C2442 and S3C2440 share items, put both sysclasses here */
struct sysdev_class s3c2440_sysclass = { struct sysdev_class s3c2440_sysclass = {
.name = "s3c2440-core", .name = "s3c2440-core",
.suspend = s3c244x_suspend,
.resume = s3c244x_resume
}; };
struct sysdev_class s3c2442_sysclass = { struct sysdev_class s3c2442_sysclass = {
.name = "s3c2442-core", .name = "s3c2442-core",
.suspend = s3c244x_suspend,
.resume = s3c244x_resume
}; };
/* need to register class before we actually register the device, and /* need to register class before we actually register the device, and
@ -194,3 +164,33 @@ static int __init s3c2442_core_init(void)
} }
core_initcall(s3c2442_core_init); core_initcall(s3c2442_core_init);
#ifdef CONFIG_PM
static struct sleep_save s3c244x_sleep[] = {
SAVE_ITEM(S3C2440_DSC0),
SAVE_ITEM(S3C2440_DSC1),
SAVE_ITEM(S3C2440_GPJDAT),
SAVE_ITEM(S3C2440_GPJCON),
SAVE_ITEM(S3C2440_GPJUP)
};
static int s3c244x_suspend(void)
{
s3c_pm_do_save(s3c244x_sleep, ARRAY_SIZE(s3c244x_sleep));
return 0;
}
static void s3c244x_resume(void)
{
s3c_pm_do_restore(s3c244x_sleep, ARRAY_SIZE(s3c244x_sleep));
}
#else
#define s3c244x_suspend NULL
#define s3c244x_resume NULL
#endif
struct syscore_ops s3c244x_pm_syscore_ops = {
.suspend = s3c244x_suspend,
.resume = s3c244x_resume,
};

View File

@ -13,7 +13,7 @@
*/ */
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/sysdev.h> #include <linux/syscore_ops.h>
#include <linux/interrupt.h> #include <linux/interrupt.h>
#include <linux/serial_core.h> #include <linux/serial_core.h>
#include <linux/irq.h> #include <linux/irq.h>
@ -54,7 +54,7 @@ static struct irq_grp_save {
static u32 irq_uart_mask[CONFIG_SERIAL_SAMSUNG_UARTS]; static u32 irq_uart_mask[CONFIG_SERIAL_SAMSUNG_UARTS];
static int s3c64xx_irq_pm_suspend(struct sys_device *dev, pm_message_t state) static int s3c64xx_irq_pm_suspend(void)
{ {
struct irq_grp_save *grp = eint_grp_save; struct irq_grp_save *grp = eint_grp_save;
int i; int i;
@ -75,7 +75,7 @@ static int s3c64xx_irq_pm_suspend(struct sys_device *dev, pm_message_t state)
return 0; return 0;
} }
static int s3c64xx_irq_pm_resume(struct sys_device *dev) static void s3c64xx_irq_pm_resume(void)
{ {
struct irq_grp_save *grp = eint_grp_save; struct irq_grp_save *grp = eint_grp_save;
int i; int i;
@ -94,18 +94,18 @@ static int s3c64xx_irq_pm_resume(struct sys_device *dev)
} }
S3C_PMDBG("%s: IRQ configuration restored\n", __func__); S3C_PMDBG("%s: IRQ configuration restored\n", __func__);
return 0;
} }
static struct sysdev_driver s3c64xx_irq_driver = { struct syscore_ops s3c64xx_irq_syscore_ops = {
.suspend = s3c64xx_irq_pm_suspend, .suspend = s3c64xx_irq_pm_suspend,
.resume = s3c64xx_irq_pm_resume, .resume = s3c64xx_irq_pm_resume,
}; };
static int __init s3c64xx_irq_pm_init(void) static __init int s3c64xx_syscore_init(void)
{ {
return sysdev_driver_register(&s3c64xx_sysclass, &s3c64xx_irq_driver); register_syscore_ops(&s3c64xx_irq_syscore_ops);
return 0;
} }
arch_initcall(s3c64xx_irq_pm_init); core_initcall(s3c64xx_syscore_init);

View File

@ -16,6 +16,7 @@
#include <linux/init.h> #include <linux/init.h>
#include <linux/suspend.h> #include <linux/suspend.h>
#include <linux/syscore_ops.h>
#include <linux/io.h> #include <linux/io.h>
#include <plat/cpu.h> #include <plat/cpu.h>
@ -140,7 +141,17 @@ static int s5pv210_pm_add(struct sys_device *sysdev)
return 0; return 0;
} }
static int s5pv210_pm_resume(struct sys_device *dev) static struct sysdev_driver s5pv210_pm_driver = {
.add = s5pv210_pm_add,
};
static __init int s5pv210_pm_drvinit(void)
{
return sysdev_driver_register(&s5pv210_sysclass, &s5pv210_pm_driver);
}
arch_initcall(s5pv210_pm_drvinit);
static void s5pv210_pm_resume(void)
{ {
u32 tmp; u32 tmp;
@ -150,17 +161,15 @@ static int s5pv210_pm_resume(struct sys_device *dev)
__raw_writel(tmp , S5P_OTHERS); __raw_writel(tmp , S5P_OTHERS);
s3c_pm_do_restore_core(s5pv210_core_save, ARRAY_SIZE(s5pv210_core_save)); s3c_pm_do_restore_core(s5pv210_core_save, ARRAY_SIZE(s5pv210_core_save));
return 0;
} }
static struct sysdev_driver s5pv210_pm_driver = { static struct syscore_ops s5pv210_pm_syscore_ops = {
.add = s5pv210_pm_add,
.resume = s5pv210_pm_resume, .resume = s5pv210_pm_resume,
}; };
static __init int s5pv210_pm_drvinit(void) static __init int s5pv210_pm_syscore_init(void)
{ {
return sysdev_driver_register(&s5pv210_sysclass, &s5pv210_pm_driver); register_syscore_ops(&s5pv210_pm_syscore_ops);
return 0;
} }
arch_initcall(s5pv210_pm_drvinit); arch_initcall(s5pv210_pm_syscore_init);

View File

@ -22,7 +22,7 @@
#include <linux/sched.h> #include <linux/sched.h>
#include <linux/spinlock.h> #include <linux/spinlock.h>
#include <linux/interrupt.h> #include <linux/interrupt.h>
#include <linux/sysdev.h> #include <linux/syscore_ops.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/errno.h> #include <linux/errno.h>
#include <linux/io.h> #include <linux/io.h>
@ -1195,19 +1195,12 @@ int s3c2410_dma_getposition(unsigned int channel, dma_addr_t *src, dma_addr_t *d
EXPORT_SYMBOL(s3c2410_dma_getposition); EXPORT_SYMBOL(s3c2410_dma_getposition);
static inline struct s3c2410_dma_chan *to_dma_chan(struct sys_device *dev) /* system core operations */
{
return container_of(dev, struct s3c2410_dma_chan, dev);
}
/* system device class */
#ifdef CONFIG_PM #ifdef CONFIG_PM
static int s3c2410_dma_suspend(struct sys_device *dev, pm_message_t state) static void s3c2410_dma_suspend_chan(s3c2410_dma_chan *cp)
{ {
struct s3c2410_dma_chan *cp = to_dma_chan(dev);
printk(KERN_DEBUG "suspending dma channel %d\n", cp->number); printk(KERN_DEBUG "suspending dma channel %d\n", cp->number);
if (dma_rdreg(cp, S3C2410_DMA_DMASKTRIG) & S3C2410_DMASKTRIG_ON) { if (dma_rdreg(cp, S3C2410_DMA_DMASKTRIG) & S3C2410_DMASKTRIG_ON) {
@ -1222,13 +1215,21 @@ static int s3c2410_dma_suspend(struct sys_device *dev, pm_message_t state)
s3c2410_dma_dostop(cp); s3c2410_dma_dostop(cp);
} }
}
static int s3c2410_dma_suspend(void)
{
struct s3c2410_dma_chan *cp = s3c2410_chans;
int channel;
for (channel = 0; channel < dma_channels; cp++, channel++)
s3c2410_dma_suspend_chan(cp);
return 0; return 0;
} }
static int s3c2410_dma_resume(struct sys_device *dev) static void s3c2410_dma_resume_chan(struct s3c2410_dma_chan *cp)
{ {
struct s3c2410_dma_chan *cp = to_dma_chan(dev);
unsigned int no = cp->number | DMACH_LOW_LEVEL; unsigned int no = cp->number | DMACH_LOW_LEVEL;
/* restore channel's hardware configuration */ /* restore channel's hardware configuration */
@ -1249,13 +1250,21 @@ static int s3c2410_dma_resume(struct sys_device *dev)
return 0; return 0;
} }
static void s3c2410_dma_resume(void)
{
struct s3c2410_dma_chan *cp = s3c2410_chans + dma_channels - 1;
int channel;
for (channel = dma_channels - 1; channel >= 0; cp++, channel--)
s3c2410_dma_resume_chan(cp);
}
#else #else
#define s3c2410_dma_suspend NULL #define s3c2410_dma_suspend NULL
#define s3c2410_dma_resume NULL #define s3c2410_dma_resume NULL
#endif /* CONFIG_PM */ #endif /* CONFIG_PM */
struct sysdev_class dma_sysclass = { struct syscore_ops dma_syscore_ops = {
.name = "s3c24xx-dma",
.suspend = s3c2410_dma_suspend, .suspend = s3c2410_dma_suspend,
.resume = s3c2410_dma_resume, .resume = s3c2410_dma_resume,
}; };
@ -1269,39 +1278,14 @@ static void s3c2410_dma_cache_ctor(void *p)
/* initialisation code */ /* initialisation code */
static int __init s3c24xx_dma_sysclass_init(void) static int __init s3c24xx_dma_syscore_init(void)
{ {
int ret = sysdev_class_register(&dma_sysclass); register_syscore_ops(&dma_syscore_ops);
if (ret != 0)
printk(KERN_ERR "dma sysclass registration failed\n");
return ret;
}
core_initcall(s3c24xx_dma_sysclass_init);
static int __init s3c24xx_dma_sysdev_register(void)
{
struct s3c2410_dma_chan *cp = s3c2410_chans;
int channel, ret;
for (channel = 0; channel < dma_channels; cp++, channel++) {
cp->dev.cls = &dma_sysclass;
cp->dev.id = channel;
ret = sysdev_register(&cp->dev);
if (ret) {
printk(KERN_ERR "error registering dev for dma %d\n",
channel);
return ret;
}
}
return 0; return 0;
} }
late_initcall(s3c24xx_dma_sysdev_register); late_initcall(s3c24xx_dma_syscore_init);
int __init s3c24xx_dma_init(unsigned int channels, unsigned int irq, int __init s3c24xx_dma_init(unsigned int channels, unsigned int irq,
unsigned int stride) unsigned int stride)

View File

@ -14,7 +14,6 @@
#include <linux/init.h> #include <linux/init.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/interrupt.h> #include <linux/interrupt.h>
#include <linux/sysdev.h>
#include <linux/irq.h> #include <linux/irq.h>
#include <plat/cpu.h> #include <plat/cpu.h>
@ -65,7 +64,7 @@ static unsigned long save_extint[3];
static unsigned long save_eintflt[4]; static unsigned long save_eintflt[4];
static unsigned long save_eintmask; static unsigned long save_eintmask;
int s3c24xx_irq_suspend(struct sys_device *dev, pm_message_t state) int s3c24xx_irq_suspend(void)
{ {
unsigned int i; unsigned int i;
@ -81,7 +80,7 @@ int s3c24xx_irq_suspend(struct sys_device *dev, pm_message_t state)
return 0; return 0;
} }
int s3c24xx_irq_resume(struct sys_device *dev) void s3c24xx_irq_resume(void)
{ {
unsigned int i; unsigned int i;
@ -93,6 +92,4 @@ int s3c24xx_irq_resume(struct sys_device *dev)
s3c_pm_do_restore(irq_save, ARRAY_SIZE(irq_save)); s3c_pm_do_restore(irq_save, ARRAY_SIZE(irq_save));
__raw_writel(save_eintmask, S3C24XX_EINTMASK); __raw_writel(save_eintmask, S3C24XX_EINTMASK);
return 0;
} }

View File

@ -16,7 +16,6 @@
#include <linux/init.h> #include <linux/init.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/interrupt.h> #include <linux/interrupt.h>
#include <linux/sysdev.h>
#include <plat/cpu.h> #include <plat/cpu.h>
#include <plat/irqs.h> #include <plat/irqs.h>
@ -77,17 +76,15 @@ static struct sleep_save eint_save[] = {
SAVE_ITEM(S5P_EINT_MASK(3)), SAVE_ITEM(S5P_EINT_MASK(3)),
}; };
int s3c24xx_irq_suspend(struct sys_device *dev, pm_message_t state) int s3c24xx_irq_suspend(void)
{ {
s3c_pm_do_save(eint_save, ARRAY_SIZE(eint_save)); s3c_pm_do_save(eint_save, ARRAY_SIZE(eint_save));
return 0; return 0;
} }
int s3c24xx_irq_resume(struct sys_device *dev) void s3c24xx_irq_resume(void)
{ {
s3c_pm_do_restore(eint_save, ARRAY_SIZE(eint_save)); s3c_pm_do_restore(eint_save, ARRAY_SIZE(eint_save));
return 0;
} }

View File

@ -68,6 +68,12 @@ extern void s3c24xx_init_uartdevs(char *name,
struct sys_timer; struct sys_timer;
extern struct sys_timer s3c24xx_timer; extern struct sys_timer s3c24xx_timer;
extern struct syscore_ops s3c2410_pm_syscore_ops;
extern struct syscore_ops s3c2412_pm_syscore_ops;
extern struct syscore_ops s3c2416_pm_syscore_ops;
extern struct syscore_ops s3c244x_pm_syscore_ops;
extern struct syscore_ops s3c64xx_irq_syscore_ops;
/* system device classes */ /* system device classes */
extern struct sysdev_class s3c2410_sysclass; extern struct sysdev_class s3c2410_sysclass;

View File

@ -103,14 +103,16 @@ extern void s3c_pm_do_restore_core(struct sleep_save *ptr, int count);
#ifdef CONFIG_PM #ifdef CONFIG_PM
extern int s3c_irqext_wake(struct irq_data *data, unsigned int state); extern int s3c_irqext_wake(struct irq_data *data, unsigned int state);
extern int s3c24xx_irq_suspend(struct sys_device *dev, pm_message_t state); extern int s3c24xx_irq_suspend(void);
extern int s3c24xx_irq_resume(struct sys_device *dev); extern void s3c24xx_irq_resume(void);
#else #else
#define s3c_irqext_wake NULL #define s3c_irqext_wake NULL
#define s3c24xx_irq_suspend NULL #define s3c24xx_irq_suspend NULL
#define s3c24xx_irq_resume NULL #define s3c24xx_irq_resume NULL
#endif #endif
extern struct syscore_ops s3c24xx_irq_syscore_ops;
/* PM debug functions */ /* PM debug functions */
#ifdef CONFIG_SAMSUNG_PM_DEBUG #ifdef CONFIG_SAMSUNG_PM_DEBUG