From 3d92e438cdb9db59a49ed1a5819adc1e394c5f06 Mon Sep 17 00:00:00 2001 From: Ranjani Sridharan Date: Wed, 17 Apr 2024 17:29:50 -0700 Subject: [PATCH] ASoC: SOF: debug-dsp-ops: Add ops for trace init/free These will be used to debugging purposes when testing the different DSP ops. Signed-off-by: Ranjani Sridharan Reviewed-by: Pierre-Louis Bossart Reviewed-by: Liam Girdwood --- sound/soc/sof/debug-dsp-ops.c | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/sound/soc/sof/debug-dsp-ops.c b/sound/soc/sof/debug-dsp-ops.c index 9f62fa4ab4fdfb..02215f124cb5ad 100644 --- a/sound/soc/sof/debug-dsp-ops.c +++ b/sound/soc/sof/debug-dsp-ops.c @@ -48,6 +48,15 @@ static int sof_dsp_ops_set_power_state(struct snd_sof_dev *sdev, char *state) return 0; } +static int sof_dsp_ops_trace_init(struct snd_sof_dev *sdev, bool init) +{ + if (init) + return sof_fw_trace_init(sdev); + + sof_fw_trace_free(sdev); + return 0; +} + static void sof_dsp_ops_unload_firmware(struct snd_sof_dev *sdev) { /* release the currently loaded firmware */ @@ -202,6 +211,13 @@ static ssize_t sof_dsp_ops_tester_dfs_write(struct file *file, const char __user size_t size; char *string; + + if (!strcmp(dentry->d_name.name, "init_trace")) + return sof_dsp_ops_trace_init(sdev, true); + + if (!strcmp(dentry->d_name.name, "free_trace")) + return sof_dsp_ops_trace_init(sdev, false); + if (!strcmp(dentry->d_name.name, "unload_fw")) { string = kzalloc(count + 1, GFP_KERNEL); if (!string) @@ -330,5 +346,13 @@ 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, "unload_fw", dsp_ops_debugfs, 0222); + ret = sof_dsp_dsp_ops_create_dfse(sdev, "unload_fw", dsp_ops_debugfs, 0222); + if (ret < 0) + return ret; + + ret = sof_dsp_dsp_ops_create_dfse(sdev, "init_trace", dsp_ops_debugfs, 0222); + if (ret < 0) + return ret; + + return sof_dsp_dsp_ops_create_dfse(sdev, "free_trace", dsp_ops_debugfs, 0222); }