diff mbox series

usb: gadget: f_uac2: EP OUT adaptive instead of async

Message ID 2bd4ac94-f7c3-41d6-27a7-352f3319bda7@ivitera.com (mailing list archive)
State New, archived
Headers show
Series usb: gadget: f_uac2: EP OUT adaptive instead of async | expand

Commit Message

Pavel Hofman Feb. 7, 2020, 4:53 p.m. UTC
The existing UAC2 implementation presents its EP OUT as
USB_ENDPOINT_SYNC_ASYNC.

However:
1) f_uac2 does not define any feedback endpoint

2) IMO in reality it is adaptive - the USB host is the one which sets
the pace of data.

Changing USB_ENDPOINT_SYNC_ASYNC to USB_ENDPOINT_SYNC_ADAPTIVE for the FS
and HS output endpoints corrects the config to reflect real functionality.

Also, the change makes the UAC2 gadget recognized and working
in MS Windows.

Signed-off-by: Pavel Hofman <pavel.hofman@ivitera.com>
---
 drivers/usb/gadget/function/f_uac2.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Ruslan Bilovol Feb. 11, 2020, 4:16 p.m. UTC | #1
On Fri, Feb 7, 2020 at 6:55 PM Pavel Hofman <pavel.hofman@ivitera.com> wrote:
>
> The existing UAC2 implementation presents its EP OUT as
> USB_ENDPOINT_SYNC_ASYNC.
>
> However:
> 1) f_uac2 does not define any feedback endpoint
>
> 2) IMO in reality it is adaptive - the USB host is the one which sets
> the pace of data.
>
> Changing USB_ENDPOINT_SYNC_ASYNC to USB_ENDPOINT_SYNC_ADAPTIVE for the FS
> and HS output endpoints corrects the config to reflect real functionality.

That's a good idea but ADAPTIVE endpoint still requires feedback endpoint for
source (USB IN) case so the host can synchronize with such endpoint
(see 3.16.2.2 of
UAC2 spec "For adaptive audio source endpoints and asynchronous audio sink
endpoints, an explicit synchronization mechanism is needed to maintain
synchronization
during transfers").

>
> Also, the change makes the UAC2 gadget recognized and working
> in MS Windows.

Does it recognizes well with both IN and OUT (e.g. capture+playback enabled)
adaptive endpoints?

Thanks,
Ruslan

>
> Signed-off-by: Pavel Hofman <pavel.hofman@ivitera.com>
> ---
>  drivers/usb/gadget/function/f_uac2.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/usb/gadget/function/f_uac2.c
> b/drivers/usb/gadget/function/f_uac2.c
> index db2d498..e8c9dd1 100644
> --- a/drivers/usb/gadget/function/f_uac2.c
> +++ b/drivers/usb/gadget/function/f_uac2.c
> @@ -273,7 +273,7 @@ enum {
>         .bDescriptorType = USB_DT_ENDPOINT,
>
>         .bEndpointAddress = USB_DIR_OUT,
> -       .bmAttributes = USB_ENDPOINT_XFER_ISOC | USB_ENDPOINT_SYNC_ASYNC,
> +       .bmAttributes = USB_ENDPOINT_XFER_ISOC | USB_ENDPOINT_SYNC_ADAPTIVE,
>         .wMaxPacketSize = cpu_to_le16(1023),
>         .bInterval = 1,
>  };
> @@ -282,7 +282,7 @@ enum {
>         .bLength = USB_DT_ENDPOINT_SIZE,
>         .bDescriptorType = USB_DT_ENDPOINT,
>
> -       .bmAttributes = USB_ENDPOINT_XFER_ISOC | USB_ENDPOINT_SYNC_ASYNC,
> +       .bmAttributes = USB_ENDPOINT_XFER_ISOC | USB_ENDPOINT_SYNC_ADAPTIVE,
>         .wMaxPacketSize = cpu_to_le16(1024),
>         .bInterval = 4,
>  };
> --
> 1.9.1
Pavel Hofman April 24, 2020, 11:05 a.m. UTC | #2
Dne 11. 02. 20 v 17:16 Ruslan Bilovol napsal(a):
> On Fri, Feb 7, 2020 at 6:55 PM Pavel Hofman <pavel.hofman@ivitera.com> wrote:
>>
>> The existing UAC2 implementation presents its EP OUT as
>> USB_ENDPOINT_SYNC_ASYNC.
>>
>> However:
>> 1) f_uac2 does not define any feedback endpoint
>>
>> 2) IMO in reality it is adaptive - the USB host is the one which sets
>> the pace of data.
>>
>> Changing USB_ENDPOINT_SYNC_ASYNC to USB_ENDPOINT_SYNC_ADAPTIVE for the FS
>> and HS output endpoints corrects the config to reflect real functionality.
> 
> That's a good idea but ADAPTIVE endpoint still requires feedback endpoint for
> source (USB IN) case so the host can synchronize with such endpoint
> (see 3.16.2.2 of
> UAC2 spec "For adaptive audio source endpoints and asynchronous audio sink
> endpoints, an explicit synchronization mechanism is needed to maintain
> synchronization
> during transfers").

I apologize for missing this message. Please can we resume the discussion?

The tested combination is (not-changed) async IN and (changed) adaptive
OUT, which is what most USB-adaptive soundcards use. Such combination
does not require any feedback endpoint.

> 
>>
>> Also, the change makes the UAC2 gadget recognized and working
>> in MS Windows.
> 
> Does it recognizes well with both IN and OUT (e.g. capture+playback enabled)
> adaptive endpoints?

Only OUT is adaptive, IN stays async.

Thanks a lot,

Pavel.


> 
> Thanks,
> Ruslan
> 
>>
>> Signed-off-by: Pavel Hofman <pavel.hofman@ivitera.com>
>> ---
>>  drivers/usb/gadget/function/f_uac2.c | 4 ++--
>>  1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/usb/gadget/function/f_uac2.c
>> b/drivers/usb/gadget/function/f_uac2.c
>> index db2d498..e8c9dd1 100644
>> --- a/drivers/usb/gadget/function/f_uac2.c
>> +++ b/drivers/usb/gadget/function/f_uac2.c
>> @@ -273,7 +273,7 @@ enum {
>>         .bDescriptorType = USB_DT_ENDPOINT,
>>
>>         .bEndpointAddress = USB_DIR_OUT,
>> -       .bmAttributes = USB_ENDPOINT_XFER_ISOC | USB_ENDPOINT_SYNC_ASYNC,
>> +       .bmAttributes = USB_ENDPOINT_XFER_ISOC | USB_ENDPOINT_SYNC_ADAPTIVE,
>>         .wMaxPacketSize = cpu_to_le16(1023),
>>         .bInterval = 1,
>>  };
>> @@ -282,7 +282,7 @@ enum {
>>         .bLength = USB_DT_ENDPOINT_SIZE,
>>         .bDescriptorType = USB_DT_ENDPOINT,
>>
>> -       .bmAttributes = USB_ENDPOINT_XFER_ISOC | USB_ENDPOINT_SYNC_ASYNC,
>> +       .bmAttributes = USB_ENDPOINT_XFER_ISOC | USB_ENDPOINT_SYNC_ADAPTIVE,
>>         .wMaxPacketSize = cpu_to_le16(1024),
>>         .bInterval = 4,
>>  };
>> --
>> 1.9.1
>
diff mbox series

Patch

diff --git a/drivers/usb/gadget/function/f_uac2.c
b/drivers/usb/gadget/function/f_uac2.c
index db2d498..e8c9dd1 100644
--- a/drivers/usb/gadget/function/f_uac2.c
+++ b/drivers/usb/gadget/function/f_uac2.c
@@ -273,7 +273,7 @@  enum {
 	.bDescriptorType = USB_DT_ENDPOINT,

 	.bEndpointAddress = USB_DIR_OUT,
-	.bmAttributes = USB_ENDPOINT_XFER_ISOC | USB_ENDPOINT_SYNC_ASYNC,
+	.bmAttributes = USB_ENDPOINT_XFER_ISOC | USB_ENDPOINT_SYNC_ADAPTIVE,
 	.wMaxPacketSize = cpu_to_le16(1023),
 	.bInterval = 1,
 };
@@ -282,7 +282,7 @@  enum {
 	.bLength = USB_DT_ENDPOINT_SIZE,
 	.bDescriptorType = USB_DT_ENDPOINT,

-	.bmAttributes = USB_ENDPOINT_XFER_ISOC | USB_ENDPOINT_SYNC_ASYNC,
+	.bmAttributes = USB_ENDPOINT_XFER_ISOC | USB_ENDPOINT_SYNC_ADAPTIVE,
 	.wMaxPacketSize = cpu_to_le16(1024),
 	.bInterval = 4,
 };