aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-omap2/cpuidle34xx.c
diff options
context:
space:
mode:
authorDaniel Lezcano <daniel.lezcano@linaro.org>2012-04-24 10:05:35 -0400
committerKevin Hilman <khilman@ti.com>2012-05-03 16:19:30 -0400
commit6622ac55a6a15670a04b5790e7ee2778a6f8c4e0 (patch)
treea5b55ed1dc540b8be0d122ea93d4163631ed90f5 /arch/arm/mach-omap2/cpuidle34xx.c
parent88c377dd9835495a19043d3ec848eac6ef8658cf (diff)
ARM: OMAP3: cpuidle - use omap3_idle_data directly
We are storing the 'omap3_idle_data' in the private data field of the cpuidle device. As we are using this variable only in this file, that does not really make sense. Let's use the global variable directly. As the table is initialized statically, let's remove the initialization at startup too. Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org> Reviewed-by: Jean Pihet <j-pihet@ti.com> Reviewed-by: Santosh Shilimkar <santosh.shilimkar@ti.com> Tested-by: Santosh Shilimkar <santosh.shilimkar@ti.com> Tested-by: Kevin Hilman <khilman@ti.com> Signed-off-by: Kevin Hilman <khilman@ti.com>
Diffstat (limited to 'arch/arm/mach-omap2/cpuidle34xx.c')
-rw-r--r--arch/arm/mach-omap2/cpuidle34xx.c63
1 files changed, 6 insertions, 57 deletions
diff --git a/arch/arm/mach-omap2/cpuidle34xx.c b/arch/arm/mach-omap2/cpuidle34xx.c
index 93e2450ee885..242f77d57965 100644
--- a/arch/arm/mach-omap2/cpuidle34xx.c
+++ b/arch/arm/mach-omap2/cpuidle34xx.c
@@ -95,8 +95,7 @@ static int __omap3_enter_idle(struct cpuidle_device *dev,
95 struct cpuidle_driver *drv, 95 struct cpuidle_driver *drv,
96 int index) 96 int index)
97{ 97{
98 struct omap3_idle_statedata *cx = 98 struct omap3_idle_statedata *cx = &omap3_idle_data[index];
99 cpuidle_get_statedata(&dev->states_usage[index]);
100 u32 mpu_state = cx->mpu_state, core_state = cx->core_state; 99 u32 mpu_state = cx->mpu_state, core_state = cx->core_state;
101 100
102 local_fiq_disable(); 101 local_fiq_disable();
@@ -176,9 +175,8 @@ static int next_valid_state(struct cpuidle_device *dev,
176 struct cpuidle_driver *drv, 175 struct cpuidle_driver *drv,
177 int index) 176 int index)
178{ 177{
179 struct cpuidle_state_usage *curr_usage = &dev->states_usage[index];
180 struct cpuidle_state *curr = &drv->states[index]; 178 struct cpuidle_state *curr = &drv->states[index];
181 struct omap3_idle_statedata *cx = cpuidle_get_statedata(curr_usage); 179 struct omap3_idle_statedata *cx = &omap3_idle_data[index];
182 u32 mpu_deepest_state = PWRDM_POWER_RET; 180 u32 mpu_deepest_state = PWRDM_POWER_RET;
183 u32 core_deepest_state = PWRDM_POWER_RET; 181 u32 core_deepest_state = PWRDM_POWER_RET;
184 int next_index = -1; 182 int next_index = -1;
@@ -218,7 +216,7 @@ static int next_valid_state(struct cpuidle_device *dev,
218 */ 216 */
219 idx--; 217 idx--;
220 for (; idx >= 0; idx--) { 218 for (; idx >= 0; idx--) {
221 cx = cpuidle_get_statedata(&dev->states_usage[idx]); 219 cx = &omap3_idle_data[idx];
222 if ((cx->mpu_state >= mpu_deepest_state) && 220 if ((cx->mpu_state >= mpu_deepest_state) &&
223 (cx->core_state >= core_deepest_state)) { 221 (cx->core_state >= core_deepest_state)) {
224 next_index = idx; 222 next_index = idx;
@@ -275,7 +273,7 @@ static int omap3_enter_idle_bm(struct cpuidle_device *dev,
275 * Prevent PER off if CORE is not in retention or off as this 273 * Prevent PER off if CORE is not in retention or off as this
276 * would disable PER wakeups completely. 274 * would disable PER wakeups completely.
277 */ 275 */
278 cx = cpuidle_get_statedata(&dev->states_usage[index]); 276 cx = &omap3_idle_data[index];
279 core_next_state = cx->core_state; 277 core_next_state = cx->core_state;
280 per_next_state = per_saved_state = pwrdm_read_next_pwrst(per_pd); 278 per_next_state = per_saved_state = pwrdm_read_next_pwrst(per_pd);
281 if ((per_next_state == PWRDM_POWER_OFF) && 279 if ((per_next_state == PWRDM_POWER_OFF) &&
@@ -365,19 +363,6 @@ struct cpuidle_driver omap3_idle_driver = {
365 .safe_state_index = 0, 363 .safe_state_index = 0,
366}; 364};
367 365
368/* Helper to register the driver_data */
369static inline struct omap3_idle_statedata *_fill_cstate_usage(
370 struct cpuidle_device *dev,
371 int idx)
372{
373 struct omap3_idle_statedata *cx = &omap3_idle_data[idx];
374 struct cpuidle_state_usage *state_usage = &dev->states_usage[idx];
375
376 cpuidle_set_statedata(state_usage, cx);
377
378 return cx;
379}
380
381/** 366/**
382 * omap3_idle_init - Init routine for OMAP3 idle 367 * omap3_idle_init - Init routine for OMAP3 idle
383 * 368 *
@@ -387,52 +372,16 @@ static inline struct omap3_idle_statedata *_fill_cstate_usage(
387int __init omap3_idle_init(void) 372int __init omap3_idle_init(void)
388{ 373{
389 struct cpuidle_device *dev; 374 struct cpuidle_device *dev;
390 struct omap3_idle_statedata *cx;
391 375
392 mpu_pd = pwrdm_lookup("mpu_pwrdm"); 376 mpu_pd = pwrdm_lookup("mpu_pwrdm");
393 core_pd = pwrdm_lookup("core_pwrdm"); 377 core_pd = pwrdm_lookup("core_pwrdm");
394 per_pd = pwrdm_lookup("per_pwrdm"); 378 per_pd = pwrdm_lookup("per_pwrdm");
395 cam_pd = pwrdm_lookup("cam_pwrdm"); 379 cam_pd = pwrdm_lookup("cam_pwrdm");
396 380
381 cpuidle_register_driver(&omap3_idle_driver);
397 382
398 dev = &per_cpu(omap3_idle_dev, smp_processor_id()); 383 dev = &per_cpu(omap3_idle_dev, smp_processor_id());
399 384 dev->cpu = 0;
400 /* C1 . MPU WFI + Core active */
401 cx = _fill_cstate_usage(dev, 0);
402 cx->mpu_state = PWRDM_POWER_ON;
403 cx->core_state = PWRDM_POWER_ON;
404
405 /* C2 . MPU WFI + Core inactive */
406 cx = _fill_cstate_usage(dev, 1);
407 cx->mpu_state = PWRDM_POWER_ON;
408 cx->core_state = PWRDM_POWER_ON;
409
410 /* C3 . MPU CSWR + Core inactive */
411 cx = _fill_cstate_usage(dev, 2);
412 cx->mpu_state = PWRDM_POWER_RET;
413 cx->core_state = PWRDM_POWER_ON;
414
415 /* C4 . MPU OFF + Core inactive */
416 cx = _fill_cstate_usage(dev, 3);
417 cx->mpu_state = PWRDM_POWER_OFF;
418 cx->core_state = PWRDM_POWER_ON;
419
420 /* C5 . MPU RET + Core RET */
421 cx = _fill_cstate_usage(dev, 4);
422 cx->mpu_state = PWRDM_POWER_RET;
423 cx->core_state = PWRDM_POWER_RET;
424
425 /* C6 . MPU OFF + Core RET */
426 cx = _fill_cstate_usage(dev, 5);
427 cx->mpu_state = PWRDM_POWER_OFF;
428 cx->core_state = PWRDM_POWER_RET;
429
430 /* C7 . MPU OFF + Core OFF */
431 cx = _fill_cstate_usage(dev, 6);
432 cx->mpu_state = PWRDM_POWER_OFF;
433 cx->core_state = PWRDM_POWER_OFF;
434
435 cpuidle_register_driver(&omap3_idle_driver);
436 385
437 if (cpuidle_register_device(dev)) { 386 if (cpuidle_register_device(dev)) {
438 printk(KERN_ERR "%s: CPUidle register device failed\n", 387 printk(KERN_ERR "%s: CPUidle register device failed\n",