diff options
author | Amit Daniel Kachhap <amit.kachhap@linaro.org> | 2012-05-12 03:29:21 -0400 |
---|---|---|
committer | Kukjin Kim <kgene.kim@samsung.com> | 2012-05-12 03:29:21 -0400 |
commit | 06c77b3ce1b81163d74d9d5e904de731934e8510 (patch) | |
tree | 20b572d51d990d44874ede3bfa73cdb43ee460ec /arch/arm/mach-exynos/cpuidle.c | |
parent | 81d413554a020ebe4f1f761cc5c417a306687511 (diff) |
ARM: EXYNOS: Adapt to cpuidle core time keeping and irq enable
This patch enables core cpuidle timekeeping and irq enabling and
remove those redundant parts from the exynos cpuidle drivers
Signed-off-by: Amit Daniel <amit.kachhap@linaro.org>
Acked-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Acked-by: Robert Lee <rob.lee@linaro.org>
Signed-off-by: Kukjin Kim <kgene.kim@samsung.com>
Diffstat (limited to 'arch/arm/mach-exynos/cpuidle.c')
-rw-r--r-- | arch/arm/mach-exynos/cpuidle.c | 53 |
1 files changed, 6 insertions, 47 deletions
diff --git a/arch/arm/mach-exynos/cpuidle.c b/arch/arm/mach-exynos/cpuidle.c index 33ab4e7558af..26dac2893b8e 100644 --- a/arch/arm/mach-exynos/cpuidle.c +++ b/arch/arm/mach-exynos/cpuidle.c | |||
@@ -20,6 +20,7 @@ | |||
20 | #include <asm/smp_scu.h> | 20 | #include <asm/smp_scu.h> |
21 | #include <asm/suspend.h> | 21 | #include <asm/suspend.h> |
22 | #include <asm/unified.h> | 22 | #include <asm/unified.h> |
23 | #include <asm/cpuidle.h> | ||
23 | #include <mach/regs-pmu.h> | 24 | #include <mach/regs-pmu.h> |
24 | #include <mach/pmu.h> | 25 | #include <mach/pmu.h> |
25 | 26 | ||
@@ -34,22 +35,12 @@ | |||
34 | 35 | ||
35 | #define S5P_CHECK_AFTR 0xFCBA0D10 | 36 | #define S5P_CHECK_AFTR 0xFCBA0D10 |
36 | 37 | ||
37 | static int exynos4_enter_idle(struct cpuidle_device *dev, | ||
38 | struct cpuidle_driver *drv, | ||
39 | int index); | ||
40 | static int exynos4_enter_lowpower(struct cpuidle_device *dev, | 38 | static int exynos4_enter_lowpower(struct cpuidle_device *dev, |
41 | struct cpuidle_driver *drv, | 39 | struct cpuidle_driver *drv, |
42 | int index); | 40 | int index); |
43 | 41 | ||
44 | static struct cpuidle_state exynos4_cpuidle_set[] __initdata = { | 42 | static struct cpuidle_state exynos4_cpuidle_set[] __initdata = { |
45 | [0] = { | 43 | [0] = ARM_CPUIDLE_WFI_STATE, |
46 | .enter = exynos4_enter_idle, | ||
47 | .exit_latency = 1, | ||
48 | .target_residency = 100000, | ||
49 | .flags = CPUIDLE_FLAG_TIME_VALID, | ||
50 | .name = "C0", | ||
51 | .desc = "ARM clock gating(WFI)", | ||
52 | }, | ||
53 | [1] = { | 44 | [1] = { |
54 | .enter = exynos4_enter_lowpower, | 45 | .enter = exynos4_enter_lowpower, |
55 | .exit_latency = 300, | 46 | .exit_latency = 300, |
@@ -63,8 +54,9 @@ static struct cpuidle_state exynos4_cpuidle_set[] __initdata = { | |||
63 | static DEFINE_PER_CPU(struct cpuidle_device, exynos4_cpuidle_device); | 54 | static DEFINE_PER_CPU(struct cpuidle_device, exynos4_cpuidle_device); |
64 | 55 | ||
65 | static struct cpuidle_driver exynos4_idle_driver = { | 56 | static struct cpuidle_driver exynos4_idle_driver = { |
66 | .name = "exynos4_idle", | 57 | .name = "exynos4_idle", |
67 | .owner = THIS_MODULE, | 58 | .owner = THIS_MODULE, |
59 | .en_core_tk_irqen = 1, | ||
68 | }; | 60 | }; |
69 | 61 | ||
70 | /* Ext-GIC nIRQ/nFIQ is the only wakeup source in AFTR */ | 62 | /* Ext-GIC nIRQ/nFIQ is the only wakeup source in AFTR */ |
@@ -103,13 +95,8 @@ static int exynos4_enter_core0_aftr(struct cpuidle_device *dev, | |||
103 | struct cpuidle_driver *drv, | 95 | struct cpuidle_driver *drv, |
104 | int index) | 96 | int index) |
105 | { | 97 | { |
106 | struct timeval before, after; | ||
107 | int idle_time; | ||
108 | unsigned long tmp; | 98 | unsigned long tmp; |
109 | 99 | ||
110 | local_irq_disable(); | ||
111 | do_gettimeofday(&before); | ||
112 | |||
113 | exynos4_set_wakeupmask(); | 100 | exynos4_set_wakeupmask(); |
114 | 101 | ||
115 | /* Set value of power down register for aftr mode */ | 102 | /* Set value of power down register for aftr mode */ |
@@ -150,34 +137,6 @@ static int exynos4_enter_core0_aftr(struct cpuidle_device *dev, | |||
150 | /* Clear wakeup state register */ | 137 | /* Clear wakeup state register */ |
151 | __raw_writel(0x0, S5P_WAKEUP_STAT); | 138 | __raw_writel(0x0, S5P_WAKEUP_STAT); |
152 | 139 | ||
153 | do_gettimeofday(&after); | ||
154 | |||
155 | local_irq_enable(); | ||
156 | idle_time = (after.tv_sec - before.tv_sec) * USEC_PER_SEC + | ||
157 | (after.tv_usec - before.tv_usec); | ||
158 | |||
159 | dev->last_residency = idle_time; | ||
160 | return index; | ||
161 | } | ||
162 | |||
163 | static int exynos4_enter_idle(struct cpuidle_device *dev, | ||
164 | struct cpuidle_driver *drv, | ||
165 | int index) | ||
166 | { | ||
167 | struct timeval before, after; | ||
168 | int idle_time; | ||
169 | |||
170 | local_irq_disable(); | ||
171 | do_gettimeofday(&before); | ||
172 | |||
173 | cpu_do_idle(); | ||
174 | |||
175 | do_gettimeofday(&after); | ||
176 | local_irq_enable(); | ||
177 | idle_time = (after.tv_sec - before.tv_sec) * USEC_PER_SEC + | ||
178 | (after.tv_usec - before.tv_usec); | ||
179 | |||
180 | dev->last_residency = idle_time; | ||
181 | return index; | 140 | return index; |
182 | } | 141 | } |
183 | 142 | ||
@@ -192,7 +151,7 @@ static int exynos4_enter_lowpower(struct cpuidle_device *dev, | |||
192 | new_index = drv->safe_state_index; | 151 | new_index = drv->safe_state_index; |
193 | 152 | ||
194 | if (new_index == 0) | 153 | if (new_index == 0) |
195 | return exynos4_enter_idle(dev, drv, new_index); | 154 | return arm_cpuidle_simple_enter(dev, drv, new_index); |
196 | else | 155 | else |
197 | return exynos4_enter_core0_aftr(dev, drv, new_index); | 156 | return exynos4_enter_core0_aftr(dev, drv, new_index); |
198 | } | 157 | } |