aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/suspend.h
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2008-02-01 22:29:57 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2008-02-01 22:29:57 -0500
commit687fcdf741e4a268c2c7bac8b3734de761bb9719 (patch)
tree82603cd0f892b13d4252cc525ecaec99bb86c0cd /include/linux/suspend.h
parent215e871aaa3d94540121a3809d80d0c5e5686e4f (diff)
parenta6eb84bc1e069e1d285167e09035ed6c27978feb (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/linux/suspend.h')
-rw-r--r--include/linux/suspend.h56
1 files changed, 29 insertions, 27 deletions
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 */
73struct platform_suspend_ops { 79struct 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 */
173struct platform_hibernation_ops { 183struct 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);
213void restore_processor_state(void); 224void restore_processor_state(void);
214 225
215/* kernel/power/main.c */ 226/* kernel/power/main.c */
216extern struct blocking_notifier_head pm_chain_head; 227extern int register_pm_notifier(struct notifier_block *nb);
217 228extern int unregister_pm_notifier(struct notifier_block *nb);
218static inline int register_pm_notifier(struct notifier_block *nb)
219{
220 return blocking_notifier_chain_register(&pm_chain_head, nb);
221}
222
223static 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 = \