Re: [PATCH v2 05/18] GPIO: OMAP: Handle save/restore ctx in GPIO driver

Kevin Hilman
2011-06-16T16:35:00Z

Tarun Kanti DebBarma <tarun.kanti@ti.com> writes:

> From: Charulatha V <charu@ti.com>
>
> 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(), call *_get_context_loss_count() and in
> gpio_resume_after_idle() call it again. If the count is different, do restore
> context. The workaround_enabled flag is no more required and is removed.
>
> Signed-off-by: Charulatha V <charu@ti.com>

[...]

> @@ -1396,8 +1399,12 @@ void omap2_gpio_resume_after_idle(void)
> for (j = 0; j < hweight_long(bank->dbck_enable_mask); j++)
> clk_enable(bank->dbck);
>
> - if (!workaround_enabled)
> - continue;
> + if (bank->get_context_loss_count) {
> + ctx_lost_cnt_after =
> + bank->get_context_loss_count(bank->dev);
> + if (ctx_lost_cnt_after != bank->ctx_loss_count)
> + omap_gpio_restore_context(bank);
> + }

Context should be also be restored if you cant know if it's been lost.
IOW, it should also be restored if !bank->get_context_loss_count.

> if (!(bank->enabled_non_wakeup_gpios))
> continue;
> @@ -1475,74 +1482,50 @@ void omap2_gpio_resume_after_idle(void)
> }
> }
> }
> -
> }
>
> -#endif
> -
> -#ifdef CONFIG_ARCH_OMAP3
> -void omap_gpio_save_context(void)
> +void omap_gpio_save_context(struct gpio_bank *bank)

Should also be made static. Same for restore below.

Kevin