[PATCH] arm64: dts: allwiner: h5: OrangePi PC2: add ethernet LEDs

Aleksander Jan Bajkowski posted 1 patch 1 month, 2 weeks ago
.../dts/allwinner/sun50i-h5-orangepi-pc2.dts  | 20 +++++++++++++++++++
1 file changed, 20 insertions(+)
[PATCH] arm64: dts: allwiner: h5: OrangePi PC2: add ethernet LEDs
Posted by Aleksander Jan Bajkowski 1 month, 2 weeks ago
This patch adds support for Ethernet LEDs.

Signed-off-by: Aleksander Jan Bajkowski <olek2@wp.pl>
---
 .../dts/allwinner/sun50i-h5-orangepi-pc2.dts  | 20 +++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/arch/arm64/boot/dts/allwinner/sun50i-h5-orangepi-pc2.dts b/arch/arm64/boot/dts/allwinner/sun50i-h5-orangepi-pc2.dts
index 0f29da7d51e6..7688f565ec9b 100644
--- a/arch/arm64/boot/dts/allwinner/sun50i-h5-orangepi-pc2.dts
+++ b/arch/arm64/boot/dts/allwinner/sun50i-h5-orangepi-pc2.dts
@@ -7,6 +7,7 @@
 
 #include <dt-bindings/gpio/gpio.h>
 #include <dt-bindings/input/input.h>
+#include <dt-bindings/leds/common.h>
 #include <dt-bindings/pinctrl/sun4i-a10.h>
 
 / {
@@ -132,6 +133,25 @@ &external_mdio {
 	ext_rgmii_phy: ethernet-phy@1 {
 		compatible = "ethernet-phy-ieee802.3-c22";
 		reg = <1>;
+
+		leds {
+			#address-cells = <1>;
+			#size-cells = <0>;
+
+			led@0 {
+				reg = <0>;
+				color = <LED_COLOR_ID_GREEN>;
+				function = LED_FUNCTION_LAN;
+				linux,default-trigger = "netdev";
+			};
+
+			led@1 {
+				reg = <1>;
+				color = <LED_COLOR_ID_AMBER>;
+				function = LED_FUNCTION_LAN;
+				linux,default-trigger = "netdev";
+			};
+		};
 	};
 };
 
-- 
2.47.2
Re: [PATCH] arm64: dts: allwiner: h5: OrangePi PC2: add ethernet LEDs
Posted by Andre Przywara 3 weeks, 4 days ago
On Mon, 18 Aug 2025 18:35:13 +0200
Aleksander Jan Bajkowski <olek2@wp.pl> wrote:

> This patch adds support for Ethernet LEDs.

So I tried this on my OPi-PC2, but I cannot influence the LEDs. I have
CONFIG_LED_TRIGGER_PHY and CONFIG_LEDS_TRIGGER_NETDEV built in, and I
see mdio_mux-0.2:01:amber:lan and mdio_mux-0.2:01:green:lan in
/sys/class/leds, but anything I write into trigger does not seem to
change the output: it always stays on the network functionality, I
guess because it's still configured to the PHY hardware wired function?

What am I missing?

Cheers,
Andre

> Signed-off-by: Aleksander Jan Bajkowski <olek2@wp.pl>
> ---
>  .../dts/allwinner/sun50i-h5-orangepi-pc2.dts  | 20
> +++++++++++++++++++ 1 file changed, 20 insertions(+)
> 
> diff --git a/arch/arm64/boot/dts/allwinner/sun50i-h5-orangepi-pc2.dts
> b/arch/arm64/boot/dts/allwinner/sun50i-h5-orangepi-pc2.dts index
> 0f29da7d51e6..7688f565ec9b 100644 ---
> a/arch/arm64/boot/dts/allwinner/sun50i-h5-orangepi-pc2.dts +++
> b/arch/arm64/boot/dts/allwinner/sun50i-h5-orangepi-pc2.dts @@ -7,6
> +7,7 @@ 
>  #include <dt-bindings/gpio/gpio.h>
>  #include <dt-bindings/input/input.h>
> +#include <dt-bindings/leds/common.h>
>  #include <dt-bindings/pinctrl/sun4i-a10.h>
>  
>  / {
> @@ -132,6 +133,25 @@ &external_mdio {
>  	ext_rgmii_phy: ethernet-phy@1 {
>  		compatible = "ethernet-phy-ieee802.3-c22";
>  		reg = <1>;
> +
> +		leds {
> +			#address-cells = <1>;
> +			#size-cells = <0>;
> +
> +			led@0 {
> +				reg = <0>;
> +				color = <LED_COLOR_ID_GREEN>;
> +				function = LED_FUNCTION_LAN;
> +				linux,default-trigger = "netdev";
> +			};
> +
> +			led@1 {
> +				reg = <1>;
> +				color = <LED_COLOR_ID_AMBER>;
> +				function = LED_FUNCTION_LAN;
> +				linux,default-trigger = "netdev";
> +			};
> +		};
>  	};
>  };
>
Re: [PATCH] arm64: dts: allwiner: h5: OrangePi PC2: add ethernet LEDs
Posted by Jernej Škrabec 3 weeks, 4 days ago
Dne ponedeljek, 18. avgust 2025 ob 18:35:13 Srednjeevropski poletni čas je Aleksander Jan Bajkowski napisal(a):
> This patch adds support for Ethernet LEDs.

How did you tested this? According to linux-sunxi wiki, this board has
RTL8211E, while LED control is supported only with RTL8211F driver.

> 
> Signed-off-by: Aleksander Jan Bajkowski <olek2@wp.pl>
> ---
>  .../dts/allwinner/sun50i-h5-orangepi-pc2.dts  | 20 +++++++++++++++++++
>  1 file changed, 20 insertions(+)
> 
> diff --git a/arch/arm64/boot/dts/allwinner/sun50i-h5-orangepi-pc2.dts b/arch/arm64/boot/dts/allwinner/sun50i-h5-orangepi-pc2.dts
> index 0f29da7d51e6..7688f565ec9b 100644
> --- a/arch/arm64/boot/dts/allwinner/sun50i-h5-orangepi-pc2.dts
> +++ b/arch/arm64/boot/dts/allwinner/sun50i-h5-orangepi-pc2.dts
> @@ -7,6 +7,7 @@
>  
>  #include <dt-bindings/gpio/gpio.h>
>  #include <dt-bindings/input/input.h>
> +#include <dt-bindings/leds/common.h>
>  #include <dt-bindings/pinctrl/sun4i-a10.h>
>  
>  / {
> @@ -132,6 +133,25 @@ &external_mdio {
>  	ext_rgmii_phy: ethernet-phy@1 {
>  		compatible = "ethernet-phy-ieee802.3-c22";
>  		reg = <1>;
> +
> +		leds {
> +			#address-cells = <1>;
> +			#size-cells = <0>;
> +
> +			led@0 {
> +				reg = <0>;
> +				color = <LED_COLOR_ID_GREEN>;
> +				function = LED_FUNCTION_LAN;
> +				linux,default-trigger = "netdev";
> +			};
> +
> +			led@1 {
> +				reg = <1>;
> +				color = <LED_COLOR_ID_AMBER>;
> +				function = LED_FUNCTION_LAN;
> +				linux,default-trigger = "netdev";
> +			};

Schematic says LED0 is "Yellow" or Amber in this DT. So LED1 should be green.

Also, I'm not sure if trigger really needs to be added, since PHY network
will set it as such.

Best regards,
Jernej

> +		};
>  	};
>  };
>  
>