linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Bin Liu <b-liu@ti.com>
To: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
Cc: Felipe Balbi <balbi@kernel.org>,
	"linux-usb@vger.kernel.org" <linux-usb@vger.kernel.org>
Subject: g_audio regression on dwc3 udc
Date: Mon, 13 Aug 2018 10:21:32 -0500	[thread overview]
Message-ID: <20180813152132.GB4119@uda0271908> (raw)

Hi Thinh,

On Fri, Aug 10, 2018 at 09:36:30PM +0000, Thinh Nguyen wrote:
> Hi Bin,
> 
> On 8/10/2018 12:05 PM, Bin Liu wrote:
> > Hi Felipe,
> >
> > I noticed a regression on g_audio (uac2) with dwc3 udc on v4.14:
> >
> > - nosound in playback
> > - playback can only play once, the following error happens from the 2nd
> >   playback
> >
> >   aplay: set_params:1361: Unable to install hw params:
> >
> > A manual bisect tells the two issues are seperate and the regression
> > happens in v4.11-rc2 with the following two patches.
> >
> > 40d829fb2ec63 ("usb: dwc3: gadget: Correct ISOC DATA PIDs for short packets")
> >
> > which cases the first no-sound issue.
> >
> > ep->mult is already 1 from g_audio, so mult-- leads to incorrect value.
> > The following change solves it.
> 
> I believe v4.14.40 is missing this patch regarding that issue:
> ec5bb87e4e2a ("usb: dwc3: gadget: Fix PCM1 for ISOC EP with ep->mult
> less than 3")
> 
> >
> > diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
> > index f92e2f2c7fbe..758cc258895c 100644
> > --- a/drivers/usb/dwc3/gadget.c
> > +++ b/drivers/usb/dwc3/gadget.c
> > @@ -930,10 +930,10 @@ static void __dwc3_prepare_one_trb(struct dwc3_ep *dep, struct dwc3_trb *trb,
> >                                 unsigned int mult = ep->mult - 1;
> >                                 unsigned int maxp = usb_endpoint_maxp(ep->desc);
> >  
> > -                               if (length <= (2 * maxp))
> > +                               if (mult && length <= (2 * maxp))
> >                                         mult--;
> >  
> > -                               if (length <= maxp)
> > +                               if (mult && length <= maxp)
> >                                         mult--;
> >  
> >                                 trb->size |= DWC3_TRB_SIZE_PCM1(mult);
> >
> > cf3113d893d4 ("usb: dwc3: gadget: properly increment dequeue pointer on ep_dequeue")
> >
> > which causes the multiple playback failure. The following hack covers it.
> >
> > diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
> > index f92e2f2c7fbe..758cc258895c 100644
> > --- a/drivers/usb/dwc3/gadget.c
> > +++ b/drivers/usb/dwc3/gadget.c
> > @@ -1411,7 +1411,7 @@ static int dwc3_gadget_ep_dequeue(struct usb_ep *ep,
> >                 if (r == req) {
> >                         /* wait until it is processed */
> >                         dwc3_stop_active_transfer(dwc, dep->number, true);
> > -
> > +#if 0
> >                         /*
> >                          * If request was already started, this means we had to
> >                          * stop the transfer. With that we also need to ignore
> > @@ -1473,6 +1473,7 @@ static int dwc3_gadget_ep_dequeue(struct usb_ep *ep,
> >                                         dwc3_ep_inc_deq(dep);
> >                                 }
> >                         }
> > +#endif
> >                         goto out1;
> >                 }
> >                 dev_err(dwc->dev, "request %pK was not queued to %s\n",
> >
> > With the two changes above, g_audio works fine with v4.14.40, but not with
> > v4.18-rc7, in which the console is flooded with following message.
> >
> > u_audio_iso_complete: iso_complete status(-18) 0/256
> >
> 
> Pierre Le Magourou attempted to fix the second issue with this patch
> (though the patch may need rework):
> https://patchwork.kernel.org/patch/10509639/
> 
> You can try it out. It works fine when I tested it on HAPS platform
> (using Felipe's next branch).

Thanks for the hints. With the two patches you pointed, g_audio works
fine on v4.14.40.

Regards,
-Bin.

             reply	other threads:[~2018-08-13 15:21 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-13 15:21 Bin Liu [this message]
  -- strict thread matches above, loose matches on Subject: below --
2018-08-10 21:36 g_audio regression on dwc3 udc Thinh Nguyen
2018-08-10 19:05 Bin Liu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180813152132.GB4119@uda0271908 \
    --to=b-liu@ti.com \
    --cc=Thinh.Nguyen@synopsys.com \
    --cc=balbi@kernel.org \
    --cc=linux-usb@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).