* [PATCH 0/3] omap: pm: Move the common code to allow re-use
@ 2010-09-14 13:55 Santosh Shilimkar
2010-09-14 13:55 ` [PATCH 1/3] omap: pm-debug: Move common debug code to pm-debug.c Santosh Shilimkar
2010-09-14 17:53 ` [PATCH 0/3] 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 13:55 UTC (permalink / raw)
To: linux-omap; +Cc: khilman, rnayak, b-cousson, Santosh Shilimkar
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.
The following changes since commit 49553c2ef88749dd502687f4eb9c258bb10a4f44:
Linus Torvalds (1):
Linux 2.6.36-rc4
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 | 26 ++++++++++++++
arch/arm/mach-omap2/pm.c | 50 ++++++++++++++++++++++++++
arch/arm/mach-omap2/pm.h | 8 +++--
arch/arm/mach-omap2/pm34xx.c | 76 ++-------------------------------------
4 files changed, 85 insertions(+), 75 deletions(-)
^ permalink raw reply [flat|nested] 6+ messages in thread* [PATCH 1/3] omap: pm-debug: Move common debug code to pm-debug.c 2010-09-14 13:55 [PATCH 0/3] omap: pm: Move the common code to allow re-use Santosh Shilimkar @ 2010-09-14 13:55 ` Santosh Shilimkar 2010-09-14 13:55 ` [PATCH 2/3] omap: pm-debug: Enable wakeup_timer_milliseconds debugfs entry Santosh Shilimkar 2010-09-14 17:53 ` [PATCH 0/3] omap: pm: Move the common code to allow re-use Kevin Hilman 1 sibling, 1 reply; 6+ messages in thread From: Santosh Shilimkar @ 2010-09-14 13:55 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 | 23 +++++++++++++++++++++++ arch/arm/mach-omap2/pm.h | 6 ++++-- arch/arm/mach-omap2/pm34xx.c | 23 ----------------------- 3 files changed, 27 insertions(+), 25 deletions(-) diff --git a/arch/arm/mach-omap2/pm-debug.c b/arch/arm/mach-omap2/pm-debug.c index 723b44e..143266d 100644 --- a/arch/arm/mach-omap2/pm-debug.c +++ b/arch/arm/mach-omap2/pm-debug.c @@ -31,12 +31,18 @@ #include <plat/board.h> #include <plat/powerdomain.h> #include <plat/clockdomain.h> +#include <plat/dmtimer.h> #include "prm.h" #include "cm.h" #include "pm.h" int omap2_pm_debug; +u32 enable_off_mode; +u32 sleep_while_idle; +u32 wakeup_timer_seconds; +u32 wakeup_timer_milliseconds; + #define DUMP_PRM_MOD_REG(mod, reg) \ regs[reg_count].name = #mod "." #reg; \ @@ -349,6 +355,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..c74d35c 100644 --- a/arch/arm/mach-omap2/pm.h +++ b/arch/arm/mach-omap2/pm.h @@ -15,6 +15,8 @@ extern u32 enable_off_mode; extern u32 sleep_while_idle; +extern u32 wakeup_timer_seconds; +extern u32 wakeup_timer_milliseconds; extern void *omap3_secure_ram_storage; extern void omap3_pm_off_mode_enable(int); @@ -42,15 +44,15 @@ inline void omap3_pm_init_cpuidle(struct cpuidle_params *cpuidle_board_params) extern int omap3_pm_get_suspend_state(struct powerdomain *pwrdm); extern int omap3_pm_set_suspend_state(struct powerdomain *pwrdm, int state); -extern u32 wakeup_timer_seconds; -extern u32 wakeup_timer_milliseconds; 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 7b03426..4fd48e0 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> @@ -55,11 +54,6 @@ #define OMAP343X_TABLE_VALUE_OFFSET 0x30 #define OMAP343X_CONTROL_REG_VALUE_OFFSET 0x32 -u32 enable_off_mode; -u32 sleep_while_idle; -u32 wakeup_timer_seconds; -u32 wakeup_timer_milliseconds; - struct power_state { struct powerdomain *pwrdm; u32 next_state; @@ -567,23 +561,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] omap: pm-debug: Enable wakeup_timer_milliseconds debugfs entry 2010-09-14 13:55 ` [PATCH 1/3] omap: pm-debug: Move common debug code to pm-debug.c Santosh Shilimkar @ 2010-09-14 13:55 ` Santosh Shilimkar 2010-09-14 13:55 ` [PATCH 3/3] omap: pm: Move set_pwrdm_state routine to common pm.c Santosh Shilimkar 0 siblings, 1 reply; 6+ messages in thread From: Santosh Shilimkar @ 2010-09-14 13:55 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 143266d..395763c 100644 --- a/arch/arm/mach-omap2/pm-debug.c +++ b/arch/arm/mach-omap2/pm-debug.c @@ -632,6 +632,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] omap: pm: Move set_pwrdm_state routine to common pm.c 2010-09-14 13:55 ` [PATCH 2/3] omap: pm-debug: Enable wakeup_timer_milliseconds debugfs entry Santosh Shilimkar @ 2010-09-14 13:55 ` Santosh Shilimkar 0 siblings, 0 replies; 6+ messages in thread From: Santosh Shilimkar @ 2010-09-14 13:55 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 c74d35c..6e3c7bf 100644 --- a/arch/arm/mach-omap2/pm.h +++ b/arch/arm/mach-omap2/pm.h @@ -22,7 +22,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 4fd48e0..c33b8b9 100644 --- a/arch/arm/mach-omap2/pm34xx.c +++ b/arch/arm/mach-omap2/pm34xx.c @@ -495,51 +495,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(); @@ -581,7 +536,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; @@ -602,7 +557,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"); @@ -951,7 +906,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); } } @@ -996,7 +951,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 0/3] omap: pm: Move the common code to allow re-use 2010-09-14 13:55 [PATCH 0/3] omap: pm: Move the common code to allow re-use Santosh Shilimkar 2010-09-14 13:55 ` [PATCH 1/3] omap: pm-debug: Move common debug code to pm-debug.c Santosh Shilimkar @ 2010-09-14 17:53 ` Kevin Hilman 2010-09-14 17:57 ` Shilimkar, Santosh 1 sibling, 1 reply; 6+ messages in thread From: Kevin Hilman @ 2010-09-14 17:53 UTC (permalink / raw) To: Santosh Shilimkar; +Cc: linux-omap, rnayak, b-cousson, Thara Gopinath Santosh Shilimkar <santosh.shilimkar@ti.com> writes: > 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. > Hi Santosh, This series looks good. Can you rebase it on my pm-next branch please? There's already a patch from Thara queued up in my pm-next queue that does most (all?) of what your patch 1 does. Thanks, Kevin > The following changes since commit 49553c2ef88749dd502687f4eb9c258bb10a4f44: > Linus Torvalds (1): > Linux 2.6.36-rc4 > > 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 | 26 ++++++++++++++ > arch/arm/mach-omap2/pm.c | 50 ++++++++++++++++++++++++++ > arch/arm/mach-omap2/pm.h | 8 +++-- > arch/arm/mach-omap2/pm34xx.c | 76 ++------------------------------------- > 4 files changed, 85 insertions(+), 75 deletions(-) ^ permalink raw reply [flat|nested] 6+ messages in thread
* RE: [PATCH 0/3] omap: pm: Move the common code to allow re-use 2010-09-14 17:53 ` [PATCH 0/3] omap: pm: Move the common code to allow re-use Kevin Hilman @ 2010-09-14 17:57 ` Shilimkar, Santosh 0 siblings, 0 replies; 6+ messages in thread From: Shilimkar, Santosh @ 2010-09-14 17:57 UTC (permalink / raw) To: Kevin Hilman Cc: linux-omap@vger.kernel.org, Nayak, Rajendra, Cousson, Benoit, Gopinath, Thara > -----Original Message----- > From: Kevin Hilman [mailto:khilman@deeprootsystems.com] > Sent: Tuesday, September 14, 2010 11:24 PM > To: Shilimkar, Santosh > Cc: linux-omap@vger.kernel.org; Nayak, Rajendra; Cousson, Benoit; Gopinath, > Thara > Subject: Re: [PATCH 0/3] omap: pm: Move the common code to allow re-use > > Santosh Shilimkar <santosh.shilimkar@ti.com> writes: > > > 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. > > > > Hi Santosh, > > This series looks good. > > Can you rebase it on my pm-next branch please? There's already a patch > from Thara queued up in my pm-next queue that does most (all?) of what > your patch 1 does. > I shall rebase on your "pm-next" branch and send you updated series Regards, Santosh ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2010-09-14 17:57 UTC | newest] Thread overview: 6+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2010-09-14 13:55 [PATCH 0/3] omap: pm: Move the common code to allow re-use Santosh Shilimkar 2010-09-14 13:55 ` [PATCH 1/3] omap: pm-debug: Move common debug code to pm-debug.c Santosh Shilimkar 2010-09-14 13:55 ` [PATCH 2/3] omap: pm-debug: Enable wakeup_timer_milliseconds debugfs entry Santosh Shilimkar 2010-09-14 13:55 ` [PATCH 3/3] omap: pm: Move set_pwrdm_state routine to common pm.c Santosh Shilimkar 2010-09-14 17:53 ` [PATCH 0/3] omap: pm: Move the common code to allow re-use Kevin Hilman 2010-09-14 17:57 ` Shilimkar, Santosh
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.