diff options
Diffstat (limited to 'include/linux/pm.h')
-rw-r--r-- | include/linux/pm.h | 36 |
1 files changed, 28 insertions, 8 deletions
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; |