According to measurements, reading the previous state of PER domain after wfi takes ~11us on OPP2. Removed this unneccessary latency from cases where we know PER power domain did not try to enter off mode. Signed-off-by: Kalle Jokiniemi <kalle.jokiniemi@xxxxxxxxx> --- arch/arm/mach-omap2/pm34xx.c | 19 +++++++++++++------ 1 files changed, 13 insertions(+), 6 deletions(-) diff --git a/arch/arm/mach-omap2/pm34xx.c b/arch/arm/mach-omap2/pm34xx.c index 237c819..b70ea19 100644 --- a/arch/arm/mach-omap2/pm34xx.c +++ b/arch/arm/mach-omap2/pm34xx.c @@ -489,12 +489,19 @@ void omap_sram_idle(void) /* PER */ if (per_next_state < PWRDM_POWER_ON) { - per_prev_state = pwrdm_read_prev_pwrst(per_pwrdm); - if (per_prev_state == PWRDM_POWER_OFF) { - omap3_per_restore_context(); - omap3_gpio_restore_pad_context(0); - } else if (per_next_state == PWRDM_POWER_OFF) - omap3_gpio_restore_pad_context(1); + if (per_next_state == PWRDM_POWER_OFF) { + /* + * Reading the prev-state takes long time (11us@OPP2), + * only do it, if we really tried to put PER in OFF + */ + per_prev_state = pwrdm_read_prev_pwrst(per_pwrdm); + if (per_prev_state == PWRDM_POWER_OFF) { + omap3_per_restore_context(); + omap3_gpio_restore_pad_context(0); + } else if (per_next_state == PWRDM_POWER_OFF) { + omap3_gpio_restore_pad_context(1); + } + } omap2_gpio_resume_after_idle(); omap_uart_resume_idle(2); if (per_state_modified) -- 1.5.4.3 -- 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