* [PATCH 1/2] ASoC: adi: axi-i2s: Use devm_clk_get_enabled()
2026-11-17 2:53 [PATCH 0/2] ASoC: adi: Use devm_clk_get_enabled() phucduc.bui
@ 2026-11-17 2:53 ` phucduc.bui
2026-11-17 2:53 ` [PATCH 2/2] ASoC: adi: axi-spdif: " phucduc.bui
1 sibling, 0 replies; 3+ messages in thread
From: phucduc.bui @ 2026-11-17 2:53 UTC (permalink / raw)
To: Mark Brown
Cc: Liam Girdwood, Jaroslav Kysela, Takashi Iwai, Kees Cook,
linux-sound, linux-kernel, bui duc phuc
From: bui duc phuc <phucduc.bui@gmail.com>
The AXI clock is enabled once in probe() and only disabled in
remove(). Use devm_clk_get_enabled() to let devres handle this
automatically, and drop the now unnecessary remove() callback.
Signed-off-by: bui duc phuc <phucduc.bui@gmail.com>
---
sound/soc/adi/axi-i2s.c | 22 +++-------------------
1 file changed, 3 insertions(+), 19 deletions(-)
diff --git a/sound/soc/adi/axi-i2s.c b/sound/soc/adi/axi-i2s.c
index 2c4035ff6c2d..1eeb96b7fd60 100644
--- a/sound/soc/adi/axi-i2s.c
+++ b/sound/soc/adi/axi-i2s.c
@@ -208,7 +208,7 @@ static int axi_i2s_probe(struct platform_device *pdev)
if (IS_ERR(i2s->regmap))
return PTR_ERR(i2s->regmap);
- i2s->clk = devm_clk_get(&pdev->dev, "axi");
+ i2s->clk = devm_clk_get_enabled(&pdev->dev, "axi");
if (IS_ERR(i2s->clk))
return PTR_ERR(i2s->clk);
@@ -216,10 +216,6 @@ static int axi_i2s_probe(struct platform_device *pdev)
if (IS_ERR(i2s->clk_ref))
return PTR_ERR(i2s->clk_ref);
- ret = clk_prepare_enable(i2s->clk);
- if (ret)
- return ret;
-
if (i2s->has_playback) {
axi_i2s_dai.playback.channels_min = 2;
axi_i2s_dai.playback.channels_max = 2;
@@ -257,28 +253,17 @@ static int axi_i2s_probe(struct platform_device *pdev)
ret = devm_snd_soc_register_component(&pdev->dev, &axi_i2s_component,
&axi_i2s_dai, 1);
if (ret)
- goto err_clk_disable;
+ return ret;
ret = devm_snd_dmaengine_pcm_register(&pdev->dev, NULL, 0);
if (ret)
- goto err_clk_disable;
+ return ret;
dev_info(&pdev->dev, "probed, capture %s, playback %s\n",
str_enabled_disabled(i2s->has_capture),
str_enabled_disabled(i2s->has_playback));
return 0;
-
-err_clk_disable:
- clk_disable_unprepare(i2s->clk);
- return ret;
-}
-
-static void axi_i2s_dev_remove(struct platform_device *pdev)
-{
- struct axi_i2s *i2s = platform_get_drvdata(pdev);
-
- clk_disable_unprepare(i2s->clk);
}
static const struct of_device_id axi_i2s_of_match[] = {
@@ -293,7 +278,6 @@ static struct platform_driver axi_i2s_driver = {
.of_match_table = axi_i2s_of_match,
},
.probe = axi_i2s_probe,
- .remove = axi_i2s_dev_remove,
};
module_platform_driver(axi_i2s_driver);
--
2.43.0
^ permalink raw reply related [flat|nested] 3+ messages in thread* [PATCH 2/2] ASoC: adi: axi-spdif: Use devm_clk_get_enabled()
2026-11-17 2:53 [PATCH 0/2] ASoC: adi: Use devm_clk_get_enabled() phucduc.bui
2026-11-17 2:53 ` [PATCH 1/2] ASoC: adi: axi-i2s: " phucduc.bui
@ 2026-11-17 2:53 ` phucduc.bui
1 sibling, 0 replies; 3+ messages in thread
From: phucduc.bui @ 2026-11-17 2:53 UTC (permalink / raw)
To: Mark Brown
Cc: Liam Girdwood, Jaroslav Kysela, Takashi Iwai, Kees Cook,
linux-sound, linux-kernel, bui duc phuc
From: bui duc phuc <phucduc.bui@gmail.com>
The AXI clock is enabled once in probe() and only disabled in
remove(). Use devm_clk_get_enabled() to let devres handle this
automatically, and drop the now unnecessary remove() callback.
Signed-off-by: bui duc phuc <phucduc.bui@gmail.com>
---
sound/soc/adi/axi-spdif.c | 22 +++-------------------
1 file changed, 3 insertions(+), 19 deletions(-)
diff --git a/sound/soc/adi/axi-spdif.c b/sound/soc/adi/axi-spdif.c
index faa1fc7cb973..07363ddebb77 100644
--- a/sound/soc/adi/axi-spdif.c
+++ b/sound/soc/adi/axi-spdif.c
@@ -199,7 +199,7 @@ static int axi_spdif_probe(struct platform_device *pdev)
if (IS_ERR(spdif->regmap))
return PTR_ERR(spdif->regmap);
- spdif->clk = devm_clk_get(&pdev->dev, "axi");
+ spdif->clk = devm_clk_get_enabled(&pdev->dev, "axi");
if (IS_ERR(spdif->clk))
return PTR_ERR(spdif->clk);
@@ -207,10 +207,6 @@ static int axi_spdif_probe(struct platform_device *pdev)
if (IS_ERR(spdif->clk_ref))
return PTR_ERR(spdif->clk_ref);
- ret = clk_prepare_enable(spdif->clk);
- if (ret)
- return ret;
-
spdif->dma_data.addr = res->start + AXI_SPDIF_REG_TX_FIFO;
spdif->dma_data.addr_width = 4;
spdif->dma_data.maxburst = 1;
@@ -226,24 +222,13 @@ static int axi_spdif_probe(struct platform_device *pdev)
ret = devm_snd_soc_register_component(&pdev->dev, &axi_spdif_component,
&axi_spdif_dai, 1);
if (ret)
- goto err_clk_disable;
+ return ret;
ret = devm_snd_dmaengine_pcm_register(&pdev->dev, NULL, 0);
if (ret)
- goto err_clk_disable;
+ return ret;
return 0;
-
-err_clk_disable:
- clk_disable_unprepare(spdif->clk);
- return ret;
-}
-
-static void axi_spdif_dev_remove(struct platform_device *pdev)
-{
- struct axi_spdif *spdif = platform_get_drvdata(pdev);
-
- clk_disable_unprepare(spdif->clk);
}
static const struct of_device_id axi_spdif_of_match[] = {
@@ -258,7 +243,6 @@ static struct platform_driver axi_spdif_driver = {
.of_match_table = axi_spdif_of_match,
},
.probe = axi_spdif_probe,
- .remove = axi_spdif_dev_remove,
};
module_platform_driver(axi_spdif_driver);
--
2.43.0
^ permalink raw reply related [flat|nested] 3+ messages in thread