We are running Apalis TK1 module on a custom carrier. I have been trying to create a “power button” using a gpio button leveraging Torradex Documents. I modified the device tree to add the button but for some reason the /dev/input device is not showing up. Based on my debug efforts it appears that gpio-keys is not happy. Gpio-keys complains that the button does not have a keycode but I think it does, Please see below. What am I doing wrong?
dmesg output related to gpio-keys:
[ 2.743438] gpio-keys gpio-keys.4: Button without keycode: 0xe9
[ 2.749494] gpio-keys: probe of gpio-keys.4 failed with error -22
The relevant parts of talis124-apalis-keys.dtsi:
gpio-keys {
compatible = "gpio-keys";
powerkeys {
label = "Powaa-Keyz";
gpios = <&gpio TEGRA_GPIO(DD, 1) GPIO_ACTIVE_LOW>;
linux,code = <KEY_POWER>;
debounce-interval = <10>;
/* gpio-key,wakeup; */
};
Device tree in proc:
root@apalis-tk1:/proc/device-tree/gpio-keys/powerkeys# grep -r . --text
name:powerkeys
debounce-interval:
linux,code:t
gpios:
label:Powaa-Keyz
root@apalis-tk1:/proc/device-tree/gpio-keys/powerkeys# xxd gpios
00000000: 0000 0008 0000 00e9 0000 0001 ............
root@apalis-tk1:/proc/device-tree/gpio-keys/powerkeys# xxd linux,code
00000000: 0000 0074 ...t
root@apalis-tk1:/proc/device-tree/gpio-keys/powerkeys# xxd debounce-interval
00000000: 0000 000a ....
Here is what /dev/input looks like:
root@apalis-tk1:/dev/input# ls -la *
crw-rw---- 1 root input 13, 64 Feb 2 16:39 event0
crw-rw---- 1 root input 13, 65 Feb 2 16:39 event1
lrwxrwxrwx 1 root root 6 Feb 2 16:39 touchscreen0 -> event1
by-id:
total 0
drwxr-xr-x 2 root root 60 Feb 2 16:39 .
drwxr-xr-x 4 root root 140 Feb 2 16:39 ..
lrwxrwxrwx 1 root root 9 Feb 2 16:39 usb-touchscreen-we-use -> ../event0
by-path:
total 0
drwxr-xr-x 2 root root 80 Feb 2 16:39 .
drwxr-xr-x 4 root root 140 Feb 2 16:39 ..
lrwxrwxrwx 1 root root 9 Feb 2 16:39 platform-spi-tegra114.1-platform-apalis-tk1-k20-ts-event -> ../event1
lrwxrwxrwx 1 root root 9 Feb 2 16:39 platform-tegra-ehci.1-usb-0:1.1:1.0-event -> ../event0
I’ve satisfied my curiocity that the power button works correctly by exporting it in sys
root@apalis-tk1:/sys/class/gpio# echo 233 > export
root@apalis-tk1:/sys/class/gpio# cat gpio233/value
1
------ Press and held
root@apalis-tk1:/sys/class/gpio# cat gpio233/value
0
----- Released
root@apalis-tk1:/sys/class/gpio# cat gpio233/value
1
root@apalis-tk1:/sys/class/gpio#