[PATCH v2 8/9] ASoC: amd: yc: Use devm_pm_runtime_enable()

From: phucduc . bui

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


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

Use devm_pm_runtime_enable() in the ACP6x PDM 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 components.


sound/soc/amd/yc/acp6x-pdm-dma.c | 21 ++++++++++-----------
1 file changed, 10 insertions(+), 11 deletions(-)

diff --git a/sound/soc/amd/yc/acp6x-pdm-dma.c b/sound/soc/amd/yc/acp6x-pdm-dma.c
index 3f8c73a1f182..99977b44bc9e 100644
--- a/sound/soc/amd/yc/acp6x-pdm-dma.c
+++ b/sound/soc/amd/yc/acp6x-pdm-dma.c
@@ -381,6 +381,15 @@ static int acp6x_pdm_audio_probe(struct platform_device *pdev)
adata->capture_stream = NULL;

dev_set_drvdata(&pdev->dev, adata);
+
+ pm_runtime_set_autosuspend_delay(&pdev->dev, ACP_SUSPEND_DELAY_MS);
+ pm_runtime_use_autosuspend(&pdev->dev);
+ pm_runtime_mark_last_busy(&pdev->dev);
+ pm_runtime_set_active(&pdev->dev);
+ status = devm_pm_runtime_enable(&pdev->dev);
+ if (status)
+ return status;
+
status = devm_snd_soc_register_component(&pdev->dev,
&acp6x_pdm_component,
&acp6x_pdm_dai_driver, 1);
@@ -389,17 +398,8 @@ static int acp6x_pdm_audio_probe(struct platform_device *pdev)

return -ENODEV;
}
- pm_runtime_set_autosuspend_delay(&pdev->dev, ACP_SUSPEND_DELAY_MS);
- 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;
-}

-static void acp6x_pdm_audio_remove(struct platform_device *pdev)
-{
- pm_runtime_disable(&pdev->dev);
+ return 0;
}

static int acp6x_pdm_resume(struct device *dev)
@@ -448,7 +448,6 @@ static const struct dev_pm_ops acp6x_pdm_pm_ops = {

static struct platform_driver acp6x_pdm_dma_driver = {
.probe = acp6x_pdm_audio_probe,
- .remove = acp6x_pdm_audio_remove,
.driver = {
.name = "acp_yc_pdm_dma",
.pm = pm_ptr(&acp6x_pdm_pm_ops),
--
2.43.0