diff mbox series

[v2] usb: host: xhci: wait USB2 port enter suspend for bus suspend

Message ID 1606912976-28318-1-git-send-email-jun.li@nxp.com (mailing list archive)
State Accepted
Commit c1373f10479b624fb6dba0805d673e860f1b421d
Headers show
Series [v2] usb: host: xhci: wait USB2 port enter suspend for bus suspend | expand

Commit Message

Jun Li Dec. 2, 2020, 12:42 p.m. UTC
If the connected USB2 device wakeup is not enabled/supported, the link
state may still be U0 when do xhci bus suspend, after we suspend ports
in U0, we need give time to device to enter suspend before do further
suspend operations (e.g. system suspend), otherwise we may enter system
suspend with link state at U0.

Signed-off-by: Li Jun <jun.li@nxp.com>
---
Change for v2:
-Use bus_state->bus_suspended to check if any port may be at U0.

 drivers/usb/host/xhci-hub.c | 4 ++++
 1 file changed, 4 insertions(+)
diff mbox series

Patch

diff --git a/drivers/usb/host/xhci-hub.c b/drivers/usb/host/xhci-hub.c
index c799ca5..74c497f 100644
--- a/drivers/usb/host/xhci-hub.c
+++ b/drivers/usb/host/xhci-hub.c
@@ -1712,6 +1712,10 @@  int xhci_bus_suspend(struct usb_hcd *hcd)
 	hcd->state = HC_STATE_SUSPENDED;
 	bus_state->next_statechange = jiffies + msecs_to_jiffies(10);
 	spin_unlock_irqrestore(&xhci->lock, flags);
+
+	if (bus_state->bus_suspended)
+		usleep_range(5000, 10000);
+
 	return 0;
 }