From 11289568f8c1530a16721c9aeaae3ae1668eacbb Mon Sep 17 00:00:00 2001
From: Phil Elwell <phil@raspberrypi.com>
Date: Fri, 10 Mar 2023 11:22:24 +0000
Subject: [PATCH] ARM: dts: bcm2711-rpi-400: Restore the ACT LED

Pi 400 doesn't have an ACT LED, only a green PWR LED, but a user may
wish to remap the ACT functionality to a GPIO on the 40-pin header.
Restore the ACT LED declaration, but leave it disabled in order to
prevent a GPIO being claimed until either the act_led_gpio dtparam
or the act-led overlay is used.

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
---
 arch/arm/boot/dts/bcm2711-rpi-400.dts          | 12 ++++++++----
 arch/arm/boot/dts/overlays/act-led-overlay.dts |  3 ++-
 2 files changed, 10 insertions(+), 5 deletions(-)

--- a/arch/arm/boot/dts/bcm2711-rpi-400.dts
+++ b/arch/arm/boot/dts/bcm2711-rpi-400.dts
@@ -512,16 +512,19 @@
 };
 
 &leds {
+	// Declare the LED but leave it disabled, in case a user wants to map it
+	// to a GPIO on the header
 	act_led: led-act {
 		default-state = "off";
-		linux,default-trigger = "default-on";
-		gpios = <&gpio 42 GPIO_ACTIVE_HIGH>;
+		linux,default-trigger = "mmc0";
+		gpios = <&gpio 0 GPIO_ACTIVE_HIGH>;
+		status = "disabled";
 	};
 
 	pwr_led: led-pwr {
 		default-state = "off";
 		linux,default-trigger = "default-on";
-		gpios = <&expgpio 2 GPIO_ACTIVE_LOW>;
+		gpios = <&gpio 42 GPIO_ACTIVE_HIGH>;
 	};
 };
 
@@ -542,7 +545,8 @@
 	__overrides__ {
 		audio = <&chosen>,"bootargs{on='snd_bcm2835.enable_hdmi=1',off='snd_bcm2835.enable_hdmi=0'}";
 
-		act_led_gpio = <&act_led>,"gpios:4";
+		act_led_gpio = <&act_led>,"gpios:4",
+			       <&act_led>,"status=okay";
 		act_led_activelow = <&act_led>,"gpios:8";
 		act_led_trigger = <&act_led>,"linux,default-trigger";
 
--- a/arch/arm/boot/dts/overlays/act-led-overlay.dts
+++ b/arch/arm/boot/dts/overlays/act-led-overlay.dts
@@ -21,7 +21,8 @@
 	};
 
 	__overrides__ {
-		gpio = <&frag0>,"gpios:4";
+		gpio = <&frag0>,"gpios:4",
+		       <&frag0>,"status=okay";
 		activelow = <&frag0>,"gpios:8";
 	};
 };
