aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorRafael J. Wysocki <rjw@sisk.pl>2008-01-07 18:04:17 -0500
committerLen Brown <len.brown@intel.com>2008-02-01 18:30:56 -0500
commitc697eecebc6cfc0b393afea3c4ff1a5041526ad1 (patch)
tree36b0cb4e667792212c2b5d05ac212662555d1682 /arch
parent7671b8ae5381a504d4c4ef8dd9c47128c2c3fd7e (diff)
Suspend: Introduce begin() and end() callbacks
On ACPI systems the target state set by acpi_pm_set_target() is reset by acpi_pm_finish(), but that need not be called if the suspend fails.  All platforms that use the .set_target() global suspend callback are affected by analogous issues. For this reason, we need an additional global suspend callback that will reset the target state regardless of whether or not the suspend is successful.  Also, it is reasonable to rename the .set_target() callback, since it will be used for a different purpose on ACPI systems (due to ACPI 1.0x code ordering requirements). Introduce the global suspend callback .end() to be executed at the end of the suspend sequence and rename the .set_target() global suspend callback to .begin(). Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl> Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/mach-at91/pm.c17
-rw-r--r--arch/powerpc/platforms/52xx/lite5200_pm.c10
2 files changed, 21 insertions, 6 deletions
diff --git a/arch/arm/mach-at91/pm.c b/arch/arm/mach-at91/pm.c
index 4b120cc36135..a67defd50438 100644
--- a/arch/arm/mach-at91/pm.c
+++ b/arch/arm/mach-at91/pm.c
@@ -52,7 +52,7 @@ static suspend_state_t target_state;
52/* 52/*
53 * Called after processes are frozen, but before we shutdown devices. 53 * Called after processes are frozen, but before we shutdown devices.
54 */ 54 */
55static int at91_pm_set_target(suspend_state_t state) 55static int at91_pm_begin(suspend_state_t state)
56{ 56{
57 target_state = state; 57 target_state = state;
58 return 0; 58 return 0;
@@ -202,11 +202,20 @@ error:
202 return 0; 202 return 0;
203} 203}
204 204
205/*
206 * Called right prior to thawing processes.
207 */
208static void at91_pm_end(void)
209{
210 target_state = PM_SUSPEND_ON;
211}
212
205 213
206static struct platform_suspend_ops at91_pm_ops ={ 214static struct platform_suspend_ops at91_pm_ops ={
207 .valid = at91_pm_valid_state, 215 .valid = at91_pm_valid_state,
208 .set_target = at91_pm_set_target, 216 .begin = at91_pm_begin,
209 .enter = at91_pm_enter, 217 .enter = at91_pm_enter,
218 .end = at91_pm_end,
210}; 219};
211 220
212static int __init at91_pm_init(void) 221static int __init at91_pm_init(void)
diff --git a/arch/powerpc/platforms/52xx/lite5200_pm.c b/arch/powerpc/platforms/52xx/lite5200_pm.c
index c0f13e8deb0b..41c7fd91e99e 100644
--- a/arch/powerpc/platforms/52xx/lite5200_pm.c
+++ b/arch/powerpc/platforms/52xx/lite5200_pm.c
@@ -31,7 +31,7 @@ static int lite5200_pm_valid(suspend_state_t state)
31 } 31 }
32} 32}
33 33
34static int lite5200_pm_set_target(suspend_state_t state) 34static int lite5200_pm_begin(suspend_state_t state)
35{ 35{
36 if (lite5200_pm_valid(state)) { 36 if (lite5200_pm_valid(state)) {
37 lite5200_pm_target_state = state; 37 lite5200_pm_target_state = state;
@@ -219,12 +219,18 @@ static void lite5200_pm_finish(void)
219 mpc52xx_pm_finish(); 219 mpc52xx_pm_finish();
220} 220}
221 221
222static void lite5200_pm_end(void)
223{
224 lite5200_pm_target_state = PM_SUSPEND_ON;
225}
226
222static struct platform_suspend_ops lite5200_pm_ops = { 227static struct platform_suspend_ops lite5200_pm_ops = {
223 .valid = lite5200_pm_valid, 228 .valid = lite5200_pm_valid,
224 .set_target = lite5200_pm_set_target, 229 .begin = lite5200_pm_begin,
225 .prepare = lite5200_pm_prepare, 230 .prepare = lite5200_pm_prepare,
226 .enter = lite5200_pm_enter, 231 .enter = lite5200_pm_enter,
227 .finish = lite5200_pm_finish, 232 .finish = lite5200_pm_finish,
233 .end = lite5200_pm_end,
228}; 234};
229 235
230int __init lite5200_pm_init(void) 236int __init lite5200_pm_init(void)