From: Dong Aisheng <b29396@freescale.com> To: alsa-devel@alsa-project.org Cc: s.hauer@pengutronix.de, broonie@opensource.wolfsonmicro.com, lrg@ti.com, linux-arm-kernel@lists.infradead.org, w.sang@pengutronix.de 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 [thread overview] Message-ID: <1314183728-23627-1-git-send-email-b29396@freescale.com> (raw) 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 <b29396@freescale.com> Cc: Mark Brown <broonie@opensource.wolfsonmicro.com> Cc: Liam Girdwood <lrg@ti.com> Cc: Sascha Hauer <s.hauer@pengutronix.de> --- 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; -- 1.7.0.4
WARNING: multiple messages have this Message-ID (diff)
From: b29396@freescale.com (Dong Aisheng) To: linux-arm-kernel@lists.infradead.org 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 [thread overview] Message-ID: <1314183728-23627-1-git-send-email-b29396@freescale.com> (raw) 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 <b29396@freescale.com> Cc: Mark Brown <broonie@opensource.wolfsonmicro.com> Cc: Liam Girdwood <lrg@ti.com> Cc: Sascha Hauer <s.hauer@pengutronix.de> --- 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; -- 1.7.0.4
next reply other threads:[~2011-08-24 11:02 UTC|newest] Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top 2011-08-24 11:02 Dong Aisheng [this message] 2011-08-24 11:02 ` [PATCH v2 1/1] ASoC: soc-core: check rate for symmetry only when pcm is active Dong Aisheng 2011-08-24 16:03 ` Liam Girdwood 2011-08-24 16:03 ` Liam Girdwood 2011-08-24 17:05 ` Lars-Peter Clausen 2011-08-24 17:05 ` [alsa-devel] " Lars-Peter Clausen 2011-08-24 17:27 ` Mark Brown 2011-08-24 17:27 ` Mark Brown 2011-08-24 18:54 ` Lars-Peter Clausen 2011-08-24 18:54 ` [alsa-devel] " Lars-Peter Clausen 2011-08-24 19:19 ` Mark Brown 2011-08-24 19:19 ` [alsa-devel] " Mark Brown 2011-08-26 9:16 ` Dong Aisheng-B29396 2011-08-26 9:16 ` [alsa-devel] " Dong Aisheng-B29396
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=1314183728-23627-1-git-send-email-b29396@freescale.com \ --to=b29396@freescale.com \ --cc=alsa-devel@alsa-project.org \ --cc=broonie@opensource.wolfsonmicro.com \ --cc=linux-arm-kernel@lists.infradead.org \ --cc=lrg@ti.com \ --cc=s.hauer@pengutronix.de \ --cc=w.sang@pengutronix.de \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.