[PATCH v2 5/9] ASoC: amd: renoir: Use devm_pm_runtime_enable()

From: phucduc . bui

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


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

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

sound/soc/amd/renoir/acp3x-pdm-dma.c | 40 ++++++++++++++--------------
1 file changed, 20 insertions(+), 20 deletions(-)

diff --git a/sound/soc/amd/renoir/acp3x-pdm-dma.c b/sound/soc/amd/renoir/acp3x-pdm-dma.c
index bea1208f1702..84ee9b931858 100644
--- a/sound/soc/amd/renoir/acp3x-pdm-dma.c
+++ b/sound/soc/amd/renoir/acp3x-pdm-dma.c
@@ -422,33 +422,34 @@ static int acp_pdm_audio_probe(struct platform_device *pdev)
adata->capture_stream = NULL;

dev_set_drvdata(&pdev->dev, adata);
- status = devm_snd_soc_register_component(&pdev->dev,
- &acp_pdm_component,
- &acp_pdm_dai_driver, 1);
- if (status) {
- dev_err(&pdev->dev, "Fail to register acp pdm dai\n");

- return -ENODEV;
- }
- status = devm_request_irq(&pdev->dev, adata->pdm_irq, pdm_irq_handler,
- irqflags, "ACP_PDM_IRQ", adata);
- if (status) {
- dev_err(&pdev->dev, "ACP PDM IRQ request failed\n");
- 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);
+ status = devm_pm_runtime_enable(&pdev->dev);
+ if (status)
+ return status;
+
+ status = devm_request_irq(&pdev->dev, adata->pdm_irq, pdm_irq_handler,
+ irqflags, "ACP_PDM_IRQ", adata);
+ if (status) {
+ dev_err(&pdev->dev, "ACP PDM IRQ request failed\n");
+ return -ENODEV;
+ }
+
+ status = devm_snd_soc_register_component(&pdev->dev,
+ &acp_pdm_component,
+ &acp_pdm_dai_driver, 1);
+ if (status) {
+ dev_err(&pdev->dev, "Fail to register acp pdm dai\n");
+
+ return -ENODEV;
+ }
+
return 0;
}

-static void acp_pdm_audio_remove(struct platform_device *pdev)
-{
- pm_runtime_disable(&pdev->dev);
-}
-
static int acp_pdm_resume(struct device *dev)
{
struct pdm_dev_data *adata;
@@ -497,7 +498,6 @@ static const struct dev_pm_ops acp_pdm_pm_ops = {

static struct platform_driver acp_pdm_dma_driver = {
.probe = acp_pdm_audio_probe,
- .remove = acp_pdm_audio_remove,
.driver = {
.name = "acp_rn_pdm_dma",
.pm = &acp_pdm_pm_ops,
--
2.43.0