How to determine the hexadecimal encoding of GPIO?

I want to change the dts to obtain a GPIO pin used to wake up Jetson, but I am not sure how to fill in the hexadecimal of this GPIO.
For example,

	gpio-keys {
		compatible = "gpio-keys";
		gpio-keys,name = "gpio-keys";
		status = "okay";

		sw_wake {
			label = "sw-wake";
			interrupt-parent = <0x26>;
			interrupts = <0x00 0xb3 0x04>;
			linux,code = <0x74>;
			wakeup-source;
		};

		forcerecovery {
			label = "force-recovery";
			gpios = <0x13 0x30 0x01>;
			linux,code = <0x101>;
		};

		power_key {
			label = "power-key";
			gpios = <0x25 0x24 0x01>;  // How to fill ?
			linux,code = <0x8f>;
			gpio-key,wakeup;
			debounce-interval = <0x1e>;
			nvidia,pmc-wakeup = <0x56 0x00 0x1d 0x00>; // real mean ?
		};
	};

What should I write in gpios and pmc-wakeup If I want to select the power key as the GPIO wake-up key?

in Pimux

hello 7175380,

may I know what’s the actual use-case, this by default define as following,

        gpio-keys {
                power_key {
                        label = "power-key";
                        gpios = <&tegra_aon_gpio TEGRA194_AON_GPIO(EE, 4) GPIO_ACTIVE_LOW>;
                        linux,code = <KEY_POWER>;
                        gpio-key,wakeup;

I want to change the power key to a wake-up key, and I can wake the jetson from suspend when I input a high level to the power key, what should I write in dts? (The dts file I show is transformed from the file in /boot/tegra…dtb)

		power_key {
			label = "power-key";
			gpios = <0x25 0x24 0x01>;  //  origin file  but 0x25 0x24 0x1 refer to what?
			linux,code = <0x8f>;
			gpio-key,wakeup;
			debounce-interval = <0x1e>; // KEY_WAKE
			nvidia,pmc-wakeup = <0x56 0x00 0x1d 0x00>; // add by myself 
		};```

hello 7175380,

as you can see.
1st column refer to pin field, 2nd for the pin number, 3rd for the pin state.

however,
you don’t need to revise the code if you’re using power button to wake-up the platform.
please refer to developer guide for Chipset Power States session.
there’re several common wake sources to awakened from deep sleep.

ennn…so if I only have a GPIO high level as my wakeup signal, which of the following may work? Can the wake source (Power Button) work with a high level signal?

And from in pimux table, 0x25 refer to which pin field? 0x24 refer to which pin number? Can I transform this hex code from the pimux table by myself so I can modify it when I need to customize some pins in the future? Thanks!

hello 7175380,

what did you meant?
could you please be more specific, or please describe the details.

BTW,
it’s not suggest to write the hex code, please update the device tree sources and compile the device tree blob.

moreover,
please refer to my previous comment #3, the definition as following.
gpios = <&tegra_aon_gpio TEGRA194_AON_GPIO(EE, 4) GPIO_ACTIVE_LOW>;.

since it’s tegra_aon_gpio = "/gpio@c2f0000";
0x25 is coming from below…

        gpio@c2f0000 {
                compatible = "nvidia,tegra194-gpio-aon";
                linux,phandle = <0x25>;
                phandle = <0x25>;

and…
0x24 is coming from below… TEGRA194_AON_GPIO(EE, 4) = (8 * 4) + 4

#define TEGRA194_AON_GPIO_PORT_EE 4

#define TEGRA194_AON_GPIO(port, offset) \
        ((TEGRA194_AON_GPIO_PORT_##port * 8) + offset)

Thanks! Your reply is very helpful!
And for my question, I am so sorry, I should describe it more clearly.
I mean I have a sensor. When the sensor is triggered, it can give Jetson a high level input(use GPIO) . I try to use this high level signal to arouse my Jetson to work. So I think if there is only one GPIO signal, what can I do to arouse Jetson?

hello 7175380,

can this sensor still functional when device suspend?
since there’re several common wake sources to awakened from deep sleep. for your use-case, you may rework for using those hardware pin.

Yeah, this sensor can still functional when device suspend.

you may rework for using those hardware pin.

About this, could you give me some more detailed suggestions?

hello 7175380,

according to pin definition.

        sdhci_sd: sdhci@3400000 {
                cd-inverted;
                cd-gpios = <&tegra_main_gpio TEGRA194_MAIN_GPIO(G, 7) 0>;
                nvidia,cd-wakeup-capable;

there’s another way, you may try manipulate sd-card detection pin (i.e. cd-gpio) for your use-case.

In addition, is there a way to convert the dtsi file set (in the kernel) to dtb? Compiling the entire kernel usually takes a lot of time….
(I’m sorry that I’m a newcomer to this field. I didn’t find relevant documents or methods, which caused you a lot of trouble)

OK, I’ll try it on my Jetson.

hello 7175380,

it can be done by dtc utility.
for example, you may disassembler the dtb file into text file, dtc -I dtb -O dts -o temp.dts tegra-xxx.dtb
after that, please convert the DTS into a new DTB binary file. dtc -I dts -O dtb -o new-output.dtb temp.dts

you may copy the new dtb file to your file system.
please modify /boot/extlinux/extlinux.conf and specify FDT entry to your binary file. warm-rebooting the device to make the change take effect.

Do I just need to overwrite the dtb file in/boot to make the changes take effect?
Can you describe the process in more detail? I don’t quite understand your description.

hello 7175380,

please check the /boot/extlinux/extlinux.conf, you may load your customize device tree blob.

TIMEOUT 30
DEFAULT primary

MENU TITLE L4T boot options

LABEL primary
      MENU LABEL primary kernel
      LINUX /boot/Image
      INITRD /boot/initrd
      APPEND ${cbootargs} quiet root=/dev/mmcblk0p1 rw rootwait rootfstype=ext4 console=ttyTCU0,115200n8 console=tty0 fbcon=map:0 net.ifnames=0

This one ? How to change it is reasonable? I’m afraid I will screw up Jetson if I write it myself.

hello 7175380,

please see-also CBoot for [Kernel Boot Sequence Using extlinux.conf] session.
you may add FDT entry, so device tree binary will loaded from file system instead of the kernel-dtb partition.

According to the guidance document, for example, I now have a new dtb file named “new.dtb”, and I have moved it to the/boot directory.
Then I should add a line to the. conf file:

FDT /boot/new.dtb

Right?

yes, your understanding is correct.

may I also know which Jetpack release you’re using?
please see-also Cboot in 32.7.2 fails to read extlinux.conf - #15 by WayneWWW for the bug fixes if you’re using l4t-r32.7.2
please check release tag, $ cat /etc/nv_tegra_release for confirmation.
thanks