]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
gpio/nomadik: don't set SLPM to 1 for non-wakeup pins
authorRabin Vincent <rabin.vincent@stericsson.com>
Tue, 26 Apr 2011 03:33:27 +0000 (09:03 +0530)
committerLinus Walleij <linus.walleij@linaro.org>
Mon, 23 Apr 2012 09:04:49 +0000 (11:04 +0200)
Setting GPIOs' SLPM value to 1 (WAKEUP_DISABLE) is seen to cause
increased power consumption in sleep/deep-sleep. So remove the code
which disables SLPM based on the wakeup settings and only ensure
it is on as needed.

Signed-off-by: Rabin Vincent <rabin.vincent@stericsson.com>
Reviewed-by: Srinidhi Kasagar <srinidhi.kasagar@stericsson.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
drivers/gpio/gpio-nomadik.c

index 839624f9fe6aa6dca29aba693dad33671abed888..f1ebd05a9c502bf32fbf734f2930c8ac4972e6d8 100644 (file)
@@ -58,7 +58,6 @@ struct nmk_gpio_chip {
        u32 real_wake;
        u32 rwimsc;
        u32 fwimsc;
-       u32 slpm;
        u32 pull_up;
 };
 
@@ -583,10 +582,14 @@ static void __nmk_gpio_irq_modify(struct nmk_gpio_chip *nmk_chip,
 static void __nmk_gpio_set_wake(struct nmk_gpio_chip *nmk_chip,
                                int gpio, bool on)
 {
-       if (nmk_chip->sleepmode) {
+       /*
+        * Ensure WAKEUP_ENABLE is on.  No need to disable it if wakeup is
+        * disabled, since setting SLPM to 1 increases power consumption, and
+        * wakeup is anyhow controlled by the RIMSC and FIMSC registers.
+        */
+       if (nmk_chip->sleepmode && on) {
                __nmk_gpio_set_slpm(nmk_chip, gpio - nmk_chip->chip.base,
-                                   on ? NMK_GPIO_SLPM_WAKEUP_ENABLE
-                                   : NMK_GPIO_SLPM_WAKEUP_DISABLE);
+                                   NMK_GPIO_SLPM_WAKEUP_ENABLE);
        }
 
        __nmk_gpio_irq_modify(nmk_chip, gpio, WAKE, on);
@@ -1016,13 +1019,6 @@ void nmk_gpio_wakeups_suspend(void)
                writel(chip->fwimsc & chip->real_wake,
                       chip->addr + NMK_GPIO_FWIMSC);
 
-               if (chip->sleepmode) {
-                       chip->slpm = readl(chip->addr + NMK_GPIO_SLPC);
-
-                       /* 0 -> wakeup enable */
-                       writel(~chip->real_wake, chip->addr + NMK_GPIO_SLPC);
-               }
-
                clk_disable(chip->clk);
        }
 }
@@ -1042,9 +1038,6 @@ void nmk_gpio_wakeups_resume(void)
                writel(chip->rwimsc, chip->addr + NMK_GPIO_RWIMSC);
                writel(chip->fwimsc, chip->addr + NMK_GPIO_FWIMSC);
 
-               if (chip->sleepmode)
-                       writel(chip->slpm, chip->addr + NMK_GPIO_SLPC);
-
                clk_disable(chip->clk);
        }
 }