Skip to content

Commit 2b943be

Browse files
Roger Quadrosgregkh
authored andcommitted
usb: gadget: f_uvc: Sanity check wMaxPacketSize for SuperSpeed
[ Upstream commit 16bb05d ] As per USB3.0 Specification "Table 9-20. Standard Endpoint Descriptor", for interrupt and isochronous endpoints, wMaxPacketSize must be set to 1024 if the endpoint defines bMaxBurst to be greater than zero. Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Roger Quadros <rogerq@ti.com> Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com> Signed-off-by: Sasha Levin <alexander.levin@verizon.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 2101ccb commit 2b943be

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

drivers/usb/gadget/function/f_uvc.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -594,6 +594,14 @@ uvc_function_bind(struct usb_configuration *c, struct usb_function *f)
594594
opts->streaming_maxpacket = clamp(opts->streaming_maxpacket, 1U, 3072U);
595595
opts->streaming_maxburst = min(opts->streaming_maxburst, 15U);
596596

597+
/* For SS, wMaxPacketSize has to be 1024 if bMaxBurst is not 0 */
598+
if (opts->streaming_maxburst &&
599+
(opts->streaming_maxpacket % 1024) != 0) {
600+
opts->streaming_maxpacket = roundup(opts->streaming_maxpacket, 1024);
601+
INFO(cdev, "overriding streaming_maxpacket to %d\n",
602+
opts->streaming_maxpacket);
603+
}
604+
597605
/* Fill in the FS/HS/SS Video Streaming specific descriptors from the
598606
* module parameters.
599607
*

0 commit comments

Comments
 (0)