[RFC PATCH 7/7] realtek: Netgear GS110TPPv1: define port LEDs

Olliver Schinagl oliver at schinagl.nl
Fri Jul 29 05:58:42 PDT 2022


On 16-07-2022 21:09, Sander Vanheule wrote:
> Add the port LEDs for lan1-lan8 to the device tree for the GS110TPP v1.
> To reproduce the same behaviour as stock firmware, green should be
> LINK/ACT 1G, and amber should be LINK/ACT 100M/10M:
>
>      for i in $(seq 1 8); do
>          echo 13 > /sys/class/leds/green:lan-$i/rtl_hw_trigger
>          echo realtek-switchport > /sys/class/leds/green:lan-$i/trigger
>          echo f > /sys/class/leds/amber:lan-$i/rtl_hw_trigger
>          echo realtek-switchport > /sys/class/leds/amber:lan-$i/trigger
>      done
>
> Signed-off-by: Sander Vanheule <sander at svanheule.net>
> ---
>   .../dts-5.10/rtl8380_netgear_gs110tpp-v1.dts  | 30 +++++++++++++++++++
>   1 file changed, 30 insertions(+)
>
> diff --git a/target/linux/realtek/dts-5.10/rtl8380_netgear_gs110tpp-v1.dts b/target/linux/realtek/dts-5.10/rtl8380_netgear_gs110tpp-v1.dts
> index 1ff209cee363..897699bea2c3 100644
> --- a/target/linux/realtek/dts-5.10/rtl8380_netgear_gs110tpp-v1.dts
> +++ b/target/linux/realtek/dts-5.10/rtl8380_netgear_gs110tpp-v1.dts
> @@ -43,3 +43,33 @@
>   &uart1 {
>   	status = "okay";
>   };
> +
> +#define LAN_LED_LABEL(p, n)	STRINGIZE(p ## n)
> +#define LED_LABEL_GREEN(p)	LAN_LED_LABEL(green:lan-, p)
> +#define LED_LABEL_AMBER(p)	LAN_LED_LABEL(amber:lan-, p)
> +#define NETGEAR_LED(_phy, _port)			\
> +	led@ ## _phy ##.0 {				\
> +		reg = < _phy 0 >;			\
> +		label = LED_LABEL_GREEN(_port) ;	\
> +	};						\
> +	led@ ## _phy ## .1 {				\
> +		reg = < _phy 1 >;			\
> +		label = LED_LABEL_AMBER(_port) ;	\
> +	}
> +
> +&switchcore {
> +	port-leds {
> +		compatible = "realtek,rtl8380-port-led";
> +		#address-cells = <2>;
> +		#size-cells = <0>;
> +
> +		NETGEAR_LED(8,1);
> +		NETGEAR_LED(9,2);
> +		NETGEAR_LED(10,3);
> +		NETGEAR_LED(11,4);
> +		NETGEAR_LED(12,5);
> +		NETGEAR_LED(13,6);
> +		NETGEAR_LED(14,7);
> +		NETGEAR_LED(15,8);
> +	};
> +};
ugh, is it relaly worth it to do this? can we not just write it out; yes 
it's a lot of writing (you can use the define to generate it and copy 
paste it ;p)





More information about the openwrt-devel mailing list