Re: [PATCH] gpio: Enable pcf857x GPIO expander for Device Tree

From: Linus Walleij
Date: Mon Jun 17 2013 - 05:05:45 EST


On Thu, Jun 6, 2013 at 4:05 PM, Archit Taneja <archit@xxxxxx> wrote:

> Add code to parse the GPIO expander Device Tree node and extract platform data
> out of it, and populate the struct 'pcf857x_platform_data' maintained by the
> driver. This enables devices to reference the gpio expander from Device Tree.
>
> Add DT binding info in Documentation.
>
> CC: Grant Likely <grant.likely@xxxxxxxxxxxx>
> Signed-off-by: Archit Taneja <archit@xxxxxx>

(...)
> +++ b/Documentation/devicetree/bindings/gpio/gpio-pcf857x.txt
> @@ -0,0 +1,44 @@
> +PCF857x I2C based GPIO controller bindings
> +
> +Required properties:
> +- compatible:
> + - "nxp,pca9670" for NXP PCA9670 8 bit I/O expander
> + - "nxp,pca9672" for NXP PCA9672 8 bit I/O expander with interrupt
> + - "nxp,pca9674" for NXP PCA9672 8 bit I/O expander with interrupt
> + - "nxp,pca8574" for NXP PCA8574 8 bit I/O expander with interrupt
> + - "nxp,pca8575" for NXP PCA8575 16 bit I/O expander with interrupt
> + - "nxp,pca9671" for NXP PCA9671 16 bit I/O expander
> + - "nxp,pca9673" for NXP PCA9673 16 bit I/O expander with interrupt
> + - "nxp,pca9675" for NXP PCA9675 16 bit I/O expander with interrupt
> + - "ti,pcf8574" for TI PCF8574 8 bit I/O expander with interrupt
> + - "ti,pcf8574a" for TI PCF8574A 8 bit I/O expander with interrupt
> + - "ti,pcf8575" for TI PCF8575 16 bit I/O expander with interrupt
> + - "ti,tca9554" for TI TCA9554 8 bit I/O expander with interrupt
> + - "maxim,max7328" for MAXIM MAX7328 8 bit I/O expander with interrupt
> + - "maxim,max7329" for MAXIM MAX7329 8 bit I/O expander with interrupt
> +- gpio-controller : Marks the device node as a GPIO controller.
> +- #gpio-cells : Should be two.
> + - first cell is the pin number.
> + - second cell is unused.

I guess you're adding this because the generic GPIO bindings use it and
of_gpio_simple_xlate() depends on this two-cell layout.

Make a reference to the generic GPIO bindings and note that the
second cell is *NOT* unused, as it is used in the GPIOlib!

> +- interrupt-controller: Mark the device node as an interrupt controller.
> +- #interrupt-cells : Should be two.
> + - first cell is the GPIO number.

Surely it is the IRQ number and not the GPIO number.
The fact that the IRQ originates in a GPIO controller does not
matter.

> + - second cell is unused.

So why do you add it? Usually this is used for trigger flags.
Are you planning to add this later, i.e. does the chip support this,
and if it doesn't then get rid of this flag.

> +- reg: I2C address of the chip.
> +
> +Device speific properties:
> +- n_latch: optional bit-inverse of initial register value; if
> + you leave this initialized to zero the driver will act
> + like the chip was just reset.

Explain what happens if you do *not* leave it as zero and what the
bits mean in that case.

Yours,
Linus Walleij
--
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/