From patchwork Thu Jul 14 04:34:29 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aisheng Dong X-Patchwork-Id: 974302 Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by demeter1.kernel.org (8.14.4/8.14.4) with ESMTP id p6E4Z0WJ019305 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Thu, 14 Jul 2011 04:35:21 GMT Received: from canuck.infradead.org ([2001:4978:20e::1]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1QhDdN-0001Kg-Jc; Thu, 14 Jul 2011 04:34:45 +0000 Received: from localhost ([127.0.0.1] helo=canuck.infradead.org) by canuck.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1QhDdN-0002lR-7I; Thu, 14 Jul 2011 04:34:45 +0000 Received: from am1ehsobe004.messaging.microsoft.com ([213.199.154.207] helo=AM1EHSOBE004.bigfish.com) by canuck.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1QhDdG-0002l7-C5 for linux-arm-kernel@lists.infradead.org; Thu, 14 Jul 2011 04:34:43 +0000 Received: from mail87-am1-R.bigfish.com (10.3.201.245) by AM1EHSOBE004.bigfish.com (10.3.204.24) with Microsoft SMTP Server id 14.1.225.22; Thu, 14 Jul 2011 04:34:33 +0000 Received: from mail87-am1 (localhost.localdomain [127.0.0.1]) by mail87-am1-R.bigfish.com (Postfix) with ESMTP id 64AC916182A1; Thu, 14 Jul 2011 04:34:34 +0000 (UTC) X-SpamScore: -16 X-BigFish: VS-16(zz9371M542M1432Nzz1202hzzz2dh2a8h668h839h8e2h8e3h944h61h) X-Spam-TCS-SCL: 0:0 X-Forefront-Antispam-Report: CIP:70.37.183.190; KIP:(null); UIP:(null); IPVD:NLI; H:mail.freescale.net; RD:none; EFVD:NLI Received: from mail87-am1 (localhost.localdomain [127.0.0.1]) by mail87-am1 (MessageSwitch) id 1310618074227261_6250; Thu, 14 Jul 2011 04:34:34 +0000 (UTC) Received: from AM1EHSMHS019.bigfish.com (unknown [10.3.201.244]) by mail87-am1.bigfish.com (Postfix) with ESMTP id 32BD727004B; Thu, 14 Jul 2011 04:34:34 +0000 (UTC) Received: from mail.freescale.net (70.37.183.190) by AM1EHSMHS019.bigfish.com (10.3.206.22) with Microsoft SMTP Server (TLS) id 14.1.225.22; Thu, 14 Jul 2011 04:34:33 +0000 Received: from 039-SN1MPN1-002.039d.mgd.msft.net ([169.254.2.218]) by 039-SN1MMR1-002.039d.mgd.msft.net ([10.84.1.15]) with mapi id 14.01.0289.008; Wed, 13 Jul 2011 23:34:30 -0500 From: Dong Aisheng-B29396 To: Mark Brown Subject: RE: [alsa-devel] [PATCH V2 02/10] ASoc: mxs: add mxs-saif driver Thread-Topic: [alsa-devel] [PATCH V2 02/10] ASoc: mxs: add mxs-saif driver Thread-Index: AQHMQKIqckdFyilx40KYs41wLS/G35Tpw/wAgAATfvCAAaEngP//ruNg Date: Thu, 14 Jul 2011 04:34:29 +0000 Message-ID: <65EE16ACC360FA4D99C96DC085B3F7721CE4BB@039-SN1MPN1-002.039d.mgd.msft.net> References: <1310483085-31442-1-git-send-email-b29396@freescale.com> <1310483085-31442-3-git-send-email-b29396@freescale.com> <20110713010346.GA18959@opensource.wolfsonmicro.com> <65EE16ACC360FA4D99C96DC085B3F7721CD902@039-SN1MPN1-002.039d.mgd.msft.net> <20110714030633.GA11559@opensource.wolfsonmicro.com> In-Reply-To: <20110714030633.GA11559@opensource.wolfsonmicro.com> Accept-Language: zh-CN, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.192.242.89] MIME-Version: 1.0 X-OriginatorOrg: freescale.com X-CRM114-Version: 20090807-BlameThorstenAndJenny ( TRE 0.7.6 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20110714_003438_660703_1D587F45 X-CRM114-Status: GOOD ( 25.06 ) X-Spam-Score: -0.7 (/) X-Spam-Report: SpamAssassin version 3.3.1 on canuck.infradead.org summary: Content analysis details: (-0.7 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [213.199.154.207 listed in list.dnswl.org] Cc: "alsa-devel@alsa-project.org" , "u.kleine-koenig@pengutronix.de" , "s.hauer@pengutronix.de" , "linux-arm-kernel@lists.infradead.org" , "lrg@ti.com" X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Thu, 14 Jul 2011 04:35:21 +0000 (UTC) > -----Original Message----- > From: Mark Brown [mailto:broonie@opensource.wolfsonmicro.com] > Sent: Thursday, July 14, 2011 11:07 AM > To: Dong Aisheng-B29396 > Cc: alsa-devel@alsa-project.org; s.hauer@pengutronix.de; lrg@ti.com; > linux-arm-kernel@lists.infradead.org; u.kleine-koenig@pengutronix.de > Subject: Re: [alsa-devel] [PATCH V2 02/10] ASoc: mxs: add mxs-saif driver > > > We will just return an error if MCLK is not correct (not 32x or 48x). > > /* SAIF MCLK should be either 32*fs or 48*fs */ > > if (saif->mclk_in_use && (mclk % 32 != 0) && (mclk % 48 != 0)) > > return -EINVAL; > > Machine driver should guarantee to set a correct value since it's HW > limitation. > > Is that ok? > > Please fix the code so you only check if the ratio is valid in one place, > the code currently is too hard to read. Sorry, here the comment is wrong: /* SAIF MCLK should be either 32*fs or 48*fs */ if (saif->mclk_in_use && (mclk % 32 != 0) && (mclk % 48 != 0)) return -EINVAL; should be changed to: /* SAIF MCLK should be either 32x or 48x */ BTW, do you mean the duplicate ratio checking is the following line? /* select the multiple of the base frequency rate of MCLK */ switch (mclk / rate) { ..... This is used to calculate the real ratio for mclk. (The range is from 32x to 512x) Yes, the code is a little confuse. Since the mxs_saif_set_clk sets both saif clk ratio and saif mclk ratio, I placed the mclk ratio checking in mxs_saif_set_clk rather than in mxs_saif_get_mclk to avoid duplication. And saif clk ratio needs to meet mclk ratio. Maybe I need to add more comments in code as follows. /* * The SAIF clock should be either 384*fs or 512*fs * * For 32x mclk, set saif clk as 512x. * For 48x mclk, set saif clk as 384x. */ Do you have any suggestion to make it more easy to read? > > So it seems, as you said, we may need to set symmetric_rates in the DAI. > > Not if there are two separate SAIFs used for each direction - this is > only relevant if one interface provides both playback and capture. OK. But how to treat our case that although there are two separate SAIFs used for each direction, they cannot work on different sample rate? Is there any parameter like symmetric_rates to tell ASoc core that do not play a different rate stream While another SAIF is already working? > > Because you return IRQ_HANDLED you're telling the IRQ infrastructure that > you handled the interrupt but you didn't. If you didn't handle an > interrupt you should return IRQ_NONE instead. Ok, understand. Thanks. How about adding handle IRQ_NONE as follows: Regards Dong Aisheng diff --git a/sound/soc/mxs/mxs-saif.c b/sound/soc/mxs/mxs-saif.c index bb32ee9..fefab24 100644 --- a/sound/soc/mxs/mxs-saif.c +++ b/sound/soc/mxs/mxs-saif.c @@ -475,6 +475,10 @@ static irqreturn_t mxs_saif_irq(int irq, void *dev_id) unsigned int stat; stat = __raw_readl(saif->base + SAIF_STAT); + if (stat & (BM_SAIF_STAT_FIFO_UNDERFLOW_IRQ | + BM_SAIF_STAT_FIFO_UNDERFLOW_IRQ)) + return IRQ_NONE; + if (stat & BM_SAIF_STAT_FIFO_UNDERFLOW_IRQ) dev_dbg(saif->dev, "underrun!!! %d\n", ++saif->fifo_underrun);