All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mark Brown <broonie@kernel.org>
To: jiada wang <jiada_wang@mentor.com>
Cc: Jiada Wang <jiada_wang@mentor.com>,
	Mark Brown <broonie@kernel.org>,
	lgirdwood@gmail.com, broonie@kernel.org, perex@perex.cz,
	tiwai@suse.com, jiada_wang@mentor.com,
	alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org,
	alsa-devel@alsa-project.org
Subject: Applied "ASoC: soc-pcm: check symmetry after hw_params" to the asoc tree
Date: Wed, 20 Sep 2017 04:41:47 -0700 (PDT)	[thread overview]
Message-ID: <20170920114147.D7A0D4400D3@finisterre.ee.mobilebroadband> (raw)
In-Reply-To: <20170920062530.12252-1-jiada_wang@mentor.com>

The patch

   ASoC: soc-pcm: check symmetry after hw_params

has been applied to the asoc tree at

   git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git 

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.  

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

>From 957ce0c6b8a1f26559864507ae0bfcba29d924ad Mon Sep 17 00:00:00 2001
From: jiada wang <jiada_wang@mentor.com>
Date: Wed, 20 Sep 2017 15:25:30 +0900
Subject: [PATCH] ASoC: soc-pcm: check symmetry after hw_params

hw_params may be fixup by be_hw_params_fixup, calling
soc_pcm_params_symmetry() before hw_params will have issue
if there is hw_params changes in be_hw_params_fixup.

For example, with following use case
1. a dai-link which is able to convert sample rate on BE side
2. set BE playback and capture sample rate to 44100Hz
3. play a 48000Hz audio stream with this dai-link
4. record from this dai-link with 44100Hz sample rate

Got following error message when record starts
[  495.013527]  be_link_ak4613: ASoC: unmatched rate symmetry: 48000 - 44100
[  495.021729]  be_link_ak4613: ASoC: hw_params BE failed -22
[  495.028589]  rsnd_link0: ASoC: hw_params BE failed -22

Because in soc_pcm_hw_params(), FE rate is still having value before
it is fixup by be_hw_params_fixup(), when soc_pcm_params_symmetry() checks
symmetry, thus soc_pcm_params_symmetry() complains about the unmatched rate
between the active stream and the new stream tries to start.

This patch moves soc_pcm_params_symmetry() after hw_params to resolve the
above issue.

Signed-off-by: Jiada Wang <jiada_wang@mentor.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 sound/soc/soc-pcm.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c
index 94b88b897c3b..f11421f08065 100644
--- a/sound/soc/soc-pcm.c
+++ b/sound/soc/soc-pcm.c
@@ -855,11 +855,6 @@ static int soc_pcm_hw_params(struct snd_pcm_substream *substream,
 	int i, ret = 0;
 
 	mutex_lock_nested(&rtd->pcm_mutex, rtd->pcm_subclass);
-
-	ret = soc_pcm_params_symmetry(substream, params);
-	if (ret)
-		goto out;
-
 	if (rtd->dai_link->ops && rtd->dai_link->ops->hw_params) {
 		ret = rtd->dai_link->ops->hw_params(substream, params);
 		if (ret < 0) {
@@ -930,6 +925,10 @@ static int soc_pcm_hw_params(struct snd_pcm_substream *substream,
 	cpu_dai->sample_bits =
 		snd_pcm_format_physical_width(params_format(params));
 
+
+	ret = soc_pcm_params_symmetry(substream, params);
+        if (ret)
+                goto platform_err;
 out:
 	mutex_unlock(&rtd->pcm_mutex);
 	return ret;
-- 
2.13.2

WARNING: multiple messages have this Message-ID (diff)
From: Mark Brown <broonie@kernel.org>
Cc: alsa-devel@alsa-project.org, jiada_wang@mentor.com,
	linux-kernel@vger.kernel.org, tiwai@suse.com,
	lgirdwood@gmail.com, broonie@kernel.org
Subject: Applied "ASoC: soc-pcm: check symmetry after hw_params" to the asoc tree
Date: Wed, 20 Sep 2017 04:41:47 -0700 (PDT)	[thread overview]
Message-ID: <20170920114147.D7A0D4400D3@finisterre.ee.mobilebroadband> (raw)
In-Reply-To: <20170920062530.12252-1-jiada_wang@mentor.com>

The patch

   ASoC: soc-pcm: check symmetry after hw_params

has been applied to the asoc tree at

   git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git 

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.  

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

>From 957ce0c6b8a1f26559864507ae0bfcba29d924ad Mon Sep 17 00:00:00 2001
From: jiada wang <jiada_wang@mentor.com>
Date: Wed, 20 Sep 2017 15:25:30 +0900
Subject: [PATCH] ASoC: soc-pcm: check symmetry after hw_params

hw_params may be fixup by be_hw_params_fixup, calling
soc_pcm_params_symmetry() before hw_params will have issue
if there is hw_params changes in be_hw_params_fixup.

For example, with following use case
1. a dai-link which is able to convert sample rate on BE side
2. set BE playback and capture sample rate to 44100Hz
3. play a 48000Hz audio stream with this dai-link
4. record from this dai-link with 44100Hz sample rate

Got following error message when record starts
[  495.013527]  be_link_ak4613: ASoC: unmatched rate symmetry: 48000 - 44100
[  495.021729]  be_link_ak4613: ASoC: hw_params BE failed -22
[  495.028589]  rsnd_link0: ASoC: hw_params BE failed -22

Because in soc_pcm_hw_params(), FE rate is still having value before
it is fixup by be_hw_params_fixup(), when soc_pcm_params_symmetry() checks
symmetry, thus soc_pcm_params_symmetry() complains about the unmatched rate
between the active stream and the new stream tries to start.

This patch moves soc_pcm_params_symmetry() after hw_params to resolve the
above issue.

Signed-off-by: Jiada Wang <jiada_wang@mentor.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 sound/soc/soc-pcm.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c
index 94b88b897c3b..f11421f08065 100644
--- a/sound/soc/soc-pcm.c
+++ b/sound/soc/soc-pcm.c
@@ -855,11 +855,6 @@ static int soc_pcm_hw_params(struct snd_pcm_substream *substream,
 	int i, ret = 0;
 
 	mutex_lock_nested(&rtd->pcm_mutex, rtd->pcm_subclass);
-
-	ret = soc_pcm_params_symmetry(substream, params);
-	if (ret)
-		goto out;
-
 	if (rtd->dai_link->ops && rtd->dai_link->ops->hw_params) {
 		ret = rtd->dai_link->ops->hw_params(substream, params);
 		if (ret < 0) {
@@ -930,6 +925,10 @@ static int soc_pcm_hw_params(struct snd_pcm_substream *substream,
 	cpu_dai->sample_bits =
 		snd_pcm_format_physical_width(params_format(params));
 
+
+	ret = soc_pcm_params_symmetry(substream, params);
+        if (ret)
+                goto platform_err;
 out:
 	mutex_unlock(&rtd->pcm_mutex);
 	return ret;
-- 
2.13.2

  parent reply	other threads:[~2017-09-20 11:42 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-20  6:25 [PATCH 1/1] soc-pcm: check symmetry after hw_params Jiada Wang
2017-09-20  6:25 ` Jiada Wang
2017-09-20 11:41 ` Mark Brown
2017-09-20 11:41   ` Mark Brown
2017-09-20 11:41 ` Mark Brown [this message]
2017-09-20 11:41   ` Applied "ASoC: soc-pcm: check symmetry after hw_params" to the asoc tree Mark Brown

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=20170920114147.D7A0D4400D3@finisterre.ee.mobilebroadband \
    --to=broonie@kernel.org \
    --cc=alsa-devel@alsa-project.org \
    --cc=jiada_wang@mentor.com \
    --cc=lgirdwood@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=perex@perex.cz \
    --cc=tiwai@suse.com \
    /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: link
Be 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.