linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Roger Quadros <rogerq@ti.com>
To: <laurent.pinchart@ideasonboard.com>, <balbi@kernel.org>
Cc: <b-liu@ti.com>, <nsekhar@ti.com>, <linux-usb@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>, Roger Quadros <rogerq@ti.com>,
	<stable@vger.kernel.org>
Subject: [PATCH 1/2] usb: gadget: f_uvc: Fix SuperSpeed companion descriptor's wBytesPerInterval
Date: Wed, 8 Mar 2017 16:05:43 +0200	[thread overview]
Message-ID: <1488981944-28915-2-git-send-email-rogerq@ti.com> (raw)
In-Reply-To: <1488981944-28915-1-git-send-email-rogerq@ti.com>

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

  reply	other threads:[~2017-03-08 14:28 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-08 14:05 [PATCH 0/2] usb: gadget: f_uvc: SuperSpeed fixes Roger Quadros
2017-03-08 14:05 ` Roger Quadros [this message]
2017-03-09  9:34   ` [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 ` [PATCH 0/2] usb: gadget: f_uvc: SuperSpeed fixes Laurent Pinchart

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1488981944-28915-2-git-send-email-rogerq@ti.com \
    --to=rogerq@ti.com \
    --cc=b-liu@ti.com \
    --cc=balbi@kernel.org \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=nsekhar@ti.com \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).