diff options
author | Arve Hjønnevåg <arve@android.com> | 2008-10-09 19:17:11 -0700 |
---|---|---|
committer | Iliyan Malchev <malchev@google.com> | 2011-05-23 15:41:25 -0700 |
commit | 3c844e720fae8bf91df37b20d15907eb0e845e8f (patch) | |
tree | cc2b4a26e5c468249006c5c0fa7dbfd54a4b20bf /kernel | |
parent | e9b15fed375c2de2d388c6c688076c1dffb049c7 (diff) |
PM: Enable early suspend through /sys/power/state
If EARLYSUSPEND is enabled then writes to /sys/power/state no longer
blocks, and the kernel will try to enter the requested state every
time no wakelocks are held. Write "on" to resume normal operation.
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/power/main.c | 11 | ||||
-rw-r--r-- | kernel/power/suspend.c | 3 |
2 files changed, 14 insertions, 0 deletions
diff --git a/kernel/power/main.c b/kernel/power/main.c index de9aef8742f4..2d74f7b24f69 100644 --- a/kernel/power/main.c +++ b/kernel/power/main.c @@ -170,7 +170,11 @@ static ssize_t state_store(struct kobject *kobj, struct kobj_attribute *attr, const char *buf, size_t n) { #ifdef CONFIG_SUSPEND +#ifdef CONFIG_EARLYSUSPEND + suspend_state_t state = PM_SUSPEND_ON; +#else suspend_state_t state = PM_SUSPEND_STANDBY; +#endif const char * const *s; #endif char *p; @@ -192,8 +196,15 @@ static ssize_t state_store(struct kobject *kobj, struct kobj_attribute *attr, break; } if (state < PM_SUSPEND_MAX && *s) +#ifdef CONFIG_EARLYSUSPEND + if (state == PM_SUSPEND_ON || valid_state(state)) { + error = 0; + request_suspend_state(state); + } +#else error = enter_state(state); #endif +#endif Exit: return error ? error : n; diff --git a/kernel/power/suspend.c b/kernel/power/suspend.c index 6275970b2189..98df7719127b 100644 --- a/kernel/power/suspend.c +++ b/kernel/power/suspend.c @@ -28,6 +28,9 @@ #include "power.h" const char *const pm_states[PM_SUSPEND_MAX] = { +#ifdef CONFIG_EARLYSUSPEND + [PM_SUSPEND_ON] = "on", +#endif [PM_SUSPEND_STANDBY] = "standby", [PM_SUSPEND_MEM] = "mem", }; |