aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-omap2/cpuidle34xx.c
diff options
context:
space:
mode:
authorDeepthi Dharwar <deepthi@linux.vnet.ibm.com>2011-10-28 06:50:33 -0400
committerLen Brown <len.brown@intel.com>2011-11-06 21:13:49 -0500
commit4202735e8ab6ecfb0381631a0d0b58fefe0bd4e2 (patch)
tree189e5aab466995128c5a9d5a2a4075a5db530674 /arch/arm/mach-omap2/cpuidle34xx.c
parentb25edc42bfb9602f0503474b2c94701d5536ce60 (diff)
cpuidle: Split cpuidle_state structure and move per-cpu statistics fields
This is the first step towards global registration of cpuidle states. The statistics used primarily by the governor are per-cpu and have to be split from rest of the fields inside cpuidle_state, which would be made global i.e. single copy. The driver_data field is also per-cpu and moved. Signed-off-by: Deepthi Dharwar <deepthi@linux.vnet.ibm.com> Signed-off-by: Trinabh Gupta <g.trinabh@gmail.com> Tested-by: Jean Pihet <j-pihet@ti.com> Reviewed-by: Kevin Hilman <khilman@ti.com> Acked-by: Arjan van de Ven <arjan@linux.intel.com> Acked-by: Kevin Hilman <khilman@ti.com> Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'arch/arm/mach-omap2/cpuidle34xx.c')
-rw-r--r--arch/arm/mach-omap2/cpuidle34xx.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/arch/arm/mach-omap2/cpuidle34xx.c b/arch/arm/mach-omap2/cpuidle34xx.c
index 58425c75f1b8..d3fce7b97fcf 100644
--- a/arch/arm/mach-omap2/cpuidle34xx.c
+++ b/arch/arm/mach-omap2/cpuidle34xx.c
@@ -97,7 +97,7 @@ static int omap3_enter_idle(struct cpuidle_device *dev,
97 int index) 97 int index)
98{ 98{
99 struct omap3_idle_statedata *cx = 99 struct omap3_idle_statedata *cx =
100 cpuidle_get_statedata(&dev->states[index]); 100 cpuidle_get_statedata(&dev->states_usage[index]);
101 struct timespec ts_preidle, ts_postidle, ts_idle; 101 struct timespec ts_preidle, ts_postidle, ts_idle;
102 u32 mpu_state = cx->mpu_state, core_state = cx->core_state; 102 u32 mpu_state = cx->mpu_state, core_state = cx->core_state;
103 int idle_time; 103 int idle_time;
@@ -160,8 +160,9 @@ return_sleep_time:
160static int next_valid_state(struct cpuidle_device *dev, 160static int next_valid_state(struct cpuidle_device *dev,
161 int index) 161 int index)
162{ 162{
163 struct cpuidle_state_usage *curr_usage = &dev->states_usage[index];
163 struct cpuidle_state *curr = &dev->states[index]; 164 struct cpuidle_state *curr = &dev->states[index];
164 struct omap3_idle_statedata *cx = cpuidle_get_statedata(curr); 165 struct omap3_idle_statedata *cx = cpuidle_get_statedata(curr_usage);
165 u32 mpu_deepest_state = PWRDM_POWER_RET; 166 u32 mpu_deepest_state = PWRDM_POWER_RET;
166 u32 core_deepest_state = PWRDM_POWER_RET; 167 u32 core_deepest_state = PWRDM_POWER_RET;
167 int next_index = -1; 168 int next_index = -1;
@@ -202,7 +203,7 @@ static int next_valid_state(struct cpuidle_device *dev,
202 */ 203 */
203 idx--; 204 idx--;
204 for (; idx >= 0; idx--) { 205 for (; idx >= 0; idx--) {
205 cx = cpuidle_get_statedata(&dev->states[idx]); 206 cx = cpuidle_get_statedata(&dev->states_usage[idx]);
206 if ((cx->valid) && 207 if ((cx->valid) &&
207 (cx->mpu_state >= mpu_deepest_state) && 208 (cx->mpu_state >= mpu_deepest_state) &&
208 (cx->core_state >= core_deepest_state)) { 209 (cx->core_state >= core_deepest_state)) {
@@ -231,7 +232,6 @@ static int next_valid_state(struct cpuidle_device *dev,
231static int omap3_enter_idle_bm(struct cpuidle_device *dev, 232static int omap3_enter_idle_bm(struct cpuidle_device *dev,
232 int index) 233 int index)
233{ 234{
234 struct cpuidle_state *state = &dev->states[index];
235 int new_state_idx; 235 int new_state_idx;
236 u32 core_next_state, per_next_state = 0, per_saved_state = 0, cam_state; 236 u32 core_next_state, per_next_state = 0, per_saved_state = 0, cam_state;
237 struct omap3_idle_statedata *cx; 237 struct omap3_idle_statedata *cx;
@@ -264,7 +264,7 @@ static int omap3_enter_idle_bm(struct cpuidle_device *dev,
264 * Prevent PER off if CORE is not in retention or off as this 264 * Prevent PER off if CORE is not in retention or off as this
265 * would disable PER wakeups completely. 265 * would disable PER wakeups completely.
266 */ 266 */
267 cx = cpuidle_get_statedata(state); 267 cx = cpuidle_get_statedata(&dev->states_usage[index]);
268 core_next_state = cx->core_state; 268 core_next_state = cx->core_state;
269 per_next_state = per_saved_state = pwrdm_read_next_pwrst(per_pd); 269 per_next_state = per_saved_state = pwrdm_read_next_pwrst(per_pd);
270 if ((per_next_state == PWRDM_POWER_OFF) && 270 if ((per_next_state == PWRDM_POWER_OFF) &&
@@ -318,6 +318,7 @@ static inline struct omap3_idle_statedata *_fill_cstate(
318{ 318{
319 struct omap3_idle_statedata *cx = &omap3_idle_data[idx]; 319 struct omap3_idle_statedata *cx = &omap3_idle_data[idx];
320 struct cpuidle_state *state = &dev->states[idx]; 320 struct cpuidle_state *state = &dev->states[idx];
321 struct cpuidle_state_usage *state_usage = &dev->states_usage[idx];
321 322
322 state->exit_latency = cpuidle_params_table[idx].exit_latency; 323 state->exit_latency = cpuidle_params_table[idx].exit_latency;
323 state->target_residency = cpuidle_params_table[idx].target_residency; 324 state->target_residency = cpuidle_params_table[idx].target_residency;
@@ -326,7 +327,7 @@ static inline struct omap3_idle_statedata *_fill_cstate(
326 cx->valid = cpuidle_params_table[idx].valid; 327 cx->valid = cpuidle_params_table[idx].valid;
327 sprintf(state->name, "C%d", idx + 1); 328 sprintf(state->name, "C%d", idx + 1);
328 strncpy(state->desc, descr, CPUIDLE_DESC_LEN); 329 strncpy(state->desc, descr, CPUIDLE_DESC_LEN);
329 cpuidle_set_statedata(state, cx); 330 cpuidle_set_statedata(state_usage, cx);
330 331
331 return cx; 332 return cx;
332} 333}