summaryrefslogtreecommitdiff
path: root/sound
diff options
context:
space:
mode:
authorNicolin Chen <b42378@freescale.com>2013-11-20 18:37:09 +0800
committerNicolin Chen <Guangyu.Chen@freescale.com>2014-01-16 19:27:47 +0800
commitd8c49cbc0b7f56c73f5b3923f07ec1c23ed62b0a (patch)
tree29f83ad7825d213744f8cb46070dca405d1c3e64 /sound
parent7912f03c2b2a0c43eae9b758fa768796fa9095d3 (diff)
ASoC: soc-pcm: move DAIs parameters cleaning into hw_free()
We're now applying soc_hw_params_symmetry() to reject unmatched parameters while we clear parameters in soc_pcm_close(). So here's a use case might be broken by this mechanism: aplay -Dhw:0 44100.wav 48000.wav 32000.wav In this case, we call soc_pcm_open()->soc_pcm_hw_params()->soc_pcm_hw_free() ->soc_pcm_hw_params()->soc_pcm_hw_free()->soc_pcm_close() in order. As we only clear parameters in soc_pcm_close(). The parameters would be remained in the system even if the playback of 44100.wav is finished. Thus, this patch is trying to move parameters cleaning into hw_free() so that the system can continue to serve this kind of use case. Also, since we set them in hw_params(), it should be better to clear them in hw_free() for symmetry. Signed-off-by: Nicolin Chen <b42378@freescale.com> Signed-off-by: Mark Brown <broonie@linaro.org> (cherry picked from commit d3383420c969c25deffd33270ebe321e8401191a) (cherry picked from commit eb745901177ab907ee2ec2ab8c8ca9b4deb0e35a)
Diffstat (limited to 'sound')
-rw-r--r--sound/soc/soc-pcm.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c
index 4a4b5523b91d..037921b0e5d6 100644
--- a/sound/soc/soc-pcm.c
+++ b/sound/soc/soc-pcm.c
@@ -440,19 +440,6 @@ static int soc_pcm_close(struct snd_pcm_substream *substream)
codec_dai->active--;
codec->active--;
- /* clear the corresponding DAIs rate when inactive */
- if (!cpu_dai->active) {
- cpu_dai->rate = 0;
- cpu_dai->channels = 0;
- cpu_dai->sample_bits = 0;
- }
-
- if (!codec_dai->active) {
- codec_dai->rate = 0;
- codec_dai->channels = 0;
- codec_dai->sample_bits = 0;
- }
-
/* Muting the DAC suppresses artifacts caused during digital
* shutdown, for example from stopping clocks.
*/
@@ -667,6 +654,19 @@ static int soc_pcm_hw_free(struct snd_pcm_substream *substream)
mutex_lock_nested(&rtd->pcm_mutex, rtd->pcm_subclass);
+ /* clear the corresponding DAIs parameters when going to be inactive */
+ if (cpu_dai->active == 1) {
+ cpu_dai->rate = 0;
+ cpu_dai->channels = 0;
+ cpu_dai->sample_bits = 0;
+ }
+
+ if (codec_dai->active == 1) {
+ codec_dai->rate = 0;
+ codec_dai->channels = 0;
+ codec_dai->sample_bits = 0;
+ }
+
/* apply codec digital mute */
if (!codec->active)
snd_soc_dai_digital_mute(codec_dai, 1, substream->stream);