ARM: OMAP3/4 : cpuidle34xx and cpuidle44xx cleanups
v3 cover ARM: OMAP3/4 : cpuidle34xx and cpuidle44xx cleanups
This patchset makes some cleanup on these cpuidle drivers and consolidate the code across both architecture.
Tested on OMAP3 (igepV2).
Partially tested on OMAP4 (pandaboard), without offlining the cpu1.
V3 :
* replace OMAP4_NUM_STATES and OMAP3_NUM_STATES by ARRAY_SIZE
* Fixed changelog
* Fixed OMAP4_NUM_STATES going back and forth in the patchset
* Removed erratum check at init time
V2 :
* Fixed a couple of typos in the patch description
V1 : Initial Post
Daniel Lezcano (18):
ARM: OMAP4: cpuidle - Remove unused valid field
ARM: OMAP4: cpuidle - Declare the states with the driver declaration
ARM: OMAP4: cpuidle - Remove the cpuidle_params_table table
ARM: OMAP4: cpuidle - fix static omap4_idle_data declaration
ARM: OMAP4: cpuidle - Initialize omap4_idle_data at compile time
ARM: OMAP4: cpuidle - use the omap4_idle_data variable directly
ARM: OMAP4: cpuidle - remove omap4_idle_data initialization at boot
time
ARM: OMAP3: cpuidle - remove rx51 cpuidle parameters table
ARM: OMAP3: define cpuidle statically
ARM: OMAP3: cpuidle - remove errata check in the init function
ARM: OMAP3: cpuidle - remove the 'valid' field
ARM: OMAP3: cpuidle - remove cpuidle_params_table
ARM: OMAP3: define statically the omap3_idle_data
ARM: OMAP3: cpuidle - use omap3_idle_data directly
ARM: OMAP3: cpuidle - simplify next_valid_state
ARM: OMAP3: set omap3_idle_data as static
ARM: OMAP3/4: consolidate cpuidle Makefile
ARM: OMAP3: cpuidle - set global variables static
arch/arm/mach-omap2/Makefile | 11 +- arch/arm/mach-omap2/board-rx51.c | 38 +++--- arch/arm/mach-omap2/cpuidle34xx.c | 306 +++++++++++++++---------------------- arch/arm/mach-omap2/cpuidle44xx.c | 134 +++++++---------- arch/arm/mach-omap2/pm.h | 38 ++--- 5 files changed, 212 insertions(+), 315 deletions(-)
Signature · 1 line
1.7.5.4
PATCH v3 1/18 ARM: OMAP4: cpuidle - Remove unused valid field
The 'valid' field is never used in the code, let's remove it.
--- arch/arm/mach-omap2/cpuidle44xx.c | 9 +++------ 1 files changed, 3 insertions(+), 6 deletions(-)
arch/arm/mach-omap2/cpuidle44xx.c +3 -6
@@ -29,16 +29,15 @@ struct omap4_idle_statedata {u32 cpu_state;u32 mpu_logic_state;u32 mpu_state; -u8 valid; };static struct cpuidle_params cpuidle_params_table[] = {/* C1 - CPU0 ON + CPU1 ON + MPU ON */ - {.exit_latency =2 +2 , .target_residency =5 , .valid =1 }, + {.exit_latency =2 +2 , .target_residency =5 },/* C2- CPU0 OFF + CPU1 OFF + MPU CSWR */ - {.exit_latency =328 +440 , .target_residency =960 , .valid =1 }, + {.exit_latency =328 +440 , .target_residency =960 },/* C3 - CPU0 OFF + CPU1 OFF + MPU OSWR */ - {.exit_latency =460 +518 , .target_residency =1100 , .valid =1 }, + {.exit_latency =460 +518 , .target_residency =1100 }, };#define OMAP4_NUM_STATES ARRAY_SIZE(cpuidle_params_table)
@@ -155,7 +154,6 @@ static inline struct omap4_idle_statedata *_fill_cstate_usage(struct omap4_idle_statedata *cx = &omap4_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;
@@ -191,7 +189,6 @@ int __init omap4_idle_init(void)_fill_cstate (drv,0 ,"MPUSS ON" ); drv->safe_state_index =0 ; cx =_fill_cstate_usage (dev,0 ); - cx->valid =1 ;/* C1 is always valid */ cx->cpu_state =PWRDM_POWER_ON ; cx->mpu_state =PWRDM_POWER_ON ; cx->mpu_logic_state =PWRDM_POWER_RET ;
Signature · 1 line
1.7.5.4
PATCH v3 2/18 ARM: OMAP4: cpuidle - Declare the states with the driver declaration
In reply to Daniel LezcanoThe cpuidle API allows to declare statically the states in the driver structure. Let's use it.
We do no longer need the fill_cstate function called at runtime and by the way adding more instructions at boot time.
--- arch/arm/mach-omap2/cpuidle44xx.c | 60 ++++++++++++++++++++---------------- 1 files changed, 33 insertions(+), 27 deletions(-)
arch/arm/mach-omap2/cpuidle44xx.c +33 -27
@@ -132,21 +132,39 @@ struct cpuidle_driver omap4_idle_driver = { .name = "omap4_idle", .owner = THIS_MODULE, .en_core_tk_irqen = 1, + .states = { + { + /* C1 - CPU0 ON + CPU1 ON + MPU ON */ + .exit_latency = 2 + 2, + .target_residency = 5, + .flags = CPUIDLE_FLAG_TIME_VALID, + .enter = omap4_enter_idle, + .name = "C1", + .desc = "MPUSS ON" + }, + { + /* C2 - CPU0 OFF + CPU1 OFF + MPU CSWR */ + .exit_latency = 328 + 440, + .target_residency = 960, + .flags = CPUIDLE_FLAG_TIME_VALID, + .enter = omap4_enter_idle, + .name = "C2", + .desc = "MPUSS CSWR", + }, + { + /* C3 - CPU0 OFF + CPU1 OFF + MPU OSWR */ + .exit_latency = 460 + 518, + .target_residency = 1100, + .flags = CPUIDLE_FLAG_TIME_VALID, + .enter = omap4_enter_idle, + .name = "C3", + .desc = "MPUSS OSWR", + }, + }, + .state_count = OMAP4_NUM_STATES, + .safe_state_index = 0, }; -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 = omap4_enter_idle; -sprintf (state->name,"C%d" , idx +1 ); -strncpy (state->desc, descr,CPUIDLE_DESC_LEN ); -} - static inline struct omap4_idle_statedata *_fill_cstate_usage( struct cpuidle_device *dev, int idx)
@@ -171,7 +189,6 @@ int __init omap4_idle_init(void) {struct omap4_idle_statedata *cx;struct cpuidle_device *dev; -struct cpuidle_driver *drv = &omap4_idle_driver;unsigned int cpu_id =0 ; mpu_pd =pwrdm_lookup ("mpu_pwrdm" );
@@ -180,41 +197,30 @@ int __init omap4_idle_init(void)if ((!mpu_pd) || (!cpu0_pd) || (!cpu1_pd))return -ENODEV ; - - drv->safe_state_index =-1 ; dev = &per_cpu (omap4_idle_dev, cpu_id); dev->cpu = cpu_id; -/* C1 - CPU0 ON + CPU1 ON + MPU ON */ -_fill_cstate (drv,0 ,"MPUSS ON" ); - drv->safe_state_index =0 ; cx =_fill_cstate_usage (dev,0 ); cx->cpu_state =PWRDM_POWER_ON ; cx->mpu_state =PWRDM_POWER_ON ; cx->mpu_logic_state =PWRDM_POWER_RET ; -/* C2 - CPU0 OFF + CPU1 OFF + MPU CSWR */ -_fill_cstate (drv,1 ,"MPUSS CSWR" ); cx =_fill_cstate_usage (dev,1 ); cx->cpu_state =PWRDM_POWER_OFF ; cx->mpu_state =PWRDM_POWER_RET ; cx->mpu_logic_state =PWRDM_POWER_RET ; -/* C3 - CPU0 OFF + CPU1 OFF + MPU OSWR */ -_fill_cstate (drv,2 ,"MPUSS OSWR" ); cx =_fill_cstate_usage (dev,2 ); cx->cpu_state =PWRDM_POWER_OFF ; cx->mpu_state =PWRDM_POWER_RET ; cx->mpu_logic_state =PWRDM_POWER_OFF ; - drv->state_count =OMAP4_NUM_STATES ;cpuidle_register_driver (&omap4_idle_driver); - dev->state_count =OMAP4_NUM_STATES ;if (cpuidle_register_device (dev)) {pr_err ("%s: CPUidle register device failed\n" , __func__); -return -EIO ; - } +return -EIO ; + }return 0 ; }
Signature · 1 line
1.7.5.4
PATCH v3 3/18 ARM: OMAP4: cpuidle - Remove the cpuidle_params_table table
In reply to Daniel LezcanoWe do not longer need this table as we defined the values in the driver states.
--- arch/arm/mach-omap2/cpuidle44xx.c | 11 +---------- 1 files changed, 1 insertions(+), 10 deletions(-)
arch/arm/mach-omap2/cpuidle44xx.c +1 -10
@@ -31,16 +31,7 @@ struct omap4_idle_statedata {u32 mpu_state; }; -static struct cpuidle_params cpuidle_params_table[] = { -/* C1 - CPU0 ON + CPU1 ON + MPU ON */ - {.exit_latency =2 +2 , .target_residency =5 }, -/* C2- CPU0 OFF + CPU1 OFF + MPU CSWR */ - {.exit_latency =328 +440 , .target_residency =960 }, -/* C3 - CPU0 OFF + CPU1 OFF + MPU OSWR */ - {.exit_latency =460 +518 , .target_residency =1100 }, -}; - -#define OMAP4_NUM_STATES ARRAY_SIZE(cpuidle_params_table) +#define OMAP4_NUM_STATES 3struct omap4_idle_statedata omap4_idle_data[OMAP4_NUM_STATES ];static struct powerdomain *mpu_pd, *cpu0_pd, *cpu1_pd;
Signature · 1 line
1.7.5.4
PATCH v3 4/18 ARM: OMAP4: cpuidle - fix static omap4_idle_data declaration
In reply to Daniel LezcanoAdd the static declaration for the omap4_idle_data variable because its scope is in the file only.
--- arch/arm/mach-omap2/cpuidle44xx.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
arch/arm/mach-omap2/cpuidle44xx.c +1 -1
@@ -33,7 +33,7 @@ struct omap4_idle_statedata {#define OMAP4_NUM_STATES 3 -struct omap4_idle_statedata omap4_idle_data[OMAP4_NUM_STATES ]; +static struct omap4_idle_statedata omap4_idle_data[OMAP4_NUM_STATES ];static struct powerdomain *mpu_pd, *cpu0_pd, *cpu1_pd;/**
Signature · 1 line
1.7.5.4
PATCH v3 5/18 ARM: OMAP4: cpuidle - Initialize omap4_idle_data at compile time
In reply to Daniel LezcanoWe initialize the omap4_idle_data variable at compile time allowing us to remove in the next patch the initialization done at boot time.
--- arch/arm/mach-omap2/cpuidle44xx.c | 21 ++++++++++++++++++--- 1 files changed, 18 insertions(+), 3 deletions(-)
arch/arm/mach-omap2/cpuidle44xx.c +18 -3
@@ -31,9 +31,24 @@ struct omap4_idle_statedata {u32 mpu_state; }; -#define OMAP4_NUM_STATES 3 +static struct omap4_idle_statedata omap4_idle_data[] = { + { + .cpu_state =PWRDM_POWER_ON , + .mpu_state =PWRDM_POWER_ON , + .mpu_logic_state =PWRDM_POWER_RET , + }, + { + .cpu_state =PWRDM_POWER_OFF , + .mpu_state =PWRDM_POWER_RET , + .mpu_logic_state =PWRDM_POWER_RET , + }, + { + .cpu_state =PWRDM_POWER_OFF , + .mpu_state =PWRDM_POWER_RET , + .mpu_logic_state =PWRDM_POWER_OFF , + }, +}; -static struct omap4_idle_statedata omap4_idle_data[OMAP4_NUM_STATES ];static struct powerdomain *mpu_pd, *cpu0_pd, *cpu1_pd;/**
@@ -152,7 +167,7 @@ struct cpuidle_driver omap4_idle_driver = { .desc = "MPUSS OSWR", }, }, - .state_count = OMAP4_NUM_STATES, + .state_count = ARRAY_SIZE(omap4_idle_data), .safe_state_index = 0, };
Signature · 1 line
1.7.5.4
PATCH v3 6/18 ARM: OMAP4: cpuidle - use the omap4_idle_data variable directly
In reply to Daniel LezcanoWe are storing the 'omap4_idle_data' in the private data field of 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.
--- arch/arm/mach-omap2/cpuidle44xx.c | 13 +++---------- 1 files changed, 3 insertions(+), 10 deletions(-)
arch/arm/mach-omap2/cpuidle44xx.c +3 -10
@@ -24,7 +24,7 @@ #ifdef CONFIG_CPU_IDLE -/* Machine specific information to be recorded in the C-state driver_data */ +/* Machine specific information */ struct omap4_idle_statedata { u32 cpu_state; u32 mpu_logic_state;
@@ -65,8 +65,7 @@ static int omap4_enter_idle(struct cpuidle_device *dev, struct cpuidle_driver *drv, int index) { -struct omap4_idle_statedata *cx = -cpuidle_get_statedata (&dev->states_usage[index]); +struct omap4_idle_statedata *cx = &omap4_idle_data[index];u32 cpu1_state;int cpu_id =smp_processor_id ();
@@ -83,7 +82,7 @@ static int omap4_enter_idle(struct cpuidle_device *dev, cpu1_state =pwrdm_read_pwrst (cpu1_pd);if (cpu1_state !=PWRDM_POWER_OFF ) { index = drv->safe_state_index; - cx =cpuidle_get_statedata (&dev->states_usage[index]); + cx = &omap4_idle_data[index]; }if (index >0 )
@@ -176,15 +175,9 @@ static inline struct omap4_idle_statedata *_fill_cstate_usage( int idx) {struct omap4_idle_statedata *cx = &omap4_idle_data[idx]; -struct cpuidle_state_usage *state_usage = &dev->states_usage[idx]; - -cpuidle_set_statedata (state_usage, cx); -return cx; } - -/** * omap4_idle_init - Init routine for OMAP4 idle *
Signature · 1 line
1.7.5.4
PATCH v3 7/18 ARM: OMAP4: cpuidle - remove omap4_idle_data initialization at boot time
In reply to Daniel LezcanoWe initialized it at compile time, no need to do that at boot time.
--- arch/arm/mach-omap2/cpuidle44xx.c | 24 ------------------------ 1 files changed, 0 insertions(+), 24 deletions(-)
arch/arm/mach-omap2/cpuidle44xx.c +0 -24
@@ -170,14 +170,6 @@ struct cpuidle_driver omap4_idle_driver = { .safe_state_index = 0, }; -static inline struct omap4_idle_statedata *_fill_cstate_usage ( -struct cpuidle_device *dev, -int idx) -{ -struct omap4_idle_statedata *cx = &omap4_idle_data[idx]; -return cx; -} -/** * omap4_idle_init - Init routine for OMAP4 idle *
@@ -186,7 +178,6 @@ static inline struct omap4_idle_statedata *_fill_cstate_usage(*/ int __init omap4_idle_init (void ) { -struct omap4_idle_statedata *cx;struct cpuidle_device *dev;unsigned int cpu_id =0 ;
@@ -199,21 +190,6 @@ int __init omap4_idle_init(void) dev = &per_cpu (omap4_idle_dev, cpu_id); dev->cpu = cpu_id; - cx =_fill_cstate_usage (dev,0 ); - cx->cpu_state =PWRDM_POWER_ON ; - cx->mpu_state =PWRDM_POWER_ON ; - cx->mpu_logic_state =PWRDM_POWER_RET ; - - cx =_fill_cstate_usage (dev,1 ); - cx->cpu_state =PWRDM_POWER_OFF ; - cx->mpu_state =PWRDM_POWER_RET ; - cx->mpu_logic_state =PWRDM_POWER_RET ; - - cx =_fill_cstate_usage (dev,2 ); - cx->cpu_state =PWRDM_POWER_OFF ; - cx->mpu_state =PWRDM_POWER_RET ; - cx->mpu_logic_state =PWRDM_POWER_OFF ; -cpuidle_register_driver (&omap4_idle_driver);if (cpuidle_register_device (dev)) {
Signature · 1 line
1.7.5.4
PATCH v3 8/18 ARM: OMAP3: cpuidle - remove rx51 cpuidle parameters table
In reply to Daniel LezcanoAs 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
@@ -298,23 +298,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
@@ -50,15 +50,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
PATCH v3 9/18 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 | 86 +++++++++++++++++++++++++----------- 1 files changed, 60 insertions(+), 26 deletions(-)
arch/arm/mach-omap2/cpuidle34xx.c +60 -26
@@ -301,23 +301,68 @@ 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 , + .safe_state_index =0 , }; -/* 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,
@@ -350,50 +395,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
@@ -411,7 +446,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
PATCH v3 10/18 ARM: OMAP3: cpuidle - remove errata check in the init function
In reply to Daniel LezcanoThe errata check is done in the next_valid_state function, no need to check that in the omap3_idle_init function.
--- arch/arm/mach-omap2/cpuidle34xx.c | 10 ---------- 1 files changed, 0 insertions(+), 10 deletions(-)
arch/arm/mach-omap2/cpuidle34xx.c +0 -10
@@ -430,16 +430,6 @@ int __init omap3_idle_init(void)/* 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. -* We disable C7 state as a result. -*/ -if (IS_PM34XX_ERRATUM (PM_SDRC_WAKEUP_ERRATUM_i583)) { - cx->valid =0 ; -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 ;
Signature · 1 line
1.7.5.4
PATCH v3 11/18 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 | 11 ++--------- 1 files changed, 2 insertions(+), 9 deletions(-)
arch/arm/mach-omap2/cpuidle34xx.c +2 -9
@@ -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 ];
@@ -191,8 +190,7 @@ static int next_valid_state(struct cpuidle_device *dev, }/* Check if current state is valid */ -if ((cx->valid) && - (cx->mpu_state >= mpu_deepest_state) && +if ((cx->mpu_state >= mpu_deepest_state) && (cx->core_state >= core_deepest_state)) {return index; }else {
@@ -216,8 +214,7 @@ static int next_valid_state(struct cpuidle_device *dev, idx--;for (; idx >=0 ; idx--) { cx =cpuidle_get_statedata (&dev->states_usage[idx]); -if ((cx->valid) && - (cx->mpu_state >= mpu_deepest_state) && +if ((cx->mpu_state >= mpu_deepest_state) && (cx->core_state >= core_deepest_state)) { next_index = idx;break ;
@@ -371,7 +368,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;
@@ -386,7 +382,6 @@ static inline struct omap3_idle_statedata *_fill_cstate_usage(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" );
@@ -399,7 +394,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 ;
@@ -433,7 +427,6 @@ int __init omap3_idle_init(void) 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
PATCH v3 11/18 ARM: OMAP3: cpuidle - remove the 'valid' field
Quoted 3 lines · Daniel Lezcano
With the previous changes all the states are valid, except the last state which can be handled by decreasing the number of states.
I don't think this changelog is valid anymore as you're not doing anything to decrease the number of states.
I updated the changelog locally to this:
ARM: OMAP3: cpuidle - remove the 'valid' field
With the previous changes all the states are valid, except the last state which is now handled at runtime by next_valid_state() based on the errata flags.
Any problems with that?
Kevin
PATCH v3 11/18 ARM: OMAP3: cpuidle - remove the 'valid' field
Quoted 10 lines · Kevin Hilman
Quoted 3 lines · Daniel Lezcano
With the previous changes all the states are valid, except the last state which can be handled by decreasing the number of states.
I don't think this changelog is valid anymore as you're not doing anything to decrease the number of states.
I updated the changelog locally to this:
Quoted 7 lines
ARM: OMAP3: cpuidle - remove the 'valid' field
With the previous changes all the states are valid, except the last state which is now handled at runtime by
next_valid_state()based on the errata flags.Any problems with that?
No problem :)
Thanks for fixing the Changelog.
-- Daniel
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
PATCH v3 12/18 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
@@ -38,18 +38,6 @@ 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);
Signature · 1 line
1.7.5.4
PATCH v3 13/18 ARM: OMAP3: define statically the omap3_idle_data
In reply to Daniel LezcanoInitialize the omap3_idle_data array at compile time, that will allow to remove the initialization at boot time.
--- arch/arm/mach-omap2/cpuidle34xx.c | 37 ++++++++++++++++++++++++++++++++----- 1 files changed, 32 insertions(+), 5 deletions(-)
arch/arm/mach-omap2/cpuidle34xx.c +32 -5
@@ -44,9 +44,36 @@ struct omap3_idle_statedata {u32 core_state; }; -#define OMAP3_NUM_STATES 7 - -struct omap3_idle_statedata omap3_idle_data[OMAP3_NUM_STATES ]; +struct omap3_idle_statedata omap3_idle_data[] = { + { + .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;
@@ -172,7 +199,7 @@ static int next_valid_state(struct cpuidle_device *dev, (cx->core_state >= core_deepest_state)) { return index; } else { -int idx =OMAP3_NUM_STATES -1 ; +int idx =ARRAY_SIZE (omap3_idle_data) -1 ;/* Reach the current state starting at highest C-state */ for (; idx >=0 ; idx--) {
@@ -334,7 +361,7 @@ struct cpuidle_driver omap3_idle_driver = { .desc = "MPU OFF + CORE OFF", }, }, - .state_count = OMAP3_NUM_STATES, + .state_count = ARRAY_SIZE(omap3_idle_data), .safe_state_index = 0, };
Signature · 1 line
1.7.5.4
PATCH v3 14/18 ARM: OMAP3: cpuidle - use omap3_idle_data directly
In reply to Daniel LezcanoWe are storing the 'omap3_idle_data' in the private data field of 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.
As the table is initialized statically, let's remove the initialization at startup too.
--- arch/arm/mach-omap2/cpuidle34xx.c | 63 +++--------------------------------- 1 files changed, 6 insertions(+), 57 deletions(-)
arch/arm/mach-omap2/cpuidle34xx.c +6 -57
@@ -95,8 +95,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];u32 mpu_state = cx->mpu_state, core_state = cx->core_state;local_fiq_disable ();
@@ -176,9 +175,8 @@ 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); +struct omap3_idle_statedata *cx = &omap3_idle_data[index];u32 mpu_deepest_state =PWRDM_POWER_RET ;u32 core_deepest_state =PWRDM_POWER_RET ;int next_index =-1 ;
@@ -218,7 +216,7 @@ static int next_valid_state(struct cpuidle_device *dev,*/ idx--;for (; idx >=0 ; idx--) { - cx =cpuidle_get_statedata (&dev->states_usage[idx]); + cx = &omap3_idle_data[idx];if ((cx->mpu_state >= mpu_deepest_state) && (cx->core_state >= core_deepest_state)) { next_index = idx;
@@ -275,7 +273,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) &&
@@ -365,19 +363,6 @@ struct cpuidle_driver omap3_idle_driver = { .safe_state_index = 0, }; -/* 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 *
@@ -387,52 +372,16 @@ static inline struct omap3_idle_statedata *_fill_cstate_usage(int __init omap3_idle_init (void ) {struct cpuidle_device *dev; -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" ); +cpuidle_register_driver (&omap3_idle_driver); 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 ); - cx->mpu_state =PWRDM_POWER_OFF ; - cx->core_state =PWRDM_POWER_OFF ; - -cpuidle_register_driver (&omap3_idle_driver); + dev->cpu =0 ;if (cpuidle_register_device (dev)) { printk(KERN_ERR "%s: CPUidle register device failed\n",
Signature · 1 line
1.7.5.4
PATCH v3 15/18 ARM: OMAP3: cpuidle - simplify next_valid_state
In reply to Daniel LezcanoSimplify the indentation by removing the useless 'else' statement. Remove the first loop for the 'idx' search as we have it already with the 'index' passed as parameter.
--- arch/arm/mach-omap2/cpuidle34xx.c | 53 +++++++++++++----------------------- 1 files changed, 19 insertions(+), 34 deletions(-)
arch/arm/mach-omap2/cpuidle34xx.c +19 -34
@@ -172,13 +172,12 @@ static inline int omap3_enter_idle(struct cpuidle_device *dev,* 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_driver *drv,int index) { -struct cpuidle_state *curr = &drv->states[index];struct omap3_idle_statedata *cx = &omap3_idle_data[index];u32 mpu_deepest_state =PWRDM_POWER_RET ;u32 core_deepest_state =PWRDM_POWER_RET ; +int idx;int next_index =-1 ;if (enable_off_mode) {
@@ -194,42 +193,28 @@ static int next_valid_state(struct cpuidle_device *dev,/* Check if current state is valid */ if ((cx->mpu_state >= mpu_deepest_state) && - (cx->core_state >= core_deepest_state)) { + (cx->core_state >= core_deepest_state))return index; - }else { -int idx =ARRAY_SIZE (omap3_idle_data) -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 = &omap3_idle_data[idx]; -if ((cx->mpu_state >= mpu_deepest_state) && - (cx->core_state >= core_deepest_state)) { - next_index = idx; -break ; - } +/* +* Drop to next valid state. +* Start search from the next (lower) state. +*/ +for (idx = index -1 ; idx >=0 ; idx--) { + cx = &omap3_idle_data[idx]; +if ((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. -*/ } +/* +* C1 is always valid. +* So, no need to check for 'next_index == -1' outside +* this loop. +*/ +return next_index; }
Signature · 1 line
1.7.5.4
PATCH v3 16/18 ARM: OMAP3: set omap3_idle_data as static
In reply to Daniel LezcanoReduce the scope of the omap3_idle_data to the file as it is only used in cpuidle34xx.c.
--- arch/arm/mach-omap2/cpuidle34xx.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
arch/arm/mach-omap2/cpuidle34xx.c +1 -1
@@ -44,7 +44,7 @@ struct omap3_idle_statedata {u32 core_state; }; -struct omap3_idle_statedata omap3_idle_data[] = { +static struct omap3_idle_statedata omap3_idle_data[] = { { .mpu_state =PWRDM_POWER_ON , .core_state =PWRDM_POWER_ON ,
Signature · 1 line
1.7.5.4
PATCH v3 17/18 ARM: OMAP3/4: consolidate cpuidle Makefile
In reply to Daniel LezcanoDefine a CPU_IDLE section in the makefile, declare the functions in the header files conforming to the kernel coding rules and remove the 'define's in the C files.
--- 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
@@ -64,10 +64,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
@@ -81,6 +79,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;
@@ -376,9 +374,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;
@@ -199,9 +197,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,12 +15,25 @@#include "powerdomain.h" +#ifdef CONFIG_CPU_IDLE +extern int __init omap3_idle_init (void ); +extern int __init 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 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
PATCH v3 17/18 ARM: OMAP3/4: consolidate cpuidle Makefile
Quoted 6 lines · Daniel Lezcano
Define a
CPU_IDLEsection in the makefile, declare the functions in the header files conforming to the kernel coding rules and remove the 'define's in the C files.Signed-off-by Daniel Lezcano <[email protected]>Reviewed-by Jean Pihet <[email protected]>
This patch breaks compilation for the !CONFIG_PM case:
arch/arm/mach-omap2/built-in.o: In function `__omap3_enter_idle':
/work/kernel/omap/pm/arch/arm/mach-omap2/cpuidle34xx.c:121: undefined reference to `omap_sram_idle'
Since you moved this stuff out of a CONFIG_PM conditional part of the Makefile, it broke because pm34xx.c is still compiled conditionally on CONFIG_PM.
When changing Makefile/Kconfig dependencies like this, please be sure to at least compile test with the various options enabled/disabled.
For now, I've dropped this patch from the series. Feel free to update/retest/resend since the idea is fine.
Kevin
PATCH v3 17/18 ARM: OMAP3/4: consolidate cpuidle Makefile
Quoted 18 lines · Kevin Hilman
Quoted 6 lines · Daniel Lezcano
Define a
CPU_IDLEsection in the makefile, declare the functions in the header files conforming to the kernel coding rules and remove the 'define's in the C files.Signed-off-by Daniel Lezcano<[email protected]>Reviewed-by Jean Pihet<[email protected]>This patch breaks compilation for the !CONFIG_PM case:
arch/arm/mach-omap2/built-in.o: In function `__omap3_enter_idle':
/work/kernel/omap/pm/arch/arm/mach-omap2/cpuidle34xx.c:121: undefined reference to `omap_sram_idle'Since you moved this stuff out of a
CONFIG_PMconditional part of theMakefile, it broke becausepm34xx.cis still compiled conditionally onCONFIG_PM.
Quoted 6 lines
When changing Makefile/Kconfig dependencies like this, please be sure to at least compile test with the various options enabled/disabled.
For now, I've dropped this patch from the series. Feel free to update/retest/resend since the idea is fine.
Ok, I will update it with the various options.
-- Daniel
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
PATCH v3 18/18 ARM: OMAP3: cpuidle - set global variables static
In reply to Daniel Lezcanoand check the powerdomain lookup is successful.
--- arch/arm/mach-omap2/cpuidle34xx.c | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-)
arch/arm/mach-omap2/cpuidle34xx.c +4 -1
@@ -73,7 +73,7 @@ static struct omap3_idle_statedata omap3_idle_data[] = { }, }; -struct powerdomain *mpu_pd, *core_pd, *per_pd, *cam_pd; +static struct powerdomain *mpu_pd, *core_pd, *per_pd, *cam_pd;static int _cpuidle_allow_idle (struct powerdomain *pwrdm,struct clockdomain *clkdm)
@@ -252,6 +252,9 @@ static int omap3_enter_idle_bm(struct cpuidle_device *dev,* its own code. */ +if (!mpu_pd || !core_pd || !per_pd || !cam_pd) +return -ENODEV ; +/* * Prevent PER off if CORE is not in retention or off as this * would disable PER wakeups completely.
Signature · 1 line
1.7.5.4
PATCH v3 18/18 ARM: OMAP3: cpuidle - set global variables static
Quoted 22 lines · Daniel Lezcano
and check the powerdomain lookup is successful.
Signed-off-by Daniel Lezcano <[email protected]>Reviewed-by Jean Pihet <[email protected]>--- arch/arm/mach-omap2/cpuidle34xx.c | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-)arch/arm/mach-omap2/cpuidle34xx.c +1
-1@@ -73,7 +73,7 @@ static struct omap3_idle_statedata omap3_idle_data[] = { }, }; -struct powerdomain *mpu_pd, *core_pd, *per_pd, *cam_pd; +static struct powerdomain *mpu_pd, *core_pd, *per_pd, *cam_pd;static int _cpuidle_allow_idle (struct powerdomain *pwrdm,struct clockdomain *clkdm)
arch/arm/mach-omap2/cpuidle34xx.c static int omap3_enter_idle_bm(struct cpuidle_device *dev, · line 257
Quoted 6 lines
arch/arm/mach-omap2/cpuidle34xx.c +3
-0@@ -252,6 +252,9 @@ static int omap3_enter_idle_bm(struct cpuidle_device *dev,* its own code. */ +if (!mpu_pd || !core_pd || !per_pd || !cam_pd) +return -ENODEV ; +
Why check here? cam_pd is actually used just above this code.
Also, this is in the fast path. This should just be checked once at init time instead of every idle path.
For those reasons, I've dropped this part of the patch (updated patch below.)
If desired, you can send an additional patch that adds this error checking at init time and then refuses to register the driver if any of the pwrdms don't exist.
Kevin
Quoted 1 line
From
7870c78d0343ab39050bec01d88cdb19245fdaa9Mon Sep 17 00:00:00 2001
From: Daniel Lezcano <[email protected]>
Date: Tue, 24 Apr 2012 16:05:39 +0200
Subject: [PATCH] ARM: OMAP3: cpuidle - set global variables static
struct powerdomain varialbes are all file local, make them static.
--- arch/arm/mach-omap2/cpuidle34xx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/mach-omap2/cpuidle34xx.c +1 -1
@@ -73,7 +73,7 @@ static struct omap3_idle_statedata omap3_idle_data[] = { }, }; -struct powerdomain *mpu_pd, *core_pd, *per_pd, *cam_pd; +static struct powerdomain *mpu_pd, *core_pd, *per_pd, *cam_pd;static int _cpuidle_allow_idle (struct powerdomain *pwrdm,struct clockdomain *clkdm)
Signature · 1 line
1.7.9.2
PATCH v3 18/18 ARM: OMAP3: cpuidle - set global variables static
Quoted 33 lines · Kevin Hilman
Quoted 22 lines · Daniel Lezcano
and check the powerdomain lookup is successful.
Signed-off-by Daniel Lezcano<[email protected]>Reviewed-by Jean Pihet<[email protected]>--- arch/arm/mach-omap2/cpuidle34xx.c | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-)arch/arm/mach-omap2/cpuidle34xx.c +1
-1@@ -73,7 +73,7 @@ static struct omap3_idle_statedata omap3_idle_data[] = { }, }; -struct powerdomain *mpu_pd, *core_pd, *per_pd, *cam_pd; +static struct powerdomain *mpu_pd, *core_pd, *per_pd, *cam_pd;static int _cpuidle_allow_idle (struct powerdomain *pwrdm,struct clockdomain *clkdm)arch/arm/mach-omap2/cpuidle34xx.c static int omap3_enter_idle_bm(struct cpuidle_device *dev, · line 257
Quoted 6 lines
arch/arm/mach-omap2/cpuidle34xx.c +3
-0@@ -252,6 +252,9 @@ static int omap3_enter_idle_bm(struct cpuidle_device *dev,* its own code. */ +if (!mpu_pd || !core_pd || !per_pd || !cam_pd) +return -ENODEV ; +Why check here?
cam_pdis actually used just above this code.
Quoted 5 lines
Also, this is in the fast path. This should just be checked once at init time instead of every idle path.
For those reasons, I've dropped this part of the patch (updated patch below.)
Hmm, weird this part should have been in the init function, I likely missed a big fuzz I think when porting the patchset to the latest kernel version. Thanks for fixing it.
Quoted 3 lines
If desired, you can send an additional patch that adds this error checking at init time and then refuses to register the driver if any of the pwrdms don't exist.
Yes, I will do it.
-- Daniel
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
v3 cover ARM: OMAP3/4 : cpuidle34xx and cpuidle44xx cleanups
In reply to Daniel LezcanoQuoted 5 lines · Daniel Lezcano
This patchset makes some cleanup on these cpuidle drivers and consolidate the code across both architecture.
Tested on OMAP3 (igepV2).
Partially tested on OMAP4 (pandaboard), without offlining the cpu1.
Hi,
could be this patchset considered for inclusion ?
Thanks
-- Daniel
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
v3 cover ARM: OMAP3/4 : cpuidle34xx and cpuidle44xx cleanups
Quoted 6 lines · Daniel Lezcano
Quoted 5 lines · Daniel Lezcano
This patchset makes some cleanup on these cpuidle drivers and consolidate the code across both architecture.
Tested on OMAP3 (igepV2).
Partially tested on OMAP4 (pandaboard), without offlining the cpu1.
Without offlining CPU1, none of this code is executed. Can you test with CPU1 offlined?
Quoted 4 lines
Hi,
could be this patchset considered for inclusion ?
Yes. This is a good series, and a great cleanup.
Unfortunately, there is lots of OMAP PM code to review at the moment so there's a bit of a lag in my ability to review and test.
Tested-by tags from others on various platforms will also go a long ways as well.
Kevin
v3 cover ARM: OMAP3/4 : cpuidle34xx and cpuidle44xx cleanups
Quoted 11 lines · Kevin Hilman
Quoted 6 lines · Daniel Lezcano
Quoted 5 lines · Daniel Lezcano
This patchset makes some cleanup on these cpuidle drivers and consolidate the code across both architecture.
Tested on OMAP3 (igepV2).
Partially tested on OMAP4 (pandaboard), without offlining the cpu1.Without offlining CPU1, none of this code is executed. Can you test with CPU1 offlined?
Unfortunately my OMAP4 board burned :/ I am waiting for a new one.
Rob tested the series but when he unplugged the cpu1, the kernel panics for another reason. I guess the problem should have been fixed since the last testing.
Rob ? Do you mind the test the series again, the problem you were facing when unplugging the cpu1 may have been fixed.
Mike ? if you have time, is it possible you test it on your board ?
Quoted 8 lines
Quoted 3 lines
Hi,>>
could be this patchset considered for inclusion ?Yes. This is a good series, and a great cleanup.
Unfortunately, there is lots of OMAP PM code to review at the moment so there's a bit of a lag in my ability to review and test.
Ok, sure. I understand, no pressure :)
Thanks a lot.
-- Daniel
Signature · 10 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 -- To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
v3 cover ARM: OMAP3/4 : cpuidle34xx and cpuidle44xx cleanups
Quoted 17 lines · Daniel Lezcano
Quoted 8 lines · Kevin Hilman
Quoted 5 lines · Daniel Lezcano<[email protected]> ?writes:
Quoted 4 lines · Daniel Lezcano
This patchset makes some cleanup on these cpuidle drivers and consolidate the code across both architecture.
Quoted 6 lines
Quoted 2 lines
Quoted 2 lines
Tested on OMAP3 (igepV2).
Partially tested on OMAP4 (pandaboard), without offlining the cpu1.Without offlining CPU1, none of this code is executed. ?Can you test with CPU1 offlined?
Quoted 7 lines
Unfortunately my OMAP4 board burned :/ I am waiting for a new one. Rob tested the series but when he unplugged the cpu1, the kernel panics for another reason. I guess the problem should have been fixed since the last testing.
Rob ? Do you mind the test the series again, the problem you were facing when unplugging the cpu1 may have been fixed.
I'd rather have someone from the OMAP community that understands the internals test this - adding Santosh to see if he can bring some engineering time to bear on this series.
Quoted 1 line
Mike ? if you have time, is it possible you test it on your board ?
And Mike and Rajendra, if you could help with this, it would be great. We'd really like to get various platform cpuidle driver changes in for 3.5 so that Daniel can take a stab at more consolidation for the core in the next cycle.
/Amit
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 14 lines · Daniel Lezcano
Quoted 12 lines · Kevin Hilman
Quoted 7 lines · Daniel Lezcano
Quoted 6 lines · Daniel Lezcano
This patchset makes some cleanup on these cpuidle drivers and consolidate the code across both architecture.
Tested on OMAP3 (igepV2).
Partially tested on OMAP4 (pandaboard), without offlining the cpu1.
Quoted 6 lines
Quoted 2 lines
Without offlining CPU1, none of this code is executed. Can you test with CPU1 offlined?
Unfortunately my OMAP4 board burned :/ I am waiting for a new one. Rob tested the series but when he unplugged the cpu1, the kernel panics
for another reason. I guess the problem should have been fixed since the last testing.
Quoted 2 lines
Rob ? Do you mind the test the series again, the problem you were facing
when unplugging the cpu1 may have been fixed.
Quoted 1 line
Have already tested this series on omap4 with cpu offline as well as with couple idle series on top of it.
I haven't finished omap3 testing and hence not reported yet. Omap4 continies to work with subject series.
Regards
Santosh
_______________________________________________
linaro-dev mailing list [email protected]
http://lists.linaro.org/mailman/listinfo/linaro-dev
v3 cover ARM: OMAP3/4 : cpuidle34xx and cpuidle44xx cleanups
Quoted 16 lines · Santosh
Quoted 7 lines · Daniel Lezcano
Quoted 6 lines · Kevin Hilman
Quoted 4 lines · Daniel Lezcano
Quoted 3 lines · Daniel Lezcano
This patchset makes some cleanup on these cpuidle drivers and consolidate the code across both architecture.
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines
Quoted 2 lines
Tested on OMAP3 (igepV2).
Partially tested on OMAP4 (pandaboard), without offlining the cpu1.Without offlining CPU1, none of this code is executed. Can you test with CPU1 offlined?
Unfortunately my OMAP4 board burned :/ I am waiting for a new one. Rob tested the series but when he unplugged the cpu1, the kernel panics
Quoted 8 lines
for another reason. I guess the problem should have been fixed since the last testing.
Quoted 1 line
Rob ? Do you mind the test the series again, the problem you were facing
when unplugging the cpu1 may have been fixed.
Have already tested this series on omap4 with cpu offline as well as with couple idle series on top of it.
I haven't finished omap3 testing and hence not reported yet. Omap4 continies to work with subject series.
Great !
I tested it on omap3 igepv2 board and it works fine too.
Thanks for testing
-- Daniel.
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
v3 cover ARM: OMAP3/4 : cpuidle34xx and cpuidle44xx cleanups
Quoted 37 lines · Daniel Lezcano
Quoted 27 lines · Santosh
Quoted 14 lines · On May 1, 2012 1:46 PM, "Daniel Lezcano"<[email protected]> ?wrote:
Quoted 12 lines · Kevin Hilman
Quoted 7 lines · Daniel Lezcano<[email protected]> ? writes:
Quoted 6 lines · Daniel Lezcano
This patchset makes some cleanup on these cpuidle drivers and consolidate the code across both architecture.
Tested on OMAP3 (igepV2).
Partially tested on OMAP4 (pandaboard), without offlining the cpu1.Quoted 6 lines
Quoted 2 lines
Without offlining CPU1, none of this code is executed. ?Can you test with CPU1 offlined?
Unfortunately my OMAP4 board burned :/ I am waiting for a new one. Rob tested the series but when he unplugged the cpu1, the kernel panics
for another reason. I guess the problem should have been fixed since the last testing.
Quoted 1 line
Quoted 7 lines
Quoted 1 line
?Rob ? Do you mind the test the series again, the problem you were facing
when unplugging the cpu1 may have been fixed.
Have already tested this series on omap4 with cpu offline as well as with couple idle series on top of it.
I haven't finished omap3 testing and hence not reported yet. Omap4 continies to work with subject series.
Quoted 4 lines
Great !
I tested it on omap3 igepv2 board and it works fine too.
Finished OMAP3 testing too. have already reviewed the series before. For entire series,
Regards
Santosh
v3 cover ARM: OMAP3/4 : cpuidle34xx and cpuidle44xx cleanups
In reply to Daniel LezcanoHi Daniel,
Quoted 2 lines · Daniel Lezcano
This patchset makes some cleanup on these cpuidle drivers and consolidate the code across both architecture.
I think I said it before, but it's worth repeating: Very nice cleanup! Thanks for your persistence.
I've now been through this version and I think it's ready for v3.5. I had a few very minor comments on some specific patches but made the changes myself. Please comment on those patches if you think my changes are OK or not. Also, I had to drop the Makefile change due to compile problems.
With those changes made, and Reviewed-by and Tested-by tags added from Santosh, I've created a branch[1] and will queue it for v3.5. Any additional patches can be sent against this branch.
Quoted 2 lines
Tested on OMAP3 (igepV2).
Partially tested on OMAP4 (pandaboard), without offlining the cpu1.
I've also tested on OMAP3430/n900, OMAP3530/Overo and OMAP4430/Pandabord with CPU1 offlined so the deeper C-states are hit. Combined with the review and testing from Jean and Santosh (thanks!), I think this is ready to go.
Thanks again for this great cleanup and consolidation,
Kevin
[1] git://git.kernel.org/pub/scm/linux/kernel/git/khilman/linux-omap-pm.git for_3.5/cleanup/omap-cpuidle