diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2011-01-10 11:14:53 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-01-10 11:14:53 -0500 |
commit | c8940eca75e6d1ea57f6c491a30bd1023c64c9ad (patch) | |
tree | d68944ab9fa8ba3c77b18edc2bd836c7e355b23e /include | |
parent | 78c92a9fd4b6abbbc1fe1ec335c697cb4e63f252 (diff) | |
parent | 3ae22e8c8ac39daf88ae32f047fb23825be7c646 (diff) |
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/suspend-2.6
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/suspend-2.6:
spi / PM: Support dev_pm_ops
PM: Prototype the pm_generic_ operations
PM / Runtime: Generic resume shouldn't set RPM_ACTIVE unconditionally
PM: Use dev_name() in core device suspend and resume routines
PM: Permit registration of parentless devices during system suspend
PM: Replace the device power.status field with a bit field
PM: Remove redundant checks from core device resume routines
PM: Use a different list of devices for each stage of device suspend
PM: Avoid compiler warning in pm_noirq_op()
PM: Use pm_wakeup_pending() in __device_suspend()
PM / Wakeup: Replace pm_check_wakeup_events() with pm_wakeup_pending()
PM: Prevent dpm_prepare() from returning errors unnecessarily
PM: Fix references to basic-pm-debugging.txt in drivers-testing.txt
PM / Runtime: Add synchronous runtime interface for interrupt handlers (v3)
PM / Hibernate: When failed, in_suspend should be reset
PM / Hibernate: hibernation_ops->leave should be checked too
Freezer: Fix a race during freezing of TASK_STOPPED tasks
PM: Use proper ccflag flag in kernel/power/Makefile
PM / Runtime: Fix comments to match runtime callback code
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/device.h | 4 | ||||
-rw-r--r-- | include/linux/pm.h | 51 | ||||
-rw-r--r-- | include/linux/pm_runtime.h | 13 | ||||
-rw-r--r-- | include/linux/suspend.h | 4 |
4 files changed, 27 insertions, 45 deletions
diff --git a/include/linux/device.h b/include/linux/device.h index dd4895313468..45bc8c1669d2 100644 --- a/include/linux/device.h +++ b/include/linux/device.h | |||
@@ -508,13 +508,13 @@ static inline int device_is_registered(struct device *dev) | |||
508 | 508 | ||
509 | static inline void device_enable_async_suspend(struct device *dev) | 509 | static inline void device_enable_async_suspend(struct device *dev) |
510 | { | 510 | { |
511 | if (dev->power.status == DPM_ON) | 511 | if (!dev->power.in_suspend) |
512 | dev->power.async_suspend = true; | 512 | dev->power.async_suspend = true; |
513 | } | 513 | } |
514 | 514 | ||
515 | static inline void device_disable_async_suspend(struct device *dev) | 515 | static inline void device_disable_async_suspend(struct device *dev) |
516 | { | 516 | { |
517 | if (dev->power.status == DPM_ON) | 517 | if (!dev->power.in_suspend) |
518 | dev->power.async_suspend = false; | 518 | dev->power.async_suspend = false; |
519 | } | 519 | } |
520 | 520 | ||
diff --git a/include/linux/pm.h b/include/linux/pm.h index 40f3f45702ba..dd9c7ab38270 100644 --- a/include/linux/pm.h +++ b/include/linux/pm.h | |||
@@ -367,45 +367,6 @@ extern struct dev_pm_ops generic_subsys_pm_ops; | |||
367 | { .event = PM_EVENT_AUTO_RESUME, }) | 367 | { .event = PM_EVENT_AUTO_RESUME, }) |
368 | 368 | ||
369 | /** | 369 | /** |
370 | * Device power management states | ||
371 | * | ||
372 | * These state labels are used internally by the PM core to indicate the current | ||
373 | * status of a device with respect to the PM core operations. | ||
374 | * | ||
375 | * DPM_ON Device is regarded as operational. Set this way | ||
376 | * initially and when ->complete() is about to be called. | ||
377 | * Also set when ->prepare() fails. | ||
378 | * | ||
379 | * DPM_PREPARING Device is going to be prepared for a PM transition. Set | ||
380 | * when ->prepare() is about to be called. | ||
381 | * | ||
382 | * DPM_RESUMING Device is going to be resumed. Set when ->resume(), | ||
383 | * ->thaw(), or ->restore() is about to be called. | ||
384 | * | ||
385 | * DPM_SUSPENDING Device has been prepared for a power transition. Set | ||
386 | * when ->prepare() has just succeeded. | ||
387 | * | ||
388 | * DPM_OFF Device is regarded as inactive. Set immediately after | ||
389 | * ->suspend(), ->freeze(), or ->poweroff() has succeeded. | ||
390 | * Also set when ->resume()_noirq, ->thaw_noirq(), or | ||
391 | * ->restore_noirq() is about to be called. | ||
392 | * | ||
393 | * DPM_OFF_IRQ Device is in a "deep sleep". Set immediately after | ||
394 | * ->suspend_noirq(), ->freeze_noirq(), or | ||
395 | * ->poweroff_noirq() has just succeeded. | ||
396 | */ | ||
397 | |||
398 | enum dpm_state { | ||
399 | DPM_INVALID, | ||
400 | DPM_ON, | ||
401 | DPM_PREPARING, | ||
402 | DPM_RESUMING, | ||
403 | DPM_SUSPENDING, | ||
404 | DPM_OFF, | ||
405 | DPM_OFF_IRQ, | ||
406 | }; | ||
407 | |||
408 | /** | ||
409 | * Device run-time power management status. | 370 | * Device run-time power management status. |
410 | * | 371 | * |
411 | * These status labels are used internally by the PM core to indicate the | 372 | * These status labels are used internally by the PM core to indicate the |
@@ -463,8 +424,8 @@ struct wakeup_source; | |||
463 | struct dev_pm_info { | 424 | struct dev_pm_info { |
464 | pm_message_t power_state; | 425 | pm_message_t power_state; |
465 | unsigned int can_wakeup:1; | 426 | unsigned int can_wakeup:1; |
466 | unsigned async_suspend:1; | 427 | unsigned int async_suspend:1; |
467 | enum dpm_state status; /* Owned by the PM core */ | 428 | unsigned int in_suspend:1; /* Owned by the PM core */ |
468 | spinlock_t lock; | 429 | spinlock_t lock; |
469 | #ifdef CONFIG_PM_SLEEP | 430 | #ifdef CONFIG_PM_SLEEP |
470 | struct list_head entry; | 431 | struct list_head entry; |
@@ -486,6 +447,7 @@ struct dev_pm_info { | |||
486 | unsigned int run_wake:1; | 447 | unsigned int run_wake:1; |
487 | unsigned int runtime_auto:1; | 448 | unsigned int runtime_auto:1; |
488 | unsigned int no_callbacks:1; | 449 | unsigned int no_callbacks:1; |
450 | unsigned int irq_safe:1; | ||
489 | unsigned int use_autosuspend:1; | 451 | unsigned int use_autosuspend:1; |
490 | unsigned int timer_autosuspends:1; | 452 | unsigned int timer_autosuspends:1; |
491 | enum rpm_request request; | 453 | enum rpm_request request; |
@@ -610,4 +572,11 @@ extern unsigned int pm_flags; | |||
610 | #define PM_APM 1 | 572 | #define PM_APM 1 |
611 | #define PM_ACPI 2 | 573 | #define PM_ACPI 2 |
612 | 574 | ||
575 | extern int pm_generic_suspend(struct device *dev); | ||
576 | extern int pm_generic_resume(struct device *dev); | ||
577 | extern int pm_generic_freeze(struct device *dev); | ||
578 | extern int pm_generic_thaw(struct device *dev); | ||
579 | extern int pm_generic_restore(struct device *dev); | ||
580 | extern int pm_generic_poweroff(struct device *dev); | ||
581 | |||
613 | #endif /* _LINUX_PM_H */ | 582 | #endif /* _LINUX_PM_H */ |
diff --git a/include/linux/pm_runtime.h b/include/linux/pm_runtime.h index d19f1cca7f74..d34f067e2a7f 100644 --- a/include/linux/pm_runtime.h +++ b/include/linux/pm_runtime.h | |||
@@ -40,6 +40,7 @@ extern int pm_generic_runtime_idle(struct device *dev); | |||
40 | extern int pm_generic_runtime_suspend(struct device *dev); | 40 | extern int pm_generic_runtime_suspend(struct device *dev); |
41 | extern int pm_generic_runtime_resume(struct device *dev); | 41 | extern int pm_generic_runtime_resume(struct device *dev); |
42 | extern void pm_runtime_no_callbacks(struct device *dev); | 42 | extern void pm_runtime_no_callbacks(struct device *dev); |
43 | extern void pm_runtime_irq_safe(struct device *dev); | ||
43 | extern void __pm_runtime_use_autosuspend(struct device *dev, bool use); | 44 | extern void __pm_runtime_use_autosuspend(struct device *dev, bool use); |
44 | extern void pm_runtime_set_autosuspend_delay(struct device *dev, int delay); | 45 | extern void pm_runtime_set_autosuspend_delay(struct device *dev, int delay); |
45 | extern unsigned long pm_runtime_autosuspend_expiration(struct device *dev); | 46 | extern unsigned long pm_runtime_autosuspend_expiration(struct device *dev); |
@@ -81,6 +82,11 @@ static inline bool pm_runtime_suspended(struct device *dev) | |||
81 | && !dev->power.disable_depth; | 82 | && !dev->power.disable_depth; |
82 | } | 83 | } |
83 | 84 | ||
85 | static inline bool pm_runtime_enabled(struct device *dev) | ||
86 | { | ||
87 | return !dev->power.disable_depth; | ||
88 | } | ||
89 | |||
84 | static inline void pm_runtime_mark_last_busy(struct device *dev) | 90 | static inline void pm_runtime_mark_last_busy(struct device *dev) |
85 | { | 91 | { |
86 | ACCESS_ONCE(dev->power.last_busy) = jiffies; | 92 | ACCESS_ONCE(dev->power.last_busy) = jiffies; |
@@ -119,11 +125,13 @@ static inline void pm_runtime_put_noidle(struct device *dev) {} | |||
119 | static inline bool device_run_wake(struct device *dev) { return false; } | 125 | static inline bool device_run_wake(struct device *dev) { return false; } |
120 | static inline void device_set_run_wake(struct device *dev, bool enable) {} | 126 | static inline void device_set_run_wake(struct device *dev, bool enable) {} |
121 | static inline bool pm_runtime_suspended(struct device *dev) { return false; } | 127 | static inline bool pm_runtime_suspended(struct device *dev) { return false; } |
128 | static inline bool pm_runtime_enabled(struct device *dev) { return false; } | ||
122 | 129 | ||
123 | static inline int pm_generic_runtime_idle(struct device *dev) { return 0; } | 130 | static inline int pm_generic_runtime_idle(struct device *dev) { return 0; } |
124 | static inline int pm_generic_runtime_suspend(struct device *dev) { return 0; } | 131 | static inline int pm_generic_runtime_suspend(struct device *dev) { return 0; } |
125 | static inline int pm_generic_runtime_resume(struct device *dev) { return 0; } | 132 | static inline int pm_generic_runtime_resume(struct device *dev) { return 0; } |
126 | static inline void pm_runtime_no_callbacks(struct device *dev) {} | 133 | static inline void pm_runtime_no_callbacks(struct device *dev) {} |
134 | static inline void pm_runtime_irq_safe(struct device *dev) {} | ||
127 | 135 | ||
128 | static inline void pm_runtime_mark_last_busy(struct device *dev) {} | 136 | static inline void pm_runtime_mark_last_busy(struct device *dev) {} |
129 | static inline void __pm_runtime_use_autosuspend(struct device *dev, | 137 | static inline void __pm_runtime_use_autosuspend(struct device *dev, |
@@ -196,6 +204,11 @@ static inline int pm_runtime_put_sync(struct device *dev) | |||
196 | return __pm_runtime_idle(dev, RPM_GET_PUT); | 204 | return __pm_runtime_idle(dev, RPM_GET_PUT); |
197 | } | 205 | } |
198 | 206 | ||
207 | static inline int pm_runtime_put_sync_suspend(struct device *dev) | ||
208 | { | ||
209 | return __pm_runtime_suspend(dev, RPM_GET_PUT); | ||
210 | } | ||
211 | |||
199 | static inline int pm_runtime_put_sync_autosuspend(struct device *dev) | 212 | static inline int pm_runtime_put_sync_autosuspend(struct device *dev) |
200 | { | 213 | { |
201 | return __pm_runtime_suspend(dev, RPM_GET_PUT | RPM_AUTO); | 214 | return __pm_runtime_suspend(dev, RPM_GET_PUT | RPM_AUTO); |
diff --git a/include/linux/suspend.h b/include/linux/suspend.h index 26697514c5ec..144b34be5c32 100644 --- a/include/linux/suspend.h +++ b/include/linux/suspend.h | |||
@@ -292,7 +292,7 @@ extern int unregister_pm_notifier(struct notifier_block *nb); | |||
292 | /* drivers/base/power/wakeup.c */ | 292 | /* drivers/base/power/wakeup.c */ |
293 | extern bool events_check_enabled; | 293 | extern bool events_check_enabled; |
294 | 294 | ||
295 | extern bool pm_check_wakeup_events(void); | 295 | extern bool pm_wakeup_pending(void); |
296 | extern bool pm_get_wakeup_count(unsigned int *count); | 296 | extern bool pm_get_wakeup_count(unsigned int *count); |
297 | extern bool pm_save_wakeup_count(unsigned int count); | 297 | extern bool pm_save_wakeup_count(unsigned int count); |
298 | #else /* !CONFIG_PM_SLEEP */ | 298 | #else /* !CONFIG_PM_SLEEP */ |
@@ -309,7 +309,7 @@ static inline int unregister_pm_notifier(struct notifier_block *nb) | |||
309 | 309 | ||
310 | #define pm_notifier(fn, pri) do { (void)(fn); } while (0) | 310 | #define pm_notifier(fn, pri) do { (void)(fn); } while (0) |
311 | 311 | ||
312 | static inline bool pm_check_wakeup_events(void) { return true; } | 312 | static inline bool pm_wakeup_pending(void) { return false; } |
313 | #endif /* !CONFIG_PM_SLEEP */ | 313 | #endif /* !CONFIG_PM_SLEEP */ |
314 | 314 | ||
315 | extern struct mutex pm_mutex; | 315 | extern struct mutex pm_mutex; |