diff options
Diffstat (limited to 'include/linux/pm.h')
-rw-r--r-- | include/linux/pm.h | 48 |
1 files changed, 26 insertions, 22 deletions
diff --git a/include/linux/pm.h b/include/linux/pm.h index 9bd86db4d395..6e8fa3049e5d 100644 --- a/include/linux/pm.h +++ b/include/linux/pm.h | |||
@@ -112,21 +112,25 @@ typedef int __bitwise suspend_state_t; | |||
112 | 112 | ||
113 | typedef int __bitwise suspend_disk_method_t; | 113 | typedef int __bitwise suspend_disk_method_t; |
114 | 114 | ||
115 | #define PM_DISK_FIRMWARE ((__force suspend_disk_method_t) 1) | 115 | /* invalid must be 0 so struct pm_ops initialisers can leave it out */ |
116 | #define PM_DISK_PLATFORM ((__force suspend_disk_method_t) 2) | 116 | #define PM_DISK_INVALID ((__force suspend_disk_method_t) 0) |
117 | #define PM_DISK_SHUTDOWN ((__force suspend_disk_method_t) 3) | 117 | #define PM_DISK_PLATFORM ((__force suspend_disk_method_t) 1) |
118 | #define PM_DISK_REBOOT ((__force suspend_disk_method_t) 4) | 118 | #define PM_DISK_SHUTDOWN ((__force suspend_disk_method_t) 2) |
119 | #define PM_DISK_TEST ((__force suspend_disk_method_t) 5) | 119 | #define PM_DISK_REBOOT ((__force suspend_disk_method_t) 3) |
120 | #define PM_DISK_TESTPROC ((__force suspend_disk_method_t) 6) | 120 | #define PM_DISK_TEST ((__force suspend_disk_method_t) 4) |
121 | #define PM_DISK_MAX ((__force suspend_disk_method_t) 7) | 121 | #define PM_DISK_TESTPROC ((__force suspend_disk_method_t) 5) |
122 | #define PM_DISK_MAX ((__force suspend_disk_method_t) 6) | ||
122 | 123 | ||
123 | /** | 124 | /** |
124 | * struct pm_ops - Callbacks for managing platform dependent suspend states. | 125 | * struct pm_ops - Callbacks for managing platform dependent suspend states. |
125 | * @valid: Callback to determine whether the given state can be entered. | 126 | * @valid: Callback to determine whether the given state can be entered. |
126 | * If %CONFIG_SOFTWARE_SUSPEND is set then %PM_SUSPEND_DISK is | 127 | * If %CONFIG_SOFTWARE_SUSPEND is set then %PM_SUSPEND_DISK is |
127 | * always valid and never passed to this call. | 128 | * always valid and never passed to this call. If not assigned, |
128 | * If not assigned, all suspend states are advertised as valid | 129 | * no suspend states are valid. |
129 | * in /sys/power/state (but can still be rejected by prepare or enter.) | 130 | * Valid states are advertised in /sys/power/state but can still |
131 | * be rejected by prepare or enter if the conditions aren't right. | ||
132 | * There is a %pm_valid_only_mem function available that can be assigned | ||
133 | * to this if you only implement mem sleep. | ||
130 | * | 134 | * |
131 | * @prepare: Prepare the platform for the given suspend state. Can return a | 135 | * @prepare: Prepare the platform for the given suspend state. Can return a |
132 | * negative error code if necessary. | 136 | * negative error code if necessary. |
@@ -137,17 +141,16 @@ typedef int __bitwise suspend_disk_method_t; | |||
137 | * @finish: Called when the system has left the given state and all devices | 141 | * @finish: Called when the system has left the given state and all devices |
138 | * are resumed. The return value is ignored. | 142 | * are resumed. The return value is ignored. |
139 | * | 143 | * |
140 | * @pm_disk_mode: Set to the disk method that the user should be able to | 144 | * @pm_disk_mode: The generic code always allows one of the shutdown methods |
141 | * configure for suspend-to-disk. Since %PM_DISK_SHUTDOWN, | 145 | * %PM_DISK_SHUTDOWN, %PM_DISK_REBOOT, %PM_DISK_TEST and |
142 | * %PM_DISK_REBOOT, %PM_DISK_TEST and %PM_DISK_TESTPROC | 146 | * %PM_DISK_TESTPROC. If this variable is set, the mode it is set |
143 | * are always allowed, currently only %PM_DISK_PLATFORM | 147 | * to is allowed in addition to those modes and is also made default. |
144 | * makes sense. If the user then choses %PM_DISK_PLATFORM, | 148 | * When this mode is sent selected, the @prepare call will be called |
145 | * the @prepare call will be called before suspending to disk | 149 | * before suspending to disk (if present), the @enter call should be |
146 | * (if present), the @enter call should be present and will | 150 | * present and will be called after all state has been saved and the |
147 | * be called after all state has been saved and the machine | 151 | * machine is ready to be powered off; the @finish callback is called |
148 | * is ready to be shut down/suspended/..., and the @finish | 152 | * after state has been restored. All these calls are called with |
149 | * callback is called after state has been restored. All | 153 | * %PM_SUSPEND_DISK as the state. |
150 | * these calls are called with %PM_SUSPEND_DISK as the state. | ||
151 | */ | 154 | */ |
152 | struct pm_ops { | 155 | struct pm_ops { |
153 | int (*valid)(suspend_state_t state); | 156 | int (*valid)(suspend_state_t state); |
@@ -165,6 +168,7 @@ extern void pm_set_ops(struct pm_ops *pm_ops); | |||
165 | extern struct pm_ops *pm_ops; | 168 | extern struct pm_ops *pm_ops; |
166 | extern int pm_suspend(suspend_state_t state); | 169 | extern int pm_suspend(suspend_state_t state); |
167 | 170 | ||
171 | extern int pm_valid_only_mem(suspend_state_t state); | ||
168 | 172 | ||
169 | /** | 173 | /** |
170 | * arch_suspend_disable_irqs - disable IRQs for suspend | 174 | * arch_suspend_disable_irqs - disable IRQs for suspend |
@@ -328,7 +332,7 @@ static inline void dpm_runtime_resume(struct device * dev) | |||
328 | 332 | ||
329 | static inline int call_platform_enable_wakeup(struct device *dev, int is_on) | 333 | static inline int call_platform_enable_wakeup(struct device *dev, int is_on) |
330 | { | 334 | { |
331 | return -EIO; | 335 | return 0; |
332 | } | 336 | } |
333 | 337 | ||
334 | #endif | 338 | #endif |