From patchwork Fri Aug 10 19:05:45 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bin Liu X-Patchwork-Id: 10563089 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1A7E813B4 for ; Fri, 10 Aug 2018 19:05:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 06BE62BC60 for ; Fri, 10 Aug 2018 19:05:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id ECD742BC85; Fri, 10 Aug 2018 19:05:49 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 815272BC60 for ; Fri, 10 Aug 2018 19:05:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726923AbeHJVgz (ORCPT ); Fri, 10 Aug 2018 17:36:55 -0400 Received: from lelv0142.ext.ti.com ([198.47.23.249]:52706 "EHLO lelv0142.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726162AbeHJVgz (ORCPT ); Fri, 10 Aug 2018 17:36:55 -0400 Received: from dflxv15.itg.ti.com ([128.247.5.124]) by lelv0142.ext.ti.com (8.15.2/8.15.2) with ESMTP id w7AJ5kML002925; Fri, 10 Aug 2018 14:05:46 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1533927946; bh=enRcCJaPT6FOlXabArUBTm5G7tirzQBHCt2TnqTJe+Y=; h=Date:From:To:Subject; b=XOmcF4EUTa+fLkTKuc3FKUVCh5xaTLQUX2SMD4eWy5NU4aOyYwEAF7MeNzQ32CI1g SouLJbgOSqs0tp9dt5ncdH+ni7E0+S4B/Xvi7DJX7wgBj09GAbfFgllgng3kBswDJA H2VDMjt4hnVCDQeoWIUCe4UKBMyT+GdJiHv4Wcj0= Received: from DLEE106.ent.ti.com (dlee106.ent.ti.com [157.170.170.36]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id w7AJ5k0g010676; Fri, 10 Aug 2018 14:05:46 -0500 Received: from DLEE112.ent.ti.com (157.170.170.23) by DLEE106.ent.ti.com (157.170.170.36) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1466.3; Fri, 10 Aug 2018 14:05:45 -0500 Received: from dlep32.itg.ti.com (157.170.170.100) by DLEE112.ent.ti.com (157.170.170.23) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.1466.3 via Frontend Transport; Fri, 10 Aug 2018 14:05:45 -0500 Received: from localhost (ileax41-snat.itg.ti.com [10.172.224.153]) by dlep32.itg.ti.com (8.14.3/8.13.8) with ESMTP id w7AJ5j1S001320; Fri, 10 Aug 2018 14:05:45 -0500 Date: Fri, 10 Aug 2018 14:05:45 -0500 From: Bin Liu To: Felipe Balbi , Subject: g_audio regression on dwc3 udc Message-ID: <20180810190545.GA4119@uda0271908> Mail-Followup-To: Bin Liu , Felipe Balbi , linux-usb@vger.kernel.org MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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. 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 Regards, -Bin. 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",