SolidRun / linux-fslc

Linux kernel source tree
Other
12 stars 26 forks source link

gpio-poweroff #63

Closed BMValeev closed 5 years ago

BMValeev commented 5 years ago

gpio-poweroff module leads to kernel panic during poweroff or halt command

Sending all processes the KILL signal...
Unmounting remote filesystems...
Deactivating swap...
Unmounting local filesystems...
EXT4-fs (mmcblk0p1): re-mounted. Opts: (null)
rmmod: ERROR: Module readypin is not currently loaded
imx2-wdt 20bc000.wdog: Device shutdown: Expect reboot!
reboot: Power down
------------[ cut here ]------------
WARNING: CPU: 0 PID: 589 at /media/eleps/data/repos/test/openembedded-core/build/tmp-glibc/work-shared/solidrun-imx6/kernel-source/drivers/power/reset/gpio-poweroff.c:45 SyS_reboot+0x12c/0x1bc
Modules linked in: mxc_v4l2_capture ipu_bg_overlay_sdc ipu_still ipu_prp_enc ipu_csi_enc ipu_fg_overlay_sdc hci_uart v4l2_int_device
CPU: 0 PID: 589 Comm: halt Not tainted 4.9.124-mx6-sr+g3b4f1a2 #65
Hardware name: Freescale i.MX6 Quad/DualLite (Device Tree)
[<c010f4a8>] (unwind_backtrace) from [<c010b250>] (show_stack+0x10/0x14)
[<c010b250>] (show_stack) from [<c039626c>] (dump_stack+0x88/0x9c)
[<c039626c>] (dump_stack) from [<c0124194>] (__warn+0xe8/0x100)
[<c0124194>] (__warn) from [<c012425c>] (warn_slowpath_null+0x20/0x28)
[<c012425c>] (warn_slowpath_null) from [<c01439e4>] (SyS_reboot+0x12c/0x1bc)
[<c01439e4>] (SyS_reboot) from [<c0107740>] (ret_fast_syscall+0x0/0x48)
---[ end trace 42cd2884da948798 ]---

log look like this

jnettlet commented 5 years ago

Our boards do not support poweroff. You can bring them to a halt state but they will still be on and running. By adding a gpio-poweroff you are creating an interrupt that can not be serviced and is causing the warning.

Is this a custom board?

BMValeev commented 5 years ago

Our boards do not support poweroff. You can bring them to a halt state but they will still be on and running. By adding a gpio-poweroff you are creating an interrupt that can not be serviced and is causing the warning.

Is this a custom board?

No, this is not custom board. So is possible to impelement software poweroff button for hummingboards?

jnettlet commented 5 years ago

Without implementing a hardware power control circuit there is no way to power off the device completely. A possible workaround to "mimic" a shutdown would be to implement a shutdown handler driven by the GPIO that would start write a temp signal value to the persistent scratch registers and initiate a watchdog restart. Then write a function in SPL that reads that register and if it is set put the SOC into WFI with the same GPIO as a wakeup signal. This way the filesystems will be cleanly synced, and while waiting to power up the SOC will be in WFI so drawing as little power as possible.

BMValeev commented 5 years ago

Okay, thanks. I think you can close this issue