提交 3383d23d 编写于 作者: M Mark Brown 提交者: Samuel Ortiz

gpiolib: Actually set output state in wm831x_gpio_direction_output()

wm831x_gpio_direction_output() ignored the state passed into it.
Signed-off-by: NMark Brown <broonie@opensource.wolfsonmicro.com>
Cc: stable@kernel.org
Signed-off-by: NSamuel Ortiz <sameo@linux.intel.com>
上级 7ee422dc
...@@ -60,23 +60,31 @@ static int wm831x_gpio_get(struct gpio_chip *chip, unsigned offset) ...@@ -60,23 +60,31 @@ static int wm831x_gpio_get(struct gpio_chip *chip, unsigned offset)
return 0; return 0;
} }
static int wm831x_gpio_direction_out(struct gpio_chip *chip, static void wm831x_gpio_set(struct gpio_chip *chip, unsigned offset, int value)
unsigned offset, int value)
{ {
struct wm831x_gpio *wm831x_gpio = to_wm831x_gpio(chip); struct wm831x_gpio *wm831x_gpio = to_wm831x_gpio(chip);
struct wm831x *wm831x = wm831x_gpio->wm831x; struct wm831x *wm831x = wm831x_gpio->wm831x;
return wm831x_set_bits(wm831x, WM831X_GPIO1_CONTROL + offset, wm831x_set_bits(wm831x, WM831X_GPIO_LEVEL, 1 << offset,
WM831X_GPN_DIR | WM831X_GPN_TRI, 0); value << offset);
} }
static void wm831x_gpio_set(struct gpio_chip *chip, unsigned offset, int value) 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_gpio *wm831x_gpio = to_wm831x_gpio(chip);
struct wm831x *wm831x = wm831x_gpio->wm831x; struct wm831x *wm831x = wm831x_gpio->wm831x;
int ret;
wm831x_set_bits(wm831x, WM831X_GPIO_LEVEL, 1 << offset, ret = wm831x_set_bits(wm831x, WM831X_GPIO1_CONTROL + offset,
value << 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) static int wm831x_gpio_to_irq(struct gpio_chip *chip, unsigned offset)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册