mirror of
https://github.com/torvalds/linux.git
synced 2026-06-08 14:42:37 +02:00
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.
This commit is contained in:
parent
c1783f55b1
commit
b0dc34309f
|
|
@ -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,7 +196,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:
|
||||
|
|
|
|||
|
|
@ -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",
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user