Jump to content

using gpio to inform system has shutdown


Coby Levy

Recommended Posts

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.

 

Link to comment
Share on other sites

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>;
	    };
	    };
    };
};

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines