AnsweredAssumed Answered

How to configure tca6416 as a button

Question asked by 贾继中 贾继中 on Mar 15, 2017
Latest reply on Mar 15, 2017 by igorpadykov

Hi,everyone

I need tca6416a as input button and output control for my new design,how to configure tca6416 as gpio button and gpio.Is it like below? 

i2c@3 {
#address-cells = <1>;
#size-cells = <0>;
reg = <3>;
tca6416: tca6416@21{
compatible = "ti,tca6416";
reg = <0x21>;
gpio-controller;
#gpio-cells = <2>;
};
};

gpio_keys {
compatible = "gpio-keys";
pinctrl-names = "default";

power-button {
label = "Power Button";
linux,code = <KEY_POWER>;
gpios = <&gpio4 22 GPIO_ACTIVE_LOW>;
};

left{
label = "left";
linux,code = <KEY_RIGHT>;
gpios = <&tca6416 0 GPIO_ACTIVE_LOW>;
};
right {
label = "right";
linux,code = <KEY_LEFT>;
gpios = <&tca6416 1 GPIO_ACTIVE_LOW>;
};
};

leds {
compatible = "gpio-leds";
pinctrl-names = "default";


keybacklight{
label = "keybl";
gpios = <&tca6416 2 GPIO_ACTIVE_HIGH>;
};
};

Outcomes