diff mbox series

dt-bindings: leds: Convert PCA9532 to dtschema

Message ID 20221228140449.938513-1-w.egorov@phytec.de
State Accepted
Commit 9f6ffd0da650f6ed264e124a3d6bb4e11a49f9f1
Headers show
Series dt-bindings: leds: Convert PCA9532 to dtschema | expand

Commit Message

Wadim Egorov Dec. 28, 2022, 2:04 p.m. UTC
Convert the PCA9532 LED dimmer to dtschema.
While at it, also update and the the example to match
recommended node names and the link to the product datasheet.

Signed-off-by: Wadim Egorov <w.egorov@phytec.de>
---
 .../devicetree/bindings/leds/leds-pca9532.txt | 49 -----------
 .../bindings/leds/leds-pca9532.yaml           | 86 +++++++++++++++++++
 2 files changed, 86 insertions(+), 49 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/leds/leds-pca9532.txt
 create mode 100644 Documentation/devicetree/bindings/leds/leds-pca9532.yaml

Comments

Jacek Anaszewski Dec. 29, 2022, 1:54 p.m. UTC | #1
Hi Wadim,

On 12/28/22 15:04, Wadim Egorov wrote:
> Convert the PCA9532 LED dimmer to dtschema.
> While at it, also update and the the example to match
> recommended node names and the link to the product datasheet.
> 
> Signed-off-by: Wadim Egorov <w.egorov@phytec.de>
> ---
>   .../devicetree/bindings/leds/leds-pca9532.txt | 49 -----------
>   .../bindings/leds/leds-pca9532.yaml           | 86 +++++++++++++++++++
>   2 files changed, 86 insertions(+), 49 deletions(-)
>   delete mode 100644 Documentation/devicetree/bindings/leds/leds-pca9532.txt
>   create mode 100644 Documentation/devicetree/bindings/leds/leds-pca9532.yaml
> 
> diff --git a/Documentation/devicetree/bindings/leds/leds-pca9532.txt b/Documentation/devicetree/bindings/leds/leds-pca9532.txt
> deleted file mode 100644
> index f769c52e3643..000000000000
> --- a/Documentation/devicetree/bindings/leds/leds-pca9532.txt
> +++ /dev/null
> @@ -1,49 +0,0 @@
> -*NXP - pca9532 PWM LED Driver
> -
> -The PCA9532 family is SMBus I/O expander optimized for dimming LEDs.
> -The PWM support 256 steps.
> -
> -Required properties:
> -	- compatible:
> -		"nxp,pca9530"
> -		"nxp,pca9531"
> -		"nxp,pca9532"
> -		"nxp,pca9533"
> -	- reg -  I2C slave address
> -
> -Each led is represented as a sub-node of the nxp,pca9530.
> -
> -Optional sub-node properties:
> -	- label: see Documentation/devicetree/bindings/leds/common.txt
> -	- type: Output configuration, see dt-bindings/leds/leds-pca9532.h (default NONE)
> -	- linux,default-trigger: see Documentation/devicetree/bindings/leds/common.txt
> -	- default-state: see Documentation/devicetree/bindings/leds/common.txt
> -	  This property is only valid for sub-nodes of type <PCA9532_TYPE_LED>.
> -
> -Example:
> -  #include <dt-bindings/leds/leds-pca9532.h>
> -
> -  leds: pca9530@60 {
> -    compatible = "nxp,pca9530";
> -    reg = <0x60>;
> -
> -    red-power {
> -      label = "pca:red:power";
> -      type = <PCA9532_TYPE_LED>;
> -    };
> -    green-power {
> -      label = "pca:green:power";
> -      type = <PCA9532_TYPE_LED>;
> -    };
> -    kernel-booting {
> -      type = <PCA9532_TYPE_LED>;
> -      default-state = "on";
> -    };
> -    sys-stat {
> -      type = <PCA9532_TYPE_LED>;
> -      default-state = "keep"; // don't touch, was set by U-Boot
> -    };
> -  };
> -
> -For more product information please see the link below:
> -http://nxp.com/documents/data_sheet/PCA9532.pdf
> diff --git a/Documentation/devicetree/bindings/leds/leds-pca9532.yaml b/Documentation/devicetree/bindings/leds/leds-pca9532.yaml
> new file mode 100644
> index 000000000000..e3741b5046b7
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/leds/leds-pca9532.yaml
> @@ -0,0 +1,86 @@
> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/leds/leds-pca9532.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: NXP - pca9532 PWM LED Driver
> +
> +maintainers:
> +  - Jacek Anaszewski <jacek.anaszewski@gmail.com>

Please remove myself, since I am not longer an LED subsystem maintainer.

> +  - Pavel Machek <pavel@ucw.cz>
> +
> +description: |
> +  The PCA9532 family is SMBus I/O expander optimized for dimming LEDs.
> +  The PWM support 256 steps.
> +
> +  For more product information please see the link below:
> +    https://www.nxp.com/docs/en/data-sheet/PCA9532.pdf
> +
> +properties:
> +  compatible:
> +    enum:
> +      - nxp,pca9530
> +      - nxp,pca9531
> +      - nxp,pca9532
> +      - nxp,pca9533
> +
> +  reg:
> +    maxItems: 1
> +    description: I2C slave address
> +
> +patternProperties:
> +  "^led-[0-9a-z]+$":
> +    type: object
> +    $ref: common.yaml#
> +    properties:
> +      type:
> +        description: |
> +          Output configuration, see dt-bindings/leds/leds-pca9532.h
> +          Default is 0, PCA9532_TYPE_NONE.
> +        $ref: /schemas/types.yaml#/definitions/uint32
> +        minimum: 0
> +        maximum: 4
> +
> +required:
> +  - compatible
> +  - reg
> +
> +additionalProperties: false
> +
> +examples:
> +  - |
> +    #include <dt-bindings/leds/leds-pca9532.h>
> +
> +    i2c {
> +        led-controller@62 {
> +                compatible = "nxp,pca9533";
> +                reg = <0x62>;
> +
> +                led-1 {
> +                        label = "user1";

You should leave label unchanged, since this patch claims that it only
converts the file format. And anyway, the driver does not use
led_classdev_register_ext(), so it won't parse 'color' property
automatically.

> +                        type = <PCA9532_TYPE_LED>;
> +                        color = <LED_COLOR_ID_RED>;
> +                };
> +
> +                led-2 {
> +                        label = "user2";
> +                        type = <PCA9532_TYPE_LED>;
> +                        color = <LED_COLOR_ID_GREEN>;
> +                };
> +
> +                led-3 {
> +                        label = "user3";
> +                        type = <PCA9532_TYPE_LED>;
> +                        color = <LED_COLOR_ID_BLUE>;
> +                };
> +
> +                led-4 {
> +                        label = "user4";
> +                        type = <PCA9532_TYPE_LED>;
> +                        color = <LED_COLOR_ID_RED>;
> +                };
> +        };
> +    };
> +
> +...
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/leds/leds-pca9532.txt b/Documentation/devicetree/bindings/leds/leds-pca9532.txt
deleted file mode 100644
index f769c52e3643..000000000000
--- a/Documentation/devicetree/bindings/leds/leds-pca9532.txt
+++ /dev/null
@@ -1,49 +0,0 @@ 
-*NXP - pca9532 PWM LED Driver
-
-The PCA9532 family is SMBus I/O expander optimized for dimming LEDs.
-The PWM support 256 steps.
-
-Required properties:
-	- compatible:
-		"nxp,pca9530"
-		"nxp,pca9531"
-		"nxp,pca9532"
-		"nxp,pca9533"
-	- reg -  I2C slave address
-
-Each led is represented as a sub-node of the nxp,pca9530.
-
-Optional sub-node properties:
-	- label: see Documentation/devicetree/bindings/leds/common.txt
-	- type: Output configuration, see dt-bindings/leds/leds-pca9532.h (default NONE)
-	- linux,default-trigger: see Documentation/devicetree/bindings/leds/common.txt
-	- default-state: see Documentation/devicetree/bindings/leds/common.txt
-	  This property is only valid for sub-nodes of type <PCA9532_TYPE_LED>.
-
-Example:
-  #include <dt-bindings/leds/leds-pca9532.h>
-
-  leds: pca9530@60 {
-    compatible = "nxp,pca9530";
-    reg = <0x60>;
-
-    red-power {
-      label = "pca:red:power";
-      type = <PCA9532_TYPE_LED>;
-    };
-    green-power {
-      label = "pca:green:power";
-      type = <PCA9532_TYPE_LED>;
-    };
-    kernel-booting {
-      type = <PCA9532_TYPE_LED>;
-      default-state = "on";
-    };
-    sys-stat {
-      type = <PCA9532_TYPE_LED>;
-      default-state = "keep"; // don't touch, was set by U-Boot
-    };
-  };
-
-For more product information please see the link below:
-http://nxp.com/documents/data_sheet/PCA9532.pdf
diff --git a/Documentation/devicetree/bindings/leds/leds-pca9532.yaml b/Documentation/devicetree/bindings/leds/leds-pca9532.yaml
new file mode 100644
index 000000000000..e3741b5046b7
--- /dev/null
+++ b/Documentation/devicetree/bindings/leds/leds-pca9532.yaml
@@ -0,0 +1,86 @@ 
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/leds/leds-pca9532.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: NXP - pca9532 PWM LED Driver
+
+maintainers:
+  - Jacek Anaszewski <jacek.anaszewski@gmail.com>
+  - Pavel Machek <pavel@ucw.cz>
+
+description: |
+  The PCA9532 family is SMBus I/O expander optimized for dimming LEDs.
+  The PWM support 256 steps.
+
+  For more product information please see the link below:
+    https://www.nxp.com/docs/en/data-sheet/PCA9532.pdf
+
+properties:
+  compatible:
+    enum:
+      - nxp,pca9530
+      - nxp,pca9531
+      - nxp,pca9532
+      - nxp,pca9533
+
+  reg:
+    maxItems: 1
+    description: I2C slave address
+
+patternProperties:
+  "^led-[0-9a-z]+$":
+    type: object
+    $ref: common.yaml#
+    properties:
+      type:
+        description: |
+          Output configuration, see dt-bindings/leds/leds-pca9532.h
+          Default is 0, PCA9532_TYPE_NONE.
+        $ref: /schemas/types.yaml#/definitions/uint32
+        minimum: 0
+        maximum: 4
+
+required:
+  - compatible
+  - reg
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/leds/leds-pca9532.h>
+
+    i2c {
+        led-controller@62 {
+                compatible = "nxp,pca9533";
+                reg = <0x62>;
+
+                led-1 {
+                        label = "user1";
+                        type = <PCA9532_TYPE_LED>;
+                        color = <LED_COLOR_ID_RED>;
+                };
+
+                led-2 {
+                        label = "user2";
+                        type = <PCA9532_TYPE_LED>;
+                        color = <LED_COLOR_ID_GREEN>;
+                };
+
+                led-3 {
+                        label = "user3";
+                        type = <PCA9532_TYPE_LED>;
+                        color = <LED_COLOR_ID_BLUE>;
+                };
+
+                led-4 {
+                        label = "user4";
+                        type = <PCA9532_TYPE_LED>;
+                        color = <LED_COLOR_ID_RED>;
+                };
+        };
+    };
+
+...