aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel/apm_32.c
diff options
context:
space:
mode:
authorRafael J. Wysocki <rjw@sisk.pl>2012-01-29 14:38:29 -0500
committerRafael J. Wysocki <rjw@sisk.pl>2012-01-29 14:38:29 -0500
commitcf579dfb82550e34de7ccf3ef090d8b834ccd3a9 (patch)
tree764ed72670c18c86d3eb9650025c56d661a31315 /arch/x86/kernel/apm_32.c
parent181e9bdef37bfcaa41f3ab6c948a2a0d60a268b5 (diff)
PM / Sleep: Introduce "late suspend" and "early resume" of devices
The current device suspend/resume phases during system-wide power transitions appear to be insufficient for some platforms that want to use the same callback routines for saving device states and related operations during runtime suspend/resume as well as during system suspend/resume. In principle, they could point their .suspend_noirq() and .resume_noirq() to the same callback routines as their .runtime_suspend() and .runtime_resume(), respectively, but at least some of them require device interrupts to be enabled while the code in those routines is running. It also makes sense to have device suspend-resume callbacks that will be executed with runtime PM disabled and with device interrupts enabled in case someone needs to run some special code in that context during system-wide power transitions. Apart from this, .suspend_noirq() and .resume_noirq() were introduced as a workaround for drivers using shared interrupts and failing to prevent their interrupt handlers from accessing suspended hardware. It appears to be better not to use them for other porposes, or we may have to deal with some serious confusion (which seems to be happening already). For the above reasons, introduce new device suspend/resume phases, "late suspend" and "early resume" (and analogously for hibernation) whose callback will be executed with runtime PM disabled and with device interrupts enabled and whose callback pointers generally may point to runtime suspend/resume routines. Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl> Reviewed-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Reviewed-by: Kevin Hilman <khilman@ti.com>
Diffstat (limited to 'arch/x86/kernel/apm_32.c')
-rw-r--r--arch/x86/kernel/apm_32.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/arch/x86/kernel/apm_32.c b/arch/x86/kernel/apm_32.c
index f76623cbe263..5d56931a15b3 100644
--- a/arch/x86/kernel/apm_32.c
+++ b/arch/x86/kernel/apm_32.c
@@ -1234,8 +1234,7 @@ static int suspend(int vetoable)
1234 struct apm_user *as; 1234 struct apm_user *as;
1235 1235
1236 dpm_suspend_start(PMSG_SUSPEND); 1236 dpm_suspend_start(PMSG_SUSPEND);
1237 1237 dpm_suspend_end(PMSG_SUSPEND);
1238 dpm_suspend_noirq(PMSG_SUSPEND);
1239 1238
1240 local_irq_disable(); 1239 local_irq_disable();
1241 syscore_suspend(); 1240 syscore_suspend();
@@ -1259,9 +1258,9 @@ static int suspend(int vetoable)
1259 syscore_resume(); 1258 syscore_resume();
1260 local_irq_enable(); 1259 local_irq_enable();
1261 1260
1262 dpm_resume_noirq(PMSG_RESUME); 1261 dpm_resume_start(PMSG_RESUME);
1263
1264 dpm_resume_end(PMSG_RESUME); 1262 dpm_resume_end(PMSG_RESUME);
1263
1265 queue_event(APM_NORMAL_RESUME, NULL); 1264 queue_event(APM_NORMAL_RESUME, NULL);
1266 spin_lock(&user_list_lock); 1265 spin_lock(&user_list_lock);
1267 for (as = user_list; as != NULL; as = as->next) { 1266 for (as = user_list; as != NULL; as = as->next) {
@@ -1277,7 +1276,7 @@ static void standby(void)
1277{ 1276{
1278 int err; 1277 int err;
1279 1278
1280 dpm_suspend_noirq(PMSG_SUSPEND); 1279 dpm_suspend_end(PMSG_SUSPEND);
1281 1280
1282 local_irq_disable(); 1281 local_irq_disable();
1283 syscore_suspend(); 1282 syscore_suspend();
@@ -1291,7 +1290,7 @@ static void standby(void)
1291 syscore_resume(); 1290 syscore_resume();
1292 local_irq_enable(); 1291 local_irq_enable();
1293 1292
1294 dpm_resume_noirq(PMSG_RESUME); 1293 dpm_resume_start(PMSG_RESUME);
1295} 1294}
1296 1295
1297static apm_event_t get_event(void) 1296static apm_event_t get_event(void)