From f104aa02b88eba92dfc9bfe377aa26cc1e94c8d0 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Arve=20Hj=C3=B8nnev=C3=A5g?= Date: Thu, 9 Oct 2008 19:17:11 -0700 Subject: [PATCH] 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. --- kernel/power/main.c | 11 +++++++++++ kernel/power/suspend.c | 3 +++ 2 files changed, 14 insertions(+) diff --git a/kernel/power/main.c b/kernel/power/main.c index 62b0bc6e4983..dcc4d58069f1 100644 --- a/kernel/power/main.c +++ b/kernel/power/main.c @@ -173,7 +173,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; @@ -195,7 +199,14 @@ 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: diff --git a/kernel/power/suspend.c b/kernel/power/suspend.c index 7335952ee473..e84f5b26f1dd 100644 --- a/kernel/power/suspend.c +++ b/kernel/power/suspend.c @@ -26,6 +26,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", }; -- 2.34.1