aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/power/main.c
diff options
context:
space:
mode:
authorArve Hjønnevåg <arve@android.com>2008-10-09 19:17:11 -0700
committerColin Cross <ccross@android.com>2011-06-14 09:08:42 -0700
commitb0dc34309fc9f98de480aa383c7f6f035ce3b54a (patch)
tree6b8633a1b37edc00b10a8c05a27eb35795a3776f /kernel/power/main.c
parentc1783f55b10d7dfb4ada9a7149821b644255d8df (diff)
downloadkernel_samsung_aries-b0dc34309fc9f98de480aa383c7f6f035ce3b54a.zip
kernel_samsung_aries-b0dc34309fc9f98de480aa383c7f6f035ce3b54a.tar.gz
kernel_samsung_aries-b0dc34309fc9f98de480aa383c7f6f035ce3b54a.tar.bz2
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/power/main.c')
-rw-r--r--kernel/power/main.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/kernel/power/main.c b/kernel/power/main.c
index 2981af4..dad38e2 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;