aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAri Kauppi <Ext-Ari.Kauppi@nokia.com>2010-03-23 03:04:59 -0400
committerKevin Hilman <khilman@deeprootsystems.com>2010-05-12 12:39:00 -0400
commit8e2efde9f1ba2fb918245f9419246e4e59b42a11 (patch)
tree415364ac960ac76f9e74ea6b4caebd854a014b9b
parentd6290a3ead555c0b092d48288b4dc0566580e17f (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>
-rw-r--r--arch/arm/mach-omap2/pm-debug.c3
-rw-r--r--arch/arm/mach-omap2/pm.h1
-rw-r--r--arch/arm/mach-omap2/pm34xx.c17
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);
43extern int omap3_pm_set_suspend_state(struct powerdomain *pwrdm, int state); 43extern int omap3_pm_set_suspend_state(struct powerdomain *pwrdm, int state);
44 44
45extern u32 wakeup_timer_seconds; 45extern u32 wakeup_timer_seconds;
46extern u32 wakeup_timer_milliseconds;
46extern struct omap_dm_timer *gptimer_wakeup; 47extern 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 @@
58u32 enable_off_mode; 58u32 enable_off_mode;
59u32 sleep_while_idle; 59u32 sleep_while_idle;
60u32 wakeup_timer_seconds; 60u32 wakeup_timer_seconds;
61u32 wakeup_timer_milliseconds;
61 62
62struct power_state { 63struct power_state {
63 struct powerdomain *pwrdm; 64 struct powerdomain *pwrdm;
@@ -555,20 +556,21 @@ out:
555#ifdef CONFIG_SUSPEND 556#ifdef CONFIG_SUSPEND
556static suspend_state_t suspend_state; 557static suspend_state_t suspend_state;
557 558
558static void omap2_pm_wakeup_on_timer(u32 seconds) 559static 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
574static int omap3_pm_prepare(void) 576static 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)