commit 4e8998d462ab06900949a3099706a19177484c09 Author: Matthew <matthew@xxxxxxxxxx> Date: Wed Apr 13 13:37:21 2016 -0700 Adding new kernel parameter that allows users to skip the check for whether or not LPM is supported. This resolves erratic power state changes with certain U3V machine vision cameras. Signed-off-by: Matthew Giassa <matthew@xxxxxxxxxx> diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c index df0e3b9..ab6eb62 100644 --- a/drivers/usb/core/hcd.c +++ b/drivers/usb/core/hcd.c @@ -118,6 +118,12 @@ static inline int is_root_hub(struct usb_device *udev) return (udev->parent == NULL); } +/* allow LPM to be disabled */ +static bool usb_hcd_lpm_disable = false; +module_param(usb_hcd_lpm_disable, bool, S_IRUGO | S_IWUSR); +MODULE_PARM_DESC(usb_hcd_lpm_disable, "true to disable link power management"); + + /*-------------------------------------------------------------------------*/ /* @@ -1054,6 +1060,7 @@ static int register_root_hub(struct usb_hcd *hcd) struct device *parent_dev = hcd->self.controller; struct usb_device *usb_dev = hcd->self.root_hub; const int devnum = 1; + bool disable_lpm; int retval; usb_dev->devnum = devnum; @@ -1074,15 +1081,18 @@ static int register_root_hub(struct usb_hcd *hcd) return (retval < 0) ? retval : -EMSGSIZE; } - if (le16_to_cpu(usb_dev->descriptor.bcdUSB) >= 0x0201) { - retval = usb_get_bos_descriptor(usb_dev); - if (!retval) { - usb_dev->lpm_capable = usb_device_supports_lpm(usb_dev); - } else if (usb_dev->speed == USB_SPEED_SUPER) { - mutex_unlock(&usb_bus_list_lock); - dev_dbg(parent_dev, "can't read %s bos descriptor %d\n", - dev_name(&usb_dev->dev), retval); - return retval; + disable_lpm = ACCESS_ONCE(usb_hcd_lpm_disable); + if (!disable_lpm) { + if (le16_to_cpu(usb_dev->descriptor.bcdUSB) >= 0x0201) { + retval = usb_get_bos_descriptor(usb_dev); + if (!retval) { + usb_dev->lpm_capable = usb_device_supports_lpm(usb_dev); + } else if (usb_dev->speed >= USB_SPEED_SUPER) { + mutex_unlock(&usb_bus_list_lock); + dev_dbg(parent_dev, "can't read %s bos descriptor %d\n", + dev_name(&usb_dev->dev), retval); + return retval; + } } } ============================================================ Matthew Giassa, MASc, BASc, EIT Security and Embedded Systems Specialist linkedin: https://ca.linkedin.com/in/giassa e-mail: matthew@xxxxxxxxxx website: www.giassa.net -- 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