From: nicolas.pitre@linaro.org (Nicolas Pitre)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 2/2] ARM: vexpress/TC2: implement PM suspend method
Date: Fri, 07 Jun 2013 02:39:12 -0400 [thread overview]
Message-ID: <1370587152-4630-3-git-send-email-nicolas.pitre@linaro.org> (raw)
In-Reply-To: <1370587152-4630-1-git-send-email-nicolas.pitre@linaro.org>
From: Nicolas Pitre <nico@linaro.org>
This is simplistic for the moment as the expected residency is used to
prevent the shutting down of L2 and the cluster if the residency for
the last man is lower than 5 ms. To make this right, the shutdown
latency for each CPU would need to be recorded and taken into account.
On a suspend, the firmware mailbox address has to be set prior entering
low power mode.
Signed-off-by: Nicolas Pitre <nico@linaro.org>
---
arch/arm/mach-vexpress/tc2_pm.c | 23 +++++++++++++++++++++--
1 file changed, 21 insertions(+), 2 deletions(-)
diff --git a/arch/arm/mach-vexpress/tc2_pm.c b/arch/arm/mach-vexpress/tc2_pm.c
index a3ea524372..7901528566 100644
--- a/arch/arm/mach-vexpress/tc2_pm.c
+++ b/arch/arm/mach-vexpress/tc2_pm.c
@@ -79,7 +79,7 @@ static int tc2_pm_power_up(unsigned int cpu, unsigned int cluster)
return 0;
}
-static void tc2_pm_power_down(void)
+static void tc2_pm_down(u64 residency)
{
unsigned int mpidr, cpu, cluster;
bool last_man = false, skip_wfi = false;
@@ -100,7 +100,8 @@ static void tc2_pm_power_down(void)
vexpress_spc_set_cpu_wakeup_irq(cpu, cluster, 1);
if (!tc2_pm_use_count[0][cluster] &&
!tc2_pm_use_count[1][cluster] &&
- !tc2_pm_use_count[2][cluster]) {
+ !tc2_pm_use_count[2][cluster] &&
+ (!residency || residency > 5000)) {
vexpress_spc_powerdown_enable(cluster, 1);
vexpress_spc_set_global_wakeup_intr(1);
last_man = true;
@@ -161,6 +162,23 @@ static void tc2_pm_power_down(void)
/* Not dead at this point? Let our caller cope. */
}
+static void tc2_pm_power_down(void)
+{
+ tc2_pm_down(0);
+}
+
+static void tc2_pm_suspend(u64 residency)
+{
+ unsigned int mpidr, cpu, cluster;
+
+ mpidr = read_cpuid_mpidr();
+ cpu = MPIDR_AFFINITY_LEVEL(mpidr, 0);
+ cluster = MPIDR_AFFINITY_LEVEL(mpidr, 1);
+ vexpress_spc_write_resume_reg(cluster, cpu,
+ virt_to_phys(mcpm_entry_point));
+ tc2_pm_down(residency);
+}
+
static void tc2_pm_powered_up(void)
{
unsigned int mpidr, cpu, cluster;
@@ -196,6 +214,7 @@ static void tc2_pm_powered_up(void)
static const struct mcpm_platform_ops tc2_pm_power_ops = {
.power_up = tc2_pm_power_up,
.power_down = tc2_pm_power_down,
+ .suspend = tc2_pm_suspend,
.powered_up = tc2_pm_powered_up,
};
--
1.8.1.2
next prev parent reply other threads:[~2013-06-07 6:39 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-06-07 6:39 [PATCH 0/2] MCPM backend for Virtual Express TC2 Nicolas Pitre
2013-06-07 6:39 ` [PATCH 1/2] ARM: vexpress/TC2: basic PM support Nicolas Pitre
2013-06-07 14:26 ` Lorenzo Pieralisi
2013-06-10 3:53 ` Nicolas Pitre
2013-06-10 17:53 ` Lorenzo Pieralisi
2013-06-10 22:39 ` Nicolas Pitre
2013-06-11 13:41 ` Lorenzo Pieralisi
2013-06-11 15:35 ` Nicolas Pitre
2013-06-10 17:01 ` Sudeep KarkadaNagesha
2013-06-10 20:21 ` Nicolas Pitre
2013-06-13 20:32 ` Olof Johansson
2013-06-13 22:31 ` Nicolas Pitre
2013-06-18 17:24 ` Dave P Martin
2013-06-18 19:50 ` Nicolas Pitre
2013-06-18 19:56 ` Olof Johansson
2013-06-18 22:06 ` Nicolas Pitre
2013-06-19 10:08 ` Dave P Martin
2013-06-07 6:39 ` Nicolas Pitre [this message]
2013-06-07 10:56 ` [PATCH 2/2] ARM: vexpress/TC2: implement PM suspend method Lorenzo Pieralisi
2013-06-10 3:56 ` Nicolas Pitre
2013-06-10 16:03 ` Lorenzo Pieralisi
2013-06-07 15:27 ` [PATCH 0/2] MCPM backend for Virtual Express TC2 Pawel Moll
2013-06-10 3:21 ` Nicolas Pitre
2013-06-10 8:59 ` Pawel Moll
2013-06-11 8:41 ` Jon Medhurst (Tixy)
2013-06-11 18:42 ` Nicolas Pitre
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=1370587152-4630-3-git-send-email-nicolas.pitre@linaro.org \
--to=nicolas.pitre@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
/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;
as well as URLs for NNTP newsgroup(s).