[PATCH 2/2] dt-bindings: leds: ti,lm3601x: Convert to DT Schema

Harrison Carter posted 2 patches 2 months, 2 weeks ago
[PATCH 2/2] dt-bindings: leds: ti,lm3601x: Convert to DT Schema
Posted by Harrison Carter 2 months, 2 weeks ago
Converts the ti,lm36010 and ti,lm36011 txt to dt schema

Signed-off-by: Harrison Carter <hcarter@thegoodpenguin.co.uk>
---
 .../devicetree/bindings/leds/leds-lm3601x.txt      |  51 -----------
 .../devicetree/bindings/leds/ti,lm3601x.yaml       | 100 +++++++++++++++++++++
 2 files changed, 100 insertions(+), 51 deletions(-)

diff --git a/Documentation/devicetree/bindings/leds/leds-lm3601x.txt b/Documentation/devicetree/bindings/leds/leds-lm3601x.txt
deleted file mode 100644
index 17e940025dc26213314f5cfd54aa8e5bb09f86b7..0000000000000000000000000000000000000000
--- a/Documentation/devicetree/bindings/leds/leds-lm3601x.txt
+++ /dev/null
@@ -1,51 +0,0 @@
-* Texas Instruments - lm3601x Single-LED Flash Driver
-
-The LM3601X are ultra-small LED flash drivers that
-provide a high level of adjustability.
-
-Required properties:
-	- compatible : Can be one of the following
-		"ti,lm36010"
-		"ti,lm36011"
-	- reg : I2C slave address
-	- #address-cells : 1
-	- #size-cells : 0
-
-Required child properties:
-	- reg : 0 - Indicates a IR mode
-		1 - Indicates a Torch (white LED) mode
-
-Required properties for flash LED child nodes:
-	See Documentation/devicetree/bindings/leds/common.txt
-	- flash-max-microamp : Range from 11mA - 1.5A
-	- flash-max-timeout-us : Range from 40ms - 1600ms
-	- led-max-microamp : Range from 2.4mA - 376mA
-
-Optional child properties:
-	- function : see Documentation/devicetree/bindings/leds/common.txt
-	- color : see Documentation/devicetree/bindings/leds/common.txt
-	- label : see Documentation/devicetree/bindings/leds/common.txt (deprecated)
-
-Example:
-
-#include <dt-bindings/leds/common.h>
-
-led-controller@64 {
-	compatible = "ti,lm36010";
-	#address-cells = <1>;
-	#size-cells = <0>;
-	reg = <0x64>;
-
-	led@0 {
-		reg = <1>;
-		function = LED_FUNCTION_TORCH;
-		color = <LED_COLOR_ID_WHITE>;
-		led-max-microamp = <376000>;
-		flash-max-microamp = <1500000>;
-		flash-max-timeout-us = <1600000>;
-	};
-}
-
-For more product information please see the links below:
-https://www.ti.com/product/LM36010
-https://www.ti.com/product/LM36011
diff --git a/Documentation/devicetree/bindings/leds/ti,lm3601x.yaml b/Documentation/devicetree/bindings/leds/ti,lm3601x.yaml
new file mode 100644
index 0000000000000000000000000000000000000000..d7d8ee44d6fe37d13ee84888c5811df3e15a5d02
--- /dev/null
+++ b/Documentation/devicetree/bindings/leds/ti,lm3601x.yaml
@@ -0,0 +1,100 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/leds/ti,lm3601x.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Texas Instruments - lm3601x Single-LED Flash Driver
+
+description: |
+  The LM3601X are ultra-small LED flash drivers
+  that provide a high level of adjustability.
+
+  For more product information please see the links below:
+  https://www.ti.com/product/LM36010
+  https://www.ti.com/product/LM36011
+
+maintainers:
+  - Dan Murphy <dmurphy@ti.com>
+
+properties:
+  compatible:
+    enum:
+      - "ti,lm36010"
+      - "ti,lm36011"
+
+  reg:
+    maxItems: 1
+
+  '#address-cells':
+    const: 1
+
+  '#size-cells':
+    const: 0
+
+patternProperties:
+  "^led@[0,1]?([0-9]|[a-z])$":
+    type: object
+    $ref: common.yaml#
+    properties:
+      reg:
+        description: |
+          0 - Indicates IR mode
+          1 - Indicates Torch (white LED) mode
+        minimum: 0
+        maximum: 1
+
+      flash-max-microamp:
+        minimum: 11
+        maximum: 1500000
+
+      flash-max-timeout-us:
+        minimum: 40
+        maximum: 1600000
+
+      led-max-microamp:
+        minimum: 24
+        maximum: 376000
+
+    required:
+      - reg
+      - flash-max-microamp
+      - flash-max-timeout-us
+      - led-max-microamp
+
+    unevaluatedProperties: true
+
+required:
+  - compatible
+  - reg
+  - '#address-cells'
+  - '#size-cells'
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/leds/common.h>
+
+    i2c {
+        #address-cells = <1>;
+        #size-cells = <0>;
+
+        led-controller@64 {
+            compatible = "ti,lm36010";
+            #address-cells = <1>;
+            #size-cells = <0>;
+            reg = <0x64>;
+
+            led@1 {
+                reg = <1>;
+                function = LED_FUNCTION_TORCH;
+                color = <LED_COLOR_ID_WHITE>;
+                led-max-microamp = <376000>;
+                flash-max-microamp = <1500000>;
+                flash-max-timeout-us = <1600000>;
+            };
+        };
+    };
+...
+

-- 
2.51.0
Re: [PATCH 2/2] dt-bindings: leds: ti,lm3601x: Convert to DT Schema
Posted by Rob Herring 2 months, 1 week ago
On Thu, Oct 02, 2025 at 10:20:16AM +0100, Harrison Carter wrote:
> Converts the ti,lm36010 and ti,lm36011 txt to dt schema
> 
> Signed-off-by: Harrison Carter <hcarter@thegoodpenguin.co.uk>
> ---
>  .../devicetree/bindings/leds/leds-lm3601x.txt      |  51 -----------
>  .../devicetree/bindings/leds/ti,lm3601x.yaml       | 100 +++++++++++++++++++++
>  2 files changed, 100 insertions(+), 51 deletions(-)
> 
> diff --git a/Documentation/devicetree/bindings/leds/leds-lm3601x.txt b/Documentation/devicetree/bindings/leds/leds-lm3601x.txt
> deleted file mode 100644
> index 17e940025dc26213314f5cfd54aa8e5bb09f86b7..0000000000000000000000000000000000000000
> --- a/Documentation/devicetree/bindings/leds/leds-lm3601x.txt
> +++ /dev/null
> @@ -1,51 +0,0 @@
> -* Texas Instruments - lm3601x Single-LED Flash Driver
> -
> -The LM3601X are ultra-small LED flash drivers that
> -provide a high level of adjustability.
> -
> -Required properties:
> -	- compatible : Can be one of the following
> -		"ti,lm36010"
> -		"ti,lm36011"
> -	- reg : I2C slave address
> -	- #address-cells : 1
> -	- #size-cells : 0
> -
> -Required child properties:
> -	- reg : 0 - Indicates a IR mode
> -		1 - Indicates a Torch (white LED) mode
> -
> -Required properties for flash LED child nodes:
> -	See Documentation/devicetree/bindings/leds/common.txt
> -	- flash-max-microamp : Range from 11mA - 1.5A
> -	- flash-max-timeout-us : Range from 40ms - 1600ms
> -	- led-max-microamp : Range from 2.4mA - 376mA
> -
> -Optional child properties:
> -	- function : see Documentation/devicetree/bindings/leds/common.txt
> -	- color : see Documentation/devicetree/bindings/leds/common.txt
> -	- label : see Documentation/devicetree/bindings/leds/common.txt (deprecated)
> -
> -Example:
> -
> -#include <dt-bindings/leds/common.h>
> -
> -led-controller@64 {
> -	compatible = "ti,lm36010";
> -	#address-cells = <1>;
> -	#size-cells = <0>;
> -	reg = <0x64>;
> -
> -	led@0 {
> -		reg = <1>;
> -		function = LED_FUNCTION_TORCH;
> -		color = <LED_COLOR_ID_WHITE>;
> -		led-max-microamp = <376000>;
> -		flash-max-microamp = <1500000>;
> -		flash-max-timeout-us = <1600000>;
> -	};
> -}
> -
> -For more product information please see the links below:
> -https://www.ti.com/product/LM36010
> -https://www.ti.com/product/LM36011
> diff --git a/Documentation/devicetree/bindings/leds/ti,lm3601x.yaml b/Documentation/devicetree/bindings/leds/ti,lm3601x.yaml
> new file mode 100644
> index 0000000000000000000000000000000000000000..d7d8ee44d6fe37d13ee84888c5811df3e15a5d02
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/leds/ti,lm3601x.yaml
> @@ -0,0 +1,100 @@
> +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/leds/ti,lm3601x.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: Texas Instruments - lm3601x Single-LED Flash Driver
> +
> +description: |
> +  The LM3601X are ultra-small LED flash drivers
> +  that provide a high level of adjustability.
> +
> +  For more product information please see the links below:
> +  https://www.ti.com/product/LM36010
> +  https://www.ti.com/product/LM36011
> +
> +maintainers:
> +  - Dan Murphy <dmurphy@ti.com>
> +
> +properties:
> +  compatible:
> +    enum:
> +      - "ti,lm36010"
> +      - "ti,lm36011"

Don't need quotes.

> +
> +  reg:
> +    maxItems: 1
> +
> +  '#address-cells':
> +    const: 1
> +
> +  '#size-cells':
> +    const: 0
> +
> +patternProperties:
> +  "^led@[0,1]?([0-9]|[a-z])$":

'^led@[01]$'

> +    type: object
> +    $ref: common.yaml#
> +    properties:
> +      reg:
> +        description: |
> +          0 - Indicates IR mode
> +          1 - Indicates Torch (white LED) mode
> +        minimum: 0
> +        maximum: 1
> +
> +      flash-max-microamp:
> +        minimum: 11
> +        maximum: 1500000
> +
> +      flash-max-timeout-us:
> +        minimum: 40
> +        maximum: 1600000
> +
> +      led-max-microamp:
> +        minimum: 24
> +        maximum: 376000
> +
> +    required:
> +      - reg
> +      - flash-max-microamp
> +      - flash-max-timeout-us
> +      - led-max-microamp
> +
> +    unevaluatedProperties: true
> +
> +required:
> +  - compatible
> +  - reg
> +  - '#address-cells'
> +  - '#size-cells'
> +
> +additionalProperties: false
> +
> +examples:
> +  - |
> +    #include <dt-bindings/leds/common.h>
> +
> +    i2c {
> +        #address-cells = <1>;
> +        #size-cells = <0>;
> +
> +        led-controller@64 {
> +            compatible = "ti,lm36010";
> +            #address-cells = <1>;
> +            #size-cells = <0>;
> +            reg = <0x64>;
> +
> +            led@1 {
> +                reg = <1>;
> +                function = LED_FUNCTION_TORCH;
> +                color = <LED_COLOR_ID_WHITE>;
> +                led-max-microamp = <376000>;
> +                flash-max-microamp = <1500000>;
> +                flash-max-timeout-us = <1600000>;
> +            };
> +        };
> +    };
> +...
> +
> 
> -- 
> 2.51.0
>