From e15cf2cdf877accfe87592334d2c468335805b5d Mon Sep 17 00:00:00 2001 From: Ranjani Sridharan Date: Mon, 25 Mar 2024 10:32:50 -0700 Subject: [PATCH] ASoC: SOF: debug-dsp-ops: Add a new debugfs entry to read current DSP state Add a read-only debugfs entry to read the current FW boot state. Signed-off-by: Ranjani Sridharan --- sound/soc/sof/debug-dsp-ops.c | 38 ++++++++++++++++++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) diff --git a/sound/soc/sof/debug-dsp-ops.c b/sound/soc/sof/debug-dsp-ops.c index bf3559cb88d855..b4e4f02615eb48 100644 --- a/sound/soc/sof/debug-dsp-ops.c +++ b/sound/soc/sof/debug-dsp-ops.c @@ -125,6 +125,38 @@ static ssize_t sof_dsp_ops_tester_dfs_read(struct file *file, char __user *buffe default: break; } + } else if (!strcmp(dentry->d_name.name, "fw_state")) { + switch (sdev->fw_state) { + case SOF_FW_BOOT_NOT_STARTED: + string = "NOT STARTED\n"; + break; + case SOF_DSPLESS_MODE: + string = "DSPLESS MODE\n"; + break; + case SOF_FW_BOOT_PREPARE: + string = "PREPARE\n"; + break; + case SOF_FW_BOOT_IN_PROGRESS: + string = "IN PROGRESS\n"; + break; + case SOF_FW_BOOT_FAILED: + string = "FAILED\n"; + break; + case SOF_FW_BOOT_READY_FAILED: + string = "READY FAILED\n"; + break; + case SOF_FW_BOOT_READY_OK: + string = "READY OK\n"; + break; + case SOF_FW_BOOT_COMPLETE: + string = "COMPLETE\n"; + break; + case SOF_FW_CRASHED: + string = "CRASHED\n"; + break; + default: + break; + } } else { return 0; } @@ -249,5 +281,9 @@ int sof_dbg_dsp_ops_test_init(struct snd_sof_dev *sdev) if (ret < 0) return ret; - return sof_dsp_dsp_ops_create_dfse(sdev, "dsp_power_state", dsp_ops_debugfs, 0666); + ret = sof_dsp_dsp_ops_create_dfse(sdev, "dsp_power_state", dsp_ops_debugfs, 0666); + if (ret < 0) + return ret; + + return sof_dsp_dsp_ops_create_dfse(sdev, "fw_state", dsp_ops_debugfs, 0444); }