aboutsummaryrefslogtreecommitdiffstats
path: root/Documentation
diff options
context:
space:
mode:
authorAlan Stern <stern@rowland.harvard.edu>2010-01-08 12:56:54 -0500
committerGreg Kroah-Hartman <gregkh@suse.de>2010-03-02 17:54:10 -0500
commit088f7fec8a0e683db72fd8826c5d3ab914e197b1 (patch)
tree971ef100d0db9727e4403865b67c72de62e8247a /Documentation
parent0c4db6df915bc470f0cd32fe48287fa6eb6adfb4 (diff)
USB: implement usb_enable_autosuspend
This patch (as1326) adds usb_enable_autosuspend() and usb_disable_autosuspend() routines for use by drivers. If a driver knows that its device can handle suspends and resumes correctly, it can enable autosuspend all by itself. This is equivalent to the user writing "auto" to the device's power/level attribute. The implementation differs slightly from what it used to be. Now autosuspend is disabled simply by doing usb_autoresume_device() (to increment the usage counter) and enabled by doing usb_autosuspend_device() (to decrement the usage counter). The set_level() attribute method is updated to use the new routines, and the USB Power-Management documentation is updated. The patch adds a usb_enable_autosuspend() call to the hub driver's probe routine, allowing the special-case code for hubs in quirks.c to be removed. Signed-off-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'Documentation')
-rw-r--r--Documentation/usb/power-management.txt18
1 files changed, 18 insertions, 0 deletions
diff --git a/Documentation/usb/power-management.txt b/Documentation/usb/power-management.txt
index 3bf6818c8cf5..e3fa189c257a 100644
--- a/Documentation/usb/power-management.txt
+++ b/Documentation/usb/power-management.txt
@@ -229,6 +229,11 @@ necessary operations by hand or add them to a udev script. You can
229also change the idle-delay time; 2 seconds is not the best choice for 229also change the idle-delay time; 2 seconds is not the best choice for
230every device. 230every device.
231 231
232If a driver knows that its device has proper suspend/resume support,
233it can enable autosuspend all by itself. For example, the video
234driver for a laptop's webcam might do this, since these devices are
235rarely used and so should normally be autosuspended.
236
232Sometimes it turns out that even when a device does work okay with 237Sometimes it turns out that even when a device does work okay with
233autosuspend there are still problems. For example, there are 238autosuspend there are still problems. For example, there are
234experimental patches adding autosuspend support to the usbhid driver, 239experimental patches adding autosuspend support to the usbhid driver,
@@ -384,6 +389,19 @@ autosuspend, there's no delay for an autoresume.
384 Other parts of the driver interface 389 Other parts of the driver interface
385 ----------------------------------- 390 -----------------------------------
386 391
392Drivers can enable autosuspend for their devices by calling
393
394 usb_enable_autosuspend(struct usb_device *udev);
395
396in their probe() routine, if they know that the device is capable of
397suspending and resuming correctly. This is exactly equivalent to
398writing "auto" to the device's power/level attribute. Likewise,
399drivers can disable autosuspend by calling
400
401 usb_disable_autosuspend(struct usb_device *udev);
402
403This is exactly the same as writing "on" to the power/level attribute.
404
387Sometimes a driver needs to make sure that remote wakeup is enabled 405Sometimes a driver needs to make sure that remote wakeup is enabled
388during autosuspend. For example, there's not much point 406during autosuspend. For example, there's not much point
389autosuspending a keyboard if the user can't cause the keyboard to do a 407autosuspending a keyboard if the user can't cause the keyboard to do a