summaryrefslogtreecommitdiff
path: root/sound/soc/soc-core.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/soc/soc-core.c')
-rw-r--r--sound/soc/soc-core.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index 16c7453f4946..6b83792e94f4 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -360,9 +360,11 @@ static int soc_codec_close(struct snd_pcm_substream *substream)
if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
/* start delayed pop wq here for playback streams */
- codec_dai->pop_wait = 1;
- schedule_delayed_work(&socdev->delayed_work,
- msecs_to_jiffies(pmdown_time));
+ if (codec_dai->prepared) {
+ codec_dai->pop_wait = 1;
+ schedule_delayed_work(&socdev->delayed_work,
+ msecs_to_jiffies(pmdown_time));
+ }
} else {
/* capture streams can be powered down now */
snd_soc_dapm_stream_event(codec,
@@ -374,6 +376,7 @@ static int soc_codec_close(struct snd_pcm_substream *substream)
SND_SOC_BIAS_STANDBY);
}
+ codec_dai->prepared = 0;
mutex_unlock(&pcm_mutex);
return 0;
}
@@ -395,7 +398,13 @@ static int soc_pcm_prepare(struct snd_pcm_substream *substream)
int ret = 0;
mutex_lock(&pcm_mutex);
-
+ /*
+ * This is for informing the close-function that we really need to
+ * start the delayed work for stopping the codecs
+ * (Luis Galdos)
+ */
+ codec_dai->prepared = 1;
+
if (machine->ops && machine->ops->prepare) {
ret = machine->ops->prepare(substream);
if (ret < 0) {