Commit 5a98c2e5 authored by Luca Ceresoli's avatar Luca Ceresoli Committed by Mark Brown

ASoC: dapm-graph: remove the "ROOT" cluster

Widgets not belonging to any component are currently represented inside a
cluster labeled "ROOT". This is not a correct representation of the actual
structure, as these widgets are not necessarily related to each other as
the ones inside actual components are.

Improve the graphical representation by not adding a cluster around these
widgets. Now a dot cluster represents a card component faithfully. This
will be particularly important with the upcoming improvements which will
visualize the component bias_level.
Signed-off-by: default avatarLuca Ceresoli <luca.ceresoli@bootlin.com>
Link: https://patch.msgid.link/20240823-dapm-graph-v1-1-989a47308c4c@bootlin.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent ca39fab8
...@@ -150,29 +150,32 @@ process_dapm_widget() ...@@ -150,29 +150,32 @@ process_dapm_widget()
# #
# $1 = temporary work dir # $1 = temporary work dir
# $2 = component directory # $2 = component directory
# $3 = forced component name (extracted for path if empty) # $3 = "ROOT" for the root card directory, empty otherwise
process_dapm_component() process_dapm_component()
{ {
local tmp_dir="${1}" local tmp_dir="${1}"
local c_dir="${2}" local c_dir="${2}"
local c_name="${3}" local c_name="${3}"
local is_component=0
local dot_file="${tmp_dir}/main.dot" local dot_file="${tmp_dir}/main.dot"
local links_file="${tmp_dir}/links.dot" local links_file="${tmp_dir}/links.dot"
if [ -z "${c_name}" ]; then if [ -z "${c_name}" ]; then
is_component=1
# Extract directory name into component name: # Extract directory name into component name:
# "./cs42l51.0-004a/dapm" -> "cs42l51.0-004a" # "./cs42l51.0-004a/dapm" -> "cs42l51.0-004a"
c_name="$(basename $(dirname "${c_dir}"))" c_name="$(basename $(dirname "${c_dir}"))"
echo "" >> "${dot_file}"
echo " subgraph \"${c_name}\" {" >> "${dot_file}"
echo " cluster = true" >> "${dot_file}"
echo " label = \"${c_name}\"" >> "${dot_file}"
echo " color=dodgerblue" >> "${dot_file}"
fi fi
dbg_echo " * Component: ${c_name}" dbg_echo " * Component: ${c_name}"
echo "" >> "${dot_file}"
echo " subgraph \"${c_name}\" {" >> "${dot_file}"
echo " cluster = true" >> "${dot_file}"
echo " label = \"${c_name}\"" >> "${dot_file}"
echo " color=dodgerblue" >> "${dot_file}"
# Create empty file to ensure it will exist in all cases # Create empty file to ensure it will exist in all cases
>"${links_file}" >"${links_file}"
...@@ -181,7 +184,9 @@ process_dapm_component() ...@@ -181,7 +184,9 @@ process_dapm_component()
process_dapm_widget "${tmp_dir}" "${c_name}" "${w_file}" process_dapm_widget "${tmp_dir}" "${c_name}" "${w_file}"
done done
echo " }" >> "${dot_file}" if [ ${is_component} = 1 ]; then
echo " }" >> "${dot_file}"
fi
cat "${links_file}" >> "${dot_file}" cat "${links_file}" >> "${dot_file}"
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment