Commit 59dd33f8 authored by Vijendar Mukunda's avatar Vijendar Mukunda Committed by Mark Brown

ASoC: soc-pcm: add a flag to reverse the stop sequence

On stream stop, currently CPU DAI stop sequence invoked first
followed by DMA. For Few platforms, it is required to stop the
DMA first before stopping CPU DAI.

Introduced new flag in dai_link structure for reordering stop sequence.
Based on flag check, ASoC core will re-order the stop sequence.

Fixes: 4378f1fb ("ASoC: soc-pcm: Use different sequence for start/stop trigger")
Signed-off-by: default avatarVijendar Mukunda <Vijendar.Mukunda@amd.com>
Link: https://lore.kernel.org/r/20210716123015.15697-1-vijendar.mukunda@amd.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent f99986c0
...@@ -712,6 +712,12 @@ struct snd_soc_dai_link { ...@@ -712,6 +712,12 @@ struct snd_soc_dai_link {
/* Do not create a PCM for this DAI link (Backend link) */ /* Do not create a PCM for this DAI link (Backend link) */
unsigned int ignore:1; unsigned int ignore:1;
/* This flag will reorder stop sequence. By enabling this flag
* DMA controller stop sequence will be invoked first followed by
* CPU DAI driver stop sequence
*/
unsigned int stop_dma_first:1;
#ifdef CONFIG_SND_SOC_TOPOLOGY #ifdef CONFIG_SND_SOC_TOPOLOGY
struct snd_soc_dobj dobj; /* For topology */ struct snd_soc_dobj dobj; /* For topology */
#endif #endif
......
...@@ -1015,6 +1015,7 @@ static int soc_pcm_hw_params(struct snd_pcm_substream *substream, ...@@ -1015,6 +1015,7 @@ static int soc_pcm_hw_params(struct snd_pcm_substream *substream,
static int soc_pcm_trigger(struct snd_pcm_substream *substream, int cmd) static int soc_pcm_trigger(struct snd_pcm_substream *substream, int cmd)
{ {
struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream);
int ret = -EINVAL, _ret = 0; int ret = -EINVAL, _ret = 0;
int rollback = 0; int rollback = 0;
...@@ -1055,6 +1056,15 @@ static int soc_pcm_trigger(struct snd_pcm_substream *substream, int cmd) ...@@ -1055,6 +1056,15 @@ static int soc_pcm_trigger(struct snd_pcm_substream *substream, int cmd)
case SNDRV_PCM_TRIGGER_STOP: case SNDRV_PCM_TRIGGER_STOP:
case SNDRV_PCM_TRIGGER_SUSPEND: case SNDRV_PCM_TRIGGER_SUSPEND:
case SNDRV_PCM_TRIGGER_PAUSE_PUSH: case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
if (rtd->dai_link->stop_dma_first) {
ret = snd_soc_pcm_component_trigger(substream, cmd, rollback);
if (ret < 0)
break;
ret = snd_soc_pcm_dai_trigger(substream, cmd, rollback);
if (ret < 0)
break;
} else {
ret = snd_soc_pcm_dai_trigger(substream, cmd, rollback); ret = snd_soc_pcm_dai_trigger(substream, cmd, rollback);
if (ret < 0) if (ret < 0)
break; break;
...@@ -1062,7 +1072,7 @@ static int soc_pcm_trigger(struct snd_pcm_substream *substream, int cmd) ...@@ -1062,7 +1072,7 @@ static int soc_pcm_trigger(struct snd_pcm_substream *substream, int cmd)
ret = snd_soc_pcm_component_trigger(substream, cmd, rollback); ret = snd_soc_pcm_component_trigger(substream, cmd, rollback);
if (ret < 0) if (ret < 0)
break; break;
}
ret = snd_soc_link_trigger(substream, cmd, rollback); ret = snd_soc_link_trigger(substream, cmd, rollback);
break; break;
} }
......
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