I managed to solve the problem.
The CAN_WAKE pin is a GPIO. Its number is 300, based on PINMUX Spreadsheet.
(CAN_WAKE -> PAA.04 -> 256 + 5*8 + 4 = 256 + 44 = 300. "5" is the number corresponding to AA, according to tegra186-gpio.h file. 44 is important in device tree changes.)
I used the following procedure:
1- Do a fresh installation of JetPack, in my case, 4.5.1
2- Copy the tegra186-quill-p3310-1000-c03-00-base.dtb from the /Linux_for_Tegra/kernel/dtb
directory on host machine, to make changes on it.
3- With the following command, use the device tree compiler to de-compile the dtb file to a dts file:
dtc -I dtb -O dts -o DeviceTreeDTS.dts tegra186-quill-p3310-1000-c03-00-base.dtb
4- Apply the following patch to the gpio-key section of the device tree file DeviceTreeDTS.dts:
gpio-keys {
compatible = "gpio-keys";
gpio-keys,name = "gpio-keys";
status = "okay";
sw_wake {
label = "sw-wake";
interrupt-parent = <0x3a>;
interrupts = <0x0 0x13 0x4>;
linux,code = <0x74>;
wakeup-source;
};
power {
label = "Power";
gpios = <0x28 0x38 0x1>;
linux,code = <0x74>;
gpio-key,wakeup;
};
volume_up {
label = "Volume Up";
gpios = <0x28 0x39 0x1>;
linux,code = <0x73>;
};
volume_down {
label = "Volume Down";
gpios = <0x28 0x3a 0x1>;
linux,code = <0x72>;
};
can_wake {
label = "CAN WAKE";
gpios = <0x28 0x2c 0x1>;
linux,code = <0x8f>;
gpio-key,wakeup;
};
};
The names can_wake and “CAN WAKE” has nothing to do with the actual device tree. Only arbitrary names. 0x2c is the hex value of 44, and 0x8f (143) is the linux code for KEY_WAKEUP.
5- Regenerate the dtb file:
dtc -I dts -O dtb -o tegra186-quill-p3310-1000-c03-00-base.dtb DeviceTreeDTS.dts
6- Re-flash the dtb file only, using the following command:
sudo ./flash.sh -k kernel-dtb jetson-tx2 mmcblk0p1
7- To test the functionality of wake pin, put the system into sleep:
sudo systemctl suspend
and then short the CAN_WAKE pin (Pin #1 of J26 on DevKit) to ground to resume the system.
Hope this will be useful.