Le Potato gpio-poweroff replacement

The Raspberry Pi has a kernel overlay gpio-poweroff that allows you to have a GPIO pin set a state early in the boot process and maintain that state until safe to poweroff the device. What would be the best way to mimic this with a Le Potato?

I’m not sure, it must be possible though because the blue and green LEDs at the front of the board do just that, if only coincidentally. I’m new to writing overlays, but I think searching the full device tree for “LED” might shed some light on how it’s done. You can also fool around with the LED triggers by messing with the files in /sys/class/leds/ to see how the work.

Device Tree:

We are currently working to fix the reboot on shutdown issue permanently.

1 Like

@librecomputer Cool, is this coming in the new images?

@Joshua_Dye In the mean time this overlay lights up an LED connected to pin 3 at the same time the blue heartbeat starts and kills it when it is safe to power off:

 * Overlay aimed create a safe power off LED on pin 3 :


#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/gpio/meson-gxl-gpio.h>

/ {
	compatible = "libretech,aml-s905x-cc\0amlogic,s905x\0amlogic,meson-gxl";
	fragment@0 {
	target-path = "/leds";
	__overlay__ {
		led-off {
			label = "green:status";
			color = <0x02>;
			gpios = <&gpio_ao GPIOAO_5 GPIO_ACTIVE_HIGH>;
			linux,default-trigger = "default-on";


  1. You can modify the “gpios” property to change the pin.
  2. I have no idea if the color property actually matters, or the color in the name, but this said to do like so, so I did: LED handling under Linux — The Linux Kernel documentation
  3. It seems this cannot be enabled during runtime, it must be merged for the next reboot.
  4. As stated above, I don’t have much experience, and this was a learning exercise for me. I don’t 100% understand this, so use with caution.
  5. You could probably copy the proprieties from the green LED to get it to light earlier in the boot process, but I didn’t understand this route as well, so I did it this way.

Yes, we are adding shutdown and suspend support to AML family and adding support for RK3328 video at startup and fixing RK3399 PD issues.

1 Like

Thanks for the overlay. I need this for a car power switch that drops power when a GPIO pin is brought low, so changing the shutdown behavior won’t affect the need. I’ll try to test it out in the next couple of days.

@librecomputer, I hope the change will still leave at least the option of having the restart watchdog. It’s rather handy when the only way to recover a hung system otherwise is to turn your car off and back on.

watchdog is supported on Le Potato if you flash the latest firmware. You can setup the watchdog using standard Linux interfaces.