ASoC: soc-pcm.c: Make sure DAI parameters cleared if the DAI becomes inactive
[linux-2.6-block.git] / sound / soc / soc-pcm.c
index b63019c662247a5f5cfdd0e71797cdb8a5fd4bc4..8c168dc553f65931d0bce4893d866822e1ea6521 100644 (file)
@@ -698,14 +698,12 @@ static int soc_pcm_clean(struct snd_soc_pcm_runtime *rtd,
 
        if (!rollback) {
                snd_soc_runtime_deactivate(rtd, substream->stream);
-               /* clear the corresponding DAIs parameters when going to be inactive */
-               for_each_rtd_dais(rtd, i, dai) {
-                       if (snd_soc_dai_active(dai) == 0)
-                               soc_pcm_set_dai_params(dai, NULL);
 
-                       if (snd_soc_dai_stream_active(dai, substream->stream) == 0)
-                               snd_soc_dai_digital_mute(dai, 1, substream->stream);
-               }
+               /* Make sure DAI parameters cleared if the DAI becomes inactive */
+               for_each_rtd_dais(rtd, i, dai)
+                       if (snd_soc_dai_active(dai) == 0 &&
+                           (dai->rate || dai->channels || dai->sample_bits))
+                               soc_pcm_set_dai_params(dai, NULL);
        }
 
        for_each_rtd_dais(rtd, i, dai)
@@ -936,6 +934,15 @@ static int soc_pcm_hw_clean(struct snd_soc_pcm_runtime *rtd,
 
        snd_soc_dpcm_mutex_assert_held(rtd);
 
+       /* clear the corresponding DAIs parameters when going to be inactive */
+       for_each_rtd_dais(rtd, i, dai) {
+               if (snd_soc_dai_active(dai) == 1)
+                       soc_pcm_set_dai_params(dai, NULL);
+
+               if (snd_soc_dai_stream_active(dai, substream->stream) == 1)
+                       snd_soc_dai_digital_mute(dai, 1, substream->stream);
+       }
+
        /* run the stream event */
        snd_soc_dapm_stream_stop(rtd, substream->stream);