diff options
author | Ari Kauppi <Ext-Ari.Kauppi@nokia.com> | 2010-03-23 03:04:59 -0400 |
---|---|---|
committer | Kevin Hilman <khilman@deeprootsystems.com> | 2010-05-12 12:39:00 -0400 |
commit | 8e2efde9f1ba2fb918245f9419246e4e59b42a11 (patch) | |
tree | 415364ac960ac76f9e74ea6b4caebd854a014b9b /arch/arm | |
parent | d6290a3ead555c0b092d48288b4dc0566580e17f (diff) |
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>
Diffstat (limited to 'arch/arm')
-rw-r--r-- | arch/arm/mach-omap2/pm-debug.c | 3 | ||||
-rw-r--r-- | arch/arm/mach-omap2/pm.h | 1 | ||||
-rw-r--r-- | arch/arm/mach-omap2/pm34xx.c | 17 |
3 files changed, 14 insertions, 7 deletions
diff --git a/arch/arm/mach-omap2/pm-debug.c b/arch/arm/mach-omap2/pm-debug.c index 6cac9817c243..723b44e252fd 100644 --- a/arch/arm/mach-omap2/pm-debug.c +++ b/arch/arm/mach-omap2/pm-debug.c | |||
@@ -548,6 +548,9 @@ static int option_set(void *data, u64 val) | |||
548 | { | 548 | { |
549 | u32 *option = data; | 549 | u32 *option = data; |
550 | 550 | ||
551 | if (option == &wakeup_timer_milliseconds && val >= 1000) | ||
552 | return -EINVAL; | ||
553 | |||
551 | *option = val; | 554 | *option = val; |
552 | 555 | ||
553 | if (option == &enable_off_mode) | 556 | if (option == &enable_off_mode) |
diff --git a/arch/arm/mach-omap2/pm.h b/arch/arm/mach-omap2/pm.h index bd6466a2b039..3de6ece23fc8 100644 --- a/arch/arm/mach-omap2/pm.h +++ b/arch/arm/mach-omap2/pm.h | |||
@@ -43,6 +43,7 @@ extern int omap3_pm_get_suspend_state(struct powerdomain *pwrdm); | |||
43 | extern int omap3_pm_set_suspend_state(struct powerdomain *pwrdm, int state); | 43 | extern int omap3_pm_set_suspend_state(struct powerdomain *pwrdm, int state); |
44 | 44 | ||
45 | extern u32 wakeup_timer_seconds; | 45 | extern u32 wakeup_timer_seconds; |
46 | extern u32 wakeup_timer_milliseconds; | ||
46 | extern struct omap_dm_timer *gptimer_wakeup; | 47 | extern struct omap_dm_timer *gptimer_wakeup; |
47 | 48 | ||
48 | #ifdef CONFIG_PM_DEBUG | 49 | #ifdef CONFIG_PM_DEBUG |
diff --git a/arch/arm/mach-omap2/pm34xx.c b/arch/arm/mach-omap2/pm34xx.c index a15aa92d384e..e76af5b532a0 100644 --- a/arch/arm/mach-omap2/pm34xx.c +++ b/arch/arm/mach-omap2/pm34xx.c | |||
@@ -58,6 +58,7 @@ | |||
58 | u32 enable_off_mode; | 58 | u32 enable_off_mode; |
59 | u32 sleep_while_idle; | 59 | u32 sleep_while_idle; |
60 | u32 wakeup_timer_seconds; | 60 | u32 wakeup_timer_seconds; |
61 | u32 wakeup_timer_milliseconds; | ||
61 | 62 | ||
62 | struct power_state { | 63 | struct power_state { |
63 | struct powerdomain *pwrdm; | 64 | struct powerdomain *pwrdm; |
@@ -555,20 +556,21 @@ out: | |||
555 | #ifdef CONFIG_SUSPEND | 556 | #ifdef CONFIG_SUSPEND |
556 | static suspend_state_t suspend_state; | 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 | u32 tick_rate, cycles; | 561 | u32 tick_rate, cycles; |
561 | 562 | ||
562 | if (!seconds) | 563 | if (!seconds && !milliseconds) |
563 | return; | 564 | return; |
564 | 565 | ||
565 | tick_rate = clk_get_rate(omap_dm_timer_get_fclk(gptimer_wakeup)); | 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 | omap_dm_timer_stop(gptimer_wakeup); | 568 | omap_dm_timer_stop(gptimer_wakeup); |
568 | omap_dm_timer_set_load_start(gptimer_wakeup, 0, 0xffffffff - cycles); | 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 | pr_info("PM: Resume timer in %u.%03u secs" |
571 | seconds, cycles, tick_rate); | 572 | " (%d ticks at %d ticks/sec.)\n", |
573 | seconds, milliseconds, cycles, tick_rate); | ||
572 | } | 574 | } |
573 | 575 | ||
574 | static int omap3_pm_prepare(void) | 576 | static int omap3_pm_prepare(void) |
@@ -582,8 +584,9 @@ static int omap3_pm_suspend(void) | |||
582 | struct power_state *pwrst; | 584 | struct power_state *pwrst; |
583 | int state, ret = 0; | 585 | int state, ret = 0; |
584 | 586 | ||
585 | if (wakeup_timer_seconds) | 587 | if (wakeup_timer_seconds || wakeup_timer_milliseconds) |
586 | omap2_pm_wakeup_on_timer(wakeup_timer_seconds); | 588 | omap2_pm_wakeup_on_timer(wakeup_timer_seconds, |
589 | wakeup_timer_milliseconds); | ||
587 | 590 | ||
588 | /* Read current next_pwrsts */ | 591 | /* Read current next_pwrsts */ |
589 | list_for_each_entry(pwrst, &pwrst_list, node) | 592 | list_for_each_entry(pwrst, &pwrst_list, node) |