OMAP: GPIO: handle save/restore ctx in GPIO driver
PATCH 4/7 OMAP: GPIO: handle save/restore ctx in GPIO driver
From: Charulatha V <[email protected]>
Modify omap_gpio_prepare_for_idle() & omap_gpio_resume_after_idle() functions to handle save context & restore context respectively in the OMAP GPIO driver itself instead of calling these functions from pm specific files. For this, in gpio_prepare_for_idle(), use omap_device_get_context_loss_count() and in gpio_resume_after_idle() call it again. If the count is different, do restore context.
context lost count is modified in omap_sram_idle() path when pwrdm_post_transition() is called. But pwrdm_post_transition() is called only after omap_gpio_resume_after_idle() is called. Hence correct this so that context lost count is modified before calling omap_gpio_resume_after_idle().
omap_gpio_prepare_for_idle() & omap_gpio_resume_after_idle() do nothing if none of the GPIOs in a bank is being used.
Also remove usage of cpu_is_* checks from the above mentioned functions and fix the multi-line comment style
---
Note that the usage of bank->method checks would be re-addressed during OMAP GPIO cleanup series which would follow this patch series
arch/arm/mach-omap2/pm34xx.c | 22 +--- arch/arm/plat-omap/gpio.c | 226 ++++++++++++++++--------------- arch/arm/plat-omap/include/plat/gpio.h | 2 - 3 files changed, 122 insertions(+), 128 deletions(-)
arch/arm/mach-omap2/pm34xx.c +5 -17
@@ -91,16 +91,6 @@ static struct powerdomain *mpu_pwrdm, *neon_pwrdm;static struct powerdomain *core_pwrdm, *per_pwrdm;static struct powerdomain *cam_pwrdm; -static inline void omap3_per_save_context (void ) -{ -omap_gpio_save_context (); -} - -static inline void omap3_per_restore_context (void ) -{ -omap_gpio_restore_context (); -} -static void omap3_enable_io_chain (void ) {int timeout =0 ;
@@ -395,8 +385,10 @@ void omap_sram_idle(void)if (!is_suspending ())if (per_next_state <PWRDM_POWER_ON || core_next_state <PWRDM_POWER_ON ) -if (!console_trylock ()) +if (!console_trylock ()) { +pwrdm_post_transition (); goto console_still_active; + }/* PER */ if (per_next_state <PWRDM_POWER_ON ) {
@@ -404,8 +396,6 @@ void omap_sram_idle(void)omap_uart_prepare_idle (2 );omap_uart_prepare_idle (3 );omap2_gpio_prepare_for_idle (per_going_off); -if (per_next_state ==PWRDM_POWER_OFF ) -omap3_per_save_context (); }/* CORE */
@@ -467,12 +457,12 @@ void omap_sram_idle(void) }omap3_intc_resume_idle (); +pwrdm_post_transition (); +/* PER */ if (per_next_state <PWRDM_POWER_ON ) { per_prev_state =pwrdm_read_prev_pwrst (per_pwrdm);omap2_gpio_resume_after_idle (); -if (per_prev_state ==PWRDM_POWER_OFF ) -omap3_per_restore_context ();omap_uart_resume_idle (2 );omap_uart_resume_idle (3 ); }
@@ -490,8 +480,6 @@ console_still_active:omap3_disable_io_chain (); } -pwrdm_post_transition (); -clkdm_allow_idle (mpu_pwrdm->pwrdm_clkdms[0 ]); }
arch/arm/plat-omap/gpio.c +117 -109
367 lines not on this page · raw message
arch/arm/plat-omap/include/plat/gpio.h +0 -2
@@ -87,8 +87,6 @@ extern void omap2_gpio_prepare_for_idle(int off_mode);extern void omap2_gpio_resume_after_idle (void );extern void omap_set_gpio_debounce (int gpio,int enable);extern void omap_set_gpio_debounce_time (int gpio,int enable); -extern void omap_gpio_save_context (void ); -extern void omap_gpio_restore_context (void );/*-------------------------------------------------------------------------*/ /* Wrappers for "new style" GPIO calls, using the new infrastructure
Signature · 1 line
1.7.1