diff options
author | jiada wang <jiada_wang@mentor.com> | 2017-09-20 02:25:30 -0400 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2017-09-20 07:40:41 -0400 |
commit | 957ce0c6b8a1f26559864507ae0bfcba29d924ad (patch) | |
tree | c82c88b8263a6dc31745b44dce277e0095b62ecb | |
parent | 2bd6bf03f4c1c59381d62c61d03f6cc3fe71f66e (diff) |
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>
-rw-r--r-- | sound/soc/soc-pcm.c | 9 |
1 files 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, | |||
855 | int i, ret = 0; | 855 | int i, ret = 0; |
856 | 856 | ||
857 | mutex_lock_nested(&rtd->pcm_mutex, rtd->pcm_subclass); | 857 | mutex_lock_nested(&rtd->pcm_mutex, rtd->pcm_subclass); |
858 | |||
859 | ret = soc_pcm_params_symmetry(substream, params); | ||
860 | if (ret) | ||
861 | goto out; | ||
862 | |||
863 | if (rtd->dai_link->ops && rtd->dai_link->ops->hw_params) { | 858 | if (rtd->dai_link->ops && rtd->dai_link->ops->hw_params) { |
864 | ret = rtd->dai_link->ops->hw_params(substream, params); | 859 | ret = rtd->dai_link->ops->hw_params(substream, params); |
865 | if (ret < 0) { | 860 | if (ret < 0) { |
@@ -930,6 +925,10 @@ static int soc_pcm_hw_params(struct snd_pcm_substream *substream, | |||
930 | cpu_dai->sample_bits = | 925 | cpu_dai->sample_bits = |
931 | snd_pcm_format_physical_width(params_format(params)); | 926 | snd_pcm_format_physical_width(params_format(params)); |
932 | 927 | ||
928 | |||
929 | ret = soc_pcm_params_symmetry(substream, params); | ||
930 | if (ret) | ||
931 | goto platform_err; | ||
933 | out: | 932 | out: |
934 | mutex_unlock(&rtd->pcm_mutex); | 933 | mutex_unlock(&rtd->pcm_mutex); |
935 | return ret; | 934 | return ret; |