diff options
Diffstat (limited to 'arch/arm/mach-omap2/pm-debug.c')
| -rw-r--r-- | arch/arm/mach-omap2/pm-debug.c | 44 |
1 files changed, 38 insertions, 6 deletions
diff --git a/arch/arm/mach-omap2/pm-debug.c b/arch/arm/mach-omap2/pm-debug.c index 723b44e252fd..5e81517a7af2 100644 --- a/arch/arm/mach-omap2/pm-debug.c +++ b/arch/arm/mach-omap2/pm-debug.c | |||
| @@ -31,12 +31,17 @@ | |||
| 31 | #include <plat/board.h> | 31 | #include <plat/board.h> |
| 32 | #include <plat/powerdomain.h> | 32 | #include <plat/powerdomain.h> |
| 33 | #include <plat/clockdomain.h> | 33 | #include <plat/clockdomain.h> |
| 34 | #include <plat/dmtimer.h> | ||
| 34 | 35 | ||
| 35 | #include "prm.h" | 36 | #include "prm.h" |
| 36 | #include "cm.h" | 37 | #include "cm.h" |
| 37 | #include "pm.h" | 38 | #include "pm.h" |
| 38 | 39 | ||
| 39 | int omap2_pm_debug; | 40 | int omap2_pm_debug; |
| 41 | u32 enable_off_mode; | ||
| 42 | u32 sleep_while_idle; | ||
| 43 | u32 wakeup_timer_seconds; | ||
| 44 | u32 wakeup_timer_milliseconds; | ||
| 40 | 45 | ||
| 41 | #define DUMP_PRM_MOD_REG(mod, reg) \ | 46 | #define DUMP_PRM_MOD_REG(mod, reg) \ |
| 42 | regs[reg_count].name = #mod "." #reg; \ | 47 | regs[reg_count].name = #mod "." #reg; \ |
| @@ -162,7 +167,7 @@ void omap2_pm_dump(int mode, int resume, unsigned int us) | |||
| 162 | 167 | ||
| 163 | static void pm_dbg_regset_store(u32 *ptr); | 168 | static void pm_dbg_regset_store(u32 *ptr); |
| 164 | 169 | ||
| 165 | struct dentry *pm_dbg_dir; | 170 | static struct dentry *pm_dbg_dir; |
| 166 | 171 | ||
| 167 | static int pm_dbg_init_done; | 172 | static int pm_dbg_init_done; |
| 168 | 173 | ||
| @@ -349,6 +354,23 @@ void pm_dbg_update_time(struct powerdomain *pwrdm, int prev) | |||
| 349 | pwrdm->timer = t; | 354 | pwrdm->timer = t; |
| 350 | } | 355 | } |
| 351 | 356 | ||
| 357 | void omap2_pm_wakeup_on_timer(u32 seconds, u32 milliseconds) | ||
| 358 | { | ||
| 359 | u32 tick_rate, cycles; | ||
| 360 | |||
| 361 | if (!seconds && !milliseconds) | ||
| 362 | return; | ||
| 363 | |||
| 364 | tick_rate = clk_get_rate(omap_dm_timer_get_fclk(gptimer_wakeup)); | ||
| 365 | cycles = tick_rate * seconds + tick_rate * milliseconds / 1000; | ||
| 366 | omap_dm_timer_stop(gptimer_wakeup); | ||
| 367 | omap_dm_timer_set_load_start(gptimer_wakeup, 0, 0xffffffff - cycles); | ||
| 368 | |||
| 369 | pr_info("PM: Resume timer in %u.%03u secs" | ||
| 370 | " (%d ticks at %d ticks/sec.)\n", | ||
| 371 | seconds, milliseconds, cycles, tick_rate); | ||
| 372 | } | ||
| 373 | |||
| 352 | static int clkdm_dbg_show_counter(struct clockdomain *clkdm, void *user) | 374 | static int clkdm_dbg_show_counter(struct clockdomain *clkdm, void *user) |
| 353 | { | 375 | { |
| 354 | struct seq_file *s = (struct seq_file *)user; | 376 | struct seq_file *s = (struct seq_file *)user; |
| @@ -494,8 +516,10 @@ int pm_dbg_regset_init(int reg_set) | |||
| 494 | 516 | ||
| 495 | static int pwrdm_suspend_get(void *data, u64 *val) | 517 | static int pwrdm_suspend_get(void *data, u64 *val) |
| 496 | { | 518 | { |
| 497 | int ret; | 519 | int ret = -EINVAL; |
| 498 | ret = omap3_pm_get_suspend_state((struct powerdomain *)data); | 520 | |
| 521 | if (cpu_is_omap34xx()) | ||
| 522 | ret = omap3_pm_get_suspend_state((struct powerdomain *)data); | ||
| 499 | *val = ret; | 523 | *val = ret; |
| 500 | 524 | ||
| 501 | if (ret >= 0) | 525 | if (ret >= 0) |
| @@ -505,7 +529,10 @@ static int pwrdm_suspend_get(void *data, u64 *val) | |||
| 505 | 529 | ||
| 506 | static int pwrdm_suspend_set(void *data, u64 val) | 530 | static int pwrdm_suspend_set(void *data, u64 val) |
| 507 | { | 531 | { |
| 508 | return omap3_pm_set_suspend_state((struct powerdomain *)data, (int)val); | 532 | if (cpu_is_omap34xx()) |
| 533 | return omap3_pm_set_suspend_state( | ||
| 534 | (struct powerdomain *)data, (int)val); | ||
| 535 | return -EINVAL; | ||
| 509 | } | 536 | } |
| 510 | 537 | ||
| 511 | DEFINE_SIMPLE_ATTRIBUTE(pwrdm_suspend_fops, pwrdm_suspend_get, | 538 | DEFINE_SIMPLE_ATTRIBUTE(pwrdm_suspend_fops, pwrdm_suspend_get, |
| @@ -553,8 +580,10 @@ static int option_set(void *data, u64 val) | |||
| 553 | 580 | ||
| 554 | *option = val; | 581 | *option = val; |
| 555 | 582 | ||
| 556 | if (option == &enable_off_mode) | 583 | if (option == &enable_off_mode) { |
| 557 | omap3_pm_off_mode_enable(val); | 584 | if (cpu_is_omap34xx()) |
| 585 | omap3_pm_off_mode_enable(val); | ||
| 586 | } | ||
| 558 | 587 | ||
| 559 | return 0; | 588 | return 0; |
| 560 | } | 589 | } |
| @@ -609,6 +638,9 @@ static int __init pm_dbg_init(void) | |||
| 609 | &sleep_while_idle, &pm_dbg_option_fops); | 638 | &sleep_while_idle, &pm_dbg_option_fops); |
| 610 | (void) debugfs_create_file("wakeup_timer_seconds", S_IRUGO | S_IWUGO, d, | 639 | (void) debugfs_create_file("wakeup_timer_seconds", S_IRUGO | S_IWUGO, d, |
| 611 | &wakeup_timer_seconds, &pm_dbg_option_fops); | 640 | &wakeup_timer_seconds, &pm_dbg_option_fops); |
| 641 | (void) debugfs_create_file("wakeup_timer_milliseconds", | ||
| 642 | S_IRUGO | S_IWUGO, d, &wakeup_timer_milliseconds, | ||
| 643 | &pm_dbg_option_fops); | ||
| 612 | pm_dbg_init_done = 1; | 644 | pm_dbg_init_done = 1; |
| 613 | 645 | ||
| 614 | return 0; | 646 | return 0; |
