* [PATCH 1/2] ASoC: amd: acp: add Kconfig options for acp7.0 based platform driver @ 2023-11-10 12:52 Syed Saba Kareem 2023-11-10 12:52 ` [PATCH 2/2] ASoC: amd: acp: add pm ops support for renoir platform Add pm ops for renoir platform Syed Saba Kareem 0 siblings, 1 reply; 4+ messages in thread From: Syed Saba Kareem @ 2023-11-10 12:52 UTC (permalink / raw) To: broonie, alsa-devel Cc: Vijendar.Mukunda, Basavaraj.Hiregoudar, Sunil-kumar.Dommati, mario.limonciello, Richard.Gong, posteuca, Syed Saba Kareem, Liam Girdwood, Jaroslav Kysela, Takashi Iwai, Arnd Bergmann, Venkata Prasad Potturu, open list ACP7.0 based platform legacy drivers can be built by selecting necessary kernel config option. This patch enables build support of the same. Signed-off-by: Syed Saba Kareem <Syed.SabaKareem@amd.com> --- sound/soc/amd/acp/Kconfig | 12 ++++++++++++ sound/soc/amd/acp/Makefile | 2 ++ 2 files changed, 14 insertions(+) diff --git a/sound/soc/amd/acp/Kconfig b/sound/soc/amd/acp/Kconfig index 5fb322212938..c8ac0027f741 100644 --- a/sound/soc/amd/acp/Kconfig +++ b/sound/soc/amd/acp/Kconfig @@ -73,6 +73,18 @@ config SND_AMD_ASOC_ACP63 Say Y if you want to enable AUDIO on ACP6.3 If unsure select "N". +config SND_AMD_ASOC_ACP70 + tristate "AMD ACP ASOC Acp7.0 Support" + depends on X86 && PCI + depends on ACPI + select SND_SOC_AMD_ACP_PCM + select SND_SOC_AMD_ACP_I2S + select SND_SOC_AMD_ACP_PDM + help + This option enables Acp7.0 PDM support on AMD platform. + Say Y if you want to enable AUDIO on ACP7.0 + If unsure select "N". + config SND_SOC_AMD_MACH_COMMON tristate depends on X86 && PCI && I2C diff --git a/sound/soc/amd/acp/Makefile b/sound/soc/amd/acp/Makefile index dd85700f1c5f..ff5f7893b81e 100644 --- a/sound/soc/amd/acp/Makefile +++ b/sound/soc/amd/acp/Makefile @@ -15,6 +15,7 @@ snd-acp-pci-objs := acp-pci.o snd-acp-renoir-objs := acp-renoir.o snd-acp-rembrandt-objs := acp-rembrandt.o snd-acp63-objs := acp63.o +snd-acp70-objs := acp70.o #machine specific driver snd-acp-mach-objs := acp-mach-common.o @@ -30,6 +31,7 @@ obj-$(CONFIG_SND_SOC_AMD_ACP_PCI) += snd-acp-pci.o obj-$(CONFIG_SND_AMD_ASOC_RENOIR) += snd-acp-renoir.o obj-$(CONFIG_SND_AMD_ASOC_REMBRANDT) += snd-acp-rembrandt.o obj-$(CONFIG_SND_AMD_ASOC_ACP63) += snd-acp63.o +obj-$(CONFIG_SND_AMD_ASOC_ACP70) += snd-acp70.o obj-$(CONFIG_SND_SOC_AMD_MACH_COMMON) += snd-acp-mach.o obj-$(CONFIG_SND_SOC_AMD_LEGACY_MACH) += snd-acp-legacy-mach.o -- 2.25.1 ^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 2/2] ASoC: amd: acp: add pm ops support for renoir platform Add pm ops for renoir platform. 2023-11-10 12:52 [PATCH 1/2] ASoC: amd: acp: add Kconfig options for acp7.0 based platform driver Syed Saba Kareem @ 2023-11-10 12:52 ` Syed Saba Kareem 2023-11-10 13:20 ` Saba Kareem, Syed 2023-11-10 14:47 ` Uwe Kleine-König 0 siblings, 2 replies; 4+ messages in thread From: Syed Saba Kareem @ 2023-11-10 12:52 UTC (permalink / raw) To: broonie, alsa-devel Cc: Vijendar.Mukunda, Basavaraj.Hiregoudar, Sunil-kumar.Dommati, mario.limonciello, Richard.Gong, posteuca, Syed Saba Kareem, Liam Girdwood, Jaroslav Kysela, Takashi Iwai, Kuninori Morimoto, Nicolas Ferre, Uwe Kleine-König, open list 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, }, }; -- 2.25.1 ^ permalink raw reply [flat|nested] 4+ messages in thread
* RE: [PATCH 2/2] ASoC: amd: acp: add pm ops support for renoir platform Add pm ops for renoir platform. 2023-11-10 12:52 ` [PATCH 2/2] ASoC: amd: acp: add pm ops support for renoir platform Add pm ops for renoir platform Syed Saba Kareem @ 2023-11-10 13:20 ` Saba Kareem, Syed 2023-11-10 14:47 ` Uwe Kleine-König 1 sibling, 0 replies; 4+ messages in thread From: Saba Kareem, Syed @ 2023-11-10 13:20 UTC (permalink / raw) To: Saba Kareem, Syed, broonie, alsa-devel Cc: Mukunda, Vijendar, Hiregoudar, Basavaraj, Dommati, Sunil-kumar, Limonciello, Mario, Gong, Richard, posteuca, Liam Girdwood, Jaroslav Kysela, Takashi Iwai, Kuninori Morimoto, Nicolas Ferre, Uwe Kleine-König, open list [AMD Official Use Only - General] Commit message got mixed with commit title will resend the patch again. -----Original Message----- From: Syed Saba Kareem <Syed.SabaKareem@amd.com> Sent: Friday, November 10, 2023 6:22 PM To: 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; Saba Kareem, Syed <Syed.SabaKareem@amd.com>; 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> Subject: [PATCH 2/2] ASoC: amd: acp: add pm ops support for renoir platform 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, }, }; -- 2.25.1 ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 2/2] ASoC: amd: acp: add pm ops support for renoir platform Add pm ops for renoir platform. 2023-11-10 12:52 ` [PATCH 2/2] ASoC: amd: acp: add pm ops support for renoir platform Add pm ops for renoir platform Syed Saba Kareem 2023-11-10 13:20 ` Saba Kareem, Syed @ 2023-11-10 14:47 ` Uwe Kleine-König 1 sibling, 0 replies; 4+ messages in thread From: Uwe Kleine-König @ 2023-11-10 14:47 UTC (permalink / raw) To: Syed Saba Kareem Cc: broonie, alsa-devel, Vijendar.Mukunda, Basavaraj.Hiregoudar, Sunil-kumar.Dommati, mario.limonciello, Richard.Gong, posteuca, Liam Girdwood, Jaroslav Kysela, Takashi Iwai, Kuninori Morimoto, Nicolas Ferre, open list [-- Attachment #1: Type: text/plain, Size: 807 bytes --] Hello, the subject should be deduplicated. On Fri, Nov 10, 2023 at 06:22:10PM +0530, Syed Saba Kareem wrote: > +static int __maybe_unused rn_pcm_resume(struct device *dev) If you use DEFINE_SIMPLE_DEV_PM_OPS below, you can drop the __maybe_unused here. > +{ > [...] > +} > + > +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, > }, > }; Best regards Uwe -- Pengutronix e.K. | Uwe Kleine-König | Industrial Linux Solutions | https://www.pengutronix.de/ | [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 488 bytes --] ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2023-11-10 19:28 UTC | newest] Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2023-11-10 12:52 [PATCH 1/2] ASoC: amd: acp: add Kconfig options for acp7.0 based platform driver Syed Saba Kareem 2023-11-10 12:52 ` [PATCH 2/2] ASoC: amd: acp: add pm ops support for renoir platform Add pm ops for renoir platform Syed Saba Kareem 2023-11-10 13:20 ` Saba Kareem, Syed 2023-11-10 14:47 ` Uwe Kleine-König
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®