Awesome, thank you!
Wakeup still doesn’t work with the armbian kernel (although powering down with the new pin works fine). The log output didn’t change.
But with current mainline (without wifi) I’m a step further!
Using gpio0 A0 (pin 37 on the BPi-M7) and this overlay:
{
gpio-keys {
compatible = "gpio-keys";
autorepeat;
pinctrl-names = "default";
pinctrl-0 = <&pwr_key>;
key-power {
gpios = <&gpio0 RK_PA0 GPIO_ACTIVE_LOW>;
linux,code = <KEY_POWER>;
label = "GPIO Key Power";
debounce-interval = <100>;
wakeup-source;
};
};
};
&pinctrl {
pinctrl-names = "default";
buttons {
pwr_key: pwr-key {
rockchip,pins = <0 RK_PA0 0 &pcfg_pull_up>;
};
};
};
Suspend works:
root@bananapi ~ # systemctl suspend
[ 22.975699] PM: suspend entry (deep)
[ 23.458725] Filesystems sync: 0.482 seconds
[ 23.460739] Freezing user space processes
[ 23.462398] Freezing user space processes completed (elapsed 0.001 seconds)
[ 23.463029] OOM killer disabled.
[ 23.463323] Freezing remaining freezable tasks
[ 23.464887] Freezing remaining freezable tasks completed (elapsed 0.001 seconds)
[ 23.647857] rtc-hym8563 6-0051: no valid clock/calendar values available
[ 23.693722] Disabling non-boot CPUs ...
[ 23.694687] psci: CPU7 killed (polled 0 ms)
[ 23.696569] psci: CPU6 killed (polled 0 ms)
[ 23.698058] psci: CPU5 killed (polled 0 ms)
[ 23.699915] psci: CPU4 killed (polled 0 ms)
[ 23.702952] psci: CPU3 killed (polled 0 ms)
[ 23.704647] psci: CPU2 killed (polled 0 ms)
[ 23.706180] psci: CPU1 killed (polled 0 ms)
Then after pulling gpio0 PA0 low, I get terminal output:
[ 23.708108] Detected VIPT I-cache on CPU1
[ 23.708563] GICv3: CPU1: found redistributor 100 region 0:0x00000000fe6a0000
[ 23.709283] CPU1: Booted secondary processor 0x0000000100 [0x412fd050]
[ 23.711089] CPU1 is up
[ 23.711705] Detected VIPT I-cache on CPU2
[ 23.712142] GICv3: CPU2: found redistributor 200 region 0:0x00000000fe6c0000
[ 23.712846] CPU2: Booted secondary processor 0x0000000200 [0x412fd050]
[ 23.714540] CPU2 is up
[ 23.715131] Detected VIPT I-cache on CPU3
[ 23.715570] GICv3: CPU3: found redistributor 300 region 0:0x00000000fe6e0000
[ 23.716276] CPU3: Booted secondary processor 0x0000000300 [0x412fd050]
[ 23.718080] CPU3 is up
[ 23.718674] Detected PIPT I-cache on CPU4
[ 23.719076] GICv3: CPU4: found redistributor 400 region 0:0x00000000fe700000
[ 23.719748] CPU4: Booted secondary processor 0x0000000400 [0x414fd0b0]
[ 23.720962] CPU4 is up
[ 23.721578] Detected PIPT I-cache on CPU5
[ 23.721986] GICv3: CPU5: found redistributor 500 region 0:0x00000000fe720000
[ 23.722663] CPU5: Booted secondary processor 0x0000000500 [0x414fd0b0]
[ 23.723971] CPU5 is up
[ 23.724568] Detected PIPT I-cache on CPU6
[ 23.724973] GICv3: CPU6: found redistributor 600 region 0:0x00000000fe740000
[ 23.725646] CPU6: Booted secondary processor 0x0000000600 [0x414fd0b0]
[ 23.726965] CPU6 is up
[ 23.727558] Detected PIPT I-cache on CPU7
[ 23.727965] GICv3: CPU7: found redistributor 700 region 0:0x00000000fe760000
[ 23.728638] CPU7: Booted secondary processor 0x0000000700 [0x414fd0b0]
[ 23.730056] CPU7 is up
[ 23.731685] r8169 0002:21:00.0: Unable to change power state from D3hot to D0, device inaccessible
[ 23.731815] r8169 0004:41:00.0: Unable to change power state from D3hot to D0, device inaccessible
[ 23.731899] pci 0003:31:00.0: Unable to change power state from unknown to D0, device inaccessible
[ 23.739439] nvme 0000:01:00.0: Unable to change power state from D3hot to D0, device inaccessible
It doesn’t come back to prompt.
Then after a while:
[ 84.119243] rcu: INFO: rcu_preempt detected stalls on CPUs/tasks:
[ 84.119833] rcu: 2-...!: (0 ticks this GP) idle=6c5c/1/0x4000000000000000 softirq=501/501 fqs=0
[ 84.120667] rcu: 3-...!: (1 GPs behind) idle=70d4/1/0x4000000000000000 softirq=470/471 fqs=0
[ 84.121470] rcu: 6-...!: (0 ticks this GP) idle=f210/0/0x0 softirq=403/403 fqs=0 (false positive?)
[ 84.122319] rcu: (detected by 0, t=6002 jiffies, g=-359, q=11 ncpus=8)
[ 84.122940] Sending NMI from CPU 0 to CPUs 2:
[ 94.124818] Sending NMI from CPU 0 to CPUs 3:
[ 104.126693] Sending NMI from CPU 0 to CPUs 6:
[ 104.126822] NMI backtrace for cpu 6
[ 104.128321] CPU: 6 UID: 0 PID: 0 Comm: swapper/6 Tainted: G W 6.13.0-rc6+ #32
[ 104.129091] Tainted: [W]=WARN
[ 104.129360] Hardware name: ArmSoM Sige7 (DT)
[ 104.129745] pstate: 60400009 (nZCv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--)
[ 104.130370] pc : cpuidle_enter_state+0xb4/0x340
[ 104.130798] lr : cpuidle_enter_state+0x1c8/0x340
[ 104.131222] sp : ffff8000814ebd90 10:51:00 [465/1848]
[ 104.131522] x29: ffff8000814ebd90 x28: 0000000000000000 x27: 0000000000000000
[ 104.132171] x26: 0000000000000001 x25: 00000005d9d868e9 x24: ffff00010227f080
[ 104.132817] x23: 0000000000000001 x22: 0000000000000001 x21: 0000000000000001
[ 104.133461] x20: 000000183e710f71 x19: ffff0001fff30af8 x18: 00000005d9d7da7f
[ 104.134106] x17: 000000040044ffff x16: 000000b2b5503510 x15: 0000000000000000
[ 104.134749] x14: ffff000100372300 x13: ffff80017efd9000 x12: 000000003464d91d
[ 104.135393] x11: 0000000000000000 x10: 0000000000001000 x9 : ffff800080010800
[ 104.136038] x8 : 000001b2b5503510 x7 : 0000000000000004 x6 : 00000000404d45a2
[ 104.136681] x5 : 00ffffffffffffff x4 : 0000000000000015 x3 : ffff0001fff2d470
[ 104.137325] x2 : 000000000000000a x1 : ffff000100372300 x0 : 0000000000000000
[ 104.137969] Call trace:
[ 104.138193] cpuidle_enter_state+0xb4/0x340 (P)
[ 104.138617] cpuidle_enter+0x34/0x50
[ 104.138947] do_idle+0x1e0/0x280
[ 104.139252] cpu_startup_entry+0x34/0x38
[ 104.139614] secondary_start_kernel+0x120/0x15c
[ 104.140035] __secondary_switched+0x74/0x78
[ 104.140709] rcu: rcu_preempt kthread timer wakeup didn't happen for 8003 jiffies! g-359 f0x0 RCU_GP_WAIT_FQS(5) ->state=0x402
[ 104.141750] rcu: Possible timer handling issue on cpu=2 timer-softirq=197
[ 104.142387] rcu: rcu_preempt kthread starved for 8004 jiffies! g-359 f0x0 RCU_GP_WAIT_FQS(5) ->state=0x402 ->cpu=2
[ 104.143343] rcu: Unless rcu_preempt kthread gets sufficient CPU time, OOM is now expected behavior.
[ 104.144179] rcu: RCU grace-period kthread stack dump:
[ 104.144649] task:rcu_preempt state:I stack:0 pid:15 tgid:15 ppid:2 flags:0x00000008
[ 104.145526] Call trace:
[ 104.145769] __switch_to+0xcc/0x100 (T) 10:54:20 [440/1848]
[ 104.146161] __schedule+0x340/0x900
[ 104.146510] schedule+0x30/0x100
[ 104.146836] schedule_timeout+0x60/0xc0
[ 104.147221] rcu_gp_fqs_loop+0xe8/0x480
[ 104.147600] rcu_gp_kthread+0x114/0x140
[ 104.147977] kthread+0x10c/0x114
[ 104.148312] ret_from_fork+0x10/0x20
[ 284.189241] rcu: INFO: rcu_preempt detected stalls on CPUs/tasks:
[ 284.189822] rcu: 2-...!: (0 ticks this GP) idle=6c5c/1/0x4000000000000000 softirq=501/501 fqs=0
[ 284.190653] rcu: 3-...!: (1 GPs behind) idle=70d4/1/0x4000000000000000 softirq=470/471 fqs=0
[ 284.191455] rcu: 6-...!: (0 ticks this GP) idle=f228/0/0x0 softirq=403/403 fqs=0 (false positive?)
[ 284.192303] rcu: (detected by 0, t=26009 jiffies, g=-359, q=11 ncpus=8)
[ 284.192930] Sending NMI from CPU 0 to CPUs 2:
[ 294.194812] Sending NMI from CPU 0 to CPUs 3:
[ 304.196685] Sending NMI from CPU 0 to CPUs 6:
[ 304.196814] NMI backtrace for cpu 6
[ 304.198312] CPU: 6 UID: 0 PID: 0 Comm: swapper/6 Tainted: G W 6.13.0-rc6+ #32
[ 304.199080] Tainted: [W]=WARN
[ 304.199351] Hardware name: ArmSoM Sige7 (DT)
[ 304.199735] pstate: 60400009 (nZCv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--)
[ 304.200360] pc : cpuidle_enter_state+0xb4/0x340
[ 304.200786] lr : cpuidle_enter_state+0x1c8/0x340
[ 304.201211] sp : ffff8000814ebd90
[ 304.201511] x29: ffff8000814ebd90 x28: 0000000000000000 x27: 0000000000000000
[ 304.202159] x26: 0000000000000001 x25: 0000001d516c1942 x24: ffff00010227f080
[ 304.202806] x23: 0000000000000001 x22: 0000000000000001 x21: 0000000000000001
[ 304.203449] x20: 00000046d38adef2 x19: ffff0001fff30af8 x18: 0000001d5163dea7
[ 304.204093] x17: 000000040044ffff x16: 000000b2b5503510 x15: 0000000000000000
[ 304.204737] x14: ffff000100372300 x13: ffff80017efd9000 x12: 000000003464d91d
[ 304.205381] x11: 0000000000000000 x10: 0000000000001000 x9 : ffff800080010800
[ 304.206026] x8 : 000001b2b5503510 x7 : 0000000000000004 x6 : 00000000404d45a2
[ 304.206670] x5 : 00ffffffffffffff x4 : 0000000000000015 x3 : ffff0001fff2d470
[ 304.207313] x2 : 000000000000000a x1 : ffff000100372300 x0 : 0000000000000000
[ 304.207957] Call trace:
[ 304.208181] cpuidle_enter_state+0xb4/0x340 (P)
[ 304.208603] cpuidle_enter+0x34/0x50
[ 304.208933] do_idle+0x1e0/0x280
[ 304.209237] cpu_startup_entry+0x30/0x38
[ 304.209599] secondary_start_kernel+0x120/0x15c
[ 304.210019] __secondary_switched+0x74/0x78
[ 304.210700] rcu: rcu_preempt kthread timer wakeup didn't happen for 28010 jiffies! g-359 f0x2 RCU_GP_WAIT_FQS(5) ->state=0x200
[ 304.211750] rcu: Possible timer handling issue on cpu=1 timer-softirq=267
[ 304.212386] rcu: rcu_preempt kthread starved for 28011 jiffies! g-359 f0x2 RCU_GP_WAIT_FQS(5) ->state=0x200 ->cpu=1
[ 304.213350] rcu: Unless rcu_preempt kthread gets sufficient CPU time, OOM is now expected behavior.
[ 304.214185] rcu: RCU grace-period kthread stack dump:
[ 304.214655] task:rcu_preempt state:R stack:0 pid:15 tgid:15 ppid:2 flags:0x00000008
[ 304.215529] Call trace:
[ 304.215771] __switch_to+0xcc/0x100 (T)
[ 304.216159] __schedule+0x340/0x900
[ 304.216509] schedule+0x30/0x100
[ 304.216833] schedule_timeout+0x60/0xc0
[ 304.217217] rcu_gp_fqs_loop+0xe8/0x480
[ 304.217593] rcu_gp_kthread+0x114/0x140
[ 304.217970] kthread+0x10c/0x114
[ 304.218303] ret_from_fork+0x10/0x20
[ 304.218663] rcu: Stack dump where RCU GP kthread last ran:
[ 304.219172] Sending NMI from CPU 0 to CPUs 1
Which keeps repeating.
With wifi (brcmfmac) enabled, suspend state is never entered:
root@bananapi ~ # systemctl suspend
[ 51.396890] PM: suspend entry (deep)
[ 51.502354] Filesystems sync: 0.105 seconds
[ 51.517321] Freezing user space processes
[ 51.519018] Freezing user space processes completed (elapsed 0.001 seconds)
[ 51.519674] OOM killer disabled.
[ 51.519969] Freezing remaining freezable tasks
[ 51.521570] Freezing remaining freezable tasks completed (elapsed 0.001 seconds)
[ 53.749450] brcmfmac 0003:31:00.0: brcmf_pcie_pm_enter_D3: Timeout on response for entering D3 substate
[ 53.750284] brcmfmac 0003:31:00.0: PM: pci_pm_suspend(): brcmf_pcie_pm_enter_D3 [brcmfmac] returns -5
[ 53.751110] brcmfmac 0003:31:00.0: PM: dpm_run_callback(): pci_pm_suspend returns -5
[ 53.751796] brcmfmac 0003:31:00.0: PM: failed to suspend async: error -5
[ 53.752725] PM: Some devices failed to suspend, or early wake event detected
[ 53.785750] nvme nvme0: 8/0/0 default/read/poll queues
[ 53.796025] xhci-hcd xhci-hcd.5.auto: xHC error in resume, USBSTS 0x401, Reinit
[ 53.796681] usb usb3: root hub lost power or was reset
[ 53.797134] usb usb4: root hub lost power or was reset
[ 53.900696] OOM killer enabled.
[ 53.900968] cpu cpu0: Looking up cpu-supply from device node /cpus/cpu@0
[ 53.901006] Restarting tasks ... done.
[ 53.902261] PM: suspend exit
[ 53.902721] PM: suspend entry (s2idle)
[ 53.903405] cpu cpu4: Looking up cpu-supply from device node /cpus/cpu@400
[ 53.914949] mmc_host mmc1: Bus speed (slot 0) = 400000Hz (slot req 400000Hz, actual 400000HZ div = 0)
[ 53.969725] mmc_host mmc1: Bus speed (slot 0) = 198000000Hz (slot req 200000000Hz, actual 198000000HZ div = 0)
[ 54.270444] dwmmc_rockchip fe2c0000.mmc: Successfully tuned phase to 76
[ 54.441540] Filesystems sync: 0.538 seconds
[ 54.442477] Freezing user space processes
[ 54.444077] Freezing user space processes completed (elapsed 0.001 seconds)
[ 54.444707] OOM killer disabled.
[ 54.445004] Freezing remaining freezable tasks
[ 54.446579] Freezing remaining freezable tasks completed (elapsed 0.001 seconds)
[ 58.629379] brcmfmac 0003:31:00.0: brcmf_pcie_pm_enter_D3: Timeout on response for entering D3 substate
[ 58.630233] brcmfmac 0003:31:00.0: PM: pci_pm_suspend(): brcmf_pcie_pm_enter_D3 [brcmfmac] returns -5
[ 58.631096] brcmfmac 0003:31:00.0: PM: dpm_run_callback(): pci_pm_suspend returns -5
[ 58.631800] brcmfmac 0003:31:00.0: PM: failed to suspend async: error -5
[ 58.632726] PM: Some devices failed to suspend, or early wake event detected
[ 58.676030] xhci-hcd xhci-hcd.5.auto: xHC error in resume, USBSTS 0x401, Reinit
[ 58.676702] usb usb3: root hub lost power or was reset
[ 58.677167] usb usb4: root hub lost power or was reset
[ 58.711434] nvme nvme0: 8/0/0 default/read/poll queues
[ 58.780524] OOM killer enabled.
[ 58.780766] cpu cpu0: Looking up cpu-supply from device node /cpus/cpu@0
[ 58.780838] Restarting tasks ... done.
[ 58.782001] PM: suspend exit
[ 58.782964] cpu cpu4: Looking up cpu-supply from device node /cpus/cpu@400
[ 58.794554] mmc_host mmc1: Bus speed (slot 0) = 400000Hz (slot req 400000Hz, actual 400000HZ div = 0)
[ 58.849515] mmc_host mmc1: Bus speed (slot 0) = 198000000Hz (slot req 200000000Hz, actual 198000000HZ div = 0)
[ 59.360559] dwmmc_rockchip fe2c0000.mmc: Successfully tuned phase to 76
root@bananapi ~ #