diff options
Diffstat (limited to 'include/linux/suspend.h')
-rw-r--r-- | include/linux/suspend.h | 39 |
1 files changed, 26 insertions, 13 deletions
diff --git a/include/linux/suspend.h b/include/linux/suspend.h index c7d9bb1832ba..795032edfc46 100644 --- a/include/linux/suspend.h +++ b/include/linux/suspend.h | |||
@@ -1,9 +1,6 @@ | |||
1 | #ifndef _LINUX_SUSPEND_H | 1 | #ifndef _LINUX_SUSPEND_H |
2 | #define _LINUX_SUSPEND_H | 2 | #define _LINUX_SUSPEND_H |
3 | 3 | ||
4 | #if defined(CONFIG_X86) || defined(CONFIG_FRV) || defined(CONFIG_PPC32) || defined(CONFIG_PPC64) | ||
5 | #include <asm/suspend.h> | ||
6 | #endif | ||
7 | #include <linux/swap.h> | 4 | #include <linux/swap.h> |
8 | #include <linux/notifier.h> | 5 | #include <linux/notifier.h> |
9 | #include <linux/init.h> | 6 | #include <linux/init.h> |
@@ -61,10 +58,17 @@ typedef int __bitwise suspend_state_t; | |||
61 | * by @begin(). | 58 | * by @begin(). |
62 | * @prepare() is called right after devices have been suspended (ie. the | 59 | * @prepare() is called right after devices have been suspended (ie. the |
63 | * appropriate .suspend() method has been executed for each device) and | 60 | * appropriate .suspend() method has been executed for each device) and |
64 | * before the nonboot CPUs are disabled (it is executed with IRQs enabled). | 61 | * before device drivers' late suspend callbacks are executed. It returns |
65 | * This callback is optional. It returns 0 on success or a negative | 62 | * 0 on success or a negative error code otherwise, in which case the |
66 | * error code otherwise, in which case the system cannot enter the desired | 63 | * system cannot enter the desired sleep state (@prepare_late(), @enter(), |
67 | * sleep state (@enter() and @finish() will not be called in that case). | 64 | * @wake(), and @finish() will not be called in that case). |
65 | * | ||
66 | * @prepare_late: Finish preparing the platform for entering the system sleep | ||
67 | * state indicated by @begin(). | ||
68 | * @prepare_late is called before disabling nonboot CPUs and after | ||
69 | * device drivers' late suspend callbacks have been executed. It returns | ||
70 | * 0 on success or a negative error code otherwise, in which case the | ||
71 | * system cannot enter the desired sleep state (@enter() and @wake()). | ||
68 | * | 72 | * |
69 | * @enter: Enter the system sleep state indicated by @begin() or represented by | 73 | * @enter: Enter the system sleep state indicated by @begin() or represented by |
70 | * the argument if @begin() is not implemented. | 74 | * the argument if @begin() is not implemented. |
@@ -72,19 +76,26 @@ typedef int __bitwise suspend_state_t; | |||
72 | * error code otherwise, in which case the system cannot enter the desired | 76 | * error code otherwise, in which case the system cannot enter the desired |
73 | * sleep state. | 77 | * sleep state. |
74 | * | 78 | * |
75 | * @finish: Called when the system has just left a sleep state, right after | 79 | * @wake: Called when the system has just left a sleep state, right after |
76 | * the nonboot CPUs have been enabled and before devices are resumed (it is | 80 | * the nonboot CPUs have been enabled and before device drivers' early |
77 | * executed with IRQs enabled). | 81 | * resume callbacks are executed. |
82 | * This callback is optional, but should be implemented by the platforms | ||
83 | * that implement @prepare_late(). If implemented, it is always called | ||
84 | * after @enter(), even if @enter() fails. | ||
85 | * | ||
86 | * @finish: Finish wake-up of the platform. | ||
87 | * @finish is called right prior to calling device drivers' regular suspend | ||
88 | * callbacks. | ||
78 | * This callback is optional, but should be implemented by the platforms | 89 | * This callback is optional, but should be implemented by the platforms |
79 | * that implement @prepare(). If implemented, it is always called after | 90 | * that implement @prepare(). If implemented, it is always called after |
80 | * @enter() (even if @enter() fails). | 91 | * @enter() and @wake(), if implemented, even if any of them fails. |
81 | * | 92 | * |
82 | * @end: Called by the PM core right after resuming devices, to indicate to | 93 | * @end: Called by the PM core right after resuming devices, to indicate to |
83 | * the platform that the system has returned to the working state or | 94 | * the platform that the system has returned to the working state or |
84 | * the transition to the sleep state has been aborted. | 95 | * the transition to the sleep state has been aborted. |
85 | * This callback is optional, but should be implemented by the platforms | 96 | * This callback is optional, but should be implemented by the platforms |
86 | * that implement @begin(), but platforms implementing @begin() should | 97 | * that implement @begin(). Accordingly, platforms implementing @begin() |
87 | * also provide a @end() which cleans up transitions aborted before | 98 | * should also provide a @end() which cleans up transitions aborted before |
88 | * @enter(). | 99 | * @enter(). |
89 | * | 100 | * |
90 | * @recover: Recover the platform from a suspend failure. | 101 | * @recover: Recover the platform from a suspend failure. |
@@ -96,7 +107,9 @@ struct platform_suspend_ops { | |||
96 | int (*valid)(suspend_state_t state); | 107 | int (*valid)(suspend_state_t state); |
97 | int (*begin)(suspend_state_t state); | 108 | int (*begin)(suspend_state_t state); |
98 | int (*prepare)(void); | 109 | int (*prepare)(void); |
110 | int (*prepare_late)(void); | ||
99 | int (*enter)(suspend_state_t state); | 111 | int (*enter)(suspend_state_t state); |
112 | void (*wake)(void); | ||
100 | void (*finish)(void); | 113 | void (*finish)(void); |
101 | void (*end)(void); | 114 | void (*end)(void); |
102 | void (*recover)(void); | 115 | void (*recover)(void); |