aboutsummaryrefslogtreecommitdiffstats
path: root/Documentation/ABI/testing/sysfs-power
diff options
context:
space:
mode:
authorRafael J. Wysocki <rjw@sisk.pl>2012-04-29 16:53:42 -0400
committerRafael J. Wysocki <rjw@sisk.pl>2012-05-01 15:26:05 -0400
commitb86ff9820fd5df69295273b9aa68e58786ffc23f (patch)
treee8af5745652c926b9a82b3b7531dc455564efdfb /Documentation/ABI/testing/sysfs-power
parent55850945e872531644f31fefd217d61dd15dcab8 (diff)
PM / Sleep: Add user space interface for manipulating wakeup sources, v3
Android allows user space to manipulate wakelocks using two sysfs file located in /sys/power/, wake_lock and wake_unlock. Writing a wakelock name and optionally a timeout to the wake_lock file causes the wakelock whose name was written to be acquired (it is created before is necessary), optionally with the given timeout. Writing the name of a wakelock to wake_unlock causes that wakelock to be released. Implement an analogous interface for user space using wakeup sources. Add the /sys/power/wake_lock and /sys/power/wake_unlock files allowing user space to create, activate and deactivate wakeup sources, such that writing a name and optionally a timeout to wake_lock causes the wakeup source of that name to be activated, optionally with the given timeout. If that wakeup source doesn't exist, it will be created and then activated. Writing a name to wake_unlock causes the wakeup source of that name, if there is one, to be deactivated. Wakeup sources created with the help of wake_lock that haven't been used for more than 5 minutes are garbage collected and destroyed. Moreover, there can be only WL_NUMBER_LIMIT wakeup sources created with the help of wake_lock present at a time. The data type used to track wakeup sources created by user space is called "struct wakelock" to indicate the origins of this feature. This version of the patch includes an rbtree manipulation fix from John Stultz. Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl> Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Reviewed-by: NeilBrown <neilb@suse.de>
Diffstat (limited to 'Documentation/ABI/testing/sysfs-power')
-rw-r--r--Documentation/ABI/testing/sysfs-power42
1 files changed, 42 insertions, 0 deletions
diff --git a/Documentation/ABI/testing/sysfs-power b/Documentation/ABI/testing/sysfs-power
index 237c735db6c9..31725ffeeb3a 100644
--- a/Documentation/ABI/testing/sysfs-power
+++ b/Documentation/ABI/testing/sysfs-power
@@ -189,3 +189,45 @@ Description:
189 189
190 Reading from this file causes the last string successfully 190 Reading from this file causes the last string successfully
191 written to it to be returned. 191 written to it to be returned.
192
193What: /sys/power/wake_lock
194Date: February 2012
195Contact: Rafael J. Wysocki <rjw@sisk.pl>
196Description:
197 The /sys/power/wake_lock file allows user space to create
198 wakeup source objects and activate them on demand (if one of
199 those wakeup sources is active, reads from the
200 /sys/power/wakeup_count file block or return false). When a
201 string without white space is written to /sys/power/wake_lock,
202 it will be assumed to represent a wakeup source name. If there
203 is a wakeup source object with that name, it will be activated
204 (unless active already). Otherwise, a new wakeup source object
205 will be registered, assigned the given name and activated.
206 If a string written to /sys/power/wake_lock contains white
207 space, the part of the string preceding the white space will be
208 regarded as a wakeup source name and handled as descrived above.
209 The other part of the string will be regarded as a timeout (in
210 nanoseconds) such that the wakeup source will be automatically
211 deactivated after it has expired. The timeout, if present, is
212 set regardless of the current state of the wakeup source object
213 in question.
214
215 Reads from this file return a string consisting of the names of
216 wakeup sources created with the help of it that are active at
217 the moment, separated with spaces.
218
219
220What: /sys/power/wake_unlock
221Date: February 2012
222Contact: Rafael J. Wysocki <rjw@sisk.pl>
223Description:
224 The /sys/power/wake_unlock file allows user space to deactivate
225 wakeup sources created with the help of /sys/power/wake_lock.
226 When a string is written to /sys/power/wake_unlock, it will be
227 assumed to represent the name of a wakeup source to deactivate.
228 If a wakeup source object of that name exists and is active at
229 the moment, it will be deactivated.
230
231 Reads from this file return a string consisting of the names of
232 wakeup sources created with the help of /sys/power/wake_lock
233 that are inactive at the moment, separated with spaces.