Skip to content

ASoC: SOF: Intel: reset SPIB in hda_data_stream_cleanup#5718

Open
bardliao wants to merge 1 commit intothesofproject:topic/sof-devfrom
bardliao:reset-spib
Open

ASoC: SOF: Intel: reset SPIB in hda_data_stream_cleanup#5718
bardliao wants to merge 1 commit intothesofproject:topic/sof-devfrom
bardliao:reset-spib

Conversation

@bardliao
Copy link
Copy Markdown
Collaborator

@bardliao bardliao commented Apr 2, 2026

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.

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>
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the Intel SOF HDA stream cleanup path to reset the SPIB (Software Position In Buffer) register to 0 during hda_data_stream_cleanup(), based on the requirement that the SPIB value is only honored by host DMA when SPIB is enabled.

Changes:

  • Add an SPIB “reset to 0” step in hda_data_stream_cleanup() using HDA_DSP_SPIB_ENABLE.
  • Keep the existing playback-specific SPIB disable call after cleanup.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +1329 to 1336
/*
* Reset SPIB. The SPIB value will only take effect when SPIB is enabled,
* That's why we need to set the value with HDA_DSP_SPIB_ENABLE
*/
hda_dsp_stream_spib_config(sdev, hext_stream, HDA_DSP_SPIB_ENABLE, 0);

if (hstream->direction == SNDRV_PCM_STREAM_PLAYBACK)
ret = hda_dsp_stream_spib_config(sdev, hext_stream, HDA_DSP_SPIB_DISABLE, 0);
Copy link

Copilot AI Apr 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new SPIB reset call enables SPIB unconditionally, but SPIB is only disabled again for playback streams. For capture streams (notably the ICCMAX capture stream path, which doesn’t enable SPIB in hda_data_stream_prepare()), this will leave SPIB enabled after cleanup and changes the stream’s register state unexpectedly. Consider limiting the reset to the playback case (where SPIB is disabled right after), or preserving/restoring the previous SPIB enable state (or explicitly disabling again for capture) so cleanup doesn’t introduce a persistent SPIB enable side effect.

Copilot uses AI. Check for mistakes.
Comment on lines +1330 to +1331
* Reset SPIB. The SPIB value will only take effect when SPIB is enabled,
* That's why we need to set the value with HDA_DSP_SPIB_ENABLE
Copy link

Copilot AI Apr 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: comment grammar/casing — the sentence after the comma starts with "That's"; consider splitting into two sentences and avoiding the contraction (e.g., "That is why...") to match typical kernel comment style and improve readability.

Suggested change
* Reset SPIB. The SPIB value will only take effect when SPIB is enabled,
* That's why we need to set the value with HDA_DSP_SPIB_ENABLE
* 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.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants