Skip to content

Commit e9fb08d

Browse files
matnymangregkh
authored andcommitted
xhci: prevent bus suspend if a roothub port detected a over-current condition
Suspending the bus and host controller while a port is in a over-current condition may halt the host. Also keep the roothub running if over-current is active. Cc: <[email protected]> Signed-off-by: Mathias Nyman <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 93ceaa8 commit e9fb08d

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

drivers/usb/host/xhci-hub.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1571,6 +1571,8 @@ int xhci_hub_status_data(struct usb_hcd *hcd, char *buf)
15711571
}
15721572
if ((temp & PORT_RC))
15731573
reset_change = true;
1574+
if (temp & PORT_OC)
1575+
status = 1;
15741576
}
15751577
if (!status && !reset_change) {
15761578
xhci_dbg(xhci, "%s: stopping port polling.\n", __func__);
@@ -1636,6 +1638,13 @@ int xhci_bus_suspend(struct usb_hcd *hcd)
16361638
port_index);
16371639
goto retry;
16381640
}
1641+
/* bail out if port detected a over-current condition */
1642+
if (t1 & PORT_OC) {
1643+
bus_state->bus_suspended = 0;
1644+
spin_unlock_irqrestore(&xhci->lock, flags);
1645+
xhci_dbg(xhci, "Bus suspend bailout, port over-current detected\n");
1646+
return -EBUSY;
1647+
}
16391648
/* suspend ports in U0, or bail out for new connect changes */
16401649
if ((t1 & PORT_PE) && (t1 & PORT_PLS_MASK) == XDEV_U0) {
16411650
if ((t1 & PORT_CSC) && wake_enabled) {

0 commit comments

Comments
 (0)