summaryrefslogtreecommitdiff
path: root/kernel/power/main.c
diff options
context:
space:
mode:
authorArve Hjønnevåg <arve@android.com>2008-10-09 21:01:46 -0700
committerDan Willemsen <dwillemsen@nvidia.com>2011-11-30 21:37:52 -0800
commit3bd252058e9743d2426a3ffec1b75722721ef0a6 (patch)
treedddd54d096bbfb0e8beaf1e1439522d0012b21cb /kernel/power/main.c
parentb766d576834f8f61dbc47e0e8e5cddf035a4bd69 (diff)
PM: Add user-space wake lock api.
This adds /sys/power/wake_lock and /sys/power/wake_unlock. Writing a string to wake_lock creates a wake lock the first time is sees a string and locks it. Optionally, the string can be followed by a timeout. To unlock the wake lock, write the same string to wake_unlock. Change-Id: I66c6e3fe6487d17f9c2fafde1174042e57d15cd7
Diffstat (limited to 'kernel/power/main.c')
-rw-r--r--kernel/power/main.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/kernel/power/main.c b/kernel/power/main.c
index 8021065555f4..3304594553ce 100644
--- a/kernel/power/main.c
+++ b/kernel/power/main.c
@@ -309,6 +309,11 @@ power_attr(pm_trace_dev_match);
#endif /* CONFIG_PM_TRACE */
+#ifdef CONFIG_USER_WAKELOCK
+power_attr(wake_lock);
+power_attr(wake_unlock);
+#endif
+
static struct attribute * g[] = {
&state_attr.attr,
#ifdef CONFIG_PM_TRACE
@@ -321,6 +326,10 @@ static struct attribute * g[] = {
#ifdef CONFIG_PM_DEBUG
&pm_test_attr.attr,
#endif
+#ifdef CONFIG_USER_WAKELOCK
+ &wake_lock_attr.attr,
+ &wake_unlock_attr.attr,
+#endif
#endif
NULL,
};