From 5f9fcc99c517a517e8d74ce001fc5bc2648f0e59 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Pali=20Roh=C3=A1r?= <pali@kernel.org>
Date: Thu, 30 Apr 2020 19:41:10 +0200
Subject: [PATCH] overlays: gpio-shutdown: Add information for
 Raspberry Pi 1 Model B rev 1

Raspberry Pi 1 Model B rev 1 uses GPIO1 for power-up instead of GPIO3.
---
 arch/arm/boot/dts/overlays/README                    | 10 ++++++++--
 arch/arm/boot/dts/overlays/gpio-shutdown-overlay.dts |  6 ++++--
 2 files changed, 12 insertions(+), 4 deletions(-)

--- a/arch/arm/boot/dts/overlays/README
+++ b/arch/arm/boot/dts/overlays/README
@@ -883,9 +883,14 @@ Info:   Initiates a shutdown when GPIO p
         can be powered up again by driving GPIO3 low. The default
         configuration uses GPIO3 with a pullup, so if you connect a
         button between GPIO3 and GND (pin 5 and 6 on the 40-pin header),
-        you get a shutdown and power-up button.
+        you get a shutdown and power-up button. Please note that
+        Raspberry Pi 1 Model B rev 1 uses GPIO1 instead of GPIO3.
 Load:   dtoverlay=gpio-shutdown,<param>=<val>
 Params: gpio_pin                GPIO pin to trigger on (default 3)
+                                For Raspberry Pi 1 Model B rev 1 set this
+                                explicitly to value 1, e.g.:
+
+                                    dtoverlay=gpio-shutdown,gpio_pin=1
 
         active_low              When this is 1 (active low), a falling
                                 edge generates a key down event and a
@@ -897,7 +902,8 @@ Params: gpio_pin                GPIO pin
                                 Default is "up".
 
                                 Note that the default pin (GPIO3) has an
-                                external pullup.
+                                external pullup. Same applies for GPIO1
+                                on Raspberry Pi 1 Model B rev 1.
 
         debounce                Specify the debounce interval in milliseconds
                                 (default 100)
--- a/arch/arm/boot/dts/overlays/gpio-shutdown-overlay.dts
+++ b/arch/arm/boot/dts/overlays/gpio-shutdown-overlay.dts
@@ -4,7 +4,9 @@
 
 // This overlay sets up an input device that generates KEY_POWER events
 // when a given GPIO pin changes. It defaults to using GPIO3, which can
-// also be used to wake up (start) the Rpi again after shutdown. Since
+// also be used to wake up (start) the Rpi again after shutdown.
+// Raspberry Pi 1 Model B rev 1 can be wake up only by GPIO1 pin, so for
+// these boards change default GPIO pin to 1 via gpio_pin parameter. Since
 // wakeup is active-low, this defaults to active-low with a pullup
 // enabled, but all of this can be changed using overlay parameters (but
 // note that GPIO3 has an external pullup on at least some boards).
@@ -71,7 +73,7 @@
 
 		// Allow changing the internal pullup/down state. 0 = none, 1 = pulldown, 2 = pullup
 		// Note that GPIO3 and GPIO2 are the I2c pins and have an external pullup (at least
-                // on some boards).
+		// on some boards). Same applies for GPIO1 on Raspberry Pi 1 Model B rev 1.
 		gpio_pull = <&pin_state>,"brcm,pull:0";
 
 		// Allow setting the active_low flag. 0 = active high, 1 = active low
