for the past few days I’ve been trying to get an i2c keypad to work with the dragonboard-410c but the ‘probe’ function from the tca8418_keypad driver is never called. What do I need to do to make sure tca8418_keypad_probe() gets properly called?
The physical setup seems fine (validated manually through the command line and using an i2c analyzer, see extra information at the end of the post) so the problem seems to be a kernel configuration issue.
I have enabled ‘TCA8418 Keypad Support’ in the kernel using ‘linux-linaro-qcomlt_4.4.bbappend’ located in a custom layer, along with a simple patch to add debug traces in the tca8418 driver. I can confirm that the driver is properly installed since I get a trace when I boot the board:
...
[ 0.295441] usbcore: registered new device driver usb
[ 0.297314] ===> tca8418_keypad_init
[ 0.298178] media: Linux media interface: v0.10
...
I know that i2c devices are not automatically detected and need to be declared in a ‘board.c’ file matching the target architecture. I tried adding the following under arch/arm/mach-qcom but it didn’t change anything:
static struct i2c_board_info myproject_i2c_board_info[] __initdata =
{
{
I2C_BOARD_INfO("tca8418_keypad", 0x34),
},
};
static void __init myproject_init(void)
{
i2c_register_board_info(0, myproject_i2c_board_info, ARRAY_SIZE(myproject_i2c_board_info));
}
If it’s not arch/arm/mach-qcom, what architecture is it? What do I need to modify in the kernel so that the tca8418_keypad_probe() function gets called?
I saw that some hardware configurations are done through *.dtsi files, do I need to register i2c drivers through that? If so, how?
Any help on this would be much appreciated, thanks.
Extra information:
The keypad is located on i2c-0 @ 0x34 as shown by i2cdetect:
dragonboard-410c:/home/linaro# i2cdetect -y -r 0
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: – – – – – – – – – – – – –
10: – – – – – – – – – – – – – 1d – –
20: – – – – – – – – – – – – – – – –
30: – – – – 34 – – – – – – – – – – –
40: – – – – – – – – – – – – – – – –
50: – – – – – – – – – – – – – – – –
60: – – – – – – – – – – – – – – – –
70: – – – – – – – –
from the command line I can manually register the keypad driver (and probe() gets called), but I get an error:
echo tca8418_keypad 0x34 > /sys/bus/i2c/devices/i2c-0/new_device
[ 135.231098] ===> tca8418_keypad_probe
[ 135.231199] tca8418_keypad 0-0034: missing DT data
from the command line I can manually configure the keypad as the tca8418 driver would:
i2cset -y 0 0x34 0x1D 0xff
i2cset -y 0 0x34 0x1E 0xff
i2cset -y 0 0x34 0x1f 0x3
i2cset -y 0 0x34 0x29 0xff
i2cset -y 0 0x34 0x2a 0xff
i2cset -y 0 0x34 0x2b 0x3
Once configured, I can press a physical key on the keypad and then do ‘i2cget -y 0 0x34 0x4’ to read the fIfO. The key values that are read make sense (proper key values, including press/release flags).