Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4b7a568d authored by Gopikrishnaiah Anandan's avatar Gopikrishnaiah Anandan Committed by Anish Kumar
Browse files

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.

Change-Id: Iaf01d153f41a2f94d302ae7f4c1c98b1361dd24f
Signed-off-by: default avatarGopikrishnaiah Anandan <agopik@codeaurora.org>
parent ec641297
Loading
Loading
Loading
Loading
+17 −3
Original line number Diff line number Diff line
@@ -459,6 +459,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) {
@@ -502,12 +507,21 @@ 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);

	}
	snd_soc_dai_digital_mute(codec_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;
}