The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* [PATCH v2 0/9] ASoC: amd: Use devm_pm_runtime_enable()
@ 2026-12-04 11:16 phucduc.bui
  2026-12-04 11:16 ` [PATCH v2 1/9] ASoC: amd: ps: " phucduc.bui
                   ` (9 more replies)
  0 siblings, 10 replies; 12+ messages in thread
From: phucduc.bui @ 2026-12-04 11:16 UTC (permalink / raw)
  To: Mark Brown, Vijendar Mukunda, Venkata Prasad Potturu,
	Syed Saba Kareem
  Cc: Liam Girdwood, Jaroslav Kysela, Takashi Iwai, Kees Cook,
	Kuninori Morimoto, wangdicheng, Chris Bainbridge, linux-sound,
	linux-kernel, bui duc phuc

From: bui duc phuc <phucduc.bui@gmail.com>

Hi all,

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

This allows removing their remove callbacks.

Link v1: 
https://lore.kernel.org/all/CAABR9nEtxzKfPEfD_ayUf5m8yMY67SEyH4fytz06UE4W1AZD2w@mail.gmail.com/

Changes in v2:
 - Enable runtime PM before registering IRQs and components.
 - Restore ACP_EXTERNAL_INTR_ENB in Raven and Vangogh probe functions.
 - Preserve original error codes instead of converting them to -ENODEV.
 - Remove redundant error messages.

Compile-tested only.

Best regards,
Phuc

bui duc phuc (9):
  ASoC: amd: ps: Use devm_pm_runtime_enable()
  ASoC: amd: ps: Simplify component registration
  ASoC: amd: raven: Use devm_pm_runtime_enable()
  ASoC: amd: raven: Preserve probe error codes
  ASoC: amd: renoir: Use devm_pm_runtime_enable()
  ASoC: amd: renoir: Preserve probe error codes
  ASoC: amd: vangogh: Use devm_pm_runtime_enable()
  ASoC: amd: yc: Use devm_pm_runtime_enable()
  ASoC: amd: yc: Simplify component registration

 sound/soc/amd/ps/ps-pdm-dma.c         | 20 +++++----------
 sound/soc/amd/ps/ps-sdw-dma.c         | 21 +++++----------
 sound/soc/amd/raven/acp3x-pcm-dma.c   | 37 ++++++++++++---------------
 sound/soc/amd/renoir/acp3x-pdm-dma.c  | 31 ++++++++--------------
 sound/soc/amd/vangogh/acp5x-pcm-dma.c | 34 ++++++++++--------------
 sound/soc/amd/yc/acp6x-pdm-dma.c      | 20 +++++----------
 6 files changed, 61 insertions(+), 102 deletions(-)

-- 
2.43.0


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH v2 1/9] ASoC: amd: ps: Use devm_pm_runtime_enable()
  2026-12-04 11:16 [PATCH v2 0/9] ASoC: amd: Use devm_pm_runtime_enable() phucduc.bui
@ 2026-12-04 11:16 ` phucduc.bui
  2026-12-04 11:16 ` [PATCH v2 2/9] ASoC: amd: ps: Simplify component registration phucduc.bui
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 12+ messages in thread
From: phucduc.bui @ 2026-12-04 11:16 UTC (permalink / raw)
  To: Mark Brown, Vijendar Mukunda, Venkata Prasad Potturu,
	Syed Saba Kareem
  Cc: Liam Girdwood, Jaroslav Kysela, Takashi Iwai, Kees Cook,
	Kuninori Morimoto, wangdicheng, Chris Bainbridge, linux-sound,
	linux-kernel, bui duc phuc

From: bui duc phuc <phucduc.bui@gmail.com>

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@gmail.com>
---

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


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH v2 2/9] ASoC: amd: ps: Simplify component registration
  2026-12-04 11:16 [PATCH v2 0/9] ASoC: amd: Use devm_pm_runtime_enable() phucduc.bui
  2026-12-04 11:16 ` [PATCH v2 1/9] ASoC: amd: ps: " phucduc.bui
@ 2026-12-04 11:16 ` phucduc.bui
  2026-12-04 11:16 ` [PATCH v2 3/9] ASoC: amd: raven: Use devm_pm_runtime_enable() phucduc.bui
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 12+ messages in thread
From: phucduc.bui @ 2026-12-04 11:16 UTC (permalink / raw)
  To: Mark Brown, Vijendar Mukunda, Venkata Prasad Potturu,
	Syed Saba Kareem
  Cc: Liam Girdwood, Jaroslav Kysela, Takashi Iwai, Kees Cook,
	Kuninori Morimoto, wangdicheng, Chris Bainbridge, linux-sound,
	linux-kernel, bui duc phuc

From: bui duc phuc <phucduc.bui@gmail.com>

Return the result of devm_snd_soc_register_component() directly
in both PDM and SoundWire DMA probe functions.

This also preserves the original error code in the PDM driver
instead of converting it to -ENODEV.

Signed-off-by: bui duc phuc <phucduc.bui@gmail.com>
---
 sound/soc/amd/ps/ps-pdm-dma.c | 13 +++----------
 sound/soc/amd/ps/ps-sdw-dma.c | 12 +++---------
 2 files changed, 6 insertions(+), 19 deletions(-)

diff --git a/sound/soc/amd/ps/ps-pdm-dma.c b/sound/soc/amd/ps/ps-pdm-dma.c
index 6e2e08c097a0..bb5e79c6f519 100644
--- a/sound/soc/amd/ps/ps-pdm-dma.c
+++ b/sound/soc/amd/ps/ps-pdm-dma.c
@@ -397,16 +397,9 @@ static int acp63_pdm_audio_probe(struct platform_device *pdev)
 	if (status)
 		return status;
 
-	status = devm_snd_soc_register_component(&pdev->dev,
-						 &acp63_pdm_component,
-						 &acp63_pdm_dai_driver, 1);
-	if (status) {
-		dev_err(&pdev->dev, "Fail to register acp pdm dai\n");
-
-		return -ENODEV;
-	}
-
-	return 0;
+	return devm_snd_soc_register_component(&pdev->dev,
+					       &acp63_pdm_component,
+					       &acp63_pdm_dai_driver, 1);
 }
 
 static int acp63_pdm_resume(struct device *dev)
diff --git a/sound/soc/amd/ps/ps-sdw-dma.c b/sound/soc/amd/ps/ps-sdw-dma.c
index 6b78b2d49b12..94f5264d5c89 100644
--- a/sound/soc/amd/ps/ps-sdw-dma.c
+++ b/sound/soc/amd/ps/ps-sdw-dma.c
@@ -681,15 +681,9 @@ static int acp63_sdw_platform_probe(struct platform_device *pdev)
 	if (status)
 		return status;
 
-	status = devm_snd_soc_register_component(&pdev->dev,
-						 &acp63_sdw_component,
-						 NULL, 0);
-	if (status) {
-		dev_err(&pdev->dev, "Fail to register sdw dma component\n");
-		return status;
-	}
-
-	return 0;
+	return devm_snd_soc_register_component(&pdev->dev,
+					       &acp63_sdw_component,
+					       NULL, 0);
 }
 
 static int acp63_restore_sdw_dma_config(struct sdw_dma_dev_data *sdw_data)
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH v2 3/9] ASoC: amd: raven: Use devm_pm_runtime_enable()
  2026-12-04 11:16 [PATCH v2 0/9] ASoC: amd: Use devm_pm_runtime_enable() phucduc.bui
  2026-12-04 11:16 ` [PATCH v2 1/9] ASoC: amd: ps: " phucduc.bui
  2026-12-04 11:16 ` [PATCH v2 2/9] ASoC: amd: ps: Simplify component registration phucduc.bui
@ 2026-12-04 11:16 ` phucduc.bui
  2026-12-04 11:52   ` Mukunda,Vijendar
  2026-12-04 11:16 ` [PATCH v2 4/9] ASoC: amd: raven: Preserve probe error codes phucduc.bui
                   ` (6 subsequent siblings)
  9 siblings, 1 reply; 12+ messages in thread
From: phucduc.bui @ 2026-12-04 11:16 UTC (permalink / raw)
  To: Mark Brown, Vijendar Mukunda, Venkata Prasad Potturu,
	Syed Saba Kareem
  Cc: Liam Girdwood, Jaroslav Kysela, Takashi Iwai, Kees Cook,
	Kuninori Morimoto, wangdicheng, Chris Bainbridge, linux-sound,
	linux-kernel, bui duc phuc

From: bui duc phuc <phucduc.bui@gmail.com>

Use devm_pm_runtime_enable() to automatically disable runtime PM
when the device is removed, allowing the remove callback to be
removed.

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

Changes in v2:
 - Enable runtime PM before registering IRQs and components.
 - Restore mmACP_EXTERNAL_INTR_ENB in probe functions.

 sound/soc/amd/raven/acp3x-pcm-dma.c | 41 +++++++++++++++--------------
 1 file changed, 21 insertions(+), 20 deletions(-)

diff --git a/sound/soc/amd/raven/acp3x-pcm-dma.c b/sound/soc/amd/raven/acp3x-pcm-dma.c
index 700c0ca20e18..1555157d8316 100644
--- a/sound/soc/amd/raven/acp3x-pcm-dma.c
+++ b/sound/soc/amd/raven/acp3x-pcm-dma.c
@@ -408,33 +408,35 @@ static int acp3x_audio_probe(struct platform_device *pdev)
 	adata->i2s_irq = status;
 
 	dev_set_drvdata(&pdev->dev, adata);
-	status = devm_snd_soc_register_component(&pdev->dev,
-						 &acp3x_i2s_component,
-						 NULL, 0);
-	if (status) {
-		dev_err(&pdev->dev, "Fail to register acp i2s component\n");
-		return -ENODEV;
-	}
-	status = devm_request_irq(&pdev->dev, adata->i2s_irq, i2s_irq_handler,
-				  irqflags, "ACP3x_I2S_IRQ", adata);
-	if (status) {
-		dev_err(&pdev->dev, "ACP3x I2S IRQ request failed\n");
-		return -ENODEV;
-	}
 
 	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);
+	status = devm_pm_runtime_enable(&pdev->dev);
+	if (status)
+		return status;
+
+	status = devm_request_irq(&pdev->dev, adata->i2s_irq, i2s_irq_handler,
+				  irqflags, "ACP3x_I2S_IRQ", adata);
+	if (status) {
+		dev_err(&pdev->dev, "ACP3x I2S IRQ request failed\n");
+		return -ENODEV;
+	}
+
+	rv_writel(1, adata->acp3x_base + mmACP_EXTERNAL_INTR_ENB);
+
+	status = devm_snd_soc_register_component(&pdev->dev,
+						 &acp3x_i2s_component,
+						 NULL, 0);
+	if (status) {
+		dev_err(&pdev->dev, "Fail to register acp i2s component\n");
+		return -ENODEV;
+	}
+
 	return 0;
 }
 
-static void acp3x_audio_remove(struct platform_device *pdev)
-{
-	pm_runtime_disable(&pdev->dev);
-}
-
 static int acp3x_resume(struct device *dev)
 {
 	struct i2s_dev_data *adata;
@@ -517,7 +519,6 @@ static const struct dev_pm_ops acp3x_pm_ops = {
 
 static struct platform_driver acp3x_dma_driver = {
 	.probe = acp3x_audio_probe,
-	.remove = acp3x_audio_remove,
 	.driver = {
 		.name = "acp3x_rv_i2s_dma",
 		.pm = &acp3x_pm_ops,
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH v2 4/9] ASoC: amd: raven: Preserve probe error codes
  2026-12-04 11:16 [PATCH v2 0/9] ASoC: amd: Use devm_pm_runtime_enable() phucduc.bui
                   ` (2 preceding siblings ...)
  2026-12-04 11:16 ` [PATCH v2 3/9] ASoC: amd: raven: Use devm_pm_runtime_enable() phucduc.bui
@ 2026-12-04 11:16 ` phucduc.bui
  2026-12-04 11:16 ` [PATCH v2 5/9] ASoC: amd: renoir: Use devm_pm_runtime_enable() phucduc.bui
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 12+ messages in thread
From: phucduc.bui @ 2026-12-04 11:16 UTC (permalink / raw)
  To: Mark Brown, Vijendar Mukunda, Venkata Prasad Potturu,
	Syed Saba Kareem
  Cc: Liam Girdwood, Jaroslav Kysela, Takashi Iwai, Kees Cook,
	Kuninori Morimoto, wangdicheng, Chris Bainbridge, linux-sound,
	linux-kernel, bui duc phuc

From: bui duc phuc <phucduc.bui@gmail.com>

Return the original error codes from devm_request_irq() and
devm_snd_soc_register_component() instead of converting them
to -ENODEV.

Remove the redundant error messages.

Signed-off-by: bui duc phuc <phucduc.bui@gmail.com>
---
 sound/soc/amd/raven/acp3x-pcm-dma.c | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/sound/soc/amd/raven/acp3x-pcm-dma.c b/sound/soc/amd/raven/acp3x-pcm-dma.c
index 1555157d8316..6842b7cd22ef 100644
--- a/sound/soc/amd/raven/acp3x-pcm-dma.c
+++ b/sound/soc/amd/raven/acp3x-pcm-dma.c
@@ -419,20 +419,16 @@ static int acp3x_audio_probe(struct platform_device *pdev)
 
 	status = devm_request_irq(&pdev->dev, adata->i2s_irq, i2s_irq_handler,
 				  irqflags, "ACP3x_I2S_IRQ", adata);
-	if (status) {
-		dev_err(&pdev->dev, "ACP3x I2S IRQ request failed\n");
-		return -ENODEV;
-	}
+	if (status)
+		return status;
 
 	rv_writel(1, adata->acp3x_base + mmACP_EXTERNAL_INTR_ENB);
 
 	status = devm_snd_soc_register_component(&pdev->dev,
 						 &acp3x_i2s_component,
 						 NULL, 0);
-	if (status) {
-		dev_err(&pdev->dev, "Fail to register acp i2s component\n");
-		return -ENODEV;
-	}
+	if (status)
+		return status;
 
 	return 0;
 }
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH v2 5/9] ASoC: amd: renoir: Use devm_pm_runtime_enable()
  2026-12-04 11:16 [PATCH v2 0/9] ASoC: amd: Use devm_pm_runtime_enable() phucduc.bui
                   ` (3 preceding siblings ...)
  2026-12-04 11:16 ` [PATCH v2 4/9] ASoC: amd: raven: Preserve probe error codes phucduc.bui
@ 2026-12-04 11:16 ` phucduc.bui
  2026-12-04 11:16 ` [PATCH v2 6/9] ASoC: amd: renoir: Preserve probe error codes phucduc.bui
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 12+ messages in thread
From: phucduc.bui @ 2026-12-04 11:16 UTC (permalink / raw)
  To: Mark Brown, Vijendar Mukunda, Venkata Prasad Potturu,
	Syed Saba Kareem
  Cc: Liam Girdwood, Jaroslav Kysela, Takashi Iwai, Kees Cook,
	Kuninori Morimoto, wangdicheng, Chris Bainbridge, linux-sound,
	linux-kernel, bui duc phuc

From: bui duc phuc <phucduc.bui@gmail.com>

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@gmail.com>
---

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


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH v2 6/9] ASoC: amd: renoir: Preserve probe error codes
  2026-12-04 11:16 [PATCH v2 0/9] ASoC: amd: Use devm_pm_runtime_enable() phucduc.bui
                   ` (4 preceding siblings ...)
  2026-12-04 11:16 ` [PATCH v2 5/9] ASoC: amd: renoir: Use devm_pm_runtime_enable() phucduc.bui
@ 2026-12-04 11:16 ` phucduc.bui
  2026-12-04 11:16 ` [PATCH v2 7/9] ASoC: amd: vangogh: Use devm_pm_runtime_enable() phucduc.bui
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 12+ messages in thread
From: phucduc.bui @ 2026-12-04 11:16 UTC (permalink / raw)
  To: Mark Brown, Vijendar Mukunda, Venkata Prasad Potturu,
	Syed Saba Kareem
  Cc: Liam Girdwood, Jaroslav Kysela, Takashi Iwai, Kees Cook,
	Kuninori Morimoto, wangdicheng, Chris Bainbridge, linux-sound,
	linux-kernel, bui duc phuc

From: bui duc phuc <phucduc.bui@gmail.com>

Return the original error codes from devm_request_irq() and
devm_snd_soc_register_component() instead of converting them
to -ENODEV.

Also remove redundant error messages and simplify the probe
function's return path.

Signed-off-by: bui duc phuc <phucduc.bui@gmail.com>
---
 sound/soc/amd/renoir/acp3x-pdm-dma.c | 19 +++++--------------
 1 file changed, 5 insertions(+), 14 deletions(-)

diff --git a/sound/soc/amd/renoir/acp3x-pdm-dma.c b/sound/soc/amd/renoir/acp3x-pdm-dma.c
index 84ee9b931858..148b7e1f2c61 100644
--- a/sound/soc/amd/renoir/acp3x-pdm-dma.c
+++ b/sound/soc/amd/renoir/acp3x-pdm-dma.c
@@ -433,21 +433,12 @@ static int acp_pdm_audio_probe(struct platform_device *pdev)
 
 	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;
-	}
+	if (status)
+		return status;
 
-	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;
+	return devm_snd_soc_register_component(&pdev->dev,
+					       &acp_pdm_component,
+					       &acp_pdm_dai_driver, 1);
 }
 
 static int acp_pdm_resume(struct device *dev)
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH v2 7/9] ASoC: amd: vangogh: Use devm_pm_runtime_enable()
  2026-12-04 11:16 [PATCH v2 0/9] ASoC: amd: Use devm_pm_runtime_enable() phucduc.bui
                   ` (5 preceding siblings ...)
  2026-12-04 11:16 ` [PATCH v2 6/9] ASoC: amd: renoir: Preserve probe error codes phucduc.bui
@ 2026-12-04 11:16 ` phucduc.bui
  2026-12-04 11:16 ` [PATCH v2 8/9] ASoC: amd: yc: " phucduc.bui
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 12+ messages in thread
From: phucduc.bui @ 2026-12-04 11:16 UTC (permalink / raw)
  To: Mark Brown, Vijendar Mukunda, Venkata Prasad Potturu,
	Syed Saba Kareem
  Cc: Liam Girdwood, Jaroslav Kysela, Takashi Iwai, Kees Cook,
	Kuninori Morimoto, wangdicheng, Chris Bainbridge, linux-sound,
	linux-kernel, bui duc phuc

From: bui duc phuc <phucduc.bui@gmail.com>

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@gmail.com>
---

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


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH v2 8/9] ASoC: amd: yc: Use devm_pm_runtime_enable()
  2026-12-04 11:16 [PATCH v2 0/9] ASoC: amd: Use devm_pm_runtime_enable() phucduc.bui
                   ` (6 preceding siblings ...)
  2026-12-04 11:16 ` [PATCH v2 7/9] ASoC: amd: vangogh: Use devm_pm_runtime_enable() phucduc.bui
@ 2026-12-04 11:16 ` phucduc.bui
  2026-12-04 11:16 ` [PATCH v2 9/9] ASoC: amd: yc: Simplify component registration phucduc.bui
  2026-12-04 12:46 ` [PATCH v2 0/9] ASoC: amd: Use devm_pm_runtime_enable() Syed Saba Kareem
  9 siblings, 0 replies; 12+ messages in thread
From: phucduc.bui @ 2026-12-04 11:16 UTC (permalink / raw)
  To: Mark Brown, Vijendar Mukunda, Venkata Prasad Potturu,
	Syed Saba Kareem
  Cc: Liam Girdwood, Jaroslav Kysela, Takashi Iwai, Kees Cook,
	Kuninori Morimoto, wangdicheng, Chris Bainbridge, linux-sound,
	linux-kernel, bui duc phuc

From: bui duc phuc <phucduc.bui@gmail.com>

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@gmail.com>
---

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


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH v2 9/9] ASoC: amd: yc: Simplify component registration
  2026-12-04 11:16 [PATCH v2 0/9] ASoC: amd: Use devm_pm_runtime_enable() phucduc.bui
                   ` (7 preceding siblings ...)
  2026-12-04 11:16 ` [PATCH v2 8/9] ASoC: amd: yc: " phucduc.bui
@ 2026-12-04 11:16 ` phucduc.bui
  2026-12-04 12:46 ` [PATCH v2 0/9] ASoC: amd: Use devm_pm_runtime_enable() Syed Saba Kareem
  9 siblings, 0 replies; 12+ messages in thread
From: phucduc.bui @ 2026-12-04 11:16 UTC (permalink / raw)
  To: Mark Brown, Vijendar Mukunda, Venkata Prasad Potturu,
	Syed Saba Kareem
  Cc: Liam Girdwood, Jaroslav Kysela, Takashi Iwai, Kees Cook,
	Kuninori Morimoto, wangdicheng, Chris Bainbridge, linux-sound,
	linux-kernel, bui duc phuc

From: bui duc phuc <phucduc.bui@gmail.com>

Return the result of devm_snd_soc_register_component() directly
instead of checking and converting the error to -ENODEV.

Signed-off-by: bui duc phuc <phucduc.bui@gmail.com>
---
 sound/soc/amd/yc/acp6x-pdm-dma.c | 13 +++----------
 1 file changed, 3 insertions(+), 10 deletions(-)

diff --git a/sound/soc/amd/yc/acp6x-pdm-dma.c b/sound/soc/amd/yc/acp6x-pdm-dma.c
index 99977b44bc9e..057ac5b35894 100644
--- a/sound/soc/amd/yc/acp6x-pdm-dma.c
+++ b/sound/soc/amd/yc/acp6x-pdm-dma.c
@@ -390,16 +390,9 @@ static int acp6x_pdm_audio_probe(struct platform_device *pdev)
 	if (status)
 		return status;
 
-	status = devm_snd_soc_register_component(&pdev->dev,
-						 &acp6x_pdm_component,
-						 &acp6x_pdm_dai_driver, 1);
-	if (status) {
-		dev_err(&pdev->dev, "Fail to register acp pdm dai\n");
-
-		return -ENODEV;
-	}
-
-	return 0;
+	return devm_snd_soc_register_component(&pdev->dev,
+					       &acp6x_pdm_component,
+					       &acp6x_pdm_dai_driver, 1);
 }
 
 static int acp6x_pdm_resume(struct device *dev)
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* Re: [PATCH v2 3/9] ASoC: amd: raven: Use devm_pm_runtime_enable()
  2026-12-04 11:16 ` [PATCH v2 3/9] ASoC: amd: raven: Use devm_pm_runtime_enable() phucduc.bui
@ 2026-12-04 11:52   ` Mukunda,Vijendar
  0 siblings, 0 replies; 12+ messages in thread
From: Mukunda,Vijendar @ 2026-12-04 11:52 UTC (permalink / raw)
  To: phucduc.bui, Mark Brown, Venkata Prasad Potturu, Syed Saba Kareem
  Cc: Liam Girdwood, Jaroslav Kysela, Takashi Iwai, Kees Cook,
	Kuninori Morimoto, wangdicheng, Chris Bainbridge, linux-sound,
	linux-kernel



On 12/4/26 16:46, phucduc.bui@gmail.com wrote:
> From: bui duc phuc <phucduc.bui@gmail.com>
>
> Use devm_pm_runtime_enable() to automatically disable runtime PM
> when the device is removed, allowing the remove callback to be
> removed.
>
> Signed-off-by: bui duc phuc <phucduc.bui@gmail.com>
> ---
>
> Changes in v2:
>   - Enable runtime PM before registering IRQs and components.
>   - Restore mmACP_EXTERNAL_INTR_ENB in probe functions.
The kernel patch convention is "Changes since v2:" not "Changes in v2:".
See Documentation/process/submitting-patches.rst.
>
>   sound/soc/amd/raven/acp3x-pcm-dma.c | 41 +++++++++++++++--------------
>   1 file changed, 21 insertions(+), 20 deletions(-)
>
> diff --git a/sound/soc/amd/raven/acp3x-pcm-dma.c b/sound/soc/amd/raven/acp3x-pcm-dma.c
> index 700c0ca20e18..1555157d8316 100644
> --- a/sound/soc/amd/raven/acp3x-pcm-dma.c
> +++ b/sound/soc/amd/raven/acp3x-pcm-dma.c
> @@ -408,33 +408,35 @@ static int acp3x_audio_probe(struct platform_device *pdev)
>   	adata->i2s_irq = status;
>   
>   	dev_set_drvdata(&pdev->dev, adata);
> -	status = devm_snd_soc_register_component(&pdev->dev,
> -						 &acp3x_i2s_component,
> -						 NULL, 0);
> -	if (status) {
> -		dev_err(&pdev->dev, "Fail to register acp i2s component\n");
> -		return -ENODEV;
> -	}
> -	status = devm_request_irq(&pdev->dev, adata->i2s_irq, i2s_irq_handler,
> -				  irqflags, "ACP3x_I2S_IRQ", adata);
> -	if (status) {
> -		dev_err(&pdev->dev, "ACP3x I2S IRQ request failed\n");
> -		return -ENODEV;
> -	}
>   
>   	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);
> +	status = devm_pm_runtime_enable(&pdev->dev);
> +	if (status)
> +		return status;
> +
> +	status = devm_request_irq(&pdev->dev, adata->i2s_irq, i2s_irq_handler,
> +				  irqflags, "ACP3x_I2S_IRQ", adata);
> +	if (status) {
> +		dev_err(&pdev->dev, "ACP3x I2S IRQ request failed\n");
> +		return -ENODEV;
> +	}
> +
> +	rv_writel(1, adata->acp3x_base + mmACP_EXTERNAL_INTR_ENB);
The parent PCI driver's acp_init() already writes this register and
re-enabling it in probe is redundant. Drop this change.
> +
> +	status = devm_snd_soc_register_component(&pdev->dev,
> +						 &acp3x_i2s_component,
> +						 NULL, 0);
> +	if (status) {
> +		dev_err(&pdev->dev, "Fail to register acp i2s component\n");
> +		return -ENODEV;
This is a pre-existing bug but since this patch touches both error
paths, please fix it here: return status instead of -ENODEV.
Returning a hardcoded -ENODEV throws away the real error from
devm_request_irq() / devm_snd_soc_register_component() and makes
failures harder to diagnose.
> +	}
> +
>   	return 0;
>   }
>   
> -static void acp3x_audio_remove(struct platform_device *pdev)
> -{
> -	pm_runtime_disable(&pdev->dev);
> -}
> -
>   static int acp3x_resume(struct device *dev)
>   {
>   	struct i2s_dev_data *adata;
> @@ -517,7 +519,6 @@ static const struct dev_pm_ops acp3x_pm_ops = {
>   
>   static struct platform_driver acp3x_dma_driver = {
>   	.probe = acp3x_audio_probe,
> -	.remove = acp3x_audio_remove,
>   	.driver = {
>   		.name = "acp3x_rv_i2s_dma",
>   		.pm = &acp3x_pm_ops,


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH v2 0/9] ASoC: amd: Use devm_pm_runtime_enable()
  2026-12-04 11:16 [PATCH v2 0/9] ASoC: amd: Use devm_pm_runtime_enable() phucduc.bui
                   ` (8 preceding siblings ...)
  2026-12-04 11:16 ` [PATCH v2 9/9] ASoC: amd: yc: Simplify component registration phucduc.bui
@ 2026-12-04 12:46 ` Syed Saba Kareem
  9 siblings, 0 replies; 12+ messages in thread
From: Syed Saba Kareem @ 2026-12-04 12:46 UTC (permalink / raw)
  To: phucduc.bui, Mark Brown, Vijendar Mukunda, Venkata Prasad Potturu
  Cc: Liam Girdwood, Jaroslav Kysela, Takashi Iwai, Kees Cook,
	Kuninori Morimoto, wangdicheng, Chris Bainbridge, linux-sound,
	linux-kernel


On 12/4/26 16:46, phucduc.bui@gmail.com wrote:
> From: bui duc phuc <phucduc.bui@gmail.com>
>
> Hi all,
>
> Use devm_pm_runtime_enable() in AMD DMA drivers to
> automatically disable runtime PM when the devices are removed.
>
> This allows removing their remove callbacks.
Please address the comments from Sashiko and post a new revision.
We'll revision the updated patch from the AMD side.
>
> Link v1:
> https://lore.kernel.org/all/CAABR9nEtxzKfPEfD_ayUf5m8yMY67SEyH4fytz06UE4W1AZD2w@mail.gmail.com/
>
> Changes in v2:
>   - Enable runtime PM before registering IRQs and components.
>   - Restore ACP_EXTERNAL_INTR_ENB in Raven and Vangogh probe functions.
>   - Preserve original error codes instead of converting them to -ENODEV.
>   - Remove redundant error messages.
>
> Compile-tested only.
>
> Best regards,
> Phuc
>
> bui duc phuc (9):
>    ASoC: amd: ps: Use devm_pm_runtime_enable()
>    ASoC: amd: ps: Simplify component registration
>    ASoC: amd: raven: Use devm_pm_runtime_enable()
>    ASoC: amd: raven: Preserve probe error codes
>    ASoC: amd: renoir: Use devm_pm_runtime_enable()
>    ASoC: amd: renoir: Preserve probe error codes
>    ASoC: amd: vangogh: Use devm_pm_runtime_enable()
>    ASoC: amd: yc: Use devm_pm_runtime_enable()
>    ASoC: amd: yc: Simplify component registration
>
>   sound/soc/amd/ps/ps-pdm-dma.c         | 20 +++++----------
>   sound/soc/amd/ps/ps-sdw-dma.c         | 21 +++++----------
>   sound/soc/amd/raven/acp3x-pcm-dma.c   | 37 ++++++++++++---------------
>   sound/soc/amd/renoir/acp3x-pdm-dma.c  | 31 ++++++++--------------
>   sound/soc/amd/vangogh/acp5x-pcm-dma.c | 34 ++++++++++--------------
>   sound/soc/amd/yc/acp6x-pdm-dma.c      | 20 +++++----------
>   6 files changed, 61 insertions(+), 102 deletions(-

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2026-12-04 12:47 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-04 11:16 [PATCH v2 0/9] ASoC: amd: Use devm_pm_runtime_enable() phucduc.bui
2026-12-04 11:16 ` [PATCH v2 1/9] ASoC: amd: ps: " phucduc.bui
2026-12-04 11:16 ` [PATCH v2 2/9] ASoC: amd: ps: Simplify component registration phucduc.bui
2026-12-04 11:16 ` [PATCH v2 3/9] ASoC: amd: raven: Use devm_pm_runtime_enable() phucduc.bui
2026-12-04 11:52   ` Mukunda,Vijendar
2026-12-04 11:16 ` [PATCH v2 4/9] ASoC: amd: raven: Preserve probe error codes phucduc.bui
2026-12-04 11:16 ` [PATCH v2 5/9] ASoC: amd: renoir: Use devm_pm_runtime_enable() phucduc.bui
2026-12-04 11:16 ` [PATCH v2 6/9] ASoC: amd: renoir: Preserve probe error codes phucduc.bui
2026-12-04 11:16 ` [PATCH v2 7/9] ASoC: amd: vangogh: Use devm_pm_runtime_enable() phucduc.bui
2026-12-04 11:16 ` [PATCH v2 8/9] ASoC: amd: yc: " phucduc.bui
2026-12-04 11:16 ` [PATCH v2 9/9] ASoC: amd: yc: Simplify component registration phucduc.bui
2026-12-04 12:46 ` [PATCH v2 0/9] ASoC: amd: Use devm_pm_runtime_enable() Syed Saba Kareem

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox