ASoC: soc-pcm: check symmetry after hw_params
authorjiada wang <jiada_wang@mentor.com>
Wed, 20 Sep 2017 06:25:30 +0000 (15:25 +0900)
committerMark Brown <broonie@kernel.org>
Wed, 20 Sep 2017 11:40:41 +0000 (12:40 +0100)
commit957ce0c6b8a1f26559864507ae0bfcba29d924ad
treec82c88b8263a6dc31745b44dce277e0095b62ecb
parent2bd6bf03f4c1c59381d62c61d03f6cc3fe71f66e
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