diff options
Diffstat (limited to 'include/linux/pm.h')
-rw-r--r-- | include/linux/pm.h | 58 |
1 files changed, 50 insertions, 8 deletions
diff --git a/include/linux/pm.h b/include/linux/pm.h index e4982ac3fbb..d6dd6f612b8 100644 --- a/include/linux/pm.h +++ b/include/linux/pm.h | |||
@@ -110,6 +110,10 @@ typedef struct pm_message { | |||
110 | * Subsystem-level @suspend() is executed for all devices after invoking | 110 | * Subsystem-level @suspend() is executed for all devices after invoking |
111 | * subsystem-level @prepare() for all of them. | 111 | * subsystem-level @prepare() for all of them. |
112 | * | 112 | * |
113 | * @suspend_late: Continue operations started by @suspend(). For a number of | ||
114 | * devices @suspend_late() may point to the same callback routine as the | ||
115 | * runtime suspend callback. | ||
116 | * | ||
113 | * @resume: Executed after waking the system up from a sleep state in which the | 117 | * @resume: Executed after waking the system up from a sleep state in which the |
114 | * contents of main memory were preserved. The exact action to perform | 118 | * contents of main memory were preserved. The exact action to perform |
115 | * depends on the device's subsystem, but generally the driver is expected | 119 | * depends on the device's subsystem, but generally the driver is expected |
@@ -122,6 +126,10 @@ typedef struct pm_message { | |||
122 | * Subsystem-level @resume() is executed for all devices after invoking | 126 | * Subsystem-level @resume() is executed for all devices after invoking |
123 | * subsystem-level @resume_noirq() for all of them. | 127 | * subsystem-level @resume_noirq() for all of them. |
124 | * | 128 | * |
129 | * @resume_early: Prepare to execute @resume(). For a number of devices | ||
130 | * @resume_early() may point to the same callback routine as the runtime | ||
131 | * resume callback. | ||
132 | * | ||
125 | * @freeze: Hibernation-specific, executed before creating a hibernation image. | 133 | * @freeze: Hibernation-specific, executed before creating a hibernation image. |
126 | * Analogous to @suspend(), but it should not enable the device to signal | 134 | * Analogous to @suspend(), but it should not enable the device to signal |
127 | * wakeup events or change its power state. The majority of subsystems | 135 | * wakeup events or change its power state. The majority of subsystems |
@@ -131,6 +139,10 @@ typedef struct pm_message { | |||
131 | * Subsystem-level @freeze() is executed for all devices after invoking | 139 | * Subsystem-level @freeze() is executed for all devices after invoking |
132 | * subsystem-level @prepare() for all of them. | 140 | * subsystem-level @prepare() for all of them. |
133 | * | 141 | * |
142 | * @freeze_late: Continue operations started by @freeze(). Analogous to | ||
143 | * @suspend_late(), but it should not enable the device to signal wakeup | ||
144 | * events or change its power state. | ||
145 | * | ||
134 | * @thaw: Hibernation-specific, executed after creating a hibernation image OR | 146 | * @thaw: Hibernation-specific, executed after creating a hibernation image OR |
135 | * if the creation of an image has failed. Also executed after a failing | 147 | * if the creation of an image has failed. Also executed after a failing |
136 | * attempt to restore the contents of main memory from such an image. | 148 | * attempt to restore the contents of main memory from such an image. |
@@ -140,15 +152,23 @@ typedef struct pm_message { | |||
140 | * subsystem-level @thaw_noirq() for all of them. It also may be executed | 152 | * subsystem-level @thaw_noirq() for all of them. It also may be executed |
141 | * directly after @freeze() in case of a transition error. | 153 | * directly after @freeze() in case of a transition error. |
142 | * | 154 | * |
155 | * @thaw_early: Prepare to execute @thaw(). Undo the changes made by the | ||
156 | * preceding @freeze_late(). | ||
157 | * | ||
143 | * @poweroff: Hibernation-specific, executed after saving a hibernation image. | 158 | * @poweroff: Hibernation-specific, executed after saving a hibernation image. |
144 | * Analogous to @suspend(), but it need not save the device's settings in | 159 | * Analogous to @suspend(), but it need not save the device's settings in |
145 | * memory. | 160 | * memory. |
146 | * Subsystem-level @poweroff() is executed for all devices after invoking | 161 | * Subsystem-level @poweroff() is executed for all devices after invoking |
147 | * subsystem-level @prepare() for all of them. | 162 | * subsystem-level @prepare() for all of them. |
148 | * | 163 | * |
164 | * @poweroff_late: Continue operations started by @poweroff(). Analogous to | ||
165 | * @suspend_late(), but it need not save the device's settings in memory. | ||
166 | * | ||
149 | * @restore: Hibernation-specific, executed after restoring the contents of main | 167 | * @restore: Hibernation-specific, executed after restoring the contents of main |
150 | * memory from a hibernation image, analogous to @resume(). | 168 | * memory from a hibernation image, analogous to @resume(). |
151 | * | 169 | * |
170 | * @restore_early: Prepare to execute @restore(), analogous to @resume_early(). | ||
171 | * | ||
152 | * @suspend_noirq: Complete the actions started by @suspend(). Carry out any | 172 | * @suspend_noirq: Complete the actions started by @suspend(). Carry out any |
153 | * additional operations required for suspending the device that might be | 173 | * additional operations required for suspending the device that might be |
154 | * racing with its driver's interrupt handler, which is guaranteed not to | 174 | * racing with its driver's interrupt handler, which is guaranteed not to |
@@ -158,9 +178,10 @@ typedef struct pm_message { | |||
158 | * @suspend_noirq() has returned successfully. If the device can generate | 178 | * @suspend_noirq() has returned successfully. If the device can generate |
159 | * system wakeup signals and is enabled to wake up the system, it should be | 179 | * system wakeup signals and is enabled to wake up the system, it should be |
160 | * configured to do so at that time. However, depending on the platform | 180 | * configured to do so at that time. However, depending on the platform |
161 | * and device's subsystem, @suspend() may be allowed to put the device into | 181 | * and device's subsystem, @suspend() or @suspend_late() may be allowed to |
162 | * the low-power state and configure it to generate wakeup signals, in | 182 | * put the device into the low-power state and configure it to generate |
163 | * which case it generally is not necessary to define @suspend_noirq(). | 183 | * wakeup signals, in which case it generally is not necessary to define |
184 | * @suspend_noirq(). | ||
164 | * | 185 | * |
165 | * @resume_noirq: Prepare for the execution of @resume() by carrying out any | 186 | * @resume_noirq: Prepare for the execution of @resume() by carrying out any |
166 | * operations required for resuming the device that might be racing with | 187 | * operations required for resuming the device that might be racing with |
@@ -171,9 +192,9 @@ typedef struct pm_message { | |||
171 | * additional operations required for freezing the device that might be | 192 | * additional operations required for freezing the device that might be |
172 | * racing with its driver's interrupt handler, which is guaranteed not to | 193 | * racing with its driver's interrupt handler, which is guaranteed not to |
173 | * run while @freeze_noirq() is being executed. | 194 | * run while @freeze_noirq() is being executed. |
174 | * The power state of the device should not be changed by either @freeze() | 195 | * The power state of the device should not be changed by either @freeze(), |
175 | * or @freeze_noirq() and it should not be configured to signal system | 196 | * or @freeze_late(), or @freeze_noirq() and it should not be configured to |
176 | * wakeup by any of these callbacks. | 197 | * signal system wakeup by any of these callbacks. |
177 | * | 198 | * |
178 | * @thaw_noirq: Prepare for the execution of @thaw() by carrying out any | 199 | * @thaw_noirq: Prepare for the execution of @thaw() by carrying out any |
179 | * operations required for thawing the device that might be racing with its | 200 | * operations required for thawing the device that might be racing with its |
@@ -249,6 +270,12 @@ struct dev_pm_ops { | |||
249 | int (*thaw)(struct device *dev); | 270 | int (*thaw)(struct device *dev); |
250 | int (*poweroff)(struct device *dev); | 271 | int (*poweroff)(struct device *dev); |
251 | int (*restore)(struct device *dev); | 272 | int (*restore)(struct device *dev); |
273 | int (*suspend_late)(struct device *dev); | ||
274 | int (*resume_early)(struct device *dev); | ||
275 | int (*freeze_late)(struct device *dev); | ||
276 | int (*thaw_early)(struct device *dev); | ||
277 | int (*poweroff_late)(struct device *dev); | ||
278 | int (*restore_early)(struct device *dev); | ||
252 | int (*suspend_noirq)(struct device *dev); | 279 | int (*suspend_noirq)(struct device *dev); |
253 | int (*resume_noirq)(struct device *dev); | 280 | int (*resume_noirq)(struct device *dev); |
254 | int (*freeze_noirq)(struct device *dev); | 281 | int (*freeze_noirq)(struct device *dev); |
@@ -293,6 +320,15 @@ const struct dev_pm_ops name = { \ | |||
293 | /* | 320 | /* |
294 | * Use this for defining a set of PM operations to be used in all situations | 321 | * Use this for defining a set of PM operations to be used in all situations |
295 | * (sustem suspend, hibernation or runtime PM). | 322 | * (sustem suspend, hibernation or runtime PM). |
323 | * NOTE: In general, system suspend callbacks, .suspend() and .resume(), should | ||
324 | * be different from the corresponding runtime PM callbacks, .runtime_suspend(), | ||
325 | * and .runtime_resume(), because .runtime_suspend() always works on an already | ||
326 | * quiescent device, while .suspend() should assume that the device may be doing | ||
327 | * something when it is called (it should ensure that the device will be | ||
328 | * quiescent after it has returned). Therefore it's better to point the "late" | ||
329 | * suspend and "early" resume callback pointers, .suspend_late() and | ||
330 | * .resume_early(), to the same routines as .runtime_suspend() and | ||
331 | * .runtime_resume(), respectively (and analogously for hibernation). | ||
296 | */ | 332 | */ |
297 | #define UNIVERSAL_DEV_PM_OPS(name, suspend_fn, resume_fn, idle_fn) \ | 333 | #define UNIVERSAL_DEV_PM_OPS(name, suspend_fn, resume_fn, idle_fn) \ |
298 | const struct dev_pm_ops name = { \ | 334 | const struct dev_pm_ops name = { \ |
@@ -584,13 +620,13 @@ struct dev_pm_domain { | |||
584 | 620 | ||
585 | #ifdef CONFIG_PM_SLEEP | 621 | #ifdef CONFIG_PM_SLEEP |
586 | extern void device_pm_lock(void); | 622 | extern void device_pm_lock(void); |
587 | extern void dpm_resume_noirq(pm_message_t state); | 623 | extern void dpm_resume_start(pm_message_t state); |
588 | extern void dpm_resume_end(pm_message_t state); | 624 | extern void dpm_resume_end(pm_message_t state); |
589 | extern void dpm_resume(pm_message_t state); | 625 | extern void dpm_resume(pm_message_t state); |
590 | extern void dpm_complete(pm_message_t state); | 626 | extern void dpm_complete(pm_message_t state); |
591 | 627 | ||
592 | extern void device_pm_unlock(void); | 628 | extern void device_pm_unlock(void); |
593 | extern int dpm_suspend_noirq(pm_message_t state); | 629 | extern int dpm_suspend_end(pm_message_t state); |
594 | extern int dpm_suspend_start(pm_message_t state); | 630 | extern int dpm_suspend_start(pm_message_t state); |
595 | extern int dpm_suspend(pm_message_t state); | 631 | extern int dpm_suspend(pm_message_t state); |
596 | extern int dpm_prepare(pm_message_t state); | 632 | extern int dpm_prepare(pm_message_t state); |
@@ -605,17 +641,23 @@ extern void __suspend_report_result(const char *function, void *fn, int ret); | |||
605 | extern int device_pm_wait_for_dev(struct device *sub, struct device *dev); | 641 | extern int device_pm_wait_for_dev(struct device *sub, struct device *dev); |
606 | 642 | ||
607 | extern int pm_generic_prepare(struct device *dev); | 643 | extern int pm_generic_prepare(struct device *dev); |
644 | extern int pm_generic_suspend_late(struct device *dev); | ||
608 | extern int pm_generic_suspend_noirq(struct device *dev); | 645 | extern int pm_generic_suspend_noirq(struct device *dev); |
609 | extern int pm_generic_suspend(struct device *dev); | 646 | extern int pm_generic_suspend(struct device *dev); |
647 | extern int pm_generic_resume_early(struct device *dev); | ||
610 | extern int pm_generic_resume_noirq(struct device *dev); | 648 | extern int pm_generic_resume_noirq(struct device *dev); |
611 | extern int pm_generic_resume(struct device *dev); | 649 | extern int pm_generic_resume(struct device *dev); |
612 | extern int pm_generic_freeze_noirq(struct device *dev); | 650 | extern int pm_generic_freeze_noirq(struct device *dev); |
651 | extern int pm_generic_freeze_late(struct device *dev); | ||
613 | extern int pm_generic_freeze(struct device *dev); | 652 | extern int pm_generic_freeze(struct device *dev); |
614 | extern int pm_generic_thaw_noirq(struct device *dev); | 653 | extern int pm_generic_thaw_noirq(struct device *dev); |
654 | extern int pm_generic_thaw_early(struct device *dev); | ||
615 | extern int pm_generic_thaw(struct device *dev); | 655 | extern int pm_generic_thaw(struct device *dev); |
616 | extern int pm_generic_restore_noirq(struct device *dev); | 656 | extern int pm_generic_restore_noirq(struct device *dev); |
657 | extern int pm_generic_restore_early(struct device *dev); | ||
617 | extern int pm_generic_restore(struct device *dev); | 658 | extern int pm_generic_restore(struct device *dev); |
618 | extern int pm_generic_poweroff_noirq(struct device *dev); | 659 | extern int pm_generic_poweroff_noirq(struct device *dev); |
660 | extern int pm_generic_poweroff_late(struct device *dev); | ||
619 | extern int pm_generic_poweroff(struct device *dev); | 661 | extern int pm_generic_poweroff(struct device *dev); |
620 | extern void pm_generic_complete(struct device *dev); | 662 | extern void pm_generic_complete(struct device *dev); |
621 | 663 | ||