ASoC: SOF: Intel: reset spib_addr in stream cleanup
Subsystems (3)
Bard Liao
maintainercover ASoC: SOF: Intel: reset spib_addr in stream cleanup
The spib_addr register indicates the current position in the buffer being processed by the host software to the host DMA. It must be reset before being disabled. Also, add the missing disable call in hda_data_stream_cleanup().
Bard Liao (2):
ASoC: SOF: Intel: reset spib_addr before disabling SPIB
ASoC: SOF: Intel: Disable SPIB in both direction
sound/soc/sof/intel/hda-stream.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-)
Signature · 1 line
2.43.0
Bard Liao
maintainerPATCH 1/2 ASoC: SOF: Intel: reset spib_addr before disabling SPIB
The spib_addr register will indicate to the host DMA where the position is in the buffer currently processed by host SW. The register is ignored by the host DMA if SPIB is disabled. Reset it to 0 before disabling SPIB.
--- sound/soc/sof/intel/hda-stream.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
sound/soc/sof/intel/hda-stream.c +6 -1
@@ -198,13 +198,18 @@ int hda_dsp_stream_spib_config(struct snd_sof_dev *sdev, mask = (1 << hstream->index); +/* Reset the spib_addr before disabling SPIB */ +if (!enable) +sof_io_write (sdev, hstream->spib_addr,0 ); +/* enable/disable SPIB for the stream */ snd_sof_dsp_update_bits (sdev,HDA_DSP_SPIB_BAR ,SOF_HDA_ADSP_REG_CL_SPBFIFO_SPBFCCTL , mask, enable << hstream->index);/* set the SPIB value */ -sof_io_write (sdev, hstream->spib_addr, size); +if (enable) +sof_io_write (sdev, hstream->spib_addr, size);return 0 ; }
Signature · 1 line
2.43.0
Bard Liao
maintainerPATCH 2/2 ASoC: SOF: Intel: Disable SPIB in both direction
In reply to Bard LiaoSPIB was enabled in hda_data_stream_prepare() if is_iccmax = false. We should disable it in hda_data_stream_cleanup().
--- sound/soc/sof/intel/hda-stream.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
sound/soc/sof/intel/hda-stream.c +4 -4
@@ -1333,11 +1333,11 @@ 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 ret; -if (hstream->direction ==SNDRV_PCM_STREAM_PLAYBACK ) - ret =hda_dsp_stream_spib_config (sdev, hext_stream,HDA_DSP_SPIB_DISABLE ,0 ); -else + ret =hda_dsp_stream_spib_config (sdev, hext_stream,HDA_DSP_SPIB_DISABLE ,0 ); + +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 );
Signature · 1 line
2.43.0
Mark Brown
maintainerRe: [PATCH 2/2] ASoC: SOF: Intel: Disable SPIB in both direction
sound/soc/sof/intel/hda-stream.c int hda_data_stream_cleanup(struct device *dev, struct snd_dma_buffer *dmab, · line 1340
Quoted 9 lines · Bard Liao
SPIB was enabled in
hda_data_stream_prepare()ifis_iccmax= false. We should disable it inhda_data_stream_cleanup().sound/soc/sof/intel/hda-stream.c +3
-3-if (hstream->direction ==SNDRV_PCM_STREAM_PLAYBACK ) - ret =hda_dsp_stream_spib_config (sdev, hext_stream,HDA_DSP_SPIB_DISABLE ,0 ); -else + ret =hda_dsp_stream_spib_config (sdev, hext_stream,HDA_DSP_SPIB_DISABLE ,0 ); + +if (hstream->direction ==SNDRV_PCM_STREAM_CAPTURE )
This doesn't check if is_icccmax is true but upgrades any error from the teardown to be propagated to the caller - should we either pay less attention to the error or have a check to see if the cleanup is needed?
RE: [PATCH 2/2] ASoC: SOF: Intel: Disable SPIB in both direction
Quoted 20 lines
-----Original Message-----
From: Mark Brown <[email protected]>
Sent: Wednesday, July 8, 2026 7:32 AM
To: Bard Liao <[email protected]>
Cc: [email protected]; [email protected]; Liao, Bard <[email protected]>; [email protected]
Subject: Re: [PATCH 2/2] ASoC: SOF: Intel: Disable SPIB in both directionReview
Quoted 5 lines · Bard Liao
SPIB was enabled in
hda_data_stream_prepare()ifis_iccmax= false. We should disable it inhda_data_stream_cleanup().(quoted diff) +0
-2- if (hstream->direction == SNDRV_PCM_STREAM_PLAYBACK) - ret = hda_dsp_stream_spib_config(sdev, hext_stream,
HDA_DSP_SPIB_DISABLE, 0);Review
Quoted 2 lines
(quoted diff) +1
-1- else + ret = hda_dsp_stream_spib_config(sdev, hext_stream,
HDA_DSP_SPIB_DISABLE, 0);
Quoted 6 lines
sound/soc/sof/intel/hda-stream.c int hda_data_stream_cleanup(struct device *dev, struct snd_dma_buffer *dmab, · line 1340
Quoted 2 lines
sound/soc/sof/intel/hda-stream.c +2
-0+ +if (hstream->direction ==SNDRV_PCM_STREAM_CAPTURE )This doesn't check if
is_icccmaxis true but upgrades any error from the teardown to be propagated to the caller - should we either pay less attention to the error or have a check to see if the cleanup is needed?
Thanks Mark for the review. I will fix it in v2.