gpiolib: Force wm831x GPIOs into GPIO mode when requested
authorMark Brown <broonie@opensource.wolfsonmicro.com>
Wed, 17 Feb 2010 18:45:26 +0000 (18:45 +0000)
committerSamuel Ortiz <sameo@linux.intel.com>
Sun, 7 Mar 2010 21:17:30 +0000 (22:17 +0100)
This is the chip default but it's possible the bootloader or OTP
will have been configured to a different mode (eg, to provide
feedback during startup).

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
drivers/gpio/wm831x-gpio.c

index 5b8dc098d80ffc5b729dcae6e96d104f4cd107c7..d09021f4a7d38042dceed014643fb3a84b52423e 100644 (file)
@@ -44,7 +44,8 @@ static int wm831x_gpio_direction_in(struct gpio_chip *chip, unsigned offset)
                val |= WM831X_GPN_TRI;
 
        return wm831x_set_bits(wm831x, WM831X_GPIO1_CONTROL + offset,
-                              WM831X_GPN_DIR | WM831X_GPN_TRI, val);
+                              WM831X_GPN_DIR | WM831X_GPN_TRI |
+                              WM831X_GPN_FN_MASK, val);
 }
 
 static int wm831x_gpio_get(struct gpio_chip *chip, unsigned offset)
@@ -84,7 +85,8 @@ static int wm831x_gpio_direction_out(struct gpio_chip *chip,
                val |= WM831X_GPN_TRI;
 
        ret = wm831x_set_bits(wm831x, WM831X_GPIO1_CONTROL + offset,
-                             WM831X_GPN_DIR | WM831X_GPN_TRI, val);
+                             WM831X_GPN_DIR | WM831X_GPN_TRI |
+                             WM831X_GPN_FN_MASK, val);
        if (ret < 0)
                return ret;