aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorRafael J. Wysocki <rjw@sisk.pl>2011-04-22 16:03:21 -0400
committerRafael J. Wysocki <rjw@sisk.pl>2011-04-24 13:16:10 -0400
commitbb072c3cf21d1c9a5a2eeb5a00679ee7bf39675b (patch)
tree8b9b425422e11c5cb5012adf68e9e2a3e957358f /arch
parent2eaa03b5bebd1e80014f780d7bf27c3e66daefd6 (diff)
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>
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/mach-exynos4/pm.c45
-rw-r--r--arch/arm/mach-s3c2410/irq.c30
-rw-r--r--arch/arm/mach-s3c2410/mach-bast.c17
-rw-r--r--arch/arm/mach-s3c2410/pm.c13
-rw-r--r--arch/arm/mach-s3c2410/s3c2410.c5
-rw-r--r--arch/arm/mach-s3c2412/irq.c2
-rw-r--r--arch/arm/mach-s3c2412/mach-jive.c19
-rw-r--r--arch/arm/mach-s3c2412/pm.c27
-rw-r--r--arch/arm/mach-s3c2412/s3c2412.c4
-rw-r--r--arch/arm/mach-s3c2416/irq.c2
-rw-r--r--arch/arm/mach-s3c2416/pm.c27
-rw-r--r--arch/arm/mach-s3c2416/s3c2416.c5
-rw-r--r--arch/arm/mach-s3c2440/mach-osiris.c18
-rw-r--r--arch/arm/mach-s3c2440/s3c2440.c8
-rw-r--r--arch/arm/mach-s3c2440/s3c2442.c6
-rw-r--r--arch/arm/mach-s3c2440/s3c244x-irq.c4
-rw-r--r--arch/arm/mach-s3c2440/s3c244x.c62
-rw-r--r--arch/arm/mach-s3c64xx/irq-pm.c18
-rw-r--r--arch/arm/mach-s5pv210/pm.c25
-rw-r--r--arch/arm/plat-s3c24xx/dma.c68
-rw-r--r--arch/arm/plat-s3c24xx/irq-pm.c7
-rw-r--r--arch/arm/plat-s5p/irq-pm.c7
-rw-r--r--arch/arm/plat-samsung/include/plat/cpu.h6
-rw-r--r--arch/arm/plat-samsung/include/plat/pm.h6
24 files changed, 203 insertions, 228 deletions
diff --git a/arch/arm/mach-exynos4/pm.c b/arch/arm/mach-exynos4/pm.c
index 10d917d9e3ad..8755ca8dd48d 100644
--- a/arch/arm/mach-exynos4/pm.c
+++ b/arch/arm/mach-exynos4/pm.c
@@ -16,6 +16,7 @@
16 16
17#include <linux/init.h> 17#include <linux/init.h>
18#include <linux/suspend.h> 18#include <linux/suspend.h>
19#include <linux/syscore_ops.h>
19#include <linux/io.h> 20#include <linux/io.h>
20 21
21#include <asm/cacheflush.h> 22#include <asm/cacheflush.h>
@@ -372,7 +373,27 @@ void exynos4_scu_enable(void __iomem *scu_base)
372 flush_cache_all(); 373 flush_cache_all();
373} 374}
374 375
375static int exynos4_pm_resume(struct sys_device *dev) 376static struct sysdev_driver exynos4_pm_driver = {
377 .add = exynos4_pm_add,
378};
379
380static __init int exynos4_pm_drvinit(void)
381{
382 unsigned int tmp;
383
384 s3c_pm_init();
385
386 /* All wakeup disable */
387
388 tmp = __raw_readl(S5P_WAKEUP_MASK);
389 tmp |= ((0xFF << 8) | (0x1F << 1));
390 __raw_writel(tmp, S5P_WAKEUP_MASK);
391
392 return sysdev_driver_register(&exynos4_sysclass, &exynos4_pm_driver);
393}
394arch_initcall(exynos4_pm_drvinit);
395
396static void exynos4_pm_resume(void)
376{ 397{
377 /* For release retention */ 398 /* For release retention */
378 399
@@ -394,27 +415,15 @@ static int exynos4_pm_resume(struct sys_device *dev)
394 /* enable L2X0*/ 415 /* enable L2X0*/
395 writel_relaxed(1, S5P_VA_L2CC + L2X0_CTRL); 416 writel_relaxed(1, S5P_VA_L2CC + L2X0_CTRL);
396#endif 417#endif
397
398 return 0;
399} 418}
400 419
401static struct sysdev_driver exynos4_pm_driver = { 420static struct syscore_ops exynos4_pm_syscore_ops = {
402 .add = exynos4_pm_add,
403 .resume = exynos4_pm_resume, 421 .resume = exynos4_pm_resume,
404}; 422};
405 423
406static __init int exynos4_pm_drvinit(void) 424static __init int exynos4_pm_syscore_init(void)
407{ 425{
408 unsigned int tmp; 426 register_syscore_ops(&exynos4_pm_syscore_ops);
409 427 return 0;
410 s3c_pm_init();
411
412 /* All wakeup disable */
413
414 tmp = __raw_readl(S5P_WAKEUP_MASK);
415 tmp |= ((0xFF << 8) | (0x1F << 1));
416 __raw_writel(tmp, S5P_WAKEUP_MASK);
417
418 return sysdev_driver_register(&exynos4_sysclass, &exynos4_pm_driver);
419} 428}
420arch_initcall(exynos4_pm_drvinit); 429arch_initcall(exynos4_pm_syscore_init);
diff --git a/arch/arm/mach-s3c2410/irq.c b/arch/arm/mach-s3c2410/irq.c
index 5e2f35332056..2854129f8cc7 100644
--- a/arch/arm/mach-s3c2410/irq.c
+++ b/arch/arm/mach-s3c2410/irq.c
@@ -23,38 +23,12 @@
23#include <linux/module.h> 23#include <linux/module.h>
24#include <linux/interrupt.h> 24#include <linux/interrupt.h>
25#include <linux/ioport.h> 25#include <linux/ioport.h>
26#include <linux/sysdev.h> 26#include <linux/syscore_ops.h>
27 27
28#include <plat/cpu.h> 28#include <plat/cpu.h>
29#include <plat/pm.h> 29#include <plat/pm.h>
30 30
31static int s3c2410_irq_add(struct sys_device *sysdev) 31struct syscore_ops s3c24xx_irq_syscore_ops = {
32{
33 return 0;
34}
35
36static struct sysdev_driver s3c2410_irq_driver = {
37 .add = s3c2410_irq_add,
38 .suspend = s3c24xx_irq_suspend, 32 .suspend = s3c24xx_irq_suspend,
39 .resume = s3c24xx_irq_resume, 33 .resume = s3c24xx_irq_resume,
40}; 34};
41
42static int __init s3c2410_irq_init(void)
43{
44 return sysdev_driver_register(&s3c2410_sysclass, &s3c2410_irq_driver);
45}
46
47arch_initcall(s3c2410_irq_init);
48
49static struct sysdev_driver s3c2410a_irq_driver = {
50 .add = s3c2410_irq_add,
51 .suspend = s3c24xx_irq_suspend,
52 .resume = s3c24xx_irq_resume,
53};
54
55static int __init s3c2410a_irq_init(void)
56{
57 return sysdev_driver_register(&s3c2410a_sysclass, &s3c2410a_irq_driver);
58}
59
60arch_initcall(s3c2410a_irq_init);
diff --git a/arch/arm/mach-s3c2410/mach-bast.c b/arch/arm/mach-s3c2410/mach-bast.c
index 2970ea9f7c2b..1e2d536adda9 100644
--- a/arch/arm/mach-s3c2410/mach-bast.c
+++ b/arch/arm/mach-s3c2410/mach-bast.c
@@ -17,7 +17,7 @@
17#include <linux/timer.h> 17#include <linux/timer.h>
18#include <linux/init.h> 18#include <linux/init.h>
19#include <linux/gpio.h> 19#include <linux/gpio.h>
20#include <linux/sysdev.h> 20#include <linux/syscore_ops.h>
21#include <linux/serial_core.h> 21#include <linux/serial_core.h>
22#include <linux/platform_device.h> 22#include <linux/platform_device.h>
23#include <linux/dm9000.h> 23#include <linux/dm9000.h>
@@ -214,17 +214,16 @@ static struct s3c2410_uartcfg bast_uartcfgs[] __initdata = {
214/* NAND Flash on BAST board */ 214/* NAND Flash on BAST board */
215 215
216#ifdef CONFIG_PM 216#ifdef CONFIG_PM
217static int bast_pm_suspend(struct sys_device *sd, pm_message_t state) 217static int bast_pm_suspend(void)
218{ 218{
219 /* ensure that an nRESET is not generated on resume. */ 219 /* ensure that an nRESET is not generated on resume. */
220 gpio_direction_output(S3C2410_GPA(21), 1); 220 gpio_direction_output(S3C2410_GPA(21), 1);
221 return 0; 221 return 0;
222} 222}
223 223
224static int bast_pm_resume(struct sys_device *sd) 224static void bast_pm_resume(void)
225{ 225{
226 s3c_gpio_cfgpin(S3C2410_GPA(21), S3C2410_GPA21_nRSTOUT); 226 s3c_gpio_cfgpin(S3C2410_GPA(21), S3C2410_GPA21_nRSTOUT);
227 return 0;
228} 227}
229 228
230#else 229#else
@@ -232,16 +231,11 @@ static int bast_pm_resume(struct sys_device *sd)
232#define bast_pm_resume NULL 231#define bast_pm_resume NULL
233#endif 232#endif
234 233
235static struct sysdev_class bast_pm_sysclass = { 234static struct syscore_ops bast_pm_syscore_ops = {
236 .name = "mach-bast",
237 .suspend = bast_pm_suspend, 235 .suspend = bast_pm_suspend,
238 .resume = bast_pm_resume, 236 .resume = bast_pm_resume,
239}; 237};
240 238
241static struct sys_device bast_pm_sysdev = {
242 .cls = &bast_pm_sysclass,
243};
244
245static int smartmedia_map[] = { 0 }; 239static int smartmedia_map[] = { 0 };
246static int chip0_map[] = { 1 }; 240static int chip0_map[] = { 1 };
247static int chip1_map[] = { 2 }; 241static int chip1_map[] = { 2 };
@@ -642,8 +636,7 @@ static void __init bast_map_io(void)
642 636
643static void __init bast_init(void) 637static void __init bast_init(void)
644{ 638{
645 sysdev_class_register(&bast_pm_sysclass); 639 register_syscore_ops(&bast_pm_syscore_ops);
646 sysdev_register(&bast_pm_sysdev);
647 640
648 s3c_i2c0_set_platdata(&bast_i2c_info); 641 s3c_i2c0_set_platdata(&bast_i2c_info);
649 s3c_nand_set_platdata(&bast_nand_info); 642 s3c_nand_set_platdata(&bast_nand_info);
diff --git a/arch/arm/mach-s3c2410/pm.c b/arch/arm/mach-s3c2410/pm.c
index 725636fc4dc3..4728f9aa7df1 100644
--- a/arch/arm/mach-s3c2410/pm.c
+++ b/arch/arm/mach-s3c2410/pm.c
@@ -25,6 +25,7 @@
25#include <linux/errno.h> 25#include <linux/errno.h>
26#include <linux/time.h> 26#include <linux/time.h>
27#include <linux/sysdev.h> 27#include <linux/sysdev.h>
28#include <linux/syscore_ops.h>
28#include <linux/gpio.h> 29#include <linux/gpio.h>
29#include <linux/io.h> 30#include <linux/io.h>
30 31
@@ -92,7 +93,7 @@ static void s3c2410_pm_prepare(void)
92 } 93 }
93} 94}
94 95
95static int s3c2410_pm_resume(struct sys_device *dev) 96static void s3c2410_pm_resume(void)
96{ 97{
97 unsigned long tmp; 98 unsigned long tmp;
98 99
@@ -104,10 +105,12 @@ static int s3c2410_pm_resume(struct sys_device *dev)
104 105
105 if ( machine_is_aml_m5900() ) 106 if ( machine_is_aml_m5900() )
106 s3c2410_gpio_setpin(S3C2410_GPF(2), 0); 107 s3c2410_gpio_setpin(S3C2410_GPF(2), 0);
107
108 return 0;
109} 108}
110 109
110struct syscore_ops s3c2410_pm_syscore_ops = {
111 .resume = s3c2410_pm_resume,
112};
113
111static int s3c2410_pm_add(struct sys_device *dev) 114static int s3c2410_pm_add(struct sys_device *dev)
112{ 115{
113 pm_cpu_prep = s3c2410_pm_prepare; 116 pm_cpu_prep = s3c2410_pm_prepare;
@@ -119,7 +122,6 @@ static int s3c2410_pm_add(struct sys_device *dev)
119#if defined(CONFIG_CPU_S3C2410) 122#if defined(CONFIG_CPU_S3C2410)
120static struct sysdev_driver s3c2410_pm_driver = { 123static struct sysdev_driver s3c2410_pm_driver = {
121 .add = s3c2410_pm_add, 124 .add = s3c2410_pm_add,
122 .resume = s3c2410_pm_resume,
123}; 125};
124 126
125/* register ourselves */ 127/* register ourselves */
@@ -133,7 +135,6 @@ arch_initcall(s3c2410_pm_drvinit);
133 135
134static struct sysdev_driver s3c2410a_pm_driver = { 136static struct sysdev_driver s3c2410a_pm_driver = {
135 .add = s3c2410_pm_add, 137 .add = s3c2410_pm_add,
136 .resume = s3c2410_pm_resume,
137}; 138};
138 139
139static int __init s3c2410a_pm_drvinit(void) 140static int __init s3c2410a_pm_drvinit(void)
@@ -147,7 +148,6 @@ arch_initcall(s3c2410a_pm_drvinit);
147#if defined(CONFIG_CPU_S3C2440) 148#if defined(CONFIG_CPU_S3C2440)
148static struct sysdev_driver s3c2440_pm_driver = { 149static struct sysdev_driver s3c2440_pm_driver = {
149 .add = s3c2410_pm_add, 150 .add = s3c2410_pm_add,
150 .resume = s3c2410_pm_resume,
151}; 151};
152 152
153static int __init s3c2440_pm_drvinit(void) 153static int __init s3c2440_pm_drvinit(void)
@@ -161,7 +161,6 @@ arch_initcall(s3c2440_pm_drvinit);
161#if defined(CONFIG_CPU_S3C2442) 161#if defined(CONFIG_CPU_S3C2442)
162static struct sysdev_driver s3c2442_pm_driver = { 162static struct sysdev_driver s3c2442_pm_driver = {
163 .add = s3c2410_pm_add, 163 .add = s3c2410_pm_add,
164 .resume = s3c2410_pm_resume,
165}; 164};
166 165
167static int __init s3c2442_pm_drvinit(void) 166static int __init s3c2442_pm_drvinit(void)
diff --git a/arch/arm/mach-s3c2410/s3c2410.c b/arch/arm/mach-s3c2410/s3c2410.c
index adc90a3c5890..f1d3bd8f6f17 100644
--- a/arch/arm/mach-s3c2410/s3c2410.c
+++ b/arch/arm/mach-s3c2410/s3c2410.c
@@ -19,6 +19,7 @@
19#include <linux/gpio.h> 19#include <linux/gpio.h>
20#include <linux/clk.h> 20#include <linux/clk.h>
21#include <linux/sysdev.h> 21#include <linux/sysdev.h>
22#include <linux/syscore_ops.h>
22#include <linux/serial_core.h> 23#include <linux/serial_core.h>
23#include <linux/platform_device.h> 24#include <linux/platform_device.h>
24#include <linux/io.h> 25#include <linux/io.h>
@@ -40,6 +41,7 @@
40#include <plat/devs.h> 41#include <plat/devs.h>
41#include <plat/clock.h> 42#include <plat/clock.h>
42#include <plat/pll.h> 43#include <plat/pll.h>
44#include <plat/pm.h>
43 45
44#include <plat/gpio-core.h> 46#include <plat/gpio-core.h>
45#include <plat/gpio-cfg.h> 47#include <plat/gpio-cfg.h>
@@ -168,6 +170,9 @@ int __init s3c2410_init(void)
168{ 170{
169 printk("S3C2410: Initialising architecture\n"); 171 printk("S3C2410: Initialising architecture\n");
170 172
173 register_syscore_ops(&s3c2410_pm_syscore_ops);
174 register_syscore_ops(&s3c24xx_irq_syscore_ops);
175
171 return sysdev_register(&s3c2410_sysdev); 176 return sysdev_register(&s3c2410_sysdev);
172} 177}
173 178
diff --git a/arch/arm/mach-s3c2412/irq.c b/arch/arm/mach-s3c2412/irq.c
index f3355d2ec634..1a1aa220972b 100644
--- a/arch/arm/mach-s3c2412/irq.c
+++ b/arch/arm/mach-s3c2412/irq.c
@@ -202,8 +202,6 @@ static int s3c2412_irq_add(struct sys_device *sysdev)
202 202
203static struct sysdev_driver s3c2412_irq_driver = { 203static struct sysdev_driver s3c2412_irq_driver = {
204 .add = s3c2412_irq_add, 204 .add = s3c2412_irq_add,
205 .suspend = s3c24xx_irq_suspend,
206 .resume = s3c24xx_irq_resume,
207}; 205};
208 206
209static int s3c2412_irq_init(void) 207static int s3c2412_irq_init(void)
diff --git a/arch/arm/mach-s3c2412/mach-jive.c b/arch/arm/mach-s3c2412/mach-jive.c
index 923e01bdf017..85dcaeb9e62f 100644
--- a/arch/arm/mach-s3c2412/mach-jive.c
+++ b/arch/arm/mach-s3c2412/mach-jive.c
@@ -17,7 +17,7 @@
17#include <linux/timer.h> 17#include <linux/timer.h>
18#include <linux/init.h> 18#include <linux/init.h>
19#include <linux/gpio.h> 19#include <linux/gpio.h>
20#include <linux/sysdev.h> 20#include <linux/syscore_ops.h>
21#include <linux/serial_core.h> 21#include <linux/serial_core.h>
22#include <linux/platform_device.h> 22#include <linux/platform_device.h>
23#include <linux/i2c.h> 23#include <linux/i2c.h>
@@ -486,7 +486,7 @@ static struct s3c2410_udc_mach_info jive_udc_cfg __initdata = {
486/* Jive power management device */ 486/* Jive power management device */
487 487
488#ifdef CONFIG_PM 488#ifdef CONFIG_PM
489static int jive_pm_suspend(struct sys_device *sd, pm_message_t state) 489static int jive_pm_suspend(void)
490{ 490{
491 /* Write the magic value u-boot uses to check for resume into 491 /* Write the magic value u-boot uses to check for resume into
492 * the INFORM0 register, and ensure INFORM1 is set to the 492 * 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)
498 return 0; 498 return 0;
499} 499}
500 500
501static int jive_pm_resume(struct sys_device *sd) 501static void jive_pm_resume(void)
502{ 502{
503 __raw_writel(0x0, S3C2412_INFORM0); 503 __raw_writel(0x0, S3C2412_INFORM0);
504 return 0;
505} 504}
506 505
507#else 506#else
@@ -509,16 +508,11 @@ static int jive_pm_resume(struct sys_device *sd)
509#define jive_pm_resume NULL 508#define jive_pm_resume NULL
510#endif 509#endif
511 510
512static struct sysdev_class jive_pm_sysclass = { 511static struct syscore_ops jive_pm_syscore_ops = {
513 .name = "jive-pm",
514 .suspend = jive_pm_suspend, 512 .suspend = jive_pm_suspend,
515 .resume = jive_pm_resume, 513 .resume = jive_pm_resume,
516}; 514};
517 515
518static struct sys_device jive_pm_sysdev = {
519 .cls = &jive_pm_sysclass,
520};
521
522static void __init jive_map_io(void) 516static void __init jive_map_io(void)
523{ 517{
524 s3c24xx_init_io(jive_iodesc, ARRAY_SIZE(jive_iodesc)); 518 s3c24xx_init_io(jive_iodesc, ARRAY_SIZE(jive_iodesc));
@@ -536,10 +530,9 @@ static void jive_power_off(void)
536 530
537static void __init jive_machine_init(void) 531static void __init jive_machine_init(void)
538{ 532{
539 /* register system devices for managing low level suspend */ 533 /* register system core operations for managing low level suspend */
540 534
541 sysdev_class_register(&jive_pm_sysclass); 535 register_syscore_ops(&jive_pm_syscore_ops);
542 sysdev_register(&jive_pm_sysdev);
543 536
544 /* write our sleep configurations for the IO. Pull down all unused 537 /* write our sleep configurations for the IO. Pull down all unused
545 * IO, ensure that we have turned off all peripherals we do not 538 * IO, ensure that we have turned off all peripherals we do not
diff --git a/arch/arm/mach-s3c2412/pm.c b/arch/arm/mach-s3c2412/pm.c
index a7417c479ffe..752b13a7b3db 100644
--- a/arch/arm/mach-s3c2412/pm.c
+++ b/arch/arm/mach-s3c2412/pm.c
@@ -17,6 +17,7 @@
17#include <linux/timer.h> 17#include <linux/timer.h>
18#include <linux/init.h> 18#include <linux/init.h>
19#include <linux/sysdev.h> 19#include <linux/sysdev.h>
20#include <linux/syscore_ops.h>
20#include <linux/platform_device.h> 21#include <linux/platform_device.h>
21#include <linux/io.h> 22#include <linux/io.h>
22 23
@@ -86,13 +87,24 @@ static struct sleep_save s3c2412_sleep[] = {
86 SAVE_ITEM(S3C2413_GPJSLPCON), 87 SAVE_ITEM(S3C2413_GPJSLPCON),
87}; 88};
88 89
89static int s3c2412_pm_suspend(struct sys_device *dev, pm_message_t state) 90static struct sysdev_driver s3c2412_pm_driver = {
91 .add = s3c2412_pm_add,
92};
93
94static __init int s3c2412_pm_init(void)
95{
96 return sysdev_driver_register(&s3c2412_sysclass, &s3c2412_pm_driver);
97}
98
99arch_initcall(s3c2412_pm_init);
100
101static int s3c2412_pm_suspend(void)
90{ 102{
91 s3c_pm_do_save(s3c2412_sleep, ARRAY_SIZE(s3c2412_sleep)); 103 s3c_pm_do_save(s3c2412_sleep, ARRAY_SIZE(s3c2412_sleep));
92 return 0; 104 return 0;
93} 105}
94 106
95static int s3c2412_pm_resume(struct sys_device *dev) 107static void s3c2412_pm_resume(void)
96{ 108{
97 unsigned long tmp; 109 unsigned long tmp;
98 110
@@ -102,18 +114,9 @@ static int s3c2412_pm_resume(struct sys_device *dev)
102 __raw_writel(tmp, S3C2412_PWRCFG); 114 __raw_writel(tmp, S3C2412_PWRCFG);
103 115
104 s3c_pm_do_restore(s3c2412_sleep, ARRAY_SIZE(s3c2412_sleep)); 116 s3c_pm_do_restore(s3c2412_sleep, ARRAY_SIZE(s3c2412_sleep));
105 return 0;
106} 117}
107 118
108static struct sysdev_driver s3c2412_pm_driver = { 119struct syscore_ops s3c2412_pm_syscore_ops = {
109 .add = s3c2412_pm_add,
110 .suspend = s3c2412_pm_suspend, 120 .suspend = s3c2412_pm_suspend,
111 .resume = s3c2412_pm_resume, 121 .resume = s3c2412_pm_resume,
112}; 122};
113
114static __init int s3c2412_pm_init(void)
115{
116 return sysdev_driver_register(&s3c2412_sysclass, &s3c2412_pm_driver);
117}
118
119arch_initcall(s3c2412_pm_init);
diff --git a/arch/arm/mach-s3c2412/s3c2412.c b/arch/arm/mach-s3c2412/s3c2412.c
index 4c6df51ddf33..ef0958d3e5c6 100644
--- a/arch/arm/mach-s3c2412/s3c2412.c
+++ b/arch/arm/mach-s3c2412/s3c2412.c
@@ -19,6 +19,7 @@
19#include <linux/clk.h> 19#include <linux/clk.h>
20#include <linux/delay.h> 20#include <linux/delay.h>
21#include <linux/sysdev.h> 21#include <linux/sysdev.h>
22#include <linux/syscore_ops.h>
22#include <linux/serial_core.h> 23#include <linux/serial_core.h>
23#include <linux/platform_device.h> 24#include <linux/platform_device.h>
24#include <linux/io.h> 25#include <linux/io.h>
@@ -244,5 +245,8 @@ int __init s3c2412_init(void)
244{ 245{
245 printk("S3C2412: Initialising architecture\n"); 246 printk("S3C2412: Initialising architecture\n");
246 247
248 register_syscore_ops(&s3c2412_pm_syscore_ops);
249 register_syscore_ops(&s3c24xx_irq_syscore_ops);
250
247 return sysdev_register(&s3c2412_sysdev); 251 return sysdev_register(&s3c2412_sysdev);
248} 252}
diff --git a/arch/arm/mach-s3c2416/irq.c b/arch/arm/mach-s3c2416/irq.c
index 77b38f2381c1..28ad20d42445 100644
--- a/arch/arm/mach-s3c2416/irq.c
+++ b/arch/arm/mach-s3c2416/irq.c
@@ -236,8 +236,6 @@ static int __init s3c2416_irq_add(struct sys_device *sysdev)
236 236
237static struct sysdev_driver s3c2416_irq_driver = { 237static struct sysdev_driver s3c2416_irq_driver = {
238 .add = s3c2416_irq_add, 238 .add = s3c2416_irq_add,
239 .suspend = s3c24xx_irq_suspend,
240 .resume = s3c24xx_irq_resume,
241}; 239};
242 240
243static int __init s3c2416_irq_init(void) 241static int __init s3c2416_irq_init(void)
diff --git a/arch/arm/mach-s3c2416/pm.c b/arch/arm/mach-s3c2416/pm.c
index 4a04205b04d5..41db2b21e213 100644
--- a/arch/arm/mach-s3c2416/pm.c
+++ b/arch/arm/mach-s3c2416/pm.c
@@ -11,6 +11,7 @@
11*/ 11*/
12 12
13#include <linux/sysdev.h> 13#include <linux/sysdev.h>
14#include <linux/syscore_ops.h>
14#include <linux/io.h> 15#include <linux/io.h>
15 16
16#include <asm/cacheflush.h> 17#include <asm/cacheflush.h>
@@ -55,30 +56,26 @@ static int s3c2416_pm_add(struct sys_device *sysdev)
55 return 0; 56 return 0;
56} 57}
57 58
58static int s3c2416_pm_suspend(struct sys_device *dev, pm_message_t state) 59static struct sysdev_driver s3c2416_pm_driver = {
60 .add = s3c2416_pm_add,
61};
62
63static __init int s3c2416_pm_init(void)
59{ 64{
60 return 0; 65 return sysdev_driver_register(&s3c2416_sysclass, &s3c2416_pm_driver);
61} 66}
62 67
63static int s3c2416_pm_resume(struct sys_device *dev) 68arch_initcall(s3c2416_pm_init);
69
70
71static void s3c2416_pm_resume(void)
64{ 72{
65 /* unset the return-from-sleep amd inform flags */ 73 /* unset the return-from-sleep amd inform flags */
66 __raw_writel(0x0, S3C2443_PWRMODE); 74 __raw_writel(0x0, S3C2443_PWRMODE);
67 __raw_writel(0x0, S3C2412_INFORM0); 75 __raw_writel(0x0, S3C2412_INFORM0);
68 __raw_writel(0x0, S3C2412_INFORM1); 76 __raw_writel(0x0, S3C2412_INFORM1);
69
70 return 0;
71} 77}
72 78
73static struct sysdev_driver s3c2416_pm_driver = { 79struct syscore_ops s3c2416_pm_syscore_ops = {
74 .add = s3c2416_pm_add,
75 .suspend = s3c2416_pm_suspend,
76 .resume = s3c2416_pm_resume, 80 .resume = s3c2416_pm_resume,
77}; 81};
78
79static __init int s3c2416_pm_init(void)
80{
81 return sysdev_driver_register(&s3c2416_sysclass, &s3c2416_pm_driver);
82}
83
84arch_initcall(s3c2416_pm_init);
diff --git a/arch/arm/mach-s3c2416/s3c2416.c b/arch/arm/mach-s3c2416/s3c2416.c
index ba7fd8737434..494ce913dc95 100644
--- a/arch/arm/mach-s3c2416/s3c2416.c
+++ b/arch/arm/mach-s3c2416/s3c2416.c
@@ -32,6 +32,7 @@
32#include <linux/platform_device.h> 32#include <linux/platform_device.h>
33#include <linux/serial_core.h> 33#include <linux/serial_core.h>
34#include <linux/sysdev.h> 34#include <linux/sysdev.h>
35#include <linux/syscore_ops.h>
35#include <linux/clk.h> 36#include <linux/clk.h>
36#include <linux/io.h> 37#include <linux/io.h>
37 38
@@ -54,6 +55,7 @@
54#include <plat/devs.h> 55#include <plat/devs.h>
55#include <plat/cpu.h> 56#include <plat/cpu.h>
56#include <plat/sdhci.h> 57#include <plat/sdhci.h>
58#include <plat/pm.h>
57 59
58#include <plat/iic-core.h> 60#include <plat/iic-core.h>
59#include <plat/fb-core.h> 61#include <plat/fb-core.h>
@@ -95,6 +97,9 @@ int __init s3c2416_init(void)
95 97
96 s3c_fb_setname("s3c2443-fb"); 98 s3c_fb_setname("s3c2443-fb");
97 99
100 register_syscore_ops(&s3c2416_pm_syscore_ops);
101 register_syscore_ops(&s3c24xx_irq_syscore_ops);
102
98 return sysdev_register(&s3c2416_sysdev); 103 return sysdev_register(&s3c2416_sysdev);
99} 104}
100 105
diff --git a/arch/arm/mach-s3c2440/mach-osiris.c b/arch/arm/mach-s3c2440/mach-osiris.c
index 14dc67897757..d88536393310 100644
--- a/arch/arm/mach-s3c2440/mach-osiris.c
+++ b/arch/arm/mach-s3c2440/mach-osiris.c
@@ -17,7 +17,7 @@
17#include <linux/init.h> 17#include <linux/init.h>
18#include <linux/gpio.h> 18#include <linux/gpio.h>
19#include <linux/device.h> 19#include <linux/device.h>
20#include <linux/sysdev.h> 20#include <linux/syscore_ops.h>
21#include <linux/serial_core.h> 21#include <linux/serial_core.h>
22#include <linux/clk.h> 22#include <linux/clk.h>
23#include <linux/i2c.h> 23#include <linux/i2c.h>
@@ -284,7 +284,7 @@ static struct platform_device osiris_pcmcia = {
284#ifdef CONFIG_PM 284#ifdef CONFIG_PM
285static unsigned char pm_osiris_ctrl0; 285static unsigned char pm_osiris_ctrl0;
286 286
287static int osiris_pm_suspend(struct sys_device *sd, pm_message_t state) 287static int osiris_pm_suspend(void)
288{ 288{
289 unsigned int tmp; 289 unsigned int tmp;
290 290
@@ -304,7 +304,7 @@ static int osiris_pm_suspend(struct sys_device *sd, pm_message_t state)
304 return 0; 304 return 0;
305} 305}
306 306
307static int osiris_pm_resume(struct sys_device *sd) 307static void osiris_pm_resume(void)
308{ 308{
309 if (pm_osiris_ctrl0 & OSIRIS_CTRL0_FIX8) 309 if (pm_osiris_ctrl0 & OSIRIS_CTRL0_FIX8)
310 __raw_writeb(OSIRIS_CTRL1_FIX8, OSIRIS_VA_CTRL1); 310 __raw_writeb(OSIRIS_CTRL1_FIX8, OSIRIS_VA_CTRL1);
@@ -312,8 +312,6 @@ static int osiris_pm_resume(struct sys_device *sd)
312 __raw_writeb(pm_osiris_ctrl0, OSIRIS_VA_CTRL0); 312 __raw_writeb(pm_osiris_ctrl0, OSIRIS_VA_CTRL0);
313 313
314 s3c_gpio_cfgpin(S3C2410_GPA(21), S3C2410_GPA21_nRSTOUT); 314 s3c_gpio_cfgpin(S3C2410_GPA(21), S3C2410_GPA21_nRSTOUT);
315
316 return 0;
317} 315}
318 316
319#else 317#else
@@ -321,16 +319,11 @@ static int osiris_pm_resume(struct sys_device *sd)
321#define osiris_pm_resume NULL 319#define osiris_pm_resume NULL
322#endif 320#endif
323 321
324static struct sysdev_class osiris_pm_sysclass = { 322static struct syscore_ops osiris_pm_syscore_ops = {
325 .name = "mach-osiris",
326 .suspend = osiris_pm_suspend, 323 .suspend = osiris_pm_suspend,
327 .resume = osiris_pm_resume, 324 .resume = osiris_pm_resume,
328}; 325};
329 326
330static struct sys_device osiris_pm_sysdev = {
331 .cls = &osiris_pm_sysclass,
332};
333
334/* Link for DVS driver to TPS65011 */ 327/* Link for DVS driver to TPS65011 */
335 328
336static void osiris_tps_release(struct device *dev) 329static void osiris_tps_release(struct device *dev)
@@ -439,8 +432,7 @@ static void __init osiris_map_io(void)
439 432
440static void __init osiris_init(void) 433static void __init osiris_init(void)
441{ 434{
442 sysdev_class_register(&osiris_pm_sysclass); 435 register_syscore_ops(&osiris_pm_syscore_ops);
443 sysdev_register(&osiris_pm_sysdev);
444 436
445 s3c_i2c0_set_platdata(NULL); 437 s3c_i2c0_set_platdata(NULL);
446 s3c_nand_set_platdata(&osiris_nand_info); 438 s3c_nand_set_platdata(&osiris_nand_info);
diff --git a/arch/arm/mach-s3c2440/s3c2440.c b/arch/arm/mach-s3c2440/s3c2440.c
index f7663f731ea0..ce99ff72838d 100644
--- a/arch/arm/mach-s3c2440/s3c2440.c
+++ b/arch/arm/mach-s3c2440/s3c2440.c
@@ -19,6 +19,7 @@
19#include <linux/platform_device.h> 19#include <linux/platform_device.h>
20#include <linux/serial_core.h> 20#include <linux/serial_core.h>
21#include <linux/sysdev.h> 21#include <linux/sysdev.h>
22#include <linux/syscore_ops.h>
22#include <linux/gpio.h> 23#include <linux/gpio.h>
23#include <linux/clk.h> 24#include <linux/clk.h>
24#include <linux/io.h> 25#include <linux/io.h>
@@ -33,6 +34,7 @@
33#include <plat/devs.h> 34#include <plat/devs.h>
34#include <plat/cpu.h> 35#include <plat/cpu.h>
35#include <plat/s3c244x.h> 36#include <plat/s3c244x.h>
37#include <plat/pm.h>
36 38
37#include <plat/gpio-core.h> 39#include <plat/gpio-core.h>
38#include <plat/gpio-cfg.h> 40#include <plat/gpio-cfg.h>
@@ -51,6 +53,12 @@ int __init s3c2440_init(void)
51 s3c_device_wdt.resource[1].start = IRQ_S3C2440_WDT; 53 s3c_device_wdt.resource[1].start = IRQ_S3C2440_WDT;
52 s3c_device_wdt.resource[1].end = IRQ_S3C2440_WDT; 54 s3c_device_wdt.resource[1].end = IRQ_S3C2440_WDT;
53 55
56 /* register suspend/resume handlers */
57
58 register_syscore_ops(&s3c2410_pm_syscore_ops);
59 register_syscore_ops(&s3c244x_pm_syscore_ops);
60 register_syscore_ops(&s3c24xx_irq_syscore_ops);
61
54 /* register our system device for everything else */ 62 /* register our system device for everything else */
55 63
56 return sysdev_register(&s3c2440_sysdev); 64 return sysdev_register(&s3c2440_sysdev);
diff --git a/arch/arm/mach-s3c2440/s3c2442.c b/arch/arm/mach-s3c2440/s3c2442.c
index ecf813546554..6224bad4d604 100644
--- a/arch/arm/mach-s3c2440/s3c2442.c
+++ b/arch/arm/mach-s3c2440/s3c2442.c
@@ -29,6 +29,7 @@
29#include <linux/err.h> 29#include <linux/err.h>
30#include <linux/device.h> 30#include <linux/device.h>
31#include <linux/sysdev.h> 31#include <linux/sysdev.h>
32#include <linux/syscore_ops.h>
32#include <linux/interrupt.h> 33#include <linux/interrupt.h>
33#include <linux/ioport.h> 34#include <linux/ioport.h>
34#include <linux/mutex.h> 35#include <linux/mutex.h>
@@ -45,6 +46,7 @@
45#include <plat/clock.h> 46#include <plat/clock.h>
46#include <plat/cpu.h> 47#include <plat/cpu.h>
47#include <plat/s3c244x.h> 48#include <plat/s3c244x.h>
49#include <plat/pm.h>
48 50
49#include <plat/gpio-core.h> 51#include <plat/gpio-core.h>
50#include <plat/gpio-cfg.h> 52#include <plat/gpio-cfg.h>
@@ -167,6 +169,10 @@ int __init s3c2442_init(void)
167{ 169{
168 printk("S3C2442: Initialising architecture\n"); 170 printk("S3C2442: Initialising architecture\n");
169 171
172 register_syscore_ops(&s3c2410_pm_syscore_ops);
173 register_syscore_ops(&s3c244x_pm_syscore_ops);
174 register_syscore_ops(&s3c24xx_irq_syscore_ops);
175
170 return sysdev_register(&s3c2442_sysdev); 176 return sysdev_register(&s3c2442_sysdev);
171} 177}
172 178
diff --git a/arch/arm/mach-s3c2440/s3c244x-irq.c b/arch/arm/mach-s3c2440/s3c244x-irq.c
index de07c2feaa32..c63e8f26d901 100644
--- a/arch/arm/mach-s3c2440/s3c244x-irq.c
+++ b/arch/arm/mach-s3c2440/s3c244x-irq.c
@@ -116,8 +116,6 @@ static int s3c244x_irq_add(struct sys_device *sysdev)
116 116
117static struct sysdev_driver s3c2440_irq_driver = { 117static struct sysdev_driver s3c2440_irq_driver = {
118 .add = s3c244x_irq_add, 118 .add = s3c244x_irq_add,
119 .suspend = s3c24xx_irq_suspend,
120 .resume = s3c24xx_irq_resume,
121}; 119};
122 120
123static int s3c2440_irq_init(void) 121static int s3c2440_irq_init(void)
@@ -129,8 +127,6 @@ arch_initcall(s3c2440_irq_init);
129 127
130static struct sysdev_driver s3c2442_irq_driver = { 128static struct sysdev_driver s3c2442_irq_driver = {
131 .add = s3c244x_irq_add, 129 .add = s3c244x_irq_add,
132 .suspend = s3c24xx_irq_suspend,
133 .resume = s3c24xx_irq_resume,
134}; 130};
135 131
136 132
diff --git a/arch/arm/mach-s3c2440/s3c244x.c b/arch/arm/mach-s3c2440/s3c244x.c
index 90c1707b9c95..7e8a23d2098a 100644
--- a/arch/arm/mach-s3c2440/s3c244x.c
+++ b/arch/arm/mach-s3c2440/s3c244x.c
@@ -19,6 +19,7 @@
19#include <linux/serial_core.h> 19#include <linux/serial_core.h>
20#include <linux/platform_device.h> 20#include <linux/platform_device.h>
21#include <linux/sysdev.h> 21#include <linux/sysdev.h>
22#include <linux/syscore_ops.h>
22#include <linux/clk.h> 23#include <linux/clk.h>
23#include <linux/io.h> 24#include <linux/io.h>
24 25
@@ -134,45 +135,14 @@ void __init s3c244x_init_clocks(int xtal)
134 s3c2410_baseclk_add(); 135 s3c2410_baseclk_add();
135} 136}
136 137
137#ifdef CONFIG_PM
138
139static struct sleep_save s3c244x_sleep[] = {
140 SAVE_ITEM(S3C2440_DSC0),
141 SAVE_ITEM(S3C2440_DSC1),
142 SAVE_ITEM(S3C2440_GPJDAT),
143 SAVE_ITEM(S3C2440_GPJCON),
144 SAVE_ITEM(S3C2440_GPJUP)
145};
146
147static int s3c244x_suspend(struct sys_device *dev, pm_message_t state)
148{
149 s3c_pm_do_save(s3c244x_sleep, ARRAY_SIZE(s3c244x_sleep));
150 return 0;
151}
152
153static int s3c244x_resume(struct sys_device *dev)
154{
155 s3c_pm_do_restore(s3c244x_sleep, ARRAY_SIZE(s3c244x_sleep));
156 return 0;
157}
158
159#else
160#define s3c244x_suspend NULL
161#define s3c244x_resume NULL
162#endif
163
164/* Since the S3C2442 and S3C2440 share items, put both sysclasses here */ 138/* Since the S3C2442 and S3C2440 share items, put both sysclasses here */
165 139
166struct sysdev_class s3c2440_sysclass = { 140struct sysdev_class s3c2440_sysclass = {
167 .name = "s3c2440-core", 141 .name = "s3c2440-core",
168 .suspend = s3c244x_suspend,
169 .resume = s3c244x_resume
170}; 142};
171 143
172struct sysdev_class s3c2442_sysclass = { 144struct sysdev_class s3c2442_sysclass = {
173 .name = "s3c2442-core", 145 .name = "s3c2442-core",
174 .suspend = s3c244x_suspend,
175 .resume = s3c244x_resume
176}; 146};
177 147
178/* need to register class before we actually register the device, and 148/* need to register class before we actually register the device, and
@@ -194,3 +164,33 @@ static int __init s3c2442_core_init(void)
194} 164}
195 165
196core_initcall(s3c2442_core_init); 166core_initcall(s3c2442_core_init);
167
168
169#ifdef CONFIG_PM
170static struct sleep_save s3c244x_sleep[] = {
171 SAVE_ITEM(S3C2440_DSC0),
172 SAVE_ITEM(S3C2440_DSC1),
173 SAVE_ITEM(S3C2440_GPJDAT),
174 SAVE_ITEM(S3C2440_GPJCON),
175 SAVE_ITEM(S3C2440_GPJUP)
176};
177
178static int s3c244x_suspend(void)
179{
180 s3c_pm_do_save(s3c244x_sleep, ARRAY_SIZE(s3c244x_sleep));
181 return 0;
182}
183
184static void s3c244x_resume(void)
185{
186 s3c_pm_do_restore(s3c244x_sleep, ARRAY_SIZE(s3c244x_sleep));
187}
188#else
189#define s3c244x_suspend NULL
190#define s3c244x_resume NULL
191#endif
192
193struct syscore_ops s3c244x_pm_syscore_ops = {
194 .suspend = s3c244x_suspend,
195 .resume = s3c244x_resume,
196};
diff --git a/arch/arm/mach-s3c64xx/irq-pm.c b/arch/arm/mach-s3c64xx/irq-pm.c
index da1bec64b9da..8bec61e242c7 100644
--- a/arch/arm/mach-s3c64xx/irq-pm.c
+++ b/arch/arm/mach-s3c64xx/irq-pm.c
@@ -13,7 +13,7 @@
13 */ 13 */
14 14
15#include <linux/kernel.h> 15#include <linux/kernel.h>
16#include <linux/sysdev.h> 16#include <linux/syscore_ops.h>
17#include <linux/interrupt.h> 17#include <linux/interrupt.h>
18#include <linux/serial_core.h> 18#include <linux/serial_core.h>
19#include <linux/irq.h> 19#include <linux/irq.h>
@@ -54,7 +54,7 @@ static struct irq_grp_save {
54 54
55static u32 irq_uart_mask[CONFIG_SERIAL_SAMSUNG_UARTS]; 55static u32 irq_uart_mask[CONFIG_SERIAL_SAMSUNG_UARTS];
56 56
57static int s3c64xx_irq_pm_suspend(struct sys_device *dev, pm_message_t state) 57static int s3c64xx_irq_pm_suspend(void)
58{ 58{
59 struct irq_grp_save *grp = eint_grp_save; 59 struct irq_grp_save *grp = eint_grp_save;
60 int i; 60 int i;
@@ -75,7 +75,7 @@ static int s3c64xx_irq_pm_suspend(struct sys_device *dev, pm_message_t state)
75 return 0; 75 return 0;
76} 76}
77 77
78static int s3c64xx_irq_pm_resume(struct sys_device *dev) 78static void s3c64xx_irq_pm_resume(void)
79{ 79{
80 struct irq_grp_save *grp = eint_grp_save; 80 struct irq_grp_save *grp = eint_grp_save;
81 int i; 81 int i;
@@ -94,18 +94,18 @@ static int s3c64xx_irq_pm_resume(struct sys_device *dev)
94 } 94 }
95 95
96 S3C_PMDBG("%s: IRQ configuration restored\n", __func__); 96 S3C_PMDBG("%s: IRQ configuration restored\n", __func__);
97 return 0;
98} 97}
99 98
100static struct sysdev_driver s3c64xx_irq_driver = { 99struct syscore_ops s3c64xx_irq_syscore_ops = {
101 .suspend = s3c64xx_irq_pm_suspend, 100 .suspend = s3c64xx_irq_pm_suspend,
102 .resume = s3c64xx_irq_pm_resume, 101 .resume = s3c64xx_irq_pm_resume,
103}; 102};
104 103
105static int __init s3c64xx_irq_pm_init(void) 104static __init int s3c64xx_syscore_init(void)
106{ 105{
107 return sysdev_driver_register(&s3c64xx_sysclass, &s3c64xx_irq_driver); 106 register_syscore_ops(&s3c64xx_irq_syscore_ops);
108}
109 107
110arch_initcall(s3c64xx_irq_pm_init); 108 return 0;
109}
111 110
111core_initcall(s3c64xx_syscore_init);
diff --git a/arch/arm/mach-s5pv210/pm.c b/arch/arm/mach-s5pv210/pm.c
index 549d7924fd4c..24febae3d4c0 100644
--- a/arch/arm/mach-s5pv210/pm.c
+++ b/arch/arm/mach-s5pv210/pm.c
@@ -16,6 +16,7 @@
16 16
17#include <linux/init.h> 17#include <linux/init.h>
18#include <linux/suspend.h> 18#include <linux/suspend.h>
19#include <linux/syscore_ops.h>
19#include <linux/io.h> 20#include <linux/io.h>
20 21
21#include <plat/cpu.h> 22#include <plat/cpu.h>
@@ -140,7 +141,17 @@ static int s5pv210_pm_add(struct sys_device *sysdev)
140 return 0; 141 return 0;
141} 142}
142 143
143static int s5pv210_pm_resume(struct sys_device *dev) 144static struct sysdev_driver s5pv210_pm_driver = {
145 .add = s5pv210_pm_add,
146};
147
148static __init int s5pv210_pm_drvinit(void)
149{
150 return sysdev_driver_register(&s5pv210_sysclass, &s5pv210_pm_driver);
151}
152arch_initcall(s5pv210_pm_drvinit);
153
154static void s5pv210_pm_resume(void)
144{ 155{
145 u32 tmp; 156 u32 tmp;
146 157
@@ -150,17 +161,15 @@ static int s5pv210_pm_resume(struct sys_device *dev)
150 __raw_writel(tmp , S5P_OTHERS); 161 __raw_writel(tmp , S5P_OTHERS);
151 162
152 s3c_pm_do_restore_core(s5pv210_core_save, ARRAY_SIZE(s5pv210_core_save)); 163 s3c_pm_do_restore_core(s5pv210_core_save, ARRAY_SIZE(s5pv210_core_save));
153
154 return 0;
155} 164}
156 165
157static struct sysdev_driver s5pv210_pm_driver = { 166static struct syscore_ops s5pv210_pm_syscore_ops = {
158 .add = s5pv210_pm_add,
159 .resume = s5pv210_pm_resume, 167 .resume = s5pv210_pm_resume,
160}; 168};
161 169
162static __init int s5pv210_pm_drvinit(void) 170static __init int s5pv210_pm_syscore_init(void)
163{ 171{
164 return sysdev_driver_register(&s5pv210_sysclass, &s5pv210_pm_driver); 172 register_syscore_ops(&s5pv210_pm_syscore_ops);
173 return 0;
165} 174}
166arch_initcall(s5pv210_pm_drvinit); 175arch_initcall(s5pv210_pm_syscore_init);
diff --git a/arch/arm/plat-s3c24xx/dma.c b/arch/arm/plat-s3c24xx/dma.c
index 27ea852e3370..c10d10c56e2e 100644
--- a/arch/arm/plat-s3c24xx/dma.c
+++ b/arch/arm/plat-s3c24xx/dma.c
@@ -22,7 +22,7 @@
22#include <linux/sched.h> 22#include <linux/sched.h>
23#include <linux/spinlock.h> 23#include <linux/spinlock.h>
24#include <linux/interrupt.h> 24#include <linux/interrupt.h>
25#include <linux/sysdev.h> 25#include <linux/syscore_ops.h>
26#include <linux/slab.h> 26#include <linux/slab.h>
27#include <linux/errno.h> 27#include <linux/errno.h>
28#include <linux/io.h> 28#include <linux/io.h>
@@ -1195,19 +1195,12 @@ int s3c2410_dma_getposition(unsigned int channel, dma_addr_t *src, dma_addr_t *d
1195 1195
1196EXPORT_SYMBOL(s3c2410_dma_getposition); 1196EXPORT_SYMBOL(s3c2410_dma_getposition);
1197 1197
1198static inline struct s3c2410_dma_chan *to_dma_chan(struct sys_device *dev) 1198/* system core operations */
1199{
1200 return container_of(dev, struct s3c2410_dma_chan, dev);
1201}
1202
1203/* system device class */
1204 1199
1205#ifdef CONFIG_PM 1200#ifdef CONFIG_PM
1206 1201
1207static int s3c2410_dma_suspend(struct sys_device *dev, pm_message_t state) 1202static void s3c2410_dma_suspend_chan(s3c2410_dma_chan *cp)
1208{ 1203{
1209 struct s3c2410_dma_chan *cp = to_dma_chan(dev);
1210
1211 printk(KERN_DEBUG "suspending dma channel %d\n", cp->number); 1204 printk(KERN_DEBUG "suspending dma channel %d\n", cp->number);
1212 1205
1213 if (dma_rdreg(cp, S3C2410_DMA_DMASKTRIG) & S3C2410_DMASKTRIG_ON) { 1206 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)
1222 1215
1223 s3c2410_dma_dostop(cp); 1216 s3c2410_dma_dostop(cp);
1224 } 1217 }
1218}
1219
1220static int s3c2410_dma_suspend(void)
1221{
1222 struct s3c2410_dma_chan *cp = s3c2410_chans;
1223 int channel;
1224
1225 for (channel = 0; channel < dma_channels; cp++, channel++)
1226 s3c2410_dma_suspend_chan(cp);
1225 1227
1226 return 0; 1228 return 0;
1227} 1229}
1228 1230
1229static int s3c2410_dma_resume(struct sys_device *dev) 1231static void s3c2410_dma_resume_chan(struct s3c2410_dma_chan *cp)
1230{ 1232{
1231 struct s3c2410_dma_chan *cp = to_dma_chan(dev);
1232 unsigned int no = cp->number | DMACH_LOW_LEVEL; 1233 unsigned int no = cp->number | DMACH_LOW_LEVEL;
1233 1234
1234 /* restore channel's hardware configuration */ 1235 /* restore channel's hardware configuration */
@@ -1249,13 +1250,21 @@ static int s3c2410_dma_resume(struct sys_device *dev)
1249 return 0; 1250 return 0;
1250} 1251}
1251 1252
1253static void s3c2410_dma_resume(void)
1254{
1255 struct s3c2410_dma_chan *cp = s3c2410_chans + dma_channels - 1;
1256 int channel;
1257
1258 for (channel = dma_channels - 1; channel >= 0; cp++, channel--)
1259 s3c2410_dma_resume_chan(cp);
1260}
1261
1252#else 1262#else
1253#define s3c2410_dma_suspend NULL 1263#define s3c2410_dma_suspend NULL
1254#define s3c2410_dma_resume NULL 1264#define s3c2410_dma_resume NULL
1255#endif /* CONFIG_PM */ 1265#endif /* CONFIG_PM */
1256 1266
1257struct sysdev_class dma_sysclass = { 1267struct syscore_ops dma_syscore_ops = {
1258 .name = "s3c24xx-dma",
1259 .suspend = s3c2410_dma_suspend, 1268 .suspend = s3c2410_dma_suspend,
1260 .resume = s3c2410_dma_resume, 1269 .resume = s3c2410_dma_resume,
1261}; 1270};
@@ -1269,39 +1278,14 @@ static void s3c2410_dma_cache_ctor(void *p)
1269 1278
1270/* initialisation code */ 1279/* initialisation code */
1271 1280
1272static int __init s3c24xx_dma_sysclass_init(void) 1281static int __init s3c24xx_dma_syscore_init(void)
1273{ 1282{
1274 int ret = sysdev_class_register(&dma_sysclass); 1283 register_syscore_ops(&dma_syscore_ops);
1275
1276 if (ret != 0)
1277 printk(KERN_ERR "dma sysclass registration failed\n");
1278
1279 return ret;
1280}
1281
1282core_initcall(s3c24xx_dma_sysclass_init);
1283
1284static int __init s3c24xx_dma_sysdev_register(void)
1285{
1286 struct s3c2410_dma_chan *cp = s3c2410_chans;
1287 int channel, ret;
1288
1289 for (channel = 0; channel < dma_channels; cp++, channel++) {
1290 cp->dev.cls = &dma_sysclass;
1291 cp->dev.id = channel;
1292 ret = sysdev_register(&cp->dev);
1293
1294 if (ret) {
1295 printk(KERN_ERR "error registering dev for dma %d\n",
1296 channel);
1297 return ret;
1298 }
1299 }
1300 1284
1301 return 0; 1285 return 0;
1302} 1286}
1303 1287
1304late_initcall(s3c24xx_dma_sysdev_register); 1288late_initcall(s3c24xx_dma_syscore_init);
1305 1289
1306int __init s3c24xx_dma_init(unsigned int channels, unsigned int irq, 1290int __init s3c24xx_dma_init(unsigned int channels, unsigned int irq,
1307 unsigned int stride) 1291 unsigned int stride)
diff --git a/arch/arm/plat-s3c24xx/irq-pm.c b/arch/arm/plat-s3c24xx/irq-pm.c
index c3624d898630..0efb2e2848c8 100644
--- a/arch/arm/plat-s3c24xx/irq-pm.c
+++ b/arch/arm/plat-s3c24xx/irq-pm.c
@@ -14,7 +14,6 @@
14#include <linux/init.h> 14#include <linux/init.h>
15#include <linux/module.h> 15#include <linux/module.h>
16#include <linux/interrupt.h> 16#include <linux/interrupt.h>
17#include <linux/sysdev.h>
18#include <linux/irq.h> 17#include <linux/irq.h>
19 18
20#include <plat/cpu.h> 19#include <plat/cpu.h>
@@ -65,7 +64,7 @@ static unsigned long save_extint[3];
65static unsigned long save_eintflt[4]; 64static unsigned long save_eintflt[4];
66static unsigned long save_eintmask; 65static unsigned long save_eintmask;
67 66
68int s3c24xx_irq_suspend(struct sys_device *dev, pm_message_t state) 67int s3c24xx_irq_suspend(void)
69{ 68{
70 unsigned int i; 69 unsigned int i;
71 70
@@ -81,7 +80,7 @@ int s3c24xx_irq_suspend(struct sys_device *dev, pm_message_t state)
81 return 0; 80 return 0;
82} 81}
83 82
84int s3c24xx_irq_resume(struct sys_device *dev) 83void s3c24xx_irq_resume(void)
85{ 84{
86 unsigned int i; 85 unsigned int i;
87 86
@@ -93,6 +92,4 @@ int s3c24xx_irq_resume(struct sys_device *dev)
93 92
94 s3c_pm_do_restore(irq_save, ARRAY_SIZE(irq_save)); 93 s3c_pm_do_restore(irq_save, ARRAY_SIZE(irq_save));
95 __raw_writel(save_eintmask, S3C24XX_EINTMASK); 94 __raw_writel(save_eintmask, S3C24XX_EINTMASK);
96
97 return 0;
98} 95}
diff --git a/arch/arm/plat-s5p/irq-pm.c b/arch/arm/plat-s5p/irq-pm.c
index 5259ad458bc8..327acb3a4464 100644
--- a/arch/arm/plat-s5p/irq-pm.c
+++ b/arch/arm/plat-s5p/irq-pm.c
@@ -16,7 +16,6 @@
16#include <linux/init.h> 16#include <linux/init.h>
17#include <linux/module.h> 17#include <linux/module.h>
18#include <linux/interrupt.h> 18#include <linux/interrupt.h>
19#include <linux/sysdev.h>
20 19
21#include <plat/cpu.h> 20#include <plat/cpu.h>
22#include <plat/irqs.h> 21#include <plat/irqs.h>
@@ -77,17 +76,15 @@ static struct sleep_save eint_save[] = {
77 SAVE_ITEM(S5P_EINT_MASK(3)), 76 SAVE_ITEM(S5P_EINT_MASK(3)),
78}; 77};
79 78
80int s3c24xx_irq_suspend(struct sys_device *dev, pm_message_t state) 79int s3c24xx_irq_suspend(void)
81{ 80{
82 s3c_pm_do_save(eint_save, ARRAY_SIZE(eint_save)); 81 s3c_pm_do_save(eint_save, ARRAY_SIZE(eint_save));
83 82
84 return 0; 83 return 0;
85} 84}
86 85
87int s3c24xx_irq_resume(struct sys_device *dev) 86void s3c24xx_irq_resume(void)
88{ 87{
89 s3c_pm_do_restore(eint_save, ARRAY_SIZE(eint_save)); 88 s3c_pm_do_restore(eint_save, ARRAY_SIZE(eint_save));
90
91 return 0;
92} 89}
93 90
diff --git a/arch/arm/plat-samsung/include/plat/cpu.h b/arch/arm/plat-samsung/include/plat/cpu.h
index cedfff51c82b..3aedac0034ba 100644
--- a/arch/arm/plat-samsung/include/plat/cpu.h
+++ b/arch/arm/plat-samsung/include/plat/cpu.h
@@ -68,6 +68,12 @@ extern void s3c24xx_init_uartdevs(char *name,
68struct sys_timer; 68struct sys_timer;
69extern struct sys_timer s3c24xx_timer; 69extern struct sys_timer s3c24xx_timer;
70 70
71extern struct syscore_ops s3c2410_pm_syscore_ops;
72extern struct syscore_ops s3c2412_pm_syscore_ops;
73extern struct syscore_ops s3c2416_pm_syscore_ops;
74extern struct syscore_ops s3c244x_pm_syscore_ops;
75extern struct syscore_ops s3c64xx_irq_syscore_ops;
76
71/* system device classes */ 77/* system device classes */
72 78
73extern struct sysdev_class s3c2410_sysclass; 79extern struct sysdev_class s3c2410_sysclass;
diff --git a/arch/arm/plat-samsung/include/plat/pm.h b/arch/arm/plat-samsung/include/plat/pm.h
index 937cc2ace517..7fb6f6be8c81 100644
--- a/arch/arm/plat-samsung/include/plat/pm.h
+++ b/arch/arm/plat-samsung/include/plat/pm.h
@@ -103,14 +103,16 @@ extern void s3c_pm_do_restore_core(struct sleep_save *ptr, int count);
103 103
104#ifdef CONFIG_PM 104#ifdef CONFIG_PM
105extern int s3c_irqext_wake(struct irq_data *data, unsigned int state); 105extern int s3c_irqext_wake(struct irq_data *data, unsigned int state);
106extern int s3c24xx_irq_suspend(struct sys_device *dev, pm_message_t state); 106extern int s3c24xx_irq_suspend(void);
107extern int s3c24xx_irq_resume(struct sys_device *dev); 107extern void s3c24xx_irq_resume(void);
108#else 108#else
109#define s3c_irqext_wake NULL 109#define s3c_irqext_wake NULL
110#define s3c24xx_irq_suspend NULL 110#define s3c24xx_irq_suspend NULL
111#define s3c24xx_irq_resume NULL 111#define s3c24xx_irq_resume NULL
112#endif 112#endif
113 113
114extern struct syscore_ops s3c24xx_irq_syscore_ops;
115
114/* PM debug functions */ 116/* PM debug functions */
115 117
116#ifdef CONFIG_SAMSUNG_PM_DEBUG 118#ifdef CONFIG_SAMSUNG_PM_DEBUG