Lines Matching +full:audio +full:- +full:graph +full:- +full:card
2 # SPDX-License-Identifier: GPL-2.0
4 # Generate a graph of the current DAPM state for an audio card
9 set -eu
22 if [ "${1}" -ne 0 ]; then
27 Generate a graph of the current DAPM state for an audio card.
29 The DAPM state can be obtained via debugfs for a card on the local host or
30 a remote target, or from a local copy of the debugfs tree for the card.
33 $(basename $0) [options] -c CARD - Local sound card
34 $(basename $0) [options] -c CARD -r REMOTE_TARGET - Card on remote system
35 $(basename $0) [options] -d STATE_DIR - Local directory
38 -c CARD Sound card to get DAPM state of
39 -r REMOTE_TARGET Get DAPM state from REMOTE_TARGET via SSH and SCP
40 instead of using a local sound card
41 -d STATE_DIR Get DAPM state from a local copy of a debugfs tree
42 -o OUT_FILE Output file (default: dapm.dot)
43 -D Show verbose debugging info
44 -h Print this help and exit
48 * Use the .dot extension to generate a text graph representation in
63 # $2 = sound card name
69 # Note: the tarball is needed because plain 'scp -r' from debugfs would
77 set -eu &&
79 find * -type d -exec mkdir -p ${3}/dapm-tree/{} \; &&
80 find * -type f -exec cp \"{}\" \"${3}/dapm-tree/{}\" \; &&
81 cd ${3}/dapm-tree &&
83 scp -q "${1}:${3}/dapm.tar" "${3}"
85 mkdir -p "${4}"
86 tar xf "${tmp_dir}/dapm.tar" -C "${4}"
89 # Parse a widget file and generate graph description in graphviz dot format
116 if echo "${line}" | grep -q ': On '
124 if echo "${line}" | grep -q '^widget-type '; then
125 local w_type_raw="$(echo "$line" | cut -d ' ' -f 2)"
126 dbg_echo " - Widget type: ${w_type_raw}"
136 if echo "${line}" | grep -q '^in '; then
137 local w_route=$(echo "$line" | awk -F\" '{print $2}')
139 awk -F\" '{print $6 "_" $4}' |
141 dbg_echo " - Input route from: ${w_src}"
142 dbg_echo " - Route: ${w_route}"
147 echo " \"${w_src}\" -> \"$w_tag\"${w_edge_attrs}" >> "${links_file}"
156 # Parse the DAPM tree for a sound card component and generate graph
161 # $3 = "ROOT" for the root card directory, empty otherwise
172 if [ -z "${c_name}" ]; then
176 # "./cs42l51.0-004a/dapm" -> "cs42l51.0-004a"
183 if [ -f "${c_dir}/bias_level" ]; then
184 c_onoff=$(sed -n -e 1p "${c_dir}/bias_level" | awk '{print $1}')
185 dbg_echo " - bias_level: ${c_onoff}"
215 # Parse the DAPM tree for a sound card and generate graph description in
227 echo " fontname=\"sans-serif\"" >> "${dot_file}"
228 echo " node [fontname=\"sans-serif\"]" >> "${dot_file}"
229 echo " edge [fontname=\"sans-serif\"]" >> "${dot_file}"
262 shift $(($OPTIND - 1))
264 if [ -n "${dapm_tree}" ]; then
265 if [ -n "${card_name}${remote_target}" ]; then
266 usage 1 "Cannot use -c and -r with -d"
269 elif [ -n "${remote_target}" ]; then
270 if [ -z "${card_name}" ]; then
271 usage 1 "-r requires -c"
273 echo "Using card ${card_name} from remote target ${remote_target}"
274 elif [ -n "${card_name}" ]; then
275 echo "Using local card: ${card_name}"
277 usage 1 "Please choose mode using -c, -r or -d"
293 if ! echo "${out_file}" | grep -qE '\.'; then
306 tmp_dir="$(mktemp -d /tmp/$(basename $0).XXXXXX)"
307 trap "{ rm -fr ${tmp_dir}; }" INT TERM EXIT
309 if [ -z "${dapm_tree}" ]
313 if [ -n "${remote_target}" ]; then
314 dapm_tree="${tmp_dir}/dapm-tree"
323 dot -T"${out_fmt}" "${dot_file}" -o "${out_file}"