diff --git a/sound/soc/sof/intel/hda-stream.c b/sound/soc/sof/intel/hda-stream.c index 1c04b5d9c0d8b6..b102e39760c67a 100644 --- a/sound/soc/sof/intel/hda-stream.c +++ b/sound/soc/sof/intel/hda-stream.c @@ -1324,11 +1324,23 @@ int hda_data_stream_cleanup(struct device *dev, struct snd_dma_buffer *dmab, struct snd_sof_dev *sdev = dev_get_drvdata(dev); struct hdac_stream *hstream = hdac_stream(hext_stream); int sd_offset = SOF_STREAM_SD_OFFSET(hstream); - int ret = 0; + int ret1; + int ret; - if (hstream->direction == SNDRV_PCM_STREAM_PLAYBACK) - ret = hda_dsp_stream_spib_config(sdev, hext_stream, HDA_DSP_SPIB_DISABLE, 0); - else + /* + * Reset SPIB. The SPIB value will only take effect when SPIB is enabled, + * That is why we need to set the value with HDA_DSP_SPIB_ENABLE + */ + ret = hda_dsp_stream_spib_config(sdev, hext_stream, HDA_DSP_SPIB_ENABLE, 0); + if (ret < 0) { + dev_err(sdev->dev, "%s: failed to reset SPIB: %d\n", __func__, ret); + } + + ret1 = hda_dsp_stream_spib_config(sdev, hext_stream, HDA_DSP_SPIB_DISABLE, 0); + if (!ret) + ret = ret1; + + if (hstream->direction == SNDRV_PCM_STREAM_CAPTURE) snd_sof_dsp_update_bits(sdev, HDA_DSP_HDA_BAR, sd_offset, SOF_HDA_SD_CTL_DMA_START, 0);