summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRanjani Sridharan <ranjani.sridharan@linux.intel.com>2021-11-25 12:15:18 +0200
committerMark Brown <broonie@kernel.org>2021-11-26 13:24:23 +0000
commit0b639dcd457b1d3fc660e5a77b02cf65acde3b5a (patch)
tree129d69496e8644e51fe73f64326e843e6d336acb
parent85d7acd0ef18725b1d3a7980eee8b84d46296b91 (diff)
downloadlwn-0b639dcd457b1d3fc660e5a77b02cf65acde3b5a.tar.gz
lwn-0b639dcd457b1d3fc660e5a77b02cf65acde3b5a.zip
ASoC: SOF: align the hw_free sequence with stop
Even though the order of stopping the DMA and freeing the widget list is not important, align the sequence to match with the stop trigger to avoid confusion. Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com> Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com> Link: https://lore.kernel.org/r/20211125101520.291581-9-kai.vehmanen@linux.intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
-rw-r--r--sound/soc/sof/pcm.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/sound/soc/sof/pcm.c b/sound/soc/sof/pcm.c
index c61cd3cc4f02..e4446defe51e 100644
--- a/sound/soc/sof/pcm.c
+++ b/sound/soc/sof/pcm.c
@@ -299,22 +299,26 @@ static int sof_pcm_hw_free(struct snd_soc_component *component,
dev_dbg(component->dev, "pcm: free stream %d dir %d\n",
spcm->pcm.pcm_id, substream->stream);
+ /* free PCM in the DSP */
ret = sof_pcm_dsp_pcm_free(substream, sdev, spcm);
if (ret < 0)
err = ret;
- ret = sof_widget_list_free(sdev, spcm, substream->stream);
- if (ret < 0)
- err = ret;
-
- cancel_work_sync(&spcm->stream[substream->stream].period_elapsed_work);
+ /* stop DMA */
ret = snd_sof_pcm_platform_hw_free(sdev, substream);
if (ret < 0) {
dev_err(component->dev, "error: platform hw free failed\n");
err = ret;
}
+ /* free the DAPM widget list */
+ ret = sof_widget_list_free(sdev, spcm, substream->stream);
+ if (ret < 0)
+ err = ret;
+
+ cancel_work_sync(&spcm->stream[substream->stream].period_elapsed_work);
+
return err;
}