From 279672913fcfef646da84cadf74a486d4b7133e2 Mon Sep 17 00:00:00 2001 From: Peter Oostewechel Date: Sun, 18 Feb 2018 01:24:07 +0100 Subject: [PATCH 1/3] Added gpio-poweroff driver overlay for sun8i-h3 This is meant to support true power off by power switch for battery powered applications. The gpio-poweroff driver will toggle a pin if the system is halted. An external micro can then turn off the power to the processor. --- sun8i-h3/sun8i-h3-gpio-poweroff.dts | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 sun8i-h3/sun8i-h3-gpio-poweroff.dts diff --git a/sun8i-h3/sun8i-h3-gpio-poweroff.dts b/sun8i-h3/sun8i-h3-gpio-poweroff.dts new file mode 100644 index 0000000..0a73a04 --- /dev/null +++ b/sun8i-h3/sun8i-h3-gpio-poweroff.dts @@ -0,0 +1,28 @@ +/dts-v1/; +/plugin/; + +/ { + compatible = "allwinner,sun8i-h3"; + + fragment@0 { + target = <&pio>; + __overlay__ { + pwr_off_pins: pwr_off_pins { + pins = "PG11"; + function = "gpio_out"; + }; + }; + }; + + fragment@1 { + target-path = "/"; + __overlay__ { + gpio-poweroff { + compatible = "gpio-poweroff"; + pinctrl-names = "default"; + pinctrl-0 = <&pwr_off_pins>; + gpios = <&pio 6 11 0>; + }; + }; + }; +}; From dfeedc4a90d8ab4a3409e7991e57a6b8ca81e3b4 Mon Sep 17 00:00:00 2001 From: Peter Oostewechel Date: Sun, 18 Feb 2018 02:02:56 +0100 Subject: [PATCH 2/3] Updated README.sun8i-h3-overlays with gpio-poweroff overlay --- sun8i-h3/README.sun8i-h3-overlays | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/sun8i-h3/README.sun8i-h3-overlays b/sun8i-h3/README.sun8i-h3-overlays index 3029734..030c8b0 100644 --- a/sun8i-h3/README.sun8i-h3-overlays +++ b/sun8i-h3/README.sun8i-h3-overlays @@ -17,6 +17,7 @@ adding fixed software (GPIO) chip selects is possible with a separate overlay - analog-codec - cir +- gpio-poweroff - i2c0 - i2c1 - i2c2 @@ -68,6 +69,16 @@ I2C2 pins (SCL, SDA): PE12, PE13 On most board this bus is wired to Camera (CSI) socket +### gpio-poweroff + +Activates poweroff gpio driver, this driver toggles a pin when the system shuts down + +Parameters: + +param_pwr_off_pin (pin) + Pin which outputs poweroff signal when system halts + Default: PG11 + ### pps-gpio Activates pulse-per-second GPIO client From 6ceb92f09af1dbf9b019624ea96bd82dc4eb86d4 Mon Sep 17 00:00:00 2001 From: Peter Oostewechel Date: Mon, 19 Feb 2018 19:44:28 +0100 Subject: [PATCH 3/3] Fixed indenting in sun8i-h3-gpio-poweroff overlay --- sun8i-h3/sun8i-h3-gpio-poweroff.dts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sun8i-h3/sun8i-h3-gpio-poweroff.dts b/sun8i-h3/sun8i-h3-gpio-poweroff.dts index 0a73a04..7146c85 100644 --- a/sun8i-h3/sun8i-h3-gpio-poweroff.dts +++ b/sun8i-h3/sun8i-h3-gpio-poweroff.dts @@ -20,7 +20,7 @@ gpio-poweroff { compatible = "gpio-poweroff"; pinctrl-names = "default"; - pinctrl-0 = <&pwr_off_pins>; + pinctrl-0 = <&pwr_off_pins>; gpios = <&pio 6 11 0>; }; };