OMAP3: PM: add CPUidle support
cover OMAP3: PM: add CPUidle support
This series adds CPUidle support for OMAP3. This includes power states for full-chip retention and full-chip OFF during idle.
This series is based on top of Tony's for-next branch plus the recently posted off-mode series.
[PATCH v2 00/32] OMAP3: PM: base off-mode support
This series is also available in my linux-omap-pm repo[1] as a branch named pm-upstream/pm-cpuidle.
Kevin
Jouni Hogander (1):
OMAP3: PM: Use pwrdm_set_next_pwrst instead of set_pwrdm_state in
idle loop
Kalle Jokiniemi (1):
OMAP3: PM: CPUidle: fix init sequencing
Kevin Hilman (2):
OMAP3: PM: CPUidle: obey enable_off_mode flag
OMAP3: PM: CPUidle: check activity for C2, C3, correct accounting
Peter 'p2' De Schrijver (2):
OMAP3: PM: CPUidle: Add new lower-latency C1 state
OMAP3: PM: idle: Remove fclk check for idle loop
Rajendra Nayak (2):
OMAP3: PM: CPUidle: base driver and support for C1-C2
OMAP3: PM: CPUidle: support retention and off-mode C-states
Sanjeev Premi (1):
OMAP3: PM: CPUidle: Start C-state definitions from base 0
Tero Kristo (1):
OMAP3: PM: Added resched check into idle calls
arch/arm/mach-omap2/Makefile | 2 +- arch/arm/mach-omap2/cpuidle34xx.c | 318 +++++++++++++++++++++++++++++++++++++ arch/arm/mach-omap2/pm.h | 4 + arch/arm/mach-omap2/pm34xx.c | 55 +------ 4 files changed, 329 insertions(+), 50 deletions(-) create mode 100644 arch/arm/mach-omap2/cpuidle34xx.c
PATCH 1/10 OMAP3: PM: CPUidle: base driver and support for C1-C2
From: Rajendra Nayak <[email protected]>
Basic CPUidle driver for OMAP3 with deepest sleep state supported being MPU CSWR.
--- arch/arm/mach-omap2/Makefile | 2 +- arch/arm/mach-omap2/cpuidle34xx.c | 255 +++++++++++++++++++++++++++++++++++++ arch/arm/mach-omap2/pm.h | 1 + arch/arm/mach-omap2/pm34xx.c | 4 +- 4 files changed, 260 insertions(+), 2 deletions(-) create mode 100644 arch/arm/mach-omap2/cpuidle34xx.c
arch/arm/mach-omap2/Makefile +1 -1
@@ -31,7 +31,7 @@ obj-$(CONFIG_ARCH_OMAP2) += sdrc2xxx.o ifeq ($(CONFIG_PM),y) obj-$(CONFIG_ARCH_OMAP2) += pm24xx.o obj-$(CONFIG_ARCH_OMAP24XX) += sleep24xx.o -obj-$(CONFIG_ARCH_OMAP3) += pm34xx.o sleep34xx.o +obj-$(CONFIG_ARCH_OMAP3) += pm34xx.o sleep34xx.o cpuidle34xx.o obj-$(CONFIG_PM_DEBUG) += pm-debug.o endif
arch/arm/mach-omap2/cpuidle34xx.c new file +255 -0
255 lines not on this page · raw message
arch/arm/mach-omap2/pm.h +1 -0
@@ -18,6 +18,7 @@ extern u32 sleep_while_idle;extern void *omap3_secure_ram_storage;extern void omap3_pm_off_mode_enable (int ); +extern void omap_sram_idle (void );extern int omap3_pm_get_suspend_state (struct powerdomain *pwrdm);extern int omap3_pm_set_suspend_state (struct powerdomain *pwrdm,int state);
arch/arm/mach-omap2/pm34xx.c +3 -1
@@ -318,7 +318,7 @@ static void restore_table_entry(void)restore_control_register (control_reg_value); } -static void omap_sram_idle (void ) +void omap_sram_idle (void ) {/* Variable to tell what needs to be saved and restored * in omap_sram_idle*/
@@ -1100,7 +1100,9 @@ static int __init omap3_pm_init(void)suspend_set_ops (&omap_pm_ops);#endif /* CONFIG_SUSPEND */ +#ifndef CONFIG_CPU_IDLE pm_idle = omap3_pm_idle; +#endif pwrdm_add_wkdep (neon_pwrdm, mpu_pwrdm);/*
Signature · 1 line
1.6.4.3
PATCH 2/10 OMAP3: PM: CPUidle: support retention and off-mode C-states
From: Rajendra Nayak <[email protected]>
This patch adds support and enables state C4(MPU RET + CORE RET) and MPU OFF states (C3 and C5.)
--- arch/arm/mach-omap2/cpuidle34xx.c | 28 ++++++++++++++++------------ arch/arm/mach-omap2/pm.h | 2 ++ arch/arm/mach-omap2/pm34xx.c | 6 ++---- 3 files changed, 20 insertions(+), 16 deletions(-)
arch/arm/mach-omap2/cpuidle34xx.c +16 -12
@@ -26,6 +26,8 @@#include <plat/prcm.h> #include <plat/powerdomain.h> +#include <plat/irqs.h> +#include <plat/control.h> #ifdef CONFIG_CPU_IDLE
@@ -50,10 +52,12 @@ struct omap3_processor_cx {struct omap3_processor_cx omap3_power_states[OMAP3_MAX_STATES ];struct omap3_processor_cx current_cx_state; -struct powerdomain *mpu_pd; +struct powerdomain *mpu_pd, *core_pd;static int omap3_idle_bm_check (void ) { +if (!omap3_can_sleep ()) +return 1 ;return 0 ; }
@@ -79,24 +83,23 @@ static int omap3_enter_idle(struct cpuidle_device *dev,local_irq_disable ();local_fiq_disable (); -/* Program MPU to target state */ -if (cx->mpu_state <PWRDM_POWER_ON ) -pwrdm_set_next_pwrst (mpu_pd, cx->mpu_state); +set_pwrdm_state (mpu_pd, cx->mpu_state); +set_pwrdm_state (core_pd, cx->core_state); + +if (omap_irq_pending ()) + goto return_sleep_time;/* Execute ARM wfi */ omap_sram_idle (); -/* Program MPU to ON */ -if (cx->mpu_state <PWRDM_POWER_ON ) -pwrdm_set_next_pwrst (mpu_pd,PWRDM_POWER_ON ); - +return_sleep_time:getnstimeofday (&ts_postidle); ts_idle =timespec_sub (ts_postidle, ts_preidle);local_irq_enable ();local_fiq_enable (); -return timespec_to_ns (&ts_idle); +return (u32 )timespec_to_ns (&ts_idle)/1000 ; }/**
@@ -153,7 +156,7 @@ void omap_init_power_states(void) omap3_power_states[OMAP3_STATE_C2 ].flags =CPUIDLE_FLAG_TIME_VALID ;/* C3 . MPU OFF + Core active */ - omap3_power_states[OMAP3_STATE_C3 ].valid =0 ; + omap3_power_states[OMAP3_STATE_C3 ].valid =1 ; omap3_power_states[OMAP3_STATE_C3 ].type =OMAP3_STATE_C3 ; omap3_power_states[OMAP3_STATE_C3 ].sleep_latency =1500 ; omap3_power_states[OMAP3_STATE_C3 ].wakeup_latency =1800 ;
@@ -163,7 +166,7 @@ void omap_init_power_states(void) omap3_power_states[OMAP3_STATE_C3 ].flags =CPUIDLE_FLAG_TIME_VALID ;/* C4 . MPU CSWR + Core CSWR*/ - omap3_power_states[OMAP3_STATE_C4 ].valid =0 ; + omap3_power_states[OMAP3_STATE_C4 ].valid =1 ; omap3_power_states[OMAP3_STATE_C4 ].type =OMAP3_STATE_C4 ; omap3_power_states[OMAP3_STATE_C4 ].sleep_latency =2500 ; omap3_power_states[OMAP3_STATE_C4 ].wakeup_latency =7500 ;
@@ -174,7 +177,7 @@ void omap_init_power_states(void)CPUIDLE_FLAG_CHECK_BM ;/* C5 . MPU OFF + Core CSWR */ - omap3_power_states[OMAP3_STATE_C5 ].valid =0 ; + omap3_power_states[OMAP3_STATE_C5 ].valid =1 ; omap3_power_states[OMAP3_STATE_C5 ].type =OMAP3_STATE_C5 ; omap3_power_states[OMAP3_STATE_C5 ].sleep_latency =3000 ; omap3_power_states[OMAP3_STATE_C5 ].wakeup_latency =8500 ;
@@ -215,6 +218,7 @@ int omap3_idle_init(void)struct cpuidle_device *dev; mpu_pd =pwrdm_lookup ("mpu_pwrdm" ); + core_pd =pwrdm_lookup ("core_pwrdm" );omap_init_power_states ();cpuidle_register_driver (&omap3_idle_driver);
arch/arm/mach-omap2/pm.h +2 -0
@@ -19,6 +19,8 @@ extern u32 sleep_while_idle;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 set_pwrdm_state (struct powerdomain *pwrdm,u32 state);extern int omap3_pm_get_suspend_state (struct powerdomain *pwrdm);extern int omap3_pm_set_suspend_state (struct powerdomain *pwrdm,int state);
arch/arm/mach-omap2/pm34xx.c +2 -4
@@ -76,8 +76,6 @@ static struct powerdomain *mpu_pwrdm, *neon_pwrdm;static struct powerdomain *core_pwrdm, *per_pwrdm;static struct powerdomain *cam_pwrdm; -static int set_pwrdm_state (struct powerdomain *pwrdm,u32 state); -static inline void omap3_per_save_context (void ) {omap_gpio_save_context ();
@@ -503,7 +501,7 @@ static int omap3_fclks_active(void)return 0 ; } -static int omap3_can_sleep (void ) +int omap3_can_sleep (void ) {if (!sleep_while_idle)return 0 ;
@@ -517,7 +515,7 @@ static int omap3_can_sleep(void)/* This sets pwrdm state (other than mpu & core. Currently only ON & * RET are supported. Function is assuming that clkdm doesn't have * hw_sup mode enabled. */ -static int set_pwrdm_state (struct powerdomain *pwrdm,u32 state) +int set_pwrdm_state (struct powerdomain *pwrdm,u32 state) {u32 cur_state;int sleep_switch =0 ;
Signature · 1 line
1.6.4.3
PATCH 3/10 OMAP3: PM: CPUidle: obey enable_off_mode flag
If 'enable_off_mode' is not set, force powerdomain states to RET instead of OFF.
--- arch/arm/mach-omap2/cpuidle34xx.c | 14 ++++++++++++-- 1 files changed, 12 insertions(+), 2 deletions(-)
arch/arm/mach-omap2/cpuidle34xx.c +12 -2
@@ -29,6 +29,8 @@#include <plat/irqs.h> #include <plat/control.h> +#include "pm.h" +#ifdef CONFIG_CPU_IDLE #define OMAP3_MAX_STATES 7
@@ -74,6 +76,7 @@ static int omap3_enter_idle(struct cpuidle_device *dev, {struct omap3_processor_cx *cx =cpuidle_get_statedata (state);struct timespec ts_preidle, ts_postidle, ts_idle; +u32 mpu_state = cx->mpu_state, core_state = cx->core_state; current_cx_state = *cx;
@@ -83,8 +86,15 @@ static int omap3_enter_idle(struct cpuidle_device *dev,local_irq_disable ();local_fiq_disable (); -set_pwrdm_state (mpu_pd, cx->mpu_state); -set_pwrdm_state (core_pd, cx->core_state); +if (!enable_off_mode) { +if (mpu_state <PWRDM_POWER_RET ) + mpu_state =PWRDM_POWER_RET ; +if (core_state <PWRDM_POWER_RET ) + core_state =PWRDM_POWER_RET ; + } + +set_pwrdm_state (mpu_pd, mpu_state); +set_pwrdm_state (core_pd, core_state);if (omap_irq_pending ()) goto return_sleep_time;
Signature · 1 line
1.6.4.3
PATCH 4/10 OMAP3: PM: CPUidle: check activity for C2, C3, correct accounting
Use the activity check for states C2 and C3 as well. This is primarily to prevent deeper states during UART activity.
Also, if a different state is chosen than the target state, update the 'last_state' accordingly so that CPUidle state accounting is coorect.
--- arch/arm/mach-omap2/cpuidle34xx.c | 19 +++++++++++++------ 1 files changed, 13 insertions(+), 6 deletions(-)
arch/arm/mach-omap2/cpuidle34xx.c +13 -6
@@ -28,6 +28,7 @@#include <plat/powerdomain.h> #include <plat/irqs.h> #include <plat/control.h> +#include <plat/serial.h> #include "pm.h"
@@ -124,11 +125,15 @@ return_sleep_time:static int omap3_enter_idle_bm (struct cpuidle_device *dev,struct cpuidle_state *state) { +struct cpuidle_state *new_state = state; +if ((state->flags &CPUIDLE_FLAG_CHECK_BM ) &&omap3_idle_bm_check ()) { -if (dev->safe_state) -return dev->safe_state->enter (dev, dev->safe_state); +BUG_ON (!dev->safe_state); + new_state = dev->safe_state; } -return omap3_enter_idle (dev, state); + + dev->last_state = new_state; +return omap3_enter_idle (dev, new_state); } DEFINE_PER_CPU(struct cpuidle_device, omap3_idle_dev);
@@ -163,7 +168,8 @@ void omap_init_power_states(void) omap3_power_states[OMAP3_STATE_C2 ].threshold =300 ; omap3_power_states[OMAP3_STATE_C2 ].mpu_state =PWRDM_POWER_RET ; omap3_power_states[OMAP3_STATE_C2 ].core_state =PWRDM_POWER_ON ; - omap3_power_states[OMAP3_STATE_C2 ].flags =CPUIDLE_FLAG_TIME_VALID ; + omap3_power_states[OMAP3_STATE_C2 ].flags =CPUIDLE_FLAG_TIME_VALID | +CPUIDLE_FLAG_CHECK_BM ;/* C3 . MPU OFF + Core active */ omap3_power_states[OMAP3_STATE_C3 ].valid =1 ;
@@ -173,7 +179,8 @@ void omap_init_power_states(void) omap3_power_states[OMAP3_STATE_C3 ].threshold =4000 ; omap3_power_states[OMAP3_STATE_C3 ].mpu_state =PWRDM_POWER_OFF ; omap3_power_states[OMAP3_STATE_C3 ].core_state =PWRDM_POWER_ON ; - omap3_power_states[OMAP3_STATE_C3 ].flags =CPUIDLE_FLAG_TIME_VALID ; + omap3_power_states[OMAP3_STATE_C3 ].flags =CPUIDLE_FLAG_TIME_VALID | +CPUIDLE_FLAG_CHECK_BM ;/* C4 . MPU CSWR + Core CSWR*/ omap3_power_states[OMAP3_STATE_C4 ].valid =1 ;
@@ -198,7 +205,7 @@ void omap_init_power_states(void)CPUIDLE_FLAG_CHECK_BM ;/* C6 . MPU OFF + Core OFF */ - omap3_power_states[OMAP3_STATE_C6 ].valid =0 ; + omap3_power_states[OMAP3_STATE_C6 ].valid =1 ; omap3_power_states[OMAP3_STATE_C6 ].type =OMAP3_STATE_C6 ; omap3_power_states[OMAP3_STATE_C6 ].sleep_latency =10000 ; omap3_power_states[OMAP3_STATE_C6 ].wakeup_latency =30000 ;
Signature · 1 line
1.6.4.3
PATCH 5/10 OMAP3: PM: CPUidle: fix init sequencing
From: Kalle Jokiniemi <[email protected]>
Previously omap3_idle_init() was called in device_init, while omap_pm_init() is called at late_initcall. This causes the cpu idle driver to call omap_sram_idle before it is properly initialized. This patch fixes the issue by moving omap3_idle_init into omap3_pm_init.
--- arch/arm/mach-omap2/cpuidle34xx.c | 8 ++++++-- arch/arm/mach-omap2/pm.h | 1 + arch/arm/mach-omap2/pm34xx.c | 3 +-- 3 files changed, 8 insertions(+), 4 deletions(-)
arch/arm/mach-omap2/cpuidle34xx.c +6 -2
@@ -227,7 +227,7 @@ struct cpuidle_driver omap3_idle_driver = {* Registers the OMAP3 specific cpuidle driver with the cpuidle * framework with the valid set of states. */ -int omap3_idle_init (void ) +int __init omap3_idle_init (void ) {int i, count =0 ;struct omap3_processor_cx *cx;
@@ -272,5 +272,9 @@ int omap3_idle_init(void) return 0; } -device_initcall (omap3_idle_init); +#else +int __init omap3_idle_init (void ) +{ +return 0 ; +}#endif /* CONFIG_CPU_IDLE */
arch/arm/mach-omap2/pm.h +1 -0
@@ -21,6 +21,7 @@ extern void omap3_pm_off_mode_enable(int);extern void omap_sram_idle (void );extern int omap3_can_sleep (void );extern int set_pwrdm_state (struct powerdomain *pwrdm,u32 state); +extern int omap3_idle_init (void );extern int omap3_pm_get_suspend_state (struct powerdomain *pwrdm);extern int omap3_pm_set_suspend_state (struct powerdomain *pwrdm,int state);
arch/arm/mach-omap2/pm34xx.c +1 -2
@@ -1098,9 +1098,8 @@ static int __init omap3_pm_init(void)suspend_set_ops (&omap_pm_ops);#endif /* CONFIG_SUSPEND */ -#ifndef CONFIG_CPU_IDLE pm_idle = omap3_pm_idle; -#endif +omap3_idle_init ();pwrdm_add_wkdep (neon_pwrdm, mpu_pwrdm);/*
Signature · 1 line
1.6.4.3
PATCH 6/10 OMAP3: PM: CPUidle: Add new lower-latency C1 state
From: Peter 'p2' De Schrijver <[email protected]>
This patch introduces a new C state which allows MPU to go to WFI but keeps the core domain active. This offers a much better wakeup latency (3us vs 10s of us for the current C1) at the cost of a higher power consumption.
--- arch/arm/mach-omap2/cpuidle34xx.c | 125 ++++++++++++++++++++++++------------- 1 files changed, 81 insertions(+), 44 deletions(-)
arch/arm/mach-omap2/cpuidle34xx.c +81 -44
@@ -25,8 +25,9 @@#include <linux/cpuidle.h> #include <plat/prcm.h> -#include <plat/powerdomain.h> #include <plat/irqs.h> +#include <plat/powerdomain.h> +#include <plat/clockdomain.h> #include <plat/control.h> #include <plat/serial.h>
@@ -34,13 +35,14 @@ #ifdef CONFIG_CPU_IDLE -#define OMAP3_MAX_STATES 7 +#define OMAP3_MAX_STATES 8 #define OMAP3_STATE_C1 1 /* C1 - MPU WFI + Core active */ -#define OMAP3_STATE_C2 2 /* C2 - MPU CSWR + Core active */ -#define OMAP3_STATE_C3 3 /* C3 - MPU OFF + Core active */ -#define OMAP3_STATE_C4 4 /* C4 - MPU RET + Core RET */ -#define OMAP3_STATE_C5 5 /* C5 - MPU OFF + Core RET */ -#define OMAP3_STATE_C6 6 /* C6 - MPU OFF + Core OFF */ +#define OMAP3_STATE_C2 2 /* C2 - MPU WFI + Core inactive */ +#define OMAP3_STATE_C3 3 /* C3 - MPU CSWR + Core inactive */ +#define OMAP3_STATE_C4 4 /* C4 - MPU OFF + Core iactive */ +#define OMAP3_STATE_C5 5 /* C5 - MPU RET + Core RET */ +#define OMAP3_STATE_C6 6 /* C6 - MPU OFF + Core RET */ +#define OMAP3_STATE_C7 7 /* C7 - MPU OFF + Core OFF */ struct omap3_processor_cx { u8 valid;
@@ -64,6 +66,20 @@ static int omap3_idle_bm_check(void)return 0 ; } +static int _cpuidle_allow_idle (struct powerdomain *pwrdm, +struct clockdomain *clkdm) +{ +omap2_clkdm_allow_idle (clkdm); +return 0 ; +} + +static int _cpuidle_deny_idle (struct powerdomain *pwrdm, +struct clockdomain *clkdm) +{ +omap2_clkdm_deny_idle (clkdm); +return 0 ; +} +/** * omap3_enter_idle - Programs OMAP3 to enter the specified state * @dev: cpuidle device
@@ -100,9 +116,19 @@ static int omap3_enter_idle(struct cpuidle_device *dev,if (omap_irq_pending ()) goto return_sleep_time; +if (cx->type ==OMAP3_STATE_C1 ) { +pwrdm_for_each_clkdm (mpu_pd, _cpuidle_deny_idle); +pwrdm_for_each_clkdm (core_pd, _cpuidle_deny_idle); + } +/* Execute ARM wfi */ omap_sram_idle (); +if (cx->type ==OMAP3_STATE_C1 ) { +pwrdm_for_each_clkdm (mpu_pd, _cpuidle_allow_idle); +pwrdm_for_each_clkdm (core_pd, _cpuidle_allow_idle); + } + return_sleep_time:getnstimeofday (&ts_postidle); ts_idle =timespec_sub (ts_postidle, ts_preidle);
@@ -141,79 +167,90 @@ DEFINE_PER_CPU(struct cpuidle_device, omap3_idle_dev);/* omap3_init_power_states - Initialises the OMAP3 specific C states. * * Below is the desciption of each C state. -* C1 . MPU WFI + Core active -* C2 . MPU CSWR + Core active -* C3 . MPU OFF + Core active -* C4 . MPU CSWR + Core CSWR -* C5 . MPU OFF + Core CSWR -* C6 . MPU OFF + Core OFF +* C1 . MPU WFI + Core active +* C2 . MPU WFI + Core inactive +* C3 . MPU CSWR + Core inactive +* C4 . MPU OFF + Core inactive +* C5 . MPU CSWR + Core CSWR +* C6 . MPU OFF + Core CSWR +* C7 . MPU OFF + Core OFF */ void omap_init_power_states (void ) {/* C1 . MPU WFI + Core active */ omap3_power_states[OMAP3_STATE_C1 ].valid =1 ; omap3_power_states[OMAP3_STATE_C1 ].type =OMAP3_STATE_C1 ; - omap3_power_states[OMAP3_STATE_C1 ].sleep_latency =10 ; - omap3_power_states[OMAP3_STATE_C1 ].wakeup_latency =10 ; - omap3_power_states[OMAP3_STATE_C1 ].threshold =30 ; + omap3_power_states[OMAP3_STATE_C1 ].sleep_latency =2 ; + omap3_power_states[OMAP3_STATE_C1 ].wakeup_latency =2 ; + omap3_power_states[OMAP3_STATE_C1 ].threshold =5 ; omap3_power_states[OMAP3_STATE_C1 ].mpu_state =PWRDM_POWER_ON ; omap3_power_states[OMAP3_STATE_C1 ].core_state =PWRDM_POWER_ON ; omap3_power_states[OMAP3_STATE_C1 ].flags =CPUIDLE_FLAG_TIME_VALID ; -/* C2 . MPU CSWR + Core active */ +/* C2 . MPU WFI + Core inactive */ omap3_power_states[OMAP3_STATE_C2 ].valid =1 ; omap3_power_states[OMAP3_STATE_C2 ].type =OMAP3_STATE_C2 ; - omap3_power_states[OMAP3_STATE_C2 ].sleep_latency =50 ; - omap3_power_states[OMAP3_STATE_C2 ].wakeup_latency =50 ; - omap3_power_states[OMAP3_STATE_C2 ].threshold =300 ; - omap3_power_states[OMAP3_STATE_C2 ].mpu_state =PWRDM_POWER_RET ; + omap3_power_states[OMAP3_STATE_C2 ].sleep_latency =10 ; + omap3_power_states[OMAP3_STATE_C2 ].wakeup_latency =10 ; + omap3_power_states[OMAP3_STATE_C2 ].threshold =30 ; + omap3_power_states[OMAP3_STATE_C2 ].mpu_state =PWRDM_POWER_ON ; omap3_power_states[OMAP3_STATE_C2 ].core_state =PWRDM_POWER_ON ; - omap3_power_states[OMAP3_STATE_C2 ].flags =CPUIDLE_FLAG_TIME_VALID | -CPUIDLE_FLAG_CHECK_BM ; + omap3_power_states[OMAP3_STATE_C2 ].flags =CPUIDLE_FLAG_TIME_VALID ; -/* C3 . MPU OFF + Core active */ +/* C3 . MPU CSWR + Core inactive */ omap3_power_states[OMAP3_STATE_C3 ].valid =1 ; omap3_power_states[OMAP3_STATE_C3 ].type =OMAP3_STATE_C3 ; - omap3_power_states[OMAP3_STATE_C3 ].sleep_latency =1500 ; - omap3_power_states[OMAP3_STATE_C3 ].wakeup_latency =1800 ; - omap3_power_states[OMAP3_STATE_C3 ].threshold =4000 ; - omap3_power_states[OMAP3_STATE_C3 ].mpu_state =PWRDM_POWER_OFF ; + omap3_power_states[OMAP3_STATE_C3 ].sleep_latency =50 ; + omap3_power_states[OMAP3_STATE_C3 ].wakeup_latency =50 ; + omap3_power_states[OMAP3_STATE_C3 ].threshold =300 ; + omap3_power_states[OMAP3_STATE_C3 ].mpu_state =PWRDM_POWER_RET ; omap3_power_states[OMAP3_STATE_C3 ].core_state =PWRDM_POWER_ON ; omap3_power_states[OMAP3_STATE_C3 ].flags =CPUIDLE_FLAG_TIME_VALID |CPUIDLE_FLAG_CHECK_BM ; -/* C4 . MPU CSWR + Core CSWR*/ +/* C4 . MPU OFF + Core inactive */ omap3_power_states[OMAP3_STATE_C4 ].valid =1 ; omap3_power_states[OMAP3_STATE_C4 ].type =OMAP3_STATE_C4 ; - omap3_power_states[OMAP3_STATE_C4 ].sleep_latency =2500 ; - omap3_power_states[OMAP3_STATE_C4 ].wakeup_latency =7500 ; - omap3_power_states[OMAP3_STATE_C4 ].threshold =12000 ; - omap3_power_states[OMAP3_STATE_C4 ].mpu_state =PWRDM_POWER_RET ; - omap3_power_states[OMAP3_STATE_C4 ].core_state =PWRDM_POWER_RET ; + omap3_power_states[OMAP3_STATE_C4 ].sleep_latency =1500 ; + omap3_power_states[OMAP3_STATE_C4 ].wakeup_latency =1800 ; + omap3_power_states[OMAP3_STATE_C4 ].threshold =4000 ; + omap3_power_states[OMAP3_STATE_C4 ].mpu_state =PWRDM_POWER_OFF ; + omap3_power_states[OMAP3_STATE_C4 ].core_state =PWRDM_POWER_ON ; omap3_power_states[OMAP3_STATE_C4 ].flags =CPUIDLE_FLAG_TIME_VALID |CPUIDLE_FLAG_CHECK_BM ; -/* C5 . MPU OFF + Core CSWR */ +/* C5 . MPU CSWR + Core CSWR*/ omap3_power_states[OMAP3_STATE_C5 ].valid =1 ; omap3_power_states[OMAP3_STATE_C5 ].type =OMAP3_STATE_C5 ; - omap3_power_states[OMAP3_STATE_C5 ].sleep_latency =3000 ; - omap3_power_states[OMAP3_STATE_C5 ].wakeup_latency =8500 ; - omap3_power_states[OMAP3_STATE_C5 ].threshold =15000 ; - omap3_power_states[OMAP3_STATE_C5 ].mpu_state =PWRDM_POWER_OFF ; + omap3_power_states[OMAP3_STATE_C5 ].sleep_latency =2500 ; + omap3_power_states[OMAP3_STATE_C5 ].wakeup_latency =7500 ; + omap3_power_states[OMAP3_STATE_C5 ].threshold =12000 ; + omap3_power_states[OMAP3_STATE_C5 ].mpu_state =PWRDM_POWER_RET ; omap3_power_states[OMAP3_STATE_C5 ].core_state =PWRDM_POWER_RET ; omap3_power_states[OMAP3_STATE_C5 ].flags =CPUIDLE_FLAG_TIME_VALID |CPUIDLE_FLAG_CHECK_BM ; -/* C6 . MPU OFF + Core OFF */ +/* C6 . MPU OFF + Core CSWR */ omap3_power_states[OMAP3_STATE_C6 ].valid =1 ; omap3_power_states[OMAP3_STATE_C6 ].type =OMAP3_STATE_C6 ; - omap3_power_states[OMAP3_STATE_C6 ].sleep_latency =10000 ; - omap3_power_states[OMAP3_STATE_C6 ].wakeup_latency =30000 ; - omap3_power_states[OMAP3_STATE_C6 ].threshold =300000 ; + omap3_power_states[OMAP3_STATE_C6 ].sleep_latency =3000 ; + omap3_power_states[OMAP3_STATE_C6 ].wakeup_latency =8500 ; + omap3_power_states[OMAP3_STATE_C6 ].threshold =15000 ; omap3_power_states[OMAP3_STATE_C6 ].mpu_state =PWRDM_POWER_OFF ; - omap3_power_states[OMAP3_STATE_C6 ].core_state =PWRDM_POWER_OFF ; + omap3_power_states[OMAP3_STATE_C6 ].core_state =PWRDM_POWER_RET ; omap3_power_states[OMAP3_STATE_C6 ].flags =CPUIDLE_FLAG_TIME_VALID |CPUIDLE_FLAG_CHECK_BM ; + +/* C7 . MPU OFF + Core OFF */ + omap3_power_states[OMAP3_STATE_C7 ].valid =1 ; + omap3_power_states[OMAP3_STATE_C7 ].type =OMAP3_STATE_C7 ; + omap3_power_states[OMAP3_STATE_C7 ].sleep_latency =10000 ; + omap3_power_states[OMAP3_STATE_C7 ].wakeup_latency =30000 ; + omap3_power_states[OMAP3_STATE_C7 ].threshold =300000 ; + omap3_power_states[OMAP3_STATE_C7 ].mpu_state =PWRDM_POWER_OFF ; + omap3_power_states[OMAP3_STATE_C7 ].core_state =PWRDM_POWER_OFF ; + omap3_power_states[OMAP3_STATE_C7 ].flags =CPUIDLE_FLAG_TIME_VALID | +CPUIDLE_FLAG_CHECK_BM ; }struct cpuidle_driver omap3_idle_driver = {
Signature · 1 line
1.6.4.3
PATCH 7/10 OMAP3: PM: CPUidle: Start C-state definitions from base 0
From: Sanjeev Premi <[email protected]>
The current definition of C-states starts from base 1. Whereas, the cpuidle driver uses base 0. This patch eliminates need for explicit mapping (add/ sbutract) due to different base values.
--- arch/arm/mach-omap2/cpuidle34xx.c | 18 +++++++++--------- 1 files changed, 9 insertions(+), 9 deletions(-)
arch/arm/mach-omap2/cpuidle34xx.c +9 -9
@@ -35,14 +35,14 @@ #ifdef CONFIG_CPU_IDLE -#define OMAP3_MAX_STATES 8 -#define OMAP3_STATE_C1 1 /* C1 - MPU WFI + Core active */ -#define OMAP3_STATE_C2 2 /* C2 - MPU WFI + Core inactive */ -#define OMAP3_STATE_C3 3 /* C3 - MPU CSWR + Core inactive */ -#define OMAP3_STATE_C4 4 /* C4 - MPU OFF + Core iactive */ -#define OMAP3_STATE_C5 5 /* C5 - MPU RET + Core RET */ -#define OMAP3_STATE_C6 6 /* C6 - MPU OFF + Core RET */ -#define OMAP3_STATE_C7 7 /* C7 - MPU OFF + Core OFF */ +#define OMAP3_MAX_STATES 7 +#define OMAP3_STATE_C1 0 /* C1 - MPU WFI + Core active */ +#define OMAP3_STATE_C2 1 /* C2 - MPU WFI + Core inactive */ +#define OMAP3_STATE_C3 2 /* C3 - MPU CSWR + Core inactive */ +#define OMAP3_STATE_C4 3 /* C4 - MPU OFF + Core iactive */ +#define OMAP3_STATE_C5 4 /* C5 - MPU RET + Core RET */ +#define OMAP3_STATE_C6 5 /* C6 - MPU OFF + Core RET */ +#define OMAP3_STATE_C7 6 /* C7 - MPU OFF + Core OFF */ struct omap3_processor_cx { u8 valid;
@@ -279,7 +279,7 @@ int __init omap3_idle_init(void) dev = &per_cpu (omap3_idle_dev,smp_processor_id ()); -for (i =1 ; i <OMAP3_MAX_STATES ; i++) { +for (i =OMAP3_STATE_C1 ; i <OMAP3_MAX_STATES ; i++) { cx = &omap3_power_states[i]; state = &dev->states[count];
Signature · 1 line
1.6.4.3
PATCH 8/10 OMAP3: PM: Use pwrdm_set_next_pwrst instead of set_pwrdm_state in idle loop
From: Jouni Hogander <[email protected]>
It is more efficient to use pwrdm_set_next_pwrst for mpu, core and neon instead of set_pwrdm_state in idle loop. It is anyway known that those are active in idle loop. So no need to use set_pwrdm_state.
--- arch/arm/mach-omap2/cpuidle34xx.c | 4 ++-- arch/arm/mach-omap2/pm34xx.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-)
arch/arm/mach-omap2/cpuidle34xx.c +2 -2
@@ -110,8 +110,8 @@ static int omap3_enter_idle(struct cpuidle_device *dev, core_state =PWRDM_POWER_RET ; } -set_pwrdm_state (mpu_pd, mpu_state); -set_pwrdm_state (core_pd, core_state); +pwrdm_set_next_pwrst (mpu_pd, mpu_state); +pwrdm_set_next_pwrst (core_pd, core_state);if (omap_irq_pending ()) goto return_sleep_time;
arch/arm/mach-omap2/pm34xx.c +1 -1
@@ -359,7 +359,7 @@ void omap_sram_idle(void)/* NEON control */ if (pwrdm_read_pwrst (neon_pwrdm) ==PWRDM_POWER_ON ) -set_pwrdm_state (neon_pwrdm, mpu_next_state); +pwrdm_set_next_pwrst (neon_pwrdm, mpu_next_state);/* PER */ per_next_state =pwrdm_read_next_pwrst (per_pwrdm);
Signature · 1 line
1.6.4.3
PATCH 9/10 OMAP3: PM: idle: Remove fclk check for idle loop
From: Peter 'p2' De Schrijver <[email protected]>
This patch removes the check to see if some functional clocks are still enabled before entering sleep. This is no longer needed when using safe state (C1) that keeps CORE active.
--- arch/arm/mach-omap2/pm34xx.c | 42 ------------------------------------------ 1 files changed, 0 insertions(+), 42 deletions(-)
arch/arm/mach-omap2/pm34xx.c +0 -42
@@ -461,54 +461,12 @@ void omap_sram_idle(void)omap2_clkdm_allow_idle (mpu_pwrdm->pwrdm_clkdms[0 ]); } -/* -* Check if functional clocks are enabled before entering -* sleep. This function could be behind CONFIG_PM_DEBUG -* when all drivers are configuring their sysconfig registers -* properly and using their clocks properly. -*/ -static int omap3_fclks_active (void ) -{ -u32 fck_core1 =0 , fck_core3 =0 , fck_sgx =0 , fck_dss =0 , - fck_cam =0 , fck_per =0 , fck_usbhost =0 ; - - fck_core1 =cm_read_mod_reg (CORE_MOD , -CM_FCLKEN1 ); -if (omap_rev () >OMAP3430_REV_ES1_0 ) { - fck_core3 =cm_read_mod_reg (CORE_MOD , -OMAP3430ES2_CM_FCLKEN3 ); - fck_sgx =cm_read_mod_reg (OMAP3430ES2_SGX_MOD , -CM_FCLKEN ); - fck_usbhost =cm_read_mod_reg (OMAP3430ES2_USBHOST_MOD , -CM_FCLKEN ); - }else - fck_sgx =cm_read_mod_reg (GFX_MOD , -OMAP3430ES2_CM_FCLKEN3 ); - fck_dss =cm_read_mod_reg (OMAP3430_DSS_MOD , -CM_FCLKEN ); - fck_cam =cm_read_mod_reg (OMAP3430_CAM_MOD , -CM_FCLKEN ); - fck_per =cm_read_mod_reg (OMAP3430_PER_MOD , -CM_FCLKEN ); - -/* Ignore UART clocks. These are handled by UART core (serial.c) */ - fck_core1 &= ~(OMAP3430_EN_UART1 |OMAP3430_EN_UART2 ); - fck_per &= ~OMAP3430_EN_UART3 ; - -if (fck_core1 | fck_core3 | fck_sgx | fck_dss | - fck_cam | fck_per | fck_usbhost) -return 1 ; -return 0 ; -} -int omap3_can_sleep (void ) {if (!sleep_while_idle)return 0 ;if (!omap_uart_can_sleep ())return 0 ; -if (omap3_fclks_active ()) -return 0 ;return 1 ; }
Signature · 1 line
1.6.4.3
PATCH 10/10 OMAP3: PM: Added resched check into idle calls
From: Tero Kristo <[email protected]>
Fixes a bug where scheduling is delayed until next wakeup due to race condition (e.g. interrupt requests scheduling just before omap_sram_idle is entered.)
--- arch/arm/mach-omap2/cpuidle34xx.c | 3 ++- arch/arm/mach-omap2/pm34xx.c | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-)
arch/arm/mach-omap2/cpuidle34xx.c +2 -1
@@ -22,6 +22,7 @@* published by the Free Software Foundation. */ +#include <linux/sched.h> #include <linux/cpuidle.h> #include <plat/prcm.h>
@@ -113,7 +114,7 @@ static int omap3_enter_idle(struct cpuidle_device *dev,pwrdm_set_next_pwrst (mpu_pd, mpu_state);pwrdm_set_next_pwrst (core_pd, core_state); -if (omap_irq_pending ()) +if (omap_irq_pending () ||need_resched ()) goto return_sleep_time;if (cx->type ==OMAP3_STATE_C1 ) {
arch/arm/mach-omap2/pm34xx.c +1 -1
@@ -523,7 +523,7 @@ static void omap3_pm_idle(void)if (!omap3_can_sleep ()) goto out; -if (omap_irq_pending ()) +if (omap_irq_pending () ||need_resched ()) goto out;omap_sram_idle ();
Signature · 1 line
1.6.4.3