Skip to content

Commit

Permalink
gpio: max732x: fix input configuration for open-drain pins
Browse files Browse the repository at this point in the history
Fix a bug I noticed while hacking on the max732x driver for interrupt
support.  According to the datasheets, open-drain pins have to be
configured as output-high (which in that case is actually high impedance)
to be used as input.

Signed-off-by: Marc Zyngier <maz@misterjones.org>
Acked-by: Eric Miao <eric.y.miao@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
Marc Zyngier authored and Linus Torvalds committed May 27, 2010
1 parent 5535cb6 commit a13c186
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions drivers/gpio/max732x.c
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,13 @@ static int max732x_gpio_direction_input(struct gpio_chip *gc, unsigned off)
return -EACCES;
}

/*
* Open-drain pins must be set to high impedance (which is
* equivalent to output-high) to be turned into an input.
*/
if ((mask & chip->dir_output))
max732x_gpio_set_value(gc, off, 1);

return 0;
}

Expand Down

0 comments on commit a13c186

Please sign in to comment.