From: Ivan Verbovoy via B4 Relay <devnull+ivanverbovoy.gmail.com@kernel.org>
To: Srinivas Kandagatla <srini@kernel.org>,
Liam Girdwood <lgirdwood@gmail.com>,
Mark Brown <broonie@kernel.org>,
Jaroslav Kysela <perex@perex.cz>, Takashi Iwai <tiwai@suse.com>,
Pierre-Louis Bossart <pierre-louis.bossart@linux.dev>
Cc: linux-sound@vger.kernel.org, linux-arm-msm@vger.kernel.org,
linux-kernel@vger.kernel.org,
Ivan Verbovoy <ivanverbovoy@gmail.com>
Subject: [PATCH] ASoC: codecs: wcd934x: drop the MCLK on every disable
Date: Tue, 10 Nov 2026 00:33:18 +0200 [thread overview]
Message-ID: <20261110-wcd934x-mclk-v1-1-c62956792a3f@gmail.com> (raw)
From: Ivan Verbovoy <ivanverbovoy@gmail.com>
__wcd934x_cdc_mclk_enable() takes a reference on every enable: it
prepares and enables the external clock and counts a user of the
analog bias and system clock (sysclk_users). On disable it returns
early while the SoundWire controller's clock is enabled, so neither is
dropped. Each DAPM MCLK power-down or MBHC micbias release during
SoundWire activity therefore leaks one reference, and the MCLK stays on
for good.
The early return is not needed: wcd934x_swrm_clock() takes its own
reference before it enables the SoundWire clock and clears that clock
before it drops the reference, and sysclk_users keeps the bias and the
system clock on while any user remains. Drop the check.
On a Surface Duo (SM8150, WCD9340) the codec's external clock,
ln_bb_clk2 (an RPMh XO buffer vote), was found prepared five times at
suspend, which kept the SoC's XO on. With the check dropped, its enable
and prepare counts are back to zero once playback stops.
Fixes: a61f3b4f476e ("ASoC: wcd934x: add support to wcd9340/wcd9341 codec")
Signed-off-by: Ivan Verbovoy <ivanverbovoy@gmail.com>
---
sound/soc/codecs/wcd934x.c | 9 ---------
1 file changed, 9 deletions(-)
diff --git a/sound/soc/codecs/wcd934x.c b/sound/soc/codecs/wcd934x.c
index 5cd30a5ed69c..043061558225 100644
--- a/sound/soc/codecs/wcd934x.c
+++ b/sound/soc/codecs/wcd934x.c
@@ -1355,15 +1355,6 @@ static int __wcd934x_cdc_mclk_enable(struct wcd934x_codec *wcd, bool enable)
}
ret = wcd934x_enable_ana_bias_and_sysclk(wcd);
} else {
- int val;
-
- regmap_read(wcd->regmap, WCD934X_CDC_CLK_RST_CTRL_SWR_CONTROL,
- &val);
-
- /* Don't disable clock if soundwire using it.*/
- if (val & WCD934X_CDC_SWR_CLK_EN_MASK)
- return 0;
-
wcd934x_disable_ana_bias_and_syclk(wcd);
clk_disable_unprepare(wcd->extclk);
}
---
base-commit: 630059a5a632377b9b7b487baccde92b7ae1dd47
change-id: 20261109-wcd934x-mclk-2121fa04731a
Best regards,
--
Ivan Verbovoy <ivanverbovoy@gmail.com>
next reply other threads:[~2026-11-09 22:33 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-09 22:33 Ivan Verbovoy via B4 Relay [this message]
2026-11-19 14:07 ` Mark Brown
2026-11-19 14:51 ` Ivan Verbovoy
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261110-wcd934x-mclk-v1-1-c62956792a3f@gmail.com \
--to=devnull+ivanverbovoy.gmail.com@kernel.org \
--cc=broonie@kernel.org \
--cc=ivanverbovoy@gmail.com \
--cc=lgirdwood@gmail.com \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-sound@vger.kernel.org \
--cc=perex@perex.cz \
--cc=pierre-louis.bossart@linux.dev \
--cc=srini@kernel.org \
--cc=tiwai@suse.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®