Skip to content

Commit b6e5485

Browse files
committed
ASoC: SOF: ipc4-pcm: Continue the pipeline trigger in case of IPC timeout
Ignore IPC errors for pipeline state change if the firmware state is crashed or the IPC has timed out. If the firmware has crashed the kernel still needs to go through the state changes to reset its internal to be able to correctly work the next time the DSP is booted up. The case with IPC timeout is a bit more problematic, but it has been rootcaused to be the result of system scheduling blockage and the firmware did actually received and handled the message, but the reply handling got blocked by issues outside of the SOF stack. So far the best way to handle this is to continue with setting the state. Fixes: c40aad7 ("ASoC: SOF: ipc4-pcm: Workaround for crashed firmware on system suspend") Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
1 parent 8ff4995 commit b6e5485

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

sound/soc/sof/ipc4-pcm.c

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -528,7 +528,20 @@ static int sof_ipc4_trigger_pipelines(struct snd_soc_component *component,
528528
ret = sof_ipc4_set_multi_pipeline_state(sdev, SOF_IPC4_PIPE_PAUSED, trigger_list);
529529
if (ret < 0) {
530530
spcm_err(spcm, substream->stream, "failed to pause all pipelines\n");
531-
goto free;
531+
/*
532+
* workaround: if the firmware is crashed while setting the
533+
* pipelines to reset state we must ignore the error code and
534+
* reset it to 0.
535+
* Since the firmware is crashed we will not send IPC messages
536+
* and we are going to see errors printed, but the state of the
537+
* widgets will be correct for the next boot.
538+
* Similarly, continue if the IPC has timed out.
539+
*/
540+
if (sdev->fw_state != SOF_FW_CRASHED || state != SOF_IPC4_PIPE_RESET ||
541+
ret != -ETIMEDOUT)
542+
goto free;
543+
544+
ret = 0;
532545
}
533546

534547
/* update PAUSED state for all pipelines just triggered */
@@ -566,8 +579,10 @@ static int sof_ipc4_trigger_pipelines(struct snd_soc_component *component,
566579
* Since the firmware is crashed we will not send IPC messages
567580
* and we are going to see errors printed, but the state of the
568581
* widgets will be correct for the next boot.
582+
* Similarly, continue if the IPC has timed out.
569583
*/
570-
if (sdev->fw_state != SOF_FW_CRASHED || state != SOF_IPC4_PIPE_RESET)
584+
if (sdev->fw_state != SOF_FW_CRASHED || state != SOF_IPC4_PIPE_RESET ||
585+
ret != -ETIMEDOUT)
571586
goto free;
572587

573588
ret = 0;

0 commit comments

Comments
 (0)