From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Shuzhen Wang <shuzhenwang@google.com>
Cc: balbi@kernel.org, gregkh@linuxfoundation.org,
linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] usb: gadget: uvc: Add missing initialization of ssp config descriptor
Date: Fri, 27 Oct 2023 11:03:15 +0300 [thread overview]
Message-ID: <20231027080315.GK26306@pendragon.ideasonboard.com> (raw)
In-Reply-To: <14ceb63f-1769-4025-ad90-c38112dfec79@google.com>
Hi Shuzhen,
Thank you for the patch.
On Thu, Oct 26, 2023 at 12:29:02PM -0700, Shuzhen Wang wrote:
> In case the uvc gadget is super speed plus, the corresponding config
> descriptor wasn't initialized. As a result, the host will not recognize
> the devices when using super speed plus connection.
>
> This patch initializes them to super speed descriptors.
>
> Signed-off-by: Shuzhen Wang <shuzhenwang@google.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> ---
> drivers/usb/gadget/function/f_uvc.c | 14 ++++++++++++--
> 1 file changed, 12 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/usb/gadget/function/f_uvc.c b/drivers/usb/gadget/function/f_uvc.c
> index faa398109431..786379f1b7b7 100644
> --- a/drivers/usb/gadget/function/f_uvc.c
> +++ b/drivers/usb/gadget/function/f_uvc.c
> @@ -516,6 +516,7 @@ uvc_copy_descriptors(struct uvc_device *uvc, enum usb_device_speed speed)
> void *mem;
>
> switch (speed) {
> + case USB_SPEED_SUPER_PLUS:
> case USB_SPEED_SUPER:
> uvc_control_desc = uvc->desc.ss_control;
> uvc_streaming_cls = uvc->desc.ss_streaming;
> @@ -564,7 +565,8 @@ uvc_copy_descriptors(struct uvc_device *uvc, enum usb_device_speed speed)
> bytes += uvc_interrupt_ep.bLength + uvc_interrupt_cs_ep.bLength;
> n_desc += 2;
>
> - if (speed == USB_SPEED_SUPER) {
> + if (speed == USB_SPEED_SUPER ||
> + speed == USB_SPEED_SUPER_PLUS) {
> bytes += uvc_ss_interrupt_comp.bLength;
> n_desc += 1;
> }
> @@ -619,7 +621,8 @@ uvc_copy_descriptors(struct uvc_device *uvc, enum usb_device_speed speed)
>
> if (uvc->enable_interrupt_ep) {
> UVC_COPY_DESCRIPTOR(mem, dst, &uvc_interrupt_ep);
> - if (speed == USB_SPEED_SUPER)
> + if (speed == USB_SPEED_SUPER ||
> + speed == USB_SPEED_SUPER_PLUS)
> UVC_COPY_DESCRIPTOR(mem, dst, &uvc_ss_interrupt_comp);
>
> UVC_COPY_DESCRIPTOR(mem, dst, &uvc_interrupt_cs_ep);
> @@ -795,6 +798,13 @@ uvc_function_bind(struct usb_configuration *c, struct usb_function *f)
> goto error;
> }
>
> + f->ssp_descriptors = uvc_copy_descriptors(uvc, USB_SPEED_SUPER_PLUS);
> + if (IS_ERR(f->ssp_descriptors)) {
> + ret = PTR_ERR(f->ssp_descriptors);
> + f->ssp_descriptors = NULL;
> + goto error;
> + }
> +
> /* Preallocate control endpoint request. */
> uvc->control_req = usb_ep_alloc_request(cdev->gadget->ep0, GFP_KERNEL);
> uvc->control_buf = kmalloc(UVC_MAX_REQUEST_SIZE, GFP_KERNEL);
--
Regards,
Laurent Pinchart
next prev parent reply other threads:[~2023-10-27 8:03 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-26 19:29 [PATCH] usb: gadget: uvc: Add missing initialization of ssp config descriptor Shuzhen Wang
2023-10-27 8:03 ` Laurent Pinchart [this message]
2023-10-27 10:57 ` Greg KH
2023-10-27 18:34 ` [PATCH v2] " Shuzhen Wang
[not found] <c2a62810-98b3-46d5-b557-2e98460729f7@google.com>
2023-10-27 10:55 ` [PATCH] " Greg KH
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=20231027080315.GK26306@pendragon.ideasonboard.com \
--to=laurent.pinchart@ideasonboard.com \
--cc=balbi@kernel.org \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=shuzhenwang@google.com \
/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