How to find wakeup source?

Hello! I am using multiple wakeup sources in my device tree: RTC interrupt (pin 45), button (pin 55) and accelerometer interrupt (pin 30). All interrupts wakeup the SoM as expected.

How can I find the interrupt source after the SoM wakes up from standby/suspend? (In other words, how can I find which interrupt was the reason for the system wakeup)

Colibri iMX6ULL 512MB WB IT
Custom carrier board
Linux TDX X11 5.2.0-devel-20210226152038+build.0 (dunfell)

Hello @CristianM ,

This information should be available from cat /var/log/syslog . Could you please check there once?

Best Regards,
Janani

@saijanani.tx I have checked, but I get: cat: /var/log/syslog: No such file or directory. Currently, I can find out the interrupt source by comparing the number of interrupts for each wakeup source using cat /proc/interrupts, but it is not the most elegant solution.

Hello @CristianM ,

You could install rsyslog to your image. Alternatively, you can use the journalctl or even dmesg log for this purpose. Could you maybe try those?

BR, Janani

@saijanani.tx dmesg does not show the wakeup source, as you can see:

[  121.280617] PM: suspend entry (deep)
[  121.305795] Filesystems sync: 0.025 seconds
[  121.374445] Freezing user space processes ... (elapsed 0.004 seconds) done.
[  121.378678] OOM killer disabled.
[  121.378689] Freezing remaining freezable tasks ... (elapsed 0.001 seconds) done.
[  121.385920] mwifiex_sdio mmc1:0001:1: info: successfully disconnected from 28:ee:52:33:87:70: reason code 3
[  121.389641] mwifiex_sdio mmc1:0001:1: None of the WOWLAN triggers enabled
[  121.494737] PM: suspend devices took 0.110 seconds
[  121.498847] Disabling non-boot CPUs ...
[  122.012407] PM: resume devices took 0.510 seconds
[  122.012427] OOM killer enabled.
[  122.012434] Restarting tasks ... done.
[  122.041600] PM: suspend exit
[  122.230489] mwifiex_sdio mmc1:0001:1: info: trying to associate to 'netis' bssid 28:ee:52:33:87:6f
[  122.414100] mwifiex_sdio mmc1:0001:1: info: associated to bssid 28:ee:52:33:87:6f successfully

Also, journalctl does not show the wakeup source:

Oct 15 09:37:41 magus-dl kernel[169]: [  121.280617] PM: suspend entry (deep)
Oct 15 09:37:41 magus-dl kernel: Filesystems sync: 0.025 seconds
Oct 15 09:37:41 magus-dl kernel[169]: [  121.305795] Filesystems sync: 0.025 seconds
Oct 15 09:37:45 magus-dl kernel: Freezing user space processes ... (elapsed 0.004 seconds) done.
Oct 15 09:37:45 magus-dl kernel: OOM killer disabled.
Oct 15 09:37:45 magus-dl kernel: Freezing remaining freezable tasks ... (elapsed 0.001 seconds) done.
Oct 15 09:37:45 magus-dl kernel: mwifiex_sdio mmc1:0001:1: info: successfully disconnected from 28:ee:52:33:87:70: reason code 3
Oct 15 09:37:45 magus-dl kernel: mwifiex_sdio mmc1:0001:1: None of the WOWLAN triggers enabled
Oct 15 09:37:45 magus-dl kernel: PM: suspend devices took 0.110 seconds
Oct 15 09:37:45 magus-dl kernel: Disabling non-boot CPUs ...
Oct 15 09:37:45 magus-dl kernel: PM: resume devices took 0.510 seconds
Oct 15 09:37:45 magus-dl kernel: OOM killer enabled.
Oct 15 09:37:45 magus-dl kernel: Restarting tasks ... done.
Oct 15 09:37:45 magus-dl kernel: PM: suspend exit
Oct 15 09:37:45 magus-dl wpa_supplicant[479]: mlan0: CTRL-EVENT-DISCONNECTED bssid=28:ee:52:33:87:70 reason=3 locally_generated=1
Oct 15 09:37:45 magus-dl wpa_supplicant[479]: dbus: wpa_dbus_property_changed: no property SessionLength in object /fi/w1/wpa_supplicant1/Interfaces/1
Oct 15 09:37:45 magus-dl kernel[169]: [  121.374445] Freezing user space processes ... (elapsed 0.004 seconds) done.
Oct 15 09:37:45 magus-dl NetworkManager[417]: <warn>  [1634290665.3520] sup-iface[0x1e66b78,mlan0]: connection disconnected (reason -3)
Oct 15 09:37:45 magus-dl kernel[169]: [  121.378678] OOM killer disabled.
Oct 15 09:37:45 magus-dl NetworkManager[417]: <info>  [1634290665.3702] device (mlan0): supplicant interface state: completed -> disconnected
Oct 15 09:37:45 magus-dl kernel[169]: [  121.378689] Freezing remaining freezable tasks ... (elapsed 0.001 seconds) done.
Oct 15 09:37:45 magus-dl kernel[169]: [  121.385920] mwifiex_sdio mmc1:0001:1: info: successfully disconnected from 28:ee:52:33:87:70: reason code 3
Oct 15 09:37:45 magus-dl kernel[169]: [  121.389641] mwifiex_sdio mmc1:0001:1: None of the WOWLAN triggers enabled
Oct 15 09:37:45 magus-dl kernel[169]: [  121.494737] PM: suspend devices took 0.110 seconds
Oct 15 09:37:45 magus-dl kernel[169]: [  121.498847] Disabling non-boot CPUs ...
Oct 15 09:37:45 magus-dl kernel[169]: [  122.012407] PM: resume devices took 0.510 seconds
Oct 15 09:37:45 magus-dl kernel[169]: [  122.012427] OOM killer enabled.
Oct 15 09:37:45 magus-dl kernel[169]: [  122.012434] Restarting tasks ... done.
Oct 15 09:37:45 magus-dl kernel[169]: [  122.041600] PM: suspend exit
Oct 15 09:37:45 magus-dl NetworkManager[417]: <info>  [1634290665.4618] device (mlan0): supplicant interface state: disconnected -> scanning
Oct 15 09:37:45 magus-dl wpa_supplicant[479]: mlan0: Trying to associate with 28:ee:52:33:87:6f (SSID='netis' freq=5180 MHz)
Oct 15 09:37:45 magus-dl kernel: mwifiex_sdio mmc1:0001:1: info: trying to associate to 'netis' bssid 28:ee:52:33:87:6f

rsyslog may be a solution, but I haven’t tried it. It takes some time to recompile the image and flash the device again. However, I think rsyslog logs the same messages presented above.

Hello @CristianM ,

After digging around a bit and asking around, I have been told that some files in /sys/power could do the trick e.g: pm_wakeup_irq

The following thread from NXP also tackles the issue. This may be helpful as well.

Best regards,
Janani

@saijanani.tx Thank you. It helped. With cat /sys/power/pm_wakeup_irq I can get the IRQ number that triggered the wakeup and I can match it in cat /proc/interrupts.

Hello @CristianM ,

Glad it worked :smiley_cat:

BR, Janani