From f9161413c6a021f4b267648e5bcda7c6f241da81 Mon Sep 17 00:00:00 2001 From: Peter Ujfalusi Date: Fri, 25 Sep 2026 09:42:07 +0300 Subject: [PATCH] ASoC: SOF: Intel: hda: Allow D3 transition after firmware crash A D0i3-compatible stream can leave the DSP power state at D0I3 when the firmware crashes. The normal D0I3 to D0I0 transition then fails because its IPC cannot be delivered. Runtime suspend subsequently rejects the D0I3 to D3 transition and resets the firmware state to SOF_FW_BOOT_NOT_STARTED despite the failed suspend. Device removal then skips the SOF teardown and the PCI core frees the MSI vector while the AudioDSP IRQ remains registered. Allow a direct D0I3 to D3 transition after a firmware crash or boot failure. The DSP is no longer executing, so it can be powered down without first requesting the D0I0 transition. Signed-off-by: Peter Ujfalusi --- sound/soc/sof/intel/hda-dsp.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/sound/soc/sof/intel/hda-dsp.c b/sound/soc/sof/intel/hda-dsp.c index e26e4c132637b9..ec49aeaa9bd7af 100644 --- a/sound/soc/sof/intel/hda-dsp.c +++ b/sound/soc/sof/intel/hda-dsp.c @@ -683,9 +683,15 @@ static int hda_dsp_set_power_state(struct snd_sof_dev *sdev, ret = hda_dsp_set_D0_state(sdev, target_state); break; case SOF_DSP_PM_D3: - /* The only allowed transition is: D0I0 -> D3 */ + /* + * The only allowed transition is D0I0 -> D3. If the firmware + * crashed, the D0I3 -> D0I0 IPC cannot succeed, but the DSP can + * still be powered down directly. + */ if (sdev->dsp_power_state.state == SOF_DSP_PM_D0 && - sdev->dsp_power_state.substate == SOF_HDA_DSP_PM_D0I0) { + (sdev->dsp_power_state.substate == SOF_HDA_DSP_PM_D0I0 || + sdev->fw_state == SOF_FW_CRASHED || + sdev->fw_state == SOF_FW_BOOT_FAILED)) { struct sof_intel_hda_dev *hda = sdev->pdata->hw_pdata; const struct sof_intel_dsp_desc *chip = hda->desc; int ret, j;