Skip to contentSkip to conversation

ASoC: soc-compress: Cancel delayed power down if needed

PATCH Superseded Charles Keepax 1 participant 1 message Mar 27, 2013

Subsystems (3)

v6 of 7 Superseded Latest is v7 →

lore
Share & tools
lore
#0 lore raw

PATCH v6 1/1 ASoC: soc-compress: Cancel delayed power down if needed

When a new stream is being opened it is necessary to cancel any delayed power down of the audio.

---

Well hopefully sixth time lucky, generated against the asoc tree for-next branch.

Charles

 sound/soc/soc-compress.c |   16 +++++++++++++---
 1 files changed, 13 insertions(+), 3 deletions(-)
sound/soc/soc-compress.c +13 -3
index f9b2197..4b4b5fa 100644
@@ -198,8 +198,10 @@ static int soc_compr_set_params(struct snd_compr_stream *cstream,
 {
 	struct snd_soc_pcm_runtime *rtd = cstream->private_data;
 	struct snd_soc_platform *platform = rtd->platform;
+	struct snd_soc_dai *codec_dai = rtd->codec_dai;
 	int ret = 0;
 
+
 	mutex_lock_nested(&rtd->pcm_mutex, rtd->pcm_subclass);
 
 	/* first we call set_params for the platform driver
@@ -211,19 +213,27 @@ static int soc_compr_set_params(struct snd_compr_stream *cstream,
 	if (platform->driver->compr_ops && platform->driver->compr_ops->set_params) {
 		ret = platform->driver->compr_ops->set_params(cstream, params);
 		if (ret < 0)
-			goto out;
+			goto err;
 	}
 
 	if (rtd->dai_link->compr_ops && rtd->dai_link->compr_ops->set_params) {
 		ret = rtd->dai_link->compr_ops->set_params(cstream);
 		if (ret < 0)
-			goto out;
+			goto err;
 	}
 
 	snd_soc_dapm_stream_event(rtd, SNDRV_PCM_STREAM_PLAYBACK,
 				SND_SOC_DAPM_STREAM_START);
 
-out:
+	/* cancel any delayed stream shutdown that is pending */
+	rtd->pop_wait = 0;
+	mutex_unlock(&rtd->pcm_mutex);
+
+	cancel_delayed_work_sync(&rtd->delayed_work);
+
+	return ret;
+
+err:
 	mutex_unlock(&rtd->pcm_mutex);
 	return ret;
 }
Signature · 1 line
1.7.2.5