diff --git a/sound/soc/sof/intel/hda-dai.c b/sound/soc/sof/intel/hda-dai.c index 7a8875a885ab34..3bc342627365c3 100644 --- a/sound/soc/sof/intel/hda-dai.c +++ b/sound/soc/sof/intel/hda-dai.c @@ -353,6 +353,23 @@ static int __maybe_unused hda_dai_trigger(struct snd_pcm_substream *substream, i return 0; } + /* + * The link DMA is reset on STOP and it is expected to be configured + * again in the BE prepare before the next START. + * When the BE is shared by multiple FEs, DPCM can start the BE again + * without preparing it: the BE prepare is skipped while another FE + * using the BE is in PREPARED state, and that FE can also start the BE + * directly. Run the prepare of the DAI here to configure the link DMA. + */ + if (cmd == SNDRV_PCM_TRIGGER_START && !hext_stream->link_prepared && + dai->driver->ops && dai->driver->ops->prepare) { + dev_dbg(dai->dev, "link DMA not prepared, preparing it for START\n"); + + ret = dai->driver->ops->prepare(substream, dai); + if (ret < 0) + return ret; + } + if (ops->pre_trigger) { ret = ops->pre_trigger(sdev, dai, substream, cmd); if (ret < 0)