* [PATCH v2 1/2] OMAP3: PM: Configure PRM setup times from board files @ 2009-10-15 14:48 Rajendra Nayak 2009-10-15 14:48 ` [PATCH v2 2/2] OMAP3: PM: Configure CPUidle latencies/thresholds from board file Rajendra Nayak 2009-10-20 15:46 ` [PATCH v2 1/2] OMAP3: PM: Configure PRM setup times from board files Kevin Hilman 0 siblings, 2 replies; 4+ messages in thread From: Rajendra Nayak @ 2009-10-15 14:48 UTC (permalink / raw) To: linux-omap; +Cc: khilman, Rajendra Nayak The setup times to be programmed in the PRM module on OMAP (for clksetup, voltsetup etc) are board specific. They depend heavily on the PMIC used and even on different boards with the same PMIC, they vary based on the sleep/wake sequence used, system clock speed et al. This patch makes it possible for these setup values to be configured from different board files. omap3_pm_init_vc() can now be optionally called from board files to initialise the setup times. If board files do not use this function to pass the setup times, default/conservative values are used which are safe but would cause higher wakeup latencies from sleep states. This patch only updates the 3430sdp board file to use omap3_pm_init_vc() to update the setup times. Signed-off-by: Rajendra Nayak <rnayak@ti.com> --- arch/arm/mach-omap2/board-3430sdp.c | 18 ++++++++++++++++++ arch/arm/mach-omap2/pm.h | 2 +- arch/arm/mach-omap2/pm34xx.c | 5 ++++- 3 files changed, 23 insertions(+), 2 deletions(-) diff --git a/arch/arm/mach-omap2/board-3430sdp.c b/arch/arm/mach-omap2/board-3430sdp.c index 14868b5..0f1975c 100644 --- a/arch/arm/mach-omap2/board-3430sdp.c +++ b/arch/arm/mach-omap2/board-3430sdp.c @@ -56,6 +56,23 @@ #define TWL4030_MSECURE_GPIO 22 +/* FIXME: These are not the optimal setup values to be used on 3430sdp*/ +static struct prm_setup_vc omap3_setuptime_table = { + .clksetup = 0xff, + .voltsetup_time1 = 0xfff, + .voltsetup_time2 = 0xfff, + .voltoffset = 0xff, + .voltsetup2 = 0xff, + .vdd0_on = 0x30, + .vdd0_onlp = 0x20, + .vdd0_ret = 0x1e, + .vdd0_off = 0x00, + .vdd1_on = 0x2c, + .vdd1_onlp = 0x20, + .vdd1_ret = 0x1e, + .vdd1_off = 0x00, +}; + static int board_keymap[] = { KEY(0, 0, KEY_LEFT), KEY(0, 1, KEY_RIGHT), @@ -185,6 +202,7 @@ static void __init omap_3430sdp_init_irq(void) { omap_board_config = sdp3430_config; omap_board_config_size = ARRAY_SIZE(sdp3430_config); + omap3_pm_init_vc(&omap3_setuptime_table); omap2_init_common_hw(hyb18m512160af6_sdrc_params, NULL, omap3_mpu_rate_table, omap3_dsp_rate_table, omap3_l3_rate_table); omap_init_irq(); diff --git a/arch/arm/mach-omap2/pm.h b/arch/arm/mach-omap2/pm.h index f8d11a2..ca673c5 100644 --- a/arch/arm/mach-omap2/pm.h +++ b/arch/arm/mach-omap2/pm.h @@ -41,7 +41,7 @@ struct prm_setup_vc { u16 vdd1_ret; u16 vdd1_off; }; -extern void omap3_set_prm_setup_vc(struct prm_setup_vc *setup_vc); +extern void omap3_pm_init_vc(struct prm_setup_vc *setup_vc); extern int resource_set_opp_level(int res, u32 target_level, int flags); extern int resource_access_opp_lock(int res, int delta); diff --git a/arch/arm/mach-omap2/pm34xx.c b/arch/arm/mach-omap2/pm34xx.c index 01260ec..3d7ae2f 100644 --- a/arch/arm/mach-omap2/pm34xx.c +++ b/arch/arm/mach-omap2/pm34xx.c @@ -1027,8 +1027,11 @@ int omap3_pm_set_suspend_state(struct powerdomain *pwrdm, int state) return -EINVAL; } -void omap3_set_prm_setup_vc(struct prm_setup_vc *setup_vc) +void omap3_pm_init_vc(struct prm_setup_vc *setup_vc) { + if (!setup_vc) + return; + prm_setup.clksetup = setup_vc->clksetup; prm_setup.voltsetup_time1 = setup_vc->voltsetup_time1; prm_setup.voltsetup_time2 = setup_vc->voltsetup_time2; -- 1.5.4.7 ^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH v2 2/2] OMAP3: PM: Configure CPUidle latencies/thresholds from board file 2009-10-15 14:48 [PATCH v2 1/2] OMAP3: PM: Configure PRM setup times from board files Rajendra Nayak @ 2009-10-15 14:48 ` Rajendra Nayak 2009-10-16 6:23 ` Nayak, Rajendra 2009-10-20 15:46 ` [PATCH v2 1/2] OMAP3: PM: Configure PRM setup times from board files Kevin Hilman 1 sibling, 1 reply; 4+ messages in thread From: Rajendra Nayak @ 2009-10-15 14:48 UTC (permalink / raw) To: linux-omap; +Cc: khilman, Rajendra Nayak The CPUidle C state latencies and thresholds are dependent on various board specific details. This patch makes it possible to configure these values from the respective board files. omap3_pm_init_cpuidle() can now be optionally called from board files to pass board specific cpuidle parameters. If the board files do not use this function to pass the params default values are used which might cause higher consumption dur to wrong state selection by the governor. This patch only updates the 3430sdp board files to use omap3_pm_init_cpuidle(). Signed-off-by: Rajendra Nayak <rnayak@ti.com> --- arch/arm/mach-omap2/board-3430sdp.c | 19 +++++++++++++++ arch/arm/mach-omap2/cpuidle34xx.c | 42 +++++++++++++++++++++++++++++++++++ arch/arm/mach-omap2/pm.h | 8 ++++++ 3 files changed, 69 insertions(+), 0 deletions(-) diff --git a/arch/arm/mach-omap2/board-3430sdp.c b/arch/arm/mach-omap2/board-3430sdp.c index 0f1975c..d2b2f8f 100644 --- a/arch/arm/mach-omap2/board-3430sdp.c +++ b/arch/arm/mach-omap2/board-3430sdp.c @@ -73,6 +73,24 @@ static struct prm_setup_vc omap3_setuptime_table = { .vdd1_off = 0x00, }; +/* FIXME: These values need to be updated based on more profiling on 3430sdp*/ +static struct cpuidle_params omap3_cpuidle_params_table[] = { + /* C1 */ + {2, 2, 5}, + /* C2 */ + {10, 10, 30}, + /* C3 */ + {50, 50, 300}, + /* C4 */ + {1500, 1800, 4000}, + /* C5 */ + {2500, 7500, 12000}, + /* C6 */ + {3000, 8500, 15000}, + /* C7 */ + {10000, 30000, 300000}, +}; + static int board_keymap[] = { KEY(0, 0, KEY_LEFT), KEY(0, 1, KEY_RIGHT), @@ -203,6 +221,7 @@ static void __init omap_3430sdp_init_irq(void) omap_board_config = sdp3430_config; omap_board_config_size = ARRAY_SIZE(sdp3430_config); omap3_pm_init_vc(&omap3_setuptime_table); + omap3_pm_init_cpuidle(omap3_cpuidle_params_table); omap2_init_common_hw(hyb18m512160af6_sdrc_params, NULL, omap3_mpu_rate_table, omap3_dsp_rate_table, omap3_l3_rate_table); omap_init_irq(); diff --git a/arch/arm/mach-omap2/cpuidle34xx.c b/arch/arm/mach-omap2/cpuidle34xx.c index c44a942..f5d8f55 100644 --- a/arch/arm/mach-omap2/cpuidle34xx.c +++ b/arch/arm/mach-omap2/cpuidle34xx.c @@ -60,6 +60,30 @@ struct omap3_processor_cx omap3_power_states[OMAP3_MAX_STATES]; struct omap3_processor_cx current_cx_state; struct powerdomain *mpu_pd, *core_pd, *per_pd; +/* + * The latencies/thresholds for various C states have + * to be configured from the respective board files. + * These are some default values (which might not provide + * the best power savings) used on boards which do not + * pass these details from the board file. + */ +static struct cpuidle_params cpuidle_params_table[] = { + /* C1 */ + {2, 2, 5}, + /* C2 */ + {10, 10, 30}, + /* C3 */ + {50, 50, 300}, + /* C4 */ + {1500, 1800, 4000}, + /* C5 */ + {2500, 7500, 12000}, + /* C6 */ + {3000, 8500, 15000}, + /* C7 */ + {10000, 30000, 300000}, +}; + static int omap3_idle_bm_check(void) { if (!omap3_can_sleep()) @@ -165,6 +189,24 @@ static int omap3_enter_idle_bm(struct cpuidle_device *dev, DEFINE_PER_CPU(struct cpuidle_device, omap3_idle_dev); +void omap3_pm_init_cpuidle(struct cpuidle_params *cpuidle_board_params) +{ + int i; + + if (!cpuidle_board_params) + return; + + for (i = OMAP3_STATE_C1; i < OMAP3_MAX_STATES; i++) { + cpuidle_params_table[i].sleep_latency = + cpuidle_board_params[i].sleep_latency; + cpuidle_params_table[i].wake_latency = + cpuidle_board_params[i].wake_latency; + cpuidle_params_table[i].threshold = + cpuidle_board_params[i].threshold; + } + return; +} + /* omap3_init_power_states - Initialises the OMAP3 specific C states. * * Below is the desciption of each C state. diff --git a/arch/arm/mach-omap2/pm.h b/arch/arm/mach-omap2/pm.h index ca673c5..0b814ab 100644 --- a/arch/arm/mach-omap2/pm.h +++ b/arch/arm/mach-omap2/pm.h @@ -41,7 +41,15 @@ struct prm_setup_vc { u16 vdd1_ret; u16 vdd1_off; }; + +struct cpuidle_params { + u32 sleep_latency; + u32 wake_latency; + u32 threshold; +}; + extern void omap3_pm_init_vc(struct prm_setup_vc *setup_vc); +extern void omap3_pm_init_cpuidle(struct cpuidle_params *cpuidle_board_params); extern int resource_set_opp_level(int res, u32 target_level, int flags); extern int resource_access_opp_lock(int res, int delta); -- 1.5.4.7 ^ permalink raw reply related [flat|nested] 4+ messages in thread
* RE: [PATCH v2 2/2] OMAP3: PM: Configure CPUidle latencies/thresholds from board file 2009-10-15 14:48 ` [PATCH v2 2/2] OMAP3: PM: Configure CPUidle latencies/thresholds from board file Rajendra Nayak @ 2009-10-16 6:23 ` Nayak, Rajendra 0 siblings, 0 replies; 4+ messages in thread From: Nayak, Rajendra @ 2009-10-16 6:23 UTC (permalink / raw) To: linux-omap@vger.kernel.org; +Cc: khilman@deeprootsystems.com, Gopinath, Thara I missed updating omap_init_power_states() to look into cpuidle_params_table at init, as part of this patch. Will send a fixed patch shortly. Thanks to Thara for catching this. >-----Original Message----- >From: Nayak, Rajendra >Sent: Thursday, October 15, 2009 8:19 PM >To: linux-omap@vger.kernel.org >Cc: khilman@deeprootsystems.com; Nayak, Rajendra >Subject: [PATCH v2 2/2] OMAP3: PM: Configure CPUidle >latencies/thresholds from board file > >The CPUidle C state latencies and thresholds are dependent >on various board specific details. >This patch makes it possible to configure these values from the >respective board files. > >omap3_pm_init_cpuidle() can now be optionally called from board >files to pass board specific cpuidle parameters. >If the board files do not use this function to pass the params >default values are used which might cause higher consumption >dur to wrong state selection by the governor. > >This patch only updates the 3430sdp board files to use >omap3_pm_init_cpuidle(). > >Signed-off-by: Rajendra Nayak <rnayak@ti.com> >--- > arch/arm/mach-omap2/board-3430sdp.c | 19 +++++++++++++++ > arch/arm/mach-omap2/cpuidle34xx.c | 42 >+++++++++++++++++++++++++++++++++++ > arch/arm/mach-omap2/pm.h | 8 ++++++ > 3 files changed, 69 insertions(+), 0 deletions(-) > >diff --git a/arch/arm/mach-omap2/board-3430sdp.c >b/arch/arm/mach-omap2/board-3430sdp.c >index 0f1975c..d2b2f8f 100644 >--- a/arch/arm/mach-omap2/board-3430sdp.c >+++ b/arch/arm/mach-omap2/board-3430sdp.c >@@ -73,6 +73,24 @@ static struct prm_setup_vc omap3_setuptime_table = { > .vdd1_off = 0x00, > }; > >+/* FIXME: These values need to be updated based on more >profiling on 3430sdp*/ >+static struct cpuidle_params omap3_cpuidle_params_table[] = { >+ /* C1 */ >+ {2, 2, 5}, >+ /* C2 */ >+ {10, 10, 30}, >+ /* C3 */ >+ {50, 50, 300}, >+ /* C4 */ >+ {1500, 1800, 4000}, >+ /* C5 */ >+ {2500, 7500, 12000}, >+ /* C6 */ >+ {3000, 8500, 15000}, >+ /* C7 */ >+ {10000, 30000, 300000}, >+}; >+ > static int board_keymap[] = { > KEY(0, 0, KEY_LEFT), > KEY(0, 1, KEY_RIGHT), >@@ -203,6 +221,7 @@ static void __init omap_3430sdp_init_irq(void) > omap_board_config = sdp3430_config; > omap_board_config_size = ARRAY_SIZE(sdp3430_config); > omap3_pm_init_vc(&omap3_setuptime_table); >+ omap3_pm_init_cpuidle(omap3_cpuidle_params_table); > omap2_init_common_hw(hyb18m512160af6_sdrc_params, NULL, >omap3_mpu_rate_table, > omap3_dsp_rate_table, omap3_l3_rate_table); > omap_init_irq(); >diff --git a/arch/arm/mach-omap2/cpuidle34xx.c >b/arch/arm/mach-omap2/cpuidle34xx.c >index c44a942..f5d8f55 100644 >--- a/arch/arm/mach-omap2/cpuidle34xx.c >+++ b/arch/arm/mach-omap2/cpuidle34xx.c >@@ -60,6 +60,30 @@ struct omap3_processor_cx >omap3_power_states[OMAP3_MAX_STATES]; > struct omap3_processor_cx current_cx_state; > struct powerdomain *mpu_pd, *core_pd, *per_pd; > >+/* >+ * The latencies/thresholds for various C states have >+ * to be configured from the respective board files. >+ * These are some default values (which might not provide >+ * the best power savings) used on boards which do not >+ * pass these details from the board file. >+ */ >+static struct cpuidle_params cpuidle_params_table[] = { >+ /* C1 */ >+ {2, 2, 5}, >+ /* C2 */ >+ {10, 10, 30}, >+ /* C3 */ >+ {50, 50, 300}, >+ /* C4 */ >+ {1500, 1800, 4000}, >+ /* C5 */ >+ {2500, 7500, 12000}, >+ /* C6 */ >+ {3000, 8500, 15000}, >+ /* C7 */ >+ {10000, 30000, 300000}, >+}; >+ > static int omap3_idle_bm_check(void) > { > if (!omap3_can_sleep()) >@@ -165,6 +189,24 @@ static int omap3_enter_idle_bm(struct >cpuidle_device *dev, > > DEFINE_PER_CPU(struct cpuidle_device, omap3_idle_dev); > >+void omap3_pm_init_cpuidle(struct cpuidle_params >*cpuidle_board_params) >+{ >+ int i; >+ >+ if (!cpuidle_board_params) >+ return; >+ >+ for (i = OMAP3_STATE_C1; i < OMAP3_MAX_STATES; i++) { >+ cpuidle_params_table[i].sleep_latency = >+ cpuidle_board_params[i].sleep_latency; >+ cpuidle_params_table[i].wake_latency = >+ cpuidle_board_params[i].wake_latency; >+ cpuidle_params_table[i].threshold = >+ cpuidle_board_params[i].threshold; >+ } >+ return; >+} >+ > /* omap3_init_power_states - Initialises the OMAP3 specific C states. > * > * Below is the desciption of each C state. >diff --git a/arch/arm/mach-omap2/pm.h b/arch/arm/mach-omap2/pm.h >index ca673c5..0b814ab 100644 >--- a/arch/arm/mach-omap2/pm.h >+++ b/arch/arm/mach-omap2/pm.h >@@ -41,7 +41,15 @@ struct prm_setup_vc { > u16 vdd1_ret; > u16 vdd1_off; > }; >+ >+struct cpuidle_params { >+ u32 sleep_latency; >+ u32 wake_latency; >+ u32 threshold; >+}; >+ > extern void omap3_pm_init_vc(struct prm_setup_vc *setup_vc); >+extern void omap3_pm_init_cpuidle(struct cpuidle_params >*cpuidle_board_params); > > extern int resource_set_opp_level(int res, u32 target_level, >int flags); > extern int resource_access_opp_lock(int res, int delta); >-- >1.5.4.7 > > ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2 1/2] OMAP3: PM: Configure PRM setup times from board files 2009-10-15 14:48 [PATCH v2 1/2] OMAP3: PM: Configure PRM setup times from board files Rajendra Nayak 2009-10-15 14:48 ` [PATCH v2 2/2] OMAP3: PM: Configure CPUidle latencies/thresholds from board file Rajendra Nayak @ 2009-10-20 15:46 ` Kevin Hilman 1 sibling, 0 replies; 4+ messages in thread From: Kevin Hilman @ 2009-10-20 15:46 UTC (permalink / raw) To: Rajendra Nayak; +Cc: linux-omap Rajendra Nayak <rnayak@ti.com> writes: > The setup times to be programmed in the PRM module on OMAP > (for clksetup, voltsetup etc) are board specific. > They depend heavily on the PMIC used and even on different boards > with the same PMIC, they vary based on the sleep/wake > sequence used, system clock speed et al. > > This patch makes it possible for these setup values to be > configured from different board files. > omap3_pm_init_vc() can now be optionally called from board files > to initialise the setup times. If board files do not use > this function to pass the setup times, default/conservative > values are used which are safe but would cause higher wakeup > latencies from sleep states. > > This patch only updates the 3430sdp board file to use > omap3_pm_init_vc() to update the setup times. > > Signed-off-by: Rajendra Nayak <rnayak@ti.com> Thanks, pulling into PM branch. Kevin > --- > arch/arm/mach-omap2/board-3430sdp.c | 18 ++++++++++++++++++ > arch/arm/mach-omap2/pm.h | 2 +- > arch/arm/mach-omap2/pm34xx.c | 5 ++++- > 3 files changed, 23 insertions(+), 2 deletions(-) > > diff --git a/arch/arm/mach-omap2/board-3430sdp.c b/arch/arm/mach-omap2/board-3430sdp.c > index 14868b5..0f1975c 100644 > --- a/arch/arm/mach-omap2/board-3430sdp.c > +++ b/arch/arm/mach-omap2/board-3430sdp.c > @@ -56,6 +56,23 @@ > > #define TWL4030_MSECURE_GPIO 22 > > +/* FIXME: These are not the optimal setup values to be used on 3430sdp*/ > +static struct prm_setup_vc omap3_setuptime_table = { > + .clksetup = 0xff, > + .voltsetup_time1 = 0xfff, > + .voltsetup_time2 = 0xfff, > + .voltoffset = 0xff, > + .voltsetup2 = 0xff, > + .vdd0_on = 0x30, > + .vdd0_onlp = 0x20, > + .vdd0_ret = 0x1e, > + .vdd0_off = 0x00, > + .vdd1_on = 0x2c, > + .vdd1_onlp = 0x20, > + .vdd1_ret = 0x1e, > + .vdd1_off = 0x00, > +}; > + > static int board_keymap[] = { > KEY(0, 0, KEY_LEFT), > KEY(0, 1, KEY_RIGHT), > @@ -185,6 +202,7 @@ static void __init omap_3430sdp_init_irq(void) > { > omap_board_config = sdp3430_config; > omap_board_config_size = ARRAY_SIZE(sdp3430_config); > + omap3_pm_init_vc(&omap3_setuptime_table); > omap2_init_common_hw(hyb18m512160af6_sdrc_params, NULL, omap3_mpu_rate_table, > omap3_dsp_rate_table, omap3_l3_rate_table); > omap_init_irq(); > diff --git a/arch/arm/mach-omap2/pm.h b/arch/arm/mach-omap2/pm.h > index f8d11a2..ca673c5 100644 > --- a/arch/arm/mach-omap2/pm.h > +++ b/arch/arm/mach-omap2/pm.h > @@ -41,7 +41,7 @@ struct prm_setup_vc { > u16 vdd1_ret; > u16 vdd1_off; > }; > -extern void omap3_set_prm_setup_vc(struct prm_setup_vc *setup_vc); > +extern void omap3_pm_init_vc(struct prm_setup_vc *setup_vc); > > extern int resource_set_opp_level(int res, u32 target_level, int flags); > extern int resource_access_opp_lock(int res, int delta); > diff --git a/arch/arm/mach-omap2/pm34xx.c b/arch/arm/mach-omap2/pm34xx.c > index 01260ec..3d7ae2f 100644 > --- a/arch/arm/mach-omap2/pm34xx.c > +++ b/arch/arm/mach-omap2/pm34xx.c > @@ -1027,8 +1027,11 @@ int omap3_pm_set_suspend_state(struct powerdomain *pwrdm, int state) > return -EINVAL; > } > > -void omap3_set_prm_setup_vc(struct prm_setup_vc *setup_vc) > +void omap3_pm_init_vc(struct prm_setup_vc *setup_vc) > { > + if (!setup_vc) > + return; > + > prm_setup.clksetup = setup_vc->clksetup; > prm_setup.voltsetup_time1 = setup_vc->voltsetup_time1; > prm_setup.voltsetup_time2 = setup_vc->voltsetup_time2; > -- > 1.5.4.7 ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2009-10-20 15:46 UTC | newest] Thread overview: 4+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2009-10-15 14:48 [PATCH v2 1/2] OMAP3: PM: Configure PRM setup times from board files Rajendra Nayak 2009-10-15 14:48 ` [PATCH v2 2/2] OMAP3: PM: Configure CPUidle latencies/thresholds from board file Rajendra Nayak 2009-10-16 6:23 ` Nayak, Rajendra 2009-10-20 15:46 ` [PATCH v2 1/2] OMAP3: PM: Configure PRM setup times from board files Kevin Hilman
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox