linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] usb: gadget: f_uac2: Add missing companion descriptor for feedback EP
@ 2021-09-02  1:43 Jack Pham
  2021-09-09  5:53 ` Jack Pham
  0 siblings, 1 reply; 2+ messages in thread
From: Jack Pham @ 2021-09-02  1:43 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Felipe Balbi, Thinh Nguyen, Ruslan Bilovol,
	Jerome Brunet, Pavel Hofman
  Cc: linux-usb, Ferry Toth, Wesley Cheng, Pawel Laszczak, Jack Pham

The f_uac2 function fails to enumerate when connected in SuperSpeed
due to the feedback endpoint missing the companion descriptor.
We can reuse the ss_epin_desc_comp descriptor and append it behind the
ss_epin_fback_desc both in the static definition of the ss_audio_desc
structure as well as its dynamic construction in setup_headers().

Fixes: 24f779dac8f3 ("usb: gadget: f_uac2/u_audio: add feedback endpoint support")
Signed-off-by: Jack Pham <jackp@codeaurora.org>
---
 drivers/usb/gadget/function/f_uac2.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/gadget/function/f_uac2.c b/drivers/usb/gadget/function/f_uac2.c
index 3c34995276e7..5c4917f157e2 100644
--- a/drivers/usb/gadget/function/f_uac2.c
+++ b/drivers/usb/gadget/function/f_uac2.c
@@ -597,6 +597,7 @@ static struct usb_descriptor_header *ss_audio_desc[] = {
 	(struct usb_descriptor_header *)&ss_epout_desc_comp,
 	(struct usb_descriptor_header *)&as_iso_out_desc,
 	(struct usb_descriptor_header *)&ss_epin_fback_desc,
+	(struct usb_descriptor_header *)&ss_epin_desc_comp,
 
 	(struct usb_descriptor_header *)&std_as_in_if0_desc,
 	(struct usb_descriptor_header *)&std_as_in_if1_desc,
@@ -773,8 +774,11 @@ static void setup_headers(struct f_uac2_opts *opts,
 
 		headers[i++] = USBDHDR(&as_iso_out_desc);
 
-		if (EPOUT_FBACK_IN_EN(opts))
+		if (EPOUT_FBACK_IN_EN(opts)) {
 			headers[i++] = USBDHDR(epin_fback_desc);
+			if (epin_desc_comp)
+				headers[i++] = USBDHDR(epin_desc_comp);
+		}
 	}
 
 	if (EPIN_EN(opts)) {
-- 
2.24.0


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

* Re: [PATCH] usb: gadget: f_uac2: Add missing companion descriptor for feedback EP
  2021-09-02  1:43 [PATCH] usb: gadget: f_uac2: Add missing companion descriptor for feedback EP Jack Pham
@ 2021-09-09  5:53 ` Jack Pham
  0 siblings, 0 replies; 2+ messages in thread
From: Jack Pham @ 2021-09-09  5:53 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Felipe Balbi, Thinh Nguyen, Ruslan Bilovol,
	Jerome Brunet, Pavel Hofman
  Cc: linux-usb, Ferry Toth, Wesley Cheng, Pawel Laszczak

On Wed, Sep 01, 2021 at 06:43:17PM -0700, Jack Pham wrote:
> The f_uac2 function fails to enumerate when connected in SuperSpeed
> due to the feedback endpoint missing the companion descriptor.
> We can reuse the ss_epin_desc_comp descriptor and append it behind the
> ss_epin_fback_desc both in the static definition of the ss_audio_desc
> structure as well as its dynamic construction in setup_headers().
> 
> Fixes: 24f779dac8f3 ("usb: gadget: f_uac2/u_audio: add feedback endpoint support")
> Signed-off-by: Jack Pham <jackp@codeaurora.org>
> ---
>  drivers/usb/gadget/function/f_uac2.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/usb/gadget/function/f_uac2.c b/drivers/usb/gadget/function/f_uac2.c
> index 3c34995276e7..5c4917f157e2 100644
> --- a/drivers/usb/gadget/function/f_uac2.c
> +++ b/drivers/usb/gadget/function/f_uac2.c
> @@ -597,6 +597,7 @@ static struct usb_descriptor_header *ss_audio_desc[] = {
>  	(struct usb_descriptor_header *)&ss_epout_desc_comp,
>  	(struct usb_descriptor_header *)&as_iso_out_desc,
>  	(struct usb_descriptor_header *)&ss_epin_fback_desc,
> +	(struct usb_descriptor_header *)&ss_epin_desc_comp,
>  
>  	(struct usb_descriptor_header *)&std_as_in_if0_desc,
>  	(struct usb_descriptor_header *)&std_as_in_if1_desc,
> @@ -773,8 +774,11 @@ static void setup_headers(struct f_uac2_opts *opts,
>  
>  		headers[i++] = USBDHDR(&as_iso_out_desc);
>  
> -		if (EPOUT_FBACK_IN_EN(opts))
> +		if (EPOUT_FBACK_IN_EN(opts)) {
>  			headers[i++] = USBDHDR(epin_fback_desc);
> +			if (epin_desc_comp)
> +				headers[i++] = USBDHDR(epin_desc_comp);
> +		}
>  	}
>  
>  	if (EPIN_EN(opts)) {

Please hold off on this change... there's another bug with f_uac2 in
SuperSpeed wherein the companion descriptors' wBytesPerInterval field
is currently 0 when they need to actually indicate the number of bytes
intended to be transferred per service interval.  As such this means
the ISOC IN, ISOC OUT and now the ISOC IN feedback should have their
own companion descriptors instead of sharing the same structure.

Will send a V2 series shortly.

Jack
-- 
The Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project

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

end of thread, other threads:[~2021-09-09  5:54 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-02  1:43 [PATCH] usb: gadget: f_uac2: Add missing companion descriptor for feedback EP Jack Pham
2021-09-09  5:53 ` Jack Pham

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