usb: gadget: Disable L1 LPM capability

Disable USB L1 LPM functionality on MSM platforms by setting the
USB version as 0x200 for all High Speed Devices.
Add a module param, which when enabled will set the USB version as
0x210. Module param can be enabled as

echo Y > /sys/module/libcomposite/parameters/enable_l1_for_hs

Change-Id: I781a237b44e542c6089af36b7ce0a0665d3cd440
Signed-off-by: Azhar Shaikh <azhars@codeaurora.org>
This commit is contained in:
Azhar Shaikh 2015-07-02 18:11:33 -07:00 committed by David Keitel
parent 37648e8eb6
commit a99d4a5017

View file

@ -27,6 +27,10 @@
#define SSUSB_GADGET_VBUS_DRAW_UNITS 8
#define HSUSB_GADGET_VBUS_DRAW_UNITS 2
static bool enable_l1_for_hs;
module_param(enable_l1_for_hs, bool, S_IRUGO | S_IWUSR);
MODULE_PARM_DESC(enable_l1_for_hs, "Enable support for L1 LPM for HS devices");
/**
* struct usb_os_string - represents OS String to be reported by a gadget
* @bLength: total length of the entire descritor, always 0x12
@ -1625,8 +1629,11 @@ composite_setup(struct usb_gadget *gadget, const struct usb_ctrlrequest *ctrl)
if (gadget->speed >= USB_SPEED_SUPER) {
cdev->desc.bcdUSB = cpu_to_le16(0x0300);
cdev->desc.bMaxPacketSize0 = 9;
} else {
} else if (gadget->l1_supported ||
enable_l1_for_hs) {
cdev->desc.bcdUSB = cpu_to_le16(0x0210);
DBG(cdev,
"Config HS device with LPM(L1)\n");
}
} else if (gadget->l1_supported) {
cdev->desc.bcdUSB = cpu_to_le16(0x0210);
@ -1661,8 +1668,9 @@ composite_setup(struct usb_gadget *gadget, const struct usb_ctrlrequest *ctrl)
value = min(w_length, (u16) value);
break;
case USB_DT_BOS:
if (gadget_is_superspeed(gadget) ||
gadget->l1_supported) {
if ((gadget_is_superspeed(gadget) &&
(gadget->speed >= USB_SPEED_SUPER))
|| gadget->l1_supported) {
value = bos_desc(cdev);
value = min(w_length, (u16) value);
}