[PATCH 1/2] dt-bindings: leds: Document LTC3220 18 channel LED Driver

Edelweise Escala posted 2 patches 1 month ago
There is a newer version of this series
[PATCH 1/2] dt-bindings: leds: Document LTC3220 18 channel LED Driver
Posted by Edelweise Escala 1 month ago
Add dt-binding for ltc3220. LTC3220 18 Channel LED driver

Signed-off-by: Edelweise Escala <edelweise.escala@analog.com>
---
 .../devicetree/bindings/leds/leds-ltc3220.yaml     | 131 +++++++++++++++++++++
 MAINTAINERS                                        |   7 ++
 2 files changed, 138 insertions(+)

diff --git a/Documentation/devicetree/bindings/leds/leds-ltc3220.yaml b/Documentation/devicetree/bindings/leds/leds-ltc3220.yaml
new file mode 100644
index 000000000000..33285a7ac7a3
--- /dev/null
+++ b/Documentation/devicetree/bindings/leds/leds-ltc3220.yaml
@@ -0,0 +1,131 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/leds/leds-ltc3220.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Analog Devices LTC3220 LED Drivers
+
+maintainers:
+  - Edelweise Escala <edelweise.escala@analog.com>
+
+description: Bindings for the Analog Devices LTC3220 18 channel LED Drivers.
+
+  For more product information please see the link below
+    https://www.analog.com/en/products/ltc3220.html
+
+properties:
+  compatible:
+    enum:
+      - adi,ltc3220
+      - adi,ltc3220-1
+
+  reg:
+    maxItems: 1
+
+  '#address-cells':
+    const: 1
+
+  '#size-cells':
+    const: 0
+
+  reset-gpios:
+    maxItems: 1
+    description: GPIO attached to the chip's reset pin
+
+  adi,force-cpo-level:
+    $ref: /schemas/types.yaml#/definitions/string
+    description: Forces the Charge Pump Output to a specified multiplier.
+    enum:
+      - "0" # Auto(default) - Automatically selects optimal charge pump mode
+      - "1.5"
+      - "2"
+      - "1"
+    default: "0"
+
+  adi,quick-write:
+    type: boolean
+    description: If present, LED 1 output becomes a master control that
+      simultaneously updates all 18 LED outputs using the hardware's quick-write
+      mode. When enabled, led@1 must be defined in the device tree to provide
+      the control interface, even if no physical LED is connected to the D1
+      output pin. When disabled or not present, LED 1 operates as a normal
+      independent LED output.
+
+patternProperties:
+  "^led@([1-9]|1[0-8])$":
+    type: object
+    $ref: /schemas/leds/common.yaml#
+    unevaluatedProperties: false
+    properties:
+      reg:
+        description: Output channel for the LED (1-18 maps to LED outputs D1-D18).
+        minimum: 1
+        maximum: 18
+
+    required:
+      - reg
+
+required:
+  - compatible
+  - reg
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/gpio/gpio.h>
+    #include <dt-bindings/leds/common.h>
+
+    i2c {
+       #address-cells = <1>;
+       #size-cells = <0>;
+
+       led-controller@1c {
+             compatible = "adi,ltc3220";
+             reg = <0x1c>;
+             #address-cells = <1>;
+             #size-cells = <0>;
+             reset-gpios = <&gpio 17 GPIO_ACTIVE_LOW>;
+             adi,force-cpo-level = "0";
+             adi,quick-write;
+
+             led@1 {
+                 reg = <1>;
+                 function = LED_FUNCTION_INDICATOR;
+                 function-enumerator = <1>;
+             };
+
+             led@2 {
+                 reg = <2>;
+                 function = LED_FUNCTION_INDICATOR;
+                 function-enumerator = <2>;
+             };
+
+             led@3 {
+                 reg = <3>;
+                 function = LED_FUNCTION_INDICATOR;
+                 function-enumerator = <3>;
+             };
+
+             led@4 {
+                 reg = <4>;
+                 function = LED_FUNCTION_INDICATOR;
+                 function-enumerator = <4>;
+             };
+
+             led@5 {
+                 reg = <5>;
+                 function = LED_FUNCTION_INDICATOR;
+                 function-enumerator = <5>;
+             };
+
+             led@6 {
+                 reg = <6>;
+                 function = LED_FUNCTION_INDICATOR;
+                 function-enumerator = <6>;
+             };
+        };
+    };
+
+...
diff --git a/MAINTAINERS b/MAINTAINERS
index 327d74ca7ecb..d640c35d1f93 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -14955,6 +14955,13 @@ W:	https://ez.analog.com/linux-software-drivers
 F:	Documentation/devicetree/bindings/iio/temperature/adi,ltc2983.yaml
 F:	drivers/iio/temperature/ltc2983.c
 
+LTC3220 LED DRIVER
+M:	Edelweise Escala <edelweise.escala@analog.com>
+L:	linux-leds@vger.kernel.org
+S:	Maintained
+W:	https://ez.analog.com/linux-software-drivers
+F:	Documentation/devicetree/bindings/leds/leds-ltc3220.yaml
+
 LTC4282 HARDWARE MONITOR DRIVER
 M:	Nuno Sa <nuno.sa@analog.com>
 L:	linux-hwmon@vger.kernel.org

-- 
2.43.0
Re: [PATCH 1/2] dt-bindings: leds: Document LTC3220 18 channel LED Driver
Posted by Krzysztof Kozlowski 1 month ago
On Tue, Jan 06, 2026 at 01:27:07PM +0800, Edelweise Escala wrote:
> Add dt-binding for ltc3220. LTC3220 18 Channel LED driver

Subject, commit msg, binding: driver as Linux driver? If yes, then
rewrite everything to match hardware.

Otherwise what is exactly a LED driver? I know motor drivers.

> 
> Signed-off-by: Edelweise Escala <edelweise.escala@analog.com>
> ---
>  .../devicetree/bindings/leds/leds-ltc3220.yaml     | 131 +++++++++++++++++++++
>  MAINTAINERS                                        |   7 ++
>  2 files changed, 138 insertions(+)
> 
> diff --git a/Documentation/devicetree/bindings/leds/leds-ltc3220.yaml b/Documentation/devicetree/bindings/leds/leds-ltc3220.yaml
> new file mode 100644
> index 000000000000..33285a7ac7a3
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/leds/leds-ltc3220.yaml

Filename matching compatible.


> @@ -0,0 +1,131 @@
> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/leds/leds-ltc3220.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: Analog Devices LTC3220 LED Drivers
> +
> +maintainers:
> +  - Edelweise Escala <edelweise.escala@analog.com>
> +
> +description: Bindings for the Analog Devices LTC3220 18 channel LED Drivers.

Missing wrapping after description. Look at other bindings.

Also, drop "Bindings for". You should describe  here hardware, not that
binding is a binding for.

> +
> +  For more product information please see the link below
> +    https://www.analog.com/en/products/ltc3220.html
> +
> +properties:
> +  compatible:
> +    enum:
> +      - adi,ltc3220
> +      - adi,ltc3220-1

What is -1 device? Why description does not help here at all?

> +
> +  reg:
> +    maxItems: 1
> +
> +  '#address-cells':
> +    const: 1
> +
> +  '#size-cells':
> +    const: 0
> +
> +  reset-gpios:
> +    maxItems: 1
> +    description: GPIO attached to the chip's reset pin

Drop description, obvious, redundant.

> +
> +  adi,force-cpo-level:
> +    $ref: /schemas/types.yaml#/definitions/string
> +    description: Forces the Charge Pump Output to a specified multiplier.
> +    enum:
> +      - "0" # Auto(default) - Automatically selects optimal charge pump mode
> +      - "1.5"
> +      - "2"
> +      - "1"

Numbers are not a string, so choose appropriate number format. Also,
oddly sorted. I don't understand what this property is for so not sure
what to recommend.


> +    default: "0"
> +
> +  adi,quick-write:
> +    type: boolean
> +    description: If present, LED 1 output becomes a master control that
> +      simultaneously updates all 18 LED outputs using the hardware's quick-write
> +      mode. When enabled, led@1 must be defined in the device tree to provide
> +      the control interface, even if no physical LED is connected to the D1
> +      output pin. When disabled or not present, LED 1 operates as a normal
> +      independent LED output.

If there is no led@1 physically, you cannot add it to the DT. It seems
you described some sort of driver behavior, instead of hardware.

> +
> +patternProperties:
> +  "^led@([1-9]|1[0-8])$":

Use consistent quotes, so '.

> +    type: object
> +    $ref: /schemas/leds/common.yaml#
> +    unevaluatedProperties: false
> +    properties:
> +      reg:
> +        description: Output channel for the LED (1-18 maps to LED outputs D1-D18).
> +        minimum: 1
> +        maximum: 18

Best regards,
Krzysztof