On Sat, Mar 5, 2011 at 02:50, Kevin Hilman <khilman@xxxxxx> wrote: > Charulatha V <charu@xxxxxx> writes: > >> Make gpio_prepare_for_idle() & gpio_resume_after_idle() functions >> handle save context & restore context respectively in OMAP GPIO driver >> instead of calling these functions directly from pm layer. This would >> be useful while modifying the OMAP GPIO driver to use PM runtime framework. > > Excellent! Thanks. > > I really like this change, but have some minor issues with the > implementation. > > Basically, you should no longer need to manually read PER prev state. > Instead, in prepare_for_idle(), call > omap_device_get_context_loss_count(), in resume_from_idle() call it > again. If the count is different, you need to restore context. Okay, will do this way. > > This way, you don't need to modify the resume_from_idle function, *and* > you can get rid of the read of PER prev state. > > Otherwise, I like this change. > > Kevin > >> Also modfiy gpio_prepare_for_idle() & gpio_resume_after_idle() >> to 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 > >> Signed-off-by: Charulatha V <charu@xxxxxx> >> >> Tested-by: Tarun Kanti DebBarma <tarun.kanti@xxxxxx> >> (2430-SDP testing) >> --- >> arch/arm/mach-omap2/pm24xx.c | 2 +- >> arch/arm/mach-omap2/pm34xx.c | 20 +--- >> arch/arm/plat-omap/gpio.c | 218 ++++++++++++++++---------------- >> arch/arm/plat-omap/include/plat/gpio.h | 4 +- >> 4 files changed, 113 insertions(+), 131 deletions(-) >> >> diff --git a/arch/arm/mach-omap2/pm24xx.c b/arch/arm/mach-omap2/pm24xx.c >> index 97feb3a..b71072d 100644 >> --- a/arch/arm/mach-omap2/pm24xx.c >> +++ b/arch/arm/mach-omap2/pm24xx.c >> @@ -162,7 +162,7 @@ no_sleep: >> tmp = timespec_to_ns(&ts_idle) * NSEC_PER_USEC; >> omap2_pm_dump(0, 1, tmp); >> } >> - omap2_gpio_resume_after_idle(); >> + omap2_gpio_resume_after_idle(0); >> >> clk_enable(osc_ck); >> >> diff --git a/arch/arm/mach-omap2/pm34xx.c b/arch/arm/mach-omap2/pm34xx.c >> index 2f864e4..07af07e 100644 >> --- a/arch/arm/mach-omap2/pm34xx.c >> +++ b/arch/arm/mach-omap2/pm34xx.c >> @@ -90,16 +90,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; >> @@ -408,8 +398,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 */ >> @@ -473,10 +461,12 @@ void omap_sram_idle(void) >> >> /* PER */ >> if (per_next_state < PWRDM_POWER_ON) { >> + int is_per_prev_state_off; >> + >> 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(); >> + is_per_prev_state_off = (per_prev_state == >> + PWRDM_POWER_OFF) ? 1 : 0; >> + omap2_gpio_resume_after_idle(is_per_prev_state_off); >> omap_uart_resume_idle(2); >> omap_uart_resume_idle(3); >> } >> diff --git a/arch/arm/plat-omap/gpio.c b/arch/arm/plat-omap/gpio.c >> index 1da3233..10792b6 100644 >> --- a/arch/arm/plat-omap/gpio.c >> +++ b/arch/arm/plat-omap/gpio.c >> @@ -175,6 +175,9 @@ struct gpio_bank { >> const char *pwrdm_name; >> }; >> >> +static void omap_gpio_save_context(struct gpio_bank *bank); >> +static void omap_gpio_restore_context(struct gpio_bank *bank); >> + >> /* >> * TODO: Cleanup gpio_bank usage as it is having information >> * related to all instances of the device >> @@ -1860,8 +1863,6 @@ static struct sys_device omap_gpio_device = { >> >> #endif >> >> -#ifdef CONFIG_ARCH_OMAP2PLUS >> - > > Why remove this? This will just be bloat for OMAP1-only builds. Just thought of removing all CONFIG_ARCH_* #ifdefs. Anyways, I will not retain this check in my next version. -- To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html