diff options
author | Olof Johansson <olof@lixom.net> | 2014-07-20 01:59:07 +0400 |
---|---|---|
committer | Olof Johansson <olof@lixom.net> | 2014-07-20 01:59:07 +0400 |
commit | 4e9816d012dbc28dc89559261c6ffbf8ffc440dd (patch) | |
tree | dee9f8b31f3d6d2fb141541da88e1cc1329b017e /drivers/usb/core/hub.h | |
parent | da98f44f27d81d7fe9a41f69af4fe08c18d13b56 (diff) | |
parent | 1795cd9b3a91d4b5473c97f491d63892442212ab (diff) | |
download | linux-4e9816d012dbc28dc89559261c6ffbf8ffc440dd.tar.xz |
Merge tag 'v3.16-rc5' into next/fixes-non-critical
Linux 3.16-rc5
Diffstat (limited to 'drivers/usb/core/hub.h')
-rw-r--r-- | drivers/usb/core/hub.h | 43 |
1 files changed, 37 insertions, 6 deletions
diff --git a/drivers/usb/core/hub.h b/drivers/usb/core/hub.h index 33bcb2c6f90a..326308e53961 100644 --- a/drivers/usb/core/hub.h +++ b/drivers/usb/core/hub.h @@ -45,12 +45,13 @@ struct usb_hub { unsigned long event_bits[1]; /* status change bitmask */ unsigned long change_bits[1]; /* ports with logical connect status change */ - unsigned long busy_bits[1]; /* ports being reset or - resumed */ unsigned long removed_bits[1]; /* ports with a "removed" device present */ unsigned long wakeup_bits[1]; /* ports that have signaled remote wakeup */ + unsigned long power_bits[1]; /* ports that are powered */ + unsigned long child_usage_bits[1]; /* ports powered on for + children */ #if USB_MAXCHILDREN > 31 /* 8*sizeof(unsigned long) - 1 */ #error event_bits[] is too short! #endif @@ -66,6 +67,7 @@ struct usb_hub { unsigned limited_power:1; unsigned quiescing:1; unsigned disconnected:1; + unsigned in_reset:1; unsigned quirk_check_port_auto_suspend:1; @@ -81,19 +83,25 @@ struct usb_hub { * @child: usb device attached to the port * @dev: generic device interface * @port_owner: port's owner + * @peer: related usb2 and usb3 ports (share the same connector) + * @req: default pm qos request for hubs without port power control * @connect_type: port's connect type + * @location: opaque representation of platform connector location + * @status_lock: synchronize port_event() vs usb_port_{suspend|resume} * @portnum: port index num based one - * @power_is_on: port's power state - * @did_runtime_put: port has done pm_runtime_put(). + * @is_superspeed cache super-speed status */ struct usb_port { struct usb_device *child; struct device dev; struct usb_dev_state *port_owner; + struct usb_port *peer; + struct dev_pm_qos_request *req; enum usb_port_connect_type connect_type; + usb_port_location_t location; + struct mutex status_lock; u8 portnum; - unsigned power_is_on:1; - unsigned did_runtime_put:1; + unsigned int is_superspeed:1; }; #define to_usb_port(_dev) \ @@ -111,6 +119,29 @@ extern int hub_port_debounce(struct usb_hub *hub, int port1, extern int usb_clear_port_feature(struct usb_device *hdev, int port1, int feature); +static inline bool hub_is_port_power_switchable(struct usb_hub *hub) +{ + __le16 hcs; + + if (!hub) + return false; + hcs = hub->descriptor->wHubCharacteristics; + return (le16_to_cpu(hcs) & HUB_CHAR_LPSM) < HUB_CHAR_NO_LPSM; +} + +static inline int hub_is_superspeed(struct usb_device *hdev) +{ + return hdev->descriptor.bDeviceProtocol == USB_HUB_PR_SS; +} + +static inline unsigned hub_power_on_good_delay(struct usb_hub *hub) +{ + unsigned delay = hub->descriptor->bPwrOn2PwrGood * 2; + + /* Wait at least 100 msec for power to become stable */ + return max(delay, 100U); +} + static inline int hub_port_debounce_be_connected(struct usb_hub *hub, int port1) { |