From: Marc Zyngier Date: Wed, 26 May 2010 21:42:21 +0000 (-0700) Subject: gpio: max732x: fix input configuration for open-drain pins X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=a13c1868aa60ae7a2516b8d00ee8873dea587581;p=GitHub%2Fmt8127%2Fandroid_kernel_alcatel_ttab.git gpio: max732x: fix input configuration for open-drain pins 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 Acked-by: Eric Miao Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/drivers/gpio/max732x.c b/drivers/gpio/max732x.c index 26ff40110d9f..9cad60f9e962 100644 --- a/drivers/gpio/max732x.c +++ b/drivers/gpio/max732x.c @@ -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; }