Skip to content

Commit

Permalink
ASoC: SOF: debug-dsp-ops: Add a new debugfs entry to read current DSP…
Browse files Browse the repository at this point in the history
… state

Add a read-only debugfs entry to read the current FW boot state.

Signed-off-by: Ranjani Sridharan <[email protected]>
  • Loading branch information
ranj063 committed Mar 25, 2024
1 parent 84ac120 commit e15cf2c
Showing 1 changed file with 37 additions and 1 deletion.
38 changes: 37 additions & 1 deletion sound/soc/sof/debug-dsp-ops.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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);
}

0 comments on commit e15cf2c

Please sign in to comment.