Skip to content

Commit 5126224

Browse files
committed
ASoC: dapm: improve debugfs output and introduce
Merge series from Luca Ceresoli <luca.ceresoli@bootlin.com>: This patch series improves the tools available to understand and debug DAPM.
2 parents bd74e9c + e7bb438 commit 5126224

3 files changed

Lines changed: 361 additions & 2 deletions

File tree

MAINTAINERS

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20669,6 +20669,12 @@ F: include/trace/events/sof*.h
2066920669
F: include/uapi/sound/asoc.h
2067020670
F: sound/soc/
2067120671

20672+
SOUND - SOC LAYER / dapm-graph
20673+
M: Luca Ceresoli <luca.ceresoli@bootlin.com>
20674+
L: linux-sound@vger.kernel.org
20675+
S: Maintained
20676+
F: tools/sound/dapm-graph
20677+
2067220678
SOUND - SOUND OPEN FIRMWARE (SOF) DRIVERS
2067320679
M: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
2067420680
M: Liam Girdwood <lgirdwood@gmail.com>

sound/soc/soc-dapm.c

Lines changed: 52 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2094,6 +2094,48 @@ static int dapm_power_widgets(struct snd_soc_card *card, int event)
20942094
}
20952095

20962096
#ifdef CONFIG_DEBUG_FS
2097+
2098+
static const char * const snd_soc_dapm_type_name[] = {
2099+
[snd_soc_dapm_input] = "input",
2100+
[snd_soc_dapm_output] = "output",
2101+
[snd_soc_dapm_mux] = "mux",
2102+
[snd_soc_dapm_demux] = "demux",
2103+
[snd_soc_dapm_mixer] = "mixer",
2104+
[snd_soc_dapm_mixer_named_ctl] = "mixer_named_ctl",
2105+
[snd_soc_dapm_pga] = "pga",
2106+
[snd_soc_dapm_out_drv] = "out_drv",
2107+
[snd_soc_dapm_adc] = "adc",
2108+
[snd_soc_dapm_dac] = "dac",
2109+
[snd_soc_dapm_micbias] = "micbias",
2110+
[snd_soc_dapm_mic] = "mic",
2111+
[snd_soc_dapm_hp] = "hp",
2112+
[snd_soc_dapm_spk] = "spk",
2113+
[snd_soc_dapm_line] = "line",
2114+
[snd_soc_dapm_switch] = "switch",
2115+
[snd_soc_dapm_vmid] = "vmid",
2116+
[snd_soc_dapm_pre] = "pre",
2117+
[snd_soc_dapm_post] = "post",
2118+
[snd_soc_dapm_supply] = "supply",
2119+
[snd_soc_dapm_pinctrl] = "pinctrl",
2120+
[snd_soc_dapm_regulator_supply] = "regulator_supply",
2121+
[snd_soc_dapm_clock_supply] = "clock_supply",
2122+
[snd_soc_dapm_aif_in] = "aif_in",
2123+
[snd_soc_dapm_aif_out] = "aif_out",
2124+
[snd_soc_dapm_siggen] = "siggen",
2125+
[snd_soc_dapm_sink] = "sink",
2126+
[snd_soc_dapm_dai_in] = "dai_in",
2127+
[snd_soc_dapm_dai_out] = "dai_out",
2128+
[snd_soc_dapm_dai_link] = "dai_link",
2129+
[snd_soc_dapm_kcontrol] = "kcontrol",
2130+
[snd_soc_dapm_buffer] = "buffer",
2131+
[snd_soc_dapm_scheduler] = "scheduler",
2132+
[snd_soc_dapm_effect] = "effect",
2133+
[snd_soc_dapm_src] = "src",
2134+
[snd_soc_dapm_asrc] = "asrc",
2135+
[snd_soc_dapm_encoder] = "encoder",
2136+
[snd_soc_dapm_decoder] = "decoder",
2137+
};
2138+
20972139
static ssize_t dapm_widget_power_read_file(struct file *file,
20982140
char __user *user_buf,
20992141
size_t count, loff_t *ppos)
@@ -2104,6 +2146,9 @@ static ssize_t dapm_widget_power_read_file(struct file *file,
21042146
int in, out;
21052147
ssize_t ret;
21062148
struct snd_soc_dapm_path *p = NULL;
2149+
const char *c_name;
2150+
2151+
BUILD_BUG_ON(ARRAY_SIZE(snd_soc_dapm_type_name) != SND_SOC_DAPM_TYPE_COUNT);
21072152

21082153
buf = kmalloc(PAGE_SIZE, GFP_KERNEL);
21092154
if (!buf)
@@ -2136,6 +2181,9 @@ static ssize_t dapm_widget_power_read_file(struct file *file,
21362181
w->sname,
21372182
w->active ? "active" : "inactive");
21382183

2184+
ret += scnprintf(buf + ret, PAGE_SIZE - ret, " widget-type %s\n",
2185+
snd_soc_dapm_type_name[w->id]);
2186+
21392187
snd_soc_dapm_for_each_direction(dir) {
21402188
rdir = SND_SOC_DAPM_DIR_REVERSE(dir);
21412189
snd_soc_dapm_widget_for_each_path(w, dir, p) {
@@ -2145,11 +2193,13 @@ static ssize_t dapm_widget_power_read_file(struct file *file,
21452193
if (!p->connect)
21462194
continue;
21472195

2196+
c_name = p->node[rdir]->dapm->component ?
2197+
p->node[rdir]->dapm->component->name : NULL;
21482198
ret += scnprintf(buf + ret, PAGE_SIZE - ret,
2149-
" %s \"%s\" \"%s\"\n",
2199+
" %s \"%s\" \"%s\" \"%s\"\n",
21502200
(rdir == SND_SOC_DAPM_DIR_IN) ? "in" : "out",
21512201
p->name ? p->name : "static",
2152-
p->node[rdir]->name);
2202+
p->node[rdir]->name, c_name);
21532203
}
21542204
}
21552205

0 commit comments

Comments
 (0)