This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Linux/TCA6424A: Configuration GPIOs of an expander IO and from device tree.

Part Number: TCA6424A
Other Parts Discussed in Thread: TCA6424,

Tool/software: Linux

Hi everyone,

I'm using an expander IO: tca6424 from TI on my raspberry pi 3B and it's working perfectly. I'm using this device tree dts file:

/dts-v1/;
/plugin/;
/ {
compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709";

fragment@0 {
target = <&i2c1>;
__overlay__ {
status = "okay";
};
};

fragment@1 {
target = <&gpio>;
__overlay__ {
tca6424a_pins: tca6424a_pins {
brcm,pins = <18>;
brcm,function = <0>;
};
};
};dmesg

fragment@2 {
target = <&i2c1>;
__overlay__ {
#address-cells = <1>;
#size-cells = <0>;

tca6424@22 {
compatible = "ti,tca6424";
reg = <0x22>;
pinctrl-names = "default";
pinctrl-0 = <&tca6424a_pins>;
interrupt-parent = <&gpio>;
interrupts = <18 2>; //IRQ_TYPE_EDGE_FALLING
reset-gpios = <&gpio 23 0>; //GPIO_ACTIVE_HIGH
};
};
};
};

I would like to configure the inputs and output from this file, instead of doing this for inputs:

echo 488 > /sys/class/gpio/export
echo "in" > /sys/class/gpio/gpio488/direction
cat /sys/class/gpio/gpio488/value

or this for outputs:

echo 488 > /sys/class/gpio/export
echo "out" > /sys/class/gpio/gpio488/direction
echo 1 > /sys/class/gpio/gpio488/value


How can I do that?

Best regards.