[PATCH v2 7/9] ASoC: amd: vangogh: Use devm_pm_runtime_enable()

From: phucduc . bui

Date: Fri Dec 04 2026 - 06:17:54 EST


From: bui duc phuc <phucduc.bui@xxxxxxxxx>

Use devm_pm_runtime_enable() in the ACP5x PCM DMA driver to
automatically disable runtime PM when the device is removed.

This allows removing the remove callback.

Signed-off-by: bui duc phuc <phucduc.bui@xxxxxxxxx>
---

Changes in v2:
- Enable runtime PM before registering IRQs and components.
- Restore ACP_EXTERNAL_INTR_ENB in probe functions.
- Remove redundant error messages.

sound/soc/amd/vangogh/acp5x-pcm-dma.c | 34 +++++++++++----------------
1 file changed, 14 insertions(+), 20 deletions(-)

diff --git a/sound/soc/amd/vangogh/acp5x-pcm-dma.c b/sound/soc/amd/vangogh/acp5x-pcm-dma.c
index 8b09e66610b5..c6a247efe8cf 100644
--- a/sound/soc/amd/vangogh/acp5x-pcm-dma.c
+++ b/sound/soc/amd/vangogh/acp5x-pcm-dma.c
@@ -400,30 +400,25 @@ static int acp5x_audio_probe(struct platform_device *pdev)
adata->i2s_irq = status;

dev_set_drvdata(&pdev->dev, adata);
- status = devm_snd_soc_register_component(&pdev->dev,
- &acp5x_i2s_component,
- NULL, 0);
- if (status) {
- dev_err(&pdev->dev, "Fail to register acp i2s component\n");
- return status;
- }
- status = devm_request_irq(&pdev->dev, adata->i2s_irq, i2s_irq_handler,
- irqflags, "ACP5x_I2S_IRQ", adata);
- if (status) {
- dev_err(&pdev->dev, "ACP5x I2S IRQ request failed\n");
- return status;
- }
+
pm_runtime_set_autosuspend_delay(&pdev->dev, 2000);
pm_runtime_use_autosuspend(&pdev->dev);
pm_runtime_mark_last_busy(&pdev->dev);
pm_runtime_set_active(&pdev->dev);
- pm_runtime_enable(&pdev->dev);
- return 0;
-}
+ status = devm_pm_runtime_enable(&pdev->dev);
+ if (status)
+ return status;

-static void acp5x_audio_remove(struct platform_device *pdev)
-{
- pm_runtime_disable(&pdev->dev);
+ status = devm_request_irq(&pdev->dev, adata->i2s_irq, i2s_irq_handler,
+ irqflags, "ACP5x_I2S_IRQ", adata);
+ if (status)
+ return status;
+
+ acp_writel(1, adata->acp5x_base + ACP_EXTERNAL_INTR_ENB);
+
+ return devm_snd_soc_register_component(&pdev->dev,
+ &acp5x_i2s_component,
+ NULL, 0);
}

static int acp5x_pcm_resume(struct device *dev)
@@ -504,7 +499,6 @@ static const struct dev_pm_ops acp5x_pm_ops = {

static struct platform_driver acp5x_dma_driver = {
.probe = acp5x_audio_probe,
- .remove = acp5x_audio_remove,
.driver = {
.name = "acp5x_i2s_dma",
.pm = &acp5x_pm_ops,
--
2.43.0