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

From: kgunda
Date: Thu Dec 24 2020 - 01:58:14 EST


On 2020-12-20 05:17, Stephen Boyd wrote:
Quoting Kiran Gunda (2020-12-18 00:14:51)
Convert the bindings from .txt to .yaml format.

Signed-off-by: Kiran Gunda <kgunda@xxxxxxxxxxxxxx>
---
.../devicetree/bindings/mfd/qcom,spmi-pmic.txt | 80 -------------
.../devicetree/bindings/mfd/qcom,spmi-pmic.yaml | 127 +++++++++++++++++++++
2 files changed, 127 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

diff --git a/Documentation/devicetree/bindings/mfd/qcom,spmi-pmic.txt b/Documentation/devicetree/bindings/mfd/qcom,spmi-pmic.txt
deleted file mode 100644
index 79367a4..0000000
--- a/Documentation/devicetree/bindings/mfd/qcom,spmi-pmic.txt
+++ /dev/null
@@ -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";
- };
- };
- };
diff --git a/Documentation/devicetree/bindings/mfd/qcom,spmi-pmic.yaml b/Documentation/devicetree/bindings/mfd/qcom,spmi-pmic.yaml
new file mode 100644
index 0000000..e458dd1
--- /dev/null
+++ b/Documentation/devicetree/bindings/mfd/qcom,spmi-pmic.yaml
@@ -0,0 +1,127 @@
+# SPDX-License-Identifier: GPL-2.0
+%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 <sboyd@xxxxxxxxxx>

Someone at Qualcomm should be the maintainer here. Maybe you?

+
+description: |
+ The Qualcomm SPMI PMICs use a QPNP scheme through SPMI interface.

What is QPNP?

Qualcomm Plug And Play.
+ 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.
+
+properties:
+ spmi_bus:
+ type: object
+ description: SPMI bus node
+
+patternProperties:
+ "^pmic@[0-9]$":
+ description: Child PMIC nodes
+ type: object
+
+ properties:
+ compatible:
+ 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
+ - qcom,pm8950
+ - qcom,pmi8950
+ - qcom,pm8998
+ - qcom,pmi8998
+ - qcom,pm8005
+ - qcom,pm660l
+ - qcom,pm660
+
+ - enum:
+ - qcom,spmi-pmic
+
+ reg:
+ maxItems: 1
+ description:
+ Specifies the SPMI USID slave address for this device.
+ For more information see bindings/spmi/spmi.txt
+
+ patternProperties:
+ "@[0-9a-f]$":

Is that @ sign supposed to be a ^ sign? I thought the child nodes of a
pmic node were [a-zA-Z0-9-] or some sort of regex like that. Certainly
not an address that doesn't exist. They look to be things like 'rtc' or
'regulator'.

Will fix it in next series.
+ 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
+
+ properties:
+ interrupts:
+ maxItems: 4
+ description:
+ Interrupts are specified as a 4-tuple. For more information

Seems like minItems is also 4 though, so should be a const 4 instead?
But then this is about how many interrupts there are, which would be 1
or 2? It really can't be known in case there are many interrupts for a
child node so not sure we need to specify anything.

+ see bindings/spmi/qcom,spmi-pmic-arb.txt
+
+ interrupt-names:
+ description:
+ Corresponding interrupt name to the interrupts property

I suspect we should drop these two properties and leave them up to the
binding for the function, like rtc, or regualator, etc.

Okay. I will remove these properties.
+
+ required:
+ - compatible
+ - reg
+
+additionalProperties: false
+
+examples:
+ - |
+ #include <dt-bindings/spmi/spmi.h>
+
+ spmi_bus {
+ compatible = "qcom,spmi-pmic-arb";
+ #address-cells = <2>;
+ #size-cells = <0>;
+
+ pmic@0 {
+ compatible = "qcom,pm8941";
+ reg = <0x0 SPMI_USID>;
+
+ rtc {
+ compatible = "qcom,rtc";
+ interrupts = <0x0 0x61 0x1 0x1>;
+ interrupt-names = "alarm";
+ };
+ };
+
+ pmic@1 {
+ compatible = "qcom,pm8941";
+ reg = <0x1 SPMI_USID>;
+
+ regulator {
+ compatible = "qcom,regulator";
+ regulator-name = "8941_boost";
+ };
+ };
+ };
+...