Skip to contentSkip to conversation

dt-bindings: regulator: microchip,mcp16502: convert to YAML

PATCH Superseded Andrei Simion 2 participants 2 messages Jan 23, 2024

Subsystems (3)

v1 of 4 Superseded Latest is v4 →

lore
Share & tools
lore

Andrei Simion

author maintainer
#0 lore raw

PATCH 1/1 dt-bindings: regulator: microchip,mcp16502: convert to YAML

Convert devicetree binding mcp16502-regulator.txt to YAML format.

---
 .../bindings/regulator/mcp16502-regulator.txt | 144 --------------
 .../regulator/microchip,mcp16502.yaml         | 182 ++++++++++++++++++
 2 files changed, 182 insertions(+), 144 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/regulator/mcp16502-regulator.txt
 create mode 100644 Documentation/devicetree/bindings/regulator/microchip,mcp16502.yaml
Documentation/devicetree/bindings/regulator/mcp16502-regulator.txt deleted +0 -144
deleted file mode 100644
index 451cc4e86b01..000000000000
@@ -1,144 +0,0 @@
-MCP16502 PMIC
-
-Required properties:
-- compatible: "microchip,mcp16502"
-- reg: I2C slave address
-- lpm-gpios: GPIO for LPM pin. Note that this GPIO *must* remain high during
-	     suspend-to-ram, keeping the PMIC into HIBERNATE mode; this
-	     property is optional;
-- regulators: A node that houses a sub-node for each regulator within
-              the device. Each sub-node is identified using the node's
-              name. The content of each sub-node is defined by the
-              standard binding for regulators; see regulator.txt.
-
-Regulators of MCP16502 PMIC:
-1) VDD_IO	- Buck (1.2 - 3.7 V)
-2) VDD_DDR	- Buck (0.6 - 1.85 V)
-3) VDD_CORE	- Buck (0.6 - 1.85 V)
-4) VDD_OTHER	- BUCK (0.6 - 1.85 V)
-5) LDO1		- LDO  (1.2 - 3.7 V)
-6) LDO2		- LDO  (1.2 - 3.7 V)
-
-Regulator modes:
-2 - FPWM: higher precision, higher consumption
-4 - AutoPFM: lower precision, lower consumption
-
-Each regulator is defined using the standard binding for regulators.
-
-Example:
-
-mcp16502@5b {
-	compatible = "microchip,mcp16502";
-	reg = <0x5b>;
-	status = "okay";
-	lpm-gpios = <&pioBU 7 GPIO_ACTIVE_HIGH>;
-
-	regulators {
-		VDD_IO {
-			regulator-name = "VDD_IO";
-			regulator-min-microvolt = <1200000>;
-			regulator-max-microvolt = <3700000>;
-			regulator-initial-mode = <2>;
-			regulator-allowed-modes = <2>, <4>;
-			regulator-always-on;
-
-			regulator-state-standby {
-				regulator-on-in-suspend;
-				regulator-mode = <4>;
-			};
-
-			regulator-state-mem {
-				regulator-off-in-suspend;
-				regulator-mode = <4>;
-			};
-		};
-
-		VDD_DDR {
-			regulator-name = "VDD_DDR";
-			regulator-min-microvolt = <600000>;
-			regulator-max-microvolt = <1850000>;
-			regulator-initial-mode = <2>;
-			regulator-allowed-modes = <2>, <4>;
-			regulator-always-on;
-
-			regulator-state-standby {
-				regulator-on-in-suspend;
-				regulator-mode = <4>;
-			};
-
-			regulator-state-mem {
-				regulator-on-in-suspend;
-				regulator-mode = <4>;
-			};
-		};
-
-		VDD_CORE {
-			regulator-name = "VDD_CORE";
-			regulator-min-microvolt = <600000>;
-			regulator-max-microvolt = <1850000>;
-			regulator-initial-mode = <2>;
-			regulator-allowed-modes = <2>, <4>;
-			regulator-always-on;
-
-			regulator-state-standby {
-				regulator-on-in-suspend;
-				regulator-mode = <4>;
-			};
-
-			regulator-state-mem {
-				regulator-off-in-suspend;
-				regulator-mode = <4>;
-			};
-		};
-
-		VDD_OTHER {
-			regulator-name = "VDD_OTHER";
-			regulator-min-microvolt = <600000>;
-			regulator-max-microvolt = <1850000>;
-			regulator-initial-mode = <2>;
-			regulator-allowed-modes = <2>, <4>;
-			regulator-always-on;
-
-			regulator-state-standby {
-				regulator-on-in-suspend;
-				regulator-mode = <4>;
-			};
-
-			regulator-state-mem {
-				regulator-off-in-suspend;
-				regulator-mode = <4>;
-			};
-		};
-
-		LDO1 {
-			regulator-name = "LDO1";
-			regulator-min-microvolt = <1200000>;
-			regulator-max-microvolt = <3700000>;
-			regulator-always-on;
-
-			regulator-state-standby {
-				regulator-on-in-suspend;
-			};
-
-			regulator-state-mem {
-				regulator-off-in-suspend;
-			};
-		};
-
-		LDO2 {
-			regulator-name = "LDO2";
-			regulator-min-microvolt = <1200000>;
-			regulator-max-microvolt = <3700000>;
-			regulator-always-on;
-
-			regulator-state-standby {
-				regulator-on-in-suspend;
-			};
-
-			regulator-state-mem {
-				regulator-off-in-suspend;
-			};
-		};
-
-	};
-};
Documentation/devicetree/bindings/regulator/microchip,mcp16502.yaml new file +182 -0

182 lines not on this page · raw message

Signature · 1 line
2.34.1
#1 lore raw
Quoted 3 lines · Andrei Simion

Convert devicetree binding mcp16502-regulator.txt to YAML format.

Reverse subject prefixes. See: git log --oneline -- DIRECTORY_OR_FILE on the directory your patch is touching.

Quoted 165 lines
---
 .../bindings/regulator/mcp16502-regulator.txt | 144 --------------
 .../regulator/microchip,mcp16502.yaml         | 182 ++++++++++++++++++
 2 files changed, 182 insertions(+), 144 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/regulator/mcp16502-regulator.txt
 create mode 100644 Documentation/devicetree/bindings/regulator/microchip,mcp16502.yaml
Documentation/devicetree/bindings/regulator/mcp16502-regulator.txt deleted +0 -144
deleted file mode 100644
index 451cc4e86b01..000000000000
@@ -1,144 +0,0 @@
-MCP16502 PMIC
-
-Required properties:
-- compatible: "microchip,mcp16502"
-- reg: I2C slave address
-- lpm-gpios: GPIO for LPM pin. Note that this GPIO *must* remain high during
-	     suspend-to-ram, keeping the PMIC into HIBERNATE mode; this
-	     property is optional;
-- regulators: A node that houses a sub-node for each regulator within
-              the device. Each sub-node is identified using the node's
-              name. The content of each sub-node is defined by the
-              standard binding for regulators; see regulator.txt.
-
-Regulators of MCP16502 PMIC:
-1) VDD_IO	- Buck (1.2 - 3.7 V)
-2) VDD_DDR	- Buck (0.6 - 1.85 V)
-3) VDD_CORE	- Buck (0.6 - 1.85 V)
-4) VDD_OTHER	- BUCK (0.6 - 1.85 V)
-5) LDO1		- LDO  (1.2 - 3.7 V)
-6) LDO2		- LDO  (1.2 - 3.7 V)
-
-Regulator modes:
-2 - FPWM: higher precision, higher consumption
-4 - AutoPFM: lower precision, lower consumption
-
-Each regulator is defined using the standard binding for regulators.
-
-Example:
-
-mcp16502@5b {
-	compatible = "microchip,mcp16502";
-	reg = <0x5b>;
-	status = "okay";
-	lpm-gpios = <&pioBU 7 GPIO_ACTIVE_HIGH>;
-
-	regulators {
-		VDD_IO {
-			regulator-name = "VDD_IO";
-			regulator-min-microvolt = <1200000>;
-			regulator-max-microvolt = <3700000>;
-			regulator-initial-mode = <2>;
-			regulator-allowed-modes = <2>, <4>;
-			regulator-always-on;
-
-			regulator-state-standby {
-				regulator-on-in-suspend;
-				regulator-mode = <4>;
-			};
-
-			regulator-state-mem {
-				regulator-off-in-suspend;
-				regulator-mode = <4>;
-			};
-		};
-
-		VDD_DDR {
-			regulator-name = "VDD_DDR";
-			regulator-min-microvolt = <600000>;
-			regulator-max-microvolt = <1850000>;
-			regulator-initial-mode = <2>;
-			regulator-allowed-modes = <2>, <4>;
-			regulator-always-on;
-
-			regulator-state-standby {
-				regulator-on-in-suspend;
-				regulator-mode = <4>;
-			};
-
-			regulator-state-mem {
-				regulator-on-in-suspend;
-				regulator-mode = <4>;
-			};
-		};
-
-		VDD_CORE {
-			regulator-name = "VDD_CORE";
-			regulator-min-microvolt = <600000>;
-			regulator-max-microvolt = <1850000>;
-			regulator-initial-mode = <2>;
-			regulator-allowed-modes = <2>, <4>;
-			regulator-always-on;
-
-			regulator-state-standby {
-				regulator-on-in-suspend;
-				regulator-mode = <4>;
-			};
-
-			regulator-state-mem {
-				regulator-off-in-suspend;
-				regulator-mode = <4>;
-			};
-		};
-
-		VDD_OTHER {
-			regulator-name = "VDD_OTHER";
-			regulator-min-microvolt = <600000>;
-			regulator-max-microvolt = <1850000>;
-			regulator-initial-mode = <2>;
-			regulator-allowed-modes = <2>, <4>;
-			regulator-always-on;
-
-			regulator-state-standby {
-				regulator-on-in-suspend;
-				regulator-mode = <4>;
-			};
-
-			regulator-state-mem {
-				regulator-off-in-suspend;
-				regulator-mode = <4>;
-			};
-		};
-
-		LDO1 {
-			regulator-name = "LDO1";
-			regulator-min-microvolt = <1200000>;
-			regulator-max-microvolt = <3700000>;
-			regulator-always-on;
-
-			regulator-state-standby {
-				regulator-on-in-suspend;
-			};
-
-			regulator-state-mem {
-				regulator-off-in-suspend;
-			};
-		};
-
-		LDO2 {
-			regulator-name = "LDO2";
-			regulator-min-microvolt = <1200000>;
-			regulator-max-microvolt = <3700000>;
-			regulator-always-on;
-
-			regulator-state-standby {
-				regulator-on-in-suspend;
-			};
-
-			regulator-state-mem {
-				regulator-off-in-suspend;
-			};
-		};
-
-	};
-};
Documentation/devicetree/bindings/regulator/microchip,mcp16502.yaml new file +2 -0
new file mode 100644
index 000000000000..13a6806b4604
@@ -0,0 +1,182 @@
+# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
+%YAML 1.2

Documentation/devicetree/bindings/regulator/microchip,mcp16502.yaml line 12

Quoted 10 lines
Documentation/devicetree/bindings/regulator/microchip,mcp16502.yaml new file +10 -0
+---
+$id: http://devicetree.org/schemas/regulator/microchip,mcp16502.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: MCP16502 - High-Performance PMIC
+
+maintainers:
+  - Andrei Simion <[email protected]>
+
+description: The MCP16502 is an optimally integrated PMIC compatible

Line break after "description:"

Quoted 5 lines
Documentation/devicetree/bindings/regulator/microchip,mcp16502.yaml new file +5 -0
+  with Microchip's eMPUs(Embedded Microprocessor Units), requiring
+  Dynamic Voltage Scaling (DVS) with the use of High-Performance mode (HPM).
+
+properties:
+  compatible:

Documentation/devicetree/bindings/regulator/microchip,mcp16502.yaml line 27

Quoted 10 lines
Documentation/devicetree/bindings/regulator/microchip,mcp16502.yaml new file +10 -0
+    const: microchip,mcp16502
+
+  lpm-gpios:
+    description: GPIO for LPM pin.
+      Note that this GPIO must remain high during
+      suspend-to-ram, keeping the PMIC into HIBERNATE mode;
+    maxItems: 1
+
+  reg:
+    description: I2C slave address

Drop description, it's obvious.

Documentation/devicetree/bindings/regulator/microchip,mcp16502.yaml line 31

Quoted 4 lines
Documentation/devicetree/bindings/regulator/microchip,mcp16502.yaml new file +4 -0
+    maxItems: 1
+
+  regulators:
+    type: object

additionalProperties: false

Quoted 4 lines
Documentation/devicetree/bindings/regulator/microchip,mcp16502.yaml new file +4 -0
+    description: List of regulators and its properties.
+      A node that houses a sub-node for each regulator within
+      the device. Each sub-node is identified using the node's
+      name. The content of each sub-node is defined by the

Documentation/devicetree/bindings/regulator/microchip,mcp16502.yaml line 45

Quoted 10 lines
Documentation/devicetree/bindings/regulator/microchip,mcp16502.yaml new file +10 -0
+      standard binding for regulators;
+
+    patternProperties:
+      "^(VDD_(IO|CORE|DDR|OTHER)|LDO[1-2])$":
+        type: object
+        $ref: regulator.yaml#
+
+        properties:
+          regulator-name:
+            pattern: "^(VDD_(IO|CORE|DDR|OTHER)|LDO[1-2])$"

regulator-name should not be enforced. Does driver actually require it?

Documentation/devicetree/bindings/regulator/microchip,mcp16502.yaml line 52

Quoted 7 lines
Documentation/devicetree/bindings/regulator/microchip,mcp16502.yaml new file +7 -0
+
+          regulator-allowed-modes:
+            description: Supported modes
+              2 - FPWM higher precision, higher consumption
+              4 - AutoPFM lower precision, lower consumption
+            items:
+              enum: [2, 4]

What about initial-mode?

Documentation/devicetree/bindings/regulator/microchip,mcp16502.yaml line 54

Quoted 2 lines
Documentation/devicetree/bindings/regulator/microchip,mcp16502.yaml new file +2 -0
+
+        unevaluatedProperties: false

Please put this one just after $ref: regulator.yaml

Documentation/devicetree/bindings/regulator/microchip,mcp16502.yaml line 65

Quoted 11 lines
Documentation/devicetree/bindings/regulator/microchip,mcp16502.yaml new file +11 -0
+
+required:
+  - compatible
+  - reg
+  - regulators
+
+additionalProperties: false
+
+examples:
+  - |
+    i2c@600 {

Instead:

i2c {

Documentation/devicetree/bindings/regulator/microchip,mcp16502.yaml line 66

Quoted 1 line
Documentation/devicetree/bindings/regulator/microchip,mcp16502.yaml new file +1 -0
+      reg = <0x600 0x100>;

Drop

Documentation/devicetree/bindings/regulator/microchip,mcp16502.yaml line 70

Quoted 4 lines
Documentation/devicetree/bindings/regulator/microchip,mcp16502.yaml new file +4 -0
+      #address-cells = <1>;
+      #size-cells = <0>;
+
+      mcp16502@5b {

Node names should be generic. See also an explanation and list of examples (not exhaustive) in DT specification:
https://devicetree-specification.readthedocs.io/en/latest/chapter2-devicetree-basics.html#generic-names-recommendation
E.g. pmic

Documentation/devicetree/bindings/regulator/microchip,mcp16502.yaml line 75

Quoted 5 lines
Documentation/devicetree/bindings/regulator/microchip,mcp16502.yaml new file +5 -0
+          compatible = "microchip,mcp16502";
+          reg = <0x5b>;
+
+          regulators {
+                  VDD_IO {

Use 4 spaces for example indentation.

Documentation/devicetree/bindings/regulator/microchip,mcp16502.yaml line 82

Quoted 7 lines
Documentation/devicetree/bindings/regulator/microchip,mcp16502.yaml new file +7 -0
+                          regulator-name = "VDD_IO";
+                          regulator-min-microvolt = <3300000>;
+                          regulator-max-microvolt = <3300000>;
+                          regulator-initial-mode = <2>;
+                          regulator-allowed-modes = <2>, <4>;
+                          regulator-always-on;
+

Best regards,
Krzysztof