[PATCH 4/4] xhci: Enable LPM support only for hardwired or BESL devices

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Some usb3 devices falsely claim they support usb2 hardware Link PM
when connected to a usb2 port. We only trust hardwired devices
or devices with the later BESL LPM support to be LPM enabled as default.

Signed-off-by: Mathias Nyman <mathias.nyman@xxxxxxxxxxxxxxx>
---
 drivers/usb/host/xhci.c |   16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
index b554eba..280df91 100644
--- a/drivers/usb/host/xhci.c
+++ b/drivers/usb/host/xhci.c
@@ -4141,6 +4141,7 @@ int xhci_update_device(struct usb_hcd *hcd, struct usb_device *udev)
 {
 	struct xhci_hcd	*xhci = hcd_to_xhci(hcd);
 	int		portnum = udev->portnum - 1;
+	int		ret, connect_type;
 
 	if (xhci->hw_lpm_support == 1 &&
 			xhci_check_usb2_port_capability(
@@ -4151,8 +4152,21 @@ int xhci_update_device(struct usb_hcd *hcd, struct usb_device *udev)
 		if (xhci_check_usb2_port_capability(xhci, portnum,
 					XHCI_BLC))
 			udev->usb2_hw_lpm_besl_capable = 1;
-	}
+		connect_type = usb_get_hub_port_connect_type(udev->parent,
+							     udev->portnum);
 
+		/* Some usb3 devices falsely claim to be LPM capable when
+		 * connected to a usb2 port. Only trust hardwired usb2
+		 * devices and devices with BESL support to actually work
+		 */
+		if (udev->usb2_hw_lpm_besl_capable ||
+		    connect_type == USB_PORT_CONNECT_TYPE_HARD_WIRED) {
+			udev->usb2_hw_lpm_allowed = 1;
+			ret = xhci_set_usb2_hardware_lpm(hcd, udev, 1);
+			if (!ret)
+				udev->usb2_hw_lpm_enabled = 1;
+		}
+	}
 	return 0;
 }
 
-- 
1.7.10.4

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux