From: Syed Saba Kareem <Syed.SabaKareem@amd.com>
To: <broonie@kernel.org>, <alsa-devel@alsa-project.org>
Cc: Vijendar.Mukunda@amd.com, Basavaraj.Hiregoudar@amd.com,
Sunil-kumar.Dommati@amd.com, mario.limonciello@amd.com,
richgong@amd.com, posteuca@mutex.one,
"Syed Saba Kareem" <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 V2 2/2] ASoC: amd: acp: add pm ops support for renoir platform
Date: Mon, 13 Nov 2023 18:03:43 +0530 [thread overview]
Message-ID: <20231113123345.2196504-2-Syed.SabaKareem@amd.com> (raw)
In-Reply-To: <20231113123345.2196504-1-Syed.SabaKareem@amd.com>
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
next prev parent reply other threads:[~2023-11-13 12:34 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-13 12:33 [PATCH V2 1/2] ASoC: amd: acp: add Kconfig options for acp7.0 based platform driver Syed Saba Kareem
2023-11-13 12:33 ` Syed Saba Kareem [this message]
2023-11-13 14:45 ` [PATCH V2 2/2] ASoC: amd: acp: add pm ops support for renoir platform Pierre-Louis Bossart
2023-12-15 11:14 ` Linux regression tracking (Thorsten Leemhuis)
2023-12-18 12:21 ` Saba Kareem, Syed
2023-11-13 16:19 ` [PATCH V2 1/2] ASoC: amd: acp: add Kconfig options for acp7.0 based platform driver Mario Limonciello
2023-11-14 12:45 ` syed saba kareem
2023-11-14 11:39 ` Mark Brown
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20231113123345.2196504-2-Syed.SabaKareem@amd.com \
--to=syed.sabakareem@amd.com \
--cc=Basavaraj.Hiregoudar@amd.com \
--cc=Sunil-kumar.Dommati@amd.com \
--cc=Vijendar.Mukunda@amd.com \
--cc=alsa-devel@alsa-project.org \
--cc=broonie@kernel.org \
--cc=kuninori.morimoto.gx@renesas.com \
--cc=lgirdwood@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mario.limonciello@amd.com \
--cc=nicolas.ferre@microchip.com \
--cc=perex@perex.cz \
--cc=posteuca@mutex.one \
--cc=richgong@amd.com \
--cc=tiwai@suse.com \
--cc=u.kleine-koenig@pengutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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®