From patchwork Wed Aug 24 11:02:08 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aisheng Dong X-Patchwork-Id: 1091972 Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by demeter2.kernel.org (8.14.4/8.14.4) with ESMTP id p7OAnQF1019446 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Wed, 24 Aug 2011 10:49:47 GMT Received: from canuck.infradead.org ([2001:4978:20e::1]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1QwB1I-00062q-If; Wed, 24 Aug 2011 10:49:16 +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 1QwB1I-0001LM-3q; Wed, 24 Aug 2011 10:49:16 +0000 Received: from am1ehsobe003.messaging.microsoft.com ([213.199.154.206] helo=AM1EHSOBE003.bigfish.com) by canuck.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1QwB1E-0001L3-6N for linux-arm-kernel@lists.infradead.org; Wed, 24 Aug 2011 10:49:13 +0000 Received: from mail97-am1-R.bigfish.com (10.3.201.247) by AM1EHSOBE003.bigfish.com (10.3.204.23) with Microsoft SMTP Server id 14.1.225.22; Wed, 24 Aug 2011 10:49:10 +0000 Received: from mail97-am1 (localhost.localdomain [127.0.0.1]) by mail97-am1-R.bigfish.com (Postfix) with ESMTP id 20EC6CB81D1; Wed, 24 Aug 2011 10:49:10 +0000 (UTC) X-SpamScore: 3 X-BigFish: VS3(zzzz1202h1082kzz8275bhz2dh2a8h668h839h62h) X-Spam-TCS-SCL: 1: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 mail97-am1 (localhost.localdomain [127.0.0.1]) by mail97-am1 (MessageSwitch) id 1314182949967499_25540; Wed, 24 Aug 2011 10:49:09 +0000 (UTC) Received: from AM1EHSMHS012.bigfish.com (unknown [10.3.201.247]) by mail97-am1.bigfish.com (Postfix) with ESMTP id E80CB1A68054; Wed, 24 Aug 2011 10:49:09 +0000 (UTC) Received: from mail.freescale.net (70.37.183.190) by AM1EHSMHS012.bigfish.com (10.3.207.112) with Microsoft SMTP Server (TLS) id 14.1.225.22; Wed, 24 Aug 2011 10:49:05 +0000 Received: from az33smr01.freescale.net (10.64.34.199) by 039-SN1MMR1-001.039d.mgd.msft.net (10.84.1.13) with Microsoft SMTP Server id 14.1.323.2; Wed, 24 Aug 2011 05:48:56 -0500 Received: from localhost.localdomain (shlinux2.ap.freescale.net [10.192.224.44]) by az33smr01.freescale.net (8.13.1/8.13.0) with ESMTP id p7OAmrBw024265; Wed, 24 Aug 2011 05:48:54 -0500 (CDT) From: Dong Aisheng To: Subject: [PATCH v2 1/1] ASoC: soc-core: check rate for symmetry only when pcm is active Date: Wed, 24 Aug 2011 19:02:08 +0800 Message-ID: <1314183728-23627-1-git-send-email-b29396@freescale.com> X-Mailer: git-send-email 1.7.0.4 MIME-Version: 1.0 X-OriginatorOrg: freescale.com X-CRM114-Version: 20090807-BlameThorstenAndJenny ( TRE 0.7.6 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20110824_064912_465334_E70EB128 X-CRM114-Status: GOOD ( 17.48 ) 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.206 listed in list.dnswl.org] Cc: s.hauer@pengutronix.de, broonie@opensource.wolfsonmicro.com, lrg@ti.com, linux-arm-kernel@lists.infradead.org, w.sang@pengutronix.de 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 (demeter2.kernel.org [140.211.167.43]); Wed, 24 Aug 2011 10:49:47 +0000 (UTC) For the playback and record using different dai links, checking !rtd->rate for symmetry may not be accurate because that pcm may be acutually not running and the default new open rate is 0, then the warning message "Not enforcing symmetric_rates" will happen each time with running arecord | aplay. Now we only check rate for symmetry when the pcm is really active which seems more sensible. Signed-off-by: Dong Aisheng Cc: Mark Brown Cc: Liam Girdwood Cc: Sascha Hauer Acked-by: Liam Girdwood --- include/sound/soc.h | 1 + sound/soc/soc-pcm.c | 5 +++++ 2 files changed, 6 insertions(+), 0 deletions(-) diff --git a/include/sound/soc.h b/include/sound/soc.h index 3fe658e..17970fd 100644 --- a/include/sound/soc.h +++ b/include/sound/soc.h @@ -851,6 +851,7 @@ struct snd_soc_pcm_runtime { /* Symmetry data - only valid if symmetry is being enforced */ unsigned int rate; + unsigned int active; long pmdown_time; /* runtime devices */ diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c index 1aee9fc..72a7b34 100644 --- a/sound/soc/soc-pcm.c +++ b/sound/soc/soc-pcm.c @@ -39,6 +39,9 @@ static int soc_pcm_apply_symmetry(struct snd_pcm_substream *substream) !rtd->dai_link->symmetric_rates) return 0; + if (!rtd->active) + return 0; + /* This can happen if multiple streams are starting simultaneously - * the second can need to get its constraints before the first has * picked a rate. Complain and allow the application to carry on. @@ -209,6 +212,7 @@ static int soc_pcm_open(struct snd_pcm_substream *substream) cpu_dai->active++; codec_dai->active++; rtd->codec->active++; + rtd->active++; mutex_unlock(&rtd->pcm_mutex); return 0; @@ -287,6 +291,7 @@ static int soc_pcm_close(struct snd_pcm_substream *substream) cpu_dai->active--; codec_dai->active--; codec->active--; + rtd->active--; if (!cpu_dai->active && !codec_dai->active) rtd->rate = 0;