From: Jouni Hogander Date: Mon, 17 Nov 2008 08:18:01 +0000 (+0200) Subject: OMAP3: PM: Check in set_pwrdm_state that target state is supported by pwrdm v2 X-Git-Tag: v2.6.28-omap1~140 X-Git-Url: http://pilppa.com/gitweb/?a=commitdiff_plain;h=7a54b0f6f39ea1e5dbff6bb47314bea228bf6e44;p=linux-2.6-omap-h63xx.git OMAP3: PM: Check in set_pwrdm_state that target state is supported by pwrdm v2 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 Acked-by: Paul Walmsley Signed-off-by: Kevin Hilman Signed-off-by: Tony Lindgren --- diff --git a/arch/arm/mach-omap2/pm34xx.c b/arch/arm/mach-omap2/pm34xx.c index da098d24d13..9f5a54469f1 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);