]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
gpiolib: wm8994: Pay attention to the value set when enabling as output
authorMark Brown <broonie@opensource.wolfsonmicro.com>
Sat, 9 Jun 2012 03:07:56 +0000 (11:07 +0800)
committerBen Hutchings <ben@decadent.org.uk>
Wed, 25 Jul 2012 03:11:08 +0000 (04:11 +0100)
commit 8cd578b6e28693f357867a77598a88ef3deb6b39 upstream.

Not paying attention to the value being set is a bad thing because it
means that we'll not set the hardware up to reflect what was requested.
Not setting the hardware up to reflect what was requested means that the
caller won't get the results they wanted.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
drivers/gpio/gpio-wm8994.c

index 96198f3fab7342140096898b5ec54b4f574e6e7d..a2da8f2e7ff3547febdcfb7b82f2f003270f6f3c 100644 (file)
@@ -89,8 +89,11 @@ static int wm8994_gpio_direction_out(struct gpio_chip *chip,
        struct wm8994_gpio *wm8994_gpio = to_wm8994_gpio(chip);
        struct wm8994 *wm8994 = wm8994_gpio->wm8994;
 
+       if (value)
+               value = WM8994_GPN_LVL;
+
        return wm8994_set_bits(wm8994, WM8994_GPIO_1 + offset,
-                              WM8994_GPN_DIR, 0);
+                              WM8994_GPN_DIR | WM8994_GPN_LVL, value);
 }
 
 static void wm8994_gpio_set(struct gpio_chip *chip, unsigned offset, int value)