]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blobdiff - drivers/usb/core/hub.c
usb: hub: delay hub autosuspend if USB3 port is still link training
[mirror_ubuntu-bionic-kernel.git] / drivers / usb / core / hub.c
index 4b0def17632e2df1941bd0ce6e9806741c092f34..45c2702343f052e541dd514f9544cde7d3654f8d 100644 (file)
@@ -1110,6 +1110,16 @@ static void hub_activate(struct usb_hub *hub, enum hub_activation_type type)
                                                   USB_PORT_FEAT_ENABLE);
                }
 
+               /*
+                * Add debounce if USB3 link is in polling/link training state.
+                * Link will automatically transition to Enabled state after
+                * link training completes.
+                */
+               if (hub_is_superspeed(hdev) &&
+                   ((portstatus & USB_PORT_STAT_LINK_STATE) ==
+                                               USB_SS_PORT_LS_POLLING))
+                       need_debounce_delay = true;
+
                /* Clear status-change flags; we'll debounce later */
                if (portchange & USB_PORT_STAT_C_CONNECTION) {
                        need_debounce_delay = true;