diff mbox series

[V2,2/2] ASoC: amd: acp: add pm ops support for renoir platform

Message ID 20231113123345.2196504-2-Syed.SabaKareem@amd.com
State Superseded
Headers show
Series None | expand

Commit Message

Saba Kareem, Syed Nov. 13, 2023, 12:33 p.m. UTC
Add pm ops for renoir platform.

Signed-off-by: Syed Saba Kareem <Syed.SabaKareem@amd.com>
---
 sound/soc/amd/acp/acp-renoir.c | 38 +++++++++++++++++++++++++++++++++-
 1 file changed, 37 insertions(+), 1 deletion(-)

Comments

Linux regression tracking (Thorsten Leemhuis) Dec. 15, 2023, 11:14 a.m. UTC | #1
Hi, Thorsten here, the Linux kernel's regression tracker. Top-posting
for once, to make this easily accessible to everyone.

Does anyone know what happened to below patch? It afaics was meant to
fix a regression that made it into 6.6. For details see:

https://lore.kernel.org/lkml/87a5v8szhc.fsf@mutex.one/
https://lore.kernel.org/lkml/ac9d4f7b-c7af-4d21-b0b8-d0f188b94b0f@amd.com/

Ciao, Thorsten (wearing his 'the Linux kernel's regression tracker' hat)
--
Everything you wanna know about Linux kernel regression tracking:
https://linux-regtracking.leemhuis.info/about/#tldr
If I did something stupid, please tell me, as explained on that page.

On 13.11.23 13:33, Syed Saba Kareem wrote:
> Add pm ops for renoir platform.
> 
> Signed-off-by: Syed Saba Kareem <Syed.SabaKareem@amd.com>
> ---
>  sound/soc/amd/acp/acp-renoir.c | 38 +++++++++++++++++++++++++++++++++-
>  1 file changed, 37 insertions(+), 1 deletion(-)
> 
> diff --git a/sound/soc/amd/acp/acp-renoir.c b/sound/soc/amd/acp/acp-renoir.c
> index a591482a0726..8539fbacdf4c 100644
> --- a/sound/soc/amd/acp/acp-renoir.c
> +++ b/sound/soc/amd/acp/acp-renoir.c
> @@ -20,6 +20,7 @@
>  #include <sound/soc.h>
>  #include <sound/soc-dai.h>
>  #include <linux/dma-mapping.h>
> +#include <linux/pm_runtime.h>
>  
>  #include "amd.h"
>  #include "acp-mach.h"
> @@ -195,7 +196,11 @@ static int renoir_audio_probe(struct platform_device *pdev)
>  	dev_set_drvdata(dev, adata);
>  	acp_enable_interrupts(adata);
>  	acp_platform_register(dev);
> -
> +	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;
>  }
>  
> @@ -208,11 +213,42 @@ static void renoir_audio_remove(struct platform_device *pdev)
>  	acp_platform_unregister(dev);
>  }
>  
> +static int __maybe_unused rn_pcm_resume(struct device *dev)
> +{
> +	struct acp_dev_data *adata = dev_get_drvdata(dev);
> +	struct acp_stream *stream;
> +	struct snd_pcm_substream *substream;
> +	snd_pcm_uframes_t buf_in_frames;
> +	u64 buf_size;
> +
> +	spin_lock(&adata->acp_lock);
> +	list_for_each_entry(stream, &adata->stream_list, list) {
> +		substream = stream->substream;
> +		if (substream && substream->runtime) {
> +			buf_in_frames = (substream->runtime->buffer_size);
> +			buf_size = frames_to_bytes(substream->runtime, buf_in_frames);
> +			config_pte_for_stream(adata, stream);
> +			config_acp_dma(adata, stream, buf_size);
> +			if (stream->dai_id)
> +				restore_acp_i2s_params(substream, adata, stream);
> +			else
> +				restore_acp_pdm_params(substream, adata);
> +		}
> +	}
> +	spin_unlock(&adata->acp_lock);
> +	return 0;
> +}
> +
> +static const struct dev_pm_ops rn_dma_pm_ops = {
> +	SET_SYSTEM_SLEEP_PM_OPS(NULL, rn_pcm_resume)
> +};
> +
>  static struct platform_driver renoir_driver = {
>  	.probe = renoir_audio_probe,
>  	.remove_new = renoir_audio_remove,
>  	.driver = {
>  		.name = "acp_asoc_renoir",
> +		.pm = &rn_dma_pm_ops,
>  	},
>  };
>
Saba Kareem, Syed Dec. 18, 2023, 12:21 p.m. UTC | #2
[AMD Official Use Only - General]

Hi Thorsten,
The patch got merged to broonie git.
Please find the below link for the details.
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git/commit/sound/soc/amd/acp?id=c95a2a0be0b1bba2e051faa105c2e0401fc2de33

Thanks,
Syed Saba Kareem.

-----Original Message-----
From: Linux regression tracking (Thorsten Leemhuis) <regressions@leemhuis.info>
Sent: Friday, December 15, 2023 4:44 PM
To: Saba Kareem, Syed <Syed.SabaKareem@amd.com>; broonie@kernel.org; alsa-devel@alsa-project.org
Cc: Mukunda, Vijendar <Vijendar.Mukunda@amd.com>; Hiregoudar, Basavaraj <Basavaraj.Hiregoudar@amd.com>; Dommati, Sunil-kumar <Sunil-kumar.Dommati@amd.com>; Limonciello, Mario <Mario.Limonciello@amd.com>; Gong, Richard <Richard.Gong@amd.com>; posteuca@mutex.one; Liam Girdwood <lgirdwood@gmail.com>; Jaroslav Kysela <perex@perex.cz>; Takashi Iwai <tiwai@suse.com>; Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>; Nicolas Ferre <nicolas.ferre@microchip.com>; Uwe Kleine-König <u.kleine-koenig@pengutronix.de>; open list <linux-kernel@vger.kernel.org>; Linux kernel regressions list <regressions@lists.linux.dev>
Subject: Re: [PATCH V2 2/2] ASoC: amd: acp: add pm ops support for renoir platform

Hi, Thorsten here, the Linux kernel's regression tracker. Top-posting for once, to make this easily accessible to everyone.

Does anyone know what happened to below patch? It afaics was meant to fix a regression that made it into 6.6. For details see:

https://lore.kernel.org/lkml/87a5v8szhc.fsf@mutex.one/
https://lore.kernel.org/lkml/ac9d4f7b-c7af-4d21-b0b8-d0f188b94b0f@amd.com/

Ciao, Thorsten (wearing his 'the Linux kernel's regression tracker' hat)
--
Everything you wanna know about Linux kernel regression tracking:
https://linux-regtracking.leemhuis.info/about/#tldr
If I did something stupid, please tell me, as explained on that page.

On 13.11.23 13:33, Syed Saba Kareem wrote:
> Add pm ops for renoir platform.
>
> Signed-off-by: Syed Saba Kareem <Syed.SabaKareem@amd.com>
> ---
>  sound/soc/amd/acp/acp-renoir.c | 38
> +++++++++++++++++++++++++++++++++-
>  1 file changed, 37 insertions(+), 1 deletion(-)
>
> diff --git a/sound/soc/amd/acp/acp-renoir.c
> b/sound/soc/amd/acp/acp-renoir.c index a591482a0726..8539fbacdf4c
> 100644
> --- a/sound/soc/amd/acp/acp-renoir.c
> +++ b/sound/soc/amd/acp/acp-renoir.c
> @@ -20,6 +20,7 @@
>  #include <sound/soc.h>
>  #include <sound/soc-dai.h>
>  #include <linux/dma-mapping.h>
> +#include <linux/pm_runtime.h>
>
>  #include "amd.h"
>  #include "acp-mach.h"
> @@ -195,7 +196,11 @@ static int renoir_audio_probe(struct platform_device *pdev)
>       dev_set_drvdata(dev, adata);
>       acp_enable_interrupts(adata);
>       acp_platform_register(dev);
> -
> +     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;
>  }
>
> @@ -208,11 +213,42 @@ static void renoir_audio_remove(struct platform_device *pdev)
>       acp_platform_unregister(dev);
>  }
>
> +static int __maybe_unused rn_pcm_resume(struct device *dev) {
> +     struct acp_dev_data *adata = dev_get_drvdata(dev);
> +     struct acp_stream *stream;
> +     struct snd_pcm_substream *substream;
> +     snd_pcm_uframes_t buf_in_frames;
> +     u64 buf_size;
> +
> +     spin_lock(&adata->acp_lock);
> +     list_for_each_entry(stream, &adata->stream_list, list) {
> +             substream = stream->substream;
> +             if (substream && substream->runtime) {
> +                     buf_in_frames = (substream->runtime->buffer_size);
> +                     buf_size = frames_to_bytes(substream->runtime, buf_in_frames);
> +                     config_pte_for_stream(adata, stream);
> +                     config_acp_dma(adata, stream, buf_size);
> +                     if (stream->dai_id)
> +                             restore_acp_i2s_params(substream, adata, stream);
> +                     else
> +                             restore_acp_pdm_params(substream, adata);
> +             }
> +     }
> +     spin_unlock(&adata->acp_lock);
> +     return 0;
> +}
> +
> +static const struct dev_pm_ops rn_dma_pm_ops = {
> +     SET_SYSTEM_SLEEP_PM_OPS(NULL, rn_pcm_resume) };
> +
>  static struct platform_driver renoir_driver = {
>       .probe = renoir_audio_probe,
>       .remove_new = renoir_audio_remove,
>       .driver = {
>               .name = "acp_asoc_renoir",
> +             .pm = &rn_dma_pm_ops,
>       },
>  };
>
diff mbox series

Patch

diff --git a/sound/soc/amd/acp/acp-renoir.c b/sound/soc/amd/acp/acp-renoir.c
index a591482a0726..8539fbacdf4c 100644
--- a/sound/soc/amd/acp/acp-renoir.c
+++ b/sound/soc/amd/acp/acp-renoir.c
@@ -20,6 +20,7 @@ 
 #include <sound/soc.h>
 #include <sound/soc-dai.h>
 #include <linux/dma-mapping.h>
+#include <linux/pm_runtime.h>
 
 #include "amd.h"
 #include "acp-mach.h"
@@ -195,7 +196,11 @@  static int renoir_audio_probe(struct platform_device *pdev)
 	dev_set_drvdata(dev, adata);
 	acp_enable_interrupts(adata);
 	acp_platform_register(dev);
-
+	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;
 }
 
@@ -208,11 +213,42 @@  static void renoir_audio_remove(struct platform_device *pdev)
 	acp_platform_unregister(dev);
 }
 
+static int __maybe_unused rn_pcm_resume(struct device *dev)
+{
+	struct acp_dev_data *adata = dev_get_drvdata(dev);
+	struct acp_stream *stream;
+	struct snd_pcm_substream *substream;
+	snd_pcm_uframes_t buf_in_frames;
+	u64 buf_size;
+
+	spin_lock(&adata->acp_lock);
+	list_for_each_entry(stream, &adata->stream_list, list) {
+		substream = stream->substream;
+		if (substream && substream->runtime) {
+			buf_in_frames = (substream->runtime->buffer_size);
+			buf_size = frames_to_bytes(substream->runtime, buf_in_frames);
+			config_pte_for_stream(adata, stream);
+			config_acp_dma(adata, stream, buf_size);
+			if (stream->dai_id)
+				restore_acp_i2s_params(substream, adata, stream);
+			else
+				restore_acp_pdm_params(substream, adata);
+		}
+	}
+	spin_unlock(&adata->acp_lock);
+	return 0;
+}
+
+static const struct dev_pm_ops rn_dma_pm_ops = {
+	SET_SYSTEM_SLEEP_PM_OPS(NULL, rn_pcm_resume)
+};
+
 static struct platform_driver renoir_driver = {
 	.probe = renoir_audio_probe,
 	.remove_new = renoir_audio_remove,
 	.driver = {
 		.name = "acp_asoc_renoir",
+		.pm = &rn_dma_pm_ops,
 	},
 };