Re: [PATCH v3] usb: gadget: f_uac1: add different speed transfers support

From: Greg KH
Date: Tue Feb 15 2022 - 09:08:45 EST


On Tue, Feb 15, 2022 at 11:08:48AM +0800, 3090101217@xxxxxxxxxx wrote:
> From: Jing Leng <jleng@xxxxxxxxxxxxx>
>
> On page 61 of the UAC1 specification (
> https://www.usb.org/sites/default/files/audio10.pdf),
> bInterval is interval for polling endpoint for data transfers
> expressed in milliseconds, must be set to 1.
>
> On page 47 of the USB2.0 specification (
> https://www.usb.org/sites/default/files/usb_20_20211008.zip),
> An isochronous endpoint must specify its required bus access period.
> Full-/high-speed endpoints must specify a desired period as
> (2^(bInterval-1)) x F, where bInterval is in the range one to
> (and including) 16 and F is 125 μs for high-speed and 1ms for full-speed.
>
> On page 362 of the USB3.2 specification (
> https://usb.org/sites/default/files/usb_32_20210125.zip),
> The 'SuperSpeed Endpoint Companion Descriptor' shall only be
> returned by Enhanced SuperSpeed devices that are operating at Gen X speed.
> Each endpoint described in an interface is followed by a 'SuperSpeed
> Endpoint Companion Descriptor'.
>
> Currently uac1 driver doesn't set bInterval to 1 in full speed transfer
> and doesn't have a 'SuperSpeed Endpoint Companion Descriptor' behind
> 'Standard Endpoint Descriptor'.
>
> So we should set bInterval to 1 in full speed transfer and set it to 4
> in other speed transfers, and we should add 'SuperSpeed Endpoint Companion
> Descriptor' behind 'Standard Endpoint Descriptor' for superspeed transfer.
>
> Signed-off-by: Jing Leng <jleng@xxxxxxxxxxxxx>
> ---
> drivers/usb/gadget/function/f_uac1.c | 276 ++++++++++++++++++++++-----
> 1 file changed, 225 insertions(+), 51 deletions(-)

Where is the patch version information?

> +static struct usb_ss_ep_comp_descriptor as_out_ep_desc_comp = {
> + .bLength = sizeof(as_out_ep_desc_comp),
> + .bDescriptorType = USB_DT_SS_ENDPOINT_COMP,
> + .bMaxBurst = 0,
> + .bmAttributes = 0,

Why are you setting values to 0 when you do not have to as that is the
default value?

> @@ -891,7 +1098,6 @@ static int f_audio_get_alt(struct usb_function *f, unsigned intf)
> return -EINVAL;
> }
>
> -
> static void f_audio_disable(struct usb_function *f)
> {
> struct f_uac1 *uac1 = func_to_uac1(f);

The above change is not needed here.

thanks,

greg k-h