SUPERH platform development
 help / color / mirror / Atom feed
From: Magnus Damm <magnus.damm@gmail.com>
To: linux-sh@vger.kernel.org
Subject: [PATCH] ARM: mach-shmobile: sh7372 Core Standby CPUIdle
Date: Thu, 28 Apr 2011 17:39:32 +0000	[thread overview]
Message-ID: <20110428173932.3811.2688.sendpatchset@t400s> (raw)
In-Reply-To: <20110428172808.3636.13888.sendpatchset@t400s>

From: Magnus Damm <damm@opensource.se>

This patch ties in the previously added sh7372 sleep
mode known as Core Standby together with the shared
SH-Mobile ARM CPUIdle implementation.

Signed-off-by: Magnus Damm <damm@opensource.se>
---

 arch/arm/mach-shmobile/pm-sh7372.c |   33 +++++++++++++++++++++++++++++++--
 1 file changed, 31 insertions(+), 2 deletions(-)

--- 0003/arch/arm/mach-shmobile/pm-sh7372.c
+++ work/arch/arm/mach-shmobile/pm-sh7372.c	2011-04-29 02:09:33.000000000 +0900
@@ -10,6 +10,7 @@
 
 #include <linux/pm.h>
 #include <linux/suspend.h>
+#include <linux/cpuidle.h>
 #include <linux/module.h>
 #include <linux/list.h>
 #include <linux/err.h>
@@ -24,8 +25,7 @@
 #define SBAR 0xe6180020
 #define APARMBAREA 0xe6f10020
 
-#ifdef CONFIG_SUSPEND
-static void sh7372_enter_core_standby(void)
+void sh7372_enter_core_standby(void)
 {
 	void __iomem *smfram = (void __iomem *)SMFRAM;
 
@@ -51,6 +51,34 @@ static void sh7372_enter_core_standby(vo
 	__raw_writel(0, SBAR); /* disable reset vector translation */
 }
 
+#ifdef CONFIG_CPU_IDLE
+static void sh7372_cpuidle_setup(struct cpuidle_device *dev)
+{
+	struct cpuidle_state *state;
+	int i = dev->state_count;
+
+	state = &dev->states[i];
+	snprintf(state->name, CPUIDLE_NAME_LEN, "C2");
+	strncpy(state->desc, "Core Standby Mode", CPUIDLE_DESC_LEN);
+	state->exit_latency = 10;
+	state->target_residency = 20 + 10;
+	state->power_usage = 1; /* perhaps not */
+	state->flags = 0;
+	state->flags |= CPUIDLE_FLAG_TIME_VALID;
+	shmobile_cpuidle_modes[i] = sh7372_enter_core_standby;
+
+	dev->state_count = i + 1;
+}
+
+static void sh7372_cpuidle_init(void)
+{
+	shmobile_cpuidle_setup = sh7372_cpuidle_setup;
+}
+#else
+static void sh7372_cpuidle_init(void) {}
+#endif
+
+#ifdef CONFIG_SUSPEND
 static int sh7372_enter_suspend(suspend_state_t suspend_state)
 {
 	sh7372_enter_core_standby();
@@ -76,4 +104,5 @@ void __init sh7372_pm_init(void)
 	__raw_writel(0x00000000, DBGREG1);
 
 	sh7372_suspend_init();
+	sh7372_cpuidle_init();
 }

      reply	other threads:[~2011-04-28 17:39 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-28 17:28 [PATCH] ARM: mach-shmobile: sh7372 Core Standby Suspend-to-RAM Magnus Damm
2011-04-28 17:39 ` Magnus Damm [this message]

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=20110428173932.3811.2688.sendpatchset@t400s \
    --to=magnus.damm@gmail.com \
    --cc=linux-sh@vger.kernel.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