* [PATCH 0/5] ASoC: atmel-i2s: fix clock error handling
@ 2026-10-02 4:38 phucduc.bui
2026-10-02 4:38 ` [PATCH 1/5] ASoC: atmel-i2s: fix MCK generator " phucduc.bui
` (6 more replies)
0 siblings, 7 replies; 9+ messages in thread
From: phucduc.bui @ 2026-10-02 4:38 UTC (permalink / raw)
To: Mark Brown, Claudiu Beznea, Andrei Simion, Nicolas Ferre,
Alexandre Belloni
Cc: Liam Girdwood, Jaroslav Kysela, Takashi Iwai, Codrin Ciubotariu,
Cyrille Pitchen, linux-sound, linux-arm-kernel, linux-kernel,
bui duc phuc
From: bui duc phuc <phucduc.bui@gmail.com>
Hi all,
This series fixes clock error handling in the Atmel I2S driver by
propagating errors, using optional clock APIs, and simplifying probe
error reporting.
Found by manual code inspection.
Compile-tested only.
Best regards,
Phuc
bui duc phuc (5):
ASoC: atmel-i2s: fix MCK generator error handling
ASoC: atmel-i2s: use optional API for muxclk
ASoC: atmel-i2s: use optional API for gclk
ASoC: atmel-i2s: use dev_err_probe() for pclk errors
ASoC: atmel-i2s: remove redundant error message
sound/soc/atmel/atmel-i2s.c | 54 +++++++++++++++++--------------------
1 file changed, 25 insertions(+), 29 deletions(-)
--
2.43.0
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 1/5] ASoC: atmel-i2s: fix MCK generator error handling
2026-10-02 4:38 [PATCH 0/5] ASoC: atmel-i2s: fix clock error handling phucduc.bui
@ 2026-10-02 4:38 ` phucduc.bui
2026-10-02 4:38 ` [PATCH 2/5] ASoC: atmel-i2s: use optional API for muxclk phucduc.bui
` (5 subsequent siblings)
6 siblings, 0 replies; 9+ messages in thread
From: phucduc.bui @ 2026-10-02 4:38 UTC (permalink / raw)
To: Mark Brown, Claudiu Beznea, Andrei Simion, Nicolas Ferre,
Alexandre Belloni
Cc: Liam Girdwood, Jaroslav Kysela, Takashi Iwai, Codrin Ciubotariu,
Cyrille Pitchen, linux-sound, linux-arm-kernel, linux-kernel,
bui duc phuc
From: bui duc phuc <phucduc.bui@gmail.com>
Disable the gclk and reset the MCK configuration when an error occurs
while enabling the MCK generator.
This prevents the gclk from remaining enabled after a failed clock
configuration.
Fixes: 73ad0df57290 ("ASoC: atmel-i2s: Remove unnecessary audio PLL clock (aclk)")
Signed-off-by: bui duc phuc <phucduc.bui@gmail.com>
---
sound/soc/atmel/atmel-i2s.c | 16 +++++++++++++---
1 file changed, 13 insertions(+), 3 deletions(-)
diff --git a/sound/soc/atmel/atmel-i2s.c b/sound/soc/atmel/atmel-i2s.c
index d9ad262ec44d..f28808d980ce 100644
--- a/sound/soc/atmel/atmel-i2s.c
+++ b/sound/soc/atmel/atmel-i2s.c
@@ -466,11 +466,21 @@ static int atmel_i2s_switch_mck_generator(struct atmel_i2s_dev *dev,
mr |= ATMEL_I2SC_MR_IMCKMODE_I2SMCK;
ret = regmap_update_bits(dev->regmap, ATMEL_I2SC_MR, mr_mask, mr);
if (ret)
- return ret;
+ goto err_disable_gclk;
/* Finally enable the I2S Master Clock generator. */
- return regmap_write(dev->regmap, ATMEL_I2SC_CR,
- ATMEL_I2SC_CR_CKEN);
+ ret = regmap_write(dev->regmap, ATMEL_I2SC_CR, ATMEL_I2SC_CR_CKEN);
+ if (ret)
+ goto err_reset_mr;
+
+ return 0;
+
+err_reset_mr:
+ regmap_update_bits(dev->regmap, ATMEL_I2SC_MR, mr_mask, 0);
+err_disable_gclk:
+ clk_disable_unprepare(dev->gclk);
+
+ return ret;
}
static int atmel_i2s_trigger(struct snd_pcm_substream *substream, int cmd,
--
2.43.0
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 2/5] ASoC: atmel-i2s: use optional API for muxclk
2026-10-02 4:38 [PATCH 0/5] ASoC: atmel-i2s: fix clock error handling phucduc.bui
2026-10-02 4:38 ` [PATCH 1/5] ASoC: atmel-i2s: fix MCK generator " phucduc.bui
@ 2026-10-02 4:38 ` phucduc.bui
2026-10-02 4:38 ` [PATCH 3/5] ASoC: atmel-i2s: use optional API for gclk phucduc.bui
` (4 subsequent siblings)
6 siblings, 0 replies; 9+ messages in thread
From: phucduc.bui @ 2026-10-02 4:38 UTC (permalink / raw)
To: Mark Brown, Claudiu Beznea, Andrei Simion, Nicolas Ferre,
Alexandre Belloni
Cc: Liam Girdwood, Jaroslav Kysela, Takashi Iwai, Codrin Ciubotariu,
Cyrille Pitchen, linux-sound, linux-arm-kernel, linux-kernel,
bui duc phuc
From: bui duc phuc <phucduc.bui@gmail.com>
The muxclk is an optional clock according to the device tree
binding.
Use devm_clk_get_optional() to handle the optional muxclk instead of
handling the missing clock explicitly.
When muxclk is not available, devm_clk_get_optional() returns NULL.
clk_set_parent() returns 0 when passed NULL, preserving the existing
behavior.
Unlike the existing code, errors other than -EPROBE_DEFER are now
returned instead of being silently ignored.
Fixes: b543e467d1a9 ("ASoC: atmel-i2s: add driver for the new Atmel I2S controller")
Signed-off-by: bui duc phuc <phucduc.bui@gmail.com>
---
sound/soc/atmel/atmel-i2s.c | 16 +++++-----------
1 file changed, 5 insertions(+), 11 deletions(-)
diff --git a/sound/soc/atmel/atmel-i2s.c b/sound/soc/atmel/atmel-i2s.c
index f28808d980ce..c52d048449f8 100644
--- a/sound/soc/atmel/atmel-i2s.c
+++ b/sound/soc/atmel/atmel-i2s.c
@@ -589,21 +589,15 @@ static int atmel_i2s_sama5d2_mck_init(struct atmel_i2s_dev *dev,
struct device_node *np)
{
struct clk *muxclk;
- int err;
if (!dev->gclk)
return 0;
- /* muxclk is optional, so we return error for probe defer only */
- muxclk = devm_clk_get(dev->dev, "muxclk");
- if (IS_ERR(muxclk)) {
- err = PTR_ERR(muxclk);
- if (err == -EPROBE_DEFER)
- return -EPROBE_DEFER;
- dev_dbg(dev->dev,
- "failed to get the I2S clock control: %d\n", err);
- return 0;
- }
+ /* muxclk is optional */
+ muxclk = devm_clk_get_optional(dev->dev, "muxclk");
+ if (IS_ERR(muxclk))
+ return dev_err_probe(dev->dev, PTR_ERR(muxclk),
+ "failed to get the I2S clock control\n");
return clk_set_parent(muxclk, dev->gclk);
}
--
2.43.0
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 3/5] ASoC: atmel-i2s: use optional API for gclk
2026-10-02 4:38 [PATCH 0/5] ASoC: atmel-i2s: fix clock error handling phucduc.bui
2026-10-02 4:38 ` [PATCH 1/5] ASoC: atmel-i2s: fix MCK generator " phucduc.bui
2026-10-02 4:38 ` [PATCH 2/5] ASoC: atmel-i2s: use optional API for muxclk phucduc.bui
@ 2026-10-02 4:38 ` phucduc.bui
2026-10-02 4:38 ` [PATCH 4/5] ASoC: atmel-i2s: use dev_err_probe() for pclk errors phucduc.bui
` (3 subsequent siblings)
6 siblings, 0 replies; 9+ messages in thread
From: phucduc.bui @ 2026-10-02 4:38 UTC (permalink / raw)
To: Mark Brown, Claudiu Beznea, Andrei Simion, Nicolas Ferre,
Alexandre Belloni
Cc: Liam Girdwood, Jaroslav Kysela, Takashi Iwai, Codrin Ciubotariu,
Cyrille Pitchen, linux-sound, linux-arm-kernel, linux-kernel,
bui duc phuc
From: bui duc phuc <phucduc.bui@gmail.com>
The gclk is an optional clock according to the device tree binding.
Use devm_clk_get_optional() to handle the optional gclk directly.
Unlike the existing code, errors other than -EPROBE_DEFER are now
returned instead of being silently ignored.
Fixes: 73ad0df57290 ("ASoC: atmel-i2s: Remove unnecessary audio PLL clock (aclk)")
Signed-off-by: bui duc phuc <phucduc.bui@gmail.com>
---
sound/soc/atmel/atmel-i2s.c | 11 ++++-------
1 file changed, 4 insertions(+), 7 deletions(-)
diff --git a/sound/soc/atmel/atmel-i2s.c b/sound/soc/atmel/atmel-i2s.c
index c52d048449f8..6ca230f8adc8 100644
--- a/sound/soc/atmel/atmel-i2s.c
+++ b/sound/soc/atmel/atmel-i2s.c
@@ -670,13 +670,10 @@ static int atmel_i2s_probe(struct platform_device *pdev)
}
/* Get audio clock to generate the I2S Master Clock (I2S_MCK) */
- dev->gclk = devm_clk_get(&pdev->dev, "gclk");
- if (IS_ERR(dev->gclk)) {
- if (PTR_ERR(dev->gclk) == -EPROBE_DEFER)
- return -EPROBE_DEFER;
- /* Master Mode not supported */
- dev->gclk = NULL;
- }
+ dev->gclk = devm_clk_get_optional(&pdev->dev, "gclk");
+ if (IS_ERR(dev->gclk))
+ return PTR_ERR(dev->gclk);
+
dev->dev = &pdev->dev;
dev->regmap = regmap;
platform_set_drvdata(pdev, dev);
--
2.43.0
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 4/5] ASoC: atmel-i2s: use dev_err_probe() for pclk errors
2026-10-02 4:38 [PATCH 0/5] ASoC: atmel-i2s: fix clock error handling phucduc.bui
` (2 preceding siblings ...)
2026-10-02 4:38 ` [PATCH 3/5] ASoC: atmel-i2s: use optional API for gclk phucduc.bui
@ 2026-10-02 4:38 ` phucduc.bui
2026-10-02 4:38 ` [PATCH 5/5] ASoC: atmel-i2s: remove redundant error message phucduc.bui
` (2 subsequent siblings)
6 siblings, 0 replies; 9+ messages in thread
From: phucduc.bui @ 2026-10-02 4:38 UTC (permalink / raw)
To: Mark Brown, Claudiu Beznea, Andrei Simion, Nicolas Ferre,
Alexandre Belloni
Cc: Liam Girdwood, Jaroslav Kysela, Takashi Iwai, Codrin Ciubotariu,
Cyrille Pitchen, linux-sound, linux-arm-kernel, linux-kernel,
bui duc phuc
From: bui duc phuc <phucduc.bui@gmail.com>
Use dev_err_probe() when obtaining clocks to avoid redundant error
messages, particularly for probe deferral.
Signed-off-by: bui duc phuc <phucduc.bui@gmail.com>
---
sound/soc/atmel/atmel-i2s.c | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)
diff --git a/sound/soc/atmel/atmel-i2s.c b/sound/soc/atmel/atmel-i2s.c
index 6ca230f8adc8..9b651eb4f0a4 100644
--- a/sound/soc/atmel/atmel-i2s.c
+++ b/sound/soc/atmel/atmel-i2s.c
@@ -662,12 +662,9 @@ static int atmel_i2s_probe(struct platform_device *pdev)
/* Get the peripheral clock. */
dev->pclk = devm_clk_get(&pdev->dev, "pclk");
- if (IS_ERR(dev->pclk)) {
- err = PTR_ERR(dev->pclk);
- dev_err(&pdev->dev,
- "failed to get the peripheral clock: %d\n", err);
- return err;
- }
+ if (IS_ERR(dev->pclk))
+ return dev_err_probe(&pdev->dev, PTR_ERR(dev->pclk),
+ "failed to get the peripheral clock\n");
/* Get audio clock to generate the I2S Master Clock (I2S_MCK) */
dev->gclk = devm_clk_get_optional(&pdev->dev, "gclk");
--
2.43.0
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 5/5] ASoC: atmel-i2s: remove redundant error message
2026-10-02 4:38 [PATCH 0/5] ASoC: atmel-i2s: fix clock error handling phucduc.bui
` (3 preceding siblings ...)
2026-10-02 4:38 ` [PATCH 4/5] ASoC: atmel-i2s: use dev_err_probe() for pclk errors phucduc.bui
@ 2026-10-02 4:38 ` phucduc.bui
2026-10-13 16:08 ` [PATCH 0/5] ASoC: atmel-i2s: fix clock error handling Mark Brown
2026-11-10 19:01 ` Mark Brown
6 siblings, 0 replies; 9+ messages in thread
From: phucduc.bui @ 2026-10-02 4:38 UTC (permalink / raw)
To: Mark Brown, Claudiu Beznea, Andrei Simion, Nicolas Ferre,
Alexandre Belloni
Cc: Liam Girdwood, Jaroslav Kysela, Takashi Iwai, Codrin Ciubotariu,
Cyrille Pitchen, linux-sound, linux-arm-kernel, linux-kernel,
bui duc phuc
From: bui duc phuc <phucduc.bui@gmail.com>
The errors handled here are already reported by the called functions,
either directly or deeper in the call chain. Therefore, the additional
dev_err() call is redundant and can be removed.
Signed-off-by: bui duc phuc <phucduc.bui@gmail.com>
---
sound/soc/atmel/atmel-i2s.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/sound/soc/atmel/atmel-i2s.c b/sound/soc/atmel/atmel-i2s.c
index 9b651eb4f0a4..e1d8af056234 100644
--- a/sound/soc/atmel/atmel-i2s.c
+++ b/sound/soc/atmel/atmel-i2s.c
@@ -699,7 +699,6 @@ static int atmel_i2s_probe(struct platform_device *pdev)
&atmel_i2s_component,
&atmel_i2s_dai, 1);
if (err) {
- dev_err(&pdev->dev, "failed to register DAI: %d\n", err);
clk_disable_unprepare(dev->pclk);
return err;
}
@@ -714,7 +713,6 @@ static int atmel_i2s_probe(struct platform_device *pdev)
pcm_flags |= SND_DMAENGINE_PCM_FLAG_HALF_DUPLEX;
err = devm_snd_dmaengine_pcm_register(&pdev->dev, NULL, pcm_flags);
if (err) {
- dev_err(&pdev->dev, "failed to register PCM: %d\n", err);
clk_disable_unprepare(dev->pclk);
return err;
}
--
2.43.0
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH 0/5] ASoC: atmel-i2s: fix clock error handling
2026-10-02 4:38 [PATCH 0/5] ASoC: atmel-i2s: fix clock error handling phucduc.bui
` (4 preceding siblings ...)
2026-10-02 4:38 ` [PATCH 5/5] ASoC: atmel-i2s: remove redundant error message phucduc.bui
@ 2026-10-13 16:08 ` Mark Brown
2026-11-10 19:01 ` Mark Brown
6 siblings, 0 replies; 9+ messages in thread
From: Mark Brown @ 2026-10-13 16:08 UTC (permalink / raw)
To: Claudiu Beznea, Andrei Simion, Nicolas Ferre, Alexandre Belloni,
phucduc.bui
Cc: Liam Girdwood, Jaroslav Kysela, Takashi Iwai, Codrin Ciubotariu,
Cyrille Pitchen, linux-sound, linux-arm-kernel, linux-kernel
On Fri, 02 Oct 2026 11:38:51 +0700, phucduc.bui@gmail.com wrote:
> ASoC: atmel-i2s: fix clock error handling
>
> From: bui duc phuc <phucduc.bui@gmail.com>
>
> Hi all,
>
> This series fixes clock error handling in the Atmel I2S driver by
> propagating errors, using optional clock APIs, and simplifying probe
> error reporting.
>
> [...]
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-7.4
Thanks!
[1/5] ASoC: atmel-i2s: fix MCK generator error handling
https://git.kernel.org/broonie/misc/c/2e2da92de9bf
[2/5] ASoC: atmel-i2s: use optional API for muxclk
https://git.kernel.org/broonie/misc/c/be952abd69c1
[3/5] ASoC: atmel-i2s: use optional API for gclk
https://git.kernel.org/broonie/misc/c/b431a055fb76
[4/5] ASoC: atmel-i2s: use dev_err_probe() for pclk errors
https://git.kernel.org/broonie/misc/c/5421a0a39d43
[5/5] ASoC: atmel-i2s: remove redundant error message
https://git.kernel.org/broonie/misc/c/c501f9873aca
All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying
to this mail.
Thanks,
Mark
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 0/5] ASoC: atmel-i2s: fix clock error handling
2026-10-02 4:38 [PATCH 0/5] ASoC: atmel-i2s: fix clock error handling phucduc.bui
` (5 preceding siblings ...)
2026-10-13 16:08 ` [PATCH 0/5] ASoC: atmel-i2s: fix clock error handling Mark Brown
@ 2026-11-10 19:01 ` Mark Brown
2026-11-11 3:48 ` Bui Duc Phuc
6 siblings, 1 reply; 9+ messages in thread
From: Mark Brown @ 2026-11-10 19:01 UTC (permalink / raw)
To: phucduc.bui
Cc: Claudiu Beznea, Andrei Simion, Nicolas Ferre, Alexandre Belloni,
Liam Girdwood, Jaroslav Kysela, Takashi Iwai, Codrin Ciubotariu,
Cyrille Pitchen, linux-sound, linux-arm-kernel, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 367 bytes --]
On Fri, Oct 02, 2026 at 11:38:51AM +0700, phucduc.bui@gmail.com wrote:
> From: bui duc phuc <phucduc.bui@gmail.com>
>
> Hi all,
>
> This series fixes clock error handling in the Atmel I2S driver by
> propagating errors, using optional clock APIs, and simplifying probe
> error reporting.
This doesn't apply against current code, please check and resend.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 0/5] ASoC: atmel-i2s: fix clock error handling
2026-11-10 19:01 ` Mark Brown
@ 2026-11-11 3:48 ` Bui Duc Phuc
0 siblings, 0 replies; 9+ messages in thread
From: Bui Duc Phuc @ 2026-11-11 3:48 UTC (permalink / raw)
To: Mark Brown
Cc: Claudiu Beznea, Andrei Simion, Nicolas Ferre, Alexandre Belloni,
Liam Girdwood, Jaroslav Kysela, Takashi Iwai, Codrin Ciubotariu,
Cyrille Pitchen, linux-sound, linux-arm-kernel, linux-kernel
Hi Mark,
>
> This doesn't apply against current code, please check and resend.
I believe this series has already been applied to the for-7.4 branch.
I've also taken another look at the driver and plan to submit a few
more patches for it.
Best regards,
Phuc
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2026-11-11 3:49 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-02 4:38 [PATCH 0/5] ASoC: atmel-i2s: fix clock error handling phucduc.bui
2026-10-02 4:38 ` [PATCH 1/5] ASoC: atmel-i2s: fix MCK generator " phucduc.bui
2026-10-02 4:38 ` [PATCH 2/5] ASoC: atmel-i2s: use optional API for muxclk phucduc.bui
2026-10-02 4:38 ` [PATCH 3/5] ASoC: atmel-i2s: use optional API for gclk phucduc.bui
2026-10-02 4:38 ` [PATCH 4/5] ASoC: atmel-i2s: use dev_err_probe() for pclk errors phucduc.bui
2026-10-02 4:38 ` [PATCH 5/5] ASoC: atmel-i2s: remove redundant error message phucduc.bui
2026-10-13 16:08 ` [PATCH 0/5] ASoC: atmel-i2s: fix clock error handling Mark Brown
2026-11-10 19:01 ` Mark Brown
2026-11-11 3:48 ` 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