Skip to contentSkip to conversation

ASoC: Add a debug log to track DAPM widget power up/down

PATCH In review [email protected] 2 participants 4 messages May 24, 2019 – May 28, 2019

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ASoC: Add a debug log to track DAPM widget power up/down

From: Banajit Goswami <[email protected]>

Add a debug log to help track widgets being powered-up and powered-down by DAPM.

---
 sound/soc/soc-dapm.c | 7 +++++++
 1 file changed, 7 insertions(+)
sound/soc/soc-dapm.c +7 -0
index 29cdfbf4c888..9bab90410de5 100644
@@ -1665,6 +1665,13 @@ static void dapm_seq_run(struct snd_soc_card *card,
 			break;
 		}
 
+		/*
+		 * Add this debug log to keep track of widgets being
+		 * powered-up and powered-down.
+		 */
+		dev_dbg(w->dapm->dev, "dapm: powering %s widget %s\n",
+			power_up ? "up" : "down", w->name);
+
 		if (ret < 0)
 			dev_err(w->dapm->dev,
 				"ASoC: Failed to apply widget power: %d\n", ret);
Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project
maintainer
#1 lore raw
Quoted 4 lines · On Fri, May 24, 2019 at 12:54:27AM -0700, [email protected] wrote:

From: Banajit Goswami <[email protected]>

Add a debug log to help track widgets being powered-up and powered-down by DAPM.

We already have huge amounts of trace available via tracepoints and having something on by default in the debug logs seems like it's going to get very verbose for people who aren't specifically working on audio. What's the advantage of adding dev_dbg() logs as well?

#2 lore raw

Thanks Mark for the review!

Quoted 9 lines · Mark Brown
Quoted 4 lines · On Fri, May 24, 2019 at 12:54:27AM -0700, [email protected] wrote:

From: Banajit Goswami <[email protected]>

Add a debug log to help track widgets being powered-up and powered-down by DAPM.

We already have huge amounts of trace available via tracepoints and having something on by default in the debug logs seems like it's going to get very verbose for people who aren't specifically working on audio. What's the advantage of adding dev_dbg() logs as well?

Having this debug statement helps collecting logs about DAPM widget power

Up/Down sequence, which helps significantly during debugging. The advantage of

having the dev_dbg here are-

1. Do not need to enable trace, which helps collecting logs, without much know-how

about audio or kernel

2. Dynamic debug (using /sys/kernel/debug/dynamic_debug) can be enabled for

either just this line of code, or, for the function containing this debug statement.

This way, logs can be collected just for the DAPM widget enable/disable, and thereby

avoid having the output logs filled with unwanted logs.

3. Though I agree with you about the additional DAPM debug logs being present for

someone who may not be specifically working on Audio, based on the number of

widgets in the audio path used, the number of prints should be limited to only widget

power on/off.

Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project
maintainer
#3 lore raw
Quoted 6 lines · Banajit Goswami

having the dev_dbg here are-

1. Do not need to enable trace, which helps collecting logs, without much know-how

about audio or kernel

That approach results in kernel logs that are really hard to use and wrap round far too fast - if everything starts spamming the logs it does nothing for readability.

Quoted 9 lines

2. Dynamic debug (using /sys/kernel/debug/dynamic_debug) can be enabled for

either just this line of code, or, for the function containing this debug statement.

This way, logs can be collected just for the DAPM widget enable/disable, and thereby

avoid having the output logs filled with unwanted logs.

That's into needing to learn about the kernel at which point there's no real advantage of this approach.

Quoted 9 lines

3. Though I agree with you about the additional DAPM debug logs being present for

someone who may not be specifically working on Audio, based on the number of

widgets in the audio path used, the number of prints should be limited to only widget

power on/off.

Some devices are *much* bigger than others, and some systems will start and stop audio much more frequently than others (things like noises for taps for example) both of which will massively amplify the noise. Even when actively working on audio with those systems logging everything gets old really fast.