Skip to contentSkip to conversation

dt-bindings: mfd: hisilicon,hi655x-pmic: Convert to DT schema

PATCH Superseded Shaunak Datar 4 participants 6 messages Apr 22 – May 7

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

PATCH 1/1 dt-bindings: mfd: hisilicon,hi655x-pmic: Convert to DT schema

Convert the Hisilicon Hi655x PMIC binding from the text format to DT schema to enable dtbs_check validation

---
 .../bindings/mfd/hisilicon,hi655x-pmic.yaml   | 89 +++++++++++++++++++
 .../bindings/mfd/hisilicon,hi655x.txt         | 33 -------
 2 files changed, 89 insertions(+), 33 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/mfd/hisilicon,hi655x-pmic.yaml
 delete mode 100644 Documentation/devicetree/bindings/mfd/hisilicon,hi655x.txt
Documentation/devicetree/bindings/mfd/hisilicon,hi655x-pmic.yaml new file +89 -0
new file mode 100644
index 000000000000..1bed57003bd2
@@ -0,0 +1,89 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/mfd/hisilicon,hi655x-pmic.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Hisilicon Hi655x Power Management Integrated Circuit
+
+maintainers:
+  - Chen Feng <[email protected]>
+  - Daniel Lezcano <[email protected]>
+
+description:
+  The hardware layout for access PMIC Hi655x from AP SoC Hi6220.
+  Between PMIC Hi655x and Hi6220, the physical signal channel is SSI.
+  We can use memory-mapped I/O to communicate.
+
+properties:
+  $nodename:
+    pattern: "pmic@[0-9a-f]"
+
+  compatible:
+    const: hisilicon,hi655x-pmic
+
+  reg:
+    maxItems: 1
+
+  interrupt-controller: true
+
+  '#interrupt-cells':
+    const: 2
+
+  pmic-gpios:
+    maxItems: 1
+    description: The GPIO used by PMIC IRQ
+
+  '#clock-cells':
+    const: 0
+
+  clock-output-names:
+    maxItems: 1
+
+  regulators:
+    type: object
+    additionalProperties: false
+
+    patternProperties:
+      '^LDO[0-9]+$':
+        type: object
+        $ref: /schemas/regulator/regulator.yaml#
+        unevaluatedProperties: false
+
+required:
+  - compatible
+  - reg
+  - interrupt-controller
+  - '#interrupt-cells'
+  - pmic-gpios
+  - '#clock-cells'
+  - regulators
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/gpio/gpio.h>
+
+    / {
+        #address-cells = <2>;
+        #size-cells = <2>;
+
+        pmic: pmic@f8000000 {
+            compatible = "hisilicon,hi655x-pmic";
+            reg = <0x0 0xf8000000 0x0 0x1000>;
+            #clock-cells = <0>;
+            interrupt-controller;
+            #interrupt-cells = <2>;
+            pmic-gpios = <&gpio1 2 GPIO_ACTIVE_HIGH>;
+
+            regulators {
+                ldo2: LDO2 {
+                    regulator-name = "LDO2_2V8";
+                    regulator-min-microvolt = <2500000>;
+                    regulator-max-microvolt = <3200000>;
+                    regulator-enable-ramp-delay = <120>;
+                };
+            };
+        };
+    };
Documentation/devicetree/bindings/mfd/hisilicon,hi655x.txt deleted +0 -33
deleted file mode 100644
index 9630ac0e4b56..000000000000
@@ -1,33 +0,0 @@
-Hisilicon Hi655x Power Management Integrated Circuit (PMIC)
-
-The hardware layout for access PMIC Hi655x from AP SoC Hi6220.
-Between PMIC Hi655x and Hi6220, the physical signal channel is SSI.
-We can use memory-mapped I/O to communicate.
-
-+----------------+             +-------------+
-|                |             |             |
-|    Hi6220      |   SSI bus   |   Hi655x    |
-|                |-------------|             |
-|                |(REGMAP_MMIO)|             |
-+----------------+             +-------------+
-
-Required properties:
-- compatible:           Should be "hisilicon,hi655x-pmic".
-- reg:                  Base address of PMIC on Hi6220 SoC.
-- interrupt-controller: Hi655x has internal IRQs (has own IRQ domain).
-- pmic-gpios:           The GPIO used by PMIC IRQ.
-- #clock-cells:		From common clock binding; shall be set to 0
-
-Optional properties:
-- clock-output-names: From common clock binding to override the
-  default output clock name
-
-Example:
-	pmic: pmic@f8000000 {
-		compatible = "hisilicon,hi655x-pmic";
-		reg = <0x0 0xf8000000 0x0 0x1000>;
-		interrupt-controller;
-		#interrupt-cells = <2>;
-		pmic-gpios = <&gpio1 2 GPIO_ACTIVE_HIGH>;
-		#clock-cells = <0>;
-	}
Signature · 1 line
2.53.0
#1 lore raw
Quoted 10 lines · Shaunak Datar

Convert the Hisilicon Hi655x PMIC binding from the text format to DT schema to enable dtbs_check validation

---
 .../bindings/mfd/hisilicon,hi655x-pmic.yaml   | 89 +++++++++++++++++++
 .../bindings/mfd/hisilicon,hi655x.txt         | 33 -------
 2 files changed, 89 insertions(+), 33 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/mfd/hisilicon,hi655x-pmic.yaml
 delete mode 100644 Documentation/devicetree/bindings/mfd/hisilicon,hi655x.txt

My bot found errors running 'make dt_binding_check' on your patch:

yamllint warnings/errors:

dtschema/dtc warnings/errors:
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/mfd/hisilicon,hi655x-pmic.example.dtb: /: 'compatible' is a required property
from schema $id: http://devicetree.org/schemas/root-node.yaml
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/mfd/hisilicon,hi655x-pmic.example.dtb: /: 'model' is a required property
from schema $id: http://devicetree.org/schemas/root-node.yaml

doc reference errors (make refcheckdocs):

See https://patchwork.kernel.org/project/devicetree/patch/[email protected]

The base for the series is generally the latest rc1. A different dependency should be noted in *this* patch.

If you already ran 'make dt_binding_check' and didn't see the above error(s), then make sure 'yamllint' is installed and dt-schema is up to date:

pip3 install dtschema --upgrade

Please check and re-submit after running the above command yourself. Note that DT_SCHEMA_FILES can be set to your schema file to speed up checking your schema. However, it must be unset to test all examples with your schema.

#2 lore raw
In reply to Shaunak Datar
Quoted 2 lines · Shaunak Datar

Convert the Hisilicon Hi655x PMIC binding from the text format to DT schema to enable dtbs_check validation

Missing blank line

Quoted 24 lines
---
 .../bindings/mfd/hisilicon,hi655x-pmic.yaml   | 89 +++++++++++++++++++
 .../bindings/mfd/hisilicon,hi655x.txt         | 33 -------
 2 files changed, 89 insertions(+), 33 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/mfd/hisilicon,hi655x-pmic.yaml
 delete mode 100644 Documentation/devicetree/bindings/mfd/hisilicon,hi655x.txt
Documentation/devicetree/bindings/mfd/hisilicon,hi655x-pmic.yaml new file +10 -0
new file mode 100644
index 000000000000..1bed57003bd2
@@ -0,0 +1,89 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/mfd/hisilicon,hi655x-pmic.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Hisilicon Hi655x Power Management Integrated Circuit
+
+maintainers:
+  - Chen Feng <[email protected]>

Documentation/devicetree/bindings/mfd/hisilicon,hi655x-pmic.yaml line 20

Quoted 10 lines
Documentation/devicetree/bindings/mfd/hisilicon,hi655x-pmic.yaml new file +10 -0
+  - Daniel Lezcano <[email protected]>
+
+description:
+  The hardware layout for access PMIC Hi655x from AP SoC Hi6220.
+  Between PMIC Hi655x and Hi6220, the physical signal channel is SSI.
+  We can use memory-mapped I/O to communicate.
+
+properties:
+  $nodename:
+    pattern: "pmic@[0-9a-f]"

Drop

Quoted 13 lines
Documentation/devicetree/bindings/mfd/hisilicon,hi655x-pmic.yaml new file +13 -0
+
+  compatible:
+    const: hisilicon,hi655x-pmic
+
+  reg:
+    maxItems: 1
+
+  interrupt-controller: true
+
+  '#interrupt-cells':
+    const: 2
+
+  pmic-gpios:

Documentation/devicetree/bindings/mfd/hisilicon,hi655x-pmic.yaml line 43

Quoted 10 lines
Documentation/devicetree/bindings/mfd/hisilicon,hi655x-pmic.yaml new file +10 -0
+    maxItems: 1
+    description: The GPIO used by PMIC IRQ
+
+  '#clock-cells':
+    const: 0
+
+  clock-output-names:
+    maxItems: 1
+
+  regulators:

There was no such property/child before, so this must be explained in the commit msg.

Documentation/devicetree/bindings/mfd/hisilicon,hi655x-pmic.yaml line 48

Quoted 5 lines
Documentation/devicetree/bindings/mfd/hisilicon,hi655x-pmic.yaml new file +5 -0
+    type: object
+    additionalProperties: false
+
+    patternProperties:
+      '^LDO[0-9]+$':

Why 9999 regulators is valid? This is usually constrained, because device has a very specific number of regulators.

Also, name should be 'ldo' if this is a new binding. If this is not new, you must explain WHY you are doing these changes to the binding.

Documentation/devicetree/bindings/mfd/hisilicon,hi655x-pmic.yaml line 60

Quoted 12 lines
Documentation/devicetree/bindings/mfd/hisilicon,hi655x-pmic.yaml new file +12 -0
+        type: object
+        $ref: /schemas/regulator/regulator.yaml#
+        unevaluatedProperties: false
+
+required:
+  - compatible
+  - reg
+  - interrupt-controller
+  - '#interrupt-cells'
+  - pmic-gpios
+  - '#clock-cells'
+  - regulators

And why is this required?

Documentation/devicetree/bindings/mfd/hisilicon,hi655x-pmic.yaml line 68

Quoted 8 lines
Documentation/devicetree/bindings/mfd/hisilicon,hi655x-pmic.yaml new file +8 -0
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/gpio/gpio.h>
+
+    / {

Drop and use 1 as address/size-cells. Or 'soc' like in other bindings.

Documentation/devicetree/bindings/mfd/hisilicon,hi655x-pmic.yaml line 71

Quoted 3 lines
Documentation/devicetree/bindings/mfd/hisilicon,hi655x-pmic.yaml new file +3 -0
+        #address-cells = <2>;
+        #size-cells = <2>;
+

Best regards,
Krzysztof

#3 lore raw

PATCH v2 1/1 dt-bindings: mfd: hisilicon,hi655x-pmic: Convert to DT schema

In reply to Shaunak Datar

Convert the Hisilicon Hi655x PMIC binding from the text format to DT schema to enable dtbs_check validation.

The 'regulators' child node is added based on existing usage in arch/arm64/boot/dts/hisilicon/hi6220-hikey.dts, which defines child regulator nodes not documented in the original .txt binding.

The uppercase LDO names are retained to match existing DTS usage.

---
Changes in v2:
- Drop the $nodename property
- Constrain LDO according to actual hardware regulators
- Drop 'regulators' from required list
- Drop example root node wrapper and use 1 address/size cell.
- Elaborate about 'regulators' addition and uppercase LDO naming in the commit message

 .../bindings/mfd/hisilicon,hi655x-pmic.yaml   | 80 +++++++++++++++++++
 .../bindings/mfd/hisilicon,hi655x.txt         | 33 --------
 2 files changed, 80 insertions(+), 33 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/mfd/hisilicon,hi655x-pmic.yaml
 delete mode 100644 Documentation/devicetree/bindings/mfd/hisilicon,hi655x.txt
Documentation/devicetree/bindings/mfd/hisilicon,hi655x-pmic.yaml new file +80 -0
new file mode 100644
index 000000000000..6f28f472e0f5
@@ -0,0 +1,80 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/mfd/hisilicon,hi655x-pmic.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Hisilicon Hi655x Power Management Integrated Circuit
+
+maintainers:
+  - Chen Feng <[email protected]>
+  - Daniel Lezcano <[email protected]>
+
+description:
+  The hardware layout for access PMIC Hi655x from AP SoC Hi6220.
+  Between PMIC Hi655x and Hi6220, the physical signal channel is SSI.
+  We can use memory-mapped I/O to communicate.
+
+properties:
+  compatible:
+    const: hisilicon,hi655x-pmic
+
+  reg:
+    maxItems: 1
+
+  interrupt-controller: true
+
+  '#interrupt-cells':
+    const: 2
+
+  pmic-gpios:
+    maxItems: 1
+    description: The GPIO used by PMIC IRQ
+
+  '#clock-cells':
+    const: 0
+
+  clock-output-names:
+    maxItems: 1
+
+  regulators:
+    type: object
+    additionalProperties: false
+
+    patternProperties:
+      '^LDO(2|7|10|13|14|15|17|19|21|22)$':
+        type: object
+        $ref: /schemas/regulator/regulator.yaml#
+        unevaluatedProperties: false
+
+required:
+  - compatible
+  - reg
+  - interrupt-controller
+  - '#interrupt-cells'
+  - pmic-gpios
+  - '#clock-cells'
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/gpio/gpio.h>
+
+    pmic: pmic@f8000000 {
+        compatible = "hisilicon,hi655x-pmic";
+        reg = <0xf8000000 0x1000>;
+        #clock-cells = <0>;
+        interrupt-controller;
+        #interrupt-cells = <2>;
+        pmic-gpios = <&gpio1 2 GPIO_ACTIVE_HIGH>;
+
+        regulators {
+            ldo2: LDO2 {
+                regulator-name = "LDO2_2V8";
+                regulator-min-microvolt = <2500000>;
+                regulator-max-microvolt = <3200000>;
+                regulator-enable-ramp-delay = <120>;
+            };
+        };
+    };
Documentation/devicetree/bindings/mfd/hisilicon,hi655x.txt deleted +0 -33
deleted file mode 100644
index 9630ac0e4b56..000000000000
@@ -1,33 +0,0 @@
-Hisilicon Hi655x Power Management Integrated Circuit (PMIC)
-
-The hardware layout for access PMIC Hi655x from AP SoC Hi6220.
-Between PMIC Hi655x and Hi6220, the physical signal channel is SSI.
-We can use memory-mapped I/O to communicate.
-
-+----------------+             +-------------+
-|                |             |             |
-|    Hi6220      |   SSI bus   |   Hi655x    |
-|                |-------------|             |
-|                |(REGMAP_MMIO)|             |
-+----------------+             +-------------+
-
-Required properties:
-- compatible:           Should be "hisilicon,hi655x-pmic".
-- reg:                  Base address of PMIC on Hi6220 SoC.
-- interrupt-controller: Hi655x has internal IRQs (has own IRQ domain).
-- pmic-gpios:           The GPIO used by PMIC IRQ.
-- #clock-cells:		From common clock binding; shall be set to 0
-
-Optional properties:
-- clock-output-names: From common clock binding to override the
-  default output clock name
-
-Example:
-	pmic: pmic@f8000000 {
-		compatible = "hisilicon,hi655x-pmic";
-		reg = <0x0 0xf8000000 0x0 0x1000>;
-		interrupt-controller;
-		#interrupt-cells = <2>;
-		pmic-gpios = <&gpio1 2 GPIO_ACTIVE_HIGH>;
-		#clock-cells = <0>;
-	}
Signature · 1 line
2.53.0
Reviewed-by on v2 1/1
#4 lore raw
Quoted 10 lines · Shaunak Datar

Convert the Hisilicon Hi655x PMIC binding from the text format to DT schema to enable dtbs_check validation.

The 'regulators' child node is added based on existing usage in arch/arm64/boot/dts/hisilicon/hi6220-hikey.dts, which defines child regulator nodes not documented in the original .txt binding.

The uppercase LDO names are retained to match existing DTS usage.

Quoted 8 lines

---
Changes in v2:
- Drop the $nodename property
- Constrain LDO according to actual hardware regulators
- Drop 'regulators' from required list
- Drop example root node wrapper and use 1 address/size cell.
- Elaborate about 'regulators' addition and uppercase LDO naming in the commit message

In the future (no need to resend):
Do not attach (thread) your patchsets to some other threads (unrelated or older versions). This buries them deep in the mailbox and might interfere with applying entire sets. See also:
https://elixir.bootlin.com/linux/v6.16-rc2/source/Documentation/process/submitting-patches.rst#L830

Best regards,
Krzysztof

maintainer Applied
#5 lore raw

Re: (subset) [PATCH v2] dt-bindings: mfd: hisilicon,hi655x-pmic: Convert to DT schema

In reply to Shaunak Datar
Quoted 8 lines · Shaunak Datar

Convert the Hisilicon Hi655x PMIC binding from the text format to DT schema to enable dtbs_check validation.

The 'regulators' child node is added based on existing usage in arch/arm64/boot/dts/hisilicon/hi6220-hikey.dts, which defines child regulator nodes not documented in the original .txt binding.

[...]

Applied, thanks!

[1/1] dt-bindings: mfd: hisilicon,hi655x-pmic: Convert to DT schema

      commit: 182a61b3f8d2314995f7687364265cad7a365a38

--
Lee Jones [李琼斯]