Skip to contentSkip to conversation

usb: gadget: f_uac2: Add missing companion descriptor for feedback EP

PATCH Superseded Jack Pham 1 participant 2 messages Sep 2, 2021 – Sep 9, 2021 USB

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Jack Pham

author
#0 lore raw

PATCH 1/1 usb: gadget: f_uac2: Add missing companion descriptor for feedback EP

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")
---
 drivers/usb/gadget/function/f_uac2.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/usb/gadget/function/f_uac2.c +5 -1
index 3c34995276e7..5c4917f157e2 100644
@@ -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)) {
Signature · 1 line
2.24.0
author
#1 lore raw
Quoted 27 lines · 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")
---
 drivers/usb/gadget/function/f_uac2.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/usb/gadget/function/f_uac2.c +1 -0
index 3c34995276e7..5c4917f157e2 100644
@@ -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);

drivers/usb/gadget/function/f_uac2.c static void setup_headers(struct f_uac2_opts *opts, · line 784

Quoted 10 lines
drivers/usb/gadget/function/f_uac2.c +4 -1
 
-		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

Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project