Skip to contentSkip to conversation

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

PATCH Applied Rafał Miłecki 3 participants 9 messages Dec 27, 2021 – Jul 17, 2022

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

PATCH v3 1/2 dt-bindings: leds: add Broadcom's BCM63138 controller

From: Rafał Miłecki <[email protected]>

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.

---
 .../bindings/leds/leds-bcm63138.yaml          | 95 +++++++++++++++++++
 1 file changed, 95 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/leds/leds-bcm63138.yaml
Documentation/devicetree/bindings/leds/leds-bcm63138.yaml new file +95 -0
new file mode 100644
index 000000000000..99cd4ba9b0ca
@@ -0,0 +1,95 @@
+# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/leds/leds-bcm63138.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Broadcom's BCM63138 LEDs controller
+
+maintainers:
+  - Rafał Miłecki <[email protected]>
+
+description: |
+  This LEDs controller was first used on BCM63138 and later reused on BCM4908,
+  BCM6848, BCM6858, BCM63138, BCM63148, BCM63381 and BCM68360 SoCs.
+
+  It supports up to 32 LEDs that can be connected parallelly or serially. It
+  also includes limited support for hardware blinking.
+
+  Binding serially connected LEDs isn't documented yet.
+
+properties:
+  compatible:
+    oneOf:
+      - items:
+          - enum:
+              - brcm,bcm4908-leds
+              - brcm,bcm6848-leds
+              - brcm,bcm6858-leds
+              - brcm,bcm63148-leds
+              - brcm,bcm63381-leds
+              - brcm,bcm68360-leds
+          - const: brcm,bcm63138-leds
+      - const: brcm,bcm63138-leds
+
+  reg:
+    maxItems: 1
+
+  "#address-cells":
+    const: 1
+
+  "#size-cells":
+    const: 0
+
+patternProperties:
+  "^led@[a-f0-9]+$":
+    type: object
+
+    $ref: common.yaml#
+
+    properties:
+      reg:
+        maxItems: 1
+        description: LED pin number
+
+      active-low:
+        type: boolean
+        description: Makes LED active low.
+
+    required:
+      - reg
+
+    unevaluatedProperties: false
+
+required:
+  - reg
+  - "#address-cells"
+  - "#size-cells"
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/leds/common.h>
+
+    leds@ff800800 {
+        compatible = "brcm,bcm4908-leds", "brcm,bcm63138-leds";
+        reg = <0xff800800 0xdc>;
+
+        #address-cells = <1>;
+        #size-cells = <0>;
+
+        led@0 {
+            reg = <0x0>;
+            function = LED_FUNCTION_POWER;
+            color = <LED_COLOR_ID_GREEN>;
+            default-state = "on";
+        };
+
+        led@3 {
+            reg = <0x3>;
+            function = LED_FUNCTION_STATUS;
+            color = <LED_COLOR_ID_GREEN>;
+            active-low;
+        };
+    };
Signature · 1 line
2.31.1
#1 lore raw

PATCH v3 2/2 leds: bcm63138: add support for BCM63138 controller

From: Rafał Miłecki <[email protected]>

It's a new controller first introduced in BCM63138 SoC. Later it was also used in BCM4908, some BCM68xx and some BCM63xxx SoCs.

---
V2: Rename to bcm63138
Improve Kconfig help
Add defines for magic values
Support setting brightness
Make bcm63xxx_leds_create_led() void function
V3: Move to blink/
Add bcm63138_leds_create_led() fail dev_err() call Drop "default-state" & LED_FULL

---
 drivers/leds/blink/Kconfig         |  12 ++
 drivers/leds/blink/Makefile        |   1 +
 drivers/leds/blink/leds-bcm63138.c | 308 +++++++++++++++++++++++++++++
 3 files changed, 321 insertions(+)
 create mode 100644 drivers/leds/blink/leds-bcm63138.c
drivers/leds/blink/Kconfig +12 -0
index 59ba81e40e85..c680af01b5a9 100644
@@ -1,3 +1,15 @@
+config LEDS_BCM63138
+	tristate "LED Support for Broadcom BCM63138 SoC"
+	depends on LEDS_CLASS
+	depends on ARCH_BCM4908 || ARCH_BCM_5301X || BCM63XX || COMPILE_TEST
+	depends on HAS_IOMEM
+	depends on OF
+	default ARCH_BCM4908
+	help
+	  This option enables support for LED controller that is part of
+	  BCM63138 SoC. The same hardware block is known to be also used
+	  in BCM4908, BCM6848, BCM6858, BCM63148, BCM63381 and BCM68360.
+
 config LEDS_LGM
        tristate "LED support for LGM SoC series"
        depends on X86 || COMPILE_TEST
drivers/leds/blink/Makefile +1 -0
index fa5d04dccf13..447029f4153a 100644
@@ -1,2 +1,3 @@
 # SPDX-License-Identifier: GPL-2.0
+obj-$(CONFIG_LEDS_BCM63138)	+= leds-bcm63138.o
 obj-$(CONFIG_LEDS_LGM)	+= leds-lgm-sso.o
drivers/leds/blink/leds-bcm63138.c new file +308 -0

308 lines not on this page · raw message

Signature · 1 line
2.31.1
#2 lore raw

Re: [PATCH V3 2/2] leds: bcm63138: add support for BCM63138 controller

Hi!

Quoted 13 lines

From: Rafał Miłecki <[email protected]>

It's a new controller first introduced in BCM63138 SoC. Later it was also used in BCM4908, some BCM68xx and some BCM63xxx SoCs.

drivers/leds/blink/Kconfig +1 -0
index 59ba81e40e85..c680af01b5a9 100644
@@ -1,3 +1,15 @@
+config LEDS_BCM63138

drivers/leds/blink/Kconfig line 11

Quoted 10 lines
drivers/leds/blink/Kconfig +10 -0
+	tristate "LED Support for Broadcom BCM63138 SoC"
+	depends on LEDS_CLASS
+	depends on ARCH_BCM4908 || ARCH_BCM_5301X || BCM63XX || COMPILE_TEST
+	depends on HAS_IOMEM
+	depends on OF
+	default ARCH_BCM4908
+	help
+	  This option enables support for LED controller that is part of
+	  BCM63138 SoC. The same hardware block is known to be also used
+	  in BCM4908, BCM6848, BCM6858, BCM63148, BCM63381 and BCM68360.

...the module will be called..?

drivers/leds/blink/Kconfig

Quoted 7 lines
drivers/leds/blink/Kconfig +7 -0
+#define BCM63138_MAX_LEDS				32
+#define BCM63138_MAX_BRIGHTNESS				9
+
+#define BCM63138_LED_BITS				4				/* how many bits control a single LED */
+#define BCM63138_LED_MASK				((1 << BCM63138_LED_BITS) - 1)	/* 0xf */
+#define BCM63138_LEDS_PER_REG				(32 / BCM63138_LED_BITS)	/* 8 */
+

80 columns would not hurt.

drivers/leds/blink/Kconfig

Quoted 5 lines
drivers/leds/blink/Kconfig +5 -0
+static void bcm63138_leds_set_flash_rate(struct bcm63138_leds *leds,
+					 struct bcm63138_led *led,
+					 u8 value)
+{
+	int reg_offset = (led->pin >> fls((BCM63138_LEDS_PER_REG - 1))) * 4;

The fls() dance is "interesting".

drivers/leds/blink/Kconfig

Quoted 9 lines
drivers/leds/blink/Kconfig +9 -0
+static void bcm63138_leds_enable_led(struct bcm63138_leds *leds,
+				     struct bcm63138_led *led,
+				     enum led_brightness value)
+{
+	u32 bit = BIT(led->pin);
+
+	bcm63138_leds_update_bits(leds, BCM63138_SW_DATA, bit,
+				  value == LED_OFF ? 0 : bit);
+}

I'd do "! value". We'll want to deprecate LED_OFF. (And you do that below).

Best regards,
Pavel

Signature · 1 line
People of Russia, stop Putin before his war on Ukraine escalates.
#3 lore raw
In reply to Rafał Miłecki
Quoted 8 lines · Rafał Miłecki

From: Rafał Miłecki <[email protected]>

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.

Quoted 7 lines

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.

Ping?

Pavel: can I get this patchset finally accepted, please?

#4 lore raw

Hi Pavel,

Quoted 13 lines · Rafał Miłecki
Quoted 12 lines · Rafał Miłecki

From: Rafał Miłecki <[email protected]>

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.

Quoted 5 lines
Quoted 3 lines

Pavel: can I get this patchset finally accepted, please?

It has been 3 months now. I kindly pinged you in January, February and March. Please let me know how can I get those patches accepted.

#5 lore raw

Hi Pavel,

Quoted 14 lines · Rafał Miłecki
Quoted 13 lines · Rafał Miłecki
Quoted 12 lines · Rafał Miłecki

From: Rafał Miłecki <[email protected]>

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.

Quoted 8 lines
Quoted 5 lines
Quoted 3 lines

Pavel: can I get this patchset finally accepted, please?

It has been 3 months now. I kindly pinged you in January, February and March. Please let me know how can I get those patches accepted.

did you maybe have a chance to look at my patches?

maintainer
#6 lore raw

Hi Pavel,

Quoted 19 lines · Rafał Miłecki
Quoted 18 lines · Rafał Miłecki
Quoted 17 lines · Rafał Miłecki
Quoted 15 lines · Rafał Miłecki

From: Rafał Miłecki <[email protected]>

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.

Quoted 6 lines
Quoted 4 lines
Quoted 1 line

Pavel: can I get this patchset finally accepted, please?

It has been 3 months now. I kindly pinged you in January, February and March. Please let me know how can I get those patches accepted.

did you maybe have a chance to look at my patches?

I'm asking to get this reviewed / accepted for half a year.

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

#7 lore raw
In reply to Rafał Miłecki

Hi!

Quoted 6 lines

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.

Documentation/devicetree/bindings/leds/leds-bcm63138.yaml line 57

Quoted 8 lines
Documentation/devicetree/bindings/leds/leds-bcm63138.yaml new file +8 -0
+    properties:
+      reg:
+        maxItems: 1
+        description: LED pin number
+
+      active-low:
+        type: boolean
+        description: Makes LED active low.

I'd expect both descriptions to end with ".", or none of them.

Best regards,
Pavel

Signature · 1 line
People of Russia, stop Putin before his war on Ukraine escalates.
Applied
#8 lore raw
In reply to Rafał Miłecki

Hi!

Quoted 11 lines

From: Rafał Miłecki <[email protected]>

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.

Thanks, applied, sorry for the delay. I would not mind additional fixes as mentioned.
Pavel

Signature · 1 line
People of Russia, stop Putin before his war on Ukraine escalates.