How to understand which pin represents WAKE29?

Hi,
we are using Jetson Xavier NX with JP 4.6.2 attached to Photon Carrier from ConnectTech and camera e-CAM21_CUNX - Sony STARVIS™ IMX327 from Econ Systems.

To put the device in sleep mode we usually use rtcwake -m mem --seconds 86400. In this case after 24 hours the board is up and running again and in the kern.log we can see following lines.

Jun  5 16:02:13 nvidia-desktop kernel: [13585.672827] Resume caused by WAKE24, max77620-top
Jun  5 16:02:13 nvidia-desktop kernel: [13585.672827] Wake[64:32]  status=0x0
Jun  5 16:02:13 nvidia-desktop kernel: [13585.672827] Wake[96:64]  status=0x0
Jun  5 16:02:13 nvidia-desktop kernel: [13585.672827] Exited SC7

The reason is WAKE24.
Strange thing for me is that in some cases once the board was in sleep mode it wakes up earlier than expected with reason WAKE29.

Apr 11 13:50:29 tegra-ubuntu kernel: [  565.783987] Resume caused by WAKE29, power-key
Apr 11 13:50:29 tegra-ubuntu kernel: [  565.783987] Wake[64:32]  status=0x0
Apr 11 13:50:29 tegra-ubuntu kernel: [  565.783987] Wake[96:64]  status=0x0
Apr 11 13:50:29 tegra-ubuntu kernel: [  565.783987] Exited SC7

I tried to find what is the pin number of WAKE29 and what power-key means.
Pinmux table shows “Customer usage=GPIO3_PEE.04” and “Pin #240”.
I tried to calculate correct GPIO number with following formula
Linux GPIO number = (base + (8 * port) + pin)
Not sure about the base. Here I found it should be 320, but in other place I found it should be 240. Depending on the base value GPIO number should be 284 or 356.
At the same time in kern.log I can see gpio=36

Jun  5 09:28:04 nvidia-desktop kernel: [  824.155923] gpio tegra-gpio-aon wake29 for gpio=36(EE:4)
Jun  5 09:28:04 nvidia-desktop kernel: [  824.155925] Enabling wake29

On the carrier board there is no power button. There is only "Rear IO - Button Dual RESET + FLASH Enable Functionality "

I also tried to to wake up the board via usb, but then the reason was WAKE61 or WAKE81.

So my main question is how to reproduce wake up with WAKE29?
kern.log (247.7 KB)

Suppose the power key is GPIO3_PEE.04, Have a check the connection of this GPIO pin.

Thanks

what is the correct pin number?
36, 284 or 356

nvidia@nvidia-desktop:~$ sudo cat /sys/kernel/debug/gpio
gpiochip4: GPIOs 200-223, parent: i2c/9-0022, tca6424, can sleep:
 gpio-200 (                    |tca6424_22_outlow   ) out hi    
 gpio-201 (                    |tca6424_22_outlow   ) out lo    
 gpio-202 (                    |tca6424_22_outlow   ) out lo    
 gpio-203 (                    |tca6424_22_outlow   ) out lo    
 gpio-204 (                    |tca6424_22_outlow   ) out lo    
 gpio-205 (                    |tca6424_22_outlow   ) out hi    
 gpio-206 (                    |tca6424_22_outlow   ) out lo    
 gpio-207 (                    |tca6424_22_outlow   ) out lo    

gpiochip3: GPIOs 224-239, parent: i2c/1-0074, tca9539, can sleep:

gpiochip2: GPIOs 240-247, parent: platform/max77620-gpio, max77620-gpio, can sleep:
 gpio-246 (                    |gpio_default        ) out hi    
 gpio-247 (                    |gpio_default        ) out hi    

gpiochip1: GPIOs 248-287, parent: platform/c2f0000.gpio, tegra-gpio-aon:
 gpio-284 (                    |power-key           ) in  hi    

gpiochip0: GPIOs 288-511, parent: platform/2200000.gpio, tegra-gpio:
 gpio-289 (                    |pcie-reg-enable     ) out lo    
 gpio-336 (                    |force-recovery      ) in  hi    
 gpio-338 (                    |vdd-sdmmc1-sw       ) out hi    
 gpio-343 (                    |cd                  ) in  hi    
 gpio-378 (                    |pcie_wake           ) in  hi    
 gpio-385 (                    |hdmi2.0_hpd         ) in  hi    
 gpio-392 (                    |avdd-cam-2v8        ) out lo    
 gpio-393 (                    |pwm-fan-tach        ) in  hi    
 gpio-412 (                    |camera-control-outpu) out lo    
 gpio-413 (                    |camera-control-outpu) out lo    
 gpio-418 (                    |cd                  ) in  lo    
 gpio-425 (                    |eqos_phy_reset      ) out hi    
 gpio-489 (                    |external-connection:) in  hi    
 gpio-490 (                    |pcie-reg-enable     ) out hi 

It’s below pin.

gpiochip1: GPIOs 248-287, parent: platform/c2f0000.gpio, tegra-gpio-aon:
 gpio-284 (                    |power-key           ) in  hi
static const int tegra194_aon_gpio_wakes[] = {
	-EINVAL,			/* wake0 */
	-EINVAL,			/* wake1 */
	TEGRA194_AON_GPIO(EE, 2),	/* wake2 */
	-EINVAL,			/* wake3 */
	-EINVAL,			/* wake4 */
	-EINVAL,			/* wake5 */
	-EINVAL,			/* wake6 */
	-EINVAL,			/* wake7 */
	-EINVAL,			/* wake8 */
	-EINVAL,			/* wake9 */
	TEGRA194_AON_GPIO(EE, 3),	/* wake10 */
	-EINVAL,			/* wake11 */
	-EINVAL,			/* wake12 */
	-EINVAL,			/* wake13 */
	-EINVAL,			/* wake14 */
	-EINVAL,			/* wake15 */
	-EINVAL,			/* wake16 */
	-EINVAL,			/* wake17 */
	-EINVAL,			/* wake18 */
	-EINVAL,			/* wake19 */
	-EINVAL,			/* wake20 */
	TEGRA194_AON_GPIO(DD, 2),	/* wake21 */
	-EINVAL,			/* wake22 */
	-EINVAL,			/* wake23 */
	-EINVAL,			/* wake24 */
	TEGRA194_AON_GPIO(EE, 0),	/* wake25 */
	TEGRA194_AON_GPIO(EE, 1),	/* wake26 */
	TEGRA194_AON_GPIO(EE, 6),	/* wake27 */
	-EINVAL,			/* wake28 */
	TEGRA194_AON_GPIO(EE, 4),	/* wake29 */
	-EINVAL,			/* wake30 */
	-EINVAL,			/* wake31 */
	-EINVAL,			/* wake32 */
	-EINVAL,			/* wake33 */
	-EINVAL,			/* wake34 */
	-EINVAL,			/* wake35 */
	-EINVAL,			/* wake36 */
	-EINVAL,			/* wake37 */
	-EINVAL,			/* wake38 */
	TEGRA194_AON_GPIO(CC, 3),	/* wake39 */
	-EINVAL,			/* wake40 */
	TEGRA194_AON_GPIO(DD, 0),	/* wake41 */
	TEGRA194_AON_GPIO(AA, 1),	/* wake42 */
	TEGRA194_AON_GPIO(AA, 3),	/* wake43 */
	-EINVAL,			/* wake44 */
	-EINVAL,			/* wake45 */
	TEGRA194_AON_GPIO(AA, 6),	/* wake46 */
	TEGRA194_AON_GPIO(BB, 3),	/* wake47 */
	TEGRA194_AON_GPIO(BB, 2),	/* wake48 */
	TEGRA194_AON_GPIO(AA, 7),	/* wake49 */
	-EINVAL,			/* wake50 */
	-EINVAL,			/* wake51 */
	-EINVAL,			/* wake52 */
	-EINVAL,			/* wake53 */
	-EINVAL,			/* wake54 */
	-EINVAL,			/* wake55 */
	-EINVAL,			/* wake56 */
	-EINVAL,			/* wake57 */
	-EINVAL,			/* wake58 */
	-EINVAL,			/* wake59 */
	-EINVAL,			/* wake60 */
	-EINVAL,			/* wake61 */
	-EINVAL,			/* wake62 */
	-EINVAL,			/* wake63 */
	-EINVAL,			/* wake64 */
	-EINVAL,			/* wake65 */
	-EINVAL,			/* wake66 */
	-EINVAL,			/* wake67 */
	-EINVAL,			/* wake68 */
	-EINVAL,			/* wake69 */
	-EINVAL,			/* wake70 */
	-EINVAL,			/* wake71 */
	-EINVAL,			/* wake72 */
	-EINVAL,			/* wake73 */
	-EINVAL,			/* wake74 */
	-EINVAL,			/* wake75 */
	-EINVAL,			/* wake76 */
	-EINVAL,			/* wake77 */
	-EINVAL,			/* wake78 */
	-EINVAL,			/* wake79 */
	-EINVAL,			/* wake80 */
	-EINVAL,			/* wake81 */
	-EINVAL,			/* wake82 */
	-EINVAL,			/* wake83 */
	-EINVAL,			/* wake84 */
	-EINVAL,			/* wake85 */
	-EINVAL,			/* wake86 */
	-EINVAL,			/* wake87 */
	-EINVAL,			/* wake88 */
	-EINVAL,			/* wake89 */
	-EINVAL,			/* wake90 */
	-EINVAL,			/* wake91 */
	-EINVAL,			/* wake92 */
	-EINVAL,			/* wake93 */
	-EINVAL,			/* wake94 */
	-EINVAL,			/* wake95 */
};
gpio-keys {
        compatible = "gpio-keys";
        gpio-keys,name = "gpio-keys";

        forcerecovery {
            label = "force-recovery";
            gpios = <&tegra_main_gpio TEGRA194_MAIN_GPIO(G, 0) GPIO_ACTIVE_LOW>;
            linux,code = <BTN_1>;
        };

        power_key {
            label = "power-key";
            gpios = <&tegra_aon_gpio TEGRA194_AON_GPIO(EE, 4) GPIO_ACTIVE_LOW>;
            linux,code = <KEY_POWER>;
            gpio-key,wakeup;
        };
    };
#define KEY_POWER               116     /* SC System Power Down */

This is what I found in device tree and in file sources/kernel/kernel-4.9/include/uapi/linux/input-event-codes.h
From the device tree we can see that the only button on the carrier which is force-recovery has different code.
TEGRA194_AON_GPIO(EE, 4) seems to be correct and represents gpio 284.
Not sure what is input 116 - KEY_POWER

It’s linux define event key code.

Thank you for the quick response.
If I understand correctly I need to connect keyboard and press the key?

Is it possible to disable specific wakeup events on the device or I need to change the device tree and re-flash it?

No, it’s different for the key generate by keyboard.
You need to change modify the device tree for it.

sorry, but I’m not familiar with it.

any suggestion how to reproduce WAKE29 in this case?
I mean how to trigger input 116 - KEY_POWER while the device is in sleep.
Or if the provided information is not enough where I need to check?

I’d like to understand what was the reason for this event.
Need to dig deeper into it and really understand how it works.

Press the power bottom to trigger it while device in sleep mode.

There is no power button on the carrier board. There is only “Rear IO - Button Dual RESET + FLASH Enable Functionality”. I’ve tried with it, but it works as expected. Just reset.

If your carrier board didn’t implement the power button you may check with HW if able wire jump the pin to try.

Thx for the info. I’ll try to make it in next days.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.