From e88444a73ef7bc16869e60ad1e392129a07a9f2c Mon Sep 17 00:00:00 2001
From: Phil Elwell <phil@raspberrypi.com>
Date: Wed, 3 Mar 2021 10:31:13 +0000
Subject: [PATCH] overlays: ghost-amp: Minor tweaks

1. Reduce the delay between RELAY1 and RELAY2 to 1000ms.
2. Rename the states to simplify LED control by an external script.
3. Claim all the required GPIOs, enabling pull-ups on the input.

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
---
 .../boot/dts/overlays/ghost-amp-overlay.dts   | 20 ++++++++++++++++---
 1 file changed, 17 insertions(+), 3 deletions(-)

--- a/arch/arm/boot/dts/overlays/ghost-amp-overlay.dts
+++ b/arch/arm/boot/dts/overlays/ghost-amp-overlay.dts
@@ -54,6 +54,8 @@
 		__overlay__ {
 			amp: ghost-amp {
 				compatible = "rpi,gpio-fsm";
+				pinctrl-names = "default";
+				pinctrl-0 = <&ghost_amp_pins>;
 
 				debug = <0>;
 				gpio-controller;
@@ -77,18 +79,18 @@
 
 				amp_on_1 {
 					set = <RELAY1 1>;
-					amp_on = <GF_DELAY 1500>;
+					amp_on = <GF_DELAY 1000>;
 					amp_off = <ENABLE 0>;
 					fault = <FAULT 1>;
 				};
 
 				amp_on {
 					set = <RELAY2 1>;
-					amp_off_wait = <ENABLE 0>;
+					amp_on_wait = <ENABLE 0>;
 					fault = <FAULT 1>;
 				};
 
-				amp_off_wait {
+				amp_on_wait {
 					amp_off_1 = <GF_DELAY (30*60*1000)>,
 						    <GF_SHUTDOWN 0>;
 					amp_on = <ENABLE 1>;
@@ -107,11 +109,23 @@
 				fault {
 					set = <RELAY2 0>,
 					      <RELAY1 0>;
+					amp_off = <FAULT 0>;
 					shutdown_state;
 				};
 			};
 		};
 	};
+
+	fragment@4 {
+		target = <&gpio>;
+		__overlay__ {
+			ghost_amp_pins: ghost_amp_pins {
+				brcm,pins = <5 22 23>;
+				brcm,function = <0 1 1>; /* in out out */
+				brcm,pull = <2 0 0>; /* up none none */
+			};
+		};
+	};
 
 	__overrides__ {
 		fsm_debug = <&amp>,"debug:0";
