Jetson AGX Orin Devkit GPIO Wakeup from Deep Sleep

Based on the forum post solved by @KevinFFF

I’m attempting to use CAN1_DIN on the 40-pin expansion header as a wakeup source.

My system:
Jetson Orin AGX Dev Kit
Jetpack 6.0.3
L4T Version: R36.4.3

What I’ve done so far:

  1. modified /drivers/soc/tegra/pmc.c as follows to include the pin as a wakeup source
static const struct tegra_wake_event tegra234_wake_events[] = {
	TEGRA_WAKE_GPIO("power", 29, 1, TEGRA234_AON_GPIO(EE, 4)),
	TEGRA_WAKE_GPIO("gpio_wake", 43, 1, TEGRA234_AON_GPIO(AA, 3)),
  1. rebuilt the kernel and modules and installed them
  2. updated /boot/extlinux/extlinux.conf as follows to boot using my overlay and new image
LABEL WakeupImage
	MENU LABEL Custom Header Config: <Wakeup Image with Overlay>
	LINUX /boot/Image
	FDT /boot/dtb/kernel_tegra234-p3737-0000+p3701-0005-nv.dtb
	INITRD /boot/initrd
	APPEND ${cbootargs} root=PARTUUID=abed36ac-013c-44be-965c-f8dbccaa0aa4 rw rootwait rootfstype=ext4 mminit_loglevel=4 console=ttyTCU0,115200 console=ttyAMA0,115200 firmware_class.path=/etc/firmware fbcon=map:0 nospectre_bhb video=efifb:off console=tty0 nv-auto-config
	OVERLAYS /boot/custom_wakeup_pin_overlay.dtbo
  1. Created the following overlay
    custom_wakeup_pin_overlay.dts
/dts-v1/;
/plugin/;

#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/gpio/tegra234-gpio.h>
#include <dt-bindings/input/input.h>
#include <dt-bindings/pinctrl/pinctrl-tegra.h>
#include <dt-bindings/input/gpio-keys.h>

/ {
    jetson-header-name = "Jetson 40pin Header";
    overlay-name = "Wake via CAN1_DIN (PAA.03)";
    compatible = "nvidia,p3737-0000+p3701-0005";

    fragment@0 {
        target-path = "/";

        __overlay__ {
            gpio-keys {
                compatible = "gpio-keys";
                status = "okay";
                pinctrl-names = "default";
                pinctrl-0 = <&gpio_wake_pinmux>;

                /* Pinmux settings to reconfigure CAN1_DIN (PAA.03) as GPIO input */
                gpio_wake_pinmux: gpio_wake_pinmux {
                    hdr40-pin37 {
                        nvidia,pins = "can1_din_paa3";
                        /* Set to 'rsvd1' to disable CAN and treat as GPIO */
                        nvidia,function = "rsvd1";
                        /* Enable internal pull-up resistor: 2 = TEGRA_PIN_PULL_UP */
                        nvidia,pull = <TEGRA_PIN_PULL_UP>;
                        /* Enable tristate (hi-Z when not driven): 1 = TEGRA_PIN_ENABLE */
                        nvidia,tristate = <TEGRA_PIN_ENABLE>;
                        /* Enable input buffer: 1 = TEGRA_PIN_ENABLE */
                        nvidia,enable-input = <TEGRA_PIN_ENABLE>;
                    };
                };

                /* Wake event on GPIO 3 = TEGRA234_AON_GPIO(AA, 3) = CAN1_DIN = PAA.03 */
                key-wake {
                    label = "Wake";
                    /* GPIO controller: gpio_aon, pin 3, active-low */
                    gpios = <&gpio_aon 3 1>; 
                    /* Standard Linux input key event configuration EV_KEY==1, KEY_WAKEUP==143 */
                    linux,input-type = <EV_KEY>;
                    linux,code = <KEY_WAKEUP>; 
                    /* Trigger on assertion (line goes low) EV_ACT_ASSERTED */
                    wakeup-event-action = <EV_ACT_ASSERTED>;
                    /* Register this as a wakeup source */
                    wakeup-source;
                };
            };
        };
    };
};

Compiled using:

$ cpp -nostdinc   -I /usr/src/kernel/kernel-jammy-src/include   -I /usr/src/kernel/kernel-jammy-src/include/dt-bindings  -undef -x assembler-with-cpp   custom_wakeup_pin_overlay.dts | dtc -@ -I dts -O dtb -o custom_wakeup_pin_overlay.dtbo

Then copied it to the /boot directory
5. rebooted

Results:

$ sudo cat /sys/kernel/debug/gpio | grep PAA.03
 gpio-319 (PAA.03              )

Doesn’t seem like my changes are picking up the correct settings for the pin.

Any thoughts?