From patchwork Wed Jul 23 11:23:40 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolin Chen X-Patchwork-Id: 4610121 Return-Path: X-Original-To: patchwork-alsa-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 99D66C0514 for ; Wed, 23 Jul 2014 11:23:29 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id D1D47201C7 for ; Wed, 23 Jul 2014 11:23:28 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id 8F12620120 for ; Wed, 23 Jul 2014 11:23:27 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 9299426579B; Wed, 23 Jul 2014 13:23:23 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, FREEMAIL_FROM,UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Received: from alsa0.perex.cz (localhost [IPv6:::1]) by alsa0.perex.cz (Postfix) with ESMTP id 14CF926572D; Wed, 23 Jul 2014 13:21:52 +0200 (CEST) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id 66CA626573C; Wed, 23 Jul 2014 13:21:50 +0200 (CEST) Received: from na01-by2-obe.outbound.protection.outlook.com (mail-by2lp0235.outbound.protection.outlook.com [207.46.163.235]) by alsa0.perex.cz (Postfix) with ESMTP id 8D25926549B for ; Wed, 23 Jul 2014 13:21:29 +0200 (CEST) Received: from DM2PR03CA006.namprd03.prod.outlook.com (10.141.52.154) by BLUPR03MB358.namprd03.prod.outlook.com (10.141.75.152) with Microsoft SMTP Server (TLS) id 15.0.990.7; Wed, 23 Jul 2014 11:21:27 +0000 Received: from BL2FFO11FD022.protection.gbl (2a01:111:f400:7c09::169) by DM2PR03CA006.outlook.office365.com (2a01:111:e400:2414::26) with Microsoft SMTP Server (TLS) id 15.0.990.7 via Frontend Transport; Wed, 23 Jul 2014 11:21:26 +0000 Received: from az84smr01.freescale.net (192.88.158.2) by BL2FFO11FD022.mail.protection.outlook.com (10.173.161.101) with Microsoft SMTP Server (TLS) id 15.0.980.11 via Frontend Transport; Wed, 23 Jul 2014 11:21:25 +0000 Received: from rio.ap.freescale.net (rio.ap.freescale.net [10.192.242.9]) by az84smr01.freescale.net (8.14.3/8.14.0) with ESMTP id s6NBLCKX015646; Wed, 23 Jul 2014 04:21:22 -0700 From: Nicolin Chen To: Date: Wed, 23 Jul 2014 19:23:40 +0800 Message-ID: X-Mailer: git-send-email 1.8.4 In-Reply-To: References: X-EOPAttributedMessage: 0 X-Matching-Connectors: 130505880860621954; (91ab9b29-cfa4-454e-5278-08d120cd25b8); () X-Forefront-Antispam-Report: CIP:192.88.158.2; CTRY:US; IPV:CAL; IPV:NLI; EFV:NLI; SFV:NSPM; SFS:(6009001)(199002)(189002)(50986999)(21056001)(76176999)(81156004)(83072002)(31966008)(68736004)(88136002)(87286001)(104016003)(77156001)(87936001)(19580405001)(93916002)(62966002)(19580395003)(84676001)(82202001)(85306003)(4396001)(50226001)(86362001)(69596002)(85852003)(44976005)(87572001)(73972005)(6806004)(33646002)(74502001)(81342001)(99396002)(95666004)(77982001)(74662001)(61266001)(20776003)(80022001)(105596002)(107046002)(97736001)(50466002)(81442001)(81542001)(102836001)(79102001)(229853001)(104166001)(46102001)(106466001)(92726001)(55446002)(89996001)(48376002)(47776003)(64706001)(2351001)(26826002)(36756003)(92566001)(73392001)(110136001); DIR:OUT; SFP:; SCL:1; SRVR:BLUPR03MB358; H:az84smr01.freescale.net; FPR:; MLV:ovrnspm; PTR:InfoDomainNonexistent; MX:1; LANG:en; MIME-Version: 1.0 X-Microsoft-Antispam: BCL:0;PCL:0;RULEID: X-Forefront-PRVS: 028166BF91 Received-SPF: SoftFail (: domain of transitioning gmail.com discourages use of 192.88.158.2 as permitted sender) Authentication-Results: spf=softfail (sender IP is 192.88.158.2) smtp.mailfrom=nicoleotsuka@gmail.com; Cc: alsa-devel@alsa-project.org, b42378@freescale.com, b02247@freescale.com, linux-kernel@vger.kernel.org, timur@tabi.org, Li.Xiubo@freescale.com, linuxppc-dev@lists.ozlabs.org Subject: [alsa-devel] [PATCH 3/3] ASoC: fsl_sai: Improve enable flow in fsl_sai_trigger() X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP From: Nicolin Chen The previous enable flow: 1, Enable TE&RE (SAI starts to consume tx FIFO and feed rx FIFO) 2, Mask IRQ of Tx/Rx to enable its interrupt. 3, Enable DMA request of Tx/Rx. As this flow would enable DMA request later than TERE, the Tx FIFO would be easily emptied into underrun while Rx FIFO would be easily stuffed into overrun due to the delayed DMA transfering. This issue happened merely occational before the patch 'ASoC: fsl_sai: Reset FIFOs after disabling TE/RE' because there were useless data remaining in the FIFO for the gap. However, it manifested after FIFO reset's implemented. After this patch, the new flow: 1, Enable DMA request of Tx/Rx. 2, Enable TE&RE (SAI starts to consume tx FIFO and feed rx FIFO) 3, Mask IRQ of Tx/Rx to enable its interrupt. Signed-off-by: Nicolin Chen --- sound/soc/fsl/fsl_sai.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sound/soc/fsl/fsl_sai.c b/sound/soc/fsl/fsl_sai.c index a79a9b0..364410b 100644 --- a/sound/soc/fsl/fsl_sai.c +++ b/sound/soc/fsl/fsl_sai.c @@ -346,6 +346,9 @@ static int fsl_sai_trigger(struct snd_pcm_substream *substream, int cmd, case SNDRV_PCM_TRIGGER_START: case SNDRV_PCM_TRIGGER_RESUME: case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: + regmap_update_bits(sai->regmap, FSL_SAI_xCSR(tx), + FSL_SAI_CSR_FRDE, FSL_SAI_CSR_FRDE); + regmap_update_bits(sai->regmap, FSL_SAI_RCSR, FSL_SAI_CSR_TERE, FSL_SAI_CSR_TERE); regmap_update_bits(sai->regmap, FSL_SAI_TCSR, @@ -353,8 +356,6 @@ static int fsl_sai_trigger(struct snd_pcm_substream *substream, int cmd, regmap_update_bits(sai->regmap, FSL_SAI_xCSR(tx), FSL_SAI_CSR_xIE_MASK, FSL_SAI_FLAGS); - regmap_update_bits(sai->regmap, FSL_SAI_xCSR(tx), - FSL_SAI_CSR_FRDE, FSL_SAI_CSR_FRDE); break; case SNDRV_PCM_TRIGGER_STOP: case SNDRV_PCM_TRIGGER_SUSPEND: