* [PATCH v2 0/2] ASoC: atmel-classd: Improve clock and probe handling
@ 2026-11-16 4:26 phucduc.bui
2026-11-16 4:26 ` [PATCH v2 1/2] ASoC: atmel-classd: Simplify probe error handling phucduc.bui
2026-11-16 4:26 ` [PATCH v2 2/2] ASoC: atmel-classd: Enable pclk during probe phucduc.bui
0 siblings, 2 replies; 5+ messages in thread
From: phucduc.bui @ 2026-11-16 4:26 UTC (permalink / raw)
To: Mark Brown, Claudiu Beznea, Andrei Simion, Nicolas Ferre,
Alexandre Belloni
Cc: Liam Girdwood, Jaroslav Kysela, Takashi Iwai, linux-sound,
linux-arm-kernel, linux-kernel, bui duc phuc
From: bui duc phuc <phucduc.bui@gmail.com>
Hi all,
This series simplifies probe error handling and fixes the
peripheral clock lifecycle management in the Atmel CLASSD driver.
Link v1 :
https://lore.kernel.org/all/20261113103727.30449-1-phucduc.bui@gmail.com/
Change in v2:
- Rebase the patches on the latest for-next branch after checking the
Sashiko review page and discovering that the patches could not be
applied cleanly.
- Use dev_err_probe() for devm_regmap_init_mmio() error handling.
Compile-tested only.
Best regards,
Phuc
bui duc phuc (2):
ASoC: atmel-classd: Simplify probe error handling
ASoC: atmel-classd: Enable pclk during probe
sound/soc/atmel/atmel-classd.c | 50 ++++++++++------------------------
1 file changed, 15 insertions(+), 35 deletions(-)
--
2.43.0
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH v2 1/2] ASoC: atmel-classd: Simplify probe error handling
2026-11-16 4:26 [PATCH v2 0/2] ASoC: atmel-classd: Improve clock and probe handling phucduc.bui
@ 2026-11-16 4:26 ` phucduc.bui
2026-11-16 4:26 ` [PATCH v2 2/2] ASoC: atmel-classd: Enable pclk during probe phucduc.bui
1 sibling, 0 replies; 5+ messages in thread
From: phucduc.bui @ 2026-11-16 4:26 UTC (permalink / raw)
To: Mark Brown, Claudiu Beznea, Andrei Simion, Nicolas Ferre,
Alexandre Belloni
Cc: Liam Girdwood, Jaroslav Kysela, Takashi Iwai, linux-sound,
linux-arm-kernel, linux-kernel, bui duc phuc
From: bui duc phuc <phucduc.bui@gmail.com>
Use dev_err_probe() for clock acquisition and regmap initialization
to suppress probe deferral logs and simplify error handling.
Also remove the unnecessary cleanup label, as all resources are
managed by devm.
Signed-off-by: bui duc phuc <phucduc.bui@gmail.com>
---
Change in v2:
- Use dev_err_probe() for devm_regmap_init_mmio() error handling.
sound/soc/atmel/atmel-classd.c | 37 ++++++++++++----------------------
1 file changed, 13 insertions(+), 24 deletions(-)
diff --git a/sound/soc/atmel/atmel-classd.c b/sound/soc/atmel/atmel-classd.c
index 746e6bbbf423..59490e9effab 100644
--- a/sound/soc/atmel/atmel-classd.c
+++ b/sound/soc/atmel/atmel-classd.c
@@ -547,18 +547,14 @@ static int atmel_classd_probe(struct platform_device *pdev)
return dd->irq;
dd->pclk = devm_clk_get(dev, "pclk");
- if (IS_ERR(dd->pclk)) {
- ret = PTR_ERR(dd->pclk);
- dev_err(dev, "failed to get peripheral clock: %d\n", ret);
- return ret;
- }
+ if (IS_ERR(dd->pclk))
+ return dev_err_probe(dev, PTR_ERR(dd->pclk),
+ "failed to get peripheral clock\n");
dd->gclk = devm_clk_get(dev, "gclk");
- if (IS_ERR(dd->gclk)) {
- ret = PTR_ERR(dd->gclk);
- dev_err(dev, "failed to get GCK clock: %d\n", ret);
- return ret;
- }
+ if (IS_ERR(dd->gclk))
+ return dev_err_probe(dev, PTR_ERR(dd->gclk),
+ "failed to get GCK clock\n");
io_base = devm_platform_get_and_ioremap_resource(pdev, 0, &res);
if (IS_ERR(io_base))
@@ -569,11 +565,9 @@ static int atmel_classd_probe(struct platform_device *pdev)
dd->regmap = devm_regmap_init_mmio(dev, io_base,
&atmel_classd_regmap_config);
- if (IS_ERR(dd->regmap)) {
- ret = PTR_ERR(dd->regmap);
- dev_err(dev, "failed to init register map: %d\n", ret);
- return ret;
- }
+ if (IS_ERR(dd->regmap))
+ return dev_err_probe(dev, PTR_ERR(dd->regmap),
+ "failed to init register map\n");
ret = devm_snd_soc_register_component(dev,
&atmel_classd_cpu_dai_component,
@@ -593,29 +587,24 @@ static int atmel_classd_probe(struct platform_device *pdev)
/* register sound card */
card = devm_kzalloc_obj(dev, *card);
- if (!card) {
- ret = -ENOMEM;
- goto unregister_codec;
- }
+ if (!card)
+ return -ENOMEM;
snd_soc_card_set_drvdata(card, dd);
ret = atmel_classd_asoc_card_init(dev, card);
if (ret) {
dev_err(dev, "failed to init sound card\n");
- goto unregister_codec;
+ return ret;
}
ret = devm_snd_soc_register_card(dev, card);
if (ret) {
dev_err(dev, "failed to register sound card: %d\n", ret);
- goto unregister_codec;
+ return ret;
}
return 0;
-
-unregister_codec:
- return ret;
}
static struct platform_driver atmel_classd_driver = {
--
2.43.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH v2 2/2] ASoC: atmel-classd: Enable pclk during probe
2026-11-16 4:26 [PATCH v2 0/2] ASoC: atmel-classd: Improve clock and probe handling phucduc.bui
2026-11-16 4:26 ` [PATCH v2 1/2] ASoC: atmel-classd: Simplify probe error handling phucduc.bui
@ 2026-11-16 4:26 ` phucduc.bui
2026-11-16 4:39 ` sashiko-bot
1 sibling, 1 reply; 5+ messages in thread
From: phucduc.bui @ 2026-11-16 4:26 UTC (permalink / raw)
To: Mark Brown, Claudiu Beznea, Andrei Simion, Nicolas Ferre,
Alexandre Belloni
Cc: Liam Girdwood, Jaroslav Kysela, Takashi Iwai, linux-sound,
linux-arm-kernel, linux-kernel, bui duc phuc
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 59490e9effab..4216a28d3371 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
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH v2 2/2] ASoC: atmel-classd: Enable pclk during probe
2026-11-16 4:26 ` [PATCH v2 2/2] ASoC: atmel-classd: Enable pclk during probe phucduc.bui
@ 2026-11-16 4:39 ` sashiko-bot
2026-11-16 4:54 ` Bui Duc Phuc
0 siblings, 1 reply; 5+ messages in thread
From: sashiko-bot @ 2026-11-16 4:39 UTC (permalink / raw)
To: phucduc.bui; +Cc: linux-sound
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Low] ASoC: atmel-classd: missing Fixes trailer for pclk leak in
atmel_classd_cpu_dai_startup()
--
commit 649a4204c070ced412b97a23b481af5d990b2be5
Author: bui duc phuc <phucduc.bui@gmail.com>
> ASoC: atmel-classd: Enable pclk during probe
>
> 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>
[Severity: Low]
Commit 1dfdbe73ccf9 ("ASoC: atmel-classd: remove codec component") merged
the codec and CPU DAI callbacks, dropping clk_disable_unprepare(dd->pclk)
from atmel_classd_cpu_dai_shutdown() while leaving clk_prepare_enable(dd->pclk)
in atmel_classd_cpu_dai_startup(). Should this include a Fixes tag?
Fixes: 1dfdbe73ccf9 ("ASoC: atmel-classd: remove codec component")
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261116042633.497423-1-phucduc.bui@gmail.com?part=2
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v2 2/2] ASoC: atmel-classd: Enable pclk during probe
2026-11-16 4:39 ` sashiko-bot
@ 2026-11-16 4:54 ` Bui Duc Phuc
0 siblings, 0 replies; 5+ messages in thread
From: Bui Duc Phuc @ 2026-11-16 4:54 UTC (permalink / raw)
To: sashiko-reviews; +Cc: linux-sound
> [Severity: Low]
> Commit 1dfdbe73ccf9 ("ASoC: atmel-classd: remove codec component") merged
> the codec and CPU DAI callbacks, dropping clk_disable_unprepare(dd->pclk)
> from atmel_classd_cpu_dai_shutdown() while leaving clk_prepare_enable(dd->pclk)
> in atmel_classd_cpu_dai_startup(). Should this include a Fixes tag?
>
> Fixes: 1dfdbe73ccf9 ("ASoC: atmel-classd: remove codec component")
>
I agree that a Fixes tag would be appropriate here.
However, I'll leave it to the maintainer to decide whether to include it,
as I'd prefer to avoid another revision just for this.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2026-11-16 4:54 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-16 4:26 [PATCH v2 0/2] ASoC: atmel-classd: Improve clock and probe handling phucduc.bui
2026-11-16 4:26 ` [PATCH v2 1/2] ASoC: atmel-classd: Simplify probe error handling phucduc.bui
2026-11-16 4:26 ` [PATCH v2 2/2] ASoC: atmel-classd: Enable pclk during probe phucduc.bui
2026-11-16 4:39 ` sashiko-bot
2026-11-16 4:54 ` Bui Duc Phuc
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox