Commit 5b1047dc authored by Luca Ceresoli's avatar Luca Ceresoli Committed by Mark Brown

ASoC: dapm: debugfs: show the widget type

To make the widget debugfs files more informative, add a line showing the
widget type string.

Keeping backward compatibility is nice to have being debugfs, and ease of
parsing by both humans and software is also good. To maximize both with a
reasonable effort add a new line without thouching the already complex
format of the first line. The syntax is meant to be a key/value pair.

The existing vizdapm tool continues working after this change, ignoring the
new line.

The new format is:

  Left ADC: Off  in 1 out 0 - R2(0x2) mask 0x2
   stream Left HiFi Capture inactive
   widget-type adc
   out  "static" "Capture" "cs42l51.0-004a"
   in  "static" "Left PGA" "cs42l51.0-004a"
Signed-off-by: default avatarLuca Ceresoli <luca.ceresoli@bootlin.com>
Reviewed-by: default avatarAlexandre Belloni <alexandre.belloni@bootlin.com>
Link: https://lore.kernel.org/r/20240416-vizdapm-ng-v1-2-5d33c0b57bc5@bootlin.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent cbd9eed8
...@@ -2094,6 +2094,48 @@ static int dapm_power_widgets(struct snd_soc_card *card, int event) ...@@ -2094,6 +2094,48 @@ static int dapm_power_widgets(struct snd_soc_card *card, int event)
} }
#ifdef CONFIG_DEBUG_FS #ifdef CONFIG_DEBUG_FS
static const char * const snd_soc_dapm_type_name[] = {
[snd_soc_dapm_input] = "input",
[snd_soc_dapm_output] = "output",
[snd_soc_dapm_mux] = "mux",
[snd_soc_dapm_demux] = "demux",
[snd_soc_dapm_mixer] = "mixer",
[snd_soc_dapm_mixer_named_ctl] = "mixer_named_ctl",
[snd_soc_dapm_pga] = "pga",
[snd_soc_dapm_out_drv] = "out_drv",
[snd_soc_dapm_adc] = "adc",
[snd_soc_dapm_dac] = "dac",
[snd_soc_dapm_micbias] = "micbias",
[snd_soc_dapm_mic] = "mic",
[snd_soc_dapm_hp] = "hp",
[snd_soc_dapm_spk] = "spk",
[snd_soc_dapm_line] = "line",
[snd_soc_dapm_switch] = "switch",
[snd_soc_dapm_vmid] = "vmid",
[snd_soc_dapm_pre] = "pre",
[snd_soc_dapm_post] = "post",
[snd_soc_dapm_supply] = "supply",
[snd_soc_dapm_pinctrl] = "pinctrl",
[snd_soc_dapm_regulator_supply] = "regulator_supply",
[snd_soc_dapm_clock_supply] = "clock_supply",
[snd_soc_dapm_aif_in] = "aif_in",
[snd_soc_dapm_aif_out] = "aif_out",
[snd_soc_dapm_siggen] = "siggen",
[snd_soc_dapm_sink] = "sink",
[snd_soc_dapm_dai_in] = "dai_in",
[snd_soc_dapm_dai_out] = "dai_out",
[snd_soc_dapm_dai_link] = "dai_link",
[snd_soc_dapm_kcontrol] = "kcontrol",
[snd_soc_dapm_buffer] = "buffer",
[snd_soc_dapm_scheduler] = "scheduler",
[snd_soc_dapm_effect] = "effect",
[snd_soc_dapm_src] = "src",
[snd_soc_dapm_asrc] = "asrc",
[snd_soc_dapm_encoder] = "encoder",
[snd_soc_dapm_decoder] = "decoder",
};
static ssize_t dapm_widget_power_read_file(struct file *file, static ssize_t dapm_widget_power_read_file(struct file *file,
char __user *user_buf, char __user *user_buf,
size_t count, loff_t *ppos) size_t count, loff_t *ppos)
...@@ -2106,6 +2148,8 @@ static ssize_t dapm_widget_power_read_file(struct file *file, ...@@ -2106,6 +2148,8 @@ static ssize_t dapm_widget_power_read_file(struct file *file,
struct snd_soc_dapm_path *p = NULL; struct snd_soc_dapm_path *p = NULL;
const char *c_name; const char *c_name;
BUILD_BUG_ON(ARRAY_SIZE(snd_soc_dapm_type_name) != SND_SOC_DAPM_TYPE_COUNT);
buf = kmalloc(PAGE_SIZE, GFP_KERNEL); buf = kmalloc(PAGE_SIZE, GFP_KERNEL);
if (!buf) if (!buf)
return -ENOMEM; return -ENOMEM;
...@@ -2137,6 +2181,9 @@ static ssize_t dapm_widget_power_read_file(struct file *file, ...@@ -2137,6 +2181,9 @@ static ssize_t dapm_widget_power_read_file(struct file *file,
w->sname, w->sname,
w->active ? "active" : "inactive"); w->active ? "active" : "inactive");
ret += scnprintf(buf + ret, PAGE_SIZE - ret, " widget-type %s\n",
snd_soc_dapm_type_name[w->id]);
snd_soc_dapm_for_each_direction(dir) { snd_soc_dapm_for_each_direction(dir) {
rdir = SND_SOC_DAPM_DIR_REVERSE(dir); rdir = SND_SOC_DAPM_DIR_REVERSE(dir);
snd_soc_dapm_widget_for_each_path(w, dir, p) { snd_soc_dapm_widget_for_each_path(w, dir, p) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment