diff options
| author | Rafael J. Wysocki <rjw@sisk.pl> | 2012-05-11 15:15:09 -0400 |
|---|---|---|
| committer | Rafael J. Wysocki <rjw@sisk.pl> | 2012-05-11 15:15:09 -0400 |
| commit | 351520a9ebfdf2f36cd97c1192f280e0ac7fdcfc (patch) | |
| tree | 8f177d2c59be90ebcedc98ed508832a7ebbd7e0a /include/linux | |
| parent | e6d18093ea3d1d30a4de9e29cb1676c1f4b55147 (diff) | |
| parent | 4e585d25e120f1eae0a3a8bf8f6ebc7692afec18 (diff) | |
Merge branch 'pm-sleep'
* pm-sleep:
PM / Sleep: User space wakeup sources garbage collector Kconfig option
PM / Sleep: Make the limit of user space wakeup sources configurable
PM / Documentation: suspend-and-cpuhotplug.txt: Fix typo
PM / Sleep: Fix a mistake in a conditional in autosleep_store()
epoll: Add a flag, EPOLLWAKEUP, to prevent suspend while epoll events are ready
PM / Sleep: Add user space interface for manipulating wakeup sources, v3
PM / Sleep: Add "prevent autosleep time" statistics to wakeup sources
PM / Sleep: Implement opportunistic sleep, v2
PM / Sleep: Add wakeup_source_activate and wakeup_source_deactivate tracepoints
PM / Sleep: Change wakeup source statistics to follow Android
PM / Sleep: Use wait queue to signal "no wakeup events in progress"
PM / Sleep: Look for wakeup events in later stages of device suspend
PM / Hibernate: Hibernate/thaw fixes/improvements
Diffstat (limited to 'include/linux')
| -rw-r--r-- | include/linux/capability.h | 5 | ||||
| -rw-r--r-- | include/linux/eventpoll.h | 12 | ||||
| -rw-r--r-- | include/linux/pm_wakeup.h | 15 | ||||
| -rw-r--r-- | include/linux/suspend.h | 14 |
4 files changed, 40 insertions, 6 deletions
diff --git a/include/linux/capability.h b/include/linux/capability.h index 12d52dedb229..c398cff3dab7 100644 --- a/include/linux/capability.h +++ b/include/linux/capability.h | |||
| @@ -360,8 +360,11 @@ struct cpu_vfs_cap_data { | |||
| 360 | 360 | ||
| 361 | #define CAP_WAKE_ALARM 35 | 361 | #define CAP_WAKE_ALARM 35 |
| 362 | 362 | ||
| 363 | /* Allow preventing system suspends while epoll events are pending */ | ||
| 363 | 364 | ||
| 364 | #define CAP_LAST_CAP CAP_WAKE_ALARM | 365 | #define CAP_EPOLLWAKEUP 36 |
| 366 | |||
| 367 | #define CAP_LAST_CAP CAP_EPOLLWAKEUP | ||
| 365 | 368 | ||
| 366 | #define cap_valid(x) ((x) >= 0 && (x) <= CAP_LAST_CAP) | 369 | #define cap_valid(x) ((x) >= 0 && (x) <= CAP_LAST_CAP) |
| 367 | 370 | ||
diff --git a/include/linux/eventpoll.h b/include/linux/eventpoll.h index 657ab55beda0..6f8be328770a 100644 --- a/include/linux/eventpoll.h +++ b/include/linux/eventpoll.h | |||
| @@ -26,6 +26,18 @@ | |||
| 26 | #define EPOLL_CTL_DEL 2 | 26 | #define EPOLL_CTL_DEL 2 |
| 27 | #define EPOLL_CTL_MOD 3 | 27 | #define EPOLL_CTL_MOD 3 |
| 28 | 28 | ||
| 29 | /* | ||
| 30 | * Request the handling of system wakeup events so as to prevent system suspends | ||
| 31 | * from happening while those events are being processed. | ||
| 32 | * | ||
| 33 | * Assuming neither EPOLLET nor EPOLLONESHOT is set, system suspends will not be | ||
| 34 | * re-allowed until epoll_wait is called again after consuming the wakeup | ||
| 35 | * event(s). | ||
| 36 | * | ||
| 37 | * Requires CAP_EPOLLWAKEUP | ||
| 38 | */ | ||
| 39 | #define EPOLLWAKEUP (1 << 29) | ||
| 40 | |||
| 29 | /* Set the One Shot behaviour for the target file descriptor */ | 41 | /* Set the One Shot behaviour for the target file descriptor */ |
| 30 | #define EPOLLONESHOT (1 << 30) | 42 | #define EPOLLONESHOT (1 << 30) |
| 31 | 43 | ||
diff --git a/include/linux/pm_wakeup.h b/include/linux/pm_wakeup.h index d9f05113e5fb..569781faa504 100644 --- a/include/linux/pm_wakeup.h +++ b/include/linux/pm_wakeup.h | |||
| @@ -33,12 +33,15 @@ | |||
| 33 | * | 33 | * |
| 34 | * @total_time: Total time this wakeup source has been active. | 34 | * @total_time: Total time this wakeup source has been active. |
| 35 | * @max_time: Maximum time this wakeup source has been continuously active. | 35 | * @max_time: Maximum time this wakeup source has been continuously active. |
| 36 | * @last_time: Monotonic clock when the wakeup source's was activated last time. | 36 | * @last_time: Monotonic clock when the wakeup source's was touched last time. |
| 37 | * @prevent_sleep_time: Total time this source has been preventing autosleep. | ||
| 37 | * @event_count: Number of signaled wakeup events. | 38 | * @event_count: Number of signaled wakeup events. |
| 38 | * @active_count: Number of times the wakeup sorce was activated. | 39 | * @active_count: Number of times the wakeup sorce was activated. |
| 39 | * @relax_count: Number of times the wakeup sorce was deactivated. | 40 | * @relax_count: Number of times the wakeup sorce was deactivated. |
| 40 | * @hit_count: Number of times the wakeup sorce might abort system suspend. | 41 | * @expire_count: Number of times the wakeup source's timeout has expired. |
| 42 | * @wakeup_count: Number of times the wakeup source might abort suspend. | ||
| 41 | * @active: Status of the wakeup source. | 43 | * @active: Status of the wakeup source. |
| 44 | * @has_timeout: The wakeup source has been activated with a timeout. | ||
| 42 | */ | 45 | */ |
| 43 | struct wakeup_source { | 46 | struct wakeup_source { |
| 44 | const char *name; | 47 | const char *name; |
| @@ -49,11 +52,15 @@ struct wakeup_source { | |||
| 49 | ktime_t total_time; | 52 | ktime_t total_time; |
| 50 | ktime_t max_time; | 53 | ktime_t max_time; |
| 51 | ktime_t last_time; | 54 | ktime_t last_time; |
| 55 | ktime_t start_prevent_time; | ||
| 56 | ktime_t prevent_sleep_time; | ||
| 52 | unsigned long event_count; | 57 | unsigned long event_count; |
| 53 | unsigned long active_count; | 58 | unsigned long active_count; |
| 54 | unsigned long relax_count; | 59 | unsigned long relax_count; |
| 55 | unsigned long hit_count; | 60 | unsigned long expire_count; |
| 56 | unsigned int active:1; | 61 | unsigned long wakeup_count; |
| 62 | bool active:1; | ||
| 63 | bool autosleep_enabled:1; | ||
| 57 | }; | 64 | }; |
| 58 | 65 | ||
| 59 | #ifdef CONFIG_PM_SLEEP | 66 | #ifdef CONFIG_PM_SLEEP |
diff --git a/include/linux/suspend.h b/include/linux/suspend.h index ac1c114c499d..cd83059fb592 100644 --- a/include/linux/suspend.h +++ b/include/linux/suspend.h | |||
| @@ -356,8 +356,9 @@ extern int unregister_pm_notifier(struct notifier_block *nb); | |||
| 356 | extern bool events_check_enabled; | 356 | extern bool events_check_enabled; |
| 357 | 357 | ||
| 358 | extern bool pm_wakeup_pending(void); | 358 | extern bool pm_wakeup_pending(void); |
| 359 | extern bool pm_get_wakeup_count(unsigned int *count); | 359 | extern bool pm_get_wakeup_count(unsigned int *count, bool block); |
| 360 | extern bool pm_save_wakeup_count(unsigned int count); | 360 | extern bool pm_save_wakeup_count(unsigned int count); |
| 361 | extern void pm_wakep_autosleep_enabled(bool set); | ||
| 361 | 362 | ||
| 362 | static inline void lock_system_sleep(void) | 363 | static inline void lock_system_sleep(void) |
| 363 | { | 364 | { |
| @@ -407,6 +408,17 @@ static inline void unlock_system_sleep(void) {} | |||
| 407 | 408 | ||
| 408 | #endif /* !CONFIG_PM_SLEEP */ | 409 | #endif /* !CONFIG_PM_SLEEP */ |
| 409 | 410 | ||
| 411 | #ifdef CONFIG_PM_AUTOSLEEP | ||
| 412 | |||
| 413 | /* kernel/power/autosleep.c */ | ||
| 414 | void queue_up_suspend_work(void); | ||
| 415 | |||
| 416 | #else /* !CONFIG_PM_AUTOSLEEP */ | ||
| 417 | |||
| 418 | static inline void queue_up_suspend_work(void) {} | ||
| 419 | |||
| 420 | #endif /* !CONFIG_PM_AUTOSLEEP */ | ||
| 421 | |||
| 410 | #ifdef CONFIG_ARCH_SAVE_PAGE_KEYS | 422 | #ifdef CONFIG_ARCH_SAVE_PAGE_KEYS |
| 411 | /* | 423 | /* |
| 412 | * The ARCH_SAVE_PAGE_KEYS functions can be used by an architecture | 424 | * The ARCH_SAVE_PAGE_KEYS functions can be used by an architecture |
