Skip to content

Commit 454fde2

Browse files
committed
ASoC: SOF: Intel: reset SPIB in hda_data_stream_cleanup
The register will indicate to the host DMA where the position is in the buffer currently processed by host SW. Reset it to 0 in hda_data_stream_cleanup. The register is ignored by the host DMA if SPIB is disabled. That's why the "enable" parameter needs to be HDA_DSP_SPIB_ENABLE. Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
1 parent b309a4a commit 454fde2

1 file changed

Lines changed: 16 additions & 4 deletions

File tree

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

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1324,11 +1324,23 @@ int hda_data_stream_cleanup(struct device *dev, struct snd_dma_buffer *dmab,
13241324
struct snd_sof_dev *sdev = dev_get_drvdata(dev);
13251325
struct hdac_stream *hstream = hdac_stream(hext_stream);
13261326
int sd_offset = SOF_STREAM_SD_OFFSET(hstream);
1327-
int ret = 0;
1327+
int ret1;
1328+
int ret;
13281329

1329-
if (hstream->direction == SNDRV_PCM_STREAM_PLAYBACK)
1330-
ret = hda_dsp_stream_spib_config(sdev, hext_stream, HDA_DSP_SPIB_DISABLE, 0);
1331-
else
1330+
/*
1331+
* Reset SPIB. The SPIB value will only take effect when SPIB is enabled,
1332+
* That is why we need to set the value with HDA_DSP_SPIB_ENABLE
1333+
*/
1334+
ret = hda_dsp_stream_spib_config(sdev, hext_stream, HDA_DSP_SPIB_ENABLE, 0);
1335+
if (ret < 0) {
1336+
dev_err(sdev->dev, "%s: failed to reset SPIB: %d\n", __func__, ret);
1337+
}
1338+
1339+
ret1 = hda_dsp_stream_spib_config(sdev, hext_stream, HDA_DSP_SPIB_DISABLE, 0);
1340+
if (!ret)
1341+
ret = ret1;
1342+
1343+
if (hstream->direction == SNDRV_PCM_STREAM_CAPTURE)
13321344
snd_sof_dsp_update_bits(sdev, HDA_DSP_HDA_BAR, sd_offset,
13331345
SOF_HDA_SD_CTL_DMA_START, 0);
13341346

0 commit comments

Comments
 (0)