diff options
author | Alan Stern <stern@rowland.harvard.edu> | 2010-09-25 17:35:15 -0400 |
---|---|---|
committer | Rafael J. Wysocki <rjw@sisk.pl> | 2010-10-16 19:57:47 -0400 |
commit | 7490e44239e60293bca0c2663229050c36c660c2 (patch) | |
tree | 938cd1cafba133f2d47c648ac01242de841d6d1b /Documentation | |
parent | 140a6c945211ee911dec776fafa52e03a7d7bb9a (diff) |
PM / Runtime: Add no_callbacks flag
Some devices, such as USB interfaces, cannot be power-managed
independently of their parents, i.e., they cannot be put in low power
while the parent remains at full power. This patch (as1425) creates a
new "no_callbacks" flag, which tells the PM core not to invoke the
runtime-PM callback routines for the such devices but instead to
assume that the callbacks always succeed. In addition, the
non-debugging runtime-PM sysfs attributes for the devices are removed,
since they are pretty much meaningless.
The advantage of this scheme comes not so much from avoiding the
callbacks themselves, but rather from the fact that without the need
for a process context in which to run the callbacks, more work can be
done in interrupt context.
Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Diffstat (limited to 'Documentation')
-rw-r--r-- | Documentation/power/runtime_pm.txt | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/Documentation/power/runtime_pm.txt b/Documentation/power/runtime_pm.txt index 55b859b3bc72..9ba49b21ac86 100644 --- a/Documentation/power/runtime_pm.txt +++ b/Documentation/power/runtime_pm.txt | |||
@@ -1,6 +1,7 @@ | |||
1 | Run-time Power Management Framework for I/O Devices | 1 | Run-time Power Management Framework for I/O Devices |
2 | 2 | ||
3 | (C) 2009 Rafael J. Wysocki <rjw@sisk.pl>, Novell Inc. | 3 | (C) 2009 Rafael J. Wysocki <rjw@sisk.pl>, Novell Inc. |
4 | (C) 2010 Alan Stern <stern@rowland.harvard.edu> | ||
4 | 5 | ||
5 | 1. Introduction | 6 | 1. Introduction |
6 | 7 | ||
@@ -230,6 +231,11 @@ defined in include/linux/pm.h: | |||
230 | interface; it may only be modified with the help of the pm_runtime_allow() | 231 | interface; it may only be modified with the help of the pm_runtime_allow() |
231 | and pm_runtime_forbid() helper functions | 232 | and pm_runtime_forbid() helper functions |
232 | 233 | ||
234 | unsigned int no_callbacks; | ||
235 | - indicates that the device does not use the run-time PM callbacks (see | ||
236 | Section 8); it may be modified only by the pm_runtime_no_callbacks() | ||
237 | helper function | ||
238 | |||
233 | All of the above fields are members of the 'power' member of 'struct device'. | 239 | All of the above fields are members of the 'power' member of 'struct device'. |
234 | 240 | ||
235 | 4. Run-time PM Device Helper Functions | 241 | 4. Run-time PM Device Helper Functions |
@@ -349,6 +355,11 @@ drivers/base/power/runtime.c and include/linux/pm_runtime.h: | |||
349 | counter (used by the /sys/devices/.../power/control interface to | 355 | counter (used by the /sys/devices/.../power/control interface to |
350 | effectively prevent the device from being power managed at run time) | 356 | effectively prevent the device from being power managed at run time) |
351 | 357 | ||
358 | void pm_runtime_no_callbacks(struct device *dev); | ||
359 | - set the power.no_callbacks flag for the device and remove the run-time | ||
360 | PM attributes from /sys/devices/.../power (or prevent them from being | ||
361 | added when the device is registered) | ||
362 | |||
352 | It is safe to execute the following helper functions from interrupt context: | 363 | It is safe to execute the following helper functions from interrupt context: |
353 | 364 | ||
354 | pm_request_idle() | 365 | pm_request_idle() |
@@ -524,3 +535,29 @@ poweroff and run-time suspend callback, and similarly for system resume, thaw, | |||
524 | restore, and run-time resume, can achieve this with the help of the | 535 | restore, and run-time resume, can achieve this with the help of the |
525 | UNIVERSAL_DEV_PM_OPS macro defined in include/linux/pm.h (possibly setting its | 536 | UNIVERSAL_DEV_PM_OPS macro defined in include/linux/pm.h (possibly setting its |
526 | last argument to NULL). | 537 | last argument to NULL). |
538 | |||
539 | 8. "No-Callback" Devices | ||
540 | |||
541 | Some "devices" are only logical sub-devices of their parent and cannot be | ||
542 | power-managed on their own. (The prototype example is a USB interface. Entire | ||
543 | USB devices can go into low-power mode or send wake-up requests, but neither is | ||
544 | possible for individual interfaces.) The drivers for these devices have no | ||
545 | need of run-time PM callbacks; if the callbacks did exist, ->runtime_suspend() | ||
546 | and ->runtime_resume() would always return 0 without doing anything else and | ||
547 | ->runtime_idle() would always call pm_runtime_suspend(). | ||
548 | |||
549 | Subsystems can tell the PM core about these devices by calling | ||
550 | pm_runtime_no_callbacks(). This should be done after the device structure is | ||
551 | initialized and before it is registered (although after device registration is | ||
552 | also okay). The routine will set the device's power.no_callbacks flag and | ||
553 | prevent the non-debugging run-time PM sysfs attributes from being created. | ||
554 | |||
555 | When power.no_callbacks is set, the PM core will not invoke the | ||
556 | ->runtime_idle(), ->runtime_suspend(), or ->runtime_resume() callbacks. | ||
557 | Instead it will assume that suspends and resumes always succeed and that idle | ||
558 | devices should be suspended. | ||
559 | |||
560 | As a consequence, the PM core will never directly inform the device's subsystem | ||
561 | or driver about run-time power changes. Instead, the driver for the device's | ||
562 | parent must take responsibility for telling the device's driver when the | ||
563 | parent's power state changes. | ||