mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-11 05:17:10 +09:00
gpiolib: Actually set output state in wm831x_gpio_direction_output()
commit 3383d23d86 upstream.
wm831x_gpio_direction_output() ignored the state passed into it.
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
d1efc1b1cb
commit
b8960a6272
@@ -60,16 +60,6 @@ static int wm831x_gpio_get(struct gpio_chip *chip, unsigned offset)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int wm831x_gpio_direction_out(struct gpio_chip *chip,
|
||||
unsigned offset, int value)
|
||||
{
|
||||
struct wm831x_gpio *wm831x_gpio = to_wm831x_gpio(chip);
|
||||
struct wm831x *wm831x = wm831x_gpio->wm831x;
|
||||
|
||||
return wm831x_set_bits(wm831x, WM831X_GPIO1_CONTROL + offset,
|
||||
WM831X_GPN_DIR | WM831X_GPN_TRI, 0);
|
||||
}
|
||||
|
||||
static void wm831x_gpio_set(struct gpio_chip *chip, unsigned offset, int value)
|
||||
{
|
||||
struct wm831x_gpio *wm831x_gpio = to_wm831x_gpio(chip);
|
||||
@@ -79,6 +69,24 @@ static void wm831x_gpio_set(struct gpio_chip *chip, unsigned offset, int value)
|
||||
value << offset);
|
||||
}
|
||||
|
||||
static int wm831x_gpio_direction_out(struct gpio_chip *chip,
|
||||
unsigned offset, int value)
|
||||
{
|
||||
struct wm831x_gpio *wm831x_gpio = to_wm831x_gpio(chip);
|
||||
struct wm831x *wm831x = wm831x_gpio->wm831x;
|
||||
int ret;
|
||||
|
||||
ret = wm831x_set_bits(wm831x, WM831X_GPIO1_CONTROL + offset,
|
||||
WM831X_GPN_DIR | WM831X_GPN_TRI, 0);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
/* Can only set GPIO state once it's in output mode */
|
||||
wm831x_gpio_set(chip, offset, value);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int wm831x_gpio_to_irq(struct gpio_chip *chip, unsigned offset)
|
||||
{
|
||||
struct wm831x_gpio *wm831x_gpio = to_wm831x_gpio(chip);
|
||||
|
||||
Reference in New Issue
Block a user