Jump to content

Q: How to make a GPIO automatically go high after shutdown


TangerineToupée

Recommended Posts

Thank you for everything you’ve done. Armbian is amazing.

 

On Raspberry PI devices, it’s possible to pass parameters to the kernel at boot-up and force certain IO pins to go high as soon as shutdown is complete. It’s along the lines of “dtoverlay=gpio-poweroff,gpiopin=xx”.

 

I’m guessing that GPIO-POWEROFF is a kernel overlay, that it’s specific to Raspbian, and that Armbian may have a similar overlay.

 

What’s the best way to discover the name of Armbian’s corresponding overlay, please? That overlay would enable me to configure the relevant single-board computer to send a signal at shutdown, a signal that would cause the charging/power circuit to unplug the board and reset the on/off power switch.

 

Any ideas would be appreciated.

Link to comment
Share on other sites

This driver (and its respective overlay) is designed to power off the board itself by toggling a GPIO, not to power off an external device, since it replaces the standard pm_power_off hook and the normal board shutdown sequence will not work.

This is not specific to Raspberry Pi but overlays can only be used on mainline 4.x kernel, and currently Armbian provides only testing images with this kernel.

Also there is no premade overlay for this driver so it has to be made and compiled manually using the Armbian documentation and bindings documentation here: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/tree/Documentation/devicetree/bindings/power/reset/gpio-poweroff.txt

Link to comment
Share on other sites

6 hours ago, zador.blood.stained said:

This driver (and its respective overlay) is designed to power off the board itself by toggling a GPIO, not to power off an external device, since it replaces the standard pm_power_off hook and the normal board shutdown sequence will not work.

You're quite right. When the pin in question goes high, it'll tell the pushbutton switch to turn off, cutting the connection between it and the power output of the charger/power supply. So, by setting the pin to go high at completion of shutdown, one ends up creating a software off switch that doubles as a hardware on/off switch. That's the theory, anyway.

6 hours ago, zador.blood.stained said:

This is not specific to Raspberry Pi but overlays can only be used on mainline 4.x kernel[... and] documentation [is] here.

You rock. Thank you for that link.

 

It might be simpler to add a 'Set pin high' call as the final item before shutdown. I'll have to play with systemd and see if I can make that happen. At that point, it would become a generic systemd problem and cease to be a motherboard-specific kernel overlay problem. Anyway, I'll explore both options and try to discover which one is the less arduous.

 

Thank you for taking the time to look into this and to respond to my question. I appreciate it.

Link to comment
Share on other sites

Dear TangerineToupée:

 

Did you find a way to compile a custom Device Tree overlay to use gpio-poweroff? i'm using kernel 4.14 on a Orange Pi Plus 2E with H3 SOC with rasbian 

 

I need the same to set a low on pin after halt.

 

Regards,

 

Mauricio F.

 

Link to comment
Share on other sites

Dear TangerineToupée:

 

I wrote a device tree user custom overlay to enable gpio-poweroff function on pin PA13 (hwd Pin8), see atatched file. The custom overlay was tested on orange Pi plus 2e, but it must work on all allwinner H3 based boards running mainline kernel 4.1x

 

I’m using armbian distro nigthly (kernel 4.14) as it won’t work on legacy kernel 3.x, so, I applied the custom overlay following the instructions on this link: https://docs.armbian.com/Hardware_Allwinner_overlays/#using-custom-overlays

 

The only problem is that the user cannot use the uart3 at the same time (hwd pins 6 and 8), but that is not a problem because H3 has 2 more uarts on the 40 pins headers that can be activated at any time.

 

regards,

 

MFM

gpio-poweroff.dts

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines