Re: [PATCH] AMD Geode CS5535/5536 GPIO driver

From: David Brownell
Date: Thu Feb 05 2009 - 19:16:23 EST


On Thursday 05 February 2009, Alessandro Zummo wrote:
> --- linux-2.6.28.orig/arch/x86/Kconfig 2009-02-03 19:38:43.000000000 +0100
> +++ linux-2.6.28/arch/x86/Kconfig 2009-02-03 20:15:25.000000000 +0100
> @@ -1911,6 +1911,16 @@ config GEODE_MFGPT_TIMER
> MFGPTs have a better resolution and max interval than the
> generic PIT, and are suitable for use as high-res timers.
>
> +config GEODE_GPIO
> + bool "Geode GPIO support"
> + depends on MGEODE_LX && !CS5535_GPIO

and also GPIOLIB ... maybe can you just "select GPIOLIB".


> + default n
> + help


> +static int cs5535_direction_output(struct gpio_chip *chip, unsigned offset,
> + int value)
> +{
> + cs5535_gpio_set(chip, offset, value);
> +
> + geode_gpio_set(geode_gpio(offset), GPIO_OUTPUT_ENABLE);
> + geode_gpio_clear(geode_gpio(offset), GPIO_INPUT_ENABLE);

Unless this hardware misbehaves when both output and input
modes are enabled (e.g. in the window between those two calls),
I'd suggest just not clearing INPUT_ENABLE. It's legit to
ask for the *actual* value of an output line, e.g. for when
it uses open drain mode. (And didn't this hardware have an
option for open drain GPIO signaling?)


Otherwise this has about the right shape for platform GPIOs.

- Dave
--
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/