I’m trying to add the matrix keypad driver in my Torizon image, but I’m not sure how to make it work or if it is being loaded correctly.
I was able to build, merge and deploy the kernel module, and also its device tree overlay.
After boot, I checked loaded modules:
And it appears in the list, but I checked with oscilloscope if key scan is performed, and I don’t see any changes in rows/cols gpios configured. All of them are LOW.
I am using the following dts file, which I’m also doing apply/union/deploy by using torizoncore-builder tool:
// Verdin Matrix Keypad
/dts-v1/;
/plugin/;
#include <dt-bindings/gpio/gpio.h>
/ {
matrix_keypad: matrix-keypad {
compatible = "gpio-matrix-keypad";
debounce-delay-ms = <5>;
col-scan-delay-us = <2>;
row-gpios = <&gpio3 4 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)
&gpio5 5 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)
&gpio5 26 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)
&gpio5 27 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>;
col-gpios = <&gpio1 0 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)
&gpio1 11 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)
&gpio1 8 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)
&gpio1 9 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>;
linux,keymap = <0x00000041
0x01000042
0x02000043
0x03000044
0x00010045
0x01010046
0x02010047
0x03010048
0x00020061
0x01020062
0x02020063
0x03020064
0x00030065
0x01030066
0x02030067
0x03030068>;
};
};
&iomuxc {
// Freeing gpios used on matrix keypad (4x4)
/*
pinctrl-0 = <&pinctrl_gpio1>, <&pinctrl_gpio2>,
<&pinctrl_gpio3>, <&pinctrl_gpio4>,
<&pinctrl_gpio7>, <&pinctrl_gpio8>,
<&pinctrl_gpio_hog1>, <&pinctrl_gpio_hog2>, <&pinctrl_gpio_hog3>,
<&pinctrl_pmic_tpm_ena>;
*/
pinctrl-0 = <&pinctrl_gpio_hog1>, <&pinctrl_gpio_hog2>, <&pinctrl_gpio_hog3>,
<&pinctrl_pmic_tpm_ena>;
};
I enable pullups in all GPIO used, but when I measure every row/col they are all LOW always, while all should be HIGH. And without pressing any key, I should measure on COLs the scan col activation every scan period, right?
The source for the driver is:
http://git.toradex.com/cgit/linux-toradex.git/tree/drivers/input/keyboard/matrix_keypad.c?h=toradex_5.4-2.3.x-imx
I used this as reference for the dts file:
http://git.toradex.com/cgit/linux-toradex.git/tree/Documentation/devicetree/bindings/input/gpio-matrix-keypad.txt?h=toradex_5.4-2.3.x-imx&id=4896fb1348713344abbd9f692b393b5fdc539bf8
I tried to map some letters (a-h/A-H) to see if it works as input for the Torizon/portainer login screen I see on my display, which works fine when a usb keyboard is connected.
Maybe there is something wrong with dts file syntax and GPIOs are not being correctly configured?
Any help will be appreciate, thanks in advance.
Best regards,
Alejandro
Verdin iMX8MM V1.1A
Verdin Development Board V1.1A
TorizonCore 5.5.0+build.11.container