From: Alex Deucher <alexdeucher@gmail.com>
To: broonie@kernel.org, airlied@gmail.com,
dri-devel@lists.freedesktop.org, alsa-devel@alsa-project.org
Cc: Maruthi Srinivas Bayyavarapu <Maruthi.Bayyavarapu@amd.com>,
lgirdwood@gmail.com, perex@perex.cz
Subject: [PATCH 08/12] drm/amd: shutdown unused ACP SRAM memory banks
Date: Thu, 6 Aug 2015 10:25:08 -0400 [thread overview]
Message-ID: <1438871112-25946-8-git-send-email-alexander.deucher@amd.com> (raw)
In-Reply-To: <1438871112-25946-1-git-send-email-alexander.deucher@amd.com>
From: Maruthi Srinivas Bayyavarapu <Maruthi.Bayyavarapu@amd.com>
ACP internal memory banks 0 to 9 are used for audio usecases
(playback/capture). Remaining banks 10 to 47 are shutdown to save power.
Signed-off-by: Maruthi Bayyavarapu <maruthi.bayyavarapu@amd.com>
Reviewed-by: Murali Krishna Vemuri <murali-krishna.vemuri@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
---
drivers/gpu/drm/amd/acp/acp_hw.c | 47 ++++++++++++++++++++++++++++++++++++++++
1 file changed, 47 insertions(+)
diff --git a/drivers/gpu/drm/amd/acp/acp_hw.c b/drivers/gpu/drm/amd/acp/acp_hw.c
index be364ab..7ee2aa6 100644
--- a/drivers/gpu/drm/amd/acp/acp_hw.c
+++ b/drivers/gpu/drm/amd/acp/acp_hw.c
@@ -773,6 +773,52 @@ static void acp_resume_tile(struct amd_acp_private *acp_prv, int tile)
}
}
+/* Shutdown unused SRAM memory banks in ACP IP */
+static void acp_turnoff_sram_banks(struct amd_acp_private *acp_prv)
+{
+ /* Bank 0 : used for DMA descriptors
+ * Bank 1 to 4 : used for playback
+ * Bank 5 to 8 : used for capture
+ * Each bank is 8kB and max size allocated for playback/ capture is
+ * 16kB(max period size) * 2(max periods) reserved for playback/capture
+ * in ALSA driver
+ * Turn off all SRAM banks except above banks during playback/capture
+ */
+ u32 val, bank;
+
+ for (bank = 9; bank < 32; bank++) {
+ val = cgs_read_register(acp_prv->cgs_device,
+ mmACP_MEM_SHUT_DOWN_REQ_LO);
+ if (!(val & (1 << bank))) {
+ val |= 1 << bank;
+ cgs_write_register(acp_prv->cgs_device,
+ mmACP_MEM_SHUT_DOWN_REQ_LO, val);
+ /* If ACP_MEM_SHUT_DOWN_STS_LO is 0xFFFFFFFF, then
+ * shutdown sequence is complete. */
+ do {
+ val = cgs_read_register(acp_prv->cgs_device,
+ mmACP_MEM_SHUT_DOWN_STS_LO);
+ } while (val != 0xFFFFFFFF);
+ }
+ }
+
+ for (bank = 32; bank < 48; bank++) {
+ val = cgs_read_register(acp_prv->cgs_device,
+ mmACP_MEM_SHUT_DOWN_REQ_HI);
+ if (!(val & (1 << (bank - 32)))) {
+ val |= 1 << (bank - 32);
+ cgs_write_register(acp_prv->cgs_device,
+ mmACP_MEM_SHUT_DOWN_REQ_HI, val);
+ /* If ACP_MEM_SHUT_DOWN_STS_HI is 0x0000FFFF, then
+ * shutdown sequence is complete. */
+ do {
+ val = cgs_read_register(acp_prv->cgs_device,
+ mmACP_MEM_SHUT_DOWN_STS_HI);
+ } while (val != 0x0000FFFF);
+ }
+ }
+}
+
/* Initialize and bring ACP hardware to default state. */
static void acp_init(struct amd_acp_private *acp_prv)
{
@@ -833,6 +879,7 @@ static void acp_init(struct amd_acp_private *acp_prv)
cgs_write_register(acp_prv->cgs_device, mmACP_EXTERNAL_INTR_CNTL,
ACP_EXTERNAL_INTR_CNTL__DMAIOCMask_MASK);
+ acp_turnoff_sram_banks(acp_prv);
pr_info("ACP: Initialized.\n");
}
--
1.8.3.1
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel
next prev parent reply other threads:[~2015-08-06 14:25 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-08-06 14:25 [PATCH 00/12] Add ASoC support for AMD APUs Alex Deucher
2015-08-06 14:25 ` [PATCH 01/12] drm/amdgpu: add amd_gnb_bus support Alex Deucher
2015-08-06 19:36 ` Lars-Peter Clausen
2015-08-07 10:25 ` Mark Brown
2015-08-07 14:17 ` Alex Deucher
2015-08-07 16:16 ` Felix Kuehling
2015-08-07 18:24 ` Mark Brown
2015-08-07 20:03 ` Felix Kuehling
2015-08-10 11:56 ` Mark Brown
2015-08-07 17:20 ` Mark Brown
2015-08-06 14:25 ` [PATCH 02/12] drm/amd: remove amd gnb bus default runtime pm ops Alex Deucher
2015-08-06 14:25 ` [PATCH 04/12] drm/amd: add ACP driver support (v4) Alex Deucher
2015-08-06 14:25 ` [PATCH 05/12] drm/amd: modify ACP DMA buffer position update logic (v2) Alex Deucher
2015-08-06 14:25 ` [PATCH 06/12] drm/amd: add ACP suspend/resume functionality Alex Deucher
2015-08-06 14:25 ` [PATCH 07/12] drm/amd: change ACP SRAM banks used for audio Alex Deucher
2015-08-06 14:25 ` Alex Deucher [this message]
2015-08-06 14:25 ` [PATCH 09/12] drm/amd: remove bitfield usage in ACP IP module Alex Deucher
2015-08-06 14:25 ` [PATCH 10/12] ASoC: AMD: add AMD ASoC ACP-I2S driver (v2) Alex Deucher
2015-08-06 19:22 ` Mark Brown
2015-08-07 9:27 ` Bayyavarapu, Maruthi
2015-08-06 14:25 ` [PATCH 11/12] ASoC: AMD: add suspend/resume for ACP PCM driver Alex Deucher
2015-08-06 19:23 ` Mark Brown
2015-08-06 14:25 ` [PATCH 12/12] ASoC: AMD: add ACP PCM driver runtime PM Alex Deucher
2015-08-06 19:26 ` Mark Brown
2015-08-07 9:41 ` Bayyavarapu, Maruthi
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=1438871112-25946-8-git-send-email-alexander.deucher@amd.com \
--to=alexdeucher@gmail.com \
--cc=Maruthi.Bayyavarapu@amd.com \
--cc=airlied@gmail.com \
--cc=alsa-devel@alsa-project.org \
--cc=broonie@kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=lgirdwood@gmail.com \
--cc=perex@perex.cz \
/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