Linux Sound subsystem development
 help / color / mirror / Atom feed
* [PATCH 0/5] ASoC: amd: Use devm_pm_runtime_enable()
@ 2026-12-03  9:45 phucduc.bui
  2026-12-03  9:45 ` [PATCH 1/5] ASoC: amd: ps: " phucduc.bui
                   ` (4 more replies)
  0 siblings, 5 replies; 7+ messages in thread
From: phucduc.bui @ 2026-12-03  9:45 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,

This series converts AMD DMA drivers to use devm_pm_runtime_enable()
instead of pm_runtime_enable(), allowing the explicit remove callbacks
to be removed.

Compile-tested only.

Best regards,
Phuc

bui duc phuc (5):
  ASoC: amd: ps: Use devm_pm_runtime_enable()
  ASoC: amd: raven: Use devm_pm_runtime_enable()
  ASoC: amd: renoir: Use devm_pm_runtime_enable()
  ASoC: amd: vangogh: Use devm_pm_runtime_enable()
  ASoC: amd: yc: Use devm_pm_runtime_enable()

 sound/soc/amd/ps/ps-pdm-dma.c         | 8 +-------
 sound/soc/amd/ps/ps-sdw-dma.c         | 8 +-------
 sound/soc/amd/raven/acp3x-pcm-dma.c   | 8 +-------
 sound/soc/amd/renoir/acp3x-pdm-dma.c  | 8 +-------
 sound/soc/amd/vangogh/acp5x-pcm-dma.c | 8 +-------
 sound/soc/amd/yc/acp6x-pdm-dma.c      | 8 +-------
 6 files changed, 6 insertions(+), 42 deletions(-)

-- 
2.43.0


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

* [PATCH 1/5] ASoC: amd: ps: Use devm_pm_runtime_enable()
  2026-12-03  9:45 [PATCH 0/5] ASoC: amd: Use devm_pm_runtime_enable() phucduc.bui
@ 2026-12-03  9:45 ` phucduc.bui
  2026-12-03 10:00   ` sashiko-bot
  2026-12-03  9:45 ` [PATCH 2/5] ASoC: amd: raven: " phucduc.bui
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 7+ messages in thread
From: phucduc.bui @ 2026-12-03  9:45 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>
---
 sound/soc/amd/ps/ps-pdm-dma.c | 8 +-------
 sound/soc/amd/ps/ps-sdw-dma.c | 8 +-------
 2 files changed, 2 insertions(+), 14 deletions(-)

diff --git a/sound/soc/amd/ps/ps-pdm-dma.c b/sound/soc/amd/ps/ps-pdm-dma.c
index 359ca10b9ba4..7a894e8688ae 100644
--- a/sound/soc/amd/ps/ps-pdm-dma.c
+++ b/sound/soc/amd/ps/ps-pdm-dma.c
@@ -400,13 +400,8 @@ static int acp63_pdm_audio_probe(struct platform_device *pdev)
 	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 devm_pm_runtime_enable(&pdev->dev);
 }
 
 static int acp63_pdm_resume(struct device *dev)
@@ -455,7 +450,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..5bf712bcd8c5 100644
--- a/sound/soc/amd/ps/ps-sdw-dma.c
+++ b/sound/soc/amd/ps/ps-sdw-dma.c
@@ -683,13 +683,8 @@ static int acp63_sdw_platform_probe(struct platform_device *pdev)
 	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 devm_pm_runtime_enable(&pdev->dev);
 }
 
 static int acp63_restore_sdw_dma_config(struct sdw_dma_dev_data *sdw_data)
@@ -795,7 +790,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] 7+ messages in thread

* [PATCH 2/5] ASoC: amd: raven: Use devm_pm_runtime_enable()
  2026-12-03  9:45 [PATCH 0/5] ASoC: amd: Use devm_pm_runtime_enable() phucduc.bui
  2026-12-03  9:45 ` [PATCH 1/5] ASoC: amd: ps: " phucduc.bui
@ 2026-12-03  9:45 ` phucduc.bui
  2026-12-03  9:45 ` [PATCH 3/5] ASoC: amd: renoir: " phucduc.bui
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 7+ messages in thread
From: phucduc.bui @ 2026-12-03  9:45 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>
---
 sound/soc/amd/raven/acp3x-pcm-dma.c | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/sound/soc/amd/raven/acp3x-pcm-dma.c b/sound/soc/amd/raven/acp3x-pcm-dma.c
index 700c0ca20e18..da8ae707a04d 100644
--- a/sound/soc/amd/raven/acp3x-pcm-dma.c
+++ b/sound/soc/amd/raven/acp3x-pcm-dma.c
@@ -426,13 +426,8 @@ static int acp3x_audio_probe(struct platform_device *pdev)
 	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 acp3x_audio_remove(struct platform_device *pdev)
-{
-	pm_runtime_disable(&pdev->dev);
+	return devm_pm_runtime_enable(&pdev->dev);
 }
 
 static int acp3x_resume(struct device *dev)
@@ -517,7 +512,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] 7+ messages in thread

* [PATCH 3/5] ASoC: amd: renoir: Use devm_pm_runtime_enable()
  2026-12-03  9:45 [PATCH 0/5] ASoC: amd: Use devm_pm_runtime_enable() phucduc.bui
  2026-12-03  9:45 ` [PATCH 1/5] ASoC: amd: ps: " phucduc.bui
  2026-12-03  9:45 ` [PATCH 2/5] ASoC: amd: raven: " phucduc.bui
@ 2026-12-03  9:45 ` phucduc.bui
  2026-12-03  9:45 ` [PATCH 4/5] ASoC: amd: vangogh: " phucduc.bui
  2026-12-03  9:45 ` [PATCH 5/5] ASoC: amd: yc: " phucduc.bui
  4 siblings, 0 replies; 7+ messages in thread
From: phucduc.bui @ 2026-12-03  9:45 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>
---
 sound/soc/amd/renoir/acp3x-pdm-dma.c | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/sound/soc/amd/renoir/acp3x-pdm-dma.c b/sound/soc/amd/renoir/acp3x-pdm-dma.c
index bea1208f1702..f6e9335d238a 100644
--- a/sound/soc/amd/renoir/acp3x-pdm-dma.c
+++ b/sound/soc/amd/renoir/acp3x-pdm-dma.c
@@ -440,13 +440,8 @@ static int acp_pdm_audio_probe(struct platform_device *pdev)
 	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 acp_pdm_audio_remove(struct platform_device *pdev)
-{
-	pm_runtime_disable(&pdev->dev);
+	return devm_pm_runtime_enable(&pdev->dev);
 }
 
 static int acp_pdm_resume(struct device *dev)
@@ -497,7 +492,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] 7+ messages in thread

* [PATCH 4/5] ASoC: amd: vangogh: Use devm_pm_runtime_enable()
  2026-12-03  9:45 [PATCH 0/5] ASoC: amd: Use devm_pm_runtime_enable() phucduc.bui
                   ` (2 preceding siblings ...)
  2026-12-03  9:45 ` [PATCH 3/5] ASoC: amd: renoir: " phucduc.bui
@ 2026-12-03  9:45 ` phucduc.bui
  2026-12-03  9:45 ` [PATCH 5/5] ASoC: amd: yc: " phucduc.bui
  4 siblings, 0 replies; 7+ messages in thread
From: phucduc.bui @ 2026-12-03  9:45 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>
---
 sound/soc/amd/vangogh/acp5x-pcm-dma.c | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/sound/soc/amd/vangogh/acp5x-pcm-dma.c b/sound/soc/amd/vangogh/acp5x-pcm-dma.c
index 8b09e66610b5..c52288c4c9a8 100644
--- a/sound/soc/amd/vangogh/acp5x-pcm-dma.c
+++ b/sound/soc/amd/vangogh/acp5x-pcm-dma.c
@@ -417,13 +417,8 @@ static int acp5x_audio_probe(struct platform_device *pdev)
 	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 acp5x_audio_remove(struct platform_device *pdev)
-{
-	pm_runtime_disable(&pdev->dev);
+	return devm_pm_runtime_enable(&pdev->dev);
 }
 
 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] 7+ messages in thread

* [PATCH 5/5] ASoC: amd: yc: Use devm_pm_runtime_enable()
  2026-12-03  9:45 [PATCH 0/5] ASoC: amd: Use devm_pm_runtime_enable() phucduc.bui
                   ` (3 preceding siblings ...)
  2026-12-03  9:45 ` [PATCH 4/5] ASoC: amd: vangogh: " phucduc.bui
@ 2026-12-03  9:45 ` phucduc.bui
  4 siblings, 0 replies; 7+ messages in thread
From: phucduc.bui @ 2026-12-03  9:45 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>
---
 sound/soc/amd/yc/acp6x-pdm-dma.c | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/sound/soc/amd/yc/acp6x-pdm-dma.c b/sound/soc/amd/yc/acp6x-pdm-dma.c
index 3f8c73a1f182..5a6a4c8b8af2 100644
--- a/sound/soc/amd/yc/acp6x-pdm-dma.c
+++ b/sound/soc/amd/yc/acp6x-pdm-dma.c
@@ -393,13 +393,8 @@ static int acp6x_pdm_audio_probe(struct platform_device *pdev)
 	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 devm_pm_runtime_enable(&pdev->dev);
 }
 
 static int acp6x_pdm_resume(struct device *dev)
@@ -448,7 +443,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] 7+ messages in thread

* Re: [PATCH 1/5] ASoC: amd: ps: Use devm_pm_runtime_enable()
  2026-12-03  9:45 ` [PATCH 1/5] ASoC: amd: ps: " phucduc.bui
@ 2026-12-03 10:00   ` sashiko-bot
  0 siblings, 0 replies; 7+ messages in thread
From: sashiko-bot @ 2026-12-03 10:00 UTC (permalink / raw)
  To: phucduc.bui; +Cc: linux-sound

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] ASoC: amd: ps: runtime PM suspended before component
  unregistration
--

commit afe126b816589bbc879239646442299aee4ce385
Author: bui duc phuc <phucduc.bui@gmail.com>

ASoC: amd: ps: Use devm_pm_runtime_enable()

This commit replaces pm_runtime_enable() and the remove callbacks in the AMD
PS PDM and SoundWire DMA drivers with devm_pm_runtime_enable().

> diff --git a/sound/soc/amd/ps/ps-pdm-dma.c b/sound/soc/amd/ps/ps-pdm-dma.c
> index 359ca10b9ba49..7a894e8688ae1 100644
> --- a/sound/soc/amd/ps/ps-pdm-dma.c
> +++ b/sound/soc/amd/ps/ps-pdm-dma.c
> @@ -400,13 +400,8 @@ static int acp63_pdm_audio_probe(struct platform_device *pdev)
>  	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 devm_pm_runtime_enable(&pdev->dev);
>  }

[Severity: Medium]
Can calling devm_pm_runtime_enable() after devm_snd_soc_register_component()
suspend the device while its PCM streams can still be opened?

Because devres runs in LIFO order, pm_runtime_disable_action() runs before
devm_component_release() unregisters the component and disconnects the card.
It calls pm_runtime_dont_use_autosuspend() while runtime PM is still enabled,
synchronously suspending the device and releasing the parent PCI device.

CPU0                              CPU1
__device_release_driver()
  devres_release_all()
    pm_runtime_disable_action()
      rpm_suspend()
      pm_runtime_disable()
                                  __soc_pcm_open()
                                    snd_soc_pcm_component_pm_runtime_get()
                                      pm_runtime_get_sync() -> -EACCES
                                    acp63_pdm_dma_open()
                                      <-- MMIO while suspended
    devm_component_release()
      snd_card_disconnect_sync()

snd_soc_pcm_component_pm_runtime_get() ignores -EACCES from
pm_runtime_get_sync(), so a concurrent open reaches acp63_pdm_dma_open() and
accesses ACP registers without resuming the device or its parent PCI device.
acp63_sdw_platform_probe() in sound/soc/amd/ps/ps-sdw-dma.c has the same bug.

Moving the runtime PM setup and devm_pm_runtime_enable() before
devm_snd_soc_register_component() in both probe functions keeps runtime PM
enabled until after the component is unregistered.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261203094558.26423-1-phucduc.bui@gmail.com?part=1

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

end of thread, other threads:[~2026-12-03 10:00 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-03  9:45 [PATCH 0/5] ASoC: amd: Use devm_pm_runtime_enable() phucduc.bui
2026-12-03  9:45 ` [PATCH 1/5] ASoC: amd: ps: " phucduc.bui
2026-12-03 10:00   ` sashiko-bot
2026-12-03  9:45 ` [PATCH 2/5] ASoC: amd: raven: " phucduc.bui
2026-12-03  9:45 ` [PATCH 3/5] ASoC: amd: renoir: " phucduc.bui
2026-12-03  9:45 ` [PATCH 4/5] ASoC: amd: vangogh: " phucduc.bui
2026-12-03  9:45 ` [PATCH 5/5] ASoC: amd: yc: " phucduc.bui

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