On Mon, Aug 22, 2022 at 05:10:41PM +0100, Mark Brown wrote: > On Mon, Aug 22, 2022 at 03:11:48PM +0200, Martin Povišer wrote: > > > On 22. 8. 2022, at 15:04, Mark Brown <broonie@xxxxxxxxxx> wrote: > > > On Mon, Aug 22, 2022 at 02:38:09PM +0200, Martin Povišer wrote: > > > >> simply having a ‘graph.dot’ at hand, especially since it requires > > >> little code. (Although sure there’s the danger of it growing.) > > > > I'm also worried about people going in and wanting other more tool > > > specific formats adding, if we didn't have anything at all it'd be one > > > thing but we do have something. > > > Sure, although I would argue DOT is by a large margin the standard > > format to represent graphs in. > > Well, the debugfs stuff there is more a general tool for introspecting > the current DAPM state than it is indended to draw a pretty picture. > When I wrote it the scale of the devices I was working with was such > that I'm not usre a full graph would've been terribly useful, and > there's even larger devices since then (though also a lot of systems > like yours which do use very much smaller devices). I still seem to have a copy of Dimitris's tool lying around (attached), yes apologies we don't seem to have that publicly hosted anymore at some point it feels like we need to look at what was lost when the older Wolfson stuff was shutdown. Thanks, Charles
#!/bin/bash # # Copyright 2011, 2012, 2013 Wolfson Microelectronics plc # Author: Dimitris Papastamos <dp@xxxxxxxxxxxxxxxxxxxxxxxxxxx> # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License version 2 as # published by the Free Software Foundation. # # A tool to generate a visual graph of the current DAPM configuration. # Active paths are shown in green, inactive in red. # # This program requires `graphviz' to be installed. if [ $# -ne 2 ]; then echo "usage: $(basename $0) dapm-debugfs-path out-png" 1>&2 exit 1 fi widgets="$1" outpng="$2" graphviztmp=$(mktemp) trap "{ rm -f $graphviztmp; exit 1; }" SIGINT SIGTERM EXIT widget_active() { local w="$1" head -1 "$w" | grep -q ': On' if [ "$?" -eq 0 ]; then echo 1 else echo 0 fi } echo "digraph G {" > "$graphviztmp" echo -e "\tbgcolor = grey" >> "$graphviztmp" cd "$widgets" for widget in *; do echo -n "Parsing widget $widget..." while read line; do echo "${line}" | grep -q '^in' if [ ! "$?" -eq 0 ]; then continue fi source=$(echo "$line" | awk -F\" '{print $4}') active=$(widget_active "$widget") if [ "$active" -eq 1 ]; then echo -e "\t\"$source\" [color = green]" >> "$graphviztmp" echo -e "\t\"$widget\" [color = green]" >> "$graphviztmp" else echo -e "\t\"$source\" [color = red]" >> "$graphviztmp" echo -e "\t\"$widget\" [color = red]" >> "$graphviztmp" fi echo -e "\t\"$source\" -> \"$widget\"" >> "$graphviztmp" done < "$widget" echo "OK!" done cd - >/dev/null echo "}" >> "$graphviztmp" echo -n "Generating $outpng..." dot -Kfdp -Tpng "$graphviztmp" -o "$outpng" echo "OK!"