ASoC: dapm: Add API call to query valid DAPM paths.
PATCH 1/1 ASoC: dapm: Add API call to query valid DAPM paths.
Add a DAPM API call to determine whether a DAPM audio path is valid between source and sink widgets. This also takes into account all kcontrol mux and mixer settings in between the source and sink widgets to validate the audio path.
This will be used by the Dynamic PCM core to determine the runtime DAI mappings between FE and BE DAIs in order to run PCM operations.
This also adds some extra debug to help with graph debugging.
--- include/sound/soc-dapm.h | 5 ++ sound/soc/soc-dapm.c | 127 ++++++++++++++++++++++++++++++++++++++++++---- 2 files changed, 122 insertions(+), 10 deletions(-)
include/sound/soc-dapm.h +5 -0
@@ -323,6 +323,7 @@ struct snd_soc_dapm_path;struct snd_soc_dapm_pin ;struct snd_soc_dapm_route ;struct snd_soc_dapm_context ; +struct snd_soc_dapm_widget_list ;int dapm_reg_event (struct snd_soc_dapm_widget *w,struct snd_kcontrol *kcontrol,int event);
@@ -401,6 +402,10 @@ void snd_soc_dapm_auto_nc_codec_pins(struct snd_soc_codec *codec);/* Mostly internal - should not normally be used */ void dapm_mark_dirty (struct snd_soc_dapm_widget *w,const char *reason); +/* dapm path query */ +int snd_soc_dapm_dai_get_connected_widgets (struct snd_soc_dai *dai,int stream, +struct snd_soc_dapm_widget_list **list); +/* dapm widget types */ enum snd_soc_dapm_type { snd_soc_dapm_input =0 ,/* input pin */
sound/soc/soc-dapm.c +117 -10
191 lines not on this page · raw message
Signature · 1 line
1.7.5.4
Quoted 1 line · Liam Girdwood
+struct
snd_soc_dapm_widget_list;
I might be blind but I think the hunk that actually declares the widget list got dropped from the header... probably in some other part of the series you haven't pushed out yet?
sound/soc/soc-dapm.c static int is_connected_output_ep(struct snd_soc_dapm_widget *widget) · line 809
Quoted 4 lines
sound/soc/soc-dapm.c +4
-0+dev_vdbg (widget->dapm->dev," %c : %s -> %s -> %s\n" , + path->sink && path->connect ?'*' :' ' , + widget->name, path->name, path->sink->name); +
This and the input user look like good candidates for a tracepoint, it's probably pretty useful to have them around and more accessible than vdbg is. It's the sort of information people often look for, and it's real time unlike the debugfs picture which isn't capturing stuff when DAPM is looking at it.
sound/soc/soc-dapm.c static int is_connected_input_ep(struct snd_soc_dapm_widget *widget) · line 953
Quoted 1 line
sound/soc/soc-dapm.c +1
-0+dapm_reset (card);
This function isn't in mainline, another patch series reordering thing I expect. It does also look like we need some locking somewhere along the line here (even if the only thing here is a big scary comment saying the relevant locks need to be held).
sound/soc/soc-dapm.c static int is_connected_input_ep(struct snd_soc_dapm_widget *widget) · line 961
Quoted 2 lines
sound/soc/soc-dapm.c +2
-0+dev_dbg (dai->dev,"%s: found %d paths\n" , + stream ?"capture" :"playback" , paths);
Tracepoint again? Much less clear for this one. I do think we should be dumping the stats we've been collecting for the neighbour walks, very useful if performance blows up again.
Quoted 7 lines · Mark Brown
Quoted 1 line · Liam Girdwood
+struct
snd_soc_dapm_widget_list;I might be blind but I think the hunk that actually declares the widget list got dropped from the header... probably in some other part of the series you haven't pushed out yet?
I had to double check myself to be sure and Stephen added it a while back :-
fafd2176f72148e83c64a1f818ff33fceed83d08
Quoted 12 lines
sound/soc/soc-dapm.c static int is_connected_output_ep(struct snd_soc_dapm_widget *widget) · line 809
Quoted 5 lines
sound/soc/soc-dapm.c +4
-0+dev_vdbg (widget->dapm->dev," %c : %s -> %s -> %s\n" , + path->sink && path->connect ?'*' :' ' , + widget->name, path->name, path->sink->name); +This and the input user look like good candidates for a tracepoint, it's probably pretty useful to have them around and more accessible than vdbg is. It's the sort of information people often look for, and it's real time unlike the debugfs picture which isn't capturing stuff when DAPM is looking at it.
Quoted 4 lines
sound/soc/soc-dapm.c static int is_connected_input_ep(struct snd_soc_dapm_widget *widget) · line 953
Quoted 1 line
sound/soc/soc-dapm.c +1
-0+dapm_reset (card);This function isn't in mainline, another patch series reordering thing I expect.
It's in 6c120e19fa587710d80757a6e364961a017fb6c3
Quoted 3 lines
It does also look like we need some locking somewhere along the line here (even if the only thing here is a big scary comment saying the relevant locks need to be held).
Oh yeah, this was post the mutex patches and got missed.
Quoted 7 lines
sound/soc/soc-dapm.c static int is_connected_input_ep(struct snd_soc_dapm_widget *widget) · line 961
Quoted 3 lines
sound/soc/soc-dapm.c +2
-0+dev_dbg (dai->dev,"%s: found %d paths\n" , + stream ?"capture" :"playback" , paths);Tracepoint again? Much less clear for this one. I do think we should be dumping the stats we've been collecting for the neighbour walks, very useful if performance blows up again.
Yep, Tracepoint it is then.
Liam
Quoted 10 lines · Liam Girdwood
Quoted 3 lines · Mark Brown
I might be blind but I think the hunk that actually declares the widget list got dropped from the header... probably in some other part of the series you haven't pushed out yet?
I had to double check myself to be sure and Stephen added it a while back :-
fafd2176f72148e83c64a1f818ff33fceed83d08
Oh, sorry about that - I didn't check the actual code for that one as I saw you adding the forward declaration and normally we're fairly good about always adding those so I figured it was a missing diff hunk.
Quoted 6 lines
Quoted 4 lines
sound/soc/soc-dapm.c static int is_connected_input_ep(struct snd_soc_dapm_widget *widget) · line 953
Quoted 1 line
sound/soc/soc-dapm.c +1
-0+dapm_reset (card);This function isn't in mainline, another patch series reordering thing I expect.
It's in
6c120e19fa587710d80757a6e364961a017fb6c3
This one I definitely did check, must've been on a separate branch and didn't notice properly.