Re: usb: gadget: dwc2: not getting audio data

Minas Harutyunyan
2022-12-09T11:33:06Z

Hi Palak,

On 12/8/2022 8:30 PM, Palak SHAH wrote:
> Hi Minas,
>
> We are using an Altera Cyclone V SoC FPGA on our board with linux kernel
> 5.4.80 and enabling the USB gadget for HID (keyboard and mouse) and
> audio (UAC1). The USB will always be configured for USB gadget (and
> never host).
>
> When the USB gadget is configured for audio (speaker), we are seeing
> that the USB gadget DWC2 driver is getting stuck and not getting the
> transfers completed. The USB speaker is configured for 44.1KHz, 2 channel.
>

Could you please apply below patch, test and send debug log.

index 8b15742d9e8a..3c03431023a8 100644
--- a/drivers/usb/dwc2/gadget.c
+++ b/drivers/usb/dwc2/gadget.c
@@ -2218,6 +2218,8 @@ static void
dwc2_gadget_complete_isoc_request_ddma(struct dwc2_hsotg_ep *hs_ep)

dwc2_hsotg_complete_request(hsotg, hs_ep, hs_req, 0);

+ dev_dbg(hsotg->dev, "%s: compl_desc # %d\n", __func__,
hs_ep->compl_desc);
+
hs_ep->compl_desc++;
if (hs_ep->compl_desc > (MAX_DMA_DESC_NUM_HS_ISOC - 1))
hs_ep->compl_desc = 0;
@@ -2892,6 +2894,9 @@ static void
dwc2_gadget_handle_out_token_ep_disabled(struct dwc2_hsotg_ep *ep)
return;

if (using_desc_dma(hsotg)) {
+
+ dev_dbg(hsotg->dev, "%s: target_frame = 0x%08x\n",
__func__, ep->target_frame);
+
if (ep->target_frame == TARGET_FRAME_INITIAL) {
/* Start first ISO Out */
ep->target_frame = hsotg->frame_number;

BTW, correct subject should be follow:

usb: dwc2: gadget: not getting....

Thanks,
Minas