Skip to content

Commit 0522b9a

Browse files
matnymangregkh
authored andcommitted
xhci: Add a flag to disable USB3 lpm on a xhci root port level.
One USB3 roothub port may support link power management, while another root port on the same xHC can't due to different retimers used for the ports. This is the case with Intel Alder Lake, and possible future platforms where retimers used for USB4 ports cause too long exit latecy to enable native USB3 lpm U1 and U2 states. Add a flag in the xhci port structure to indicate if the port is lpm_incapable, and check it while calculating exit latency. 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 23a3b8d commit 0522b9a

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

drivers/usb/host/xhci.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5049,6 +5049,7 @@ static int xhci_enable_usb3_lpm_timeout(struct usb_hcd *hcd,
50495049
struct usb_device *udev, enum usb3_link_state state)
50505050
{
50515051
struct xhci_hcd *xhci;
5052+
struct xhci_port *port;
50525053
u16 hub_encoded_timeout;
50535054
int mel;
50545055
int ret;
@@ -5065,6 +5066,13 @@ static int xhci_enable_usb3_lpm_timeout(struct usb_hcd *hcd,
50655066
if (xhci_check_tier_policy(xhci, udev, state) < 0)
50665067
return USB3_LPM_DISABLED;
50675068

5069+
/* If connected to root port then check port can handle lpm */
5070+
if (udev->parent && !udev->parent->parent) {
5071+
port = xhci->usb3_rhub.ports[udev->portnum - 1];
5072+
if (port->lpm_incapable)
5073+
return USB3_LPM_DISABLED;
5074+
}
5075+
50685076
hub_encoded_timeout = xhci_calculate_lpm_timeout(hcd, udev, state);
50695077
mel = calculate_max_exit_latency(udev, state, hub_encoded_timeout);
50705078
if (mel < 0) {

drivers/usb/host/xhci.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1735,6 +1735,7 @@ struct xhci_port {
17351735
int hcd_portnum;
17361736
struct xhci_hub *rhub;
17371737
struct xhci_port_cap *port_cap;
1738+
unsigned int lpm_incapable:1;
17381739
};
17391740

17401741
struct xhci_hub {

0 commit comments

Comments
 (0)