Commit b94dc6b5 authored by David Brownell's avatar David Brownell Committed by Greg Kroah-Hartman

[PATCH] usb device wakeup flags

This patch teaches "usb_device" about the new driver model wakeup support:

 - It updates device wakeup capabilities when entering a configuration
   with the WAKEUP attribute;

 - During suspend processing it consults the policy bit to see
   whether it should enable wakeup for that device.  (This resolves
   a FIXME to not assume the answer is always "yes"; some devices
   lie about supporting remote wakeup.)

Support for root hubs and the HCDs is separate (and more complex).
Signed-off-by: default avatarDavid Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 0ac85241
...@@ -1020,9 +1020,15 @@ void usb_set_device_state(struct usb_device *udev, ...@@ -1020,9 +1020,15 @@ void usb_set_device_state(struct usb_device *udev,
spin_lock_irqsave(&device_state_lock, flags); spin_lock_irqsave(&device_state_lock, flags);
if (udev->state == USB_STATE_NOTATTACHED) if (udev->state == USB_STATE_NOTATTACHED)
; /* do nothing */ ; /* do nothing */
else if (new_state != USB_STATE_NOTATTACHED) else if (new_state != USB_STATE_NOTATTACHED) {
udev->state = new_state; udev->state = new_state;
else if (new_state == USB_STATE_CONFIGURED)
device_init_wakeup(&udev->dev,
(udev->actconfig->desc.bmAttributes
& USB_CONFIG_ATT_WAKEUP));
else if (new_state != USB_STATE_SUSPENDED)
device_init_wakeup(&udev->dev, 0);
} else
recursively_mark_NOTATTACHED(udev); recursively_mark_NOTATTACHED(udev);
spin_unlock_irqrestore(&device_state_lock, flags); spin_unlock_irqrestore(&device_state_lock, flags);
} }
...@@ -1546,11 +1552,7 @@ static int hub_port_suspend(struct usb_hub *hub, int port1, ...@@ -1546,11 +1552,7 @@ static int hub_port_suspend(struct usb_hub *hub, int port1,
* NOTE: OTG devices may issue remote wakeup (or SRP) even when * NOTE: OTG devices may issue remote wakeup (or SRP) even when
* we don't explicitly enable it here. * we don't explicitly enable it here.
*/ */
if (udev->actconfig if (device_may_wakeup(&udev->dev)) {
// && FIXME (remote wakeup enabled on this bus)
// ... currently assuming it's always appropriate
&& (udev->actconfig->desc.bmAttributes
& USB_CONFIG_ATT_WAKEUP) != 0) {
status = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), status = usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
USB_REQ_SET_FEATURE, USB_RECIP_DEVICE, USB_REQ_SET_FEATURE, USB_RECIP_DEVICE,
USB_DEVICE_REMOTE_WAKEUP, 0, USB_DEVICE_REMOTE_WAKEUP, 0,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment