Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

ASoC: dapm-graph: add component on/off and route names

Merge series from Luca Ceresoli <luca.ceresoli@bootlin.com>:

This small series adds some improvements to dapm-graph in order to produce
a more correct and informative graph.

+35 -9
+35 -9
tools/sound/dapm-graph
··· 8 8 9 9 set -eu 10 10 11 + STYLE_COMPONENT_ON="color=dodgerblue;style=bold" 12 + STYLE_COMPONENT_OFF="color=gray40;style=filled;fillcolor=gray90" 11 13 STYLE_NODE_ON="shape=box,style=bold,color=green4" 12 14 STYLE_NODE_OFF="shape=box,style=filled,color=gray30,fillcolor=gray95" 13 15 ··· 134 132 # Collect any links. We could use "in" links or "out" links, 135 133 # let's use "in" links 136 134 if echo "${line}" | grep -q '^in '; then 135 + local w_route=$(echo "$line" | awk -F\" '{print $2}') 137 136 local w_src=$(echo "$line" | 138 137 awk -F\" '{print $6 "_" $4}' | 139 138 sed 's/^(null)_/ROOT_/') 140 139 dbg_echo " - Input route from: ${w_src}" 141 - echo " \"${w_src}\" -> \"$w_tag\"" >> "${links_file}" 140 + dbg_echo " - Route: ${w_route}" 141 + local w_edge_attrs="" 142 + if [ "${w_route}" != "static" ]; then 143 + w_edge_attrs=" [label=\"${w_route}\"]" 144 + fi 145 + echo " \"${w_src}\" -> \"$w_tag\"${w_edge_attrs}" >> "${links_file}" 142 146 fi 143 147 done 144 148 ··· 158 150 # 159 151 # $1 = temporary work dir 160 152 # $2 = component directory 161 - # $3 = forced component name (extracted for path if empty) 153 + # $3 = "ROOT" for the root card directory, empty otherwise 162 154 process_dapm_component() 163 155 { 164 156 local tmp_dir="${1}" 165 157 local c_dir="${2}" 166 158 local c_name="${3}" 159 + local is_component=0 167 160 local dot_file="${tmp_dir}/main.dot" 168 161 local links_file="${tmp_dir}/links.dot" 162 + local c_attribs="" 169 163 170 164 if [ -z "${c_name}" ]; then 165 + is_component=1 166 + 171 167 # Extract directory name into component name: 172 168 # "./cs42l51.0-004a/dapm" -> "cs42l51.0-004a" 173 169 c_name="$(basename $(dirname "${c_dir}"))" ··· 179 167 180 168 dbg_echo " * Component: ${c_name}" 181 169 182 - echo "" >> "${dot_file}" 183 - echo " subgraph \"${c_name}\" {" >> "${dot_file}" 184 - echo " cluster = true" >> "${dot_file}" 185 - echo " label = \"${c_name}\"" >> "${dot_file}" 186 - echo " color=dodgerblue" >> "${dot_file}" 170 + if [ ${is_component} = 1 ]; then 171 + if [ -f "${c_dir}/bias_level" ]; then 172 + c_onoff=$(sed -n -e 1p "${c_dir}/bias_level" | awk '{print $1}') 173 + dbg_echo " - bias_level: ${c_onoff}" 174 + if [ "$c_onoff" = "On" ]; then 175 + c_attribs="${STYLE_COMPONENT_ON}" 176 + elif [ "$c_onoff" = "Off" ]; then 177 + c_attribs="${STYLE_COMPONENT_OFF}" 178 + fi 179 + fi 180 + 181 + echo "" >> "${dot_file}" 182 + echo " subgraph \"${c_name}\" {" >> "${dot_file}" 183 + echo " cluster = true" >> "${dot_file}" 184 + echo " label = \"${c_name}\"" >> "${dot_file}" 185 + echo " ${c_attribs}" >> "${dot_file}" 186 + fi 187 187 188 188 # Create empty file to ensure it will exist in all cases 189 189 >"${links_file}" ··· 205 181 process_dapm_widget "${tmp_dir}" "${c_name}" "${w_file}" 206 182 done 207 183 208 - echo " }" >> "${dot_file}" 184 + if [ ${is_component} = 1 ]; then 185 + echo " }" >> "${dot_file}" 186 + fi 209 187 210 188 cat "${links_file}" >> "${dot_file}" 211 189 } ··· 226 200 echo "digraph G {" > "${dot_file}" 227 201 echo " fontname=\"sans-serif\"" >> "${dot_file}" 228 202 echo " node [fontname=\"sans-serif\"]" >> "${dot_file}" 229 - 203 + echo " edge [fontname=\"sans-serif\"]" >> "${dot_file}" 230 204 231 205 # Process root directory (no component) 232 206 process_dapm_component "${tmp_dir}" "${dapm_dir}/dapm" "ROOT"