* [PATCH] usb:gadget:uvc: Add super speed plus descriptors
@ 2023-10-19 22:39 Jayant Chowdhary
2023-10-20 5:42 ` Greg KH
0 siblings, 1 reply; 2+ messages in thread
From: Jayant Chowdhary @ 2023-10-19 22:39 UTC (permalink / raw)
To: laurent.pinchart@ideasonboard.com, balbi, Greg KH,
kieran.bingham@ideasonboard.com
Cc: linux-usb@vger.kernel.org, linux-kernel, arakesh@google.com,
etalvala@google.com
Currently the UVC gadget driver doesn't support super speed
plus connections since it doesn't advertise super speed plus descriptors.
This patch re-uses the super speed descriptors for super-speed plus.
As a result, hosts can recognize gadget devices when using a super
speed plus connection.
Signed-off-by: Jayant Chowdhary <jchowdhary@google.com>
---
drivers/usb/gadget/function/f_uvc.c | 14 +++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)
diff --git a/drivers/usb/gadget/function/f_uvc.c b/drivers/usb/gadget/function/f_uvc.c
index 32f2c1645467..fa96306f2209 100644
--- a/drivers/usb/gadget/function/f_uvc.c
+++ b/drivers/usb/gadget/function/f_uvc.c
@@ -492,6 +492,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;
@@ -536,7 +537,7 @@ uvc_copy_descriptors(struct uvc_device *uvc, enum usb_device_speed speed)
+ uvc_control_ep.bLength + uvc_control_cs_ep.bLength
+ uvc_streaming_intf_alt0.bLength;
- if (speed == USB_SPEED_SUPER) {
+ if (speed == USB_SPEED_SUPER || speed == USB_SPEED_SUPER_PLUS) {
bytes += uvc_ss_control_comp.bLength;
n_desc = 6;
} else {
@@ -580,7 +581,7 @@ uvc_copy_descriptors(struct uvc_device *uvc, enum usb_device_speed speed)
uvc_control_header->baInterfaceNr[0] = uvc->streaming_intf;
UVC_COPY_DESCRIPTOR(mem, dst, &uvc_control_ep);
- if (speed == USB_SPEED_SUPER)
+ if (speed == USB_SPEED_SUPER || speed == USB_SPEED_SUPER_PLUS)
UVC_COPY_DESCRIPTOR(mem, dst, &uvc_ss_control_comp);
UVC_COPY_DESCRIPTOR(mem, dst, &uvc_control_cs_ep);
@@ -742,7 +743,14 @@ uvc_function_bind(struct usb_configuration *c, struct usb_function *f)
goto error;
}
}
-
+ if (gadget_is_superspeed_plus(c->cdev->gadget)) {
+ 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);
--
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH] usb:gadget:uvc: Add super speed plus descriptors
2023-10-19 22:39 [PATCH] usb:gadget:uvc: Add super speed plus descriptors Jayant Chowdhary
@ 2023-10-20 5:42 ` Greg KH
0 siblings, 0 replies; 2+ messages in thread
From: Greg KH @ 2023-10-20 5:42 UTC (permalink / raw)
To: Jayant Chowdhary
Cc: laurent.pinchart@ideasonboard.com, balbi,
kieran.bingham@ideasonboard.com, linux-usb@vger.kernel.org,
linux-kernel, arakesh@google.com, etalvala@google.com
On Thu, Oct 19, 2023 at 03:39:44PM -0700, Jayant Chowdhary wrote:
> Currently the UVC gadget driver doesn't support super speed
> plus connections since it doesn't advertise super speed plus descriptors.
> This patch re-uses the super speed descriptors for super-speed plus.
> As a result, hosts can recognize gadget devices when using a super
> speed plus connection.
>
> Signed-off-by: Jayant Chowdhary <jchowdhary@google.com>
> ---
> drivers/usb/gadget/function/f_uvc.c | 14 +++++++++++---
> 1 file changed, 11 insertions(+), 3 deletions(-)
As this is obviously a copy of a previously posted patch, why did you
not credit the original author?
thanks,
greg k-h
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-10-20 5:42 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-10-19 22:39 [PATCH] usb:gadget:uvc: Add super speed plus descriptors Jayant Chowdhary
2023-10-20 5:42 ` Greg KH
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox