[PATCH v2 1/9] ASoC: amd: ps: Use devm_pm_runtime_enable()

From: phucduc . bui

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


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

Use devm_pm_runtime_enable() in the PDM and SoundWire DMA drivers
to automatically disable runtime PM when the devices are removed.

This allows removing their remove callbacks.

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

Changes in v2:
- Enable runtime PM before registering components.


sound/soc/amd/ps/ps-pdm-dma.c | 21 ++++++++++-----------
sound/soc/amd/ps/ps-sdw-dma.c | 21 ++++++++++-----------
2 files changed, 20 insertions(+), 22 deletions(-)

diff --git a/sound/soc/amd/ps/ps-pdm-dma.c b/sound/soc/amd/ps/ps-pdm-dma.c
index 359ca10b9ba4..6e2e08c097a0 100644
--- a/sound/soc/amd/ps/ps-pdm-dma.c
+++ b/sound/soc/amd/ps/ps-pdm-dma.c
@@ -388,6 +388,15 @@ static int acp63_pdm_audio_probe(struct platform_device *pdev)
adata->capture_stream = NULL;
adata->acp_lock = &acp_data->acp_lock;
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,
&acp63_pdm_component,
&acp63_pdm_dai_driver, 1);
@@ -396,17 +405,8 @@ static int acp63_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 acp63_pdm_audio_remove(struct platform_device *pdev)
-{
- pm_runtime_disable(&pdev->dev);
+ return 0;
}

static int acp63_pdm_resume(struct device *dev)
@@ -455,7 +455,6 @@ static const struct dev_pm_ops acp63_pdm_pm_ops = {

static struct platform_driver acp63_pdm_dma_driver = {
.probe = acp63_pdm_audio_probe,
- .remove = acp63_pdm_audio_remove,
.driver = {
.name = "acp_ps_pdm_dma",
.pm = pm_ptr(&acp63_pdm_pm_ops),
diff --git a/sound/soc/amd/ps/ps-sdw-dma.c b/sound/soc/amd/ps/ps-sdw-dma.c
index 6c510e6d9a18..6b78b2d49b12 100644
--- a/sound/soc/amd/ps/ps-sdw-dma.c
+++ b/sound/soc/amd/ps/ps-sdw-dma.c
@@ -672,6 +672,15 @@ static int acp63_sdw_platform_probe(struct platform_device *pdev)
sdw_data->acp_lock = &acp_data->acp_lock;
sdw_data->acp_rev = acp_data->acp_rev;
dev_set_drvdata(&pdev->dev, sdw_data);
+
+ 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,
&acp63_sdw_component,
NULL, 0);
@@ -679,17 +688,8 @@ static int acp63_sdw_platform_probe(struct platform_device *pdev)
dev_err(&pdev->dev, "Fail to register sdw dma component\n");
return status;
}
- 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 acp63_sdw_platform_remove(struct platform_device *pdev)
-{
- pm_runtime_disable(&pdev->dev);
+ return 0;
}

static int acp63_restore_sdw_dma_config(struct sdw_dma_dev_data *sdw_data)
@@ -795,7 +795,6 @@ static const struct dev_pm_ops acp63_pm_ops = {

static struct platform_driver acp63_sdw_dma_driver = {
.probe = acp63_sdw_platform_probe,
- .remove = acp63_sdw_platform_remove,
.driver = {
.name = "amd_ps_sdw_dma",
.pm = pm_ptr(&acp63_pm_ops),
--
2.43.0