OMAP: GPIO: ensure debounce clocks are disabled during idle/suspend
authorKevin Hilman <khilman@deeprootsystems.com>
Wed, 22 Sep 2010 23:06:27 +0000 (16:06 -0700)
committerKevin Hilman <khilman@deeprootsystems.com>
Fri, 24 Sep 2010 00:14:17 +0000 (17:14 -0700)
If a GPIO bank has more than one GPIO with debounce enabled, the
debounce clock will not be fully disabled before going to
idle/suspend.

In the idle path, we just do a single clk_disable() of the bank's
debounce clock.  If there are multiple debounce-enabled GPIOs in the
bank, that clocks usage count will be > 1, so the clk_disable() will
not actually disable the clock.

So the fix is to clk_disable() for every debounce-enabled GPIO in the
bank (and an equivalent clk_enable() of course.)

Signed-off-by: Kevin Hilman <khilman@deeprootsystems.com>
arch/arm/plat-omap/gpio.c

index 7951eefe1a0e90d634c315882427f94fc9c32faa..11c5b0eefb85e5eaa8653df16900845c47ff2563 100644 (file)
@@ -2085,8 +2085,9 @@ void omap2_gpio_prepare_for_idle(int power_state)
        for (i = min; i < gpio_bank_count; i++) {
                struct gpio_bank *bank = &gpio_bank[i];
                u32 l1, l2;
+               int j;
 
-               if (bank->dbck_enable_mask)
+               for (j = 0; j < hweight_long(bank->dbck_enable_mask); j++)
                        clk_disable(bank->dbck);
 
                if (power_state > PWRDM_POWER_OFF)
@@ -2152,8 +2153,9 @@ void omap2_gpio_resume_after_idle(void)
        for (i = min; i < gpio_bank_count; i++) {
                struct gpio_bank *bank = &gpio_bank[i];
                u32 l, gen, gen0, gen1;
+               int j;
 
-               if (bank->dbck_enable_mask)
+               for (j = 0; j < hweight_long(bank->dbck_enable_mask); j++)
                        clk_enable(bank->dbck);
 
                if (!workaround_enabled)