* [PATCH 0/3 v2] omap: pm: Move the common code to allow re-use
@ 2010-09-14 19:33 Santosh Shilimkar
2010-09-14 19:33 ` [PATCH 1/3 v2] omap: pm-debug: Move common debug code to pm-debug.c Santosh Shilimkar
2010-09-14 20:29 ` [PATCH 0/3 v2] omap: pm: Move the common code to allow re-use Kevin Hilman
0 siblings, 2 replies; 6+ messages in thread
From: Santosh Shilimkar @ 2010-09-14 19:33 UTC (permalink / raw)
To: linux-omap; +Cc: khilman, rnayak, b-cousson, Santosh Shilimkar
(v2 is rebased on Kevin's 'pm-next' branch)
This is small series moves some common pm code out of pm34xx.c so
that omap4 can re-use this and not duplicate it.
It's boot tested on OMAP3/4 with omap3_defconfig and also simple
test with millisecond debugfs entry and suspend/resume.
Santosh Shilimkar (3):
omap: pm-debug: Move common debug code to pm-debug.c
omap: pm-debug: Enable wakeup_timer_milliseconds debugfs entry
omap: pm: Move set_pwrdm_state routine to common pm.c
arch/arm/mach-omap2/pm-debug.c | 21 ++++++++++++
arch/arm/mach-omap2/pm.c | 50 ++++++++++++++++++++++++++++
arch/arm/mach-omap2/pm.h | 4 ++-
arch/arm/mach-omap2/pm34xx.c | 71 ++-------------------------------------
4 files changed, 78 insertions(+), 68 deletions(-)
^ permalink raw reply [flat|nested] 6+ messages in thread* [PATCH 1/3 v2] omap: pm-debug: Move common debug code to pm-debug.c 2010-09-14 19:33 [PATCH 0/3 v2] omap: pm: Move the common code to allow re-use Santosh Shilimkar @ 2010-09-14 19:33 ` Santosh Shilimkar 2010-09-14 19:34 ` [PATCH 2/3 v2] omap: pm-debug: Enable wakeup_timer_milliseconds debugfs entry Santosh Shilimkar 2010-09-14 20:30 ` [PATCH 1/3 v2] omap: pm-debug: Move common debug code to pm-debug.c Kevin Hilman 2010-09-14 20:29 ` [PATCH 0/3 v2] omap: pm: Move the common code to allow re-use Kevin Hilman 1 sibling, 2 replies; 6+ messages in thread From: Santosh Shilimkar @ 2010-09-14 19:33 UTC (permalink / raw) To: linux-omap; +Cc: khilman, rnayak, b-cousson, Santosh Shilimkar This patch moves omap2_pm_wakeup_on_timer() and pm debug entries form pm34xx.c to pm-debug.c and export it, so that it is available to other OMAPs Signed-off-by: Santosh Shilimkar <santosh.shilimkar@ti.com> Cc: Kevin Hilman <khilman@deeprootsystems.com> --- arch/arm/mach-omap2/pm-debug.c | 18 ++++++++++++++++++ arch/arm/mach-omap2/pm.h | 2 ++ arch/arm/mach-omap2/pm34xx.c | 18 ------------------ 3 files changed, 20 insertions(+), 18 deletions(-) diff --git a/arch/arm/mach-omap2/pm-debug.c b/arch/arm/mach-omap2/pm-debug.c index 056ff17..655f9df 100644 --- a/arch/arm/mach-omap2/pm-debug.c +++ b/arch/arm/mach-omap2/pm-debug.c @@ -31,6 +31,7 @@ #include <plat/board.h> #include <plat/powerdomain.h> #include <plat/clockdomain.h> +#include <plat/dmtimer.h> #include "prm.h" #include "cm.h" @@ -353,6 +354,23 @@ void pm_dbg_update_time(struct powerdomain *pwrdm, int prev) pwrdm->timer = t; } +void omap2_pm_wakeup_on_timer(u32 seconds, u32 milliseconds) +{ + u32 tick_rate, cycles; + + if (!seconds && !milliseconds) + return; + + tick_rate = clk_get_rate(omap_dm_timer_get_fclk(gptimer_wakeup)); + cycles = tick_rate * seconds + tick_rate * milliseconds / 1000; + omap_dm_timer_stop(gptimer_wakeup); + omap_dm_timer_set_load_start(gptimer_wakeup, 0, 0xffffffff - cycles); + + pr_info("PM: Resume timer in %u.%03u secs" + " (%d ticks at %d ticks/sec.)\n", + seconds, milliseconds, cycles, tick_rate); +} + static int clkdm_dbg_show_counter(struct clockdomain *clkdm, void *user) { struct seq_file *s = (struct seq_file *)user; diff --git a/arch/arm/mach-omap2/pm.h b/arch/arm/mach-omap2/pm.h index 3de6ece..4fd021f 100644 --- a/arch/arm/mach-omap2/pm.h +++ b/arch/arm/mach-omap2/pm.h @@ -48,9 +48,11 @@ extern struct omap_dm_timer *gptimer_wakeup; #ifdef CONFIG_PM_DEBUG extern void omap2_pm_dump(int mode, int resume, unsigned int us); +extern void omap2_pm_wakeup_on_timer(u32 seconds, u32 milliseconds); extern int omap2_pm_debug; #else #define omap2_pm_dump(mode, resume, us) do {} while (0); +#define omap2_pm_wakeup_on_timer(seconds, milliseconds) do {} while (0); #define omap2_pm_debug 0 #endif diff --git a/arch/arm/mach-omap2/pm34xx.c b/arch/arm/mach-omap2/pm34xx.c index bb2ba1e..bc24fbd 100644 --- a/arch/arm/mach-omap2/pm34xx.c +++ b/arch/arm/mach-omap2/pm34xx.c @@ -38,7 +38,6 @@ #include <plat/prcm.h> #include <plat/gpmc.h> #include <plat/dma.h> -#include <plat/dmtimer.h> #include <asm/tlbflush.h> @@ -550,23 +549,6 @@ out: #ifdef CONFIG_SUSPEND static suspend_state_t suspend_state; -static void omap2_pm_wakeup_on_timer(u32 seconds, u32 milliseconds) -{ - u32 tick_rate, cycles; - - if (!seconds && !milliseconds) - return; - - tick_rate = clk_get_rate(omap_dm_timer_get_fclk(gptimer_wakeup)); - cycles = tick_rate * seconds + tick_rate * milliseconds / 1000; - omap_dm_timer_stop(gptimer_wakeup); - omap_dm_timer_set_load_start(gptimer_wakeup, 0, 0xffffffff - cycles); - - pr_info("PM: Resume timer in %u.%03u secs" - " (%d ticks at %d ticks/sec.)\n", - seconds, milliseconds, cycles, tick_rate); -} - static int omap3_pm_prepare(void) { disable_hlt(); -- 1.6.0.4 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 2/3 v2] omap: pm-debug: Enable wakeup_timer_milliseconds debugfs entry 2010-09-14 19:33 ` [PATCH 1/3 v2] omap: pm-debug: Move common debug code to pm-debug.c Santosh Shilimkar @ 2010-09-14 19:34 ` Santosh Shilimkar 2010-09-14 19:34 ` [PATCH 3/3 v2] omap: pm: Move set_pwrdm_state routine to common pm.c Santosh Shilimkar 2010-09-14 20:30 ` [PATCH 1/3 v2] omap: pm-debug: Move common debug code to pm-debug.c Kevin Hilman 1 sibling, 1 reply; 6+ messages in thread From: Santosh Shilimkar @ 2010-09-14 19:34 UTC (permalink / raw) To: linux-omap; +Cc: khilman, rnayak, b-cousson, Santosh Shilimkar Commit 8e2efde9 added milliseconds suspend wakeup time support but same interface is not exported through debugfs This patch enables the debugfs hook for wakeup_timer_milliseconds Signed-off-by: Santosh Shilimkar <santosh.shilimkar@ti.com> Cc: Kevin Hilman <khilman@deeprootsystems.com> --- arch/arm/mach-omap2/pm-debug.c | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-) diff --git a/arch/arm/mach-omap2/pm-debug.c b/arch/arm/mach-omap2/pm-debug.c index 655f9df..af00c17 100644 --- a/arch/arm/mach-omap2/pm-debug.c +++ b/arch/arm/mach-omap2/pm-debug.c @@ -638,6 +638,9 @@ static int __init pm_dbg_init(void) &sleep_while_idle, &pm_dbg_option_fops); (void) debugfs_create_file("wakeup_timer_seconds", S_IRUGO | S_IWUGO, d, &wakeup_timer_seconds, &pm_dbg_option_fops); + (void) debugfs_create_file("wakeup_timer_milliseconds", + S_IRUGO | S_IWUGO, d, &wakeup_timer_milliseconds, + &pm_dbg_option_fops); pm_dbg_init_done = 1; return 0; -- 1.6.0.4 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 3/3 v2] omap: pm: Move set_pwrdm_state routine to common pm.c 2010-09-14 19:34 ` [PATCH 2/3 v2] omap: pm-debug: Enable wakeup_timer_milliseconds debugfs entry Santosh Shilimkar @ 2010-09-14 19:34 ` Santosh Shilimkar 0 siblings, 0 replies; 6+ messages in thread From: Santosh Shilimkar @ 2010-09-14 19:34 UTC (permalink / raw) To: linux-omap; +Cc: khilman, rnayak, b-cousson, Santosh Shilimkar The set_pwrdm_state() is needed on omap4 as well so move this routine to common pm.c file so that it's available for omap3/4 Signed-off-by: Rajendra Nayak <rnayak@ti.com> Signed-off-by: Santosh Shilimkar <santosh.shilimkar@ti.com> Cc: Kevin Hilman <khilman@deeprootsystems.com> --- arch/arm/mach-omap2/pm.c | 50 +++++++++++++++++++++++++++++++++++++++ arch/arm/mach-omap2/pm.h | 2 +- arch/arm/mach-omap2/pm34xx.c | 53 +++-------------------------------------- 3 files changed, 55 insertions(+), 50 deletions(-) diff --git a/arch/arm/mach-omap2/pm.c b/arch/arm/mach-omap2/pm.c index 68f9f2e..053f01f 100644 --- a/arch/arm/mach-omap2/pm.c +++ b/arch/arm/mach-omap2/pm.c @@ -18,6 +18,9 @@ #include <plat/omap_device.h> #include <plat/common.h> +#include <plat/powerdomain.h> +#include <plat/clockdomain.h> + static struct omap_device_pm_latency *pm_lats; static struct device *mpu_dev; @@ -73,6 +76,53 @@ static void omap2_init_processor_devices(void) _init_omap_device("l3_main", &l3_dev); } +/* + * This sets pwrdm state (other than mpu & core. Currently only ON & + * RET are supported. Function is assuming that clkdm doesn't have + * hw_sup mode enabled. + */ +int omap_set_pwrdm_state(struct powerdomain *pwrdm, u32 state) +{ + u32 cur_state; + int sleep_switch = 0; + int ret = 0; + + if (pwrdm == NULL || IS_ERR(pwrdm)) + return -EINVAL; + + while (!(pwrdm->pwrsts & (1 << state))) { + if (state == PWRDM_POWER_OFF) + return ret; + state--; + } + + cur_state = pwrdm_read_next_pwrst(pwrdm); + if (cur_state == state) + return ret; + + if (pwrdm_read_pwrst(pwrdm) < PWRDM_POWER_ON) { + omap2_clkdm_wakeup(pwrdm->pwrdm_clkdms[0]); + sleep_switch = 1; + pwrdm_wait_transition(pwrdm); + } + + ret = pwrdm_set_next_pwrst(pwrdm, state); + if (ret) { + printk(KERN_ERR "Unable to set state of powerdomain: %s\n", + pwrdm->name); + goto err; + } + + if (sleep_switch) { + omap2_clkdm_allow_idle(pwrdm->pwrdm_clkdms[0]); + pwrdm_wait_transition(pwrdm); + pwrdm_state_switch(pwrdm); + } + +err: + return ret; +} + static int __init omap2_common_pm_init(void) { omap2_init_processor_devices(); diff --git a/arch/arm/mach-omap2/pm.h b/arch/arm/mach-omap2/pm.h index 4fd021f..77770a1 100644 --- a/arch/arm/mach-omap2/pm.h +++ b/arch/arm/mach-omap2/pm.h @@ -20,7 +20,7 @@ extern void *omap3_secure_ram_storage; extern void omap3_pm_off_mode_enable(int); extern void omap_sram_idle(void); extern int omap3_can_sleep(void); -extern int set_pwrdm_state(struct powerdomain *pwrdm, u32 state); +extern int omap_set_pwrdm_state(struct powerdomain *pwrdm, u32 state); extern int omap3_idle_init(void); struct cpuidle_params { diff --git a/arch/arm/mach-omap2/pm34xx.c b/arch/arm/mach-omap2/pm34xx.c index bc24fbd..f5f1dbd 100644 --- a/arch/arm/mach-omap2/pm34xx.c +++ b/arch/arm/mach-omap2/pm34xx.c @@ -483,51 +483,6 @@ int omap3_can_sleep(void) return 1; } -/* This sets pwrdm state (other than mpu & core. Currently only ON & - * RET are supported. Function is assuming that clkdm doesn't have - * hw_sup mode enabled. */ -int set_pwrdm_state(struct powerdomain *pwrdm, u32 state) -{ - u32 cur_state; - int sleep_switch = 0; - int ret = 0; - - if (pwrdm == NULL || IS_ERR(pwrdm)) - return -EINVAL; - - while (!(pwrdm->pwrsts & (1 << state))) { - if (state == PWRDM_POWER_OFF) - return ret; - state--; - } - - cur_state = pwrdm_read_next_pwrst(pwrdm); - if (cur_state == state) - return ret; - - if (pwrdm_read_pwrst(pwrdm) < PWRDM_POWER_ON) { - omap2_clkdm_wakeup(pwrdm->pwrdm_clkdms[0]); - sleep_switch = 1; - pwrdm_wait_transition(pwrdm); - } - - ret = pwrdm_set_next_pwrst(pwrdm, state); - if (ret) { - printk(KERN_ERR "Unable to set state of powerdomain: %s\n", - pwrdm->name); - goto err; - } - - if (sleep_switch) { - omap2_clkdm_allow_idle(pwrdm->pwrdm_clkdms[0]); - pwrdm_wait_transition(pwrdm); - pwrdm_state_switch(pwrdm); - } - -err: - return ret; -} - static void omap3_pm_idle(void) { local_irq_disable(); @@ -569,7 +524,7 @@ static int omap3_pm_suspend(void) pwrst->saved_state = pwrdm_read_next_pwrst(pwrst->pwrdm); /* Set ones wanted by suspend */ list_for_each_entry(pwrst, &pwrst_list, node) { - if (set_pwrdm_state(pwrst->pwrdm, pwrst->next_state)) + if (omap_set_pwrdm_state(pwrst->pwrdm, pwrst->next_state)) goto restore; if (pwrdm_clear_all_prev_pwrst(pwrst->pwrdm)) goto restore; @@ -590,7 +545,7 @@ restore: pwrst->pwrdm->name, pwrst->next_state); ret = -1; } - set_pwrdm_state(pwrst->pwrdm, pwrst->saved_state); + omap_set_pwrdm_state(pwrst->pwrdm, pwrst->saved_state); } if (ret) printk(KERN_ERR "Could not enter target state in pm_suspend\n"); @@ -939,7 +894,7 @@ void omap3_pm_off_mode_enable(int enable) list_for_each_entry(pwrst, &pwrst_list, node) { pwrst->next_state = state; - set_pwrdm_state(pwrst->pwrdm, state); + omap_set_pwrdm_state(pwrst->pwrdm, state); } } @@ -984,7 +939,7 @@ static int __init pwrdms_setup(struct powerdomain *pwrdm, void *unused) if (pwrdm_has_hdwr_sar(pwrdm)) pwrdm_enable_hdwr_sar(pwrdm); - return set_pwrdm_state(pwrst->pwrdm, pwrst->next_state); + return omap_set_pwrdm_state(pwrst->pwrdm, pwrst->next_state); } /* -- 1.6.0.4 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH 1/3 v2] omap: pm-debug: Move common debug code to pm-debug.c 2010-09-14 19:33 ` [PATCH 1/3 v2] omap: pm-debug: Move common debug code to pm-debug.c Santosh Shilimkar 2010-09-14 19:34 ` [PATCH 2/3 v2] omap: pm-debug: Enable wakeup_timer_milliseconds debugfs entry Santosh Shilimkar @ 2010-09-14 20:30 ` Kevin Hilman 1 sibling, 0 replies; 6+ messages in thread From: Kevin Hilman @ 2010-09-14 20:30 UTC (permalink / raw) To: Santosh Shilimkar; +Cc: linux-omap, rnayak, b-cousson Santosh Shilimkar <santosh.shilimkar@ti.com> writes: > This patch moves omap2_pm_wakeup_on_timer() and pm debug entries FYI... I cleaned up this changelog a little to remove the 'and pm debug entries' part which is no longer in this patch after the rebase. Kevin > form pm34xx.c to pm-debug.c and export it, so that it is available > to other OMAPs > > Signed-off-by: Santosh Shilimkar <santosh.shilimkar@ti.com> > Cc: Kevin Hilman <khilman@deeprootsystems.com> > --- > arch/arm/mach-omap2/pm-debug.c | 18 ++++++++++++++++++ > arch/arm/mach-omap2/pm.h | 2 ++ > arch/arm/mach-omap2/pm34xx.c | 18 ------------------ > 3 files changed, 20 insertions(+), 18 deletions(-) > > diff --git a/arch/arm/mach-omap2/pm-debug.c b/arch/arm/mach-omap2/pm-debug.c > index 056ff17..655f9df 100644 > --- a/arch/arm/mach-omap2/pm-debug.c > +++ b/arch/arm/mach-omap2/pm-debug.c > @@ -31,6 +31,7 @@ > #include <plat/board.h> > #include <plat/powerdomain.h> > #include <plat/clockdomain.h> > +#include <plat/dmtimer.h> > > #include "prm.h" > #include "cm.h" > @@ -353,6 +354,23 @@ void pm_dbg_update_time(struct powerdomain *pwrdm, int prev) > pwrdm->timer = t; > } > > +void omap2_pm_wakeup_on_timer(u32 seconds, u32 milliseconds) > +{ > + u32 tick_rate, cycles; > + > + if (!seconds && !milliseconds) > + return; > + > + tick_rate = clk_get_rate(omap_dm_timer_get_fclk(gptimer_wakeup)); > + cycles = tick_rate * seconds + tick_rate * milliseconds / 1000; > + omap_dm_timer_stop(gptimer_wakeup); > + omap_dm_timer_set_load_start(gptimer_wakeup, 0, 0xffffffff - cycles); > + > + pr_info("PM: Resume timer in %u.%03u secs" > + " (%d ticks at %d ticks/sec.)\n", > + seconds, milliseconds, cycles, tick_rate); > +} > + > static int clkdm_dbg_show_counter(struct clockdomain *clkdm, void *user) > { > struct seq_file *s = (struct seq_file *)user; > diff --git a/arch/arm/mach-omap2/pm.h b/arch/arm/mach-omap2/pm.h > index 3de6ece..4fd021f 100644 > --- a/arch/arm/mach-omap2/pm.h > +++ b/arch/arm/mach-omap2/pm.h > @@ -48,9 +48,11 @@ extern struct omap_dm_timer *gptimer_wakeup; > > #ifdef CONFIG_PM_DEBUG > extern void omap2_pm_dump(int mode, int resume, unsigned int us); > +extern void omap2_pm_wakeup_on_timer(u32 seconds, u32 milliseconds); > extern int omap2_pm_debug; > #else > #define omap2_pm_dump(mode, resume, us) do {} while (0); > +#define omap2_pm_wakeup_on_timer(seconds, milliseconds) do {} while (0); > #define omap2_pm_debug 0 > #endif > > diff --git a/arch/arm/mach-omap2/pm34xx.c b/arch/arm/mach-omap2/pm34xx.c > index bb2ba1e..bc24fbd 100644 > --- a/arch/arm/mach-omap2/pm34xx.c > +++ b/arch/arm/mach-omap2/pm34xx.c > @@ -38,7 +38,6 @@ > #include <plat/prcm.h> > #include <plat/gpmc.h> > #include <plat/dma.h> > -#include <plat/dmtimer.h> > > #include <asm/tlbflush.h> > > @@ -550,23 +549,6 @@ out: > #ifdef CONFIG_SUSPEND > static suspend_state_t suspend_state; > > -static void omap2_pm_wakeup_on_timer(u32 seconds, u32 milliseconds) > -{ > - u32 tick_rate, cycles; > - > - if (!seconds && !milliseconds) > - return; > - > - tick_rate = clk_get_rate(omap_dm_timer_get_fclk(gptimer_wakeup)); > - cycles = tick_rate * seconds + tick_rate * milliseconds / 1000; > - omap_dm_timer_stop(gptimer_wakeup); > - omap_dm_timer_set_load_start(gptimer_wakeup, 0, 0xffffffff - cycles); > - > - pr_info("PM: Resume timer in %u.%03u secs" > - " (%d ticks at %d ticks/sec.)\n", > - seconds, milliseconds, cycles, tick_rate); > -} > - > static int omap3_pm_prepare(void) > { > disable_hlt(); ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 0/3 v2] omap: pm: Move the common code to allow re-use 2010-09-14 19:33 [PATCH 0/3 v2] omap: pm: Move the common code to allow re-use Santosh Shilimkar 2010-09-14 19:33 ` [PATCH 1/3 v2] omap: pm-debug: Move common debug code to pm-debug.c Santosh Shilimkar @ 2010-09-14 20:29 ` Kevin Hilman 1 sibling, 0 replies; 6+ messages in thread From: Kevin Hilman @ 2010-09-14 20:29 UTC (permalink / raw) To: Santosh Shilimkar; +Cc: linux-omap, rnayak, b-cousson Santosh Shilimkar <santosh.shilimkar@ti.com> writes: > (v2 is rebased on Kevin's 'pm-next' branch) > > This is small series moves some common pm code out of pm34xx.c so > that omap4 can re-use this and not duplicate it. > > It's boot tested on OMAP3/4 with omap3_defconfig and also simple > test with millisecond debugfs entry and suspend/resume. > > Santosh Shilimkar (3): > omap: pm-debug: Move common debug code to pm-debug.c > omap: pm-debug: Enable wakeup_timer_milliseconds debugfs entry > omap: pm: Move set_pwrdm_state routine to common pm.c Thanks, adding to my pm-next queue for 2.6.37. Kevin ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2010-09-14 20:30 UTC | newest] Thread overview: 6+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2010-09-14 19:33 [PATCH 0/3 v2] omap: pm: Move the common code to allow re-use Santosh Shilimkar 2010-09-14 19:33 ` [PATCH 1/3 v2] omap: pm-debug: Move common debug code to pm-debug.c Santosh Shilimkar 2010-09-14 19:34 ` [PATCH 2/3 v2] omap: pm-debug: Enable wakeup_timer_milliseconds debugfs entry Santosh Shilimkar 2010-09-14 19:34 ` [PATCH 3/3 v2] omap: pm: Move set_pwrdm_state routine to common pm.c Santosh Shilimkar 2010-09-14 20:30 ` [PATCH 1/3 v2] omap: pm-debug: Move common debug code to pm-debug.c Kevin Hilman 2010-09-14 20:29 ` [PATCH 0/3 v2] omap: pm: Move the common code to allow re-use Kevin Hilman
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.