diff options
Diffstat (limited to 'include/linux')
| -rw-r--r-- | include/linux/pm.h | 37 |
1 files changed, 35 insertions, 2 deletions
diff --git a/include/linux/pm.h b/include/linux/pm.h index 070394e846d0..21db05ac7c0b 100644 --- a/include/linux/pm.h +++ b/include/linux/pm.h | |||
| @@ -120,15 +120,48 @@ typedef int __bitwise suspend_disk_method_t; | |||
| 120 | #define PM_DISK_TESTPROC ((__force suspend_disk_method_t) 6) | 120 | #define PM_DISK_TESTPROC ((__force suspend_disk_method_t) 6) |
| 121 | #define PM_DISK_MAX ((__force suspend_disk_method_t) 7) | 121 | #define PM_DISK_MAX ((__force suspend_disk_method_t) 7) |
| 122 | 122 | ||
| 123 | /** | ||
| 124 | * struct pm_ops - Callbacks for managing platform dependent suspend states. | ||
| 125 | * @valid: Callback to determine whether the given state can be entered. | ||
| 126 | * If %CONFIG_SOFTWARE_SUSPEND is set then %PM_SUSPEND_DISK is | ||
| 127 | * always valid and never passed to this call. | ||
| 128 | * If not assigned, all suspend states are advertised as valid | ||
| 129 | * in /sys/power/state (but can still be rejected by prepare or enter.) | ||
| 130 | * | ||
| 131 | * @prepare: Prepare the platform for the given suspend state. Can return a | ||
| 132 | * negative error code if necessary. | ||
| 133 | * | ||
| 134 | * @enter: Enter the given suspend state, must be assigned. Can return a | ||
| 135 | * negative error code if necessary. | ||
| 136 | * | ||
| 137 | * @finish: Called when the system has left the given state and all devices | ||
| 138 | * are resumed. The return value is ignored. | ||
| 139 | * | ||
| 140 | * @pm_disk_mode: Set to the disk method that the user should be able to | ||
| 141 | * configure for suspend-to-disk. Since %PM_DISK_SHUTDOWN, | ||
| 142 | * %PM_DISK_REBOOT, %PM_DISK_TEST and %PM_DISK_TESTPROC | ||
| 143 | * are always allowed, currently only %PM_DISK_PLATFORM | ||
| 144 | * makes sense. If the user then choses %PM_DISK_PLATFORM, | ||
| 145 | * the @prepare call will be called before suspending to disk | ||
| 146 | * (if present), the @enter call should be present and will | ||
| 147 | * be called after all state has been saved and the machine | ||
| 148 | * is ready to be shut down/suspended/..., and the @finish | ||
| 149 | * callback is called after state has been restored. All | ||
| 150 | * these calls are called with %PM_SUSPEND_DISK as the state. | ||
| 151 | */ | ||
| 123 | struct pm_ops { | 152 | struct pm_ops { |
| 124 | suspend_disk_method_t pm_disk_mode; | ||
| 125 | int (*valid)(suspend_state_t state); | 153 | int (*valid)(suspend_state_t state); |
| 126 | int (*prepare)(suspend_state_t state); | 154 | int (*prepare)(suspend_state_t state); |
| 127 | int (*enter)(suspend_state_t state); | 155 | int (*enter)(suspend_state_t state); |
| 128 | int (*finish)(suspend_state_t state); | 156 | int (*finish)(suspend_state_t state); |
| 157 | suspend_disk_method_t pm_disk_mode; | ||
| 129 | }; | 158 | }; |
| 130 | 159 | ||
| 131 | extern void pm_set_ops(struct pm_ops *); | 160 | /** |
| 161 | * pm_set_ops - set platform dependent power management ops | ||
| 162 | * @pm_ops: The new power management operations to set. | ||
| 163 | */ | ||
| 164 | extern void pm_set_ops(struct pm_ops *pm_ops); | ||
| 132 | extern struct pm_ops *pm_ops; | 165 | extern struct pm_ops *pm_ops; |
| 133 | extern int pm_suspend(suspend_state_t state); | 166 | extern int pm_suspend(suspend_state_t state); |
| 134 | 167 | ||
