diff options
author | Rafael J. Wysocki <rjw@sisk.pl> | 2010-03-06 15:28:17 -0500 |
---|---|---|
committer | Rafael J. Wysocki <rjw@sisk.pl> | 2010-03-06 15:28:17 -0500 |
commit | 87d1b3e60b55ef65f10054ccc319e5d67cf010e9 (patch) | |
tree | da89462b400db6d2b71d630be350201de7e3281e /Documentation/power/runtime_pm.txt | |
parent | 64096c17417380d8a472d096645f4cbc9406c987 (diff) |
PM / Runtime: Document power.runtime_auto and related functions
The power.runtime_auto device flag and the helper functions
pm_runtime_allow() and pm_runtime_forbid() used to modify it are a
part of the run-time power management framework and therefore they
should be described in Documentation/power/runtime_pm.txt.
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Diffstat (limited to 'Documentation/power/runtime_pm.txt')
-rw-r--r-- | Documentation/power/runtime_pm.txt | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/Documentation/power/runtime_pm.txt b/Documentation/power/runtime_pm.txt index 356fd86f4ea8..f19370641684 100644 --- a/Documentation/power/runtime_pm.txt +++ b/Documentation/power/runtime_pm.txt | |||
@@ -224,6 +224,12 @@ defined in include/linux/pm.h: | |||
224 | RPM_SUSPENDED, which means that each device is initially regarded by the | 224 | RPM_SUSPENDED, which means that each device is initially regarded by the |
225 | PM core as 'suspended', regardless of its real hardware status | 225 | PM core as 'suspended', regardless of its real hardware status |
226 | 226 | ||
227 | unsigned int runtime_auto; | ||
228 | - if set, indicates that the user space has allowed the device driver to | ||
229 | power manage the device at run time via the /sys/devices/.../power/control | ||
230 | interface; it may only be modified with the help of the pm_runtime_allow() | ||
231 | and pm_runtime_forbid() helper functions | ||
232 | |||
227 | All of the above fields are members of the 'power' member of 'struct device'. | 233 | All of the above fields are members of the 'power' member of 'struct device'. |
228 | 234 | ||
229 | 4. Run-time PM Device Helper Functions | 235 | 4. Run-time PM Device Helper Functions |
@@ -329,6 +335,16 @@ drivers/base/power/runtime.c and include/linux/pm_runtime.h: | |||
329 | 'power.runtime_error' is set or 'power.disable_depth' is greater than | 335 | 'power.runtime_error' is set or 'power.disable_depth' is greater than |
330 | zero) | 336 | zero) |
331 | 337 | ||
338 | void pm_runtime_allow(struct device *dev); | ||
339 | - set the power.runtime_auto flag for the device and decrease its usage | ||
340 | counter (used by the /sys/devices/.../power/control interface to | ||
341 | effectively allow the device to be power managed at run time) | ||
342 | |||
343 | void pm_runtime_forbid(struct device *dev); | ||
344 | - unset the power.runtime_auto flag for the device and increase its usage | ||
345 | counter (used by the /sys/devices/.../power/control interface to | ||
346 | effectively prevent the device from being power managed at run time) | ||
347 | |||
332 | It is safe to execute the following helper functions from interrupt context: | 348 | It is safe to execute the following helper functions from interrupt context: |
333 | 349 | ||
334 | pm_request_idle() | 350 | pm_request_idle() |
@@ -382,6 +398,18 @@ may be desirable to suspend the device as soon as ->probe() or ->remove() has | |||
382 | finished, so the PM core uses pm_runtime_idle_sync() to invoke the | 398 | finished, so the PM core uses pm_runtime_idle_sync() to invoke the |
383 | subsystem-level idle callback for the device at that time. | 399 | subsystem-level idle callback for the device at that time. |
384 | 400 | ||
401 | The user space can effectively disallow the driver of the device to power manage | ||
402 | it at run time by changing the value of its /sys/devices/.../power/control | ||
403 | attribute to "on", which causes pm_runtime_forbid() to be called. In principle, | ||
404 | this mechanism may also be used by the driver to effectively turn off the | ||
405 | run-time power management of the device until the user space turns it on. | ||
406 | Namely, during the initialization the driver can make sure that the run-time PM | ||
407 | status of the device is 'active' and call pm_runtime_forbid(). It should be | ||
408 | noted, however, that if the user space has already intentionally changed the | ||
409 | value of /sys/devices/.../power/control to "auto" to allow the driver to power | ||
410 | manage the device at run time, the driver may confuse it by using | ||
411 | pm_runtime_forbid() this way. | ||
412 | |||
385 | 6. Run-time PM and System Sleep | 413 | 6. Run-time PM and System Sleep |
386 | 414 | ||
387 | Run-time PM and system sleep (i.e., system suspend and hibernation, also known | 415 | Run-time PM and system sleep (i.e., system suspend and hibernation, also known |