Skip to content
View in the app

A better way to browse. Learn more.

Armbian Community Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

GPIO poweroff on Nano Pi Neo plus 2

Featured Replies

 

Hello, guys!

 

I'm trying to make use of gpio-poweroff procedure. I'm trying to understand the consequences of the approach I've used.

Here's what I did

1) Added

    power_ctrl: power_ctrl {
       compatible = "gpio-poweroff";
       gpios = <&pio 6 11 GPIO_ACTIVE_HIGH>;
        force;
    };

to arch/arm64/boot/dts/allwinner/sun50i-h5-nanopi-neo-plus2.dts

2) Recompiled the device tree blob and put it where it belongs

The gpio-poweroff's code got probed but failed due to `pm_poweroff_handler` being set to something. So I figured it out that it's set to `psci_sys_poweroff` in [drivers/firmware/psci.c](https://github.com/friendlyarm/linux/blob/sunxi-4.x.y/drivers/firmware/psci.c#L518).

3) I commented this line out

4) Rebooted with a new kernel and issued `poweroff` on command line

5) The GPIO was driven high as expected

6) The board is switched off by external circuitry

I'm very eager to know if this is an OK thing to do on an embedded system? It seems like I do something nasty. The only reasonable approach that comes to mind is to use some kind of chain of callbacks with GPIO poweroff handler's priority set to low. So that I could toggle GPIO and then use the PSCI logic to properly shutdown. But the RFC with this approach got rejected and nobody seems to be stepping in.

Another solution is to make an ugly hack in gpio-poweroff.c and save the old callback to a variable and call it after gpio toggled.

So what do you guys think?

Guest
This topic is now closed to further replies.

Account

Navigation

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.