Commit 640b9135 authored by Linus Walleij's avatar Linus Walleij

gpio: vx855: use the new open drain callback

The vx855 driver clearly states it has three groups of lines:
GPI, GPO and GPIO. The GPO are assumedly push-pull. The GPIO
are implicit open drain, but if the GPIO subsystem ask for them
to be explicitly open drain (i.e. set the flag on a machine table
that we want open drain) it will currently misbehave: it will
switch the GPIOs to input mode (emulate open drain). Instead:
indicate in the .set_single_ended() callback that we support
open drain and open drain only.

Cc: Daniel Drake <drake@endlessm.com>
Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
parent 811a1882
...@@ -186,6 +186,28 @@ static int vx855gpio_direction_output(struct gpio_chip *gpio, ...@@ -186,6 +186,28 @@ static int vx855gpio_direction_output(struct gpio_chip *gpio,
return 0; return 0;
} }
static int vx855gpio_set_single_ended(struct gpio_chip *gpio,
unsigned int nr,
enum single_ended_mode mode)
{
/* The GPI cannot be single-ended */
if (nr < NR_VX855_GPI)
return -EINVAL;
/* The GPO's are push-pull */
if (nr < NR_VX855_GPInO) {
if (mode != LINE_MODE_PUSH_PULL)
return -ENOTSUPP;
return 0;
}
/* The GPIO's are open drain */
if (mode != LINE_MODE_OPEN_DRAIN)
return -ENOTSUPP;
return 0;
}
static const char *vx855gpio_names[NR_VX855_GP] = { static const char *vx855gpio_names[NR_VX855_GP] = {
"VX855_GPI0", "VX855_GPI1", "VX855_GPI2", "VX855_GPI3", "VX855_GPI4", "VX855_GPI0", "VX855_GPI1", "VX855_GPI2", "VX855_GPI3", "VX855_GPI4",
"VX855_GPI5", "VX855_GPI6", "VX855_GPI7", "VX855_GPI8", "VX855_GPI9", "VX855_GPI5", "VX855_GPI6", "VX855_GPI7", "VX855_GPI8", "VX855_GPI9",
...@@ -209,6 +231,7 @@ static void vx855gpio_gpio_setup(struct vx855_gpio *vg) ...@@ -209,6 +231,7 @@ static void vx855gpio_gpio_setup(struct vx855_gpio *vg)
c->direction_output = vx855gpio_direction_output; c->direction_output = vx855gpio_direction_output;
c->get = vx855gpio_get; c->get = vx855gpio_get;
c->set = vx855gpio_set; c->set = vx855gpio_set;
c->set_single_ended = vx855gpio_set_single_ended;
c->dbg_show = NULL; c->dbg_show = NULL;
c->base = 0; c->base = 0;
c->ngpio = NR_VX855_GP; c->ngpio = NR_VX855_GP;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment