1*c66ec88fSEmmanuel Vadot* PCF857x-compatible I/O expanders 2*c66ec88fSEmmanuel Vadot 3*c66ec88fSEmmanuel VadotThe PCF857x-compatible chips have "quasi-bidirectional" I/O lines that can be 4*c66ec88fSEmmanuel Vadotdriven high by a pull-up current source or driven low to ground. This combines 5*c66ec88fSEmmanuel Vadotthe direction and output level into a single bit per line, which can't be read 6*c66ec88fSEmmanuel Vadotback. We can't actually know at initialization time whether a line is configured 7*c66ec88fSEmmanuel Vadot(a) as output and driving the signal low/high, or (b) as input and reporting a 8*c66ec88fSEmmanuel Vadotlow/high value, without knowing the last value written since the chip came out 9*c66ec88fSEmmanuel Vadotof reset (if any). The only reliable solution for setting up line direction is 10*c66ec88fSEmmanuel Vadotthus to do it explicitly. 11*c66ec88fSEmmanuel Vadot 12*c66ec88fSEmmanuel VadotRequired Properties: 13*c66ec88fSEmmanuel Vadot 14*c66ec88fSEmmanuel Vadot - compatible: should be one of the following. 15*c66ec88fSEmmanuel Vadot - "maxim,max7328": For the Maxim MAX7378 16*c66ec88fSEmmanuel Vadot - "maxim,max7329": For the Maxim MAX7329 17*c66ec88fSEmmanuel Vadot - "nxp,pca8574": For the NXP PCA8574 18*c66ec88fSEmmanuel Vadot - "nxp,pca8575": For the NXP PCA8575 19*c66ec88fSEmmanuel Vadot - "nxp,pca9670": For the NXP PCA9670 20*c66ec88fSEmmanuel Vadot - "nxp,pca9671": For the NXP PCA9671 21*c66ec88fSEmmanuel Vadot - "nxp,pca9672": For the NXP PCA9672 22*c66ec88fSEmmanuel Vadot - "nxp,pca9673": For the NXP PCA9673 23*c66ec88fSEmmanuel Vadot - "nxp,pca9674": For the NXP PCA9674 24*c66ec88fSEmmanuel Vadot - "nxp,pca9675": For the NXP PCA9675 25*c66ec88fSEmmanuel Vadot - "nxp,pcf8574": For the NXP PCF8574 26*c66ec88fSEmmanuel Vadot - "nxp,pcf8574a": For the NXP PCF8574A 27*c66ec88fSEmmanuel Vadot - "nxp,pcf8575": For the NXP PCF8575 28*c66ec88fSEmmanuel Vadot 29*c66ec88fSEmmanuel Vadot - reg: I2C slave address. 30*c66ec88fSEmmanuel Vadot 31*c66ec88fSEmmanuel Vadot - gpio-controller: Marks the device node as a gpio controller. 32*c66ec88fSEmmanuel Vadot - #gpio-cells: Should be 2. The first cell is the GPIO number and the second 33*c66ec88fSEmmanuel Vadot cell specifies GPIO flags, as defined in <dt-bindings/gpio/gpio.h>. Only the 34*c66ec88fSEmmanuel Vadot GPIO_ACTIVE_HIGH and GPIO_ACTIVE_LOW flags are supported. 35*c66ec88fSEmmanuel Vadot 36*c66ec88fSEmmanuel VadotOptional Properties: 37*c66ec88fSEmmanuel Vadot 38*c66ec88fSEmmanuel Vadot - lines-initial-states: Bitmask that specifies the initial state of each 39*c66ec88fSEmmanuel Vadot line. When a bit is set to zero, the corresponding line will be initialized to 40*c66ec88fSEmmanuel Vadot the input (pulled-up) state. When the bit is set to one, the line will be 41*c66ec88fSEmmanuel Vadot initialized the low-level output state. If the property is not specified 42*c66ec88fSEmmanuel Vadot all lines will be initialized to the input state. 43*c66ec88fSEmmanuel Vadot 44*c66ec88fSEmmanuel Vadot The I/O expander can detect input state changes, and thus optionally act as 45*c66ec88fSEmmanuel Vadot an interrupt controller. When the expander interrupt line is connected all the 46*c66ec88fSEmmanuel Vadot following properties must be set. For more information please see the 47*c66ec88fSEmmanuel Vadot interrupt controller device tree bindings documentation available at 48*c66ec88fSEmmanuel Vadot Documentation/devicetree/bindings/interrupt-controller/interrupts.txt. 49*c66ec88fSEmmanuel Vadot 50*c66ec88fSEmmanuel Vadot - interrupt-controller: Identifies the node as an interrupt controller. 51*c66ec88fSEmmanuel Vadot - #interrupt-cells: Number of cells to encode an interrupt source, shall be 2. 52*c66ec88fSEmmanuel Vadot - interrupts: Interrupt specifier for the controllers interrupt. 53*c66ec88fSEmmanuel Vadot 54*c66ec88fSEmmanuel Vadot 55*c66ec88fSEmmanuel VadotPlease refer to gpio.txt in this directory for details of the common GPIO 56*c66ec88fSEmmanuel Vadotbindings used by client devices. 57*c66ec88fSEmmanuel Vadot 58*c66ec88fSEmmanuel VadotExample: PCF8575 I/O expander node 59*c66ec88fSEmmanuel Vadot 60*c66ec88fSEmmanuel Vadot pcf8575: gpio@20 { 61*c66ec88fSEmmanuel Vadot compatible = "nxp,pcf8575"; 62*c66ec88fSEmmanuel Vadot reg = <0x20>; 63*c66ec88fSEmmanuel Vadot interrupt-parent = <&irqpin2>; 64*c66ec88fSEmmanuel Vadot interrupts = <3 0>; 65*c66ec88fSEmmanuel Vadot gpio-controller; 66*c66ec88fSEmmanuel Vadot #gpio-cells = <2>; 67*c66ec88fSEmmanuel Vadot interrupt-controller; 68*c66ec88fSEmmanuel Vadot #interrupt-cells = <2>; 69*c66ec88fSEmmanuel Vadot }; 70