diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2008-02-01 22:29:57 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-02-01 22:29:57 -0500 |
commit | 687fcdf741e4a268c2c7bac8b3734de761bb9719 (patch) | |
tree | 82603cd0f892b13d4252cc525ecaec99bb86c0cd /include | |
parent | 215e871aaa3d94540121a3809d80d0c5e5686e4f (diff) | |
parent | a6eb84bc1e069e1d285167e09035ed6c27978feb (diff) |
Merge branch 'suspend' of git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux-acpi-2.6
* 'suspend' of git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux-acpi-2.6: (38 commits)
suspend: cleanup reference to swsusp_pg_dir[]
PM: Remove obsolete /sys/devices/.../power/state docs
Hibernation: Invoke suspend notifications after console switch
Suspend: Invoke suspend notifications after console switch
Suspend: Clean up suspend_64.c
Suspend: Add config option to disable the freezer if architecture wants that
ACPI: Print message before calling _PTS
ACPI hibernation: Call _PTS before suspending devices
Hibernation: Introduce begin() and end() callbacks
ACPI suspend: Call _PTS before suspending devices
ACPI: Separate disabling of GPEs from _PTS
ACPI: Separate invocations of _GTS and _BFS from _PTS and _WAK
Suspend: Introduce begin() and end() callbacks
suspend: fix ia64 allmodconfig build
ACPI: clear GPE earily in resume to avoid warning
Suspend: Clean up Kconfig (V2)
Hibernation: Clean up Kconfig (V2)
Hibernation: Update messages
Suspend: Use common prefix in messages
Hibernation: Remove unnecessary variable declaration
...
Diffstat (limited to 'include')
-rw-r--r-- | include/acpi/acpixf.h | 2 | ||||
-rw-r--r-- | include/linux/Kbuild | 1 | ||||
-rw-r--r-- | include/linux/notifier.h | 2 | ||||
-rw-r--r-- | include/linux/suspend.h | 56 | ||||
-rw-r--r-- | include/linux/suspend_ioctls.h | 32 |
5 files changed, 66 insertions, 27 deletions
diff --git a/include/acpi/acpixf.h b/include/acpi/acpixf.h index 9512f0456ad1..b729e64d0d4c 100644 --- a/include/acpi/acpixf.h +++ b/include/acpi/acpixf.h | |||
@@ -335,6 +335,8 @@ acpi_status asmlinkage acpi_enter_sleep_state(u8 sleep_state); | |||
335 | 335 | ||
336 | acpi_status asmlinkage acpi_enter_sleep_state_s4bios(void); | 336 | acpi_status asmlinkage acpi_enter_sleep_state_s4bios(void); |
337 | 337 | ||
338 | acpi_status acpi_leave_sleep_state_prep(u8 sleep_state); | ||
339 | |||
338 | acpi_status acpi_leave_sleep_state(u8 sleep_state); | 340 | acpi_status acpi_leave_sleep_state(u8 sleep_state); |
339 | 341 | ||
340 | #endif /* __ACXFACE_H__ */ | 342 | #endif /* __ACXFACE_H__ */ |
diff --git a/include/linux/Kbuild b/include/linux/Kbuild index 85b2482cc736..c0f9bb78727d 100644 --- a/include/linux/Kbuild +++ b/include/linux/Kbuild | |||
@@ -143,6 +143,7 @@ header-y += snmp.h | |||
143 | header-y += sockios.h | 143 | header-y += sockios.h |
144 | header-y += som.h | 144 | header-y += som.h |
145 | header-y += sound.h | 145 | header-y += sound.h |
146 | header-y += suspend_ioctls.h | ||
146 | header-y += taskstats.h | 147 | header-y += taskstats.h |
147 | header-y += telephony.h | 148 | header-y += telephony.h |
148 | header-y += termios.h | 149 | header-y += termios.h |
diff --git a/include/linux/notifier.h b/include/linux/notifier.h index 5dfbc684ce7d..f4df40038f0c 100644 --- a/include/linux/notifier.h +++ b/include/linux/notifier.h | |||
@@ -228,6 +228,8 @@ static inline int notifier_to_errno(int ret) | |||
228 | #define PM_POST_HIBERNATION 0x0002 /* Hibernation finished */ | 228 | #define PM_POST_HIBERNATION 0x0002 /* Hibernation finished */ |
229 | #define PM_SUSPEND_PREPARE 0x0003 /* Going to suspend the system */ | 229 | #define PM_SUSPEND_PREPARE 0x0003 /* Going to suspend the system */ |
230 | #define PM_POST_SUSPEND 0x0004 /* Suspend finished */ | 230 | #define PM_POST_SUSPEND 0x0004 /* Suspend finished */ |
231 | #define PM_RESTORE_PREPARE 0x0005 /* Going to restore a saved image */ | ||
232 | #define PM_POST_RESTORE 0x0006 /* Restore failed */ | ||
231 | 233 | ||
232 | /* Console keyboard events. | 234 | /* Console keyboard events. |
233 | * Note: KBD_KEYCODE is always sent before KBD_UNBOUND_KEYCODE, KBD_UNICODE and | 235 | * Note: KBD_KEYCODE is always sent before KBD_UNBOUND_KEYCODE, KBD_UNICODE and |
diff --git a/include/linux/suspend.h b/include/linux/suspend.h index 40280df2a3db..646ce2d068d4 100644 --- a/include/linux/suspend.h +++ b/include/linux/suspend.h | |||
@@ -38,18 +38,16 @@ typedef int __bitwise suspend_state_t; | |||
38 | * There is the %suspend_valid_only_mem function available that can be | 38 | * There is the %suspend_valid_only_mem function available that can be |
39 | * assigned to this if the platform only supports mem sleep. | 39 | * assigned to this if the platform only supports mem sleep. |
40 | * | 40 | * |
41 | * @set_target: Tell the platform which system sleep state is going to be | 41 | * @begin: Initialise a transition to given system sleep state. |
42 | * entered. | 42 | * @begin() is executed right prior to suspending devices. The information |
43 | * @set_target() is executed right prior to suspending devices. The | 43 | * conveyed to the platform code by @begin() should be disregarded by it as |
44 | * information conveyed to the platform code by @set_target() should be | 44 | * soon as @end() is executed. If @begin() fails (ie. returns nonzero), |
45 | * disregarded by the platform as soon as @finish() is executed and if | ||
46 | * @prepare() fails. If @set_target() fails (ie. returns nonzero), | ||
47 | * @prepare(), @enter() and @finish() will not be called by the PM core. | 45 | * @prepare(), @enter() and @finish() will not be called by the PM core. |
48 | * This callback is optional. However, if it is implemented, the argument | 46 | * This callback is optional. However, if it is implemented, the argument |
49 | * passed to @enter() is meaningless and should be ignored. | 47 | * passed to @enter() is redundant and should be ignored. |
50 | * | 48 | * |
51 | * @prepare: Prepare the platform for entering the system sleep state indicated | 49 | * @prepare: Prepare the platform for entering the system sleep state indicated |
52 | * by @set_target(). | 50 | * by @begin(). |
53 | * @prepare() is called right after devices have been suspended (ie. the | 51 | * @prepare() is called right after devices have been suspended (ie. the |
54 | * appropriate .suspend() method has been executed for each device) and | 52 | * appropriate .suspend() method has been executed for each device) and |
55 | * before the nonboot CPUs are disabled (it is executed with IRQs enabled). | 53 | * before the nonboot CPUs are disabled (it is executed with IRQs enabled). |
@@ -57,8 +55,8 @@ typedef int __bitwise suspend_state_t; | |||
57 | * error code otherwise, in which case the system cannot enter the desired | 55 | * error code otherwise, in which case the system cannot enter the desired |
58 | * sleep state (@enter() and @finish() will not be called in that case). | 56 | * sleep state (@enter() and @finish() will not be called in that case). |
59 | * | 57 | * |
60 | * @enter: Enter the system sleep state indicated by @set_target() or | 58 | * @enter: Enter the system sleep state indicated by @begin() or represented by |
61 | * represented by the argument if @set_target() is not implemented. | 59 | * the argument if @begin() is not implemented. |
62 | * This callback is mandatory. It returns 0 on success or a negative | 60 | * This callback is mandatory. It returns 0 on success or a negative |
63 | * error code otherwise, in which case the system cannot enter the desired | 61 | * error code otherwise, in which case the system cannot enter the desired |
64 | * sleep state. | 62 | * sleep state. |
@@ -69,13 +67,22 @@ typedef int __bitwise suspend_state_t; | |||
69 | * This callback is optional, but should be implemented by the platforms | 67 | * This callback is optional, but should be implemented by the platforms |
70 | * that implement @prepare(). If implemented, it is always called after | 68 | * that implement @prepare(). If implemented, it is always called after |
71 | * @enter() (even if @enter() fails). | 69 | * @enter() (even if @enter() fails). |
70 | * | ||
71 | * @end: Called by the PM core right after resuming devices, to indicate to | ||
72 | * the platform that the system has returned to the working state or | ||
73 | * the transition to the sleep state has been aborted. | ||
74 | * This callback is optional, but should be implemented by the platforms | ||
75 | * that implement @begin(), but platforms implementing @begin() should | ||
76 | * also provide a @end() which cleans up transitions aborted before | ||
77 | * @enter(). | ||
72 | */ | 78 | */ |
73 | struct platform_suspend_ops { | 79 | struct platform_suspend_ops { |
74 | int (*valid)(suspend_state_t state); | 80 | int (*valid)(suspend_state_t state); |
75 | int (*set_target)(suspend_state_t state); | 81 | int (*begin)(suspend_state_t state); |
76 | int (*prepare)(void); | 82 | int (*prepare)(void); |
77 | int (*enter)(suspend_state_t state); | 83 | int (*enter)(suspend_state_t state); |
78 | void (*finish)(void); | 84 | void (*finish)(void); |
85 | void (*end)(void); | ||
79 | }; | 86 | }; |
80 | 87 | ||
81 | #ifdef CONFIG_SUSPEND | 88 | #ifdef CONFIG_SUSPEND |
@@ -129,14 +136,17 @@ extern void mark_free_pages(struct zone *zone); | |||
129 | /** | 136 | /** |
130 | * struct platform_hibernation_ops - hibernation platform support | 137 | * struct platform_hibernation_ops - hibernation platform support |
131 | * | 138 | * |
132 | * The methods in this structure allow a platform to override the default | 139 | * The methods in this structure allow a platform to carry out special |
133 | * mechanism of shutting down the machine during a hibernation transition. | 140 | * operations required by it during a hibernation transition. |
134 | * | 141 | * |
135 | * All three methods must be assigned. | 142 | * All the methods below must be implemented. |
136 | * | 143 | * |
137 | * @start: Tell the platform driver that we're starting hibernation. | 144 | * @begin: Tell the platform driver that we're starting hibernation. |
138 | * Called right after shrinking memory and before freezing devices. | 145 | * Called right after shrinking memory and before freezing devices. |
139 | * | 146 | * |
147 | * @end: Called by the PM core right after resuming devices, to indicate to | ||
148 | * the platform that the system has returned to the working state. | ||
149 | * | ||
140 | * @pre_snapshot: Prepare the platform for creating the hibernation image. | 150 | * @pre_snapshot: Prepare the platform for creating the hibernation image. |
141 | * Called right after devices have been frozen and before the nonboot | 151 | * Called right after devices have been frozen and before the nonboot |
142 | * CPUs are disabled (runs with IRQs on). | 152 | * CPUs are disabled (runs with IRQs on). |
@@ -171,7 +181,8 @@ extern void mark_free_pages(struct zone *zone); | |||
171 | * thawing devices (runs with IRQs on). | 181 | * thawing devices (runs with IRQs on). |
172 | */ | 182 | */ |
173 | struct platform_hibernation_ops { | 183 | struct platform_hibernation_ops { |
174 | int (*start)(void); | 184 | int (*begin)(void); |
185 | void (*end)(void); | ||
175 | int (*pre_snapshot)(void); | 186 | int (*pre_snapshot)(void); |
176 | void (*finish)(void); | 187 | void (*finish)(void); |
177 | int (*prepare)(void); | 188 | int (*prepare)(void); |
@@ -213,17 +224,8 @@ void save_processor_state(void); | |||
213 | void restore_processor_state(void); | 224 | void restore_processor_state(void); |
214 | 225 | ||
215 | /* kernel/power/main.c */ | 226 | /* kernel/power/main.c */ |
216 | extern struct blocking_notifier_head pm_chain_head; | 227 | extern int register_pm_notifier(struct notifier_block *nb); |
217 | 228 | extern int unregister_pm_notifier(struct notifier_block *nb); | |
218 | static inline int register_pm_notifier(struct notifier_block *nb) | ||
219 | { | ||
220 | return blocking_notifier_chain_register(&pm_chain_head, nb); | ||
221 | } | ||
222 | |||
223 | static inline int unregister_pm_notifier(struct notifier_block *nb) | ||
224 | { | ||
225 | return blocking_notifier_chain_unregister(&pm_chain_head, nb); | ||
226 | } | ||
227 | 229 | ||
228 | #define pm_notifier(fn, pri) { \ | 230 | #define pm_notifier(fn, pri) { \ |
229 | static struct notifier_block fn##_nb = \ | 231 | static struct notifier_block fn##_nb = \ |
diff --git a/include/linux/suspend_ioctls.h b/include/linux/suspend_ioctls.h new file mode 100644 index 000000000000..2c6faec96bde --- /dev/null +++ b/include/linux/suspend_ioctls.h | |||
@@ -0,0 +1,32 @@ | |||
1 | #ifndef _LINUX_SUSPEND_IOCTLS_H | ||
2 | #define _LINUX_SUSPEND_IOCTLS_H | ||
3 | |||
4 | /* | ||
5 | * This structure is used to pass the values needed for the identification | ||
6 | * of the resume swap area from a user space to the kernel via the | ||
7 | * SNAPSHOT_SET_SWAP_AREA ioctl | ||
8 | */ | ||
9 | struct resume_swap_area { | ||
10 | loff_t offset; | ||
11 | u_int32_t dev; | ||
12 | } __attribute__((packed)); | ||
13 | |||
14 | #define SNAPSHOT_IOC_MAGIC '3' | ||
15 | #define SNAPSHOT_FREEZE _IO(SNAPSHOT_IOC_MAGIC, 1) | ||
16 | #define SNAPSHOT_UNFREEZE _IO(SNAPSHOT_IOC_MAGIC, 2) | ||
17 | #define SNAPSHOT_ATOMIC_RESTORE _IO(SNAPSHOT_IOC_MAGIC, 4) | ||
18 | #define SNAPSHOT_FREE _IO(SNAPSHOT_IOC_MAGIC, 5) | ||
19 | #define SNAPSHOT_FREE_SWAP_PAGES _IO(SNAPSHOT_IOC_MAGIC, 9) | ||
20 | #define SNAPSHOT_S2RAM _IO(SNAPSHOT_IOC_MAGIC, 11) | ||
21 | #define SNAPSHOT_SET_SWAP_AREA _IOW(SNAPSHOT_IOC_MAGIC, 13, \ | ||
22 | struct resume_swap_area) | ||
23 | #define SNAPSHOT_GET_IMAGE_SIZE _IOR(SNAPSHOT_IOC_MAGIC, 14, loff_t) | ||
24 | #define SNAPSHOT_PLATFORM_SUPPORT _IO(SNAPSHOT_IOC_MAGIC, 15) | ||
25 | #define SNAPSHOT_POWER_OFF _IO(SNAPSHOT_IOC_MAGIC, 16) | ||
26 | #define SNAPSHOT_CREATE_IMAGE _IOW(SNAPSHOT_IOC_MAGIC, 17, int) | ||
27 | #define SNAPSHOT_PREF_IMAGE_SIZE _IO(SNAPSHOT_IOC_MAGIC, 18) | ||
28 | #define SNAPSHOT_AVAIL_SWAP_SIZE _IOR(SNAPSHOT_IOC_MAGIC, 19, loff_t) | ||
29 | #define SNAPSHOT_ALLOC_SWAP_PAGE _IOR(SNAPSHOT_IOC_MAGIC, 20, loff_t) | ||
30 | #define SNAPSHOT_IOC_MAXNR 20 | ||
31 | |||
32 | #endif /* _LINUX_SUSPEND_IOCTLS_H */ | ||