Commit cd83ce9e authored by James P Michels III's avatar James P Michels III Committed by Greg Kroah-Hartman

usb-core bInterval quirk

This patch adds a usb quirk to support devices with interupt endpoints
and bInterval values expressed as microframes. The quirk causes the
parse endpoint function to modify the reported bInterval to a standards
conforming value.

There is currently code in the endpoint parser that checks for
bIntervals that are outside of the valid range (1-16 for USB 2+ high
speed and super speed interupt endpoints). In this case, the code assumes
the bInterval is being reported in 1ms frames. As well, the correction
is only applied if the original bInterval value is out of the 1-16 range.

With this quirk applied to the device, the bInterval will be
accurately adjusted from microframes to an exponent.
Signed-off-by: default avatarJames P Michels III <james.p.michels@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 4bdcde35
...@@ -199,6 +199,17 @@ static int usb_parse_endpoint(struct device *ddev, int cfgno, int inum, ...@@ -199,6 +199,17 @@ static int usb_parse_endpoint(struct device *ddev, int cfgno, int inum,
if (n == 0) if (n == 0)
n = 9; /* 32 ms = 2^(9-1) uframes */ n = 9; /* 32 ms = 2^(9-1) uframes */
j = 16; j = 16;
/*
* Adjust bInterval for quirked devices.
* This quirk fixes bIntervals reported in
* linear microframes.
*/
if (to_usb_device(ddev)->quirks &
USB_QUIRK_LINEAR_UFRAME_INTR_BINTERVAL) {
n = clamp(fls(d->bInterval), i, j);
i = j = n;
}
break; break;
default: /* USB_SPEED_FULL or _LOW */ default: /* USB_SPEED_FULL or _LOW */
/* For low-speed, 10 ms is the official minimum. /* For low-speed, 10 ms is the official minimum.
......
...@@ -145,6 +145,10 @@ static const struct usb_device_id usb_quirk_list[] = { ...@@ -145,6 +145,10 @@ static const struct usb_device_id usb_quirk_list[] = {
/* SKYMEDI USB_DRIVE */ /* SKYMEDI USB_DRIVE */
{ USB_DEVICE(0x1516, 0x8628), .driver_info = USB_QUIRK_RESET_RESUME }, { USB_DEVICE(0x1516, 0x8628), .driver_info = USB_QUIRK_RESET_RESUME },
/* Razer - Razer Blade Keyboard */
{ USB_DEVICE(0x1532, 0x0116), .driver_info =
USB_QUIRK_LINEAR_UFRAME_INTR_BINTERVAL },
/* BUILDWIN Photo Frame */ /* BUILDWIN Photo Frame */
{ USB_DEVICE(0x1908, 0x1315), .driver_info = { USB_DEVICE(0x1908, 0x1315), .driver_info =
USB_QUIRK_HONOR_BNUMINTERFACES }, USB_QUIRK_HONOR_BNUMINTERFACES },
......
...@@ -30,4 +30,15 @@ ...@@ -30,4 +30,15 @@
descriptor */ descriptor */
#define USB_QUIRK_DELAY_INIT 0x00000040 #define USB_QUIRK_DELAY_INIT 0x00000040
/*
* For high speed and super speed interupt endpoints, the USB 2.0 and
* USB 3.0 spec require the interval in microframes
* (1 microframe = 125 microseconds) to be calculated as
* interval = 2 ^ (bInterval-1).
*
* Devices with this quirk report their bInterval as the result of this
* calculation instead of the exponent variable used in the calculation.
*/
#define USB_QUIRK_LINEAR_UFRAME_INTR_BINTERVAL 0x00000080
#endif /* __LINUX_USB_QUIRKS_H */ #endif /* __LINUX_USB_QUIRKS_H */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment