Check that wanted sleep state is supported by powerdomain. If it is not supported, then use next lowest supported state. Check also on suspend that state of pwrdm was lower or equal. Signed-off-by: Jouni Hogander <jouni.hogander@xxxxxxxxx> --- arch/arm/mach-omap2/pm34xx.c | 9 +++++++-- 1 files changed, 7 insertions(+), 2 deletions(-) diff --git a/arch/arm/mach-omap2/pm34xx.c b/arch/arm/mach-omap2/pm34xx.c index da098d2..babead5 100644 --- a/arch/arm/mach-omap2/pm34xx.c +++ b/arch/arm/mach-omap2/pm34xx.c @@ -239,8 +239,13 @@ static int set_pwrdm_state(struct powerdomain *pwrdm, u32 state) if (pwrdm == NULL || IS_ERR(pwrdm)) return -EINVAL; - cur_state = pwrdm_read_next_pwrst(pwrdm); + while (!(pwrdm->pwrsts & (1 << state))) { + if (state < PWRDM_POWER_OFF) + return ret; + state--; + } + cur_state = pwrdm_read_next_pwrst(pwrdm); if (cur_state == state) return ret; @@ -314,7 +319,7 @@ restore: list_for_each_entry(pwrst, &pwrst_list, node) { set_pwrdm_state(pwrst->pwrdm, pwrst->saved_state); state = pwrdm_read_prev_pwrst(pwrst->pwrdm); - if (state != pwrst->next_state) { + if (state > pwrst->next_state) { printk(KERN_INFO "Powerdomain (%s) didn't enter " "target state %d\n", pwrst->pwrdm->name, pwrst->next_state); -- 1.6.0.1 -- 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