aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorMagnus Damm <damm@opensource.se>2011-04-28 13:39:32 -0400
committerPaul Mundt <lethal@linux-sh.org>2011-05-24 22:19:24 -0400
commit082a8ca1d3a2fbab76dba8ff66bc25c46677361d (patch)
tree93058d37fb5cba6573bd99684e1dabb6c8ca6b37 /arch
parent0af4817b80870cc12f4b6f38d89f3c012a7a6b28 (diff)
ARM: mach-shmobile: sh7372 Core Standby CPUIdle
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> Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/mach-shmobile/pm-sh7372.c33
1 files changed, 31 insertions, 2 deletions
diff --git a/arch/arm/mach-shmobile/pm-sh7372.c b/arch/arm/mach-shmobile/pm-sh7372.c
index 92c374d411d5..338049eed4ad 100644
--- a/arch/arm/mach-shmobile/pm-sh7372.c
+++ b/arch/arm/mach-shmobile/pm-sh7372.c
@@ -10,6 +10,7 @@
10 10
11#include <linux/pm.h> 11#include <linux/pm.h>
12#include <linux/suspend.h> 12#include <linux/suspend.h>
13#include <linux/cpuidle.h>
13#include <linux/module.h> 14#include <linux/module.h>
14#include <linux/list.h> 15#include <linux/list.h>
15#include <linux/err.h> 16#include <linux/err.h>
@@ -24,8 +25,7 @@
24#define SBAR 0xe6180020 25#define SBAR 0xe6180020
25#define APARMBAREA 0xe6f10020 26#define APARMBAREA 0xe6f10020
26 27
27#ifdef CONFIG_SUSPEND 28void sh7372_enter_core_standby(void)
28static void sh7372_enter_core_standby(void)
29{ 29{
30 void __iomem *smfram = (void __iomem *)SMFRAM; 30 void __iomem *smfram = (void __iomem *)SMFRAM;
31 31
@@ -51,6 +51,34 @@ static void sh7372_enter_core_standby(void)
51 __raw_writel(0, SBAR); /* disable reset vector translation */ 51 __raw_writel(0, SBAR); /* disable reset vector translation */
52} 52}
53 53
54#ifdef CONFIG_CPU_IDLE
55static void sh7372_cpuidle_setup(struct cpuidle_device *dev)
56{
57 struct cpuidle_state *state;
58 int i = dev->state_count;
59
60 state = &dev->states[i];
61 snprintf(state->name, CPUIDLE_NAME_LEN, "C2");
62 strncpy(state->desc, "Core Standby Mode", CPUIDLE_DESC_LEN);
63 state->exit_latency = 10;
64 state->target_residency = 20 + 10;
65 state->power_usage = 1; /* perhaps not */
66 state->flags = 0;
67 state->flags |= CPUIDLE_FLAG_TIME_VALID;
68 shmobile_cpuidle_modes[i] = sh7372_enter_core_standby;
69
70 dev->state_count = i + 1;
71}
72
73static void sh7372_cpuidle_init(void)
74{
75 shmobile_cpuidle_setup = sh7372_cpuidle_setup;
76}
77#else
78static void sh7372_cpuidle_init(void) {}
79#endif
80
81#ifdef CONFIG_SUSPEND
54static int sh7372_enter_suspend(suspend_state_t suspend_state) 82static int sh7372_enter_suspend(suspend_state_t suspend_state)
55{ 83{
56 sh7372_enter_core_standby(); 84 sh7372_enter_core_standby();
@@ -76,4 +104,5 @@ void __init sh7372_pm_init(void)
76 __raw_writel(0x00000000, DBGREG1); 104 __raw_writel(0x00000000, DBGREG1);
77 105
78 sh7372_suspend_init(); 106 sh7372_suspend_init();
107 sh7372_cpuidle_init();
79} 108}