summaryrefslogtreecommitdiffstats
path: root/drivers/usb/core/config.c
diff options
context:
space:
mode:
authorJames P Michels III <james.p.michels@gmail.com>2014-07-27 13:28:04 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2014-08-01 15:47:05 -0700
commitcd83ce9e6195aa3ea15ab4db92892802c20df5d0 (patch)
tree8b75990711e5ce8d060f2e7e236c32ca68e17a14 /drivers/usb/core/config.c
parent4bdcde358b4bda74e356841d351945ca3f2245dd (diff)
downloadlinux-cd83ce9e6195aa3ea15ab4db92892802c20df5d0.tar.gz
linux-cd83ce9e6195aa3ea15ab4db92892802c20df5d0.tar.bz2
linux-cd83ce9e6195aa3ea15ab4db92892802c20df5d0.zip
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: James P Michels III <james.p.michels@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb/core/config.c')
-rw-r--r--drivers/usb/core/config.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/drivers/usb/core/config.c b/drivers/usb/core/config.c
index 1ab4df1de2da..b2a540b43f97 100644
--- a/drivers/usb/core/config.c
+++ b/drivers/usb/core/config.c
@@ -199,6 +199,17 @@ static int usb_parse_endpoint(struct device *ddev, int cfgno, int inum,
if (n == 0)
n = 9; /* 32 ms = 2^(9-1) uframes */
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;
default: /* USB_SPEED_FULL or _LOW */
/* For low-speed, 10 ms is the official minimum.