aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-omap2
diff options
context:
space:
mode:
authorDaniel Lezcano <daniel.lezcano@linaro.org>2012-04-24 10:05:30 -0400
committerKevin Hilman <khilman@ti.com>2012-05-03 14:01:05 -0400
commit200dd5205754e9c99effa4a0652c0738d33655d4 (patch)
tree3d93e78165a0504d5bd237542d805fdf0035f799 /arch/arm/mach-omap2
parent231900afba52d6faddfb480cde4132d4edc089bc (diff)
ARM: OMAP3: define cpuidle statically
Use the new cpuidle API and define in the driver the states. 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')
-rw-r--r--arch/arm/mach-omap2/cpuidle34xx.c86
1 files changed, 60 insertions, 26 deletions
diff --git a/arch/arm/mach-omap2/cpuidle34xx.c b/arch/arm/mach-omap2/cpuidle34xx.c
index 3519a8ba0207..11a2c23372d7 100644
--- a/arch/arm/mach-omap2/cpuidle34xx.c
+++ b/arch/arm/mach-omap2/cpuidle34xx.c
@@ -301,23 +301,68 @@ DEFINE_PER_CPU(struct cpuidle_device, omap3_idle_dev);
301struct cpuidle_driver omap3_idle_driver = { 301struct cpuidle_driver omap3_idle_driver = {
302 .name = "omap3_idle", 302 .name = "omap3_idle",
303 .owner = THIS_MODULE, 303 .owner = THIS_MODULE,
304 .states = {
305 {
306 .enter = omap3_enter_idle,
307 .exit_latency = 2 + 2,
308 .target_residency = 5,
309 .flags = CPUIDLE_FLAG_TIME_VALID,
310 .name = "C1",
311 .desc = "MPU ON + CORE ON",
312 },
313 {
314 .enter = omap3_enter_idle_bm,
315 .exit_latency = 10 + 10,
316 .target_residency = 30,
317 .flags = CPUIDLE_FLAG_TIME_VALID,
318 .name = "C2",
319 .desc = "MPU ON + CORE ON",
320 },
321 {
322 .enter = omap3_enter_idle_bm,
323 .exit_latency = 50 + 50,
324 .target_residency = 300,
325 .flags = CPUIDLE_FLAG_TIME_VALID,
326 .name = "C3",
327 .desc = "MPU RET + CORE ON",
328 },
329 {
330 .enter = omap3_enter_idle_bm,
331 .exit_latency = 1500 + 1800,
332 .target_residency = 4000,
333 .flags = CPUIDLE_FLAG_TIME_VALID,
334 .name = "C4",
335 .desc = "MPU OFF + CORE ON",
336 },
337 {
338 .enter = omap3_enter_idle_bm,
339 .exit_latency = 2500 + 7500,
340 .target_residency = 12000,
341 .flags = CPUIDLE_FLAG_TIME_VALID,
342 .name = "C5",
343 .desc = "MPU RET + CORE RET",
344 },
345 {
346 .enter = omap3_enter_idle_bm,
347 .exit_latency = 3000 + 8500,
348 .target_residency = 15000,
349 .flags = CPUIDLE_FLAG_TIME_VALID,
350 .name = "C6",
351 .desc = "MPU OFF + CORE RET",
352 },
353 {
354 .enter = omap3_enter_idle_bm,
355 .exit_latency = 10000 + 30000,
356 .target_residency = 30000,
357 .flags = CPUIDLE_FLAG_TIME_VALID,
358 .name = "C7",
359 .desc = "MPU OFF + CORE OFF",
360 },
361 },
362 .state_count = OMAP3_NUM_STATES,
363 .safe_state_index = 0,
304}; 364};
305 365
306/* Helper to fill the C-state common data*/
307static inline void _fill_cstate(struct cpuidle_driver *drv,
308 int idx, const char *descr)
309{
310 struct cpuidle_state *state = &drv->states[idx];
311
312 state->exit_latency = cpuidle_params_table[idx].exit_latency;
313 state->target_residency = cpuidle_params_table[idx].target_residency;
314 state->flags = CPUIDLE_FLAG_TIME_VALID;
315 state->enter = omap3_enter_idle_bm;
316 sprintf(state->name, "C%d", idx + 1);
317 strncpy(state->desc, descr, CPUIDLE_DESC_LEN);
318
319}
320
321/* Helper to register the driver_data */ 366/* Helper to register the driver_data */
322static inline struct omap3_idle_statedata *_fill_cstate_usage( 367static inline struct omap3_idle_statedata *_fill_cstate_usage(
323 struct cpuidle_device *dev, 368 struct cpuidle_device *dev,
@@ -350,50 +395,40 @@ int __init omap3_idle_init(void)
350 cam_pd = pwrdm_lookup("cam_pwrdm"); 395 cam_pd = pwrdm_lookup("cam_pwrdm");
351 396
352 397
353 drv->safe_state_index = -1;
354 dev = &per_cpu(omap3_idle_dev, smp_processor_id()); 398 dev = &per_cpu(omap3_idle_dev, smp_processor_id());
355 399
356 /* C1 . MPU WFI + Core active */ 400 /* C1 . MPU WFI + Core active */
357 _fill_cstate(drv, 0, "MPU ON + CORE ON");
358 (&drv->states[0])->enter = omap3_enter_idle;
359 drv->safe_state_index = 0;
360 cx = _fill_cstate_usage(dev, 0); 401 cx = _fill_cstate_usage(dev, 0);
361 cx->valid = 1; /* C1 is always valid */ 402 cx->valid = 1; /* C1 is always valid */
362 cx->mpu_state = PWRDM_POWER_ON; 403 cx->mpu_state = PWRDM_POWER_ON;
363 cx->core_state = PWRDM_POWER_ON; 404 cx->core_state = PWRDM_POWER_ON;
364 405
365 /* C2 . MPU WFI + Core inactive */ 406 /* C2 . MPU WFI + Core inactive */
366 _fill_cstate(drv, 1, "MPU ON + CORE ON");
367 cx = _fill_cstate_usage(dev, 1); 407 cx = _fill_cstate_usage(dev, 1);
368 cx->mpu_state = PWRDM_POWER_ON; 408 cx->mpu_state = PWRDM_POWER_ON;
369 cx->core_state = PWRDM_POWER_ON; 409 cx->core_state = PWRDM_POWER_ON;
370 410
371 /* C3 . MPU CSWR + Core inactive */ 411 /* C3 . MPU CSWR + Core inactive */
372 _fill_cstate(drv, 2, "MPU RET + CORE ON");
373 cx = _fill_cstate_usage(dev, 2); 412 cx = _fill_cstate_usage(dev, 2);
374 cx->mpu_state = PWRDM_POWER_RET; 413 cx->mpu_state = PWRDM_POWER_RET;
375 cx->core_state = PWRDM_POWER_ON; 414 cx->core_state = PWRDM_POWER_ON;
376 415
377 /* C4 . MPU OFF + Core inactive */ 416 /* C4 . MPU OFF + Core inactive */
378 _fill_cstate(drv, 3, "MPU OFF + CORE ON");
379 cx = _fill_cstate_usage(dev, 3); 417 cx = _fill_cstate_usage(dev, 3);
380 cx->mpu_state = PWRDM_POWER_OFF; 418 cx->mpu_state = PWRDM_POWER_OFF;
381 cx->core_state = PWRDM_POWER_ON; 419 cx->core_state = PWRDM_POWER_ON;
382 420
383 /* C5 . MPU RET + Core RET */ 421 /* C5 . MPU RET + Core RET */
384 _fill_cstate(drv, 4, "MPU RET + CORE RET");
385 cx = _fill_cstate_usage(dev, 4); 422 cx = _fill_cstate_usage(dev, 4);
386 cx->mpu_state = PWRDM_POWER_RET; 423 cx->mpu_state = PWRDM_POWER_RET;
387 cx->core_state = PWRDM_POWER_RET; 424 cx->core_state = PWRDM_POWER_RET;
388 425
389 /* C6 . MPU OFF + Core RET */ 426 /* C6 . MPU OFF + Core RET */
390 _fill_cstate(drv, 5, "MPU OFF + CORE RET");
391 cx = _fill_cstate_usage(dev, 5); 427 cx = _fill_cstate_usage(dev, 5);
392 cx->mpu_state = PWRDM_POWER_OFF; 428 cx->mpu_state = PWRDM_POWER_OFF;
393 cx->core_state = PWRDM_POWER_RET; 429 cx->core_state = PWRDM_POWER_RET;
394 430
395 /* C7 . MPU OFF + Core OFF */ 431 /* C7 . MPU OFF + Core OFF */
396 _fill_cstate(drv, 6, "MPU OFF + CORE OFF");
397 cx = _fill_cstate_usage(dev, 6); 432 cx = _fill_cstate_usage(dev, 6);
398 /* 433 /*
399 * Erratum i583: implementation for ES rev < Es1.2 on 3630. We cannot 434 * Erratum i583: implementation for ES rev < Es1.2 on 3630. We cannot
@@ -411,7 +446,6 @@ int __init omap3_idle_init(void)
411 drv->state_count = OMAP3_NUM_STATES; 446 drv->state_count = OMAP3_NUM_STATES;
412 cpuidle_register_driver(&omap3_idle_driver); 447 cpuidle_register_driver(&omap3_idle_driver);
413 448
414 dev->state_count = OMAP3_NUM_STATES;
415 if (cpuidle_register_device(dev)) { 449 if (cpuidle_register_device(dev)) {
416 printk(KERN_ERR "%s: CPUidle register device failed\n", 450 printk(KERN_ERR "%s: CPUidle register device failed\n",
417 __func__); 451 __func__);