diff options
author | Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> | 2024-04-02 17:18:26 +0200 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2024-04-02 18:14:56 +0200 |
commit | dbc78bce74f5f9057ba02bdc8d1549d24c573900 (patch) | |
tree | f6502e7866dcbe94bbab2b1a6ef31c6a2e7c1015 /sound/soc/sof/pcm.c | |
parent | ASoC: SOF: pcm: simplify sof_pcm_hw_free() with helper (diff) | |
download | linux-dbc78bce74f5f9057ba02bdc8d1549d24c573900.tar.xz linux-dbc78bce74f5f9057ba02bdc8d1549d24c573900.zip |
ASoC: SOF: pcm: add pending_stop state variable
Add a state variable to keep track of delayed stops, in case
pcm_ops->platform_stop_during_hw_free is set.
This patch should be iso-functionality, possibly removing no-op
cases. The main purpose of this new state variable is to prepare a
follow-up patch to reset all PCM and DMAs in case of stop/prepare xrun
sequences.
Reviewed-by: Rander Wang <rander.wang@intel.com>
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://msgid.link/r/20240402151828.175002-16-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound/soc/sof/pcm.c')
-rw-r--r-- | sound/soc/sof/pcm.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/sound/soc/sof/pcm.c b/sound/soc/sof/pcm.c index 7b732f31f974..2e8782dddc80 100644 --- a/sound/soc/sof/pcm.c +++ b/sound/soc/sof/pcm.c @@ -276,6 +276,8 @@ static int sof_pcm_trigger(struct snd_soc_component *component, dev_dbg(component->dev, "pcm: trigger stream %d dir %d cmd %d\n", spcm->pcm.pcm_id, substream->stream, cmd); + spcm->pending_stop[substream->stream] = false; + switch (cmd) { case SNDRV_PCM_TRIGGER_PAUSE_PUSH: ipc_first = true; @@ -345,6 +347,15 @@ static int sof_pcm_trigger(struct snd_soc_component *component, /* invoke platform trigger to stop DMA even if pcm_ops isn't set or if it failed */ if (!pcm_ops || !pcm_ops->platform_stop_during_hw_free) snd_sof_pcm_platform_trigger(sdev, substream, cmd); + + /* + * set the pending_stop flag to indicate that pipeline stop has been delayed. + * This will be used later to stop the pipelines during prepare when recovering + * from xruns. + */ + if (pcm_ops && pcm_ops->platform_stop_during_hw_free && + cmd == SNDRV_PCM_TRIGGER_STOP) + spcm->pending_stop[substream->stream] = true; break; default: break; |