Skip to contentSkip to conversation

leds: Add basic BCMBCA LEDs support

PATCH In review Linus Walleij 3 participants 7 messages Sep 20, 2024 – Sep 24, 2024

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

cover leds: Add basic BCMBCA LEDs support

This series adds bindings and a driver for the Broadcom BCA (Broadband Access) SoC LEDs.

These LEDs can be either serial using 1-4 shift registers or parallel using unique lines per-LED.

The LED controller supports hardware triggers from an integrated ethernet switch, this support can be added later, the modern hardware control framework is complex and will require phandles and elaborate lookup of the corresponding netdev etc.

The patches were developed and tested on the Genexis XG6846B device using the BCM6846 SoC.

Broadcom guys: if you would rather take sole maintenanceship of this or be listed as comaintainers, tell me, it's fine.

---
Linus Walleij (2):
dt-bindings: leds: bcmbca: Add bindings for BRCMBCA LEDs
leds: bcmbca: Add new driver for Broadcom BCMBCA

 .../devicetree/bindings/leds/brcm,bcmbca-leds.yaml |  88 +++++
 MAINTAINERS                                        |   7 +
 drivers/leds/Kconfig                               |   9 +
 drivers/leds/Makefile                              |   1 +
 drivers/leds/leds-bcmbca.c                         | 391 +++++++++++++++++++++
 5 files changed, 496 insertions(+)

---
base-commit: 98f7e32f20d28ec452afb208f9cffc08448a2652
change-id: 20240920-bcmbca-leds-e6f16f55cfd9

Best regards,

Signature · 1 line
Linus Walleij <[email protected]>
#1 lore raw

PATCH 1/2 dt-bindings: leds: bcmbca: Add bindings for BRCMBCA LEDs

The Broadcom BCA (Broadband Access) SoCs contain a unique LED block. Add bindings for it.

---
 .../devicetree/bindings/leds/brcm,bcmbca-leds.yaml | 88 ++++++++++++++++++++++
 1 file changed, 88 insertions(+)
Documentation/devicetree/bindings/leds/brcm,bcmbca-leds.yaml new file +88 -0
new file mode 100644
index 000000000000..7fe2222c0c58
@@ -0,0 +1,88 @@
+# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/leds/brcm,bcmbca-leds.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Broadcom BCMBCA LEDs
+
+maintainers:
+  - Linus Walleij <[email protected]>
+
+description: |
+  The Broadcom BCA (Broadband Access) SoCs have a LED control
+  block that can support either parallel (directly connected)
+  LEDs or serial (connected to 1-4 shift registers) LEDs.
+  The LEDs can optionally be hardware-triggered by ethernet port
+  traffic.
+
+properties:
+  compatible:
+    const: brcm,bcmbca-leds
+
+  reg:
+    maxItems: 1
+
+  "#address-cells":
+    const: 1
+
+  "#size-cells":
+    const: 0
+
+  brcm,serial-shifters:
+    $ref: /schemas/types.yaml#/definitions/uint32
+    description:
+      This describes the number of 8-bit serial shifters
+      connected to the LED controller block. If this property
+      is definied, it is implicit that the driver is using
+      serial LED control, if it is missing, parallel LED
+      control is assumed.
+
+patternProperties:
+  "^led@[0-9a-f]+$":
+    type: object
+    $ref: common.yaml#
+    unevaluatedProperties: false
+
+    properties:
+      reg:
+        minimum: 0
+
+    required:
+      - reg
+
+required:
+  - compatible
+  - reg
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/leds/common.h>
+
+    soc {
+        #address-cells = <1>;
+        #size-cells = <1>;
+
+        led-controller@800 {
+            #address-cells = <1>;
+            #size-cells = <0>;
+            compatible = "brcm,bcmbca-leds";
+            reg = <0x800 0xc8>;
+
+            led@0 {
+                reg = <0>;
+                active-low;
+                function = "ext";
+                color = <LED_COLOR_ID_GREEN>;
+            };
+
+            led@1 {
+                reg = <1>;
+                active-low;
+                function = "ext";
+                color = <LED_COLOR_ID_AMBER>;
+            };
+        };
+    };
Signature · 1 line
2.46.0
maintainer Reviewed-by Rob Herring Reviewed-by Florian Fainelli on v1 1/2
#2 lore raw

Re: [PATCH 1/2] dt-bindings: leds: bcmbca: Add bindings for BRCMBCA LEDs

Quoted 2 lines · Linus Walleij

The Broadcom BCA (Broadband Access) SoCs contain a unique LED block. Add bindings for it.

I don't remember anymore what SoCs are part of the BCMBCA family but I believe we already have bindings for those devices (depending on the hw design variant). Please check:

Documentation/devicetree/bindings/leds/leds-bcm6328.yaml Documentation/devicetree/bindings/leds/leds-bcm63138.yaml

It may be also worth to check my commit description:

commit 13344f8ce8a0d98aa7f5d69ce3b47393c73a343b

Author: Rafał Miłecki <[email protected]>
Date:   Mon Dec 27 15:59:04 2021 +0100

dt-bindings: leds: add Broadcom's BCM63138 controller

Broadcom used 2 LEDs hardware blocks for their BCM63xx SoCs:
1. Older one (BCM6318, BCM6328, BCM6362, BCM63268, BCM6838)
2. Newer one (BCM6848, BCM6858, BCM63138, BCM63148, BCM63381,
BCM68360)

The newer one was also later also used on BCM4908 SoC.

Old block is already documented in the leds-bcm6328.yaml. This
binding
documents the new one which uses different registers & programming.
It's
first used in BCM63138 thus the binding name.

Signature · 1 line
Rafał Miłecki
maintainer Reviewed-by on v1 1/2
#3 lore raw

Re: [PATCH 1/2] dt-bindings: leds: bcmbca: Add bindings for BRCMBCA LEDs

In reply to Linus Walleij
Quoted 16 lines · Linus Walleij

The Broadcom BCA (Broadband Access) SoCs contain a unique LED block. Add bindings for it.

---
 .../devicetree/bindings/leds/brcm,bcmbca-leds.yaml | 88 ++++++++++++++++++++++
 1 file changed, 88 insertions(+)
Documentation/devicetree/bindings/leds/brcm,bcmbca-leds.yaml new file +2 -0
new file mode 100644
index 000000000000..7fe2222c0c58
@@ -0,0 +1,88 @@
+# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
+%YAML 1.2

Documentation/devicetree/bindings/leds/brcm,bcmbca-leds.yaml line 12

Quoted 10 lines
Documentation/devicetree/bindings/leds/brcm,bcmbca-leds.yaml new file +10 -0
+---
+$id: http://devicetree.org/schemas/leds/brcm,bcmbca-leds.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Broadcom BCMBCA LEDs
+
+maintainers:
+  - Linus Walleij <[email protected]>
+
+description: |

Don't need '|' if no formatting.

Otherwise,

Quoted 5 lines
Documentation/devicetree/bindings/leds/brcm,bcmbca-leds.yaml new file +5 -0
+  The Broadcom BCA (Broadband Access) SoCs have a LED control
+  block that can support either parallel (directly connected)
+  LEDs or serial (connected to 1-4 shift registers) LEDs.
+  The LEDs can optionally be hardware-triggered by ethernet port
+  traffic.
#4 lore raw

PATCH 2/2 leds: bcmbca: Add new driver for Broadcom BCMBCA

In reply to Linus Walleij

The Broadcom BCA (Broadband Access) SoCs have a LED control block that can support either parallel (directly connected) LEDs or serial (connected to 1-4 shift registers) LEDs.

Add a driver for that hardware.

---
 MAINTAINERS                |   7 +
 drivers/leds/Kconfig       |   9 ++
 drivers/leds/Makefile      |   1 +
 drivers/leds/leds-bcmbca.c | 391 +++++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 408 insertions(+)
MAINTAINERS +7 -0
index cc40a9d9b8cd..0a603b72a6a0 100644
@@ -4383,6 +4383,13 @@ N:	bcm[9]?6856
 N:	bcm[9]?6858
 N:	bcm[9]?6878
 
+BROADCOM BCMBCA LED DRIVER
+M:	Linus Walleij <[email protected]>
+L:	[email protected]
+S:	Maintained
+F:	Documentation/devicetree/bindings/leds/brcm,bcmbca-leds.yaml
+F:	drivers/leds/leds-bcmbca.c
+
 BROADCOM BDC DRIVER
 M:	Justin Chen <[email protected]>
 M:	Al Cooper <[email protected]>
drivers/leds/Kconfig +9 -0
index 8d9d8da376e4..e14c7fa587f0 100644
@@ -146,6 +146,15 @@ config LEDS_BCM6358
 	  This option enables support for LEDs connected to the BCM6358
 	  LED HW controller accessed via MMIO registers.
 
+config LEDS_BCMBCA
+	tristate "LED Support for Broadcom BCMBCA"
+	depends on LEDS_CLASS
+	depends on HAS_IOMEM
+	depends on OF
+	help
+	  This option enables support for LEDs connected to the BCMBCA
+	  LED HW controller accessed via MMIO registers.
+
 config LEDS_CHT_WCOVE
 	tristate "LED support for Intel Cherry Trail Whiskey Cove PMIC"
 	depends on LEDS_CLASS
drivers/leds/Makefile +1 -0
index 18afbb5a23ee..96e036f04e18 100644
@@ -18,6 +18,7 @@ obj-$(CONFIG_LEDS_AW200XX)		+= leds-aw200xx.o
 obj-$(CONFIG_LEDS_AW2013)		+= leds-aw2013.o
 obj-$(CONFIG_LEDS_BCM6328)		+= leds-bcm6328.o
 obj-$(CONFIG_LEDS_BCM6358)		+= leds-bcm6358.o
+obj-$(CONFIG_LEDS_BCMBCA)		+= leds-bcmbca.o
 obj-$(CONFIG_LEDS_BD2606MVV)		+= leds-bd2606mvv.o
 obj-$(CONFIG_LEDS_BD2802)		+= leds-bd2802.o
 obj-$(CONFIG_LEDS_BLINKM)		+= leds-blinkm.o
drivers/leds/leds-bcmbca.c new file +391 -0

391 lines not on this page · raw message

Signature · 1 line
2.46.0
maintainer
#5 lore raw

Re: [PATCH 2/2] leds: bcmbca: Add new driver for Broadcom BCMBCA

Quoted 5 lines · Linus Walleij

The Broadcom BCA (Broadband Access) SoCs have a LED control block that can support either parallel (directly connected) LEDs or serial (connected to 1-4 shift registers) LEDs.

Add a driver for that hardware.

There is an existing driver for this hw block, please see:
drivers/leds/blink/leds-bcm63138.c

It may need some work (I didn't compare your submission with my minimal driver) and I think it would be preferred over adding a new driver for the same hw.

Signature · 1 line
Rafał Miłecki
#6 lore raw

Re: [PATCH 2/2] leds: bcmbca: Add new driver for Broadcom BCMBCA

Quoted 9 lines · Rafał Miłecki
Quoted 5 lines · Linus Walleij

The Broadcom BCA (Broadband Access) SoCs have a LED control block that can support either parallel (directly connected) LEDs or serial (connected to 1-4 shift registers) LEDs.

Add a driver for that hardware.

There is an existing driver for this hw block, please see:
drivers/leds/blink/leds-bcm63138.c

Gah how could I miss this ... I will test with this driver and then add any stuff I need.

Thanks!
Linus Walleij