Skip to content

Commit 1a191d7

Browse files
committed
ASoC: SOF: Introduce new firmware state: SOF_FW_CRASHED
The SOF_FW_CRASHED state is meant to indicate the unfortunate case when the firmware has crashed after a successful boot. Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
1 parent fb0d9b8 commit 1a191d7

5 files changed

Lines changed: 12 additions & 1 deletion

File tree

include/sound/sof.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ struct snd_sof_dsp_ops;
2525
* @SOF_FW_BOOT_FAILED: firmware boot failed
2626
* @SOF_FW_BOOT_READY_FAILED: firmware booted but fw_ready op failed
2727
* @SOF_FW_BOOT_COMPLETE: firmware is booted up and functional
28+
* @SOF_FW_CRASHED: firmware crashed after successful boot
2829
*/
2930
enum snd_sof_fw_state {
3031
SOF_FW_BOOT_NOT_STARTED = 0,
@@ -33,6 +34,7 @@ enum snd_sof_fw_state {
3334
SOF_FW_BOOT_FAILED,
3435
SOF_FW_BOOT_READY_FAILED,
3536
SOF_FW_BOOT_COMPLETE,
37+
SOF_FW_CRASHED,
3638
};
3739

3840
/*

sound/soc/sof/debug.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -865,6 +865,7 @@ void snd_sof_handle_fw_exception(struct snd_sof_dev *sdev)
865865
/* dump vital information to the logs */
866866
snd_sof_ipc_dump(sdev);
867867
snd_sof_dsp_dbg_dump(sdev, SOF_DBG_DUMP_REGS | SOF_DBG_DUMP_MBOX);
868+
sof_set_fw_state(sdev, SOF_FW_CRASHED);
868869
snd_sof_trace_notify_for_error(sdev);
869870
}
870871
EXPORT_SYMBOL(snd_sof_handle_fw_exception);

sound/soc/sof/ipc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ static int sof_ipc_tx_message_unlocked(struct snd_sof_ipc *ipc, u32 header,
281281
struct snd_sof_ipc_msg *msg;
282282
int ret;
283283

284-
if (ipc->disable_ipc_tx)
284+
if (ipc->disable_ipc_tx || sdev->fw_state == SOF_FW_CRASHED)
285285
return -ENODEV;
286286

287287
/*

sound/soc/sof/ops.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,7 @@ void snd_sof_dsp_panic(struct snd_sof_dev *sdev, u32 offset)
158158
sdev->dsp_oops_offset, offset);
159159

160160
snd_sof_dsp_dbg_dump(sdev, SOF_DBG_DUMP_REGS | SOF_DBG_DUMP_MBOX);
161+
sof_set_fw_state(sdev, SOF_FW_CRASHED);
161162
snd_sof_trace_notify_for_error(sdev);
162163
}
163164
EXPORT_SYMBOL(snd_sof_dsp_panic);

sound/soc/sof/pm.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -312,6 +312,13 @@ int snd_sof_prepare(struct device *dev)
312312
/* will suspend to S3 by default */
313313
sdev->system_suspend_target = SOF_SUSPEND_S3;
314314

315+
/*
316+
* if the firmware is crashed then we try to aim for S3 to reboot the
317+
* firmware
318+
*/
319+
if (sdev->fw_state == SOF_FW_CRASHED)
320+
return 0;
321+
315322
if (!desc->use_acpi_target_states)
316323
return 0;
317324

0 commit comments

Comments
 (0)