[PATCH v2 01/11] dt-bindings: regulator: ti,pbias-regulator: Convert to DT schema

Thomas Richard posted 11 patches 6 days, 19 hours ago
[PATCH v2 01/11] dt-bindings: regulator: ti,pbias-regulator: Convert to DT schema
Posted by Thomas Richard 6 days, 19 hours ago
Convert PBIAS internal regulator binding to DT schema.

Signed-off-by: Thomas Richard <thomas.richard@bootlin.com>
---
 .../bindings/regulator/pbias-regulator.txt         |  32 ------
 .../bindings/regulator/ti,pbias-regulator.yaml     | 125 +++++++++++++++++++++
 MAINTAINERS                                        |   1 +
 3 files changed, 126 insertions(+), 32 deletions(-)

diff --git a/Documentation/devicetree/bindings/regulator/pbias-regulator.txt b/Documentation/devicetree/bindings/regulator/pbias-regulator.txt
deleted file mode 100644
index acbcb452a69a..000000000000
--- a/Documentation/devicetree/bindings/regulator/pbias-regulator.txt
+++ /dev/null
@@ -1,32 +0,0 @@
-PBIAS internal regulator for SD card dual voltage i/o pads on OMAP SoCs.
-
-Required properties:
-- compatible:
-  - should be "ti,pbias-dra7" for DRA7
-  - should be "ti,pbias-omap2" for OMAP2
-  - should be "ti,pbias-omap3" for OMAP3
-  - should be "ti,pbias-omap4" for OMAP4
-  - should be "ti,pbias-omap5" for OMAP5
-  - "ti,pbias-omap" is deprecated
-- reg: pbias register offset from syscon base and size of pbias register.
-- syscon : phandle of the system control module
-- regulator-name : should be
-			pbias_mmc_omap2430 for OMAP2430, OMAP3 SoCs
-			pbias_sim_omap3 for OMAP3 SoCs
-			pbias_mmc_omap4 for OMAP4 SoCs
-			pbias_mmc_omap5 for OMAP5 and DRA7 SoC
-
-Optional properties:
-- Any optional property defined in bindings/regulator/regulator.txt
-
-Example:
-
-		pbias_regulator: pbias_regulator {
-			compatible = "ti,pbias-omap";
-			reg = <0 0x4>;
-			syscon = <&omap5_padconf_global>;
-			pbias_mmc_reg: pbias_mmc_omap5 {
-				regulator-name = "pbias_mmc_omap5";
-				regulator-min-microvolt = <1800000>;
-				regulator-max-microvolt = <3000000>;
-			};
diff --git a/Documentation/devicetree/bindings/regulator/ti,pbias-regulator.yaml b/Documentation/devicetree/bindings/regulator/ti,pbias-regulator.yaml
new file mode 100644
index 000000000000..3e020d87701b
--- /dev/null
+++ b/Documentation/devicetree/bindings/regulator/ti,pbias-regulator.yaml
@@ -0,0 +1,125 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/regulator/ti,pbias-regulator.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: PBIAS internal regulator
+
+maintainers:
+  - Thomas Richard <thomas.richard@bootlin.com>
+
+description: |
+  PBIAS internal regulator for SD card dual voltage i/o pads on OMAP SoCs.
+
+properties:
+  compatible:
+    items:
+      - enum:
+          - ti,pbias-dra7
+          - ti,pbias-omap2
+          - ti,pbias-omap3
+          - ti,pbias-omap4
+          - ti,pbias-omap5
+      - const: ti,pbias-omap
+
+  reg:
+    maxItems: 1
+
+  syscon:
+    description: Phandle of the system control module
+    $ref: /schemas/types.yaml#/definitions/phandle
+
+patternProperties:
+  '^pbias_*':
+    type: object
+    $ref: regulator.yaml#
+    unevaluatedProperties: false
+
+required:
+  - compatible
+  - reg
+  - syscon
+
+additionalProperties: false
+
+allOf:
+  - if:
+      properties:
+        compatible:
+          contains:
+            enum:
+              - ti,pbias-omap2
+    then:
+      patternProperties:
+        '^pbias_*':
+          properties:
+            regulator-name:
+              contains:
+                enum:
+                  - pbias_mmc_omap2430
+
+  - if:
+      properties:
+        compatible:
+          contains:
+            enum:
+              - ti,pbias-omap3
+    then:
+      patternProperties:
+        '^pbias_*':
+          properties:
+            regulator-name:
+              contains:
+                enum:
+                  - pbias_mmc_omap2430
+                  - pbias_sim_omap3
+
+  - if:
+      properties:
+        compatible:
+          contains:
+            enum:
+              - ti,pbias-omap4
+    then:
+      patternProperties:
+        '^pbias_*':
+          properties:
+            regulator-name:
+              contains:
+                enum:
+                  - pbias_mmc_omap4
+
+  - if:
+      properties:
+        compatible:
+          contains:
+            enum:
+              - ti,pbias-dra7
+              - ti,pbias-omap5
+    then:
+      patternProperties:
+        '^pbias_*':
+          properties:
+            regulator-name:
+              contains:
+                enum:
+                  - pbias_mmc_omap5
+
+examples:
+  - |
+    bus {
+        #address-cells = <1>;
+        #size-cells = <1>;
+
+        pbias_regulator: pbias_regulator@0 {
+            compatible = "ti,pbias-omap5", "ti,pbias-omap";
+            reg = <0 0x4>;
+            syscon = <&omap5_padconf_global>;
+            pbias_mmc_reg: pbias_mmc_omap5 {
+                regulator-name = "pbias_mmc_omap5";
+                regulator-min-microvolt = <1800000>;
+                regulator-max-microvolt = <3000000>;
+            };
+        };
+    };
diff --git a/MAINTAINERS b/MAINTAINERS
index c3fe46d7c4bc..15052c0f5377 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -19406,6 +19406,7 @@ W:	http://linux.omap.com/
 Q:	http://patchwork.kernel.org/project/linux-omap/list/
 T:	git git://git.kernel.org/pub/scm/linux/kernel/git/tmlind/linux-omap.git
 F:	Documentation/devicetree/bindings/arm/ti/omap.yaml
+F:	Documentation/devicetree/bindings/regulator/ti,pbias-regulator.yaml
 F:	arch/arm/configs/omap2plus_defconfig
 F:	arch/arm/mach-omap2/
 F:	drivers/bus/omap*.[ch]

-- 
2.53.0
Re: [PATCH v2 01/11] dt-bindings: regulator: ti,pbias-regulator: Convert to DT schema
Posted by Krzysztof Kozlowski 6 days ago
On Mon, Mar 30, 2026 at 03:43:58PM +0200, Thomas Richard wrote:
> +$id: http://devicetree.org/schemas/regulator/ti,pbias-regulator.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: PBIAS internal regulator
> +
> +maintainers:
> +  - Thomas Richard <thomas.richard@bootlin.com>
> +
> +description: |

Do not need '|' unless you need to preserve formatting.

> +  PBIAS internal regulator for SD card dual voltage i/o pads on OMAP SoCs.
> +
> +properties:
> +  compatible:
> +    items:
> +      - enum:
> +          - ti,pbias-dra7
> +          - ti,pbias-omap2
> +          - ti,pbias-omap3
> +          - ti,pbias-omap4
> +          - ti,pbias-omap5
> +      - const: ti,pbias-omap
> +
> +  reg:
> +    maxItems: 1
> +
> +  syscon:
> +    description: Phandle of the system control module
> +    $ref: /schemas/types.yaml#/definitions/phandle
> +
> +patternProperties:
> +  '^pbias_*':

That wasn't in old binding and underscore is not allowed, so this needs
explanation. Old binding mentioned only the names.


> +    type: object
> +    $ref: regulator.yaml#
> +    unevaluatedProperties: false
> +
> +required:
> +  - compatible
> +  - reg
> +  - syscon
> +
> +additionalProperties: false
> +
> +allOf:
> +  - if:
> +      properties:
> +        compatible:
> +          contains:
> +            enum:
> +              - ti,pbias-omap2
> +    then:
> +      patternProperties:
> +        '^pbias_*':
> +          properties:
> +            regulator-name:
> +              contains:
> +                enum:
> +                  - pbias_mmc_omap2430
> +
> +  - if:
> +      properties:
> +        compatible:
> +          contains:
> +            enum:
> +              - ti,pbias-omap3
> +    then:
> +      patternProperties:
> +        '^pbias_*':
> +          properties:
> +            regulator-name:
> +              contains:
> +                enum:
> +                  - pbias_mmc_omap2430
> +                  - pbias_sim_omap3
> +
> +  - if:
> +      properties:
> +        compatible:
> +          contains:
> +            enum:
> +              - ti,pbias-omap4
> +    then:
> +      patternProperties:
> +        '^pbias_*':
> +          properties:
> +            regulator-name:
> +              contains:
> +                enum:
> +                  - pbias_mmc_omap4
> +
> +  - if:
> +      properties:
> +        compatible:
> +          contains:
> +            enum:
> +              - ti,pbias-dra7
> +              - ti,pbias-omap5
> +    then:
> +      patternProperties:
> +        '^pbias_*':
> +          properties:
> +            regulator-name:
> +              contains:
> +                enum:
> +                  - pbias_mmc_omap5
> +
> +examples:
> +  - |
> +    bus {
> +        #address-cells = <1>;
> +        #size-cells = <1>;
> +
> +        pbias_regulator: pbias_regulator@0 {

Drop unused labels

Best regards,
Krzysztof