Skip to contentSkip to conversation

Convert qcom,spmi-pmic bindings from .txt to .yaml

PATCH In review Kiran Gunda 2 participants 5 messages Dec 30, 2020 – Feb 10, 2021

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

v5 cover Convert qcom,spmi-pmic bindings from .txt to .yaml

This patch series does the following:
- converts the qcom,spmi-pmic bindings from .txt to .yaml format
- Sorted the compatible strings
- Adds PM6150 and PM6150L subtypes.

Changes from V1:
- Sorted the compatible strings as per Stephen Boyd's comments.
- Added a patch to convert the qcom,spmi-pmic from .txt to .yaml format.

Changes from V2:
- Addressed Stephen Boyd and Rob Herring comments.

Changes from V3:
- Fixed compilation error in .yaml file.

Changes from V4:
- Addressed Stephen Boyd comments on .yaml conversion patch
- Added "Reviewed-by" tag from Stephen Boyd
- Added "Acked-for-MFD-by" tag from Lee Jones

Kiran Gunda (2):
mfd: qcom-spmi-pmic: Convert bindings to .yaml format
mfd: qcom-spmi-pmic: Add support for pm6150 and pm6150l

 .../devicetree/bindings/mfd/qcom,spmi-pmic.txt     |  80 --------------
 .../devicetree/bindings/mfd/qcom,spmi-pmic.yaml    | 119 +++++++++++++++++++++
 drivers/mfd/qcom-spmi-pmic.c                       |   4 +
 3 files changed, 123 insertions(+), 80 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/mfd/qcom,spmi-pmic.txt
 create mode 100644 Documentation/devicetree/bindings/mfd/qcom,spmi-pmic.yaml
Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
 a Linux Foundation Collaborative Project
#1 lore raw

PATCH v5 1/2 mfd: qcom-spmi-pmic: Convert bindings to .yaml format

Convert the bindings from .txt to .yaml format.

---
 .../devicetree/bindings/mfd/qcom,spmi-pmic.txt     |  80 --------------
 .../devicetree/bindings/mfd/qcom,spmi-pmic.yaml    | 117 +++++++++++++++++++++
 2 files changed, 117 insertions(+), 80 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/mfd/qcom,spmi-pmic.txt
 create mode 100644 Documentation/devicetree/bindings/mfd/qcom,spmi-pmic.yaml
Documentation/devicetree/bindings/mfd/qcom,spmi-pmic.txt deleted +0 -80
deleted file mode 100644
index 79367a4..0000000
@@ -1,80 +0,0 @@
-          Qualcomm SPMI PMICs multi-function device bindings
-
-The Qualcomm SPMI series presently includes PM8941, PM8841 and PMA8084
-PMICs.  These PMICs use a QPNP scheme through SPMI interface.
-QPNP is effectively a partitioning scheme for dividing the SPMI extended
-register space up into logical pieces, and set of fixed register
-locations/definitions within these regions, with some of these regions
-specifically used for interrupt handling.
-
-The QPNP PMICs are used with the Qualcomm Snapdragon series SoCs, and are
-interfaced to the chip via the SPMI (System Power Management Interface) bus.
-Support for multiple independent functions are implemented by splitting the
-16-bit SPMI slave address space into 256 smaller fixed-size regions, 256 bytes
-each. A function can consume one or more of these fixed-size register regions.
-
-Required properties:
-- compatible:      Should contain one of:
-                   "qcom,pm8941",
-                   "qcom,pm8841",
-                   "qcom,pma8084",
-                   "qcom,pm8019",
-                   "qcom,pm8226",
-                   "qcom,pm8110",
-                   "qcom,pma8084",
-                   "qcom,pmi8962",
-                   "qcom,pmd9635",
-                   "qcom,pm8994",
-                   "qcom,pmi8994",
-                   "qcom,pm8916",
-                   "qcom,pm8004",
-                   "qcom,pm8909",
-                   "qcom,pm8950",
-                   "qcom,pmi8950",
-                   "qcom,pm8998",
-                   "qcom,pmi8998",
-                   "qcom,pm8005",
-                   or generalized "qcom,spmi-pmic".
-- reg:             Specifies the SPMI USID slave address for this device.
-                   For more information see:
-                   Documentation/devicetree/bindings/spmi/spmi.yaml
-
-Required properties for peripheral child nodes:
-- compatible:      Should contain "qcom,xxx", where "xxx" is a peripheral name.
-
-Optional properties for peripheral child nodes:
-- interrupts:      Interrupts are specified as a 4-tuple. For more information
-                   see:
-                   Documentation/devicetree/bindings/spmi/qcom,spmi-pmic-arb.txt
-- interrupt-names: Corresponding interrupt name to the interrupts property
-
-Each child node of SPMI slave id represents a function of the PMIC. In the
-example below the rtc device node represents a peripheral of pm8941
-SID = 0. The regulator device node represents a peripheral of pm8941 SID = 1.
-
-Example:
-
-	spmi {
-		compatible = "qcom,spmi-pmic-arb";
-
-		pm8941@0 {
-			compatible = "qcom,pm8941", "qcom,spmi-pmic";
-			reg = <0x0 SPMI_USID>;
-
-			rtc {
-				compatible = "qcom,rtc";
-				interrupts = <0x0 0x61 0x1 IRQ_TYPE_EDGE_RISING>;
-				interrupt-names = "alarm";
-			};
-		};
-
-		pm8941@1 {
-			compatible = "qcom,pm8941", "qcom,spmi-pmic";
-			reg = <0x1 SPMI_USID>;
-
-			regulator {
-				compatible = "qcom,regulator";
-				regulator-name = "8941_boost";
-			};
-		};
-	};
Documentation/devicetree/bindings/mfd/qcom,spmi-pmic.yaml new file +117 -0

117 lines not on this page · raw message

Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
 a Linux Foundation Collaborative Project
maintainer
#2 lore raw

Re: [PATCH V5 1/2] mfd: qcom-spmi-pmic: Convert bindings to .yaml format

Quoted 35 lines · Kiran Gunda

Convert the bindings from .txt to .yaml format.

---
 .../devicetree/bindings/mfd/qcom,spmi-pmic.txt     |  80 --------------
 .../devicetree/bindings/mfd/qcom,spmi-pmic.yaml    | 117 +++++++++++++++++++++
 2 files changed, 117 insertions(+), 80 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/mfd/qcom,spmi-pmic.txt
 create mode 100644 Documentation/devicetree/bindings/mfd/qcom,spmi-pmic.yaml
Documentation/devicetree/bindings/mfd/qcom,spmi-pmic.yaml new file +19 -0
new file mode 100644
index 0000000..b753bdb
@@ -0,0 +1,117 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/mfd/qcom,spmi-pmic.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Qualcomm SPMI PMICs multi-function device bindings
+
+maintainers:
+  - Stephen Boyd <[email protected]>
+  - Kiran Gunda <[email protected]>
+
+description: |
+  The Qualcomm SPMI PMICs use a QPNP scheme through SPMI interface.
+  QPNP is effectively a partitioning scheme for dividing the SPMI extended
+  register space up into logical pieces, and set of fixed register
+  locations/definitions within these regions, with some of these regions
+  specifically used for interrupt handling.
+

Documentation/devicetree/bindings/mfd/qcom,spmi-pmic.yaml line 29

Quoted 10 lines
Documentation/devicetree/bindings/mfd/qcom,spmi-pmic.yaml new file +10 -0
+  The QPNP PMICs are used with the Qualcomm Snapdragon series SoCs, and are
+  interfaced to the chip via the SPMI (System Power Management Interface) bus.
+  Support for multiple independent functions are implemented by splitting the
+  16-bit SPMI slave address space into 256 smaller fixed-size regions, 256 bytes
+  each. A function can consume one or more of these fixed-size register regions.
+
+properties:
+  spmi_bus:
+    type: object
+    description: SPMI bus node

This is outside the scope of this binding.

Documentation/devicetree/bindings/mfd/qcom,spmi-pmic.yaml line 34

Quoted 5 lines
Documentation/devicetree/bindings/mfd/qcom,spmi-pmic.yaml new file +5 -0
+
+patternProperties:
+  "^pmic@[0-9]$":
+    description: Child PMIC nodes
+    type: object

You've defined spmi_bus and pmic@... as siblings. I assume you meant parent/child instead. You'd need to indent all this 4 more spaces.

However, this is also outside the scope of the binding and should be removed.

Documentation/devicetree/bindings/mfd/qcom,spmi-pmic.yaml line 37

Quoted 3 lines
Documentation/devicetree/bindings/mfd/qcom,spmi-pmic.yaml new file +3 -0
+
+    properties:
+      compatible:

So this needs to be at the top level. 'compatible' is also how we decide to apply a schema to a node. What you did here will never be applied. Introduce an error to the example and see.

Quoted 17 lines
Documentation/devicetree/bindings/mfd/qcom,spmi-pmic.yaml new file +17 -0
+        items:
+          - enum:
+              # Sorted based on subtype ID the device reports
+              - qcom,pm8941
+              - qcom,pm8841
+              - qcom,pma8084
+              - qcom,pm8019
+              - qcom,pm8226
+              - qcom,pm8110
+              - qcom,pma8084
+              - qcom,pmi8962
+              - qcom,pmd9635
+              - qcom,pm8994
+              - qcom,pmi8994
+              - qcom,pm8916
+              - qcom,pm8004
+              - qcom,pm8909

Documentation/devicetree/bindings/mfd/qcom,spmi-pmic.yaml line 64

Quoted 10 lines
Documentation/devicetree/bindings/mfd/qcom,spmi-pmic.yaml new file +10 -0
+              - qcom,pm8950
+              - qcom,pmi8950
+              - qcom,pm8998
+              - qcom,pmi8998
+              - qcom,pm8005
+              - qcom,pm660l
+              - qcom,pm660
+
+          - enum:
+              - qcom,spmi-pmic

You can use 'const' here instead of enum.

Quoted 5 lines
Documentation/devicetree/bindings/mfd/qcom,spmi-pmic.yaml new file +5 -0
+
+      reg:
+        maxItems: 1
+        description:
+          Specifies the SPMI USID slave address for this device.

Documentation/devicetree/bindings/mfd/qcom,spmi-pmic.yaml line 79

Quoted 10 lines
Documentation/devicetree/bindings/mfd/qcom,spmi-pmic.yaml new file +10 -0
+          For more information see bindings/spmi/spmi.txt
+
+    patternProperties:
+      "^[a-zA-Z0-9]$":
+        description:
+          Each child node of SPMI slave id represents a function of the PMIC.
+          In the example below the rtc device node represents a peripheral of
+          pm8941 SID = 0. The regulator device node represents a peripheral of
+          pm8941 SID = 1.
+        type: object

No, you need to define all the child nodes. This may mean you need to split to several schemas if each PMIC has different sub devices.

Quoted 12 lines
Documentation/devicetree/bindings/mfd/qcom,spmi-pmic.yaml new file +12 -0
+
+    required:
+      - compatible
+      - reg
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/spmi/spmi.h>
+
+    spmi_bus {

Documentation/devicetree/bindings/mfd/qcom,spmi-pmic.yaml line 101

Quoted 10 lines
Documentation/devicetree/bindings/mfd/qcom,spmi-pmic.yaml new file +10 -0
+        compatible = "qcom,spmi-pmic-arb";
+        #address-cells = <2>;
+        #size-cells = <0>;
+
+        pmic@0 {
+         compatible = "qcom,pm8941";
+         reg = <0x0 SPMI_USID>;
+
+         rtc {
+           compatible = "qcom,rtc";

Not documented nor used anywhere.

Documentation/devicetree/bindings/mfd/qcom,spmi-pmic.yaml line 112

Quoted 11 lines
Documentation/devicetree/bindings/mfd/qcom,spmi-pmic.yaml new file +11 -0
+           interrupts = <0x0 0x61 0x1 0x1>;
+           interrupt-names = "alarm";
+          };
+        };
+
+        pmic@1 {
+         compatible = "qcom,pm8941";
+         reg = <0x1 SPMI_USID>;
+
+         regulator {
+           compatible = "qcom,regulator";

Same here.

Quoted 9 lines
Documentation/devicetree/bindings/mfd/qcom,spmi-pmic.yaml new file +5 -0
+           regulator-name = "8941_boost";
+           };
+          };
+        };
+...
Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
 a Linux Foundation Collaborative Project
#3 lore raw

Re: [PATCH V5 1/2] mfd: qcom-spmi-pmic: Convert bindings to .yaml format

Quoted 108 lines · Rob Herring
Quoted 51 lines · Kiran Gunda

Convert the bindings from .txt to .yaml format.

---
 .../devicetree/bindings/mfd/qcom,spmi-pmic.txt     |  80 
--------------
 .../devicetree/bindings/mfd/qcom,spmi-pmic.yaml    | 117 
+++++++++++++++++++++
 2 files changed, 117 insertions(+), 80 deletions(-)
 delete mode 100644 
Documentation/devicetree/bindings/mfd/qcom,spmi-pmic.txt
 create mode 100644 

Documentation/devicetree/bindings/mfd/qcom,spmi-pmic.yaml

Documentation/devicetree/bindings/mfd/qcom,spmi-pmic.yaml new file +15 -0
new file mode 100644
index 0000000..b753bdb
@@ -0,0 +1,117 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/mfd/qcom,spmi-pmic.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Qualcomm SPMI PMICs multi-function device bindings
+
+maintainers:
+  - Stephen Boyd <[email protected]>
+  - Kiran Gunda <[email protected]>
+
+description: |
+  The Qualcomm SPMI PMICs use a QPNP scheme through SPMI interface.
+  QPNP is effectively a partitioning scheme for dividing the SPMI 

extended

Documentation/devicetree/bindings/mfd/qcom,spmi-pmic.yaml new file +2 -0
+  register space up into logical pieces, and set of fixed register
+  locations/definitions within these regions, with some of these 

regions

Documentation/devicetree/bindings/mfd/qcom,spmi-pmic.yaml new file +3 -0
+  specifically used for interrupt handling.
+
+  The QPNP PMICs are used with the Qualcomm Snapdragon series SoCs, 

and are
+ interfaced to the chip via the SPMI (System Power Management Interface) bus.
+ Support for multiple independent functions are implemented by splitting the
+ 16-bit SPMI slave address space into 256 smaller fixed-size regions, 256 bytes
+ each. A function can consume one or more of these fixed-size register regions.

Documentation/devicetree/bindings/mfd/qcom,spmi-pmic.yaml line 29

Quoted 5 lines
Documentation/devicetree/bindings/mfd/qcom,spmi-pmic.yaml new file +5 -0
+
+properties:
+  spmi_bus:
+    type: object
+    description: SPMI bus node

This is outside the scope of this binding.

Documentation/devicetree/bindings/mfd/qcom,spmi-pmic.yaml line 34

Quoted 5 lines
Documentation/devicetree/bindings/mfd/qcom,spmi-pmic.yaml new file +5 -0
+
+patternProperties:
+  "^pmic@[0-9]$":
+    description: Child PMIC nodes
+    type: object

You've defined spmi_bus and pmic@... as siblings. I assume you meant parent/child instead. You'd need to indent all this 4 more spaces.

However, this is also outside the scope of the binding and should be removed.

Documentation/devicetree/bindings/mfd/qcom,spmi-pmic.yaml line 37

Quoted 3 lines
Documentation/devicetree/bindings/mfd/qcom,spmi-pmic.yaml new file +3 -0
+
+    properties:
+      compatible:

So this needs to be at the top level. 'compatible' is also how we decide to apply a schema to a node. What you did here will never be applied. Introduce an error to the example and see.

Quoted 17 lines
Documentation/devicetree/bindings/mfd/qcom,spmi-pmic.yaml new file +17 -0
+        items:
+          - enum:
+              # Sorted based on subtype ID the device reports
+              - qcom,pm8941
+              - qcom,pm8841
+              - qcom,pma8084
+              - qcom,pm8019
+              - qcom,pm8226
+              - qcom,pm8110
+              - qcom,pma8084
+              - qcom,pmi8962
+              - qcom,pmd9635
+              - qcom,pm8994
+              - qcom,pmi8994
+              - qcom,pm8916
+              - qcom,pm8004
+              - qcom,pm8909

Documentation/devicetree/bindings/mfd/qcom,spmi-pmic.yaml line 64

Quoted 10 lines
Documentation/devicetree/bindings/mfd/qcom,spmi-pmic.yaml new file +10 -0
+              - qcom,pm8950
+              - qcom,pmi8950
+              - qcom,pm8998
+              - qcom,pmi8998
+              - qcom,pm8005
+              - qcom,pm660l
+              - qcom,pm660
+
+          - enum:
+              - qcom,spmi-pmic
Quoted 2 lines

You can use 'const' here instead of enum.

Okay. I can address the above comments.

Quoted 13 lines
Quoted 13 lines
Documentation/devicetree/bindings/mfd/qcom,spmi-pmic.yaml new file +11 -0
+
+      reg:
+        maxItems: 1
+        description:
+          Specifies the SPMI USID slave address for this device.
+          For more information see bindings/spmi/spmi.txt
+
+    patternProperties:
+      "^[a-zA-Z0-9]$":
+        description:
+          Each child node of SPMI slave id represents a function of 

the PMIC.
+ In the example below the rtc device node represents a

Quoted 9 lines

Documentation/devicetree/bindings/mfd/qcom,spmi-pmic.yaml line 79

Quoted 5 lines

peripheral of
+ pm8941 SID = 0. The regulator device node represents a
peripheral of

Documentation/devicetree/bindings/mfd/qcom,spmi-pmic.yaml new file +2 -0
+          pm8941 SID = 1.
+        type: object

No, you need to define all the child nodes. This may mean you need to split to several schemas if each PMIC has different sub devices.

Currently all the different child node bindings have not been converted to .yaml. That means probably I can't convert this to .yaml unless all the child schemas are available?

Quoted 48 lines
Quoted 12 lines
Documentation/devicetree/bindings/mfd/qcom,spmi-pmic.yaml new file +12 -0
+
+    required:
+      - compatible
+      - reg
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/spmi/spmi.h>
+
+    spmi_bus {

Documentation/devicetree/bindings/mfd/qcom,spmi-pmic.yaml line 101

Quoted 10 lines
Documentation/devicetree/bindings/mfd/qcom,spmi-pmic.yaml new file +10 -0
+        compatible = "qcom,spmi-pmic-arb";
+        #address-cells = <2>;
+        #size-cells = <0>;
+
+        pmic@0 {
+         compatible = "qcom,pm8941";
+         reg = <0x0 SPMI_USID>;
+
+         rtc {
+           compatible = "qcom,rtc";

Not documented nor used anywhere.

Documentation/devicetree/bindings/mfd/qcom,spmi-pmic.yaml line 112

Quoted 11 lines
Documentation/devicetree/bindings/mfd/qcom,spmi-pmic.yaml new file +11 -0
+           interrupts = <0x0 0x61 0x1 0x1>;
+           interrupt-names = "alarm";
+          };
+        };
+
+        pmic@1 {
+         compatible = "qcom,pm8941";
+         reg = <0x1 SPMI_USID>;
+
+         regulator {
+           compatible = "qcom,regulator";

Same here.

Quoted 9 lines
Documentation/devicetree/bindings/mfd/qcom,spmi-pmic.yaml new file +5 -1
+           regulator-name = "8941_boost";
+           };
+          };
+        };
+...
--

The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project

#4 lore raw

PATCH v5 2/2 mfd: qcom-spmi-pmic: Add support for pm6150 and pm6150l

In reply to Kiran Gunda

Add the compatibles and PMIC ids for pm6150 and pm6150l PMICs found on SC7180 based platforms.

---
 Documentation/devicetree/bindings/mfd/qcom,spmi-pmic.yaml | 2 ++
 drivers/mfd/qcom-spmi-pmic.c                              | 4 ++++
 2 files changed, 6 insertions(+)
Documentation/devicetree/bindings/mfd/qcom,spmi-pmic.yaml +2 -0
index b753bdb..151953a 100644
@@ -59,6 +59,8 @@ patternProperties:
               - qcom,pm8005
               - qcom,pm660l
               - qcom,pm660
+              - qcom,pm6150l
+              - qcom,pm6150
 
           - enum:
               - qcom,spmi-pmic
drivers/mfd/qcom-spmi-pmic.c +4 -0
index a35d5cf..78e9084 100644
@@ -38,6 +38,8 @@
 #define PM8005_SUBTYPE		0x18
 #define PM660L_SUBTYPE		0x1A
 #define PM660_SUBTYPE		0x1B
+#define PM6150L_SUBTYPE		0x1F
+#define PM6150_SUBTYPE		0x28
 
 static const struct of_device_id pmic_spmi_id_table[] = {
 	{ .compatible = "qcom,spmi-pmic", .data = (void *)COMMON_SUBTYPE },
@@ -61,6 +63,8 @@ static const struct of_device_id pmic_spmi_id_table[] = {
 	{ .compatible = "qcom,pm8005",    .data = (void *)PM8005_SUBTYPE },
 	{ .compatible = "qcom,pm660l",    .data = (void *)PM660L_SUBTYPE },
 	{ .compatible = "qcom,pm660",     .data = (void *)PM660_SUBTYPE },
+	{ .compatible = "qcom,pm6150l",    .data = (void *)PM6150L_SUBTYPE },
+	{ .compatible = "qcom,pm6150",     .data = (void *)PM6150_SUBTYPE },
 	{ }
 };
 
Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
 a Linux Foundation Collaborative Project