[PATCH net-next 1/4] dt-bindings: net: dsa: realtek: describe LED usage

Luiz Angelo Daros de Luca
2024-03-10T04:52:16Z

Each port can have up to 4 LEDs (3 for current rtl8365mb devices). The
LED reg property will indicate its LED group.

An example of LED usage was included in an existing switch example.

Cc: devicetree@vger.kernel.org
Signed-off-by: Luiz Angelo Daros de Luca <luizluca@gmail.com>
---
.../devicetree/bindings/net/dsa/realtek.yaml | 46 ++++++++++++++++++++++
1 file changed, 46 insertions(+)

diff --git a/Documentation/devicetree/bindings/net/dsa/realtek.yaml b/Documentation/devicetree/bindings/net/dsa/realtek.yaml
index 70b6bda3cf98..45c1656b3fae 100644
--- a/Documentation/devicetree/bindings/net/dsa/realtek.yaml
+++ b/Documentation/devicetree/bindings/net/dsa/realtek.yaml
@@ -108,6 +108,32 @@ properties:
compatible:
const: realtek,smi-mdio

+patternProperties:
+ '^(ethernet-)?ports$':
+ type: object
+ additionalProperties: true
+
+ patternProperties:
+ '^(ethernet-)?port@[0-6]$':
+ type: object
+ additionalProperties: true
+
+ properties:
+ leds:
+ description:
+ "LEDs associated with this port"
+
+ patternProperties:
+ '^led@[a-f0-9]+$':
+ type: object
+ additionalProperties: true
+
+ properties:
+ reg:
+ description:
+ "reg indicates the LED group for this LED"
+ enum: [0, 1, 2, 3]
+
if:
required:
- reg
@@ -144,6 +170,7 @@ unevaluatedProperties: false
examples:
- |
#include <dt-bindings/gpio/gpio.h>
+ #include <dt-bindings/leds/common.h>
#include <dt-bindings/interrupt-controller/irq.h>

platform {
@@ -190,6 +217,25 @@ examples:
reg = <4>;
label = "wan";
phy-handle = <&phy4>;
+
+ leds {
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ led@0 {
+ reg = <0>;
+ color = <LED_COLOR_ID_GREEN>;
+ function = LED_FUNCTION_WAN;
+ default-state = "keep";
+ };
+
+ led@3 {
+ reg = <3>;
+ color = <LED_COLOR_ID_AMBER>;
+ function = LED_FUNCTION_WAN;
+ default-state = "keep";
+ };
+ };
};
port@5 {
reg = <5>;

--
2.44.0