diff options
author | Charles Keepax <ckeepax@opensource.wolfsonmicro.com> | 2013-01-24 04:44:30 -0500 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2013-01-24 05:53:43 -0500 |
commit | 202c8f7082e87e09f861d06b1a03501047c017b5 (patch) | |
tree | 3f8dc996ad45c19f92a0ad34e20828b421b9ac91 /sound/soc/soc-compress.c | |
parent | 15e2e6194a3ae13ffeea9b7c368b54b143f31594 (diff) |
ASoC: soc-compress: Initialise delayed work to power down audio
Delayed work was scheduled but not initialised, this patch adds the
actual work and initialises it.
Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Acked-by: Vinod Koul <vinod.koul@intel.com>
Tested-by: Jeeja KP <jeeja.kp@intel.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'sound/soc/soc-compress.c')
-rw-r--r-- | sound/soc/soc-compress.c | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/sound/soc/soc-compress.c b/sound/soc/soc-compress.c index c48db6391ad5..3ea79564a993 100644 --- a/sound/soc/soc-compress.c +++ b/sound/soc/soc-compress.c | |||
@@ -75,6 +75,34 @@ out: | |||
75 | return ret; | 75 | return ret; |
76 | } | 76 | } |
77 | 77 | ||
78 | /* | ||
79 | * Power down the audio subsystem pmdown_time msecs after close is called. | ||
80 | * This is to ensure there are no pops or clicks in between any music tracks | ||
81 | * due to DAPM power cycling. | ||
82 | */ | ||
83 | static void close_delayed_work(struct work_struct *work) | ||
84 | { | ||
85 | struct snd_soc_pcm_runtime *rtd = | ||
86 | container_of(work, struct snd_soc_pcm_runtime, delayed_work.work); | ||
87 | struct snd_soc_dai *codec_dai = rtd->codec_dai; | ||
88 | |||
89 | mutex_lock_nested(&rtd->pcm_mutex, rtd->pcm_subclass); | ||
90 | |||
91 | dev_dbg(rtd->dev, "ASoC: pop wq checking: %s status: %s waiting: %s\n", | ||
92 | codec_dai->driver->playback.stream_name, | ||
93 | codec_dai->playback_active ? "active" : "inactive", | ||
94 | rtd->pop_wait ? "yes" : "no"); | ||
95 | |||
96 | /* are we waiting on this codec DAI stream */ | ||
97 | if (rtd->pop_wait == 1) { | ||
98 | rtd->pop_wait = 0; | ||
99 | snd_soc_dapm_stream_event(rtd, SNDRV_PCM_STREAM_PLAYBACK, | ||
100 | SND_SOC_DAPM_STREAM_STOP); | ||
101 | } | ||
102 | |||
103 | mutex_unlock(&rtd->pcm_mutex); | ||
104 | } | ||
105 | |||
78 | static int soc_compr_free(struct snd_compr_stream *cstream) | 106 | static int soc_compr_free(struct snd_compr_stream *cstream) |
79 | { | 107 | { |
80 | struct snd_soc_pcm_runtime *rtd = cstream->private_data; | 108 | struct snd_soc_pcm_runtime *rtd = cstream->private_data; |
@@ -317,6 +345,9 @@ int soc_new_compress(struct snd_soc_pcm_runtime *rtd, int num) | |||
317 | return ret; | 345 | return ret; |
318 | } | 346 | } |
319 | 347 | ||
348 | /* DAPM dai link stream work */ | ||
349 | INIT_DELAYED_WORK(&rtd->delayed_work, close_delayed_work); | ||
350 | |||
320 | rtd->compr = compr; | 351 | rtd->compr = compr; |
321 | compr->private_data = rtd; | 352 | compr->private_data = rtd; |
322 | 353 | ||