Commit 8e2efde9f1ba2fb918245f9419246e4e59b42a11
Committed by
Kevin Hilman
1 parent
d6290a3ead
Exists in
master
and in
4 other branches
OMAP3: PM: Add milliseconds interface to suspend wakeup timer
Millisecond resolution is possible and there are use cases for it (automatic testing). Seconds-based interface is preserved for compatibility. Signed-off-by: Ari Kauppi <Ext-Ari.Kauppi@nokia.com> Reviewed-by: Phil Carmody <ext-phil.2.carmody@nokia.com> Signed-off-by: Kevin Hilman <khilman@deeprootsystems.com>
Showing 3 changed files with 14 additions and 7 deletions Side-by-side Diff
arch/arm/mach-omap2/pm-debug.c
arch/arm/mach-omap2/pm.h
arch/arm/mach-omap2/pm34xx.c
... | ... | @@ -58,6 +58,7 @@ |
58 | 58 | u32 enable_off_mode; |
59 | 59 | u32 sleep_while_idle; |
60 | 60 | u32 wakeup_timer_seconds; |
61 | +u32 wakeup_timer_milliseconds; | |
61 | 62 | |
62 | 63 | struct power_state { |
63 | 64 | struct powerdomain *pwrdm; |
64 | 65 | |
65 | 66 | |
66 | 67 | |
... | ... | @@ -555,20 +556,21 @@ |
555 | 556 | #ifdef CONFIG_SUSPEND |
556 | 557 | static suspend_state_t suspend_state; |
557 | 558 | |
558 | -static void omap2_pm_wakeup_on_timer(u32 seconds) | |
559 | +static void omap2_pm_wakeup_on_timer(u32 seconds, u32 milliseconds) | |
559 | 560 | { |
560 | 561 | u32 tick_rate, cycles; |
561 | 562 | |
562 | - if (!seconds) | |
563 | + if (!seconds && !milliseconds) | |
563 | 564 | return; |
564 | 565 | |
565 | 566 | tick_rate = clk_get_rate(omap_dm_timer_get_fclk(gptimer_wakeup)); |
566 | - cycles = tick_rate * seconds; | |
567 | + cycles = tick_rate * seconds + tick_rate * milliseconds / 1000; | |
567 | 568 | omap_dm_timer_stop(gptimer_wakeup); |
568 | 569 | omap_dm_timer_set_load_start(gptimer_wakeup, 0, 0xffffffff - cycles); |
569 | 570 | |
570 | - pr_info("PM: Resume timer in %d secs (%d ticks at %d ticks/sec.)\n", | |
571 | - seconds, cycles, tick_rate); | |
571 | + pr_info("PM: Resume timer in %u.%03u secs" | |
572 | + " (%d ticks at %d ticks/sec.)\n", | |
573 | + seconds, milliseconds, cycles, tick_rate); | |
572 | 574 | } |
573 | 575 | |
574 | 576 | static int omap3_pm_prepare(void) |
... | ... | @@ -582,8 +584,9 @@ |
582 | 584 | struct power_state *pwrst; |
583 | 585 | int state, ret = 0; |
584 | 586 | |
585 | - if (wakeup_timer_seconds) | |
586 | - omap2_pm_wakeup_on_timer(wakeup_timer_seconds); | |
587 | + if (wakeup_timer_seconds || wakeup_timer_milliseconds) | |
588 | + omap2_pm_wakeup_on_timer(wakeup_timer_seconds, | |
589 | + wakeup_timer_milliseconds); | |
587 | 590 | |
588 | 591 | /* Read current next_pwrsts */ |
589 | 592 | list_for_each_entry(pwrst, &pwrst_list, node) |