summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSudheer Papothi <spapothi@codeaurora.org>2016-01-29 06:21:36 +0530
committerDavid Keitel <dkeitel@codeaurora.org>2016-03-23 20:10:55 -0700
commita73f468d5e8e308f6a31da28fefdf4da8469cc8a (patch)
treee171dc7f1777afa662f440c1664a781eabe6effe
parentf1031ca0f7123695125f3b4a54d5723071441a37 (diff)
ASoC: pcm: update the start-up sequence for playback
Codec should be started before the CPU to ensure that there is no data loss during playback.Current sequence enables the CPU first followed by codec.This change updates the sequence prevent any playback data loss. Signed-off-by: Gopikrishnaiah Anandan <agopik@codeaurora.org> Signed-off-by: Banajit Goswami <bgoswami@codeaurora.org> Signed-off-by: Sudheer Papothi <spapothi@codeaurora.org>
-rw-r--r--sound/soc/soc-pcm.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c
index 24b32e4d044e..709847e9915d 100644
--- a/sound/soc/soc-pcm.c
+++ b/sound/soc/soc-pcm.c
@@ -763,6 +763,11 @@ static int soc_pcm_prepare(struct snd_pcm_substream *substream)
mutex_lock_nested(&rtd->pcm_mutex, rtd->pcm_subclass);
+ if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+ snd_soc_dapm_stream_event(rtd,
+ SNDRV_PCM_STREAM_PLAYBACK,
+ SND_SOC_DAPM_STREAM_START);
+
if (rtd->dai_link->ops && rtd->dai_link->ops->prepare) {
ret = rtd->dai_link->ops->prepare(substream);
if (ret < 0) {
@@ -811,8 +816,12 @@ static int soc_pcm_prepare(struct snd_pcm_substream *substream)
cancel_delayed_work(&rtd->delayed_work);
}
- snd_soc_dapm_stream_event(rtd, substream->stream,
+ if (substream->stream == SNDRV_PCM_STREAM_CAPTURE) {
+ if (codec_dai->capture_active == 1)
+ snd_soc_dapm_stream_event(rtd,
+ SNDRV_PCM_STREAM_CAPTURE,
SND_SOC_DAPM_STREAM_START);
+ }
for (i = 0; i < rtd->num_codecs; i++)
snd_soc_dai_digital_mute(rtd->codec_dais[i], 0,
@@ -820,6 +829,13 @@ static int soc_pcm_prepare(struct snd_pcm_substream *substream)
snd_soc_dai_digital_mute(cpu_dai, 0, substream->stream);
out:
+ if (ret < 0 && substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+ pr_err("%s: Issue stop stream for codec_dai due to op failure %d = ret\n",
+ __func__, ret);
+ snd_soc_dapm_stream_event(rtd,
+ SNDRV_PCM_STREAM_PLAYBACK,
+ SND_SOC_DAPM_STREAM_STOP);
+ }
mutex_unlock(&rtd->pcm_mutex);
return ret;
}