ARM: OMAP3: cpuidle - remove rx51 cpuidle parameters table
RFC PATCH 1/9 ARM: OMAP3: cpuidle - remove rx51 cpuidle parameters table
As suggested, this table is an optimized version for rx51 and we remove it in order to consolidate the cpuidle code between omap3 and omap4, we remove this specific data definition which is used to override the default omap3 latencies but at the cost of extra code and complexity.
In order to not lose the values which probably took time to be measured, the table is converted into a comment with an array description.
--- arch/arm/mach-omap2/board-rx51.c | 38 +++++++++++++++++------------------- arch/arm/mach-omap2/cpuidle34xx.c | 17 ---------------- arch/arm/mach-omap2/pm.h | 9 -------- 3 files changed, 18 insertions(+), 46 deletions(-)
arch/arm/mach-omap2/board-rx51.c +18 -20
@@ -59,25 +59,24 @@ static struct platform_device leds_gpio = { };/* -* cpuidle C-states definition override from the default values. -* The 'exit_latency' field is the sum of sleep and wake-up latencies. -*/ -static struct cpuidle_params rx51_cpuidle_params[] = { -/* C1 */ - {110 +162 ,5 ,1 }, -/* C2 */ - {106 +180 ,309 ,1 }, -/* C3 */ - {107 +410 ,46057 ,0 }, -/* C4 */ - {121 +3374 ,46057 ,0 }, -/* C5 */ - {855 +1146 ,46057 ,1 }, -/* C6 */ - {7580 +4134 ,484329 ,0 }, -/* C7 */ - {7505 +15274 ,484329 ,1 }, -}; +* cpuidle C-states definition for rx51. +* +* The 'exit_latency' field is the sum of sleep +* and wake-up latencies. + +--------------------------------------------- +| state | exit_latency | target_residency | +--------------------------------------------- +| C1 | 110 + 162 | 5 | +| C2 | 106 + 180 | 309 | +| C3 | 107 + 410 | 46057 | +| C4 | 121 + 3374 | 46057 | +| C5 | 855 + 1146 | 46057 | +| C6 | 7580 + 4134 | 484329 | +| C7 | 7505 + 15274 | 484329 | +--------------------------------------------- + +*/ extern void __init rx51_peripherals_init (void );
@@ -98,7 +97,6 @@ static void __init rx51_init(void)struct omap_sdrc_params *sdrc_params;omap3_mux_init (board_mux,OMAP_PACKAGE_CBB ); -omap3_pm_init_cpuidle (rx51_cpuidle_params);omap_serial_init (); sdrc_params =nokia_get_sdram_timings ();
arch/arm/mach-omap2/cpuidle34xx.c +0 -17
@@ -306,23 +306,6 @@ select_state: 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 =0 ; i <OMAP3_NUM_STATES ; i++) { - cpuidle_params_table[i].valid = cpuidle_board_params[i].valid; - cpuidle_params_table[i].exit_latency = - cpuidle_board_params[i].exit_latency; - cpuidle_params_table[i].target_residency = - cpuidle_board_params[i].target_residency; - } -return ; -} -struct cpuidle_driver omap3_idle_driver = { .name ="omap3_idle" , .owner =THIS_MODULE ,
arch/arm/mach-omap2/pm.h +0 -9
@@ -51,15 +51,6 @@ struct cpuidle_params {u8 valid;/* validates the C-state */ }; -#if defined(CONFIG_PM ) && defined(CONFIG_CPU_IDLE ) -extern void omap3_pm_init_cpuidle (struct cpuidle_params *cpuidle_board_params); -#else -static -inline void omap3_pm_init_cpuidle (struct cpuidle_params *cpuidle_board_params) -{ -} -#endif -extern int omap3_pm_get_suspend_state (struct powerdomain *pwrdm);extern int omap3_pm_set_suspend_state (struct powerdomain *pwrdm,int state);
Signature · 1 line
1.7.5.4
RFC PATCH 2/9 ARM: OMAP3: cpuidle - remove next_valid_state function
As we will be able to remove C-states from userspace with the sysfs API, this function is no longer needed. We remove it and that simplifies the code for more consolidation.
--- arch/arm/mach-omap2/cpuidle34xx.c | 85 +------------------------------------ 1 files changed, 2 insertions(+), 83 deletions(-)
arch/arm/mach-omap2/cpuidle34xx.c +2 -83
@@ -164,84 +164,6 @@ return_sleep_time: }/** -* next_valid_state - Find next valid C-state -* @dev: cpuidle device -* @drv: cpuidle driver -* @index: Index of currently selected c-state -* -* If the state corresponding to index is valid, index is returned back -* to the caller. Else, this function searches for a lower c-state which is -* still valid (as defined in omap3_power_states[]) and returns its index. -* -* A state is valid if the 'valid' field is enabled and -* if it satisfies the enable_off_mode condition. -*/ -static int next_valid_state (struct cpuidle_device *dev, -struct cpuidle_driver *drv, -int index) -{ -struct cpuidle_state_usage *curr_usage = &dev->states_usage[index]; -struct cpuidle_state *curr = &drv->states[index]; -struct omap3_idle_statedata *cx =cpuidle_get_statedata (curr_usage); -u32 mpu_deepest_state =PWRDM_POWER_RET ; -u32 core_deepest_state =PWRDM_POWER_RET ; -int next_index =-1 ; - -if (enable_off_mode) { - mpu_deepest_state =PWRDM_POWER_OFF ; -/* -* Erratum i583: valable for ES rev < Es1.2 on 3630. -* CORE OFF mode is not supported in a stable form, restrict -* instead the CORE state to RET. -*/ -if (!IS_PM34XX_ERRATUM (PM_SDRC_WAKEUP_ERRATUM_i583)) - core_deepest_state =PWRDM_POWER_OFF ; - } - -/* Check if current state is valid */ -if ((cx->valid) && - (cx->mpu_state >= mpu_deepest_state) && - (cx->core_state >= core_deepest_state)) { -return index; - }else { -int idx =OMAP3_NUM_STATES -1 ; - -/* Reach the current state starting at highest C-state */ -for (; idx >=0 ; idx--) { -if (&drv->states[idx] == curr) { - next_index = idx; -break ; - } - } - -/* Should never hit this condition */ -WARN_ON (next_index ==-1 ); - -/* -* Drop to next valid state. -* Start search from the next (lower) state. -*/ - idx--; -for (; idx >=0 ; idx--) { - cx =cpuidle_get_statedata (&dev->states_usage[idx]); -if ((cx->valid) && - (cx->mpu_state >= mpu_deepest_state) && - (cx->core_state >= core_deepest_state)) { - next_index = idx; -break ; - } - } -/* -* C1 is always valid. -* So, no need to check for 'next_index == -1' outside -* this loop. -*/ - } - -return next_index; -} - -/** * omap3_enter_idle_bm - Checks for any bus activity * @dev: cpuidle device * @drv: cpuidle driver
@@ -254,7 +176,6 @@ static int omap3_enter_idle_bm(struct cpuidle_device *dev, struct cpuidle_driver *drv, int index) { - int new_state_idx;u32 core_next_state, per_next_state =0 , per_saved_state =0 , cam_state;struct omap3_idle_statedata *cx;int ret;
@@ -265,7 +186,7 @@ static int omap3_enter_idle_bm(struct cpuidle_device *dev,*/ cam_state =pwrdm_read_pwrst (cam_pd);if (cam_state ==PWRDM_POWER_ON ) { - new_state_idx = drv->safe_state_index; + index = drv->safe_state_index; goto select_state; }
@@ -292,10 +213,8 @@ static int omap3_enter_idle_bm(struct cpuidle_device *dev,if (per_next_state != per_saved_state)pwrdm_set_next_pwrst (per_pd, per_next_state); - new_state_idx =next_valid_state (dev, drv, index); - select_state: - ret =omap3_enter_idle (dev, drv, new_state_idx); + ret =omap3_enter_idle (dev, drv, index);/* Restore original PER state if it was modified */ if (per_next_state != per_saved_state)
Signature · 1 line
1.7.5.4
RFC PATCH 2/9 ARM: OMAP3: cpuidle - remove next_valid_state function
Hi Daniel,
Quoted 40 lines · Daniel Lezcano
As we will be able to remove C-states from userspace with the sysfs API, this function is no longer needed. We remove it and that simplifies the code for more consolidation.
Signed-off-by Daniel Lezcano <[email protected]>---
?arch/arm/mach-omap2/cpuidle34xx.c | ? 85 +------------------------------------ ?1 files changed, 2 insertions(+), 83 deletions(-)arch/arm/mach-omap2/cpuidle34xx.c +0
-0@@ -164,84 +164,6 @@ return_sleep_time: ?}?/**
- *next_valid_state- Find next valid C-state
- * @dev: cpuidle device
- * @drv: cpuidle driver
- * @index: Index of currently selected c-state
- *
- * If the state corresponding to index is valid, index is returned back
- * to the caller. Else, this function searches for a lower c-state which is
- * still valid (as defined in omap3_power_states[]) and returns its index.
- *
- * A state is valid if the 'valid' field is enabled and
- * if it satisfies theenable_off_modecondition.
- */arch/arm/mach-omap2/cpuidle34xx.c +0
-11-static int next_valid_state (struct cpuidle_device *dev, - ? ? ? ? ? ? ? ? ? ? ? struct cpuidle_driver *drv, - ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? int index) -{ - ? ? ? struct cpuidle_state_usage *curr_usage = &dev->states_usage[index]; - ? ? ? struct cpuidle_state *curr = &drv->states[index]; - ? ? ? struct omap3_idle_statedata *cx = cpuidle_get_statedata(curr_usage); - ? ? ? u32 mpu_deepest_state = PWRDM_POWER_RET; - ? ? ? u32 core_deepest_state = PWRDM_POWER_RET; - ? ? ? int next_index = -1; -
arch/arm/mach-omap2/cpuidle34xx.c
Quoted 10 lines
arch/arm/mach-omap2/cpuidle34xx.c +0
-10- ? ? ? if (enable_off_mode) { - ? ? ? ? ? ? ? mpu_deepest_state = PWRDM_POWER_OFF; - ? ? ? ? ? ? ? /* - ? ? ? ? ? ? ? ?* Erratum i583: valable for ES rev < Es1.2 on 3630. - ? ? ? ? ? ? ? ?* CORE OFF mode is not supported in a stable form, restrict - ? ? ? ? ? ? ? ?* instead the CORE state to RET. - ? ? ? ? ? ? ? ?*/ - ? ? ? ? ? ? ? if (!IS_PM34XX_ERRATUM(PM_SDRC_WAKEUP_ERRATUM_i583)) - ? ? ? ? ? ? ? ? ? ? ? core_deepest_state = PWRDM_POWER_OFF; - ? ? ? }
I am OK to remove the function but some of the code needs to stay (can be moved into enter_idle_bm).
The errata code is needed.
Quoted 8 lines
-
- ? ? ? /* Check if current state is valid */
- ? ? ? if ((cx->valid) &&
- ? ? ? ? ? (cx->mpu_state>=mpu_deepest_state) &&
- ? ? ? ? ? (cx->core_state>=core_deepest_state)) {
- ? ? ? ? ? ? ? return index;
- ? ? ? } else {
- ? ? ? ? ? ? ? int idx =OMAP3_NUM_STATES- 1;
On OMAP3 not all the power states combinations are allowed, so this code looks for a C-state which satisfies the enable_off_mode flag. I am planning to remove the enable_off_mode flag but this has to come with the per-device PM QoS constraints code.
Quoted 67 lines
arch/arm/mach-omap2/cpuidle34xx.c +0
-37- - ? ? ? ? ? ? ? /* Reach the current state starting at highest C-state */ - ? ? ? ? ? ? ? for (; idx >= 0; idx--) { - ? ? ? ? ? ? ? ? ? ? ? if (&drv->states[idx] == curr) { - ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? next_index = idx; - ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? break; - ? ? ? ? ? ? ? ? ? ? ? } - ? ? ? ? ? ? ? } - - ? ? ? ? ? ? ? /* Should never hit this condition */ - ? ? ? ? ? ? ? WARN_ON(next_index == -1); - - ? ? ? ? ? ? ? /* - ? ? ? ? ? ? ? ?* Drop to next valid state. - ? ? ? ? ? ? ? ?* Start search from the next (lower) state. - ? ? ? ? ? ? ? ?*/ - ? ? ? ? ? ? ? idx--; - ? ? ? ? ? ? ? for (; idx >= 0; idx--) { - ? ? ? ? ? ? ? ? ? ? ? cx = cpuidle_get_statedata(&dev->states_usage[idx]); - ? ? ? ? ? ? ? ? ? ? ? if ((cx->valid) && - ? ? ? ? ? ? ? ? ? ? ? ? ? (cx->mpu_state >= mpu_deepest_state) && - ? ? ? ? ? ? ? ? ? ? ? ? ? (cx->core_state >= core_deepest_state)) { - ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? next_index = idx; - ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? break; - ? ? ? ? ? ? ? ? ? ? ? } - ? ? ? ? ? ? ? } - ? ? ? ? ? ? ? /* - ? ? ? ? ? ? ? ?* C1 is always valid. - ? ? ? ? ? ? ? ?* So, no need to check for 'next_index == -1' outside - ? ? ? ? ? ? ? ?* this loop. - ? ? ? ? ? ? ? ?*/ - ? ? ? } - - ? ? ? return next_index; -} - -/** ?*
omap3_enter_idle_bm- Checks for any bus activity ?* @dev: cpuidle device
?* @drv: cpuidle driverarch/arm/mach-omap2/cpuidle34xx.c +0
-1@@ -254,7 +176,6 @@ static int omap3_enter_idle_bm(struct cpuidle_device *dev, ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?struct cpuidle_driver *drv, ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? int index) ?{ - ? ? ? int new_state_idx; ? ? ? ?u32 core_next_state, per_next_state = 0, per_saved_state = 0, cam_state; ? ? ? ?struct omap3_idle_statedata *cx; ? ? ? ?int ret;@@ -265,7 +186,7 @@ static int omap3_enter_idle_bm(struct cpuidle_device *dev,? ? ? ? */
? ? ? ?cam_state =pwrdm_read_pwrst(cam_pd); ? ? ? ?if (cam_state==PWRDM_POWER_ON) {
- ? ? ? ? ? ? ?new_state_idx=drv->safe_state_index;
+ ? ? ? ? ? ? ? index =drv->safe_state_index; ? ? ? ? ? ? ? ?gotoselect_state;
? ? ? ?}arch/arm/mach-omap2/cpuidle34xx.c +0
-2@@ -292,10 +213,8 @@ static int omap3_enter_idle_bm(struct cpuidle_device *dev, ? ? ? ?if (per_next_state != per_saved_state) ? ? ? ? ? ? ? ?pwrdm_set_next_pwrst(per_pd, per_next_state); - ? ? ? new_state_idx = next_valid_state(dev, drv, index); -?select_state:
- ? ? ? ret =omap3_enter_idle(dev, drv, new_state_idx);
+ ? ? ? ret =omap3_enter_idle(dev, drv, index);
Quoted 5 lines
? ? ? ?/* Restore original PER state if it was modified */ ? ? ? ?if (
per_next_state!=per_saved_state)
--
1.7.5.4
Regards,
Jean
RFC PATCH 3/9 ARM: OMAP3: cpuidle - set enable_off_mode as static
In reply to Daniel LezcanoThis variable is only used in the pm-debug.c file.
--- arch/arm/mach-omap2/pm-debug.c | 2 +- arch/arm/mach-omap2/pm.h | 30 ++++++++++++------------------ 2 files changed, 13 insertions(+), 19 deletions(-)
arch/arm/mach-omap2/pm-debug.c +1 -1
@@ -38,7 +38,7 @@#include "prm2xxx_3xxx.h" #include "pm.h" -u32 enable_off_mode; +static u32 enable_off_mode;#ifdef CONFIG_DEBUG_FS #include <linux/debugfs.h>
arch/arm/mach-omap2/pm.h +12 -18
@@ -25,6 +25,18 @@ extern int omap4_idle_init(void);extern int omap_pm_clkdms_setup (struct clockdomain *clkdm,void *unused);extern int (*omap_pm_suspend)(void ); +/* +* cpuidle mach specific parameters +* +* The board code can override the default C-states definition using +* omap3_pm_init_cpuidle +*/ +struct cpuidle_params { +u32 exit_latency;/* exit_latency = sleep + wake-up latencies */ +u32 target_residency; +u8 valid;/* validates the C-state */ +}; +#if defined(CONFIG_PM_OPP )extern int omap3_opp_init (void );extern int omap4_opp_init (void );
@@ -39,27 +51,9 @@ static inline int omap4_opp_init(void) }#endif -/* -* cpuidle mach specific parameters -* -* The board code can override the default C-states definition using -* omap3_pm_init_cpuidle -*/ -struct cpuidle_params { -u32 exit_latency;/* exit_latency = sleep + wake-up latencies */ -u32 target_residency; -u8 valid;/* validates the C-state */ -}; -extern int omap3_pm_get_suspend_state (struct powerdomain *pwrdm);extern int omap3_pm_set_suspend_state (struct powerdomain *pwrdm,int state); -#ifdef CONFIG_PM_DEBUG -extern u32 enable_off_mode; -#else -#define enable_off_mode 0 -#endif -#if defined(CONFIG_PM_DEBUG ) && defined(CONFIG_DEBUG_FS )extern void pm_dbg_update_time (struct powerdomain *pwrdm,int prev);#else
Signature · 1 line
1.7.5.4
RFC PATCH 3/9 ARM: OMAP3: cpuidle - set enable_off_mode as static
Quoted 16 lines · Daniel Lezcano
This variable is only used in the
pm-debug.cfile.Signed-off-by Daniel Lezcano <[email protected]>---
?arch/arm/mach-omap2/pm-debug.c | ? ?2 +- ?arch/arm/mach-omap2/pm.h ? ? ? | ? 30 ++++++++++++------------------ ?2 files changed, 13 insertions(+), 19 deletions(-)arch/arm/mach-omap2/pm-debug.c +0
-0@@ -38,7 +38,7 @@?#include "
prm2xxx_3xxx.h"
?#include "pm.h"
arch/arm/mach-omap2/pm-debug.c line 41
Quoted 2 lines
arch/arm/mach-omap2/pm-debug.c +1
-1-u32 enable_off_mode; +static u32 enable_off_mode;
It is stil needed in cpuidle34xx.c.
Quoted 13 lines
?#ifdef
CONFIG_DEBUG_FS
?#include <linux/debugfs.h>arch/arm/mach-omap2/pm.h +2
-0@@ -25,6 +25,18 @@ extern int omap4_idle_init(void); ?extern int omap_pm_clkdms_setup(struct clockdomain *clkdm, void *unused); ?extern int (*omap_pm_suspend)(void); +/* +* cpuidle mach specific parameters
arch/arm/mach-omap2/pm.h extern int omap4_idle_init(void); · line 39
Quoted 10 lines
arch/arm/mach-omap2/pm.h +10
-0+* +* The board code can override the default C-states definition using +* omap3_pm_init_cpuidle +*/ +struct cpuidle_params { + ? ? ? u32 exit_latency; ? ? ? /* exit_latency = sleep + wake-up latencies */ + ? ? ? u32 target_residency; + ? ? ? u8 valid; ? ? ? ? ? ? ? /* validates the C-state */ +}; +
Is this move needed? This will be removed in a later patch.
Quoted 28 lines
arch/arm/mach-omap2/pm.h +0
-0?#if defined(CONFIG_PM_OPP) ?extern int omap3_opp_init(void); ?extern int omap4_opp_init(void);@@ -39,27 +51,9 @@ static inline int omap4_opp_init(void) ?}?#endif
arch/arm/mach-omap2/pm.h +0
-12-/* -* cpuidle mach specific parameters -* -* The board code can override the default C-states definition using -* omap3_pm_init_cpuidle -*/ -struct cpuidle_params { - ? ? ? u32 exit_latency; ? ? ? /* exit_latency = sleep + wake-up latencies */ - ? ? ? u32 target_residency; - ? ? ? u8 valid; ? ? ? ? ? ? ? /* validates the C-state */ -}; -?extern int
omap3_pm_get_suspend_state(struct powerdomain *pwrdm); ?extern intomap3_pm_set_suspend_state(struct powerdomain *pwrdm, int state);arch/arm/mach-omap2/pm.h +0
-6-#ifdef CONFIG_PM_DEBUG -extern u32 enable_off_mode; -#else -#define enable_off_mode 0 -#endif -
Quoted 6 lines
?#if
defined(CONFIG_PM_DEBUG)&&defined(CONFIG_DEBUG_FS)?extern voidpm_dbg_update_time(struct powerdomain *pwrdm, int prev); ?#else
--
1.7.5.4
Jean
RFC PATCH 3/9 ARM: OMAP3: cpuidle - set enable_off_mode as static
Quoted 18 lines · Jean Pihet
Quoted 16 lines · Daniel Lezcano
This variable is only used in the
pm-debug.cfile.Signed-off-by Daniel Lezcano<[email protected]>--- arch/arm/mach-omap2/pm-debug.c | 2 +- arch/arm/mach-omap2/pm.h | 30 ++++++++++++------------------ 2 files changed, 13 insertions(+), 19 deletions(-)arch/arm/mach-omap2/pm-debug.c +0
-0@@ -38,7 +38,7 @@#include "prm2xxx_3xxx.h" #include "pm.h"
Quoted 3 lines
arch/arm/mach-omap2/pm-debug.c line 41
Quoted 2 lines
arch/arm/mach-omap2/pm-debug.c +1
-1-u32 enable_off_mode; +static u32 enable_off_mode;It is stil needed in
cpuidle34xx.c.
ok.
Quoted 10 lines
Quoted 10 lines
arch/arm/mach-omap2/pm-debug.c +0
-0#ifdef CONFIG_DEBUG_FS #include <linux/debugfs.h> arch/arm/mach-omap2/pm.h +0
-0@@ -25,6 +25,18 @@ extern int omap4_idle_init(void);extern int omap_pm_clkdms_setup (struct clockdomain *clkdm,void *unused);extern int (*omap_pm_suspend)(void );
Quoted 13 lines
arch/arm/mach-omap2/pm.h extern int omap4_idle_init(void); · line 39
Quoted 12 lines
arch/arm/mach-omap2/pm.h +12
-0+/* +* cpuidle mach specific parameters +* +* The board code can override the default C-states definition using +* omap3_pm_init_cpuidle +*/ +struct cpuidle_params { +u32 exit_latency;/* exit_latency = sleep + wake-up latencies */ +u32 target_residency; +u8 valid;/* validates the C-state */ +}; +Is this move needed? This will be removed in a later patch.
No, I think I did a bad manipulation.
Quoted 36 lines
Quoted 32 lines
arch/arm/mach-omap2/pm.h +0
-19#if defined(CONFIG_PM_OPP )extern int omap3_opp_init (void );extern int omap4_opp_init (void );@@ -39,27 +51,9 @@ static inline int omap4_opp_init(void) }#endif -/* -* cpuidle mach specific parameters -* -* The board code can override the default C-states definition using -* omap3_pm_init_cpuidle -*/ -struct cpuidle_params { -u32 exit_latency;/* exit_latency = sleep + wake-up latencies */ -u32 target_residency; -u8 valid;/* validates the C-state */ -}; -extern int omap3_pm_get_suspend_state (struct powerdomain *pwrdm);extern int omap3_pm_set_suspend_state (struct powerdomain *pwrdm,int state); -#ifdef CONFIG_PM_DEBUG -extern u32 enable_off_mode; -#else -#define enable_off_mode 0 -#endif -#if defined(CONFIG_PM_DEBUG )&& defined(CONFIG_DEBUG_FS )extern void pm_dbg_update_time (struct powerdomain *pwrdm,int prev);#else --Quoted 2 lines
1.7.5.4
Jean
Signature · 5 lines
<http://www.linaro.org/> Linaro.org ? Open source software for ARM SoCs Follow Linaro: <http://www.facebook.com/pages/Linaro> Facebook | <http://twitter.com/#!/linaroorg> Twitter | <http://www.linaro.org/linaro-blog/> Blog
RFC PATCH 4/9 ARM: OMAP3: define cpuidle statically
In reply to Daniel LezcanoUse the new cpuidle API and define in the driver the states.
--- arch/arm/mach-omap2/cpuidle34xx.c | 85 +++++++++++++++++++++++++----------- 1 files changed, 59 insertions(+), 26 deletions(-)
arch/arm/mach-omap2/cpuidle34xx.c +59 -26
@@ -228,23 +228,67 @@ DEFINE_PER_CPU(struct cpuidle_device, omap3_idle_dev);struct cpuidle_driver omap3_idle_driver = { .name ="omap3_idle" , .owner =THIS_MODULE , + .states = { + { + .enter = omap3_enter_idle, + .exit_latency =2 +2 , + .target_residency =5 , + .flags =CPUIDLE_FLAG_TIME_VALID , + .name ="C1" , + .desc ="MPU ON + CORE ON" , + }, + { + .enter = omap3_enter_idle_bm, + .exit_latency =10 +10 , + .target_residency =30 , + .flags =CPUIDLE_FLAG_TIME_VALID , + .name ="C2" , + .desc ="MPU ON + CORE ON" , + }, + { + .enter = omap3_enter_idle_bm, + .exit_latency =50 +50 , + .target_residency =300 , + .flags =CPUIDLE_FLAG_TIME_VALID , + .name ="C3" , + .desc ="MPU RET + CORE ON" , + }, + { + .enter = omap3_enter_idle_bm, + .exit_latency =1500 +1800 , + .target_residency =4000 , + .flags =CPUIDLE_FLAG_TIME_VALID , + .name ="C4" , + .desc ="MPU OFF + CORE ON" , + }, + { + .enter = omap3_enter_idle_bm, + .exit_latency =2500 +7500 , + .target_residency =12000 , + .flags =CPUIDLE_FLAG_TIME_VALID , + .name ="C5" , + .desc ="MPU RET + CORE RET" , + }, + { + .enter = omap3_enter_idle_bm, + .exit_latency =3000 +8500 , + .target_residency =15000 , + .flags =CPUIDLE_FLAG_TIME_VALID , + .name ="C6" , + .desc ="MPU OFF + CORE RET" , + }, + { + .enter = omap3_enter_idle_bm, + .exit_latency =10000 +30000 , + .target_residency =30000 , + .flags =CPUIDLE_FLAG_TIME_VALID , + .name ="C7" , + .desc ="MPU OFF + CORE OFF" , + }, + }, + .state_count =OMAP3_NUM_STATES , }; -/* Helper to fill the C-state common data*/ -static inline void _fill_cstate (struct cpuidle_driver *drv, -int idx,const char *descr) -{ -struct cpuidle_state *state = &drv->states[idx]; - - state->exit_latency = cpuidle_params_table[idx].exit_latency; - state->target_residency = cpuidle_params_table[idx].target_residency; - state->flags =CPUIDLE_FLAG_TIME_VALID ; - state->enter = omap3_enter_idle_bm; -sprintf (state->name,"C%d" , idx +1 ); -strncpy (state->desc, descr,CPUIDLE_DESC_LEN ); - -} -/* Helper to register the driver_data */ static inline struct omap3_idle_statedata *_fill_cstate_usage( struct cpuidle_device *dev,
@@ -277,50 +321,40 @@ int __init omap3_idle_init(void) cam_pd =pwrdm_lookup ("cam_pwrdm" ); - drv->safe_state_index =-1 ; dev = &per_cpu (omap3_idle_dev,smp_processor_id ());/* C1 . MPU WFI + Core active */ -_fill_cstate (drv,0 ,"MPU ON + CORE ON" ); - (&drv->states[0 ])->enter = omap3_enter_idle; - drv->safe_state_index =0 ; cx =_fill_cstate_usage (dev,0 ); cx->valid =1 ;/* C1 is always valid */ cx->mpu_state =PWRDM_POWER_ON ; cx->core_state =PWRDM_POWER_ON ;/* C2 . MPU WFI + Core inactive */ -_fill_cstate (drv,1 ,"MPU ON + CORE ON" ); cx =_fill_cstate_usage (dev,1 ); cx->mpu_state =PWRDM_POWER_ON ; cx->core_state =PWRDM_POWER_ON ;/* C3 . MPU CSWR + Core inactive */ -_fill_cstate (drv,2 ,"MPU RET + CORE ON" ); cx =_fill_cstate_usage (dev,2 ); cx->mpu_state =PWRDM_POWER_RET ; cx->core_state =PWRDM_POWER_ON ;/* C4 . MPU OFF + Core inactive */ -_fill_cstate (drv,3 ,"MPU OFF + CORE ON" ); cx =_fill_cstate_usage (dev,3 ); cx->mpu_state =PWRDM_POWER_OFF ; cx->core_state =PWRDM_POWER_ON ;/* C5 . MPU RET + Core RET */ -_fill_cstate (drv,4 ,"MPU RET + CORE RET" ); cx =_fill_cstate_usage (dev,4 ); cx->mpu_state =PWRDM_POWER_RET ; cx->core_state =PWRDM_POWER_RET ;/* C6 . MPU OFF + Core RET */ -_fill_cstate (drv,5 ,"MPU OFF + CORE RET" ); cx =_fill_cstate_usage (dev,5 ); cx->mpu_state =PWRDM_POWER_OFF ; cx->core_state =PWRDM_POWER_RET ;/* C7 . MPU OFF + Core OFF */ -_fill_cstate (drv,6 ,"MPU OFF + CORE OFF" ); cx =_fill_cstate_usage (dev,6 );/* * Erratum i583: implementation for ES rev < Es1.2 on 3630. We cannot
@@ -338,7 +372,6 @@ int __init omap3_idle_init(void) drv->state_count =OMAP3_NUM_STATES ;cpuidle_register_driver (&omap3_idle_driver); - dev->state_count =OMAP3_NUM_STATES ;if (cpuidle_register_device (dev)) {printk (KERN_ERR "%s: CPUidle register device failed\n" , __func__);
Signature · 1 line
1.7.5.4
RFC PATCH 4/9 ARM: OMAP3: define cpuidle statically
Quoted 62 lines · Daniel Lezcano
Use the new cpuidle API and define in the driver the states.
Signed-off-by Daniel Lezcano <[email protected]>---
?arch/arm/mach-omap2/cpuidle34xx.c | ? 85 +++++++++++++++++++++++++----------- ?1 files changed, 59 insertions(+), 26 deletions(-)arch/arm/mach-omap2/cpuidle34xx.c +47
-0@@ -228,23 +228,67 @@ DEFINE_PER_CPU(struct cpuidle_device, omap3_idle_dev); ?struct cpuidle_driver omap3_idle_driver = { ? ? ? ?.name = ? ? ? ? "omap3_idle", ? ? ? ?.owner = ? ? ? ?THIS_MODULE, + ? ? ? .states = { + ? ? ? ? ? ? ? { + ? ? ? ? ? ? ? ? ? ? ? .enter ? ? ? ? ? ?= omap3_enter_idle, + ? ? ? ? ? ? ? ? ? ? ? .exit_latency ? ? = 2 + 2, + ? ? ? ? ? ? ? ? ? ? ? .target_residency = 5, + ? ? ? ? ? ? ? ? ? ? ? .flags ? ? ? ? ? ?= CPUIDLE_FLAG_TIME_VALID, + ? ? ? ? ? ? ? ? ? ? ? .name ? ? ? ? ? ? = "C1", + ? ? ? ? ? ? ? ? ? ? ? .desc ? ? ? ? ? ? = "MPU ON + CORE ON", + ? ? ? ? ? ? ? }, + ? ? ? ? ? ? ? { + ? ? ? ? ? ? ? ? ? ? ? .enter ? ? ? ? ? ?= omap3_enter_idle_bm, + ? ? ? ? ? ? ? ? ? ? ? .exit_latency ? ? = 10 + 10, + ? ? ? ? ? ? ? ? ? ? ? .target_residency = 30, + ? ? ? ? ? ? ? ? ? ? ? .flags ? ? ? ? ? ?= CPUIDLE_FLAG_TIME_VALID, + ? ? ? ? ? ? ? ? ? ? ? .name ? ? ? ? ? ? = "C2", + ? ? ? ? ? ? ? ? ? ? ? .desc ? ? ? ? ? ? = "MPU ON + CORE ON", + ? ? ? ? ? ? ? }, + ? ? ? ? ? ? ? { + ? ? ? ? ? ? ? ? ? ? ? .enter ? ? ? ? ? ?= omap3_enter_idle_bm, + ? ? ? ? ? ? ? ? ? ? ? .exit_latency ? ? = 50 + 50, + ? ? ? ? ? ? ? ? ? ? ? .target_residency = 300, + ? ? ? ? ? ? ? ? ? ? ? .flags ? ? ? ? ? ?= CPUIDLE_FLAG_TIME_VALID, + ? ? ? ? ? ? ? ? ? ? ? .name ? ? ? ? ? ? = "C3", + ? ? ? ? ? ? ? ? ? ? ? .desc ? ? ? ? ? ? = "MPU RET + CORE ON", + ? ? ? ? ? ? ? }, + ? ? ? ? ? ? ? { + ? ? ? ? ? ? ? ? ? ? ? .enter ? ? ? ? ? ?= omap3_enter_idle_bm, + ? ? ? ? ? ? ? ? ? ? ? .exit_latency ? ? = 1500 + 1800, + ? ? ? ? ? ? ? ? ? ? ? .target_residency = 4000, + ? ? ? ? ? ? ? ? ? ? ? .flags ? ? ? ? ? ?= CPUIDLE_FLAG_TIME_VALID, + ? ? ? ? ? ? ? ? ? ? ? .name ? ? ? ? ? ? = "C4", + ? ? ? ? ? ? ? ? ? ? ? .desc ? ? ? ? ? ? = "MPU OFF + CORE ON", + ? ? ? ? ? ? ? }, + ? ? ? ? ? ? ? { + ? ? ? ? ? ? ? ? ? ? ? .enter ? ? ? ? ? ?= omap3_enter_idle_bm, + ? ? ? ? ? ? ? ? ? ? ? .exit_latency ? ? = 2500 + 7500, + ? ? ? ? ? ? ? ? ? ? ? .target_residency = 12000, + ? ? ? ? ? ? ? ? ? ? ? .flags ? ? ? ? ? ?= CPUIDLE_FLAG_TIME_VALID, + ? ? ? ? ? ? ? ? ? ? ? .name ? ? ? ? ? ? = "C5", + ? ? ? ? ? ? ? ? ? ? ? .desc ? ? ? ? ? ? = "MPU RET + CORE RET", + ? ? ? ? ? ? ? }, + ? ? ? ? ? ? ? { + ? ? ? ? ? ? ? ? ? ? ? .enter ? ? ? ? ? ?= omap3_enter_idle_bm, + ? ? ? ? ? ? ? ? ? ? ? .exit_latency ? ? = 3000 + 8500, + ? ? ? ? ? ? ? ? ? ? ? .target_residency = 15000, + ? ? ? ? ? ? ? ? ? ? ? .flags ? ? ? ? ? ?= CPUIDLE_FLAG_TIME_VALID, + ? ? ? ? ? ? ? ? ? ? ? .name ? ? ? ? ? ? = "C6",
arch/arm/mach-omap2/cpuidle34xx.c DEFINE_PER_CPU(struct cpuidle_device, omap3_idle_dev); · line 287
Quoted 10 lines
arch/arm/mach-omap2/cpuidle34xx.c +10
-0+ ? ? ? ? ? ? ? ? ? ? ? .desc ? ? ? ? ? ? = "MPU OFF + CORE RET", + ? ? ? ? ? ? ? }, + ? ? ? ? ? ? ? { + ? ? ? ? ? ? ? ? ? ? ? .enter ? ? ? ? ? ?= omap3_enter_idle_bm, + ? ? ? ? ? ? ? ? ? ? ? .exit_latency ? ? = 10000 + 30000, + ? ? ? ? ? ? ? ? ? ? ? .target_residency = 30000, + ? ? ? ? ? ? ? ? ? ? ? .flags ? ? ? ? ? ?= CPUIDLE_FLAG_TIME_VALID, + ? ? ? ? ? ? ? ? ? ? ? .name ? ? ? ? ? ? = "C7", + ? ? ? ? ? ? ? ? ? ? ? .desc ? ? ? ? ? ? = "MPU OFF + CORE OFF", + ? ? ? ? ? ? ? },
C7 is enabled depending on the errata i583, cf. below.
Quoted 29 lines
arch/arm/mach-omap2/cpuidle34xx.c +2
-15+ ? ? ? }, + ? ? ? .state_count = OMAP3_NUM_STATES, ?}; -/* Helper to fill the C-state common data*/ -static inline void _fill_cstate(struct cpuidle_driver *drv, - ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? int idx, const char *descr) -{ - ? ? ? struct cpuidle_state *state = &drv->states[idx]; - - ? ? ? state->exit_latency ? ? = cpuidle_params_table[idx].exit_latency; - ? ? ? state->target_residency = cpuidle_params_table[idx].target_residency; - ? ? ? state->flags ? ? ? ? ? ?= CPUIDLE_FLAG_TIME_VALID; - ? ? ? state->enter ? ? ? ? ? ?= omap3_enter_idle_bm; - ? ? ? sprintf(state->name, "C%d", idx + 1); - ? ? ? strncpy(state->desc, descr, CPUIDLE_DESC_LEN); - -} -?/* Helper to register the
driver_data*/
?static inline structomap3_idle_statedata*_fill_cstate_usage( ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?structcpuidle_device*dev,arch/arm/mach-omap2/cpuidle34xx.c +0
-1@@ -277,50 +321,40 @@ int __init omap3_idle_init(void) ? ? ? ?cam_pd = pwrdm_lookup("cam_pwrdm"); - ? ? ? drv->safe_state_index = -1; ? ? ? ?dev = &per_cpu(omap3_idle_dev, smp_processor_id());
Quoted 4 lines
? ? ? ?/* C1 . MPU WFI + Core active */
- ? ? ?_fill_cstate(drv, 0, "MPU ON + CORE ON");
- ? ? ? (&drv->states[0])->enter =omap3_enter_idle;
- ? ? ?drv->safe_state_index= 0;
Same minor remark about the safe_state_index as in the previous series.
Quoted 35 lines
? ? ? ?cx =
_fill_cstate_usage(dev, 0);
? ? ? ?cx->valid = 1; ?/* C1 is always valid */
? ? ? ?cx->mpu_state =PWRDM_POWER_ON;
? ? ? ?cx->core_state =PWRDM_POWER_ON;? ? ? ?/* C2 . MPU WFI + Core inactive */
- ? ? ?_fill_cstate(drv, 1, "MPU ON + CORE ON");
? ? ? ?cx =_fill_cstate_usage(dev, 1);
? ? ? ?cx->mpu_state =PWRDM_POWER_ON;
? ? ? ?cx->core_state =PWRDM_POWER_ON;? ? ? ?/* C3 . MPU CSWR + Core inactive */
- ? ? ?_fill_cstate(drv, 2, "MPU RET + CORE ON"); ? ? ? ?cx =_fill_cstate_usage(dev, 2);
? ? ? ?cx->mpu_state =PWRDM_POWER_RET;
? ? ? ?cx->core_state =PWRDM_POWER_ON;? ? ? ?/* C4 . MPU OFF + Core inactive */
- ? ? ?_fill_cstate(drv, 3, "MPU OFF + CORE ON"); ? ? ? ?cx =_fill_cstate_usage(dev, 3);
? ? ? ?cx->mpu_state =PWRDM_POWER_OFF;
? ? ? ?cx->core_state =PWRDM_POWER_ON;? ? ? ?/* C5 . MPU RET + Core RET */
- ? ? ?_fill_cstate(drv, 4, "MPU RET + CORE RET"); ? ? ? ?cx =_fill_cstate_usage(dev, 4);
? ? ? ?cx->mpu_state =PWRDM_POWER_RET;
? ? ? ?cx->core_state =PWRDM_POWER_RET;? ? ? ?/* C6 . MPU OFF + Core RET */
- ? ? ?_fill_cstate(drv, 5, "MPU OFF + CORE RET"); ? ? ? ?cx =_fill_cstate_usage(dev, 5);
? ? ? ?cx->mpu_state =PWRDM_POWER_OFF;
? ? ? ?cx->core_state =PWRDM_POWER_RET;
Quoted 5 lines
? ? ? ?/* C7 . MPU OFF + Core OFF */
- ? ? ?_fill_cstate(drv, 6, "MPU OFF + CORE OFF");
? ? ? ?cx =_fill_cstate_usage(dev, 6);
? ? ? ?/*
? ? ? ? * Erratum i583: implementation for ES rev < Es1.2 on 3630. We cannot
C7 is enabled only if the errata does not apply.
This causes a problem with the statically defined C-states and also with the per C-state sysfs disable knob. A consistency check should be performed before trying to enter a state.
Quoted 11 lines
arch/arm/mach-omap2/cpuidle34xx.c +0
-2@@ -338,7 +372,6 @@ int __init omap3_idle_init(void) ? ? ? ?drv->state_count = OMAP3_NUM_STATES; ? ? ? ?cpuidle_register_driver(&omap3_idle_driver); - ? ? ? dev->state_count = OMAP3_NUM_STATES; ? ? ? ?if (cpuidle_register_device(dev)) { ? ? ? ? ? ? ? ?printk(KERN_ERR "%s: CPUidle register device failed\n", ? ? ? ? ? ? ? ? ? ? ? __func__); --1.7.5.4
Thanks!
Jean
RFC PATCH 4/9 ARM: OMAP3: define cpuidle statically
Quoted 6 lines · Jean Pihet
Quoted 4 lines · Daniel Lezcano
Use the new cpuidle API and define in the driver the states.
Signed-off-by Daniel Lezcano<[email protected]>---
[ ... ]
Quoted 6 lines
Quoted 2 lines
/*
* Erratum i583: implementation for ES rev< Es1.2 on 3630. We cannotC7 is enabled only if the errata does not apply.
This causes a problem with the statically defined C-states and also with the per C-state sysfs disable knob. A consistency check should be performed before trying to enter a state.
In the patch 5/9, I decrement the state_count if the errata applies. I believe it is still compatible with the static C-states.
Quoted 14 lines
Quoted 11 lines
arch/arm/mach-omap2/cpuidle34xx.c +0
-2@@ -338,7 +372,6 @@ int __init omap3_idle_init(void) drv->state_count =OMAP3_NUM_STATES ;cpuidle_register_driver (&omap3_idle_driver); - dev->state_count =OMAP3_NUM_STATES ;if (cpuidle_register_device (dev)) {printk (KERN_ERR "%s: CPUidle register device failed\n" , __func__); --1.7.5.4
Thanks!
Jean
Signature · 5 lines
<http://www.linaro.org/> Linaro.org ? Open source software for ARM SoCs Follow Linaro: <http://www.facebook.com/pages/Linaro> Facebook | <http://twitter.com/#!/linaroorg> Twitter | <http://www.linaro.org/linaro-blog/> Blog
RFC PATCH 4/9 ARM: OMAP3: define cpuidle statically
Quoted 18 lines · Daniel Lezcano
Quoted 8 lines · Jean Pihet
Quoted 5 lines · On Fri, Mar 23, 2012 at 10:26 AM, Daniel Lezcano <[email protected]>…
Use the new cpuidle API and define in the driver the states.
Signed-off-by Daniel Lezcano<[email protected]>---
[ ... ]
Quoted 4 lines
Quoted 3 lines
? ? ? ?/*
? ? ? ? * Erratum i583: implementation for ES rev< ?Es1.2 on 3630. We cannot
Quoted 8 lines
Quoted 4 lines
C7 is enabled only if the errata does not apply.
This causes a problem with the statically defined C-states and also with the per C-state sysfs disable knob. A consistency check should be performed before trying to enter a state.In the patch 5/9, I decrement the
state_countif the errata applies. I believe it is still compatible with the static C-states.
Correct! That solves the issue with the statically defined C-states. The (dynamic) per C-state sysfs disable knob requires a runtime check on .disable though, in case the cpuidle chosen C-state is demoted (depending on the value of enable_off_mode and later the latency constraints on the power domain).
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
(quoted diff) +0
-0@@ -338,7 +372,6 @@ int __init omap3_idle_init(void) ? ? ? ?drv->state_count = OMAP3_NUM_STATES; ? ? ? ?cpuidle_register_driver(&omap3_idle_driver);
Quoted 8 lines
Quoted 8 lines
Quoted 7 lines
(quoted diff) +0
-2- ? ? ? dev->state_count = OMAP3_NUM_STATES; ? ? ? ?if (cpuidle_register_device(dev)) { ? ? ? ? ? ? ? ?printk(KERN_ERR "%s: CPUidle register device failed\n", ? ? ? ? ? ? ? ? ? ? ? __func__); --1.7.5.4
Thanks!
Jean
Quoted 10 lines
--
?<http://www.linaro.org/> Linaro.org ? Open source software for ARM SoCsFollow Linaro: ?<http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog
RFC PATCH 5/9 ARM: OMAP3: cpuidle - remove the 'valid' field
In reply to Daniel LezcanoWith the previous changes all the states are valid, except the last state which can be handled by decreasing the number of states.
--- arch/arm/mach-omap2/cpuidle34xx.c | 6 +----- 1 files changed, 1 insertions(+), 5 deletions(-)
arch/arm/mach-omap2/cpuidle34xx.c +1 -5
@@ -67,7 +67,6 @@ static struct cpuidle_params cpuidle_params_table[] = {struct omap3_idle_statedata {u32 mpu_state;u32 core_state; -u8 valid; };struct omap3_idle_statedata omap3_idle_data[OMAP3_NUM_STATES ];
@@ -297,7 +296,6 @@ static inline struct omap3_idle_statedata *_fill_cstate_usage(struct omap3_idle_statedata *cx = &omap3_idle_data[idx];struct cpuidle_state_usage *state_usage = &dev->states_usage[idx]; - cx->valid = cpuidle_params_table[idx].valid;cpuidle_set_statedata (state_usage, cx);return cx;
@@ -325,7 +323,6 @@ int __init omap3_idle_init(void)/* C1 . MPU WFI + Core active */ cx =_fill_cstate_usage (dev,0 ); - cx->valid =1 ;/* C1 is always valid */ cx->mpu_state =PWRDM_POWER_ON ; cx->core_state =PWRDM_POWER_ON ;
@@ -362,14 +359,13 @@ int __init omap3_idle_init(void)* We disable C7 state as a result. */ if (IS_PM34XX_ERRATUM (PM_SDRC_WAKEUP_ERRATUM_i583)) { - cx->valid =0 ; + drv->state_count =OMAP3_NUM_STATES -1 ;pr_warn ("%s: core off state C7 disabled due to i583\n" , __func__); } cx->mpu_state =PWRDM_POWER_OFF ; cx->core_state =PWRDM_POWER_OFF ; - drv->state_count =OMAP3_NUM_STATES ;cpuidle_register_driver (&omap3_idle_driver);if (cpuidle_register_device (dev)) {
Signature · 1 line
1.7.5.4
RFC PATCH 6/9 ARM: OMAP3: cpuidle - remove cpuidle_params_table
In reply to Daniel LezcanoWe do not longer need the ''cpuidle_params_table' array as we defined the states in the driver and we checked they are all valid.
We also remove the structure definition as it is no longer used.
--- arch/arm/mach-omap2/cpuidle34xx.c | 28 +++------------------------- arch/arm/mach-omap2/pm.h | 12 ------------ 2 files changed, 3 insertions(+), 37 deletions(-)
arch/arm/mach-omap2/cpuidle34xx.c +3 -25
@@ -38,36 +38,14 @@#ifdef CONFIG_CPU_IDLE -/* -* 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 ,1 }, -/* C2 */ - {10 +10 ,30 ,1 }, -/* C3 */ - {50 +50 ,300 ,1 }, -/* C4 */ - {1500 +1800 ,4000 ,1 }, -/* C5 */ - {2500 +7500 ,12000 ,1 }, -/* C6 */ - {3000 +8500 ,15000 ,1 }, -/* C7 */ - {10000 +30000 ,300000 ,1 }, -}; -#define OMAP3_NUM_STATES ARRAY_SIZE(cpuidle_params_table) -/* Mach specific information to be recorded in the C-state driver_data */ struct omap3_idle_statedata {u32 mpu_state;u32 core_state; }; + +#define OMAP3_NUM_STATES 7 +struct omap3_idle_statedata omap3_idle_data[OMAP3_NUM_STATES ];struct powerdomain *mpu_pd, *core_pd, *per_pd, *cam_pd;
arch/arm/mach-omap2/pm.h +0 -12
@@ -25,18 +25,6 @@ extern int omap4_idle_init(void);extern int omap_pm_clkdms_setup (struct clockdomain *clkdm,void *unused);extern int (*omap_pm_suspend)(void ); -/* -* cpuidle mach specific parameters -* -* The board code can override the default C-states definition using -* omap3_pm_init_cpuidle -*/ -struct cpuidle_params { -u32 exit_latency;/* exit_latency = sleep + wake-up latencies */ -u32 target_residency; -u8 valid;/* validates the C-state */ -}; -#if defined(CONFIG_PM_OPP )extern int omap3_opp_init (void );extern int omap4_opp_init (void );
Signature · 1 line
1.7.5.4
RFC PATCH 7/9 ARM: OMAP3: define statically the omap3_idle_data
In reply to Daniel Lezcano--- arch/arm/mach-omap2/cpuidle34xx.c | 31 ++++++++++++++++++++++++++++++- 1 files changed, 30 insertions(+), 1 deletions(-)
arch/arm/mach-omap2/cpuidle34xx.c +30 -1
@@ -46,7 +46,36 @@ struct omap3_idle_statedata {#define OMAP3_NUM_STATES 7 -struct omap3_idle_statedata omap3_idle_data[OMAP3_NUM_STATES ]; +struct omap3_idle_statedata omap3_idle_data[OMAP3_NUM_STATES ] = { + { + .mpu_state =PWRDM_POWER_ON , + .core_state =PWRDM_POWER_ON , + }, + { + .mpu_state =PWRDM_POWER_ON , + .core_state =PWRDM_POWER_ON , + }, + { + .mpu_state =PWRDM_POWER_RET , + .core_state =PWRDM_POWER_ON , + }, + { + .mpu_state =PWRDM_POWER_OFF , + .core_state =PWRDM_POWER_ON , + }, + { + .mpu_state =PWRDM_POWER_RET , + .core_state =PWRDM_POWER_RET , + }, + { + .mpu_state =PWRDM_POWER_OFF , + .core_state =PWRDM_POWER_RET , + }, + { + .mpu_state =PWRDM_POWER_OFF , + .core_state =PWRDM_POWER_OFF , + }, +};struct powerdomain *mpu_pd, *core_pd, *per_pd, *cam_pd;
Signature · 1 line
1.7.5.4
RFC PATCH 8/9 ARM: OMAP3: cpuidle - use omap3_idle_data directly
In reply to Daniel LezcanoWe are storing the 'omap3_idle_data' in the private data field if the cpuidle device. As we are using this variable only in this file, that does not really make sense. Let's use the global variable directly instead dereferencing pointers in an idle critical loop.
As the table is initialized statically, let's remove the initialization at startup too.
Also, that simplfies the code.
--- arch/arm/mach-omap2/cpuidle34xx.c | 60 ++++--------------------------------- 1 files changed, 6 insertions(+), 54 deletions(-)
arch/arm/mach-omap2/cpuidle34xx.c +6 -54
@@ -106,8 +106,7 @@ static int omap3_enter_idle(struct cpuidle_device *dev, struct cpuidle_driver *drv, int index) { -struct omap3_idle_statedata *cx = -cpuidle_get_statedata (&dev->states_usage[index]); +struct omap3_idle_statedata *cx = &omap3_idle_data[index];struct timespec ts_preidle, ts_postidle, ts_idle;u32 mpu_state = cx->mpu_state, core_state = cx->core_state;int idle_time;
@@ -208,7 +207,7 @@ static int omap3_enter_idle_bm(struct cpuidle_device *dev,* Prevent PER off if CORE is not in retention or off as this * would disable PER wakeups completely. */ - cx =cpuidle_get_statedata (&dev->states_usage[index]); + cx = &omap3_idle_data[index]; core_next_state = cx->core_state; per_next_state = per_saved_state =pwrdm_read_next_pwrst (per_pd); if ((per_next_state == PWRDM_POWER_OFF) &&
@@ -295,19 +294,6 @@ struct cpuidle_driver omap3_idle_driver = { .state_count = OMAP3_NUM_STATES, }; -/* Helper to register the driver_data */ -static inline struct omap3_idle_statedata *_fill_cstate_usage ( -struct cpuidle_device *dev, -int idx) -{ -struct omap3_idle_statedata *cx = &omap3_idle_data[idx]; -struct cpuidle_state_usage *state_usage = &dev->states_usage[idx]; - -cpuidle_set_statedata (state_usage, cx); - -return cx; -} -/** * omap3_idle_init - Init routine for OMAP3 idle *
@@ -318,48 +304,12 @@ int __init omap3_idle_init(void) {struct cpuidle_device *dev;struct cpuidle_driver *drv = &omap3_idle_driver; -struct omap3_idle_statedata *cx; mpu_pd =pwrdm_lookup ("mpu_pwrdm" ); core_pd =pwrdm_lookup ("core_pwrdm" ); per_pd =pwrdm_lookup ("per_pwrdm" ); cam_pd =pwrdm_lookup ("cam_pwrdm" ); - - dev = &per_cpu (omap3_idle_dev,smp_processor_id ()); - -/* C1 . MPU WFI + Core active */ - cx =_fill_cstate_usage (dev,0 ); - cx->mpu_state =PWRDM_POWER_ON ; - cx->core_state =PWRDM_POWER_ON ; - -/* C2 . MPU WFI + Core inactive */ - cx =_fill_cstate_usage (dev,1 ); - cx->mpu_state =PWRDM_POWER_ON ; - cx->core_state =PWRDM_POWER_ON ; - -/* C3 . MPU CSWR + Core inactive */ - cx =_fill_cstate_usage (dev,2 ); - cx->mpu_state =PWRDM_POWER_RET ; - cx->core_state =PWRDM_POWER_ON ; - -/* C4 . MPU OFF + Core inactive */ - cx =_fill_cstate_usage (dev,3 ); - cx->mpu_state =PWRDM_POWER_OFF ; - cx->core_state =PWRDM_POWER_ON ; - -/* C5 . MPU RET + Core RET */ - cx =_fill_cstate_usage (dev,4 ); - cx->mpu_state =PWRDM_POWER_RET ; - cx->core_state =PWRDM_POWER_RET ; - -/* C6 . MPU OFF + Core RET */ - cx =_fill_cstate_usage (dev,5 ); - cx->mpu_state =PWRDM_POWER_OFF ; - cx->core_state =PWRDM_POWER_RET ; - -/* C7 . MPU OFF + Core OFF */ - cx =_fill_cstate_usage (dev,6 );/* * Erratum i583: implementation for ES rev < Es1.2 on 3630. We cannot * enable OFF mode in a stable form for previous revisions.
@@ -370,11 +320,13 @@ int __init omap3_idle_init(void)pr_warn ("%s: core off state C7 disabled due to i583\n" , __func__); } - cx->mpu_state =PWRDM_POWER_OFF ; - cx->core_state =PWRDM_POWER_OFF ;cpuidle_register_driver (&omap3_idle_driver); + dev = &per_cpu (omap3_idle_dev,smp_processor_id ()); + dev->cpu =0 ; + dev->state_count = drv->state_count; +if (cpuidle_register_device (dev)) {printk (KERN_ERR "%s: CPUidle register device failed\n" , __func__);
Signature · 1 line
1.7.5.4
RFC PATCH 9/9 ARM: OMAP3/4: consolidate cpuidle Makefile
In reply to Daniel Lezcano--- arch/arm/mach-omap2/Makefile | 11 +++++++---- arch/arm/mach-omap2/cpuidle34xx.c | 8 -------- arch/arm/mach-omap2/cpuidle44xx.c | 8 -------- arch/arm/mach-omap2/pm.h | 17 +++++++++++++++-- 4 files changed, 22 insertions(+), 22 deletions(-)
arch/arm/mach-omap2/Makefile +7 -4
@@ -63,10 +63,8 @@ endif ifeq ($(CONFIG_PM),y) obj-$(CONFIG_ARCH_OMAP2) += pm24xx.o obj-$(CONFIG_ARCH_OMAP2) += sleep24xx.o -obj-$(CONFIG_ARCH_OMAP3) += pm34xx.o sleep34xx.o \ - cpuidle34xx.o -obj-$(CONFIG_ARCH_OMAP4) += pm44xx.o omap-mpuss-lowpower.o \ - cpuidle44xx.o +obj-$(CONFIG_ARCH_OMAP3) += pm34xx.o sleep34xx.o +obj-$(CONFIG_ARCH_OMAP4) += pm44xx.o omap-mpuss-lowpower.o obj-$(CONFIG_PM_DEBUG) += pm-debug.o obj-$(CONFIG_OMAP_SMARTREFLEX) += sr_device.o smartreflex.o obj-$(CONFIG_OMAP_SMARTREFLEX_CLASS3) += smartreflex-class3.o
@@ -80,6 +78,11 @@ endif endif +ifeq ($(CONFIG_CPU_IDLE),y) +obj-$(CONFIG_ARCH_OMAP3) += cpuidle34xx.o +obj-$(CONFIG_ARCH_OMAP4) += cpuidle44xx.o +endif + # PRCM obj-y += prm_common.o obj-$(CONFIG_ARCH_OMAP2) += prcm.o cm2xxx_3xxx.o prm2xxx_3xxx.o
arch/arm/mach-omap2/cpuidle34xx.c +0 -8
@@ -36,8 +36,6 @@#include "control.h" #include "common.h" -#ifdef CONFIG_CPU_IDLE -/* Mach specific information to be recorded in the C-state driver_data */ struct omap3_idle_statedata {u32 mpu_state;
@@ -335,9 +333,3 @@ int __init omap3_idle_init(void)return 0 ; } -#else -int __init omap3_idle_init (void ) -{ -return 0 ; -} -#endif /* CONFIG_CPU_IDLE */
arch/arm/mach-omap2/cpuidle44xx.c +0 -8
@@ -22,8 +22,6 @@#include "pm.h" #include "prm.h" -#ifdef CONFIG_CPU_IDLE -/* Machine specific information */ struct omap4_idle_statedata {u32 cpu_state;
@@ -219,9 +217,3 @@ int __init omap4_idle_init(void)return 0 ; } -#else -int __init omap4_idle_init (void ) -{ -return 0 ; -} -#endif /* CONFIG_CPU_IDLE */
arch/arm/mach-omap2/pm.h +15 -2
@@ -15,13 +15,26 @@#include "powerdomain.h" +#ifdef CONFIG_CPU_IDLE +extern int omap3_idle_init (void ); +extern int omap4_idle_init (void ); +#else +static inline int omap3_idle_init (void ) +{ +return 0 ; +} + +static inline int omap4_idle_init (void ) +{ +return 0 ; +} +#endif +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 omap_set_pwrdm_state (struct powerdomain *pwrdm,u32 state); -extern int omap3_idle_init (void ); -extern int omap4_idle_init (void );extern int omap_pm_clkdms_setup (struct clockdomain *clkdm,void *unused);extern int (*omap_pm_suspend)(void );
Signature · 1 line
1.7.5.4