linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] usb: gadget: f_uac2: EP OUT adaptive instead of async
@ 2020-02-07 16:53 Pavel Hofman
  2020-02-11 16:16 ` Ruslan Bilovol
  0 siblings, 1 reply; 3+ messages in thread
From: Pavel Hofman @ 2020-02-07 16:53 UTC (permalink / raw)
  To: Greg KH, Linux USB

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(-)

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

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] usb: gadget: f_uac2: EP OUT adaptive instead of async
  2020-02-07 16:53 [PATCH] usb: gadget: f_uac2: EP OUT adaptive instead of async Pavel Hofman
@ 2020-02-11 16:16 ` Ruslan Bilovol
  2020-04-24 11:05   ` Pavel Hofman
  0 siblings, 1 reply; 3+ messages in thread
From: Ruslan Bilovol @ 2020-02-11 16:16 UTC (permalink / raw)
  To: Pavel Hofman; +Cc: Greg KH, Linux USB

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Re: [PATCH] usb: gadget: f_uac2: EP OUT adaptive instead of async
  2020-02-11 16:16 ` Ruslan Bilovol
@ 2020-04-24 11:05   ` Pavel Hofman
  0 siblings, 0 replies; 3+ messages in thread
From: Pavel Hofman @ 2020-04-24 11:05 UTC (permalink / raw)
  To: Ruslan Bilovol; +Cc: Greg KH, Linux USB


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
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-04-24 11:13 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-07 16:53 [PATCH] usb: gadget: f_uac2: EP OUT adaptive instead of async Pavel Hofman
2020-02-11 16:16 ` Ruslan Bilovol
2020-04-24 11:05   ` Pavel Hofman

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).