Re: [PATCH V2] input: Fix USB autosuspend on bcm5974
From: Oliver Neukum <hidden>
Date: 2011-10-10 14:06:20
Am Montag, 10. Oktober 2011, 15:41:26 schrieb Matthew Garrett:
The bcm5974 code takes a USB autosuspend reference on device open and releases it on device close. This means that the hardware won't sleep when anything holds it open. This is sensible for input devices that don't support remote wakeups on normal use (like most mice), but this hardware trigger wakeups on touch and so can suspend transparently to the user. Doing so allows the USB host controller to sleep when the machine is idle, giving measurable power savings. Signed-off-by: Matthew Garrett <redacted> --- Got rid of the unbalanced put on the close path, and added usb_mark_last_busy() calls to make sure the device doesn't go to sleep while in use. This works fine on my hardware now, and I don't see any warning messages being generated.
This is odd, because the hardware shouldn't generate remote wakeups unless you
request them, like this (usbhid)
int usbhid_open(struct hid_device *hid)
{
struct usbhid_device *usbhid = hid->driver_data;
int res;
mutex_lock(&hid_open_mut);
if (!hid->open++) {
res = usb_autopm_get_interface(usbhid->intf);
/* the device must be awake to reliably request remote wakeup */
if (res < 0) {
hid->open--;
mutex_unlock(&hid_open_mut);
return -EIO;
}
usbhid->intf->needs_remote_wakeup = 1;
Regards
Oliver