Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Ranjani Sridharan and committed by
Mark Brown
0b639dcd 85d7acd0

+9 -5
+9 -5
sound/soc/sof/pcm.c
··· 299 299 dev_dbg(component->dev, "pcm: free stream %d dir %d\n", 300 300 spcm->pcm.pcm_id, substream->stream); 301 301 302 + /* free PCM in the DSP */ 302 303 ret = sof_pcm_dsp_pcm_free(substream, sdev, spcm); 303 304 if (ret < 0) 304 305 err = ret; 305 306 306 - ret = sof_widget_list_free(sdev, spcm, substream->stream); 307 - if (ret < 0) 308 - err = ret; 309 307 310 - cancel_work_sync(&spcm->stream[substream->stream].period_elapsed_work); 311 - 308 + /* stop DMA */ 312 309 ret = snd_sof_pcm_platform_hw_free(sdev, substream); 313 310 if (ret < 0) { 314 311 dev_err(component->dev, "error: platform hw free failed\n"); 315 312 err = ret; 316 313 } 314 + 315 + /* free the DAPM widget list */ 316 + ret = sof_widget_list_free(sdev, spcm, substream->stream); 317 + if (ret < 0) 318 + err = ret; 319 + 320 + cancel_work_sync(&spcm->stream[substream->stream].period_elapsed_work); 317 321 318 322 return err; 319 323 }