aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-exynos/cpuidle.c
diff options
context:
space:
mode:
authorDaniel Lezcano <daniel.lezcano@linaro.org>2013-01-19 00:57:58 -0500
committerKukjin Kim <kgene.kim@samsung.com>2013-04-09 11:12:26 -0400
commit2eb89f893e44b1a9f48fa1cb6aa5e0d18ed66bb5 (patch)
tree1ab9910ceac4eea8bc93ff2dec92ea53c216b53b /arch/arm/mach-exynos/cpuidle.c
parentd9cdeb814fd6bb1b5eaa49c5848f10ba7acf992a (diff)
ARM: EXYNOS: factor out the idle states
The states are defined in the driver. We can get rid of the intermediate cpuidle states initialization and the memcpy by directly initializing the driver states. Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org> Acked-by: Amit Daniel Kachhap <amit.daniel@samsung.com> 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.c45
1 files changed, 17 insertions, 28 deletions
diff --git a/arch/arm/mach-exynos/cpuidle.c b/arch/arm/mach-exynos/cpuidle.c
index fcfe0251aa3e..6ac4069f3c93 100644
--- a/arch/arm/mach-exynos/cpuidle.c
+++ b/arch/arm/mach-exynos/cpuidle.c
@@ -41,24 +41,25 @@ static int exynos4_enter_lowpower(struct cpuidle_device *dev,
41 struct cpuidle_driver *drv, 41 struct cpuidle_driver *drv,
42 int index); 42 int index);
43 43
44static struct cpuidle_state exynos4_cpuidle_set[] __initdata = {
45 [0] = ARM_CPUIDLE_WFI_STATE,
46 [1] = {
47 .enter = exynos4_enter_lowpower,
48 .exit_latency = 300,
49 .target_residency = 100000,
50 .flags = CPUIDLE_FLAG_TIME_VALID,
51 .name = "C1",
52 .desc = "ARM power down",
53 },
54};
55
56static DEFINE_PER_CPU(struct cpuidle_device, exynos4_cpuidle_device); 44static DEFINE_PER_CPU(struct cpuidle_device, exynos4_cpuidle_device);
57 45
58static struct cpuidle_driver exynos4_idle_driver = { 46static struct cpuidle_driver exynos4_idle_driver = {
59 .name = "exynos4_idle", 47 .name = "exynos4_idle",
60 .owner = THIS_MODULE, 48 .owner = THIS_MODULE,
61 .en_core_tk_irqen = 1, 49 .en_core_tk_irqen = 1,
50 .states = {
51 [0] = ARM_CPUIDLE_WFI_STATE,
52 [1] = {
53 .enter = exynos4_enter_lowpower,
54 .exit_latency = 300,
55 .target_residency = 100000,
56 .flags = CPUIDLE_FLAG_TIME_VALID,
57 .name = "C1",
58 .desc = "ARM power down",
59 },
60 },
61 .state_count = 2,
62 .safe_state_index = 0,
62}; 63};
63 64
64/* Ext-GIC nIRQ/nFIQ is the only wakeup source in AFTR */ 65/* Ext-GIC nIRQ/nFIQ is the only wakeup source in AFTR */
@@ -193,33 +194,21 @@ static void __init exynos5_core_down_clk(void)
193 194
194static int __init exynos4_init_cpuidle(void) 195static int __init exynos4_init_cpuidle(void)
195{ 196{
196 int i, max_cpuidle_state, cpu_id; 197 int cpu_id;
197 struct cpuidle_device *device; 198 struct cpuidle_device *device;
198 struct cpuidle_driver *drv = &exynos4_idle_driver;
199 199
200 if (soc_is_exynos5250()) 200 if (soc_is_exynos5250())
201 exynos5_core_down_clk(); 201 exynos5_core_down_clk();
202 202
203 /* Setup cpuidle driver */
204 drv->state_count = (sizeof(exynos4_cpuidle_set) /
205 sizeof(struct cpuidle_state));
206 max_cpuidle_state = drv->state_count;
207 for (i = 0; i < max_cpuidle_state; i++) {
208 memcpy(&drv->states[i], &exynos4_cpuidle_set[i],
209 sizeof(struct cpuidle_state));
210 }
211 drv->safe_state_index = 0;
212 cpuidle_register_driver(&exynos4_idle_driver); 203 cpuidle_register_driver(&exynos4_idle_driver);
213 204
214 for_each_cpu(cpu_id, cpu_online_mask) { 205 for_each_cpu(cpu_id, cpu_online_mask) {
215 device = &per_cpu(exynos4_cpuidle_device, cpu_id); 206 device = &per_cpu(exynos4_cpuidle_device, cpu_id);
216 device->cpu = cpu_id; 207 device->cpu = cpu_id;
217 208
218 if (cpu_id == 0) 209 /* Support IDLE only */
219 device->state_count = (sizeof(exynos4_cpuidle_set) / 210 if (cpu_id != 0)
220 sizeof(struct cpuidle_state)); 211 device->state_count = 1;
221 else
222 device->state_count = 1; /* Support IDLE only */
223 212
224 if (cpuidle_register_device(device)) { 213 if (cpuidle_register_device(device)) {
225 printk(KERN_ERR "CPUidle register device failed\n,"); 214 printk(KERN_ERR "CPUidle register device failed\n,");