configure tca8418 as gpio button

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

configure tca8418 as gpio button

2,499 Views
末班车上的乘客
Contributor II

Hi,everyone
how to configure tca8418 as gpio button?

0 Kudos
3 Replies

1,743 Views
末班车上的乘客
Contributor II

I have patched tca8418 driver to support devicetree base on gpio-adp5588.c in linux3.14.28.but it's not work properly.gpio works fine with echo/cat x > export,direction,value operation.It can't use as gpio for other device.

tca8418:gpio@0x34{
compatible = "ti,tca8418-gpio";
reg = <0x34>;
interrupt-parent = <&gpio3>;
interrupts = <19 GPIO_ACTIVE_LOW>;
irq-gpios = <&gpio3 19 GPIO_ACTIVE_LOW>;
#gpio-cells = <2>;
gpio-controller;
ngpios = <18>;
base = <224>;

};

rotary@1{
compatible = "rotary-encoder";
// depends = &tca8418;
//pinctrl-names = "default";
//pinctrl-0 = <&pinctrl_gpio_keys>;
gpios = <&tca8418 6 GPIO_ACTIVE_LOW>,<&tca8418 7 GPIO_ACTIVE_LOW>;
rotary-encoder,steps = <10>;
rotary-encoder,steps-per-period = <10>;
//rotary-encoder,relative-axis;
rotary-encoder,rollover;
};

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

num7 {
label = "num7";
gpios = <&tca8418 8 1>; //tca8418 C0
gpio-key,wakeup;
linux,code = <KEY_7>;
};

num4 {
label = "num4";
gpios = <&tca8418 9 1>; //tca8418 C1
gpio-key,wakeup;
linux,code = <KEY_4>;
};

num8 {
label = "num8";
gpios = <&tca8418 10 1>; //tca8418 C2
gpio-key,wakeup;
linux,code = <KEY_8>;
};

}

regulators {
compatible = "simple-bus";
#address-cells = <1>;
#size-cells = <0>;

lvds_pwr: regulator@4 {
compatible = "regulator-fixed";
reg = <4>;
regulator-name = "lvds-supply";
// depends = &tca8418;
//regulator-min-microvolt = <3300000>;
//regulator-max-microvolt = <3300000>;
//gpio = <&gpio1 10 GPIO_ACTIVE_HIGH>;
gpio = <&tca8418 5 GPIO_ACTIVE_HIGH>;
startup-delay-us = <500>;
enable-active-high;
regulator-boot-on;
};
};

erro message as below:

gpiod_request:invalid GPIO

rotary-encoder:rotary.20:unable to request GPIO -517

rotary-encoder:probe of rotary.20 failed with error -22

seems tca8418-gpio device haven't be loaded before gpio-keys and rotary-encoder

I have solved the problem

0 Kudos

1,743 Views
igorpadykov
NXP Employee
NXP Employee

Hi

seems gpio mode is not supported by current tca8418 driver,

one can add such functionality himself using existing driver

Linux/drivers/input/keyboard/tca8418_keypad.c - Linux Cross Reference - Free Electrons 

and vendor resources

tca8418 matrix & gpio - Linux forum - Linux - TI E2E Community 

Best regards
igor
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos

1,743 Views
末班车上的乘客
Contributor II

seems adp5588 gpio driver is compatible with tca8418

0 Kudos