GPIO based Power button on TK1 - gpio-keys

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
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

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

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
------ Press and held
root@apalis-tk1:/sys/class/gpio# cat gpio233/value
----- Released
root@apalis-tk1:/sys/class/gpio# cat gpio233/value

Could you please specify a BSP version you are using?

We are on zeus. If you are interested in more specific commit hashes or version numbers I will provide that via email. Please check the ticket associated with this post.

I was able to narrow down the problem to the linux,code value. The kernel is not able to read the device tree correctly and cannot get a keycode. This means that gpio-keys errors out and the input device is never created.

For test purposes I was able to hardcode the linux,code values in the kernel source and that results in working gpio-keys but it is not really a solution.

Another interesting observation that may be helpful: The Wake On Lan button and the power button I am trying to add exercise a very similar code path in the kernel. If WOL works, power button should work too. A forum search produced this post but unfortunately the patch link no longer works. I see that the branch has been deleted and I can no longer find the hash. Could you help?