Skip to content
View in the app

A better way to browse. Learn more.

Learn more

using gpio to inform system has shutdown

Featured Replies

hi guys,

i'm using NanoPi neo core using a battery and a volt booster.

and I want to control the voltage booster to turn off all peripherals to conserve power and prevent battery drainage.

I figured there's a PWR-LED pin connected to GPIOL10, which turns off when the system shut down.

is there a way to map another GPIO in the same way so i could know when the system has shut down - so it will be safe to cut power off?

 

thank you so much.

 

You can use "gpio-poweroff"  https://www.kernel.org/doc/Documentation/devicetree/bindings/power/reset/gpio-poweroff.txt

 

PA2 will be High when shutdown complete:

/dts-v1/;
/plugin/;
/ {
    compatible = "allwinner,sun8i-h3";

    fragment@0 {
	target = <&pio>;
	__overlay__ {
	    poweroff_pins:poweroff_pins {
    	    allwinner,pins = "PA2";
    	    allwinner,function = "gpio_out";
	    };
	};
    };

    fragment@1 {
	target-path = "/";
    	__overlay__ {
    	    poweroff: poweroff {
            	compatible = "gpio-poweroff";
            	gpios = <&pio 0 2 0>;
	    };
	    };
    };
};

 

Guest
This topic is now closed to further replies.

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.