OMAP PM core updates for 2.6.35 [updated]
cover OMAP PM core updates for 2.6.35 [updated]
A small series of OMAP PM core updates for 2.6.35.
Applies on v2.6.34-rc6.
Also available here in my pm-next branch here:git://git.kernel.org/pub/scm/linux/kernel/git/tmlind/linux-omap-2.6.git pm-next
Ari Kauppi (1):
OMAP3: PM: Add milliseconds interface to suspend wakeup timer
Kevin Hilman (1):
OMAP3: PRCM interrupt: only check and clear enabled PRCM IRQs
Mike Chan (2):
OMAP3: PM: Enable IO / IO-CHAIN wakeups for PER
OMAP3: PM: Remove PER wakeup dependency on CORE.
Ranjith Lohithakshan (2):
OMAP3EVM: Update pad configuration for wakeup enabled pads
OMAP3: PM: Enable wakeup from ads7846 touchscreen
arch/arm/mach-omap2/board-3430sdp.c | 1 + arch/arm/mach-omap2/board-omap3evm.c | 6 ++-- arch/arm/mach-omap2/pm-debug.c | 3 ++ arch/arm/mach-omap2/pm.h | 1 + arch/arm/mach-omap2/pm34xx.c | 58 +++++++++++++++++++-------------- 5 files changed, 41 insertions(+), 28 deletions(-)
PATCH 1/6 OMAP3: PRCM interrupt: only check and clear enabled PRCM IRQs
While handling PRCM IRQs, mask out interrupts that are not enabled in PRM_IRQENABLE_MPU. If these are not masked out, non-enabled interrupts are caught, a WARN() is printed due to no 'handler' and the events are cleared. In addition to being noisy, this can also interfere with independent polling of this register by SR/VP code.
This was noticed using SmartReflex transitions which cause the VPx_* interrupts to be handled since they are set in PRM_IRQSTATUS_MPU even but not enabled in PRM_IRQENABLE_MPU.
--- arch/arm/mach-omap2/pm34xx.c | 17 ++++++++++++----- 1 files changed, 12 insertions(+), 5 deletions(-)
arch/arm/mach-omap2/pm34xx.c +12 -5
@@ -267,13 +267,16 @@ static int _prcm_int_handle_wakeup(void)*/ static irqreturn_t prcm_interrupt_handler (int irq,void *dev_id) { -u32 irqstatus_mpu; +u32 irqenable_mpu, irqstatus_mpu;int c =0 ; - do { - irqstatus_mpu = prm_read_mod_reg(OCP_MOD, - OMAP3_PRM_IRQSTATUS_MPU_OFFSET); + irqenable_mpu =prm_read_mod_reg (OCP_MOD , +OMAP3_PRM_IRQENABLE_MPU_OFFSET ); + irqstatus_mpu =prm_read_mod_reg (OCP_MOD , +OMAP3_PRM_IRQSTATUS_MPU_OFFSET ); + irqstatus_mpu &= irqenable_mpu; + do { if (irqstatus_mpu & (OMAP3430_WKUP_ST | OMAP3430_IO_ST)) { c = _prcm_int_handle_wakeup();
@@ -292,7 +295,11 @@ static irqreturn_t prcm_interrupt_handler (int irq, void *dev_id)prm_write_mod_reg (irqstatus_mpu,OCP_MOD ,OMAP3_PRM_IRQSTATUS_MPU_OFFSET ); - }while (prm_read_mod_reg (OCP_MOD ,OMAP3_PRM_IRQSTATUS_MPU_OFFSET )); + irqstatus_mpu =prm_read_mod_reg (OCP_MOD , +OMAP3_PRM_IRQSTATUS_MPU_OFFSET ); + irqstatus_mpu &= irqenable_mpu; + + }while (irqstatus_mpu);return IRQ_HANDLED ; }
Signature · 1 line
1.7.0.2
PATCH 2/6 OMAP3: PM: Add milliseconds interface to suspend wakeup timer
In reply to Kevin HilmanFrom: Ari Kauppi <[email protected]>
Millisecond resolution is possible and there are use cases for it (automatic testing).
Seconds-based interface is preserved for compatibility.
--- arch/arm/mach-omap2/pm-debug.c | 3 +++ arch/arm/mach-omap2/pm.h | 1 + arch/arm/mach-omap2/pm34xx.c | 17 ++++++++++------- 3 files changed, 14 insertions(+), 7 deletions(-)
arch/arm/mach-omap2/pm-debug.c +3 -0
@@ -548,6 +548,9 @@ static int option_set(void *data, u64 val) {u32 *option = data; +if (option == &wakeup_timer_milliseconds && val >=1000 ) +return -EINVAL ; + *option = val;if (option == &enable_off_mode)
arch/arm/mach-omap2/pm.h +1 -0
@@ -43,6 +43,7 @@ extern int omap3_pm_get_suspend_state(struct powerdomain *pwrdm);extern int omap3_pm_set_suspend_state (struct powerdomain *pwrdm,int state);extern u32 wakeup_timer_seconds; +extern u32 wakeup_timer_milliseconds;extern struct omap_dm_timer *gptimer_wakeup;#ifdef CONFIG_PM_DEBUG
arch/arm/mach-omap2/pm34xx.c +10 -7
@@ -58,6 +58,7 @@u32 enable_off_mode;u32 sleep_while_idle;u32 wakeup_timer_seconds; +u32 wakeup_timer_milliseconds;struct power_state {struct powerdomain *pwrdm;
@@ -555,20 +556,21 @@ out:#ifdef CONFIG_SUSPEND static suspend_state_t suspend_state; -static void omap2_pm_wakeup_on_timer (u32 seconds) +static void omap2_pm_wakeup_on_timer (u32 seconds,u32 milliseconds) {u32 tick_rate, cycles; -if (!seconds) +if (!seconds && !milliseconds)return ; tick_rate =clk_get_rate (omap_dm_timer_get_fclk (gptimer_wakeup)); - cycles = tick_rate * seconds; + cycles = tick_rate * seconds + tick_rate * milliseconds /1000 ;omap_dm_timer_stop (gptimer_wakeup);omap_dm_timer_set_load_start (gptimer_wakeup,0 ,0xffffffff - cycles); -pr_info ("PM: Resume timer in %d secs (%d ticks at %d ticks/sec.)\n" , - seconds, cycles, tick_rate); +pr_info ("PM: Resume timer in %u.%03u secs" +" (%d ticks at %d ticks/sec.)\n" , + seconds, milliseconds, cycles, tick_rate); }static int omap3_pm_prepare (void )
@@ -582,8 +584,9 @@ static int omap3_pm_suspend(void)struct power_state *pwrst;int state, ret =0 ; -if (wakeup_timer_seconds) -omap2_pm_wakeup_on_timer (wakeup_timer_seconds); +if (wakeup_timer_seconds || wakeup_timer_milliseconds) +omap2_pm_wakeup_on_timer (wakeup_timer_seconds, + wakeup_timer_milliseconds);/* Read current next_pwrsts */ list_for_each_entry (pwrst, &pwrst_list, node)
Signature · 1 line
1.7.0.2
PATCH 3/6 OMAP3EVM: Update pad configuration for wakeup enabled pads
In reply to Kevin HilmanFrom: Ranjith Lohithakshan <[email protected]>
OMAP3530 TRM section 7.4.4.4.2 requires OFFOUTENABLE to be set (active low) if wakeup capabilities are enabled on a pad. During OFF mode testing on OMAP3530 EVM, it was observed that the device was not residing in the OFF state. The device enters into the OFF state and immediately exits from that state as if an IO wakeup event has occured. The issue was traced down to the pad configuration of wkaeup enabled pad's.
--- arch/arm/mach-omap2/board-omap3evm.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
arch/arm/mach-omap2/board-omap3evm.c +2 -2
@@ -651,10 +651,10 @@ static struct ehci_hcd_omap_platform_data ehci_pdata __initdata = {#ifdef CONFIG_OMAP_MUX static struct omap_board_mux board_mux[]__initdata = {OMAP3_MUX (SYS_NIRQ ,OMAP_MUX_MODE0 |OMAP_PIN_INPUT_PULLUP | -OMAP_PIN_OFF_INPUT_PULLUP | +OMAP_PIN_OFF_INPUT_PULLUP |OMAP_PIN_OFF_OUTPUT_LOW |OMAP_PIN_OFF_WAKEUPENABLE ),OMAP3_MUX (MCSPI1_CS1 ,OMAP_MUX_MODE4 |OMAP_PIN_INPUT_PULLUP | -OMAP_PIN_OFF_INPUT_PULLUP | +OMAP_PIN_OFF_INPUT_PULLUP |OMAP_PIN_OFF_OUTPUT_LOW |OMAP_PIN_OFF_WAKEUPENABLE ), { .reg_offset =OMAP_MUX_TERMINATOR }, };
Signature · 1 line
1.7.0.2
PATCH 4/6 OMAP3: PM: Enable wakeup from ads7846 touchscreen
In reply to Kevin HilmanFrom: Ranjith Lohithakshan <[email protected]>
This patch enables the wakeup capabilities of ads7846 touchscreen driver. ads7846 driver can now wakeup the system from suspend on OMAP3430 EVM and SDP boards.
The earlier approach of enabling wakeup on the touchscreen GPIO pin during board level mux init is removed. Instead the wakeup flag in ads7846_platform_data is enabled. Based on the flag, the ads7846 driver will do an enable_irq_wake which will eventually call into the OMAP GPIO layer and will enable the wakeup capability on the GPIO pin.
--- arch/arm/mach-omap2/board-3430sdp.c | 1 + arch/arm/mach-omap2/board-omap3evm.c | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-)
arch/arm/mach-omap2/board-3430sdp.c +1 -0
@@ -150,6 +150,7 @@ static int ads7846_get_pendown_state(void)static struct ads7846_platform_data tsc2046_config__initdata = { .get_pendown_state = ads7846_get_pendown_state, .keep_vref_on =1 , + .wakeup = true, };
arch/arm/mach-omap2/board-omap3evm.c +2 -2
@@ -600,6 +600,7 @@ struct ads7846_platform_data ads7846_config = { .get_pendown_state = ads7846_get_pendown_state, .keep_vref_on = 1, .settle_delay_usecs = 150, + .wakeup = true, };static struct omap2_mcspi_device_config ads7846_mcspi_config = {
@@ -654,8 +655,7 @@ static struct omap_board_mux board_mux[] __initdata = {OMAP_PIN_OFF_INPUT_PULLUP |OMAP_PIN_OFF_OUTPUT_LOW | OMAP_PIN_OFF_WAKEUPENABLE),OMAP3_MUX (MCSPI1_CS1 ,OMAP_MUX_MODE4 |OMAP_PIN_INPUT_PULLUP | -OMAP_PIN_OFF_INPUT_PULLUP |OMAP_PIN_OFF_OUTPUT_LOW | -OMAP_PIN_OFF_WAKEUPENABLE ), +OMAP_PIN_OFF_INPUT_PULLUP |OMAP_PIN_OFF_OUTPUT_LOW ), { .reg_offset = OMAP_MUX_TERMINATOR }, };#else
Signature · 1 line
1.7.0.2
PATCH 5/6 OMAP3: PM: Enable IO / IO-CHAIN wakeups for PER
In reply to Kevin HilmanFrom: Mike Chan <[email protected]>
IO events can also come from GPIO modules, which reside in the PER domain. It is possible for the PER to enter RET while CORE is still in ON. If GPIO 2-6 are enabled for IO-pad wakeups, the PER domain will not wakeup in this case, unless we enable it.
--- arch/arm/mach-omap2/pm34xx.c | 16 +++++++++++----- 1 files changed, 11 insertions(+), 5 deletions(-)
arch/arm/mach-omap2/pm34xx.c +11 -5
@@ -379,9 +379,16 @@ void omap_sram_idle(void)if (pwrdm_read_pwrst (neon_pwrdm) ==PWRDM_POWER_ON )pwrdm_set_next_pwrst (neon_pwrdm, mpu_next_state); -/* PER */ +/* Enable IO-PAD and IO-CHAIN wakeups */ per_next_state =pwrdm_read_next_pwrst (per_pwrdm); core_next_state =pwrdm_read_next_pwrst (core_pwrdm); +if (per_next_state <PWRDM_POWER_ON || + core_next_state <PWRDM_POWER_ON ) { +prm_set_mod_reg_bits (OMAP3430_EN_IO ,WKUP_MOD ,PM_WKEN ); +omap3_enable_io_chain (); + } + +/* PER */ if (per_next_state <PWRDM_POWER_ON ) {omap_uart_prepare_idle (2 );omap2_gpio_prepare_for_retention ();
@@ -406,10 +413,8 @@ void omap_sram_idle(void)omap3_core_save_context ();omap3_prcm_save_context (); } -/* Enable IO-PAD and IO-CHAIN wakeups */ -prm_set_mod_reg_bits (OMAP3430_EN_IO ,WKUP_MOD ,PM_WKEN ); -omap3_enable_io_chain (); } +omap3_intc_prepare_idle ();/*
@@ -471,7 +476,8 @@ void omap_sram_idle(void) }/* Disable IO-PAD and IO-CHAIN wakeup */ -if (core_next_state <PWRDM_POWER_ON ) { +if (per_next_state <PWRDM_POWER_ON || + core_next_state <PWRDM_POWER_ON ) {prm_clear_mod_reg_bits (OMAP3430_EN_IO ,WKUP_MOD ,PM_WKEN );omap3_disable_io_chain (); }
Signature · 1 line
1.7.0.2
PATCH 6/6 OMAP3: PM: Remove PER wakeup dependency on CORE.
In reply to Kevin HilmanFrom: Mike Chan <[email protected]>
We can remove this wakeup dependency since now, when GPIO2-6 are enabled for IO-pad wakeup, PER domain is gauranteed to be awake or be woken up to service.
The previous dependency did not handle all corner cases. Since there was no sleep dependency between CORE and PER domains, if PER enters RET and CORE is ON, PER will not be active for GPIO handling.
--- arch/arm/mach-omap2/pm34xx.c | 8 -------- 1 files changed, 0 insertions(+), 8 deletions(-)
arch/arm/mach-omap2/pm34xx.c +0 -8
@@ -1096,14 +1096,6 @@ static int __init omap3_pm_init(void)omap3_idle_init ();clkdm_add_wkdep (neon_clkdm, mpu_clkdm); -/* -* REVISIT: This wkdep is only necessary when GPIO2-6 are enabled for -* IO-pad wakeup. Otherwise it will unnecessarily waste power -* waking up PER with every CORE wakeup - see -* http://marc.info/?l=linux-omap&m=121852150710062&w=2 -*/ -clkdm_add_wkdep (per_clkdm, core_clkdm); -if (omap_type () !=OMAP2_DEVICE_TYPE_GP ) { omap3_secure_ram_storage =kmalloc (0x803F ,GFP_KERNEL );
Signature · 1 line
1.7.0.2