diff mbox series

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

Message ID 35c7f697070b3939727f1115d3a279e280f72cd6.1744636666.git.knezic@helmholz.com
State New
Headers show
Series Add support for WL-ICLEDs from Wurth Elektronik | expand

Commit Message

Ante Knezic April 14, 2025, 1:28 p.m. UTC
From: Ante Knezic <knezic@helmholz.com>

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

Signed-off-by: Ante Knezic <knezic@helmholz.com>
---
 .../bindings/leds/leds-wl-icled.yaml          | 88 +++++++++++++++++++
 1 file changed, 88 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/leds/leds-wl-icled.yaml

Comments

Rob Herring April 14, 2025, 3:27 p.m. UTC | #1
On Mon, 14 Apr 2025 15:28:50 +0200, Ante Knezic wrote:
> From: Ante Knezic <knezic@helmholz.com>
> 
> WL-ICLED is a RGB LED with integrated IC from Wurth Elektronik.
> Individual color brightness can be controlled via SPI protocol.
> 
> Signed-off-by: Ante Knezic <knezic@helmholz.com>
> ---
>  .../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.
Krzysztof Kozlowski April 15, 2025, 7:55 a.m. UTC | #2
On Mon, Apr 14, 2025 at 03:28:50PM GMT, Ante Knezic wrote:
> From: Ante Knezic <knezic@helmholz.com>
> 
> WL-ICLED is a RGB LED with integrated IC from Wurth Elektronik.
> Individual color brightness can be controlled via SPI protocol.
> 
> Signed-off-by: Ante Knezic <knezic@helmholz.com>
> ---
>  .../bindings/leds/leds-wl-icled.yaml          | 88 +++++++++++++++++++

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

>  1 file changed, 88 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/leds/leds-wl-icled.yaml
> 
> diff --git a/Documentation/devicetree/bindings/leds/leds-wl-icled.yaml b/Documentation/devicetree/bindings/leds/leds-wl-icled.yaml
> new file mode 100644
> index 000000000000..bf79c7a1719b
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/leds/leds-wl-icled.yaml
> @@ -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

> +
> +maintainers:
> +  - Ante Knezic <ante.knezic@helmholz.de>
> +
> +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

Is that a wildcard in each compatible?

> +
> +  '#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
> +

Missing ref to spi periph schema. See other bindings.

> +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

> +            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.

> +            };
> +
> +            led@1 {
> +                reg = <1>;
> +                color = <LED_COLOR_ID_RGB>;
> +                function = "warning";

Best regards,
Krzysztof
Krzysztof Kozlowski April 16, 2025, 10:21 a.m. UTC | #3
On 16/04/2025 11:06, Ante Knezic wrote:
> On Tue, Apr 15, 2025 Krzysztof Kozlowski wrote:
>>>  1 file changed, 88 insertions(+)
>>>  create mode 100644 Documentation/devicetree/bindings/leds/leds-wl-icled.yaml
>>>
>>> diff --git a/Documentation/devicetree/bindings/leds/leds-wl-icled.yaml b/Documentation/devicetree/bindings/leds/leds-wl-icled.yaml
>>> new file mode 100644
>>> index 000000000000..bf79c7a1719b
>>> --- /dev/null
>>> +++ b/Documentation/devicetree/bindings/leds/leds-wl-icled.yaml
>>> @@ -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?

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

> 
>> Also drop full stop
> Ok, understood.
> 
>>> +
>>> +maintainers:
>>> +  - Ante Knezic <ante.knezic@helmholz.de>
>>> +
>>> +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
>>
>> 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?

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


Best regards,
Krzysztof
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/leds/leds-wl-icled.yaml b/Documentation/devicetree/bindings/leds/leds-wl-icled.yaml
new file mode 100644
index 000000000000..bf79c7a1719b
--- /dev/null
+++ b/Documentation/devicetree/bindings/leds/leds-wl-icled.yaml
@@ -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 <ante.knezic@helmholz.de>
+
+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";
+            };
+        };
+    };
+...