1 From 7b236e69bb4403f20fbdef81907d46b4d32d4af8 Mon Sep 17 00:00:00 2001
2 From: =?utf-8?q?Arve=20Hj=C3=B8nnev=C3=A5g?= <arve@android.com>
3 Date: Thu, 9 Oct 2008 19:17:11 -0700
4 Subject: [PATCH 068/134] PM: Enable early suspend through /sys/power/state
6 If EARLYSUSPEND is enabled then writes to /sys/power/state no longer
7 blocks, and the kernel will try to enter the requested state every
8 time no wakelocks are held. Write "on" to resume normal operation.
10 kernel/power/main.c | 14 ++++++++++++++
11 1 files changed, 14 insertions(+), 0 deletions(-)
13 --- a/kernel/power/main.c
14 +++ b/kernel/power/main.c
15 @@ -408,6 +408,9 @@ static void suspend_finish(void)
18 static const char * const pm_states[PM_SUSPEND_MAX] = {
19 +#ifdef CONFIG_EARLYSUSPEND
20 + [PM_SUSPEND_ON] = "on",
22 [PM_SUSPEND_STANDBY] = "standby",
23 [PM_SUSPEND_MEM] = "mem",
25 @@ -525,7 +528,11 @@ static ssize_t state_store(struct kobjec
26 const char *buf, size_t n)
29 +#ifdef CONFIG_EARLYSUSPEND
30 + suspend_state_t state = PM_SUSPEND_ON;
32 suspend_state_t state = PM_SUSPEND_STANDBY;
34 const char * const *s;
37 @@ -547,8 +554,15 @@ static ssize_t state_store(struct kobjec
40 if (state < PM_SUSPEND_MAX && *s)
41 +#ifdef CONFIG_EARLYSUSPEND
42 + if (state == PM_SUSPEND_ON || valid_state(state)) {
44 + request_suspend_state(state);
47 error = enter_state(state);
52 return error ? error : n;