diff options
author | David Brownell <david-b@pacbell.net> | 2005-09-12 22:39:39 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2005-10-28 12:52:50 -0400 |
commit | b94dc6b58667a73eeaf5cfd9c9e90dcd98743c5b (patch) | |
tree | 738e4214f3168544bfcde2c46e369b3da5845dfe /drivers/usb | |
parent | 0ac85241ebc7bf6b86ab498960cc121d53ef69ae (diff) |
[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: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb')
-rw-r--r-- | drivers/usb/core/hub.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c index a12cab5314e9..c3e2024c4347 100644 --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c | |||
@@ -1020,9 +1020,15 @@ void usb_set_device_state(struct usb_device *udev, | |||
1020 | spin_lock_irqsave(&device_state_lock, flags); | 1020 | spin_lock_irqsave(&device_state_lock, flags); |
1021 | if (udev->state == USB_STATE_NOTATTACHED) | 1021 | if (udev->state == USB_STATE_NOTATTACHED) |
1022 | ; /* do nothing */ | 1022 | ; /* do nothing */ |
1023 | else if (new_state != USB_STATE_NOTATTACHED) | 1023 | else if (new_state != USB_STATE_NOTATTACHED) { |
1024 | udev->state = new_state; | 1024 | udev->state = new_state; |
1025 | else | 1025 | if (new_state == USB_STATE_CONFIGURED) |
1026 | device_init_wakeup(&udev->dev, | ||
1027 | (udev->actconfig->desc.bmAttributes | ||
1028 | & USB_CONFIG_ATT_WAKEUP)); | ||
1029 | else if (new_state != USB_STATE_SUSPENDED) | ||
1030 | device_init_wakeup(&udev->dev, 0); | ||
1031 | } else | ||
1026 | recursively_mark_NOTATTACHED(udev); | 1032 | recursively_mark_NOTATTACHED(udev); |
1027 | spin_unlock_irqrestore(&device_state_lock, flags); | 1033 | spin_unlock_irqrestore(&device_state_lock, flags); |
1028 | } | 1034 | } |
@@ -1546,11 +1552,7 @@ static int hub_port_suspend(struct usb_hub *hub, int port1, | |||
1546 | * NOTE: OTG devices may issue remote wakeup (or SRP) even when | 1552 | * NOTE: OTG devices may issue remote wakeup (or SRP) even when |
1547 | * we don't explicitly enable it here. | 1553 | * we don't explicitly enable it here. |
1548 | */ | 1554 | */ |
1549 | if (udev->actconfig | 1555 | if (device_may_wakeup(&udev->dev)) { |
1550 | // && FIXME (remote wakeup enabled on this bus) | ||
1551 | // ... currently assuming it's always appropriate | ||
1552 | && (udev->actconfig->desc.bmAttributes | ||
1553 | & USB_CONFIG_ATT_WAKEUP) != 0) { | ||
1554 | status = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), | 1556 | status = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), |
1555 | USB_REQ_SET_FEATURE, USB_RECIP_DEVICE, | 1557 | USB_REQ_SET_FEATURE, USB_RECIP_DEVICE, |
1556 | USB_DEVICE_REMOTE_WAKEUP, 0, | 1558 | USB_DEVICE_REMOTE_WAKEUP, 0, |