]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
OMAP3: PM: Check in set_pwrdm_state that target state is supported by pwrdm v2
authorJouni Hogander <jouni.hogander@nokia.com>
Mon, 17 Nov 2008 08:18:01 +0000 (10:18 +0200)
committerTony Lindgren <tony@atomide.com>
Wed, 19 Nov 2008 18:03:21 +0000 (10:03 -0800)
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@nokia.com>
Acked-by: Paul Walmsley <paul@pwsan.com>
Signed-off-by: Kevin Hilman <khilman@deeprootsystems.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
arch/arm/mach-omap2/pm34xx.c

index da098d24d133f3ddc09477bbe690b0499f564365..9f5a54469f185e106b6831695277099e70392313 100644 (file)
@@ -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);