[PATCH] regulator: dt-bindings: ti,lp872x: Convert to DT schema

Bhargav Joshi <[email protected]>
Newsgroups org.kernel.vger.linux-devicetree,org.kernel.vger.linux-kernel
Message-ID <[email protected]>
Convert the TI/National Semiconductor LP8720/LP8725 PMIC text binding
to standard DT schema. No functional changes.

Signed-off-by: Bhargav Joshi <[email protected]>
---
 .../devicetree/bindings/regulator/lp872x.txt       | 161 ------------------
 .../devicetree/bindings/regulator/ti,lp872x.yaml   | 186 +++++++++++++++++++++
 2 files changed, 186 insertions(+), 161 deletions(-)

diff --git a/Documentation/devicetree/bindings/regulator/lp872x.txt b/Documentation/devicetree/bindings/regulator/lp872x.txt
deleted file mode 100644
index ab895cd1cac1..000000000000
--- a/Documentation/devicetree/bindings/regulator/lp872x.txt
+++ /dev/null
@@ -1,161 +0,0 @@
-Binding for TI/National Semiconductor LP872x Driver
-
-Required properties:
-  - compatible: "ti,lp8720" or "ti,lp8725"
-  - reg: I2C slave address. 0x7d = LP8720, 0x7a = LP8725
-
-Optional properties:
-  - ti,general-config: the value of LP872X_GENERAL_CFG register (u8)
-    (LP8720)
-    bit[2]: BUCK output voltage control by external DVS pin or register
-            1 = external pin, 0 = bit7 of register 08h
-    bit[1]: sleep control by external DVS pin or register
-            1 = external pin, 0 = bit6 of register 08h
-    bit[0]: time step unit(usec). 1 = 25, 0 = 50
-
-    (LP8725)
-    bit[7:6]: time step unit(usec). 00 = 32, 01 = 64, 10 = 128, 11 = 256
-    bit[4]:   BUCK2 enable control. 1 = enable, 0 = disable
-    bit[3]:   BUCK2 output voltage register address. 1 = 0Ah, 0 = 0Bh
-    bit[2]:   BUCK1 output voltage control by external DVS pin or register
-              1 = register 08h, 0 = DVS
-    bit[1]:   LDO sleep control. 1 = sleep mode, 0 = normal
-    bit[0]:   BUCK1 enable control, 1 = enable, 0 = disable
-
-    For more details, please see the datasheet.
-
-  - ti,update-config: define it when LP872X_GENERAL_CFG register should be set
-  - ti,dvs-gpio: GPIO specifier for external DVS pin control of LP872x devices.
-  - ti,dvs-vsel: DVS selector. 0 = SEL_V1, 1 = SEL_V2.
-  - ti,dvs-state: initial DVS pin state. 0 = DVS_LOW, 1 = DVS_HIGH.
-  - enable-gpios: GPIO specifier for EN pin control of LP872x devices.
-
-  Sub nodes for regulator_init_data
-    LP8720 has maximum 6 nodes. (child name: ldo1 ~ 5 and buck)
-    LP8725 has maximum 9 nodes. (child name: ldo1 ~ 5, lilo1,2 and buck1,2)
-    For more details, please see the following binding document.
-    (Documentation/devicetree/bindings/regulator/regulator.txt)
-
-Datasheet
-  - LP8720: https://www.ti.com/lit/ds/symlink/lp8720.pdf
-  - LP8725: https://www.ti.com/lit/ds/symlink/lp8725.pdf
-
-Example 1) LP8720
-
-lp8720@7d {
-	compatible = "ti,lp8720";
-	reg = <0x7d>;
-
-	/* external DVS pin used, timestep is 25usec */
-	ti,general-config = /bits/ 8 <0x03>;
-	ti,update-config;
-
-	/*
-	 * The dvs-gpio depends on the processor environment.
-	 * For example, following GPIO specifier means GPIO134 in OMAP4.
-	 */
-	ti,dvs-gpio = <&gpio5 6 0>;
-	ti,dvs-vsel = /bits/ 8 <1>;		/* SEL_V2 */
-	ti,dvs-state = /bits/ 8 <1>;		/* DVS_HIGH */
-
-	vaf: ldo1 {
-		regulator-min-microvolt = <1200000>;
-		regulator-max-microvolt = <3300000>;
-	};
-
-	vmmc: ldo2 {
-		regulator-min-microvolt = <1200000>;
-		regulator-max-microvolt = <3300000>;
-	};
-
-	vcam_io: ldo3 {
-		regulator-min-microvolt = <1200000>;
-		regulator-max-microvolt = <3300000>;
-		regulator-boot-on;
-	};
-
-	vcam_core: ldo4 {
-		regulator-min-microvolt = <800000>;
-		regulator-max-microvolt = <2850000>;
-		regulator-boot-on;
-	};
-
-	vcam: ldo5 {
-		regulator-min-microvolt = <1200000>;
-		regulator-max-microvolt = <3300000>;
-	};
-
-	vcc: buck {
-		regulator-name = "VBUCK";
-		regulator-min-microvolt = <800000>;
-		regulator-max-microvolt = <2300000>;
-	};
-};
-
-Example 2) LP8725
-
-lp8725@7a {
-	compatible = "ti,lp8725";
-	reg = <0x7a>;
-
-	/* Enable BUCK1,2, no DVS, normal LDO mode, timestep is 256usec */
-	ti,general-config = /bits/ 8 <0xdd>;
-	ti,update-config;
-
-	vcam_io: ldo1 {
-		regulator-min-microvolt = <1200000>;
-		regulator-max-microvolt = <3300000>;
-	};
-
-	vcam_core: ldo2 {
-		regulator-min-microvolt = <1200000>;
-		regulator-max-microvolt = <3300000>;
-	};
-
-	vcam: ldo3 {
-		regulator-min-microvolt = <1200000>;
-		regulator-max-microvolt = <3300000>;
-	};
-
-	vcmmb_io: ldo4 {
-		regulator-min-microvolt = <1200000>;
-		regulator-max-microvolt = <3300000>;
-		regulator-boot-on;
-	};
-
-	vcmmb_core: ldo5 {
-		regulator-min-microvolt = <1200000>;
-		regulator-max-microvolt = <3300000>;
-		regulator-boot-on;
-	};
-
-	vaux1: lilo1 {
-		regulator-name = "VAUX1";
-		regulator-min-microvolt = <800000>;
-		regulator-max-microvolt = <3300000>;
-	};
-
-	vaux2: lilo2 {
-		regulator-name = "VAUX2";
-		regulator-min-microvolt = <800000>;
-		regulator-max-microvolt = <3300000>;
-	};
-
-	vcc1: buck1 {
-		regulator-name = "VBUCK1";
-		regulator-min-microvolt = <800000>;
-		regulator-max-microvolt = <3000000>;
-		regulator-min-microamp  = <460000>;
-		regulator-max-microamp  = <1370000>;
-		regulator-boot-on;
-	};
-
-	vcc2: buck2 {
-		regulator-name = "VBUCK2";
-		regulator-min-microvolt = <800000>;
-		regulator-max-microvolt = <3000000>;
-		regulator-min-microamp  = <460000>;
-		regulator-max-microamp  = <1370000>;
-		regulator-boot-on;
-	};
-};
diff --git a/Documentation/devicetree/bindings/regulator/ti,lp872x.yaml b/Documentation/devicetree/bindings/regulator/ti,lp872x.yaml
new file mode 100644
index 000000000000..8e74dbb3ae30
--- /dev/null
+++ b/Documentation/devicetree/bindings/regulator/ti,lp872x.yaml
@@ -0,0 +1,186 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/regulator/ti,lp872x.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: TI/National Semiconductor LP872x
+
+maintainers:
+  - Milo Kim <[email protected]>
+
+description:
+  See Datasheet
+  LP8720 https://www.ti.com/lit/ds/symlink/lp8720.pdf
+  LP8725 https://www.ti.com/lit/ds/symlink/lp8725.pdf
+
+properties:
+  compatible:
+    enum:
+      - ti,lp8720
+      - ti,lp8725
+
+  reg:
+    enum: [0x7a, 0x7d]
+
+  ti,general-config:
+    $ref: /schemas/types.yaml#/definitions/uint8
+    description: |
+      the value of LP872X_GENERAL_CFG register (u8)
+      (LP8720)
+      bit[2]: BUCK output voltage control by external DVS pin or register
+              1 = external pin, 0 = bit7 of register 08h
+      bit[1]: sleep control by external DVS pin or register
+              1 = external pin, 0 = bit6 of register 08h
+      bit[0]: time step unit(usec). 1 = 25, 0 = 50
+
+      (LP8725)
+      bit[7:6]: time step unit(usec). 00 = 32, 01 = 64, 10 = 128, 11 = 256
+      bit[4]:   BUCK2 enable control. 1 = enable, 0 = disable
+      bit[3]:   BUCK2 output voltage register address. 1 = 0Ah, 0 = 0Bh
+      bit[2]:   BUCK1 output voltage control by external DVS pin or register
+                1 = register 08h, 0 = DVS
+      bit[1]:   LDO sleep control. 1 = sleep mode, 0 = normal
+      bit[0]:   BUCK1 enable control, 1 = enable, 0 = disable
+
+      For more details, please see the datasheet.
+
+  ti,update-config:
+    type: boolean
+    description: define it when LP872X_GENERAL_CFG register should be set
+
+  ti,dvs-gpio:
+    maxItems: 1
+    description: GPIO specifier for external DVS pin control of LP872x devices.
+
+  ti,dvs-vsel:
+    $ref: /schemas/types.yaml#/definitions/uint8
+    enum: [0, 1]
+    description: DVS selector. 0 = SEL_V1, 1 = SEL_V2.
+
+  ti,dvs-state:
+    $ref: /schemas/types.yaml#/definitions/uint8
+    enum: [0, 1]
+    description: initial DVS pin state. 0 = DVS_LOW, 1 = DVS_HIGH.
+
+  enable-gpios:
+    maxItems: 1
+    description: GPIO specifier for EN pin control of LP872x devices.
+
+  buck:
+    type: object
+    $ref: regulator.yaml#
+    unevaluatedProperties: false
+    description:
+      Single BUCK regulator for LP8720.
+
+patternProperties:
+  "^(buck[1-2]?|ldo[1-5]|lilo[1-2])$":
+    type: object
+    $ref: regulator.yaml#
+    unevaluatedProperties: false
+
+required:
+  - compatible
+  - reg
+
+allOf:
+  - if:
+      properties:
+        compatible:
+          contains:
+            const: ti,lp8720
+    then:
+      properties:
+        reg:
+          const: 0x7d
+      patternProperties:
+        "^(buck[1-2]|lilo[1-2])$": false
+
+  - if:
+      properties:
+        compatible:
+          contains:
+            const: ti,lp8725
+    then:
+      properties:
+        reg:
+          const: 0x7a
+        buck: false
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/gpio/gpio.h>
+
+    i2c {
+        #address-cells = <1>;
+        #size-cells = <0>;
+
+        pmic@7a {
+            compatible = "ti,lp8725";
+            reg = <0x7a>;
+
+            /* Enable BUCK1,2, no DVS, normal LDO mode, timestep is 256usec */
+            ti,general-config = /bits/ 8 <0xdd>;
+            ti,update-config;
+
+            ldo1 {
+                regulator-min-microvolt = <1200000>;
+                regulator-max-microvolt = <3300000>;
+            };
+
+            ldo2 {
+                regulator-min-microvolt = <1200000>;
+                regulator-max-microvolt = <3300000>;
+            };
+
+            ldo3 {
+                regulator-min-microvolt = <1200000>;
+                regulator-max-microvolt = <3300000>;
+            };
+
+            ldo4 {
+                regulator-min-microvolt = <1200000>;
+                regulator-max-microvolt = <3300000>;
+                regulator-boot-on;
+            };
+
+            ldo5 {
+                regulator-min-microvolt = <1200000>;
+                regulator-max-microvolt = <3300000>;
+                regulator-boot-on;
+            };
+
+            lilo1 {
+                regulator-name = "VAUX1";
+                regulator-min-microvolt = <800000>;
+                regulator-max-microvolt = <3300000>;
+            };
+
+            lilo2 {
+                regulator-name = "VAUX2";
+                regulator-min-microvolt = <800000>;
+                regulator-max-microvolt = <3300000>;
+            };
+
+            buck1 {
+                regulator-name = "VBUCK1";
+                regulator-min-microvolt = <800000>;
+                regulator-max-microvolt = <3000000>;
+                regulator-min-microamp  = <460000>;
+                regulator-max-microamp  = <1370000>;
+                regulator-boot-on;
+            };
+
+            buck2 {
+                regulator-name = "VBUCK2";
+                regulator-min-microvolt = <800000>;
+                regulator-max-microvolt = <3000000>;
+                regulator-min-microamp  = <460000>;
+                regulator-max-microamp  = <1370000>;
+                regulator-boot-on;
+            };
+        };
+    };

---
base-commit: 818bebeb63dd6bf5f4e07e145f6cdbace520a34c
change-id: 20260822-ti-lp872x-a884bead9b0d

Best regards,
--  
Bhargav
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.