diff options
| author | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2014-05-20 07:22:15 -0400 |
|---|---|---|
| committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2014-05-20 07:22:15 -0400 |
| commit | 55cc33ceb75643d190ed215f423972e0b7ae7aeb (patch) | |
| tree | e9573d995bfae0f81ce800433b424bb998f90eca /include/linux | |
| parent | 1f0b63866fc1be700260547be8edf8e6f0af37f2 (diff) | |
| parent | f71495f3f0c5f0801823d1235b271a4a415d3df8 (diff) | |
Merge branch 'pm-sleep' into acpi-pm
Diffstat (limited to 'include/linux')
| -rw-r--r-- | include/linux/cpuidle.h | 7 | ||||
| -rw-r--r-- | include/linux/pm.h | 36 | ||||
| -rw-r--r-- | include/linux/pm_runtime.h | 6 |
3 files changed, 36 insertions, 13 deletions
diff --git a/include/linux/cpuidle.h b/include/linux/cpuidle.h index b0238cba440b..c51a436135c4 100644 --- a/include/linux/cpuidle.h +++ b/include/linux/cpuidle.h | |||
| @@ -120,8 +120,6 @@ struct cpuidle_driver { | |||
| 120 | #ifdef CONFIG_CPU_IDLE | 120 | #ifdef CONFIG_CPU_IDLE |
| 121 | extern void disable_cpuidle(void); | 121 | extern void disable_cpuidle(void); |
| 122 | 122 | ||
| 123 | extern int cpuidle_enabled(struct cpuidle_driver *drv, | ||
| 124 | struct cpuidle_device *dev); | ||
| 125 | extern int cpuidle_select(struct cpuidle_driver *drv, | 123 | extern int cpuidle_select(struct cpuidle_driver *drv, |
| 126 | struct cpuidle_device *dev); | 124 | struct cpuidle_device *dev); |
| 127 | extern int cpuidle_enter(struct cpuidle_driver *drv, | 125 | extern int cpuidle_enter(struct cpuidle_driver *drv, |
| @@ -145,13 +143,11 @@ extern void cpuidle_resume(void); | |||
| 145 | extern int cpuidle_enable_device(struct cpuidle_device *dev); | 143 | extern int cpuidle_enable_device(struct cpuidle_device *dev); |
| 146 | extern void cpuidle_disable_device(struct cpuidle_device *dev); | 144 | extern void cpuidle_disable_device(struct cpuidle_device *dev); |
| 147 | extern int cpuidle_play_dead(void); | 145 | extern int cpuidle_play_dead(void); |
| 146 | extern void cpuidle_use_deepest_state(bool enable); | ||
| 148 | 147 | ||
| 149 | extern struct cpuidle_driver *cpuidle_get_cpu_driver(struct cpuidle_device *dev); | 148 | extern struct cpuidle_driver *cpuidle_get_cpu_driver(struct cpuidle_device *dev); |
| 150 | #else | 149 | #else |
| 151 | static inline void disable_cpuidle(void) { } | 150 | static inline void disable_cpuidle(void) { } |
| 152 | static inline int cpuidle_enabled(struct cpuidle_driver *drv, | ||
| 153 | struct cpuidle_device *dev) | ||
| 154 | {return -ENODEV; } | ||
| 155 | static inline int cpuidle_select(struct cpuidle_driver *drv, | 151 | static inline int cpuidle_select(struct cpuidle_driver *drv, |
| 156 | struct cpuidle_device *dev) | 152 | struct cpuidle_device *dev) |
| 157 | {return -ENODEV; } | 153 | {return -ENODEV; } |
| @@ -180,6 +176,7 @@ static inline int cpuidle_enable_device(struct cpuidle_device *dev) | |||
| 180 | {return -ENODEV; } | 176 | {return -ENODEV; } |
| 181 | static inline void cpuidle_disable_device(struct cpuidle_device *dev) { } | 177 | static inline void cpuidle_disable_device(struct cpuidle_device *dev) { } |
| 182 | static inline int cpuidle_play_dead(void) {return -ENODEV; } | 178 | static inline int cpuidle_play_dead(void) {return -ENODEV; } |
| 179 | static inline void cpuidle_use_deepest_state(bool enable) {} | ||
| 183 | static inline struct cpuidle_driver *cpuidle_get_cpu_driver( | 180 | static inline struct cpuidle_driver *cpuidle_get_cpu_driver( |
| 184 | struct cpuidle_device *dev) {return NULL; } | 181 | struct cpuidle_device *dev) {return NULL; } |
| 185 | #endif | 182 | #endif |
diff --git a/include/linux/pm.h b/include/linux/pm.h index d915d0345fa1..72c0fe098a27 100644 --- a/include/linux/pm.h +++ b/include/linux/pm.h | |||
| @@ -93,13 +93,23 @@ typedef struct pm_message { | |||
| 93 | * been registered) to recover from the race condition. | 93 | * been registered) to recover from the race condition. |
| 94 | * This method is executed for all kinds of suspend transitions and is | 94 | * This method is executed for all kinds of suspend transitions and is |
| 95 | * followed by one of the suspend callbacks: @suspend(), @freeze(), or | 95 | * followed by one of the suspend callbacks: @suspend(), @freeze(), or |
| 96 | * @poweroff(). The PM core executes subsystem-level @prepare() for all | 96 | * @poweroff(). If the transition is a suspend to memory or standby (that |
| 97 | * devices before starting to invoke suspend callbacks for any of them, so | 97 | * is, not related to hibernation), the return value of @prepare() may be |
| 98 | * generally devices may be assumed to be functional or to respond to | 98 | * used to indicate to the PM core to leave the device in runtime suspend |
| 99 | * runtime resume requests while @prepare() is being executed. However, | 99 | * if applicable. Namely, if @prepare() returns a positive number, the PM |
| 100 | * device drivers may NOT assume anything about the availability of user | 100 | * core will understand that as a declaration that the device appears to be |
| 101 | * space at that time and it is NOT valid to request firmware from within | 101 | * runtime-suspended and it may be left in that state during the entire |
| 102 | * @prepare() (it's too late to do that). It also is NOT valid to allocate | 102 | * transition and during the subsequent resume if all of its descendants |
| 103 | * are left in runtime suspend too. If that happens, @complete() will be | ||
| 104 | * executed directly after @prepare() and it must ensure the proper | ||
| 105 | * functioning of the device after the system resume. | ||
| 106 | * The PM core executes subsystem-level @prepare() for all devices before | ||
| 107 | * starting to invoke suspend callbacks for any of them, so generally | ||
| 108 | * devices may be assumed to be functional or to respond to runtime resume | ||
| 109 | * requests while @prepare() is being executed. However, device drivers | ||
| 110 | * may NOT assume anything about the availability of user space at that | ||
| 111 | * time and it is NOT valid to request firmware from within @prepare() | ||
| 112 | * (it's too late to do that). It also is NOT valid to allocate | ||
| 103 | * substantial amounts of memory from @prepare() in the GFP_KERNEL mode. | 113 | * substantial amounts of memory from @prepare() in the GFP_KERNEL mode. |
| 104 | * [To work around these limitations, drivers may register suspend and | 114 | * [To work around these limitations, drivers may register suspend and |
| 105 | * hibernation notifiers to be executed before the freezing of tasks.] | 115 | * hibernation notifiers to be executed before the freezing of tasks.] |
| @@ -112,7 +122,16 @@ typedef struct pm_message { | |||
| 112 | * of the other devices that the PM core has unsuccessfully attempted to | 122 | * of the other devices that the PM core has unsuccessfully attempted to |
| 113 | * suspend earlier). | 123 | * suspend earlier). |
| 114 | * The PM core executes subsystem-level @complete() after it has executed | 124 | * The PM core executes subsystem-level @complete() after it has executed |
| 115 | * the appropriate resume callbacks for all devices. | 125 | * the appropriate resume callbacks for all devices. If the corresponding |
| 126 | * @prepare() at the beginning of the suspend transition returned a | ||
| 127 | * positive number and the device was left in runtime suspend (without | ||
| 128 | * executing any suspend and resume callbacks for it), @complete() will be | ||
| 129 | * the only callback executed for the device during resume. In that case, | ||
| 130 | * @complete() must be prepared to do whatever is necessary to ensure the | ||
| 131 | * proper functioning of the device after the system resume. To this end, | ||
| 132 | * @complete() can check the power.direct_complete flag of the device to | ||
| 133 | * learn whether (unset) or not (set) the previous suspend and resume | ||
| 134 | * callbacks have been executed for it. | ||
| 116 | * | 135 | * |
| 117 | * @suspend: Executed before putting the system into a sleep state in which the | 136 | * @suspend: Executed before putting the system into a sleep state in which the |
| 118 | * contents of main memory are preserved. The exact action to perform | 137 | * contents of main memory are preserved. The exact action to perform |
| @@ -546,6 +565,7 @@ struct dev_pm_info { | |||
| 546 | bool is_late_suspended:1; | 565 | bool is_late_suspended:1; |
| 547 | bool ignore_children:1; | 566 | bool ignore_children:1; |
| 548 | bool early_init:1; /* Owned by the PM core */ | 567 | bool early_init:1; /* Owned by the PM core */ |
| 568 | bool direct_complete:1; /* Owned by the PM core */ | ||
| 549 | spinlock_t lock; | 569 | spinlock_t lock; |
| 550 | #ifdef CONFIG_PM_SLEEP | 570 | #ifdef CONFIG_PM_SLEEP |
| 551 | struct list_head entry; | 571 | struct list_head entry; |
diff --git a/include/linux/pm_runtime.h b/include/linux/pm_runtime.h index 2a5897a4afbc..43fd6716f662 100644 --- a/include/linux/pm_runtime.h +++ b/include/linux/pm_runtime.h | |||
| @@ -101,6 +101,11 @@ static inline bool pm_runtime_status_suspended(struct device *dev) | |||
| 101 | return dev->power.runtime_status == RPM_SUSPENDED; | 101 | return dev->power.runtime_status == RPM_SUSPENDED; |
| 102 | } | 102 | } |
| 103 | 103 | ||
| 104 | static inline bool pm_runtime_suspended_if_enabled(struct device *dev) | ||
| 105 | { | ||
| 106 | return pm_runtime_status_suspended(dev) && dev->power.disable_depth == 1; | ||
| 107 | } | ||
| 108 | |||
| 104 | static inline bool pm_runtime_enabled(struct device *dev) | 109 | static inline bool pm_runtime_enabled(struct device *dev) |
| 105 | { | 110 | { |
| 106 | return !dev->power.disable_depth; | 111 | return !dev->power.disable_depth; |
| @@ -150,6 +155,7 @@ static inline void device_set_run_wake(struct device *dev, bool enable) {} | |||
| 150 | static inline bool pm_runtime_suspended(struct device *dev) { return false; } | 155 | static inline bool pm_runtime_suspended(struct device *dev) { return false; } |
| 151 | static inline bool pm_runtime_active(struct device *dev) { return true; } | 156 | static inline bool pm_runtime_active(struct device *dev) { return true; } |
| 152 | static inline bool pm_runtime_status_suspended(struct device *dev) { return false; } | 157 | static inline bool pm_runtime_status_suspended(struct device *dev) { return false; } |
| 158 | static inline bool pm_runtime_suspended_if_enabled(struct device *dev) { return false; } | ||
| 153 | static inline bool pm_runtime_enabled(struct device *dev) { return false; } | 159 | static inline bool pm_runtime_enabled(struct device *dev) { return false; } |
| 154 | 160 | ||
| 155 | static inline void pm_runtime_no_callbacks(struct device *dev) {} | 161 | static inline void pm_runtime_no_callbacks(struct device *dev) {} |
