aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/soc-pcm.c
diff options
context:
space:
mode:
authorNicolin Chen <b42378@freescale.com>2013-11-20 05:37:09 -0500
committerNitin Garg <nitin.garg@freescale.com>2014-04-16 09:47:37 -0400
commit44963ab007355b19fb388a90fa29c48a546ef68b (patch)
treed335a60f791af115ff1b6d9876e0626acae8165a /sound/soc/soc-pcm.c
parent62d27a965c719571d2251ddbae8a56c76e752464 (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)
Diffstat (limited to 'sound/soc/soc-pcm.c')
-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)
440 codec_dai->active--; 440 codec_dai->active--;
441 codec->active--; 441 codec->active--;
442 442
443 /* clear the corresponding DAIs rate when inactive */
444 if (!cpu_dai->active) {
445 cpu_dai->rate = 0;
446 cpu_dai->channels = 0;
447 cpu_dai->sample_bits = 0;
448 }
449
450 if (!codec_dai->active) {
451 codec_dai->rate = 0;
452 codec_dai->channels = 0;
453 codec_dai->sample_bits = 0;
454 }
455
456 /* Muting the DAC suppresses artifacts caused during digital 443 /* Muting the DAC suppresses artifacts caused during digital
457 * shutdown, for example from stopping clocks. 444 * shutdown, for example from stopping clocks.
458 */ 445 */
@@ -667,6 +654,19 @@ static int soc_pcm_hw_free(struct snd_pcm_substream *substream)
667 654
668 mutex_lock_nested(&rtd->pcm_mutex, rtd->pcm_subclass); 655 mutex_lock_nested(&rtd->pcm_mutex, rtd->pcm_subclass);
669 656
657 /* clear the corresponding DAIs parameters when going to be inactive */
658 if (cpu_dai->active == 1) {
659 cpu_dai->rate = 0;
660 cpu_dai->channels = 0;
661 cpu_dai->sample_bits = 0;
662 }
663
664 if (codec_dai->active == 1) {
665 codec_dai->rate = 0;
666 codec_dai->channels = 0;
667 codec_dai->sample_bits = 0;
668 }
669
670 /* apply codec digital mute */ 670 /* apply codec digital mute */
671 if (!codec->active) 671 if (!codec->active)
672 snd_soc_dai_digital_mute(codec_dai, 1, substream->stream); 672 snd_soc_dai_digital_mute(codec_dai, 1, substream->stream);