From patchwork Wed Aug 24 07:57:20 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aisheng Dong X-Patchwork-Id: 1091402 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 p7O7ino2003166 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Wed, 24 Aug 2011 07:45:10 GMT Received: from canuck.infradead.org ([2001:4978:20e::1]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1Qw88R-0002z9-9B; Wed, 24 Aug 2011 07:44:27 +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 1Qw88Q-00058N-Ry; Wed, 24 Aug 2011 07:44:26 +0000 Received: from va3ehsobe005.messaging.microsoft.com ([216.32.180.31] helo=VA3EHSOBE005.bigfish.com) by canuck.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1Qw88N-000585-Q9 for linux-arm-kernel@lists.infradead.org; Wed, 24 Aug 2011 07:44:24 +0000 Received: from mail163-va3-R.bigfish.com (10.7.14.244) by VA3EHSOBE005.bigfish.com (10.7.40.25) with Microsoft SMTP Server id 14.1.225.22; Wed, 24 Aug 2011 07:44:22 +0000 Received: from mail163-va3 (localhost.localdomain [127.0.0.1]) by mail163-va3-R.bigfish.com (Postfix) with ESMTP id 9EDE940010E; Wed, 24 Aug 2011 07:44:21 +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 mail163-va3 (localhost.localdomain [127.0.0.1]) by mail163-va3 (MessageSwitch) id 1314171861437634_5253; Wed, 24 Aug 2011 07:44:21 +0000 (UTC) Received: from VA3EHSMHS003.bigfish.com (unknown [10.7.14.245]) by mail163-va3.bigfish.com (Postfix) with ESMTP id 18418BA004C; Wed, 24 Aug 2011 07:44:21 +0000 (UTC) Received: from mail.freescale.net (70.37.183.190) by VA3EHSMHS003.bigfish.com (10.7.99.13) with Microsoft SMTP Server (TLS) id 14.1.225.22; Wed, 24 Aug 2011 07:44:12 +0000 Received: from az33smr01.freescale.net (10.64.34.199) by 039-SN1MMR1-003.039d.mgd.msft.net (10.84.1.16) with Microsoft SMTP Server id 14.1.323.2; Wed, 24 Aug 2011 02:44:11 -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 p7O7i8kA018437; Wed, 24 Aug 2011 02:44:08 -0500 (CDT) From: Dong Aisheng To: Subject: [PATCH 1/1] ASoC: soc-core: check rate for symmetry only when pcm is ongoing Date: Wed, 24 Aug 2011 15:57:20 +0800 Message-ID: <1314172640-26972-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_034423_932359_9DBCE883 X-CRM114-Status: GOOD ( 17.70 ) 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 [216.32.180.31 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 07:45:10 +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 ongoing which seems more sensible. Signed-off-by: Dong Aisheng Cc: Mark Brown Cc: Liam Girdwood Cc: Sascha Hauer --- 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..8e9931c 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 ongoing; long pmdown_time; /* runtime devices */ diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c index 1aee9fc..f3c1a66 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->ongoing) + 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->ongoing = 1; mutex_unlock(&rtd->pcm_mutex); return 0; @@ -322,6 +326,7 @@ static int soc_pcm_close(struct snd_pcm_substream *substream) SND_SOC_DAPM_STREAM_STOP); } + rtd->ongoing = 0; mutex_unlock(&rtd->pcm_mutex); return 0; }