From patchwork Fri Aug 23 07:45:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luca Ceresoli X-Patchwork-Id: 13774720 Received: from relay5-d.mail.gandi.net (relay5-d.mail.gandi.net [217.70.183.197]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3F0EEE56E; Fri, 23 Aug 2024 07:46:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.70.183.197 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724399183; cv=none; b=pU6rEs6e2HtTmvUHGmybgWn+FR0fggY90GWnGRHhjshSpf+QDFT2O10F8ErBUEJZ/smW901ASOtKsNh9CYURnoNTaOge4Vsa6MUk/dXzWSmEhbDPSKk2ez6C4j5PMWrML/uGrJO0t77/OJ/FlLU2X+8bPpoPDR4C3gkNV4iLn2g= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724399183; c=relaxed/simple; bh=1khzek1mpOyskhV/WZJAoR8W6Qt/xyLFvHy3BHVUR0U=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To; b=LxMxe7Cp0cODkpr9CReSJBw0UsPyp6/a8TzSvQBE11emAFiU9GHo1ecGT+tu2cJ1nCVsZ15vF3PztS86gvMchC3lK/zcu+GTSkjPZaxaOl6hLBaX9ArRl1sk7ilMTyMRXSRqDXFXpif+AjR/CZ9ZLsrMdiMoGc5q2HyvoAqLMA0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=X2ZzyKj8; arc=none smtp.client-ip=217.70.183.197 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="X2ZzyKj8" Received: by mail.gandi.net (Postfix) with ESMTPSA id 0C4B61C0009; Fri, 23 Aug 2024 07:46:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1724399179; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=7KUdMPyYR+5v/qbEBCxK1PceiwD8jwTiahptQXtojpk=; b=X2ZzyKj8urvzrqsk6k+8Gco8lshbdru3Cfe4yOA2RoURFXfJ/9fAPEqeh2epkG+7JNLFNf Vy6Z6XEgKmuCCl7xJhjJZDhvasgkbqiofJhPxILOyTKvDeqzRWuXzbwy0claYJh1skvIeB QCeAuf8UGy6wIpqdAvc1t7oZOsfrpr2K+ih56NJbH5kuhGegf+MupS200bkCgNYUFv7B3r o1K2eUYwGQDsqFo8RLleqw1xcUiGLkdHNLLPzXnZUzCcB4xkcjPZ08OXK8aLf5i4ZbfShI D4xwR94TGnFYjZvttpLDLT/z1UAhdlFtMzGQRM5S/7yB1eGb6XQPVP2Aez6n/A== From: Luca Ceresoli Date: Fri, 23 Aug 2024 09:45:59 +0200 Subject: [PATCH RESEND 1/3] ASoC: dapm-graph: remove the "ROOT" cluster Precedence: bulk X-Mailing-List: linux-sound@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240823-dapm-graph-v1-1-989a47308c4c@bootlin.com> References: <20240823-dapm-graph-v1-0-989a47308c4c@bootlin.com> In-Reply-To: <20240823-dapm-graph-v1-0-989a47308c4c@bootlin.com> To: Alexandre Belloni , Thomas Petazzoni , linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org, Luca Ceresoli , Mark Brown X-Mailer: b4 0.14.1 X-GND-Sasl: luca.ceresoli@bootlin.com 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: Luca Ceresoli --- tools/sound/dapm-graph | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/tools/sound/dapm-graph b/tools/sound/dapm-graph index 57d78f6df041..205783d124d3 100755 --- a/tools/sound/dapm-graph +++ b/tools/sound/dapm-graph @@ -150,29 +150,32 @@ process_dapm_widget() # # $1 = temporary work dir # $2 = component directory -# $3 = forced component name (extracted for path if empty) +# $3 = "ROOT" for the root card directory, empty otherwise process_dapm_component() { local tmp_dir="${1}" local c_dir="${2}" local c_name="${3}" + local is_component=0 local dot_file="${tmp_dir}/main.dot" local links_file="${tmp_dir}/links.dot" if [ -z "${c_name}" ]; then + is_component=1 + # Extract directory name into component name: # "./cs42l51.0-004a/dapm" -> "cs42l51.0-004a" 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 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 >"${links_file}" @@ -181,7 +184,9 @@ process_dapm_component() process_dapm_widget "${tmp_dir}" "${c_name}" "${w_file}" done - echo " }" >> "${dot_file}" + if [ ${is_component} = 1 ]; then + echo " }" >> "${dot_file}" + fi cat "${links_file}" >> "${dot_file}" } From patchwork Fri Aug 23 07:46:00 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luca Ceresoli X-Patchwork-Id: 13774721 Received: from relay5-d.mail.gandi.net (relay5-d.mail.gandi.net [217.70.183.197]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C3F7D1304B0; Fri, 23 Aug 2024 07:46:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.70.183.197 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724399183; cv=none; b=ohBOi1Ae5tM6vEVysl43tE/LziKS0eBP2ruIDbvFVGVnjSnJo5wQ3ju6kBY0M7RibKukH7lCaBe/NgQ/LjcHpoliDfAD+rkaeFo5q5dX07nmVmLGEebdKdMCm3e/EjgQuDB3kRkxd8n1LyWIsdjvkBHUxn5ZSDEjjOaaSmw6780= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724399183; c=relaxed/simple; bh=fAFSa1046tLaQ2J5k9hk59fp/d6a1Ubet9Edv7wJS/4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To; b=lAqbYLtHR8L/oDM5p0DBJO91aom4sHyS70Dd36EXShqVRPsXAcaLkBDgJJ4VjPBGbyyn6B2GUhhIObklP9uMfHyMhbCj7zlIRVEegkf/CPqX1vSa62gNGx+oAwfgGqBxwlt4RCIZj7im54uH2JVz5FlGTAzrHtOSliIrKS1cJOY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=DJRb4xhw; arc=none smtp.client-ip=217.70.183.197 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="DJRb4xhw" Received: by mail.gandi.net (Postfix) with ESMTPSA id 986E51C0003; Fri, 23 Aug 2024 07:46:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1724399180; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=8caC1Z562fBuPuBKeXYHWprDTaCdN40rYBd8+JqzFkQ=; b=DJRb4xhwqGH3ZIvBOG0cPUKSe+Z9+6OYj7xmc05kycLr89/mTQO1P1tocyJa0/IoFmOt0G wiUqfJklM0VHj+jIiTE6KnUu36rJI2wViHDLjNTOhuhrpWmYPeE7LVwIG0NPyvW5CYtarZ AlJzmMoUKx/wMGL+SJGEl1iEK7KQ5+E9DfBnjz1VqZ9PcAGA+i/BB9tGq1AhhtKXLP/1we 8QAT1410hFCMEJLSg6th5lmU/9CNSDvQyJQEpKts8BJ8SSsYx0rSMqCbWSCMiWqUQ5kpTV pON0PFvNqQ5KgDCcN1qVz9GC5SzpdKAkBa83HabnOXtqv4ZHvxe6Vn+BAlWfpA== From: Luca Ceresoli Date: Fri, 23 Aug 2024 09:46:00 +0200 Subject: [PATCH RESEND 2/3] ASoC: dapm-graph: visualize component On/Off bias level Precedence: bulk X-Mailing-List: linux-sound@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240823-dapm-graph-v1-2-989a47308c4c@bootlin.com> References: <20240823-dapm-graph-v1-0-989a47308c4c@bootlin.com> In-Reply-To: <20240823-dapm-graph-v1-0-989a47308c4c@bootlin.com> To: Alexandre Belloni , Thomas Petazzoni , linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org, Luca Ceresoli , Mark Brown X-Mailer: b4 0.14.1 X-GND-Sasl: luca.ceresoli@bootlin.com Read the bias_level debugfs files (ignored so far) and visualize the On/Off state of each component using different graphic attributes in the generated graph. Signed-off-by: Luca Ceresoli --- tools/sound/dapm-graph | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/tools/sound/dapm-graph b/tools/sound/dapm-graph index 205783d124d3..4e90883912d0 100755 --- a/tools/sound/dapm-graph +++ b/tools/sound/dapm-graph @@ -8,6 +8,8 @@ set -eu +STYLE_COMPONENT_ON="color=dodgerblue;style=bold" +STYLE_COMPONENT_OFF="color=gray40;style=filled;fillcolor=gray90" STYLE_NODE_ON="shape=box,style=bold,color=green4" STYLE_NODE_OFF="shape=box,style=filled,color=gray30,fillcolor=gray95" @@ -159,6 +161,7 @@ process_dapm_component() local is_component=0 local dot_file="${tmp_dir}/main.dot" local links_file="${tmp_dir}/links.dot" + local c_attribs="" if [ -z "${c_name}" ]; then is_component=1 @@ -166,16 +169,28 @@ process_dapm_component() # Extract directory name into component name: # "./cs42l51.0-004a/dapm" -> "cs42l51.0-004a" c_name="$(basename $(dirname "${c_dir}"))" + fi + + dbg_echo " * Component: ${c_name}" + + if [ ${is_component} = 1 ]; then + if [ -f "${c_dir}/bias_level" ]; then + c_onoff=$(sed -n -e 1p "${c_dir}/bias_level" | awk '{print $1}') + dbg_echo " - bias_level: ${c_onoff}" + if [ "$c_onoff" = "On" ]; then + c_attribs="${STYLE_COMPONENT_ON}" + elif [ "$c_onoff" = "Off" ]; then + c_attribs="${STYLE_COMPONENT_OFF}" + fi + fi 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}" + echo " ${c_attribs}" >> "${dot_file}" fi - dbg_echo " * Component: ${c_name}" - # Create empty file to ensure it will exist in all cases >"${links_file}" From patchwork Fri Aug 23 07:46:01 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luca Ceresoli X-Patchwork-Id: 13774722 Received: from relay5-d.mail.gandi.net (relay5-d.mail.gandi.net [217.70.183.197]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2C53F137932; Fri, 23 Aug 2024 07:46:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.70.183.197 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724399184; cv=none; b=VHMhxDNCDGP1Q0sX+VRiJbqU0PPYVhHY1f6Chy4oez4mChFEb/G7JrvzDkJ6HoCs160+NM3YfoyxzydWaXOMzdD2/dYnPerGmb7SMl+APg9PBx+BTvvYgIvw8sKuvlbqCVc3fKg8ch7eI6KqefxbCg9bjHCfFBSGfWEC1GfGLTA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724399184; c=relaxed/simple; bh=PhiycFAZ6DUxwrLFqux1DsdRyTs30I96gw95dsbO5ZE=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To; b=M86by1a/W4+55zgbKs5kIWDmNZEY1Z8FpRgJWtqb6Tq5E+fyuuaowSmsS7t29ur29XA9L10YdopZBtWBj3Gd5fQSdRJoCpGwak2JImQdvMdm4Iae6OcnZjWlGng4C3BvHNBbUuWeXbG2FrtHFpuvV8MdZeWkrGlpTRs9tZEEtKQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=Meh10dmP; arc=none smtp.client-ip=217.70.183.197 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="Meh10dmP" Received: by mail.gandi.net (Postfix) with ESMTPSA id 335C31C000A; Fri, 23 Aug 2024 07:46:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1724399180; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=gVscAZKiR7cHF1VmeHRXuAuQ1Thqw8JJ9KJo8HLfQHg=; b=Meh10dmPXL587/64sNZbmFs6JiqXpgSLeR9CGzhN/o+4qMNQ56Cg1qnaQPz/7vu2C1PmJu YwRY6LqHWg8KMvV25I5oI9Ambfr0b40mKDGUyi0uraoXW/V+hDrLr1cqUNkRm8y/Go25Qj RVTwv+gZImJ3aRTtV3z8s3KYi89bj20NZfoJG6+O74zHpAusWOfRMPx6T+Ma02C91RDsRa zCT0YoNgrv6p2qPZQ8ZTeiXJQodfAoQydic5OQSZS36ujhe4sblp8/pGh5SXIJ76MLPWx8 VPhtTCJ/kDDf7fOihLi2cNuWDAeCzX7vSJcZbw9fJn16Bsiy7j9PIBhapVnDAA== From: Luca Ceresoli Date: Fri, 23 Aug 2024 09:46:01 +0200 Subject: [PATCH RESEND 3/3] ASoC: dapm-graph: show path name for non-static routes Precedence: bulk X-Mailing-List: linux-sound@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240823-dapm-graph-v1-3-989a47308c4c@bootlin.com> References: <20240823-dapm-graph-v1-0-989a47308c4c@bootlin.com> In-Reply-To: <20240823-dapm-graph-v1-0-989a47308c4c@bootlin.com> To: Alexandre Belloni , Thomas Petazzoni , linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org, Luca Ceresoli , Mark Brown X-Mailer: b4 0.14.1 X-GND-Sasl: luca.ceresoli@bootlin.com Many routes are just static, not modifiable at runtime. Show the route name for all the other routes as an edge label in the generated graph. Signed-off-by: Luca Ceresoli --- tools/sound/dapm-graph | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/tools/sound/dapm-graph b/tools/sound/dapm-graph index 4e90883912d0..f14bdfedee8f 100755 --- a/tools/sound/dapm-graph +++ b/tools/sound/dapm-graph @@ -134,11 +134,17 @@ process_dapm_widget() # Collect any links. We could use "in" links or "out" links, # let's use "in" links if echo "${line}" | grep -q '^in '; then + local w_route=$(echo "$line" | awk -F\" '{print $2}') local w_src=$(echo "$line" | awk -F\" '{print $6 "_" $4}' | sed 's/^(null)_/ROOT_/') dbg_echo " - Input route from: ${w_src}" - echo " \"${w_src}\" -> \"$w_tag\"" >> "${links_file}" + dbg_echo " - Route: ${w_route}" + local w_edge_attrs="" + if [ "${w_route}" != "static" ]; then + w_edge_attrs=" [label=\"${w_route}\"]" + fi + echo " \"${w_src}\" -> \"$w_tag\"${w_edge_attrs}" >> "${links_file}" fi done @@ -220,7 +226,7 @@ process_dapm_tree() echo "digraph G {" > "${dot_file}" echo " fontname=\"sans-serif\"" >> "${dot_file}" echo " node [fontname=\"sans-serif\"]" >> "${dot_file}" - + echo " edge [fontname=\"sans-serif\"]" >> "${dot_file}" # Process root directory (no component) process_dapm_component "${tmp_dir}" "${dapm_dir}/dapm" "ROOT"