Message ID | 1305739950-11695-9-git-send-email-j-pihet@ti.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Jean, On 5/18/2011 11:02 PM, jean.pihet@newoldbits.com wrote: > From: Jean Pihet<j-pihet@ti.com> > > Provide omap_pm_tick_nohz_get_sleep_length_us so that the code > from the OMAP PM modules can use it. > > Signed-off-by: Jean Pihet<j-pihet@ti.com> > --- > arch/arm/mach-omap2/pm-debug.c | 7 ++++--- > arch/arm/mach-omap2/pm.c | 15 +++++++++++++++ > arch/arm/mach-omap2/pm.h | 12 ++++++++---- > 3 files changed, 27 insertions(+), 7 deletions(-) > > diff --git a/arch/arm/mach-omap2/pm-debug.c b/arch/arm/mach-omap2/pm-debug.c > index 0b896d4..24e5c31 100644 > --- a/arch/arm/mach-omap2/pm-debug.c > +++ b/arch/arm/mach-omap2/pm-debug.c > @@ -141,9 +141,10 @@ void omap2_pm_dump(int mode, int resume, unsigned int us) > if (!resume) > #ifdef CONFIG_NO_HZ > printk(KERN_INFO > - "--- Going to %s %s (next timer after %u ms)\n", s1, s2, > - jiffies_to_msecs(get_next_timer_interrupt(jiffies) - > - jiffies)); > + "--- Going to %s %s (next timer after %lu ms)\n", s1, s2, > + DIV_ROUND_UP(omap_pm_tick_nohz_get_sleep_length_us(), > + 1000) > + ); > #else > printk(KERN_INFO "--- Going to %s %s\n", s1, s2); > #endif > diff --git a/arch/arm/mach-omap2/pm.c b/arch/arm/mach-omap2/pm.c > index 37a4801..0c451e3 100644 > --- a/arch/arm/mach-omap2/pm.c > +++ b/arch/arm/mach-omap2/pm.c > @@ -14,6 +14,8 @@ > #include<linux/io.h> > #include<linux/err.h> > #include<linux/opp.h> > +#include<linux/hrtimer.h> > +#include<linux/tick.h> > > #include<plat/omap-pm.h> > #include<plat/omap_device.h> > @@ -30,6 +32,7 @@ static struct omap_device_pm_latency *pm_lats; > struct cpuidle_params *cpuidle_params_override_table; > #endif > > +#ifdef CONFIG_PM_DEBUG > u32 enable_off_mode; > EXPORT_SYMBOL(enable_off_mode); > > @@ -37,6 +40,7 @@ int omap2_pm_debug; > u32 sleep_while_idle; > u32 wakeup_timer_seconds; > u32 wakeup_timer_milliseconds; > +#endif > > static struct device *mpu_dev; > static struct device *iva_dev; > @@ -292,6 +296,7 @@ void omap3_pm_init_cpuidle(struct cpuidle_params *cpuidle_board_params) > } > #endif > > +#ifdef CONFIG_PM_DEBUG > void omap2_pm_wakeup_on_timer(u32 seconds, u32 milliseconds) > { > u32 tick_rate, cycles; > @@ -308,4 +313,14 @@ void omap2_pm_wakeup_on_timer(u32 seconds, u32 milliseconds) > " (%d ticks at %d ticks/sec.)\n", > seconds, milliseconds, cycles, tick_rate); > } > +EXPORT_SYMBOL(omap2_pm_wakeup_on_timer); > +#endif > + > +#ifdef CONFIG_NO_HZ > +unsigned long omap_pm_tick_nohz_get_sleep_length_us(void) > +{ > + return ktime_to_us(tick_nohz_get_sleep_length()); > +} > +EXPORT_SYMBOL(omap_pm_tick_nohz_get_sleep_length_us); This wrapper seems to be un-necesssary. You can directly use "ktime_to_us(tick_nohz_get_sleep_length())" instead. Regards Santosh -- To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Hi Santosh, On Thu, May 19, 2011 at 9:59 AM, Santosh Shilimkar <santosh.shilimkar@ti.com> wrote: > Jean, > > On 5/18/2011 11:02 PM, jean.pihet@newoldbits.com wrote: >> >> From: Jean Pihet<j-pihet@ti.com> >> >> Provide omap_pm_tick_nohz_get_sleep_length_us so that the code >> from the OMAP PM modules can use it. >> >> Signed-off-by: Jean Pihet<j-pihet@ti.com> >> --- >> arch/arm/mach-omap2/pm-debug.c | 7 ++++--- >> arch/arm/mach-omap2/pm.c | 15 +++++++++++++++ >> arch/arm/mach-omap2/pm.h | 12 ++++++++---- >> 3 files changed, 27 insertions(+), 7 deletions(-) >> >> diff --git a/arch/arm/mach-omap2/pm-debug.c >> b/arch/arm/mach-omap2/pm-debug.c >> index 0b896d4..24e5c31 100644 >> --- a/arch/arm/mach-omap2/pm-debug.c >> +++ b/arch/arm/mach-omap2/pm-debug.c >> @@ -141,9 +141,10 @@ void omap2_pm_dump(int mode, int resume, unsigned int >> us) >> if (!resume) >> #ifdef CONFIG_NO_HZ >> printk(KERN_INFO >> - "--- Going to %s %s (next timer after %u ms)\n", >> s1, s2, >> - jiffies_to_msecs(get_next_timer_interrupt(jiffies) >> - >> - jiffies)); >> + "--- Going to %s %s (next timer after %lu ms)\n", >> s1, s2, >> + >> DIV_ROUND_UP(omap_pm_tick_nohz_get_sleep_length_us(), >> + 1000) >> + ); >> #else >> printk(KERN_INFO "--- Going to %s %s\n", s1, s2); >> #endif >> diff --git a/arch/arm/mach-omap2/pm.c b/arch/arm/mach-omap2/pm.c >> index 37a4801..0c451e3 100644 >> --- a/arch/arm/mach-omap2/pm.c >> +++ b/arch/arm/mach-omap2/pm.c >> @@ -14,6 +14,8 @@ >> #include<linux/io.h> >> #include<linux/err.h> >> #include<linux/opp.h> >> +#include<linux/hrtimer.h> >> +#include<linux/tick.h> >> >> #include<plat/omap-pm.h> >> #include<plat/omap_device.h> >> @@ -30,6 +32,7 @@ static struct omap_device_pm_latency *pm_lats; >> struct cpuidle_params *cpuidle_params_override_table; >> #endif >> >> +#ifdef CONFIG_PM_DEBUG >> u32 enable_off_mode; >> EXPORT_SYMBOL(enable_off_mode); >> >> @@ -37,6 +40,7 @@ int omap2_pm_debug; >> u32 sleep_while_idle; >> u32 wakeup_timer_seconds; >> u32 wakeup_timer_milliseconds; >> +#endif >> >> static struct device *mpu_dev; >> static struct device *iva_dev; >> @@ -292,6 +296,7 @@ void omap3_pm_init_cpuidle(struct cpuidle_params >> *cpuidle_board_params) >> } >> #endif >> >> +#ifdef CONFIG_PM_DEBUG >> void omap2_pm_wakeup_on_timer(u32 seconds, u32 milliseconds) >> { >> u32 tick_rate, cycles; >> @@ -308,4 +313,14 @@ void omap2_pm_wakeup_on_timer(u32 seconds, u32 >> milliseconds) >> " (%d ticks at %d ticks/sec.)\n", >> seconds, milliseconds, cycles, tick_rate); >> } >> +EXPORT_SYMBOL(omap2_pm_wakeup_on_timer); >> +#endif >> + >> +#ifdef CONFIG_NO_HZ >> +unsigned long omap_pm_tick_nohz_get_sleep_length_us(void) >> +{ >> + return ktime_to_us(tick_nohz_get_sleep_length()); >> +} >> +EXPORT_SYMBOL(omap_pm_tick_nohz_get_sleep_length_us); > > This wrapper seems to be un-necesssary. You can directly use > "ktime_to_us(tick_nohz_get_sleep_length())" instead. No because tick_nohz_get_sleep_length is not exported to modules. > > Regards > Santosh > Regards, Jean -- To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
jean.pihet@newoldbits.com writes: > From: Jean Pihet <j-pihet@ti.com> > > Provide omap_pm_tick_nohz_get_sleep_length_us so that the code > from the OMAP PM modules can use it. > > Signed-off-by: Jean Pihet <j-pihet@ti.com> This patch is doing more than mentioned in the changelog. > --- > arch/arm/mach-omap2/pm-debug.c | 7 ++++--- > arch/arm/mach-omap2/pm.c | 15 +++++++++++++++ > arch/arm/mach-omap2/pm.h | 12 ++++++++---- > 3 files changed, 27 insertions(+), 7 deletions(-) > > diff --git a/arch/arm/mach-omap2/pm-debug.c b/arch/arm/mach-omap2/pm-debug.c > index 0b896d4..24e5c31 100644 > --- a/arch/arm/mach-omap2/pm-debug.c > +++ b/arch/arm/mach-omap2/pm-debug.c > @@ -141,9 +141,10 @@ void omap2_pm_dump(int mode, int resume, unsigned int us) > if (!resume) > #ifdef CONFIG_NO_HZ > printk(KERN_INFO > - "--- Going to %s %s (next timer after %u ms)\n", s1, s2, > - jiffies_to_msecs(get_next_timer_interrupt(jiffies) - > - jiffies)); > + "--- Going to %s %s (next timer after %lu ms)\n", s1, s2, > + DIV_ROUND_UP(omap_pm_tick_nohz_get_sleep_length_us(), > + 1000) > + ); > #else > printk(KERN_INFO "--- Going to %s %s\n", s1, s2); > #endif > diff --git a/arch/arm/mach-omap2/pm.c b/arch/arm/mach-omap2/pm.c > index 37a4801..0c451e3 100644 > --- a/arch/arm/mach-omap2/pm.c > +++ b/arch/arm/mach-omap2/pm.c > @@ -14,6 +14,8 @@ > #include <linux/io.h> > #include <linux/err.h> > #include <linux/opp.h> > +#include <linux/hrtimer.h> > +#include <linux/tick.h> > > #include <plat/omap-pm.h> > #include <plat/omap_device.h> > @@ -30,6 +32,7 @@ static struct omap_device_pm_latency *pm_lats; > struct cpuidle_params *cpuidle_params_override_table; > #endif > > +#ifdef CONFIG_PM_DEBUG > u32 enable_off_mode; > EXPORT_SYMBOL(enable_off_mode); > > @@ -37,6 +40,7 @@ int omap2_pm_debug; > u32 sleep_while_idle; > u32 wakeup_timer_seconds; > u32 wakeup_timer_milliseconds; > +#endif > > static struct device *mpu_dev; > static struct device *iva_dev; > @@ -292,6 +296,7 @@ void omap3_pm_init_cpuidle(struct cpuidle_params *cpuidle_board_params) > } > #endif > > +#ifdef CONFIG_PM_DEBUG > void omap2_pm_wakeup_on_timer(u32 seconds, u32 milliseconds) > { > u32 tick_rate, cycles; > @@ -308,4 +313,14 @@ void omap2_pm_wakeup_on_timer(u32 seconds, u32 milliseconds) > " (%d ticks at %d ticks/sec.)\n", > seconds, milliseconds, cycles, tick_rate); > } > +EXPORT_SYMBOL(omap2_pm_wakeup_on_timer); This doesn't seem related to $SUBJECT > +#endif > + > +#ifdef CONFIG_NO_HZ > +unsigned long omap_pm_tick_nohz_get_sleep_length_us(void) > +{ > + return ktime_to_us(tick_nohz_get_sleep_length()); > +} > +EXPORT_SYMBOL(omap_pm_tick_nohz_get_sleep_length_us); > +#endif Usage of this is OMAP2-specific and needed for this very old, debug-only interface. I was inspired by some of what you did in this series, and will attempt to make your life easier by just removing this code all together. I just posted a series for that. > > diff --git a/arch/arm/mach-omap2/pm.h b/arch/arm/mach-omap2/pm.h > index 03da7f8..70eb80e 100644 > --- a/arch/arm/mach-omap2/pm.h > +++ b/arch/arm/mach-omap2/pm.h > @@ -68,11 +68,15 @@ extern int omap2_pm_debug; > extern u32 enable_off_mode; > extern u32 sleep_while_idle; > #else > -#define omap2_pm_dump(mode, resume, us) do {} while (0); > +#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 > -#define enable_off_mode 0 > -#define sleep_while_idle 0 > +#define omap2_pm_debug 0 > +#define enable_off_mode 0 > +#define sleep_while_idle 0 > +#endif Unrelated whitespace changes. > +#ifdef CONFIG_NO_HZ > +extern unsigned long omap_pm_tick_nohz_get_sleep_length_us(void); > #endif > > #if defined(CONFIG_PM_DEBUG) && defined(CONFIG_DEBUG_FS) Kevin -- To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On Fri, May 27, 2011 at 1:00 AM, Kevin Hilman <khilman@ti.com> wrote: > jean.pihet@newoldbits.com writes: > >> From: Jean Pihet <j-pihet@ti.com> >> >> Provide omap_pm_tick_nohz_get_sleep_length_us so that the code >> from the OMAP PM modules can use it. >> >> Signed-off-by: Jean Pihet <j-pihet@ti.com> > > This patch is doing more than mentioned in the changelog. Agree, there is a bit of clean-up/rework as well. Will re-organize. ... > >> +#endif >> + >> +#ifdef CONFIG_NO_HZ >> +unsigned long omap_pm_tick_nohz_get_sleep_length_us(void) >> +{ >> + return ktime_to_us(tick_nohz_get_sleep_length()); >> +} >> +EXPORT_SYMBOL(omap_pm_tick_nohz_get_sleep_length_us); >> +#endif > > Usage of this is OMAP2-specific and needed for this very old, debug-only > interface. > I was inspired by some of what you did in this series, and > will attempt to make your life easier by just removing this code all > together. I just posted a series for that. Only OMAP2 uses it currently but I think it is useful to have the time to next tick available for debug purpose. BTW this change implements it in a more generic way: tick_nohz_get_sleep_length is generic and also used by e.g. cpuidle to determine the next state to enter. Jean -- To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/arch/arm/mach-omap2/pm-debug.c b/arch/arm/mach-omap2/pm-debug.c index 0b896d4..24e5c31 100644 --- a/arch/arm/mach-omap2/pm-debug.c +++ b/arch/arm/mach-omap2/pm-debug.c @@ -141,9 +141,10 @@ void omap2_pm_dump(int mode, int resume, unsigned int us) if (!resume) #ifdef CONFIG_NO_HZ printk(KERN_INFO - "--- Going to %s %s (next timer after %u ms)\n", s1, s2, - jiffies_to_msecs(get_next_timer_interrupt(jiffies) - - jiffies)); + "--- Going to %s %s (next timer after %lu ms)\n", s1, s2, + DIV_ROUND_UP(omap_pm_tick_nohz_get_sleep_length_us(), + 1000) + ); #else printk(KERN_INFO "--- Going to %s %s\n", s1, s2); #endif diff --git a/arch/arm/mach-omap2/pm.c b/arch/arm/mach-omap2/pm.c index 37a4801..0c451e3 100644 --- a/arch/arm/mach-omap2/pm.c +++ b/arch/arm/mach-omap2/pm.c @@ -14,6 +14,8 @@ #include <linux/io.h> #include <linux/err.h> #include <linux/opp.h> +#include <linux/hrtimer.h> +#include <linux/tick.h> #include <plat/omap-pm.h> #include <plat/omap_device.h> @@ -30,6 +32,7 @@ static struct omap_device_pm_latency *pm_lats; struct cpuidle_params *cpuidle_params_override_table; #endif +#ifdef CONFIG_PM_DEBUG u32 enable_off_mode; EXPORT_SYMBOL(enable_off_mode); @@ -37,6 +40,7 @@ int omap2_pm_debug; u32 sleep_while_idle; u32 wakeup_timer_seconds; u32 wakeup_timer_milliseconds; +#endif static struct device *mpu_dev; static struct device *iva_dev; @@ -292,6 +296,7 @@ void omap3_pm_init_cpuidle(struct cpuidle_params *cpuidle_board_params) } #endif +#ifdef CONFIG_PM_DEBUG void omap2_pm_wakeup_on_timer(u32 seconds, u32 milliseconds) { u32 tick_rate, cycles; @@ -308,4 +313,14 @@ void omap2_pm_wakeup_on_timer(u32 seconds, u32 milliseconds) " (%d ticks at %d ticks/sec.)\n", seconds, milliseconds, cycles, tick_rate); } +EXPORT_SYMBOL(omap2_pm_wakeup_on_timer); +#endif + +#ifdef CONFIG_NO_HZ +unsigned long omap_pm_tick_nohz_get_sleep_length_us(void) +{ + return ktime_to_us(tick_nohz_get_sleep_length()); +} +EXPORT_SYMBOL(omap_pm_tick_nohz_get_sleep_length_us); +#endif diff --git a/arch/arm/mach-omap2/pm.h b/arch/arm/mach-omap2/pm.h index 03da7f8..70eb80e 100644 --- a/arch/arm/mach-omap2/pm.h +++ b/arch/arm/mach-omap2/pm.h @@ -68,11 +68,15 @@ extern int omap2_pm_debug; extern u32 enable_off_mode; extern u32 sleep_while_idle; #else -#define omap2_pm_dump(mode, resume, us) do {} while (0); +#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 -#define enable_off_mode 0 -#define sleep_while_idle 0 +#define omap2_pm_debug 0 +#define enable_off_mode 0 +#define sleep_while_idle 0 +#endif + +#ifdef CONFIG_NO_HZ +extern unsigned long omap_pm_tick_nohz_get_sleep_length_us(void); #endif #if defined(CONFIG_PM_DEBUG) && defined(CONFIG_DEBUG_FS)