aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/suspend.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/suspend.h')
-rw-r--r--include/linux/suspend.h43
1 files changed, 26 insertions, 17 deletions
diff --git a/include/linux/suspend.h b/include/linux/suspend.h
index 5e781d824e6d..4af270ec2204 100644
--- a/include/linux/suspend.h
+++ b/include/linux/suspend.h
@@ -61,14 +61,15 @@ typedef int __bitwise suspend_state_t;
61 * before device drivers' late suspend callbacks are executed. It returns 61 * before device drivers' late suspend callbacks are executed. It returns
62 * 0 on success or a negative error code otherwise, in which case the 62 * 0 on success or a negative error code otherwise, in which case the
63 * system cannot enter the desired sleep state (@prepare_late(), @enter(), 63 * system cannot enter the desired sleep state (@prepare_late(), @enter(),
64 * @wake(), and @finish() will not be called in that case). 64 * and @wake() will not be called in that case).
65 * 65 *
66 * @prepare_late: Finish preparing the platform for entering the system sleep 66 * @prepare_late: Finish preparing the platform for entering the system sleep
67 * state indicated by @begin(). 67 * state indicated by @begin().
68 * @prepare_late is called before disabling nonboot CPUs and after 68 * @prepare_late is called before disabling nonboot CPUs and after
69 * device drivers' late suspend callbacks have been executed. It returns 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 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()). 71 * system cannot enter the desired sleep state (@enter() will not be
72 * executed).
72 * 73 *
73 * @enter: Enter the system sleep state indicated by @begin() or represented by 74 * @enter: Enter the system sleep state indicated by @begin() or represented by
74 * the argument if @begin() is not implemented. 75 * the argument if @begin() is not implemented.
@@ -81,14 +82,15 @@ typedef int __bitwise suspend_state_t;
81 * resume callbacks are executed. 82 * resume callbacks are executed.
82 * This callback is optional, but should be implemented by the platforms 83 * This callback is optional, but should be implemented by the platforms
83 * that implement @prepare_late(). If implemented, it is always called 84 * that implement @prepare_late(). If implemented, it is always called
84 * after @enter(), even if @enter() fails. 85 * after @prepare_late and @enter(), even if one of them fails.
85 * 86 *
86 * @finish: Finish wake-up of the platform. 87 * @finish: Finish wake-up of the platform.
87 * @finish is called right prior to calling device drivers' regular suspend 88 * @finish is called right prior to calling device drivers' regular suspend
88 * callbacks. 89 * callbacks.
89 * This callback is optional, but should be implemented by the platforms 90 * This callback is optional, but should be implemented by the platforms
90 * that implement @prepare(). If implemented, it is always called after 91 * that implement @prepare(). If implemented, it is always called after
91 * @enter() and @wake(), if implemented, even if any of them fails. 92 * @enter() and @wake(), even if any of them fails. It is executed after
93 * a failing @prepare.
92 * 94 *
93 * @end: Called by the PM core right after resuming devices, to indicate to 95 * @end: Called by the PM core right after resuming devices, to indicate to
94 * the platform that the system has returned to the working state or 96 * the platform that the system has returned to the working state or
@@ -256,22 +258,22 @@ static inline int hibernate(void) { return -ENOSYS; }
256static inline bool system_entering_hibernation(void) { return false; } 258static inline bool system_entering_hibernation(void) { return false; }
257#endif /* CONFIG_HIBERNATION */ 259#endif /* CONFIG_HIBERNATION */
258 260
259#ifdef CONFIG_HIBERNATION_NVS 261#ifdef CONFIG_SUSPEND_NVS
260extern int hibernate_nvs_register(unsigned long start, unsigned long size); 262extern int suspend_nvs_register(unsigned long start, unsigned long size);
261extern int hibernate_nvs_alloc(void); 263extern int suspend_nvs_alloc(void);
262extern void hibernate_nvs_free(void); 264extern void suspend_nvs_free(void);
263extern void hibernate_nvs_save(void); 265extern void suspend_nvs_save(void);
264extern void hibernate_nvs_restore(void); 266extern void suspend_nvs_restore(void);
265#else /* CONFIG_HIBERNATION_NVS */ 267#else /* CONFIG_SUSPEND_NVS */
266static inline int hibernate_nvs_register(unsigned long a, unsigned long b) 268static inline int suspend_nvs_register(unsigned long a, unsigned long b)
267{ 269{
268 return 0; 270 return 0;
269} 271}
270static inline int hibernate_nvs_alloc(void) { return 0; } 272static inline int suspend_nvs_alloc(void) { return 0; }
271static inline void hibernate_nvs_free(void) {} 273static inline void suspend_nvs_free(void) {}
272static inline void hibernate_nvs_save(void) {} 274static inline void suspend_nvs_save(void) {}
273static inline void hibernate_nvs_restore(void) {} 275static inline void suspend_nvs_restore(void) {}
274#endif /* CONFIG_HIBERNATION_NVS */ 276#endif /* CONFIG_SUSPEND_NVS */
275 277
276#ifdef CONFIG_PM_SLEEP 278#ifdef CONFIG_PM_SLEEP
277void save_processor_state(void); 279void save_processor_state(void);
@@ -286,6 +288,13 @@ extern int unregister_pm_notifier(struct notifier_block *nb);
286 { .notifier_call = fn, .priority = pri }; \ 288 { .notifier_call = fn, .priority = pri }; \
287 register_pm_notifier(&fn##_nb); \ 289 register_pm_notifier(&fn##_nb); \
288} 290}
291
292/* drivers/base/power/wakeup.c */
293extern bool events_check_enabled;
294
295extern bool pm_check_wakeup_events(void);
296extern bool pm_get_wakeup_count(unsigned long *count);
297extern bool pm_save_wakeup_count(unsigned long count);
289#else /* !CONFIG_PM_SLEEP */ 298#else /* !CONFIG_PM_SLEEP */
290 299
291static inline int register_pm_notifier(struct notifier_block *nb) 300static inline int register_pm_notifier(struct notifier_block *nb)