Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 16 additions & 4 deletions sound/soc/sof/intel/hda-stream.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Comment on lines +1327 to +1341
Copy link

Copilot AI Apr 8, 2026

Choose a reason for hiding this comment

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

ret1 is non-descriptive in this context. Renaming it to reflect the operation (e.g. ret_disable) would make the error-handling logic easier to follow and reduce the chance of mistakes during future edits.

Copilot uses AI. Check for mistakes.

Comment on lines +1334 to +1342
Copy link

Copilot AI Apr 8, 2026

Choose a reason for hiding this comment

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

hda_data_stream_cleanup() now returns an error if the SPIB reset/disable fails, which changes behavior for capture streams (previously ret stayed 0 unless direction was PLAYBACK). Since SPIB appears optional and other call sites treat SPIB config as best-effort (e.g. hda_dsp_stream_hw_free() calls hda_dsp_stream_spib_config(...DISABLE...) and still returns 0 at hda-stream.c:770-774), consider not propagating SPIB failures from cleanup (e.g. only attempt when sdev->bar[HDA_DSP_SPIB_BAR] is present, and/or keep ret at 0 unless later cleanup steps fail).

Copilot uses AI. Check for mistakes.
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);

Expand Down
Loading