* [PATCH 0/2] usb: gadget: f_uvc: SuperSpeed fixes
@ 2017-03-08 14:05 Roger Quadros
2017-03-08 14:05 ` [PATCH 1/2] usb: gadget: f_uvc: Fix SuperSpeed companion descriptor's wBytesPerInterval Roger Quadros
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Roger Quadros @ 2017-03-08 14:05 UTC (permalink / raw)
To: laurent.pinchart, balbi
Cc: b-liu, nsekhar, linux-usb, linux-kernel, Roger Quadros
Hi Laurent & Felipe,
These are some fixes for SuperSpeed case.
--
cheers,
-roger
Roger Quadros (2):
usb: gadget: f_uvc: Fix SuperSpeed companion descriptor's
wBytesPerInterval
usb: gadget: f_uvc: Sanity check wMaxPacketSize for SuperSpeed
drivers/usb/gadget/function/f_uvc.c | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
--
2.7.4
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 1/2] usb: gadget: f_uvc: Fix SuperSpeed companion descriptor's wBytesPerInterval
2017-03-08 14:05 [PATCH 0/2] usb: gadget: f_uvc: SuperSpeed fixes Roger Quadros
@ 2017-03-08 14:05 ` Roger Quadros
2017-03-09 9:34 ` Roger Quadros
2017-03-08 14:05 ` [PATCH 2/2] usb: gadget: f_uvc: Sanity check wMaxPacketSize for SuperSpeed Roger Quadros
2017-03-08 15:48 ` [PATCH 0/2] usb: gadget: f_uvc: SuperSpeed fixes Laurent Pinchart
2 siblings, 1 reply; 5+ messages in thread
From: Roger Quadros @ 2017-03-08 14:05 UTC (permalink / raw)
To: laurent.pinchart, balbi
Cc: b-liu, nsekhar, linux-usb, linux-kernel, Roger Quadros, stable
The streaming_maxburst module parameter is 0 offset (0..15)
so we must add 1 while using it for wBytesPerInterval
calculation for the SuperSpeed companion descriptor.
Without this host uvcvideo driver will always see the wrong
wBytesPerInterval for SuperSpeed uvc gadget and may not find
a suitable video interface endpoint.
e.g. for streaming_maxburst = 0 case it will always
fail as wBytePerInterval was evaluating to 0.
Cc: stable@vger.kernel.org
Signed-off-by: Roger Quadros <rogerq@ti.com>
---
drivers/usb/gadget/function/f_uvc.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/usb/gadget/function/f_uvc.c b/drivers/usb/gadget/function/f_uvc.c
index 29b41b5..c7689d0 100644
--- a/drivers/usb/gadget/function/f_uvc.c
+++ b/drivers/usb/gadget/function/f_uvc.c
@@ -625,7 +625,7 @@ uvc_function_bind(struct usb_configuration *c, struct usb_function *f)
uvc_ss_streaming_comp.bMaxBurst = opts->streaming_maxburst;
uvc_ss_streaming_comp.wBytesPerInterval =
cpu_to_le16(max_packet_size * max_packet_mult *
- opts->streaming_maxburst);
+ (opts->streaming_maxburst + 1));
/* Allocate endpoints. */
ep = usb_ep_autoconfig(cdev->gadget, &uvc_control_ep);
--
2.7.4
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 2/2] usb: gadget: f_uvc: Sanity check wMaxPacketSize for SuperSpeed
2017-03-08 14:05 [PATCH 0/2] usb: gadget: f_uvc: SuperSpeed fixes Roger Quadros
2017-03-08 14:05 ` [PATCH 1/2] usb: gadget: f_uvc: Fix SuperSpeed companion descriptor's wBytesPerInterval Roger Quadros
@ 2017-03-08 14:05 ` Roger Quadros
2017-03-08 15:48 ` [PATCH 0/2] usb: gadget: f_uvc: SuperSpeed fixes Laurent Pinchart
2 siblings, 0 replies; 5+ messages in thread
From: Roger Quadros @ 2017-03-08 14:05 UTC (permalink / raw)
To: laurent.pinchart, balbi
Cc: b-liu, nsekhar, linux-usb, linux-kernel, Roger Quadros
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.
Signed-off-by: Roger Quadros <rogerq@ti.com>
---
drivers/usb/gadget/function/f_uvc.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/drivers/usb/gadget/function/f_uvc.c b/drivers/usb/gadget/function/f_uvc.c
index c7689d0..f8a1881 100644
--- a/drivers/usb/gadget/function/f_uvc.c
+++ b/drivers/usb/gadget/function/f_uvc.c
@@ -594,6 +594,14 @@ uvc_function_bind(struct usb_configuration *c, struct usb_function *f)
opts->streaming_maxpacket = clamp(opts->streaming_maxpacket, 1U, 3072U);
opts->streaming_maxburst = min(opts->streaming_maxburst, 15U);
+ /* For SS, wMaxPacketSize has to be 1024 if bMaxBurst is not 0 */
+ if (opts->streaming_maxburst &&
+ (opts->streaming_maxpacket % 1024) != 0) {
+ opts->streaming_maxpacket = roundup(opts->streaming_maxpacket, 1024);
+ INFO(cdev, "overriding streaming_maxpacket to %d\n",
+ opts->streaming_maxpacket);
+ }
+
/* Fill in the FS/HS/SS Video Streaming specific descriptors from the
* module parameters.
*
--
2.7.4
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH 0/2] usb: gadget: f_uvc: SuperSpeed fixes
2017-03-08 14:05 [PATCH 0/2] usb: gadget: f_uvc: SuperSpeed fixes Roger Quadros
2017-03-08 14:05 ` [PATCH 1/2] usb: gadget: f_uvc: Fix SuperSpeed companion descriptor's wBytesPerInterval Roger Quadros
2017-03-08 14:05 ` [PATCH 2/2] usb: gadget: f_uvc: Sanity check wMaxPacketSize for SuperSpeed Roger Quadros
@ 2017-03-08 15:48 ` Laurent Pinchart
2 siblings, 0 replies; 5+ messages in thread
From: Laurent Pinchart @ 2017-03-08 15:48 UTC (permalink / raw)
To: Roger Quadros; +Cc: balbi, b-liu, nsekhar, linux-usb, linux-kernel
Hi Roger,
Thank you for the patches.
On Wednesday 08 Mar 2017 16:05:42 Roger Quadros wrote:
> Hi Laurent & Felipe,
>
> These are some fixes for SuperSpeed case.
For both patches,
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> --
> cheers,
> -roger
>
> Roger Quadros (2):
> usb: gadget: f_uvc: Fix SuperSpeed companion descriptor's
> wBytesPerInterval
> usb: gadget: f_uvc: Sanity check wMaxPacketSize for SuperSpeed
>
> drivers/usb/gadget/function/f_uvc.c | 10 +++++++++-
> 1 file changed, 9 insertions(+), 1 deletion(-)
--
Regards,
Laurent Pinchart
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 1/2] usb: gadget: f_uvc: Fix SuperSpeed companion descriptor's wBytesPerInterval
2017-03-08 14:05 ` [PATCH 1/2] usb: gadget: f_uvc: Fix SuperSpeed companion descriptor's wBytesPerInterval Roger Quadros
@ 2017-03-09 9:34 ` Roger Quadros
0 siblings, 0 replies; 5+ messages in thread
From: Roger Quadros @ 2017-03-09 9:34 UTC (permalink / raw)
To: laurent.pinchart, balbi; +Cc: b-liu, nsekhar, linux-usb, linux-kernel, stable
Felipe,
On 08/03/17 16:05, Roger Quadros wrote:
> The streaming_maxburst module parameter is 0 offset (0..15)
> so we must add 1 while using it for wBytesPerInterval
> calculation for the SuperSpeed companion descriptor.
>
> Without this host uvcvideo driver will always see the wrong
> wBytesPerInterval for SuperSpeed uvc gadget and may not find
> a suitable video interface endpoint.
> e.g. for streaming_maxburst = 0 case it will always
> fail as wBytePerInterval was evaluating to 0.
>
> Cc: stable@vger.kernel.org
> Signed-off-by: Roger Quadros <rogerq@ti.com>
Please pick this one for v4.11-rc with Laurent's Reviewed-by. Thanks.
> ---
> drivers/usb/gadget/function/f_uvc.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/usb/gadget/function/f_uvc.c b/drivers/usb/gadget/function/f_uvc.c
> index 29b41b5..c7689d0 100644
> --- a/drivers/usb/gadget/function/f_uvc.c
> +++ b/drivers/usb/gadget/function/f_uvc.c
> @@ -625,7 +625,7 @@ uvc_function_bind(struct usb_configuration *c, struct usb_function *f)
> uvc_ss_streaming_comp.bMaxBurst = opts->streaming_maxburst;
> uvc_ss_streaming_comp.wBytesPerInterval =
> cpu_to_le16(max_packet_size * max_packet_mult *
> - opts->streaming_maxburst);
> + (opts->streaming_maxburst + 1));
>
> /* Allocate endpoints. */
> ep = usb_ep_autoconfig(cdev->gadget, &uvc_control_ep);
>
--
cheers,
-roger
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2017-03-09 9:37 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-08 14:05 [PATCH 0/2] usb: gadget: f_uvc: SuperSpeed fixes Roger Quadros
2017-03-08 14:05 ` [PATCH 1/2] usb: gadget: f_uvc: Fix SuperSpeed companion descriptor's wBytesPerInterval Roger Quadros
2017-03-09 9:34 ` Roger Quadros
2017-03-08 14:05 ` [PATCH 2/2] usb: gadget: f_uvc: Sanity check wMaxPacketSize for SuperSpeed Roger Quadros
2017-03-08 15:48 ` [PATCH 0/2] usb: gadget: f_uvc: SuperSpeed fixes Laurent Pinchart
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).