ASoC: core: Add flag to ignore pmdown_time at pcm_close
authorPeter Ujfalusi <peter.ujfalusi@ti.com>
Fri, 14 Oct 2011 11:43:33 +0000 (14:43 +0300)
committerMark Brown <broonie@opensource.wolfsonmicro.com>
Fri, 14 Oct 2011 19:42:21 +0000 (20:42 +0100)
With this flag codec drivers can indicate that it is desired
to ignore the pmdown_time for DAPM shutdown sequence when
playback stream is stopped.
The DAPM sequence will be executed without delay in this case.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
include/sound/soc.h
sound/soc/soc-pcm.c

index 858291dc08f9deb02f5005eeebf8067738075c80..11cfb5953e06eb82c22f52319aa2c4ea31d7f99a 100644 (file)
@@ -578,6 +578,7 @@ struct snd_soc_codec {
 
        /* dapm */
        struct snd_soc_dapm_context dapm;
+       unsigned int ignore_pmdown_time:1; /* pmdown_time is ignored at stop */
 
 #ifdef CONFIG_DEBUG_FS
        struct dentry *debugfs_codec_root;
index 8eb0f0711f8c161d809983149b9f9739bbcdca08..ee15337353fae5f2cf16f5ab86f94d13440dc6bd 100644 (file)
@@ -319,10 +319,17 @@ static int soc_pcm_close(struct snd_pcm_substream *substream)
        cpu_dai->runtime = NULL;
 
        if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
-               /* start delayed pop wq here for playback streams */
-               codec_dai->pop_wait = 1;
-               schedule_delayed_work(&rtd->delayed_work,
-                       msecs_to_jiffies(rtd->pmdown_time));
+               if (unlikely(codec->ignore_pmdown_time)) {
+                       /* powered down playback stream now */
+                       snd_soc_dapm_stream_event(rtd,
+                               codec_dai->driver->playback.stream_name,
+                               SND_SOC_DAPM_STREAM_STOP);
+               } else {
+                       /* start delayed pop wq here for playback streams */
+                       codec_dai->pop_wait = 1;
+                       schedule_delayed_work(&rtd->delayed_work,
+                               msecs_to_jiffies(rtd->pmdown_time));
+               }
        } else {
                /* capture streams can be powered down now */
                snd_soc_dapm_stream_event(rtd,