[PATCH] dt-bindings: leds: Convert leds-lt3593.txt to yaml format

dongsheng liu posted 1 patch 2 days, 11 hours ago
.../devicetree/bindings/leds/leds-lt3593.txt  | 37 -----------
.../devicetree/bindings/leds/lltc,lt3593.yaml | 62 +++++++++++++++++++
2 files changed, 62 insertions(+), 37 deletions(-)
delete mode 100644 Documentation/devicetree/bindings/leds/leds-lt3593.txt
create mode 100644 Documentation/devicetree/bindings/leds/lltc,lt3593.yaml
[PATCH] dt-bindings: leds: Convert leds-lt3593.txt to yaml format
Posted by dongsheng liu 2 days, 11 hours ago
Convert binding doc leds-lt3593.txt to yaml format, so that nodes using
the "lltc,lt3593" compatible are no longer reported by dtbs_check as:

  failed to match any schema with compatible: ['lltc,lt3593']

Additional change:
- reference common.yaml for the LED sub-node properties.
- require the sub-node, matching the driver's check for exactly one child.

The schema was written with the help of an LLM coding assistant, based on
the previous binding text and drivers/leds/leds-lt3593.c. It is validated
with make dt_binding_check, and against the "lltc,lt3593" node in
arch/arm/boot/dts/intel/pxa/pxa300-raumfeld-controller.dts.

Assisted-by: LLM dtschema yamllint
Signed-off-by: dongsheng liu <2509730023@qq.com>
---
 .../devicetree/bindings/leds/leds-lt3593.txt  | 37 -----------
 .../devicetree/bindings/leds/lltc,lt3593.yaml | 62 +++++++++++++++++++
 2 files changed, 62 insertions(+), 37 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/leds/leds-lt3593.txt
 create mode 100644 Documentation/devicetree/bindings/leds/lltc,lt3593.yaml

diff --git a/Documentation/devicetree/bindings/leds/leds-lt3593.txt b/Documentation/devicetree/bindings/leds/leds-lt3593.txt
deleted file mode 100644
index 24eccda..0000000
--- a/Documentation/devicetree/bindings/leds/leds-lt3593.txt
+++ /dev/null
@@ -1,37 +0,0 @@
-Bindings for Linear Technologies LT3593 LED controller
-
-Required properties:
-- compatible:		Should be "lltc,lt3593".
-- lltc,ctrl-gpios:	A handle to the GPIO that is connected to the 'CTRL'
-			pin of the chip.
-
-The hardware supports only one LED. The properties of this LED are
-configured in a sub-node in the device node.
-
-Optional sub-node properties:
-- function:		See Documentation/devicetree/bindings/leds/common.txt
-- color:		See Documentation/devicetree/bindings/leds/common.txt
-- label:		A label for the LED. If none is given, the LED will be
-			named "lt3595::" (deprecated)
-- linux,default-trigger: The default trigger for the LED.
-			See Documentation/devicetree/bindings/leds/common.txt
-- default-state:	The initial state of the LED.
-			See Documentation/devicetree/bindings/leds/common.txt
-
-If multiple chips of this type are found in a design, each one needs to
-be handled by its own device node.
-
-Example:
-
-#include <dt-bindings/leds/common.h>
-
-led-controller {
-	compatible = "lltc,lt3593";
-	lltc,ctrl-gpios = <&gpio 0 GPIO_ACTIVE_HIGH>;
-
-	led {
-		function = LED_FUNCTION_BACKLIGHT;
-		color = <LED_COLOR_ID_WHITE>;
-		default-state = "on";
-	};
-};
diff --git a/Documentation/devicetree/bindings/leds/lltc,lt3593.yaml b/Documentation/devicetree/bindings/leds/lltc,lt3593.yaml
new file mode 100644
index 0000000..5c1801e
--- /dev/null
+++ b/Documentation/devicetree/bindings/leds/lltc,lt3593.yaml
@@ -0,0 +1,62 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/leds/lltc,lt3593.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Linear Technology LT3593 LED controller
+
+maintainers:
+  - Daniel Mack <daniel@zonque.org>
+
+description: |
+  The LT3593 is a step-up DC/DC converter designed to drive a single LED
+  string. Its output current is programmed by the number of pulses applied to
+  the CTRL pin, which also acts as the enable input.
+
+  The hardware supports only one LED. The properties of this LED are
+  configured in a sub-node in the device node. If multiple chips of this type
+  are found in a design, each one needs to be handled by its own device node.
+
+properties:
+  compatible:
+    const: lltc,lt3593
+
+  lltc,ctrl-gpios:
+    maxItems: 1
+    description:
+      A handle to the GPIO that is connected to the 'CTRL' pin of the chip.
+
+  led:
+    type: object
+    $ref: common.yaml#
+    unevaluatedProperties: false
+    description:
+      Properties of the LED driven by the controller.
+
+required:
+  - compatible
+  - lltc,ctrl-gpios
+  - led
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/gpio/gpio.h>
+    #include <dt-bindings/leds/common.h>
+
+    led-controller {
+        compatible = "lltc,lt3593";
+        pinctrl-names = "default";
+        pinctrl-0 = <&lt3593_pins>;
+        lltc,ctrl-gpios = <&gpio 17 GPIO_ACTIVE_HIGH>;
+
+        led {
+            function = LED_FUNCTION_BACKLIGHT;
+            color = <LED_COLOR_ID_WHITE>;
+            default-state = "on";
+        };
+    };
+
+...
-- 
2.43.0