All of lore.kernel.org
 help / color / mirror / Atom feed
* [RESEND] ASoC: amd: acp: add pm ops support for renoir platform.
@ 2023-12-15 13:02 Syed Saba Kareem
  2023-12-15 14:46 ` Mario Limonciello
  2023-12-15 22:13 ` Mark Brown
  0 siblings, 2 replies; 4+ messages in thread
From: Syed Saba Kareem @ 2023-12-15 13:02 UTC (permalink / raw)
  To: broonie, alsa-devel
  Cc: Vijendar.Mukunda, Basavaraj.Hiregoudar, Sunil-kumar.Dommati,
	mario.limonciello, posteuca, bagasdotme, venkataprasad.potturu,
	Syed Saba Kareem, Liam Girdwood, Jaroslav Kysela, Takashi Iwai,
	Kuninori Morimoto, Uwe Kleine-König, Nicolas Ferre,
	open list:SOUND - SOC LAYER / DYNAMIC AUDIO POWER MANAGEM...,
	open list

Add pm ops for renoir platform.

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

diff --git a/sound/soc/amd/acp/acp-renoir.c b/sound/soc/amd/acp/acp-renoir.c
index a591482a0726..b0e181c9a733 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"
@@ -196,6 +197,11 @@ static int renoir_audio_probe(struct platform_device *pdev)
 	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 +214,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,
 	},
 };
 
-- 
2.25.1


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

* Re: [RESEND] ASoC: amd: acp: add pm ops support for renoir platform.
  2023-12-15 13:02 [RESEND] ASoC: amd: acp: add pm ops support for renoir platform Syed Saba Kareem
@ 2023-12-15 14:46 ` Mario Limonciello
  2023-12-15 22:13 ` Mark Brown
  1 sibling, 0 replies; 4+ messages in thread
From: Mario Limonciello @ 2023-12-15 14:46 UTC (permalink / raw)
  To: Syed Saba Kareem, broonie, alsa-devel
  Cc: Vijendar.Mukunda, Basavaraj.Hiregoudar, Sunil-kumar.Dommati,
	posteuca, bagasdotme, venkataprasad.potturu, Liam Girdwood,
	Jaroslav Kysela, Takashi Iwai, Kuninori Morimoto,
	Uwe Kleine-König, Nicolas Ferre,
	open list:SOUND - SOC LAYER / DYNAMIC AUDIO POWER MANAGEM...,
	open list

On 12/15/2023 07:02, Syed Saba Kareem wrote:
> Add pm ops for renoir platform.
> 
> Signed-off-by: Syed Saba Kareem <Syed.SabaKareem@amd.com>
Reviewed-by: Mario Limonciello <mario.limonciello@amd.com>
> ---
>   sound/soc/amd/acp/acp-renoir.c | 37 ++++++++++++++++++++++++++++++++++
>   1 file changed, 37 insertions(+)
> 
> diff --git a/sound/soc/amd/acp/acp-renoir.c b/sound/soc/amd/acp/acp-renoir.c
> index a591482a0726..b0e181c9a733 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"
> @@ -196,6 +197,11 @@ static int renoir_audio_probe(struct platform_device *pdev)
>   	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 +214,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,
>   	},
>   };
>   


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

* Re: [RESEND] ASoC: amd: acp: add pm ops support for renoir platform.
  2023-12-15 13:02 [RESEND] ASoC: amd: acp: add pm ops support for renoir platform Syed Saba Kareem
  2023-12-15 14:46 ` Mario Limonciello
@ 2023-12-15 22:13 ` Mark Brown
  2023-12-27 10:42   ` Tommaso Zanotti
  1 sibling, 1 reply; 4+ messages in thread
From: Mark Brown @ 2023-12-15 22:13 UTC (permalink / raw)
  To: alsa-devel, Syed Saba Kareem
  Cc: Vijendar.Mukunda, Basavaraj.Hiregoudar, Sunil-kumar.Dommati,
	mario.limonciello, posteuca, bagasdotme, venkataprasad.potturu,
	Liam Girdwood, Jaroslav Kysela, Takashi Iwai, Kuninori Morimoto,
	Uwe Kleine-König, Nicolas Ferre,
	open list:SOUND - SOC LAYER / DYNAMIC AUDIO POWER MANAGEM...,
	open list

On Fri, 15 Dec 2023 18:32:42 +0530, Syed Saba Kareem wrote:
> Add pm ops for renoir platform.
> 
> 

Applied to

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next

Thanks!

[1/1] ASoC: amd: acp: add pm ops support for renoir platform.
      commit: c95a2a0be0b1bba2e051faa105c2e0401fc2de33

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark


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

* Re: [RESEND] ASoC: amd: acp: add pm ops support for renoir platform.
  2023-12-15 22:13 ` Mark Brown
@ 2023-12-27 10:42   ` Tommaso Zanotti
  0 siblings, 0 replies; 4+ messages in thread
From: Tommaso Zanotti @ 2023-12-27 10:42 UTC (permalink / raw)
  To: broonie
  Cc: Basavaraj.Hiregoudar, Sunil-kumar.Dommati, Syed.SabaKareem,
	Vijendar.Mukunda, alsa-devel, bagasdotme, kuninori.morimoto.gx,
	lgirdwood, linux-kernel, linux-sound, mario.limonciello,
	nicolas.ferre, perex, posteuca, tiwai, u.kleine-koenig,
	venkataprasad.potturu

Hi Marc,
first time writing on a kernel mailing list here.

> All being well this means that it will be integrated into the linux-next
> tree (usually sometime in the next 24 hours) and sent to Linus during
> the next merge window (or sooner if it is a bug fix)

I noticed that this patch is scheduled to land in mainline on 6.8.
However, it was the second of a two-part bugfix for a regression introduced
in 6.6-rc1. You can find more info here:
- https://lore.kernel.org/lkml/87a5v8szhc.fsf@mutex.one/
- https://linux-regtracking.leemhuis.info/regzbot/regression/lore/87a5v8szhc.fsf@mutex.one/

Would be feasible to ship this patch already in the next 6.7-rc?
Because with the stable 6.7 some Huawei laptops will finally receive audio
support but due to this regression a workaround in user space is necessary.

Cheers,
Tommaso



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

end of thread, other threads:[~2023-12-27 11:08 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-12-15 13:02 [RESEND] ASoC: amd: acp: add pm ops support for renoir platform Syed Saba Kareem
2023-12-15 14:46 ` Mario Limonciello
2023-12-15 22:13 ` Mark Brown
2023-12-27 10:42   ` Tommaso Zanotti

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.