Commit fd045558 authored by randerwang's avatar randerwang Committed by Mark Brown

ASoC: SOF: Intel: change trigger sequence to fix pop noise when stopping playback on sdw platforms

Now the trigger sequence is set to SND_SOC_DPCM_TRIGGER_POST for
SOF. This means FE will be stopped before BE, so BE will consume
invalid data and this generates huge pop noise. This sequence is
introduced for HDA DAI which requires SND_SOC_DPCM_TRIGGER_POST for
some reasons. Now set default trigger sequence to SND_SOC_DPCM_TRIGGER_PRE
for playback with all DAI and fix sequence only for HDA DAI.

Fully tested on Comet Lake for a few cycles.
Signed-off-by: default avatarranderwang <rander.wang@linux.intel.com>
Signed-off-by: default avatarRanjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: default avatarClarex Zhou <clarex.zhou@intel.com>
Reviewed-by: default avatarGuennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Reviewed-by: default avatarPierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20200427172939.25848-5-ranjani.sridharan@linux.intel.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent ac764249
......@@ -639,6 +639,7 @@ static int sof_pcm_dai_link_fixup(struct snd_soc_pcm_runtime *rtd,
snd_soc_rtdcom_lookup(rtd, SOF_AUDIO_PCM_DRV_NAME);
struct snd_sof_dai *dai =
snd_sof_find_dai(component, (char *)rtd->dai_link->name);
struct snd_soc_dpcm *dpcm;
/* no topology exists for this BE, try a common configuration */
if (!dai) {
......@@ -702,7 +703,16 @@ static int sof_pcm_dai_link_fixup(struct snd_soc_pcm_runtime *rtd,
}
break;
case SOF_DAI_INTEL_HDA:
/* do nothing for HDA dai_link */
/*
* HDaudio does not follow the default trigger
* sequence due to firmware implementation
*/
for_each_dpcm_fe(rtd, SNDRV_PCM_STREAM_PLAYBACK, dpcm) {
struct snd_soc_pcm_runtime *fe = dpcm->fe;
fe->dai_link->trigger[SNDRV_PCM_STREAM_PLAYBACK] =
SND_SOC_DPCM_TRIGGER_POST;
}
break;
case SOF_DAI_INTEL_ALH:
/* do nothing for ALH dai_link */
......
......@@ -3111,9 +3111,17 @@ static int sof_link_load(struct snd_soc_component *scomp, int index,
if (!link->no_pcm) {
link->nonatomic = true;
/* set trigger order */
link->trigger[0] = SND_SOC_DPCM_TRIGGER_POST;
link->trigger[1] = SND_SOC_DPCM_TRIGGER_POST;
/*
* set default trigger order for all links. Exceptions to
* the rule will be handled in sof_pcm_dai_link_fixup()
* For playback, the sequence is the following: start FE,
* start BE, stop BE, stop FE; for Capture the sequence is
* inverted start BE, start FE, stop FE, stop BE
*/
link->trigger[SNDRV_PCM_STREAM_PLAYBACK] =
SND_SOC_DPCM_TRIGGER_PRE;
link->trigger[SNDRV_PCM_STREAM_CAPTURE] =
SND_SOC_DPCM_TRIGGER_POST;
/* nothing more to do for FE dai links */
return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment