diff options
Diffstat (limited to 'arch')
-rw-r--r-- | arch/arm/mach-omap1/pm.c | 20 | ||||
-rw-r--r-- | arch/arm/mach-omap2/pm.c | 20 | ||||
-rw-r--r-- | arch/blackfin/mach-common/pm.c | 53 | ||||
-rw-r--r-- | arch/powerpc/platforms/52xx/lite5200_pm.c | 34 | ||||
-rw-r--r-- | arch/powerpc/platforms/52xx/mpc52xx_pm.c | 9 |
5 files changed, 35 insertions, 101 deletions
diff --git a/arch/arm/mach-omap1/pm.c b/arch/arm/mach-omap1/pm.c index 8db38dd247a4..3bf01e28df33 100644 --- a/arch/arm/mach-omap1/pm.c +++ b/arch/arm/mach-omap1/pm.c | |||
@@ -599,27 +599,15 @@ static void (*saved_idle)(void) = NULL; | |||
599 | 599 | ||
600 | /* | 600 | /* |
601 | * omap_pm_prepare - Do preliminary suspend work. | 601 | * omap_pm_prepare - Do preliminary suspend work. |
602 | * @state: suspend state we're entering. | ||
603 | * | 602 | * |
604 | */ | 603 | */ |
605 | static int omap_pm_prepare(suspend_state_t state) | 604 | static int omap_pm_prepare(void) |
606 | { | 605 | { |
607 | int error = 0; | ||
608 | |||
609 | /* We cannot sleep in idle until we have resumed */ | 606 | /* We cannot sleep in idle until we have resumed */ |
610 | saved_idle = pm_idle; | 607 | saved_idle = pm_idle; |
611 | pm_idle = NULL; | 608 | pm_idle = NULL; |
612 | 609 | ||
613 | switch (state) | 610 | return 0; |
614 | { | ||
615 | case PM_SUSPEND_STANDBY: | ||
616 | case PM_SUSPEND_MEM: | ||
617 | break; | ||
618 | default: | ||
619 | return -EINVAL; | ||
620 | } | ||
621 | |||
622 | return error; | ||
623 | } | 611 | } |
624 | 612 | ||
625 | 613 | ||
@@ -647,16 +635,14 @@ static int omap_pm_enter(suspend_state_t state) | |||
647 | 635 | ||
648 | /** | 636 | /** |
649 | * omap_pm_finish - Finish up suspend sequence. | 637 | * omap_pm_finish - Finish up suspend sequence. |
650 | * @state: State we're coming out of. | ||
651 | * | 638 | * |
652 | * This is called after we wake back up (or if entering the sleep state | 639 | * This is called after we wake back up (or if entering the sleep state |
653 | * failed). | 640 | * failed). |
654 | */ | 641 | */ |
655 | 642 | ||
656 | static int omap_pm_finish(suspend_state_t state) | 643 | static void omap_pm_finish(void) |
657 | { | 644 | { |
658 | pm_idle = saved_idle; | 645 | pm_idle = saved_idle; |
659 | return 0; | ||
660 | } | 646 | } |
661 | 647 | ||
662 | 648 | ||
diff --git a/arch/arm/mach-omap2/pm.c b/arch/arm/mach-omap2/pm.c index 9aaa7a2633e8..baf7d82b458b 100644 --- a/arch/arm/mach-omap2/pm.c +++ b/arch/arm/mach-omap2/pm.c | |||
@@ -70,25 +70,12 @@ void omap2_pm_idle(void) | |||
70 | local_irq_enable(); | 70 | local_irq_enable(); |
71 | } | 71 | } |
72 | 72 | ||
73 | static int omap2_pm_prepare(suspend_state_t state) | 73 | static int omap2_pm_prepare(void) |
74 | { | 74 | { |
75 | int error = 0; | ||
76 | |||
77 | /* We cannot sleep in idle until we have resumed */ | 75 | /* We cannot sleep in idle until we have resumed */ |
78 | saved_idle = pm_idle; | 76 | saved_idle = pm_idle; |
79 | pm_idle = NULL; | 77 | pm_idle = NULL; |
80 | 78 | return 0; | |
81 | switch (state) | ||
82 | { | ||
83 | case PM_SUSPEND_STANDBY: | ||
84 | case PM_SUSPEND_MEM: | ||
85 | break; | ||
86 | |||
87 | default: | ||
88 | return -EINVAL; | ||
89 | } | ||
90 | |||
91 | return error; | ||
92 | } | 79 | } |
93 | 80 | ||
94 | #define INT0_WAKE_MASK (OMAP_IRQ_BIT(INT_24XX_GPIO_BANK1) | \ | 81 | #define INT0_WAKE_MASK (OMAP_IRQ_BIT(INT_24XX_GPIO_BANK1) | \ |
@@ -356,10 +343,9 @@ static int omap2_pm_enter(suspend_state_t state) | |||
356 | return ret; | 343 | return ret; |
357 | } | 344 | } |
358 | 345 | ||
359 | static int omap2_pm_finish(suspend_state_t state) | 346 | static void omap2_pm_finish(void) |
360 | { | 347 | { |
361 | pm_idle = saved_idle; | 348 | pm_idle = saved_idle; |
362 | return 0; | ||
363 | } | 349 | } |
364 | 350 | ||
365 | static struct platform_suspend_ops omap_pm_ops = { | 351 | static struct platform_suspend_ops omap_pm_ops = { |
diff --git a/arch/blackfin/mach-common/pm.c b/arch/blackfin/mach-common/pm.c index 6901891905cc..dac51fb06f22 100644 --- a/arch/blackfin/mach-common/pm.c +++ b/arch/blackfin/mach-common/pm.c | |||
@@ -89,28 +89,15 @@ void bfin_pm_suspend_standby_enter(void) | |||
89 | #endif /* CONFIG_PM_WAKEUP_GPIO_BY_SIC_IWR */ | 89 | #endif /* CONFIG_PM_WAKEUP_GPIO_BY_SIC_IWR */ |
90 | } | 90 | } |
91 | 91 | ||
92 | |||
93 | /* | 92 | /* |
94 | * bfin_pm_prepare - Do preliminary suspend work. | 93 | * bfin_pm_valid - Tell the PM core that we only support the standby sleep |
95 | * @state: suspend state we're entering. | 94 | * state |
95 | * @state: suspend state we're checking. | ||
96 | * | 96 | * |
97 | */ | 97 | */ |
98 | static int bfin_pm_prepare(suspend_state_t state) | 98 | static int bfin_pm_valid(suspend_state_t state) |
99 | { | 99 | { |
100 | int error = 0; | 100 | return (state == PM_SUSPEND_STANDBY); |
101 | |||
102 | switch (state) { | ||
103 | case PM_SUSPEND_STANDBY: | ||
104 | break; | ||
105 | |||
106 | case PM_SUSPEND_MEM: | ||
107 | return -ENOTSUPP; | ||
108 | |||
109 | default: | ||
110 | return -EINVAL; | ||
111 | } | ||
112 | |||
113 | return error; | ||
114 | } | 101 | } |
115 | 102 | ||
116 | /* | 103 | /* |
@@ -135,38 +122,8 @@ static int bfin_pm_enter(suspend_state_t state) | |||
135 | return 0; | 122 | return 0; |
136 | } | 123 | } |
137 | 124 | ||
138 | /* | ||
139 | * bfin_pm_finish - Finish up suspend sequence. | ||
140 | * @state: State we're coming out of. | ||
141 | * | ||
142 | * This is called after we wake back up (or if entering the sleep state | ||
143 | * failed). | ||
144 | */ | ||
145 | static int bfin_pm_finish(suspend_state_t state) | ||
146 | { | ||
147 | switch (state) { | ||
148 | case PM_SUSPEND_STANDBY: | ||
149 | break; | ||
150 | |||
151 | case PM_SUSPEND_MEM: | ||
152 | return -ENOTSUPP; | ||
153 | |||
154 | default: | ||
155 | return -EINVAL; | ||
156 | } | ||
157 | |||
158 | return 0; | ||
159 | } | ||
160 | |||
161 | static int bfin_pm_valid(suspend_state_t state) | ||
162 | { | ||
163 | return (state == PM_SUSPEND_STANDBY); | ||
164 | } | ||
165 | |||
166 | struct platform_suspend_ops bfin_pm_ops = { | 125 | struct platform_suspend_ops bfin_pm_ops = { |
167 | .prepare = bfin_pm_prepare, | ||
168 | .enter = bfin_pm_enter, | 126 | .enter = bfin_pm_enter, |
169 | .finish = bfin_pm_finish, | ||
170 | .valid = bfin_pm_valid, | 127 | .valid = bfin_pm_valid, |
171 | }; | 128 | }; |
172 | 129 | ||
diff --git a/arch/powerpc/platforms/52xx/lite5200_pm.c b/arch/powerpc/platforms/52xx/lite5200_pm.c index f26afcd41757..ffa14aff5248 100644 --- a/arch/powerpc/platforms/52xx/lite5200_pm.c +++ b/arch/powerpc/platforms/52xx/lite5200_pm.c | |||
@@ -1,5 +1,5 @@ | |||
1 | #include <linux/init.h> | 1 | #include <linux/init.h> |
2 | #include <linux/pm.h> | 2 | #include <linux/suspend.h> |
3 | #include <asm/io.h> | 3 | #include <asm/io.h> |
4 | #include <asm/time.h> | 4 | #include <asm/time.h> |
5 | #include <asm/mpc52xx.h> | 5 | #include <asm/mpc52xx.h> |
@@ -18,6 +18,8 @@ static void __iomem *sram; | |||
18 | static const int sram_size = 0x4000; /* 16 kBytes */ | 18 | static const int sram_size = 0x4000; /* 16 kBytes */ |
19 | static void __iomem *mbar; | 19 | static void __iomem *mbar; |
20 | 20 | ||
21 | static suspend_state_t lite5200_pm_target_state; | ||
22 | |||
21 | static int lite5200_pm_valid(suspend_state_t state) | 23 | static int lite5200_pm_valid(suspend_state_t state) |
22 | { | 24 | { |
23 | switch (state) { | 25 | switch (state) { |
@@ -29,13 +31,22 @@ static int lite5200_pm_valid(suspend_state_t state) | |||
29 | } | 31 | } |
30 | } | 32 | } |
31 | 33 | ||
32 | static int lite5200_pm_prepare(suspend_state_t state) | 34 | static int lite5200_pm_set_target(suspend_state_t state) |
35 | { | ||
36 | if (lite5200_pm_valid(state)) { | ||
37 | lite5200_pm_target_state = state; | ||
38 | return 0; | ||
39 | } | ||
40 | return -EINVAL; | ||
41 | } | ||
42 | |||
43 | static int lite5200_pm_prepare(void) | ||
33 | { | 44 | { |
34 | /* deep sleep? let mpc52xx code handle that */ | 45 | /* deep sleep? let mpc52xx code handle that */ |
35 | if (state == PM_SUSPEND_STANDBY) | 46 | if (lite5200_pm_target_state == PM_SUSPEND_STANDBY) |
36 | return mpc52xx_pm_prepare(state); | 47 | return mpc52xx_pm_prepare(); |
37 | 48 | ||
38 | if (state != PM_SUSPEND_MEM) | 49 | if (lite5200_pm_target_state != PM_SUSPEND_MEM) |
39 | return -EINVAL; | 50 | return -EINVAL; |
40 | 51 | ||
41 | /* map registers */ | 52 | /* map registers */ |
@@ -190,17 +201,16 @@ static int lite5200_pm_enter(suspend_state_t state) | |||
190 | return 0; | 201 | return 0; |
191 | } | 202 | } |
192 | 203 | ||
193 | static int lite5200_pm_finish(suspend_state_t state) | 204 | static void lite5200_pm_finish(void) |
194 | { | 205 | { |
195 | /* deep sleep? let mpc52xx code handle that */ | 206 | /* deep sleep? let mpc52xx code handle that */ |
196 | if (state == PM_SUSPEND_STANDBY) { | 207 | if (lite5200_pm_target_state == PM_SUSPEND_STANDBY) |
197 | return mpc52xx_pm_finish(state); | 208 | mpc52xx_pm_finish(); |
198 | } | ||
199 | return 0; | ||
200 | } | 209 | } |
201 | 210 | ||
202 | static struct pm_ops lite5200_pm_ops = { | 211 | static struct platform_suspend_ops lite5200_pm_ops = { |
203 | .valid = lite5200_pm_valid, | 212 | .valid = lite5200_pm_valid, |
213 | .set_target = lite5200_pm_set_target, | ||
204 | .prepare = lite5200_pm_prepare, | 214 | .prepare = lite5200_pm_prepare, |
205 | .enter = lite5200_pm_enter, | 215 | .enter = lite5200_pm_enter, |
206 | .finish = lite5200_pm_finish, | 216 | .finish = lite5200_pm_finish, |
@@ -208,6 +218,6 @@ static struct pm_ops lite5200_pm_ops = { | |||
208 | 218 | ||
209 | int __init lite5200_pm_init(void) | 219 | int __init lite5200_pm_init(void) |
210 | { | 220 | { |
211 | pm_set_ops(&lite5200_pm_ops); | 221 | suspend_set_ops(&lite5200_pm_ops); |
212 | return 0; | 222 | return 0; |
213 | } | 223 | } |
diff --git a/arch/powerpc/platforms/52xx/mpc52xx_pm.c b/arch/powerpc/platforms/52xx/mpc52xx_pm.c index 44fb064c7a16..7ffa7babf254 100644 --- a/arch/powerpc/platforms/52xx/mpc52xx_pm.c +++ b/arch/powerpc/platforms/52xx/mpc52xx_pm.c | |||
@@ -57,11 +57,8 @@ int mpc52xx_set_wakeup_gpio(u8 pin, u8 level) | |||
57 | return 0; | 57 | return 0; |
58 | } | 58 | } |
59 | 59 | ||
60 | int mpc52xx_pm_prepare(suspend_state_t state) | 60 | int mpc52xx_pm_prepare(void) |
61 | { | 61 | { |
62 | if (state != PM_SUSPEND_STANDBY) | ||
63 | return -EINVAL; | ||
64 | |||
65 | /* map the whole register space */ | 62 | /* map the whole register space */ |
66 | mbar = mpc52xx_find_and_map("mpc5200"); | 63 | mbar = mpc52xx_find_and_map("mpc5200"); |
67 | if (!mbar) { | 64 | if (!mbar) { |
@@ -166,15 +163,13 @@ int mpc52xx_pm_enter(suspend_state_t state) | |||
166 | return 0; | 163 | return 0; |
167 | } | 164 | } |
168 | 165 | ||
169 | int mpc52xx_pm_finish(suspend_state_t state) | 166 | void mpc52xx_pm_finish(void) |
170 | { | 167 | { |
171 | /* call board resume code */ | 168 | /* call board resume code */ |
172 | if (mpc52xx_suspend.board_resume_finish) | 169 | if (mpc52xx_suspend.board_resume_finish) |
173 | mpc52xx_suspend.board_resume_finish(mbar); | 170 | mpc52xx_suspend.board_resume_finish(mbar); |
174 | 171 | ||
175 | iounmap(mbar); | 172 | iounmap(mbar); |
176 | |||
177 | return 0; | ||
178 | } | 173 | } |
179 | 174 | ||
180 | static struct platform_suspend_ops mpc52xx_pm_ops = { | 175 | static struct platform_suspend_ops mpc52xx_pm_ops = { |