Re: [PATCH] OMAP3 GPIO: Fix getting the value of the GPIO output pin

From: David Brownell
Date: Sun Feb 08 2009 - 14:56:28 EST


On Friday 06 February 2009, Joonyoung Shim wrote:
> If the GPIO pin is output, must read the value from OMAP24XX_GPIO_DATAOUT
> register in __omap_get_gpio_datain().

Same comment as with the similar twl4030 patch you sent:
the API specifies that the value reported for input should
be the actual value AT THE PIN, even for outputs ... this
patch would change the behavior to report the value the pin
is trying to drive, which isn't necessarily going to reflect
the signal value at the pin.

So, NAK.

In a few rare cases on OMAP3 chips -- not currently used
by Linux -- GPIOs can be output-only (input drivers not
enabled). Such a change might be appropriate for GPIOs
configured that way ... were it not for the fact that in
those cases, a value of zero should be returned.

- Dave



> Signed-off-by: Joonyoung Shim <jy0922.shim@xxxxxxxxxxx>
> ---
>
> diff --git a/arch/arm/plat-omap/gpio.c b/arch/arm/plat-omap/gpio.c
> index f856a90..296773a 100644
> --- a/arch/arm/plat-omap/gpio.c
> +++ b/arch/arm/plat-omap/gpio.c
> @@ -428,7 +428,11 @@ static int __omap_get_gpio_datain(int gpio)
> #endif
> #if defined(CONFIG_ARCH_OMAP24XX) || defined(CONFIG_ARCH_OMAP34XX)
> case METHOD_GPIO_24XX:
> - reg += OMAP24XX_GPIO_DATAIN;
> + if (__raw_readl(reg + OMAP24XX_GPIO_OE)
> + & (1 << get_gpio_index(gpio)))
> + reg += OMAP24XX_GPIO_DATAIN;
> + else
> + reg += OMAP24XX_GPIO_DATAOUT;
> break;
> #endif
> default:
> --
> To unsubscribe from this list: send the line "unsubscribe linux-omap" in
> the body of a message to majordomo@xxxxxxxxxxxxxxx
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
>


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/