I’m building a retro gaming handheld around the Radxa Zero. It has an external battery and power controller and a physical power switch. To make sure I have safe shutdown, it is necessary for the Zero to change the state of a given GPIO pin once the system shutdown is complete, so the external power controller will know that it’s safe to remove power from the Zero.
The Linux kernel supports this through the gpio-poweroff driver and device tree. The Raspberry Pi has a device tree overlay that does exactly this. I’ve been trying to implement something similar on the Radxa Zero but so far without success.
I’ve made a thread on the EmuELEC forum detailing my efforts. As things currently stand, I’ve been able to compille and boot a kernel that has the gpio_poweroff driver enabled and I’ve tried to enable it in the device tree, but at boot I get an error in dmesg saying:
[ 0.674882@1]- poweroff-gpio gpio-poweroff: gpio_poweroff_probe: pm_power_off function already registered
[ 0.674935@1]- poweroff-gpio: probe of gpio-poweroff failed with error -16
I’m not sure but my suspicion is that there is something in the Amlogic vendor kernel that implements platform-specific power management stuff that is registering a pm_power_off handler, which blocks gpio-poweroff. I’m hoping someone here either knows how to accomplish what I am trying to do, or is willing to help me get over this hump and get it working. Thanks in advance for any suggestions!