aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-omap2
diff options
context:
space:
mode:
authorKevin Hilman <khilman@deeprootsystems.com>2009-12-15 19:37:18 -0500
committerKevin Hilman <khilman@deeprootsystems.com>2010-02-23 14:05:01 -0500
commitbb4de3df69e2993d642e38e17a3eccfe37845acc (patch)
tree3719204fb8430a28089ed12914e458fd84090be9 /arch/arm/mach-omap2
parent6af83b38613da58a221e56af676097575ce2c763 (diff)
OMAP3: cpuidle: configure latencies/thresholds from board file
The CPUidle C state latencies and thresholds are dependent on various board specific details. This patch makes it possible to configure these values from the respective board files. omap3_pm_init_cpuidle() can now be optionally called from board files to pass board specific cpuidle parameters. If the board files do not use this function to pass the params default values are used which might cause higher consumption dur to wrong state selection by the governor. This patch only updates the 3430sdp board files to use omap3_pm_init_cpuidle(). From Kalle, in addition to original patch from Rajendra: Building without CONFIG_CPU_IDLE or CONFIG_PM causes build to fail if cpu idle parameters are tried to pass using omap3_pm_init_cpuidle function. Signed-off-by: Rajendra Nayak <rnayak@ti.com> Signed-off-by: Kalle Jokiniemi <kalle.jokiniemi@digia.com> Signed-off-by: Kevin Hilman <khilman@deeprootsystems.com>
Diffstat (limited to 'arch/arm/mach-omap2')
-rw-r--r--arch/arm/mach-omap2/board-3430sdp.c20
-rw-r--r--arch/arm/mach-omap2/cpuidle34xx.c105
-rw-r--r--arch/arm/mach-omap2/pm.h15
3 files changed, 119 insertions, 21 deletions
diff --git a/arch/arm/mach-omap2/board-3430sdp.c b/arch/arm/mach-omap2/board-3430sdp.c
index 5adef517a2b3..99f295e81db4 100644
--- a/arch/arm/mach-omap2/board-3430sdp.c
+++ b/arch/arm/mach-omap2/board-3430sdp.c
@@ -46,6 +46,7 @@
46#include "mux.h" 46#include "mux.h"
47#include "sdram-qimonda-hyb18m512160af-6.h" 47#include "sdram-qimonda-hyb18m512160af-6.h"
48#include "hsmmc.h" 48#include "hsmmc.h"
49#include "pm.h"
49 50
50#define CONFIG_DISABLE_HFCLK 1 51#define CONFIG_DISABLE_HFCLK 1
51 52
@@ -57,6 +58,24 @@
57 58
58#define TWL4030_MSECURE_GPIO 22 59#define TWL4030_MSECURE_GPIO 22
59 60
61/* FIXME: These values need to be updated based on more profiling on 3430sdp*/
62static struct cpuidle_params omap3_cpuidle_params_table[] = {
63 /* C1 */
64 {2, 2, 5},
65 /* C2 */
66 {10, 10, 30},
67 /* C3 */
68 {50, 50, 300},
69 /* C4 */
70 {1500, 1800, 4000},
71 /* C5 */
72 {2500, 7500, 12000},
73 /* C6 */
74 {3000, 8500, 15000},
75 /* C7 */
76 {10000, 30000, 300000},
77};
78
60static int board_keymap[] = { 79static int board_keymap[] = {
61 KEY(0, 0, KEY_LEFT), 80 KEY(0, 0, KEY_LEFT),
62 KEY(0, 1, KEY_RIGHT), 81 KEY(0, 1, KEY_RIGHT),
@@ -307,6 +326,7 @@ static void __init omap_3430sdp_init_irq(void)
307{ 326{
308 omap_board_config = sdp3430_config; 327 omap_board_config = sdp3430_config;
309 omap_board_config_size = ARRAY_SIZE(sdp3430_config); 328 omap_board_config_size = ARRAY_SIZE(sdp3430_config);
329 omap3_pm_init_cpuidle(omap3_cpuidle_params_table);
310 omap2_init_common_hw(hyb18m512160af6_sdrc_params, NULL); 330 omap2_init_common_hw(hyb18m512160af6_sdrc_params, NULL);
311 omap_init_irq(); 331 omap_init_irq();
312 omap_gpio_init(); 332 omap_gpio_init();
diff --git a/arch/arm/mach-omap2/cpuidle34xx.c b/arch/arm/mach-omap2/cpuidle34xx.c
index ff1ad3d06ce1..597148eed0bd 100644
--- a/arch/arm/mach-omap2/cpuidle34xx.c
+++ b/arch/arm/mach-omap2/cpuidle34xx.c
@@ -62,6 +62,30 @@ struct omap3_processor_cx omap3_power_states[OMAP3_MAX_STATES];
62struct omap3_processor_cx current_cx_state; 62struct omap3_processor_cx current_cx_state;
63struct powerdomain *mpu_pd, *core_pd; 63struct powerdomain *mpu_pd, *core_pd;
64 64
65/*
66 * The latencies/thresholds for various C states have
67 * to be configured from the respective board files.
68 * These are some default values (which might not provide
69 * the best power savings) used on boards which do not
70 * pass these details from the board file.
71 */
72static struct cpuidle_params cpuidle_params_table[] = {
73 /* C1 */
74 {2, 2, 5},
75 /* C2 */
76 {10, 10, 30},
77 /* C3 */
78 {50, 50, 300},
79 /* C4 */
80 {1500, 1800, 4000},
81 /* C5 */
82 {2500, 7500, 12000},
83 /* C6 */
84 {3000, 8500, 15000},
85 /* C7 */
86 {10000, 30000, 300000},
87};
88
65static int omap3_idle_bm_check(void) 89static int omap3_idle_bm_check(void)
66{ 90{
67 if (!omap3_can_sleep()) 91 if (!omap3_can_sleep())
@@ -245,6 +269,24 @@ void omap3_cpuidle_update_states(void)
245 } 269 }
246} 270}
247 271
272void omap3_pm_init_cpuidle(struct cpuidle_params *cpuidle_board_params)
273{
274 int i;
275
276 if (!cpuidle_board_params)
277 return;
278
279 for (i = OMAP3_STATE_C1; i < OMAP3_MAX_STATES; i++) {
280 cpuidle_params_table[i].sleep_latency =
281 cpuidle_board_params[i].sleep_latency;
282 cpuidle_params_table[i].wake_latency =
283 cpuidle_board_params[i].wake_latency;
284 cpuidle_params_table[i].threshold =
285 cpuidle_board_params[i].threshold;
286 }
287 return;
288}
289
248/* omap3_init_power_states - Initialises the OMAP3 specific C states. 290/* omap3_init_power_states - Initialises the OMAP3 specific C states.
249 * 291 *
250 * Below is the desciption of each C state. 292 * Below is the desciption of each C state.
@@ -261,9 +303,12 @@ void omap_init_power_states(void)
261 /* C1 . MPU WFI + Core active */ 303 /* C1 . MPU WFI + Core active */
262 omap3_power_states[OMAP3_STATE_C1].valid = 1; 304 omap3_power_states[OMAP3_STATE_C1].valid = 1;
263 omap3_power_states[OMAP3_STATE_C1].type = OMAP3_STATE_C1; 305 omap3_power_states[OMAP3_STATE_C1].type = OMAP3_STATE_C1;
264 omap3_power_states[OMAP3_STATE_C1].sleep_latency = 2; 306 omap3_power_states[OMAP3_STATE_C1].sleep_latency =
265 omap3_power_states[OMAP3_STATE_C1].wakeup_latency = 2; 307 cpuidle_params_table[OMAP3_STATE_C1].sleep_latency;
266 omap3_power_states[OMAP3_STATE_C1].threshold = 5; 308 omap3_power_states[OMAP3_STATE_C1].wakeup_latency =
309 cpuidle_params_table[OMAP3_STATE_C1].wake_latency;
310 omap3_power_states[OMAP3_STATE_C1].threshold =
311 cpuidle_params_table[OMAP3_STATE_C1].threshold;
267 omap3_power_states[OMAP3_STATE_C1].mpu_state = PWRDM_POWER_ON; 312 omap3_power_states[OMAP3_STATE_C1].mpu_state = PWRDM_POWER_ON;
268 omap3_power_states[OMAP3_STATE_C1].core_state = PWRDM_POWER_ON; 313 omap3_power_states[OMAP3_STATE_C1].core_state = PWRDM_POWER_ON;
269 omap3_power_states[OMAP3_STATE_C1].flags = CPUIDLE_FLAG_TIME_VALID; 314 omap3_power_states[OMAP3_STATE_C1].flags = CPUIDLE_FLAG_TIME_VALID;
@@ -271,9 +316,12 @@ void omap_init_power_states(void)
271 /* C2 . MPU WFI + Core inactive */ 316 /* C2 . MPU WFI + Core inactive */
272 omap3_power_states[OMAP3_STATE_C2].valid = 1; 317 omap3_power_states[OMAP3_STATE_C2].valid = 1;
273 omap3_power_states[OMAP3_STATE_C2].type = OMAP3_STATE_C2; 318 omap3_power_states[OMAP3_STATE_C2].type = OMAP3_STATE_C2;
274 omap3_power_states[OMAP3_STATE_C2].sleep_latency = 10; 319 omap3_power_states[OMAP3_STATE_C2].sleep_latency =
275 omap3_power_states[OMAP3_STATE_C2].wakeup_latency = 10; 320 cpuidle_params_table[OMAP3_STATE_C2].sleep_latency;
276 omap3_power_states[OMAP3_STATE_C2].threshold = 30; 321 omap3_power_states[OMAP3_STATE_C2].wakeup_latency =
322 cpuidle_params_table[OMAP3_STATE_C2].wake_latency;
323 omap3_power_states[OMAP3_STATE_C2].threshold =
324 cpuidle_params_table[OMAP3_STATE_C2].threshold;
277 omap3_power_states[OMAP3_STATE_C2].mpu_state = PWRDM_POWER_ON; 325 omap3_power_states[OMAP3_STATE_C2].mpu_state = PWRDM_POWER_ON;
278 omap3_power_states[OMAP3_STATE_C2].core_state = PWRDM_POWER_ON; 326 omap3_power_states[OMAP3_STATE_C2].core_state = PWRDM_POWER_ON;
279 omap3_power_states[OMAP3_STATE_C2].flags = CPUIDLE_FLAG_TIME_VALID; 327 omap3_power_states[OMAP3_STATE_C2].flags = CPUIDLE_FLAG_TIME_VALID;
@@ -281,9 +329,12 @@ void omap_init_power_states(void)
281 /* C3 . MPU CSWR + Core inactive */ 329 /* C3 . MPU CSWR + Core inactive */
282 omap3_power_states[OMAP3_STATE_C3].valid = 1; 330 omap3_power_states[OMAP3_STATE_C3].valid = 1;
283 omap3_power_states[OMAP3_STATE_C3].type = OMAP3_STATE_C3; 331 omap3_power_states[OMAP3_STATE_C3].type = OMAP3_STATE_C3;
284 omap3_power_states[OMAP3_STATE_C3].sleep_latency = 50; 332 omap3_power_states[OMAP3_STATE_C3].sleep_latency =
285 omap3_power_states[OMAP3_STATE_C3].wakeup_latency = 50; 333 cpuidle_params_table[OMAP3_STATE_C3].sleep_latency;
286 omap3_power_states[OMAP3_STATE_C3].threshold = 300; 334 omap3_power_states[OMAP3_STATE_C3].wakeup_latency =
335 cpuidle_params_table[OMAP3_STATE_C3].wake_latency;
336 omap3_power_states[OMAP3_STATE_C3].threshold =
337 cpuidle_params_table[OMAP3_STATE_C3].threshold;
287 omap3_power_states[OMAP3_STATE_C3].mpu_state = PWRDM_POWER_RET; 338 omap3_power_states[OMAP3_STATE_C3].mpu_state = PWRDM_POWER_RET;
288 omap3_power_states[OMAP3_STATE_C3].core_state = PWRDM_POWER_ON; 339 omap3_power_states[OMAP3_STATE_C3].core_state = PWRDM_POWER_ON;
289 omap3_power_states[OMAP3_STATE_C3].flags = CPUIDLE_FLAG_TIME_VALID | 340 omap3_power_states[OMAP3_STATE_C3].flags = CPUIDLE_FLAG_TIME_VALID |
@@ -292,9 +343,12 @@ void omap_init_power_states(void)
292 /* C4 . MPU OFF + Core inactive */ 343 /* C4 . MPU OFF + Core inactive */
293 omap3_power_states[OMAP3_STATE_C4].valid = 1; 344 omap3_power_states[OMAP3_STATE_C4].valid = 1;
294 omap3_power_states[OMAP3_STATE_C4].type = OMAP3_STATE_C4; 345 omap3_power_states[OMAP3_STATE_C4].type = OMAP3_STATE_C4;
295 omap3_power_states[OMAP3_STATE_C4].sleep_latency = 1500; 346 omap3_power_states[OMAP3_STATE_C4].sleep_latency =
296 omap3_power_states[OMAP3_STATE_C4].wakeup_latency = 1800; 347 cpuidle_params_table[OMAP3_STATE_C4].sleep_latency;
297 omap3_power_states[OMAP3_STATE_C4].threshold = 4000; 348 omap3_power_states[OMAP3_STATE_C4].wakeup_latency =
349 cpuidle_params_table[OMAP3_STATE_C4].wake_latency;
350 omap3_power_states[OMAP3_STATE_C4].threshold =
351 cpuidle_params_table[OMAP3_STATE_C4].threshold;
298 omap3_power_states[OMAP3_STATE_C4].mpu_state = PWRDM_POWER_OFF; 352 omap3_power_states[OMAP3_STATE_C4].mpu_state = PWRDM_POWER_OFF;
299 omap3_power_states[OMAP3_STATE_C4].core_state = PWRDM_POWER_ON; 353 omap3_power_states[OMAP3_STATE_C4].core_state = PWRDM_POWER_ON;
300 omap3_power_states[OMAP3_STATE_C4].flags = CPUIDLE_FLAG_TIME_VALID | 354 omap3_power_states[OMAP3_STATE_C4].flags = CPUIDLE_FLAG_TIME_VALID |
@@ -303,9 +357,12 @@ void omap_init_power_states(void)
303 /* C5 . MPU CSWR + Core CSWR*/ 357 /* C5 . MPU CSWR + Core CSWR*/
304 omap3_power_states[OMAP3_STATE_C5].valid = 1; 358 omap3_power_states[OMAP3_STATE_C5].valid = 1;
305 omap3_power_states[OMAP3_STATE_C5].type = OMAP3_STATE_C5; 359 omap3_power_states[OMAP3_STATE_C5].type = OMAP3_STATE_C5;
306 omap3_power_states[OMAP3_STATE_C5].sleep_latency = 2500; 360 omap3_power_states[OMAP3_STATE_C5].sleep_latency =
307 omap3_power_states[OMAP3_STATE_C5].wakeup_latency = 7500; 361 cpuidle_params_table[OMAP3_STATE_C5].sleep_latency;
308 omap3_power_states[OMAP3_STATE_C5].threshold = 12000; 362 omap3_power_states[OMAP3_STATE_C5].wakeup_latency =
363 cpuidle_params_table[OMAP3_STATE_C5].wake_latency;
364 omap3_power_states[OMAP3_STATE_C5].threshold =
365 cpuidle_params_table[OMAP3_STATE_C5].threshold;
309 omap3_power_states[OMAP3_STATE_C5].mpu_state = PWRDM_POWER_RET; 366 omap3_power_states[OMAP3_STATE_C5].mpu_state = PWRDM_POWER_RET;
310 omap3_power_states[OMAP3_STATE_C5].core_state = PWRDM_POWER_RET; 367 omap3_power_states[OMAP3_STATE_C5].core_state = PWRDM_POWER_RET;
311 omap3_power_states[OMAP3_STATE_C5].flags = CPUIDLE_FLAG_TIME_VALID | 368 omap3_power_states[OMAP3_STATE_C5].flags = CPUIDLE_FLAG_TIME_VALID |
@@ -314,9 +371,12 @@ void omap_init_power_states(void)
314 /* C6 . MPU OFF + Core CSWR */ 371 /* C6 . MPU OFF + Core CSWR */
315 omap3_power_states[OMAP3_STATE_C6].valid = 1; 372 omap3_power_states[OMAP3_STATE_C6].valid = 1;
316 omap3_power_states[OMAP3_STATE_C6].type = OMAP3_STATE_C6; 373 omap3_power_states[OMAP3_STATE_C6].type = OMAP3_STATE_C6;
317 omap3_power_states[OMAP3_STATE_C6].sleep_latency = 3000; 374 omap3_power_states[OMAP3_STATE_C6].sleep_latency =
318 omap3_power_states[OMAP3_STATE_C6].wakeup_latency = 8500; 375 cpuidle_params_table[OMAP3_STATE_C6].sleep_latency;
319 omap3_power_states[OMAP3_STATE_C6].threshold = 15000; 376 omap3_power_states[OMAP3_STATE_C6].wakeup_latency =
377 cpuidle_params_table[OMAP3_STATE_C6].wake_latency;
378 omap3_power_states[OMAP3_STATE_C6].threshold =
379 cpuidle_params_table[OMAP3_STATE_C6].threshold;
320 omap3_power_states[OMAP3_STATE_C6].mpu_state = PWRDM_POWER_OFF; 380 omap3_power_states[OMAP3_STATE_C6].mpu_state = PWRDM_POWER_OFF;
321 omap3_power_states[OMAP3_STATE_C6].core_state = PWRDM_POWER_RET; 381 omap3_power_states[OMAP3_STATE_C6].core_state = PWRDM_POWER_RET;
322 omap3_power_states[OMAP3_STATE_C6].flags = CPUIDLE_FLAG_TIME_VALID | 382 omap3_power_states[OMAP3_STATE_C6].flags = CPUIDLE_FLAG_TIME_VALID |
@@ -325,9 +385,12 @@ void omap_init_power_states(void)
325 /* C7 . MPU OFF + Core OFF */ 385 /* C7 . MPU OFF + Core OFF */
326 omap3_power_states[OMAP3_STATE_C7].valid = 1; 386 omap3_power_states[OMAP3_STATE_C7].valid = 1;
327 omap3_power_states[OMAP3_STATE_C7].type = OMAP3_STATE_C7; 387 omap3_power_states[OMAP3_STATE_C7].type = OMAP3_STATE_C7;
328 omap3_power_states[OMAP3_STATE_C7].sleep_latency = 10000; 388 omap3_power_states[OMAP3_STATE_C7].sleep_latency =
329 omap3_power_states[OMAP3_STATE_C7].wakeup_latency = 30000; 389 cpuidle_params_table[OMAP3_STATE_C7].sleep_latency;
330 omap3_power_states[OMAP3_STATE_C7].threshold = 300000; 390 omap3_power_states[OMAP3_STATE_C7].wakeup_latency =
391 cpuidle_params_table[OMAP3_STATE_C7].wake_latency;
392 omap3_power_states[OMAP3_STATE_C7].threshold =
393 cpuidle_params_table[OMAP3_STATE_C7].threshold;
331 omap3_power_states[OMAP3_STATE_C7].mpu_state = PWRDM_POWER_OFF; 394 omap3_power_states[OMAP3_STATE_C7].mpu_state = PWRDM_POWER_OFF;
332 omap3_power_states[OMAP3_STATE_C7].core_state = PWRDM_POWER_OFF; 395 omap3_power_states[OMAP3_STATE_C7].core_state = PWRDM_POWER_OFF;
333 omap3_power_states[OMAP3_STATE_C7].flags = CPUIDLE_FLAG_TIME_VALID | 396 omap3_power_states[OMAP3_STATE_C7].flags = CPUIDLE_FLAG_TIME_VALID |
diff --git a/arch/arm/mach-omap2/pm.h b/arch/arm/mach-omap2/pm.h
index 09c0144e90d1..58a2671e6147 100644
--- a/arch/arm/mach-omap2/pm.h
+++ b/arch/arm/mach-omap2/pm.h
@@ -23,6 +23,21 @@ extern int omap3_can_sleep(void);
23extern int set_pwrdm_state(struct powerdomain *pwrdm, u32 state); 23extern int set_pwrdm_state(struct powerdomain *pwrdm, u32 state);
24extern int omap3_idle_init(void); 24extern int omap3_idle_init(void);
25 25
26struct cpuidle_params {
27 u32 sleep_latency;
28 u32 wake_latency;
29 u32 threshold;
30};
31
32#if defined(CONFIG_PM) && defined(CONFIG_CPU_IDLE)
33extern void omap3_pm_init_cpuidle(struct cpuidle_params *cpuidle_board_params);
34#else
35static
36inline void omap3_pm_init_cpuidle(struct cpuidle_params *cpuidle_board_params)
37{
38}
39#endif
40
26extern int omap3_pm_get_suspend_state(struct powerdomain *pwrdm); 41extern int omap3_pm_get_suspend_state(struct powerdomain *pwrdm);
27extern int omap3_pm_set_suspend_state(struct powerdomain *pwrdm, int state); 42extern int omap3_pm_set_suspend_state(struct powerdomain *pwrdm, int state);
28 43