From: phucduc.bui@gmail.com
To: Mark Brown <broonie@kernel.org>,
Claudiu Beznea <claudiu.beznea@tuxon.dev>,
Andrei Simion <andrei.simion@microchip.com>,
Nicolas Ferre <nicolas.ferre@microchip.com>,
Alexandre Belloni <alexandre.belloni@bootlin.com>
Cc: Liam Girdwood <lgirdwood@gmail.com>,
Jaroslav Kysela <perex@perex.cz>, Takashi Iwai <tiwai@suse.com>,
linux-sound@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org,
bui duc phuc <phucduc.bui@gmail.com>
Subject: [PATCH 2/2] ASoC: atmel-classd: Enable pclk during probe
Date: Fri, 13 Nov 2026 17:37:27 +0700 [thread overview]
Message-ID: <20261113103727.30449-3-phucduc.bui@gmail.com> (raw)
In-Reply-To: <20261113103727.30449-1-phucduc.bui@gmail.com>
From: bui duc phuc <phucduc.bui@gmail.com>
The peripheral clock is enabled in the startup callback but never
disabled, causing its enable reference count to increase on each
startup and preventing the clock from being gated.
Use devm_clk_get_enabled() to enable pclk once during probe and
automatically disable it on device removal.
Signed-off-by: bui duc phuc <phucduc.bui@gmail.com>
---
sound/soc/atmel/atmel-classd.c | 15 +++------------
1 file changed, 3 insertions(+), 12 deletions(-)
diff --git a/sound/soc/atmel/atmel-classd.c b/sound/soc/atmel/atmel-classd.c
index 117c8e400184..b6d815804e33 100644
--- a/sound/soc/atmel/atmel-classd.c
+++ b/sound/soc/atmel/atmel-classd.c
@@ -122,19 +122,10 @@ static int atmel_classd_cpu_dai_startup(struct snd_pcm_substream *substream,
{
struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream);
struct atmel_classd *dd = snd_soc_card_get_drvdata(rtd->card);
- int err;
regmap_write(dd->regmap, CLASSD_THR, 0x0);
- err = clk_prepare_enable(dd->pclk);
- if (err)
- return err;
- err = clk_prepare_enable(dd->gclk);
- if (err) {
- clk_disable_unprepare(dd->pclk);
- return err;
- }
- return 0;
+ return clk_prepare_enable(dd->gclk);
}
/* platform */
@@ -546,10 +537,10 @@ static int atmel_classd_probe(struct platform_device *pdev)
if (dd->irq < 0)
return dd->irq;
- dd->pclk = devm_clk_get(dev, "pclk");
+ dd->pclk = devm_clk_get_enabled(dev, "pclk");
if (IS_ERR(dd->pclk))
return dev_err_probe(dev, PTR_ERR(dd->pclk),
- "failed to get peripheral clock\n");
+ "failed to get/enable peripheral clock\n");
dd->gclk = devm_clk_get(dev, "gclk");
if (IS_ERR(dd->gclk))
--
2.43.0
prev parent reply other threads:[~2026-11-13 10:38 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-13 10:37 [PATCH 0/2] ASoC: atmel-classd: Improve clock and probe handling phucduc.bui
2026-11-13 10:37 ` [PATCH 1/2] ASoC: atmel-classd: Simplify probe error handling phucduc.bui
2026-11-13 10:37 ` phucduc.bui [this message]
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=20261113103727.30449-3-phucduc.bui@gmail.com \
--to=phucduc.bui@gmail.com \
--cc=alexandre.belloni@bootlin.com \
--cc=andrei.simion@microchip.com \
--cc=broonie@kernel.org \
--cc=claudiu.beznea@tuxon.dev \
--cc=lgirdwood@gmail.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-sound@vger.kernel.org \
--cc=nicolas.ferre@microchip.com \
--cc=perex@perex.cz \
--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®