Skip to contentSkip to conversation

Add support for WL-ICLEDs from Wurth Elektronik

PATCH In review Ante Knezic 4 participants 9 messages Apr 14, 2025 – Apr 16, 2025

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

cover Add support for WL-ICLEDs from Wurth Elektronik

From: Ante Knezic <[email protected]>

This patch adds support for WL-ICLED series of RGB Leds. These LEDs are equipped with integrated controller and can be daisy chained to arbitrary number of units. The MCU communicates with the first LED in series via SPI. Interface can be regular SPI protocol or single line only (MOSI connection only) depending on the model.

Ante Knezic (3):
Documentation: leds: Add docs for Wurth Elektronik WL-ICLED
dt-bindings: leds: add binding for WL-ICLED
leds: add WL-ICLED SPI driver

 .../bindings/leds/leds-wl-icled.yaml          |  88 ++++
 Documentation/leds/index.rst                  |   1 +
 Documentation/leds/leds-wl-icled.rst          |  69 +++
 drivers/leds/Kconfig                          |  10 +
 drivers/leds/Makefile                         |   1 +
 drivers/leds/leds-wl-icled.c                  | 406 ++++++++++++++++++
 6 files changed, 575 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/leds/leds-wl-icled.yaml
 create mode 100644 Documentation/leds/leds-wl-icled.rst
 create mode 100644 drivers/leds/leds-wl-icled.c
Signature · 1 line
2.48.1
#1 lore raw

PATCH 1/3 Documentation: leds: Add docs for Wurth Elektronik WL-ICLED

From: Ante Knezic <[email protected]>

Basic description of WL-ICLED RGB LEDs from Wurth Elektronik

---
 Documentation/leds/index.rst         |  1 +
 Documentation/leds/leds-wl-icled.rst | 69 ++++++++++++++++++++++++++++
 2 files changed, 70 insertions(+)
 create mode 100644 Documentation/leds/leds-wl-icled.rst
Documentation/leds/index.rst +1 -0
index 76fae171039c..b9a4db72cc26 100644
@@ -30,3 +30,4 @@ LEDs
    leds-sc27xx
    leds-st1202
    leds-qcom-lpg
+   leds-wl-icled
Documentation/leds/leds-wl-icled.rst new file +69 -0

69 lines not on this page · raw message

Signature · 1 line
2.48.1
#2 lore raw

Re: [PATCH 1/3] Documentation: leds: Add docs for Wurth Elektronik WL-ICLED

Quoted 24 lines · Ante Knezic
(quoted diff) +24 -0
+Description
+-----------
+The WL-ICLEDs are RGB LEDs with integrated controller that can be
+daisy-chained to a arbitrary number of units. The MCU communicates
+with the first LED in chain via SPI interface and can be single or
+two wire connection, depending on  the model.
+
+Single wire models like 1315050930002, 1313210530000, 1312020030000 and
+1312121320437 are controlled with specific signal pattern on the
+input line. The MCU is connected to input line only via SPI MOSI signal.
+For example WE-1312121320437 uses following signal pattern per one LED:
+
+|          RED            |          GREEN          |           BLUE          |
+| GAIN:4bits | PWM:12bits | GAIN:4bits | PWM:12bits | GAIN:4bits | PWM:12bits |
+
+ where logical 1 is represented as:
+ (V)^
+    |          T
+    |<-------1.2us------->
+    |
+    +================+
+    | <---0.9us----> |
+    |                |
+    +----------------+===|------> t

Review

Quoted 10 lines
(quoted diff) +10 -0
+
+ and logical 0 is represented as:
+ (V)^
+    |          T
+    |<-------1.2us------->
+    |
+    +=====+
+    |0.3us|
+    |     |
+    +-----+==============|------> t

I get htmldocs indentation warnings from Sphinx:

Documentation/leds/leds-wl-icled.rst:22: ERROR: Unexpected indentation. [docutils]
Documentation/leds/leds-wl-icled.rst:23: WARNING: Line block ends without a blank line. [docutils]
Documentation/leds/leds-wl-icled.rst:32: ERROR: Unexpected indentation. [docutils]
Documentation/leds/leds-wl-icled.rst:33: WARNING: Line block ends without a blank line. [docutils]
Documentation/leds/leds-wl-icled.rst:55: ERROR: Unexpected indentation. [docutils]
Documentation/leds/leds-wl-icled.rst:23: ERROR: Undefined substitution referenced: "<-------1.2us-------> | +================+ | <---0.9us----> | | | +----------------+===". [docutils] Documentation/leds/leds-wl-icled.rst:33: ERROR: Undefined substitution referenced: "<-------1.2us-------> | +=====+ |0.3us". [docutils]

I have to wrap the signal logics diagram in literal code block:

---- >8 ----

Documentation/leds/leds-wl-icled.rst +7 -5
index 0e55683e946894..78ee2df33df2f5 100644
@@ -12,12 +12,13 @@ two wire connection, depending on  the model.
 Single wire models like 1315050930002, 1313210530000, 1312020030000 and
 1312121320437 are controlled with specific signal pattern on the
 input line. The MCU is connected to input line only via SPI MOSI signal.
-For example WE-1312121320437 uses following signal pattern per one LED:
+For example WE-1312121320437 uses following signal pattern per one LED::
 
-|          RED            |          GREEN          |           BLUE          |
-| GAIN:4bits | PWM:12bits | GAIN:4bits | PWM:12bits | GAIN:4bits | PWM:12bits |
+  |          RED            |          GREEN          |           BLUE          |
+  | GAIN:4bits | PWM:12bits | GAIN:4bits | PWM:12bits | GAIN:4bits | PWM:12bits |
+
+where logical 1 is represented as::
 
- where logical 1 is represented as:
  (V)^
     |          T
     |<-------1.2us------->
@@ -27,7 +28,8 @@ For example WE-1312121320437 uses following signal pattern per one LED:
     |                |
     +----------------+===|------> t
 
- and logical 0 is represented as:
+and logical 0 is represented as::
+
  (V)^
     |          T
     |<-------1.2us------->
Quoted 8 lines
(quoted diff) +8 -0
+
+To generate the required pattern with exact timings SPI clock is selected
+so that it devides T in 8 equal parts such that a logical true symbol can be
+represented as 1111 1100 and a logical false can be represented as 1100 0000.
+Single wire LEDs require the MOSI line to be set to low at idle and this should
+be provided by the chip driver if possible or by external HW circuit.
+
+Models 1313210530000, 1312020030000 and 1315050930002 require a slightly

Review

Quoted 10 lines
(quoted diff) +10 -0
+different signaling scheme where each color of the LED is encoded in
+8 bits.
+
+Two wire LED types do not require specific encoding of the input line as
+both clock and data are provided to each LED.
+
+Additionally, models differ by available controls:
+- WE 1312121320437 provide PWM and GAIN control per each RGB element.
+  Both GAIN and PWM values are calculated by normalising particular
+  multi_intensity value to 4 and 12 bits.

Separate the first bullet item from previous paragraph so that all three items are outputted as in bullet list.

Review

Quoted 13 lines
(quoted diff) +13 -0
+
+- WE 1315050930246 and 1311610030140 provide PWM control per each
+  RGB element and one global GAIN control.
+  Global GAIN value is calculated by normalising global led brightness
+  value to 5 bits while PWM values are set by particular
+  multi_intensity values.
+
+- WE 1315050930002, 1313210530000 and 1312020030000 provide only PWM
+  control per each RGB element.
+  PWM values are set by particular multi_intensity value.
+
+For more product information please see the link below:
+https://www.we-online.com/en/components/products/WL-ICLED

Thanks.

Signature · 1 line
An old man doll... just what I always wanted! - Clara
#3 lore raw

PATCH 2/3 dt-bindings: leds: add binding for WL-ICLED

In reply to Ante Knezic

From: Ante Knezic <[email protected]>

WL-ICLED is a RGB LED with integrated IC from Wurth Elektronik. Individual color brightness can be controlled via SPI protocol.

---
 .../bindings/leds/leds-wl-icled.yaml          | 88 +++++++++++++++++++
 1 file changed, 88 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/leds/leds-wl-icled.yaml
Documentation/devicetree/bindings/leds/leds-wl-icled.yaml new file +88 -0
new file mode 100644
index 000000000000..bf79c7a1719b
@@ -0,0 +1,88 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/leds/leds-wl-icled.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: LED driver for WL-ICLEDs from Wurth Elektronik.
+
+maintainers:
+  - Ante Knezic <[email protected]>
+
+description: |
+  The WL-ICLEDs are RGB LEDs with integrated controller that can be
+  daisy-chained to arbitrary number of LEDs. Communication with LEDs is
+  via SPI interface and can be single or two wire, depending on the model.
+  For more product information please see the link below:
+  https://www.we-online.com/en/components/products/WL-ICLED
+
+properties:
+  compatible:
+    enum:
+      - we,1315x246
+      - we,1315x002
+      - we,131x000
+      - we,131161x
+      - we,131212x
+
+  '#address-cells':
+    const: 1
+
+  '#size-cells':
+    const: 0
+
+patternProperties:
+  '^led@[0-9a-f]$':
+    type: object
+    $ref: leds-class-multicolor.yaml#
+    unevaluatedProperties: false
+
+    properties:
+      reg:
+        maxItems: 1
+        description:
+          This property denotes the LED position in the daisy chain
+          series. It is a zero based LED identifier.
+
+required:
+  - compatible
+  - reg
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/gpio/gpio.h>
+    #include <dt-bindings/leds/common.h>
+
+    spi {
+        #address-cells = <1>;
+        #size-cells = <0>;
+
+        icled@1 {
+            compatible = "we,131x000";
+            #address-cells = <1>;
+            #size-cells = <0>;
+            reg = <1>;
+            cs-gpios = <&gpio 1 GPIO_ACTIVE_HIGH>;
+
+            led@0 {
+                reg = <0>;
+                color = <LED_COLOR_ID_RGB>;
+                function = "error";
+            };
+
+            led@1 {
+                reg = <1>;
+                color = <LED_COLOR_ID_RGB>;
+                function = "warning";
+            };
+
+            led@2 {
+                reg = <2>;
+                color = <LED_COLOR_ID_RGB>;
+                function = "running";
+            };
+        };
+    };
+...
Signature · 1 line
2.48.1
#4 lore raw

Re: [PATCH 2/3] dt-bindings: leds: add binding for WL-ICLED

Quoted 11 lines · Ante Knezic

From: Ante Knezic <[email protected]>

WL-ICLED is a RGB LED with integrated IC from Wurth Elektronik. Individual color brightness can be controlled via SPI protocol.

---
 .../bindings/leds/leds-wl-icled.yaml          | 88 +++++++++++++++++++
 1 file changed, 88 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/leds/leds-wl-icled.yaml

My bot found errors running 'make dt_binding_check' on your patch:

yamllint warnings/errors:

dtschema/dtc warnings/errors:
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/leds/leds-wl-icled.example.dtb: icled@1 (we,131x000): 'cs-gpios', 'reg' do not match any of the regexes: '^led@[0-9a-f]$', 'pinctrl-[0-9]+'
from schema $id: http://devicetree.org/schemas/leds/leds-wl-icled.yaml#

doc reference errors (make refcheckdocs):

See https://patchwork.ozlabs.org/project/devicetree-bindings/patch/35c7f697070b3939727f1115d3a279e280f72cd6.1744636666.git.knezic@helmholz.com

The base for the series is generally the latest rc1. A different dependency should be noted in *this* patch.

If you already ran 'make dt_binding_check' and didn't see the above error(s), then make sure 'yamllint' is installed and dt-schema is up to date:

pip3 install dtschema --upgrade

Please check and re-submit after running the above command yourself. Note that DT_SCHEMA_FILES can be set to your schema file to speed up checking your schema. However, it must be unset to test all examples with your schema.

#5 lore raw

Re: [PATCH 2/3] dt-bindings: leds: add binding for WL-ICLED

In reply to Ante Knezic
Quoted 8 lines · Ante Knezic

From: Ante Knezic <[email protected]>

WL-ICLED is a RGB LED with integrated IC from Wurth Elektronik. Individual color brightness can be controlled via SPI protocol.

---
 .../bindings/leds/leds-wl-icled.yaml          | 88 +++++++++++++++++++

Filename based on compatible. Choose one compatible and use it here.

Quoted 9 lines
 1 file changed, 88 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/leds/leds-wl-icled.yaml
Documentation/devicetree/bindings/leds/leds-wl-icled.yaml new file +0 -0
new file mode 100644
index 000000000000..bf79c7a1719b

Documentation/devicetree/bindings/leds/leds-wl-icled.yaml line 7

Quoted 7 lines
Documentation/devicetree/bindings/leds/leds-wl-icled.yaml new file +7 -0
@@ -0,0 +1,88 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/leds/leds-wl-icled.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: LED driver for WL-ICLEDs from Wurth Elektronik.

driver as Linux driver? Then drop and describe hardware.

Also drop full stop

Quoted 9 lines
Documentation/devicetree/bindings/leds/leds-wl-icled.yaml new file +9 -0
+
+maintainers:
+  - Ante Knezic <[email protected]>
+
+description: |
+  The WL-ICLEDs are RGB LEDs with integrated controller that can be
+  daisy-chained to arbitrary number of LEDs. Communication with LEDs is
+  via SPI interface and can be single or two wire, depending on the model.
+  For more product information please see the link below:

Documentation/devicetree/bindings/leds/leds-wl-icled.yaml line 26

Quoted 10 lines
Documentation/devicetree/bindings/leds/leds-wl-icled.yaml new file +10 -0
+  https://www.we-online.com/en/components/products/WL-ICLED
+
+properties:
+  compatible:
+    enum:
+      - we,1315x246
+      - we,1315x002
+      - we,131x000
+      - we,131161x
+      - we,131212x

Is that a wildcard in each compatible?

Quoted 14 lines
Documentation/devicetree/bindings/leds/leds-wl-icled.yaml new file +14 -0
+
+  '#address-cells':
+    const: 1
+
+  '#size-cells':
+    const: 0
+
+patternProperties:
+  '^led@[0-9a-f]$':
+    type: object
+    $ref: leds-class-multicolor.yaml#
+    unevaluatedProperties: false
+
+    properties:

Documentation/devicetree/bindings/leds/leds-wl-icled.yaml line 50

Quoted 10 lines
Documentation/devicetree/bindings/leds/leds-wl-icled.yaml new file +10 -0
+      reg:
+        maxItems: 1
+        description:
+          This property denotes the LED position in the daisy chain
+          series. It is a zero based LED identifier.
+
+required:
+  - compatible
+  - reg
+

Missing ref to spi periph schema. See other bindings.

Documentation/devicetree/bindings/leds/leds-wl-icled.yaml line 62

Quoted 12 lines
Documentation/devicetree/bindings/leds/leds-wl-icled.yaml new file +12 -0
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/gpio/gpio.h>
+    #include <dt-bindings/leds/common.h>
+
+    spi {
+        #address-cells = <1>;
+        #size-cells = <0>;
+
+        icled@1 {

Node names should be generic. See also an explanation and list of examples (not exhaustive) in DT specification:
https://devicetree-specification.readthedocs.io/en/latest/chapter2-devicetree-basics.html#generic-names-recommendation

led-controller

Documentation/devicetree/bindings/leds/leds-wl-icled.yaml line 72

Quoted 10 lines
Documentation/devicetree/bindings/leds/leds-wl-icled.yaml new file +10 -0
+            compatible = "we,131x000";
+            #address-cells = <1>;
+            #size-cells = <0>;
+            reg = <1>;
+            cs-gpios = <&gpio 1 GPIO_ACTIVE_HIGH>;
+
+            led@0 {
+                reg = <0>;
+                color = <LED_COLOR_ID_RGB>;
+                function = "error";

Use standard defines.

Documentation/devicetree/bindings/leds/leds-wl-icled.yaml line 78

Quoted 6 lines
Documentation/devicetree/bindings/leds/leds-wl-icled.yaml new file +6 -0
+            };
+
+            led@1 {
+                reg = <1>;
+                color = <LED_COLOR_ID_RGB>;
+                function = "warning";

Best regards,
Krzysztof

#6 lore raw

Re: [PATCH 2/3] dt-bindings: leds: add binding for WL-ICLED

Quoted 18 lines · On Tue, Apr 15, 2025 Krzysztof Kozlowski wrote:
Quoted 9 lines
 1 file changed, 88 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/leds/leds-wl-icled.yaml
Documentation/devicetree/bindings/leds/leds-wl-icled.yaml new file +0 -0
new file mode 100644
index 000000000000..bf79c7a1719b

Documentation/devicetree/bindings/leds/leds-wl-icled.yaml line 7

Quoted 7 lines
Documentation/devicetree/bindings/leds/leds-wl-icled.yaml new file +7 -0
@@ -0,0 +1,88 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/leds/leds-wl-icled.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: LED driver for WL-ICLEDs from Wurth Elektronik.

driver as Linux driver? Then drop and describe hardware.

Sorry, I am not sure I quite understand what you mean here? Add "linux LED driver" to title?

Quoted 1 line

Also drop full stop

Ok, understood.

Quoted 13 lines
Quoted 13 lines
Documentation/devicetree/bindings/leds/leds-wl-icled.yaml new file +13 -0
+
+maintainers:
+  - Ante Knezic <[email protected]>
+
+description: |
+  The WL-ICLEDs are RGB LEDs with integrated controller that can be
+  daisy-chained to arbitrary number of LEDs. Communication with LEDs is
+  via SPI interface and can be single or two wire, depending on the model.
+  For more product information please see the link below:
+  https://www.we-online.com/en/components/products/WL-ICLED
+
+properties:
+  compatible:
Quoted 8 lines

Documentation/devicetree/bindings/leds/leds-wl-icled.yaml line 26

Quoted 6 lines
Documentation/devicetree/bindings/leds/leds-wl-icled.yaml new file +6 -0
+    enum:
+      - we,1315x246
+      - we,1315x002
+      - we,131x000
+      - we,131161x
+      - we,131212x

Is that a wildcard in each compatible?

Unfortunatelly, yes. Exact model names are quite elaborate, yet similar enough:

1315050930246   --> we,1315x246
1315050930002   --> we,1315x002
1313210530000   --> we,131x000

1312020030000 we,131x000
1311610030140 --> we,131161x
1312121320437 --> we,131212x

This seemed easier than writing complete model number... You want compatible expanded to full number anyway?

#7 lore raw

Re: [PATCH 2/3] dt-bindings: leds: add binding for WL-ICLED

Quoted 19 lines · Ante Knezic
Quoted 18 lines · On Tue, Apr 15, 2025 Krzysztof Kozlowski wrote:
Quoted 9 lines
 1 file changed, 88 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/leds/leds-wl-icled.yaml
Documentation/devicetree/bindings/leds/leds-wl-icled.yaml new file +0 -0
new file mode 100644
index 000000000000..bf79c7a1719b

Documentation/devicetree/bindings/leds/leds-wl-icled.yaml line 7

Quoted 7 lines
Documentation/devicetree/bindings/leds/leds-wl-icled.yaml new file +7 -0
@@ -0,0 +1,88 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/leds/leds-wl-icled.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: LED driver for WL-ICLEDs from Wurth Elektronik.

driver as Linux driver? Then drop and describe hardware.

Quoted 2 lines

Sorry, I am not sure I quite understand what you mean here? Add "linux LED driver" to title?

I am asking to drop it and instead describe the hardware.

Quoted 29 lines
Quoted 2 lines

Also drop full stop

Ok, understood.

Quoted 13 lines
Quoted 13 lines
Documentation/devicetree/bindings/leds/leds-wl-icled.yaml new file +13 -0
+
+maintainers:
+  - Ante Knezic <[email protected]>
+
+description: |
+  The WL-ICLEDs are RGB LEDs with integrated controller that can be
+  daisy-chained to arbitrary number of LEDs. Communication with LEDs is
+  via SPI interface and can be single or two wire, depending on the model.
+  For more product information please see the link below:
+  https://www.we-online.com/en/components/products/WL-ICLED
+
+properties:
+  compatible:
Quoted 8 lines

Documentation/devicetree/bindings/leds/leds-wl-icled.yaml line 26

Quoted 6 lines
Documentation/devicetree/bindings/leds/leds-wl-icled.yaml new file +6 -0
+    enum:
+      - we,1315x246
+      - we,1315x002
+      - we,131x000
+      - we,131161x
+      - we,131212x

Is that a wildcard in each compatible?

Unfortunatelly, yes. Exact model names are quite elaborate, yet similar enough:

1315050930246   --> we,1315x246
1315050930002   --> we,1315x002
1313210530000   --> we,131x000
Quoted 6 lines

1312020030000 we,131x000
1311610030140 --> we,131161x
1312121320437 --> we,131212x

This seemed easier than writing complete model number... You want compatible expanded to full number anyway?

Yes, otherwise git grep for model won't work.

Best regards,
Krzysztof

#8 lore raw

PATCH 3/3 leds: add WL-ICLED SPI driver

In reply to Ante Knezic

From: Ante Knezic <[email protected]>

Add support for WL-ICLED RGB LEDs with integrated controller. Device enables individual color control via SPI interface and can be interfaced via single wire connection (MOSI line only) or by two wire connection (MOSI and CLK).

---
 drivers/leds/Kconfig         |  10 +
 drivers/leds/Makefile        |   1 +
 drivers/leds/leds-wl-icled.c | 406 +++++++++++++++++++++++++++++++++++
 3 files changed, 417 insertions(+)
 create mode 100644 drivers/leds/leds-wl-icled.c
drivers/leds/Kconfig +10 -0
index a104cbb0a001..a8100a7ee72b 100644
@@ -950,6 +950,16 @@ config LEDS_SPI_BYTE
 	  for controlling the brightness. Currently the following controller is
 	  supported: Ubiquiti airCube ISP microcontroller based LED controller.
 
+config LEDS_WL_ICLED
+	tristate "LED Support for WL-ICLED RGB LEDs"
+	depends on LEDS_CLASS
+	depends on SPI
+	depends on OF
+	depends on LEDS_CLASS_MULTICOLOR
+	help
+	  Say yes to get support for the Wurth Elektronik WL-ICLED series RGB
+	  LEDs with integrated controller.
+
 config LEDS_TI_LMU_COMMON
 	tristate "LED driver for TI LMU" if COMPILE_TEST
 	select REGMAP
drivers/leds/Makefile +1 -0
index 2f170d69dcbf..42e8849fa619 100644
@@ -106,6 +106,7 @@ obj-$(CONFIG_LEDS_CR0014114)		+= leds-cr0014114.o
 obj-$(CONFIG_LEDS_DAC124S085)		+= leds-dac124s085.o
 obj-$(CONFIG_LEDS_EL15203000)		+= leds-el15203000.o
 obj-$(CONFIG_LEDS_SPI_BYTE)		+= leds-spi-byte.o
+obj-$(CONFIG_LEDS_WL_ICLED)		+= leds-wl-icled.o
 
 # LED Userspace Drivers
 obj-$(CONFIG_LEDS_USER)			+= uleds.o
drivers/leds/leds-wl-icled.c new file +406 -0

406 lines not on this page · raw message

Signature · 1 line
2.48.1