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?

Hi david_is_busy,

Are you using Jetpack 6.0(L4T r36.3.0) or Jetpack 6.2(r36.4.3)?

Do you mean PIN37 of 40-pins header?
image

Please share the full dmesg and device tree for further check.

Thanks for looking at this @KevinFFF.

Regarding version

$ head -n 1 /etc/nv_tegra_release 
# R36 (release), REVISION: 4.3, GCID: 38968081, BOARD: generic, EABI: aarch64, DATE: Wed Jan  8 01:49:37 UTC 2025

Yes, PIN37 of the 40-pin header.

Attached dmesg and currently running device tree.

dmesg.txt (67.3 KB)
running_dt.txt (399.5 KB)

[    4.193146] gpio-keys gpio-keys: Button without keycode
[    4.193151] gpio-keys: probe of gpio-keys failed with error -22

From the log you shared, it seems probe the gpio-keys failed.

Above configurations should be put into pinmux@2430000 node in device tree to be loaded by tegra-pinctrl driver rather than gpio-keys node

Thanks @KevinFFF.

I modified the overlay as follows

/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: Set up pinmux (must be under tegra pinctrl node) */
    fragment@0 {
        target = <&pinmux>;
        __overlay__ {
            gpio_wake_pinmux: gpio_wake_pinmux {
                hdr40-pin37 {
                    nvidia,pins = "can1_din_paa3";
                    nvidia,function = "rsvd1";
                    nvidia,pull = <TEGRA_PIN_PULL_UP>;
                    nvidia,tristate = <TEGRA_PIN_ENABLE>;
                    nvidia,enable-input = <TEGRA_PIN_ENABLE>;
                };
            };
        };
    };

    /* Fragment 1: Add gpio-keys device using the pinmux group above */
    fragment@1 {
        target-path = "/";
        __overlay__ {
            gpio-keys {
                compatible = "gpio-keys";
                status = "okay";

                pinctrl-names = "default";
                pinctrl-0 = <&gpio_wake_pinmux>;

                key-wake {
                    label = "Wake";
                    gpios = <&gpio_aon 3 GPIO_ACTIVE_LOW>;
                    linux,input-type = <EV_KEY>;
                    linux,code = <KEY_WAKEUP>;
                    wakeup-event-action = <EV_ACT_ASSERTED>;
                    wakeup-source;
                };
            };
        };
    };
};

Looks like the gpio-keys error went away in dmesg, but still got the following output after rebooting.

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

Attaching the latest complete dmesg and running device tree.
dmesg_01.txt (68.6 KB)
running_01.txt (399.5 KB)

There is no update from you for a period, assuming this is not an issue anymore.
Hence, we are closing this topic. If need further support, please open a new one.
Thanks
~0618

It seems this pin still not used by gpio-keys driver.

I don’t see any gpio-keys related log in dmesg_01.txt you shared.
Could you add some debug log in this driver to confirm if PAA.03 has been loaded correctly?