Skip to content

Commit 90219f1

Browse files
ranj063broonie
authored andcommitted
ASoC: SOF: intel: hda: Clean up link DMA for IPC3 during stop
With IPC3, we reset hw_params during the stop trigger, so we should also clean up the link DMA during the stop trigger. Fixes: 1bf83fa ("ASoC: SOF: Intel: hda-dai: Do not perform DMA cleanup during stop") Closes: thesofproject#4455 Closes: thesofproject#4482 Closes: https://bugzilla.kernel.org/show_bug.cgi?id=217673 Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com> Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Reviewed-by: Rander Wang <rander.wang@intel.com> Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com> Reviewed-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com> Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com> Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com> Link: https://lore.kernel.org/r/20230808110627.32375-1-peter.ujfalusi@linux.intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
1 parent e619948 commit 90219f1

File tree

3 files changed

+14
-4
lines changed

3 files changed

+14
-4
lines changed

sound/soc/sof/intel/hda-dai-ops.c

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -372,16 +372,25 @@ static const struct hda_dai_widget_dma_ops hda_ipc4_chain_dma_ops = {
372372
static int hda_ipc3_post_trigger(struct snd_sof_dev *sdev, struct snd_soc_dai *cpu_dai,
373373
struct snd_pcm_substream *substream, int cmd)
374374
{
375+
struct hdac_ext_stream *hext_stream = hda_get_hext_stream(sdev, cpu_dai, substream);
375376
struct snd_soc_dapm_widget *w = snd_soc_dai_get_widget(cpu_dai, substream->stream);
376377

377378
switch (cmd) {
378379
case SNDRV_PCM_TRIGGER_SUSPEND:
379380
case SNDRV_PCM_TRIGGER_STOP:
380381
{
381382
struct snd_sof_dai_config_data data = { 0 };
383+
int ret;
382384

383385
data.dai_data = DMA_CHAN_INVALID;
384-
return hda_dai_config(w, SOF_DAI_CONFIG_FLAGS_HW_FREE, &data);
386+
ret = hda_dai_config(w, SOF_DAI_CONFIG_FLAGS_HW_FREE, &data);
387+
if (ret < 0)
388+
return ret;
389+
390+
if (cmd == SNDRV_PCM_TRIGGER_STOP)
391+
return hda_link_dma_cleanup(substream, hext_stream, cpu_dai);
392+
393+
break;
385394
}
386395
case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
387396
return hda_dai_config(w, SOF_DAI_CONFIG_FLAGS_PAUSE, NULL);

sound/soc/sof/intel/hda-dai.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,9 +107,8 @@ hda_dai_get_ops(struct snd_pcm_substream *substream, struct snd_soc_dai *cpu_dai
107107
return sdai->platform_private;
108108
}
109109

110-
static int hda_link_dma_cleanup(struct snd_pcm_substream *substream,
111-
struct hdac_ext_stream *hext_stream,
112-
struct snd_soc_dai *cpu_dai)
110+
int hda_link_dma_cleanup(struct snd_pcm_substream *substream, struct hdac_ext_stream *hext_stream,
111+
struct snd_soc_dai *cpu_dai)
113112
{
114113
const struct hda_dai_widget_dma_ops *ops = hda_dai_get_ops(substream, cpu_dai);
115114
struct sof_intel_hda_stream *hda_stream;

sound/soc/sof/intel/hda.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -963,5 +963,7 @@ const struct hda_dai_widget_dma_ops *
963963
hda_select_dai_widget_ops(struct snd_sof_dev *sdev, struct snd_sof_widget *swidget);
964964
int hda_dai_config(struct snd_soc_dapm_widget *w, unsigned int flags,
965965
struct snd_sof_dai_config_data *data);
966+
int hda_link_dma_cleanup(struct snd_pcm_substream *substream, struct hdac_ext_stream *hext_stream,
967+
struct snd_soc_dai *cpu_dai);
966968

967969
#endif

0 commit comments

Comments
 (0)