Skip to contentSkip to conversation

dt-bindings: power: rockchip: Convert to json-schema

PATCH Superseded Enric Balletbo i Serra 2 participants 3 messages Oct 15, 2020 – Oct 16, 2020

Subsystems (2)

v4 of 6 Superseded Latest is v6 →

lore
Share & tools
lore
#0 lore raw

PATCH v4 1/1 dt-bindings: power: rockchip: Convert to json-schema

Convert the soc/rockchip/power_domain.txt binding document to json-schema and move to the power bindings directory.

---
Rob, I didn't add a number of clocks neither a number of pm_qos because will be a finger in the air number. If you still want I add it, I can add a number based on the actual users of this binding but no guarantee that we don't need to change that number in the future.

Changes in v4:
- Use hex for unit-addresses.
- Use space between compatibles in the example.
- Define child nodes for nested power domains even are duplicated but more clear that adding a regex scaped to be a valid URI.

Changes in v3:
- Fixed tab errors found by bot

Changes in v2:
- Fixed a warning that says that 'syscon' should not be used alone.
- Use patternProperties to define a new level for power-domains.
- Add const values for power-domain-cells, address-cells, etc.

 .../power/rockchip,power-controller.yaml      | 283 ++++++++++++++++++
 .../bindings/soc/rockchip/power_domain.txt    | 136 ---------
 2 files changed, 283 insertions(+), 136 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/power/rockchip,power-controller.yaml
 delete mode 100644 Documentation/devicetree/bindings/soc/rockchip/power_domain.txt
Documentation/devicetree/bindings/power/rockchip,power-controller.yaml new file +283 -0
new file mode 100644
index 000000000000..ae9728c590b6
@@ -0,0 +1,283 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/power/rockchip,power-controller.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Rockchip Power Domains
+
+maintainers:
+  - Caesar Wang <[email protected]>
+  - Heiko Stuebner <[email protected]>
+
+description: |
+  Rockchip processors include support for multiple power domains which can be
+  powered up/down by software based on different application scenes to save power.
+
+  Power domains contained within power-controller node are generic power domain
+  providers documented in Documentation/devicetree/bindings/power/power-domain.yaml.
+
+  IP cores belonging to a power domain should contain a 'power-domains'
+  property that is a phandle for the power domain node representing the domain.
+
+properties:
+  $nodename:
+    const: power-controller
+
+  compatible:
+    enum:
+      - rockchip,px30-power-controller
+      - rockchip,rk3036-power-controller
+      - rockchip,rk3066-power-controller
+      - rockchip,rk3128-power-controller
+      - rockchip,rk3188-power-controller
+      - rockchip,rk3228-power-controller
+      - rockchip,rk3288-power-controller
+      - rockchip,rk3328-power-controller
+      - rockchip,rk3366-power-controller
+      - rockchip,rk3368-power-controller
+      - rockchip,rk3399-power-controller
+
+  '#power-domain-cells':
+    const: 1
+
+  '#address-cells':
+    const: 1
+
+  '#size-cells':
+    const: 0
+
+patternProperties:
+  "^power-domain@[0-9a-f]+$":
+    type: object
+    description: |
+      Represents the power domains within the power controller node as documented
+      in Documentation/devicetree/bindings/power/power-domain.yaml.
+
+    properties:
+
+      '#power-domain-cells':
+        description:
+            Must be 0 for nodes representing a single PM domain and 1 for nodes
+            providing multiple PM domains.
+
+      '#address-cells':
+        const: 1
+
+      '#size-cells':
+        const: 0
+
+      reg:
+        description: |
+          Power domain index. Valid values are defined in:
+          "include/dt-bindings/power/px30-power.h" - for PX30 type power domain.
+          "include/dt-bindings/power/rk3036-power.h" - for RK3036 type power domain.
+          "include/dt-bindings/power/rk3066-power.h" - for RK3066 type power domain.
+          "include/dt-bindings/power/rk3128-power.h" - for RK3128 type power domain.
+          "include/dt-bindings/power/rk3188-power.h" - for RK3188 type power domain.
+          "include/dt-bindings/power/rk3228-power.h" - for RK3228 type power domain.
+          "include/dt-bindings/power/rk3288-power.h" - for RK3288 type power domain.
+          "include/dt-bindings/power/rk3328-power.h" - for RK3328 type power domain.
+          "include/dt-bindings/power/rk3366-power.h" - for RK3366 type power domain.
+          "include/dt-bindings/power/rk3368-power.h" - for RK3368 type power domain.
+          "include/dt-bindings/power/rk3399-power.h" - for RK3399 type power domain.
+        maxItems: 1
+
+      clocks:
+        description: |
+          A number of phandles to clocks that need to be enabled while power domain
+          switches state.
+
+      pm_qos:
+        description: |
+          A number of phandles to qos blocks which need to be saved and restored
+          while power domain switches state.
+
+    patternProperties:
+      "^power-domain@[0-9a-f]+$":
+        type: object
+        description: |
+          Represents a power domain child within a power domain parent node.
+
+        properties:
+
+          '#power-domain-cells':
+            description:
+                Must be 0 for nodes representing a single PM domain and 1 for nodes
+                providing multiple PM domains.
+
+          '#address-cells':
+            const: 1
+
+          '#size-cells':
+            const: 0
+
+          reg:
+            maxItems: 1
+
+          clocks:
+            description: |
+              A number of phandles to clocks that need to be enabled while power domain
+              switches state.
+
+          pm_qos:
+            description: |
+              A number of phandles to qos blocks which need to be saved and restored
+              while power domain switches state.
+
+        patternProperties:
+          "^power-domain@[0-9a-f]+$":
+            type: object
+            description: |
+              Represents a power domain child within a power domain parent node.
+
+            properties:
+
+              '#power-domain-cells':
+                description:
+                    Must be 0 for nodes representing a single PM domain and 1 for nodes
+                    providing multiple PM domains.
+
+              '#address-cells':
+                const: 1
+
+              '#size-cells':
+                const: 0
+
+              reg:
+                maxItems: 1
+
+              clocks:
+                description: |
+                  A number of phandles to clocks that need to be enabled while power domain
+                  switches state.
+
+              pm_qos:
+                description: |
+                  A number of phandles to qos blocks which need to be saved and restored
+                  while power domain switches state.
+
+            required:
+              - reg
+
+            additionalProperties: false
+
+        required:
+          - reg
+
+        additionalProperties: false
+
+    required:
+      - reg
+
+    additionalProperties: false
+
+required:
+  - compatible
+  - '#power-domain-cells'
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/clock/rk3399-cru.h>
+    #include <dt-bindings/power/rk3399-power.h>
+
+    soc {
+        #address-cells = <2>;
+        #size-cells = <2>;
+
+        qos_hdcp: qos@ffa90000 {
+            compatible = "rockchip,rk3399-qos", "syscon";
+            reg = <0x0 0xffa90000 0x0 0x20>;
+        };
+
+        qos_iep: qos@ffa98000 {
+            compatible = "rk3399-qos", "syscon";
+            reg = <0x0 0xffa98000 0x0 0x20>;
+        };
+
+        qos_rga_r: qos@ffab0000 {
+            compatible = "rk3399-qos", "syscon";
+            reg = <0x0 0xffab0000 0x0 0x20>;
+        };
+
+        qos_rga_w: qos@ffab0080 {
+            compatible = "rk3399-qos", "syscon";
+            reg = <0x0 0xffab0080 0x0 0x20>;
+        };
+
+        qos_video_m0: qos@ffab8000 {
+            compatible = "rk3399-qos", "syscon";
+            reg = <0x0 0xffab8000 0x0 0x20>;
+        };
+
+        qos_video_m1_r: qos@ffac0000 {
+            compatible = "rk3399-qos", "syscon";
+            reg = <0x0 0xffac0000 0x0 0x20>;
+        };
+
+        qos_video_m1_w: qos@ffac0080 {
+            compatible = "rk3399-qos", "syscon";
+            reg = <0x0 0xffac0080 0x0 0x20>;
+        };
+
+        power-management@ff310000 {
+            compatible = "rockchip,rk3399-pmu", "syscon", "simple-mfd";
+            reg = <0x0 0xff310000 0x0 0x1000>;
+
+            power-controller {
+                compatible = "rockchip,rk3399-power-controller";
+                #power-domain-cells = <1>;
+                #address-cells = <1>;
+                #size-cells = <0>;
+
+                /* These power domains are grouped by VD_CENTER */
+                power-domain@RK3399_PD_IEP {
+                    reg = <RK3399_PD_IEP>;
+                    clocks = <&cru ACLK_IEP>,
+                             <&cru HCLK_IEP>;
+                    pm_qos = <&qos_iep>;
+                    #power-domain-cells = <0>;
+                };
+                power-domain@RK3399_PD_RGA {
+                    reg = <RK3399_PD_RGA>;
+                    clocks = <&cru ACLK_RGA>,
+                             <&cru HCLK_RGA>;
+                    pm_qos = <&qos_rga_r>,
+                             <&qos_rga_w>;
+                    #power-domain-cells = <0>;
+                };
+                power-domain@RK3399_PD_VCODEC {
+                    reg = <RK3399_PD_VCODEC>;
+                    clocks = <&cru ACLK_VCODEC>,
+                             <&cru HCLK_VCODEC>;
+                    pm_qos = <&qos_video_m0>;
+                    #power-domain-cells = <0>;
+                };
+                power-domain@RK3399_PD_VDU {
+                    reg = <RK3399_PD_VDU>;
+                    clocks = <&cru ACLK_VDU>,
+                             <&cru HCLK_VDU>;
+                    pm_qos = <&qos_video_m1_r>,
+                             <&qos_video_m1_w>;
+                    #power-domain-cells = <0>;
+                };
+                power-domain@RK3399_PD_VIO {
+                    reg = <RK3399_PD_VIO>;
+                    #power-domain-cells = <1>;
+                    #address-cells = <1>;
+                    #size-cells = <0>;
+
+                    power-domain@RK3399_PD_HDCP {
+                        reg = <RK3399_PD_HDCP>;
+                        clocks = <&cru ACLK_HDCP>,
+                                 <&cru HCLK_HDCP>,
+                                 <&cru PCLK_HDCP>;
+                        pm_qos = <&qos_hdcp>;
+                        #power-domain-cells = <0>;
+                    };
+                };
+            };
+        };
+    };
Documentation/devicetree/bindings/soc/rockchip/power_domain.txt deleted +0 -136

136 lines not on this page · raw message

Signature · 1 line
2.28.0
maintainer
#1 lore raw
Quoted 24 lines · Enric Balletbo i Serra

Convert the soc/rockchip/power_domain.txt binding document to json-schema and move to the power bindings directory.

---
Rob, I didn't add a number of clocks neither a number of pm_qos because will be a finger in the air number. If you still want I add it, I can add a number based on the actual users of this binding but no guarantee that we don't need to change that number in the future.

Changes in v4:
- Use hex for unit-addresses.
- Use space between compatibles in the example.
- Define child nodes for nested power domains even are duplicated but more clear that adding a regex scaped to be a valid URI.

Changes in v3:
- Fixed tab errors found by bot

Changes in v2:
- Fixed a warning that says that 'syscon' should not be used alone.
- Use patternProperties to define a new level for power-domains.
- Add const values for power-domain-cells, address-cells, etc.

Quoted 6 lines
 .../power/rockchip,power-controller.yaml      | 283 ++++++++++++++++++
 .../bindings/soc/rockchip/power_domain.txt    | 136 ---------
 2 files changed, 283 insertions(+), 136 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/power/rockchip,power-controller.yaml
 delete mode 100644 Documentation/devicetree/bindings/soc/rockchip/power_domain.txt

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

./Documentation/devicetree/bindings/power/rockchip,power-controller.yaml:61:13: [warning] wrong indentation: expected 10 but found 12 (indentation) ./Documentation/devicetree/bindings/power/rockchip,power-controller.yaml:106:17: [warning] wrong indentation: expected 14 but found 16 (indentation) ./Documentation/devicetree/bindings/power/rockchip,power-controller.yaml:138:21: [warning] wrong indentation: expected 18 but found 20 (indentation)

See https://patchwork.ozlabs.org/patch/1382558

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

pip3 install git+https://github.com/devicetree-org/dt-schema.git@master --upgrade

Please check and re-submit.

maintainer Reviewed-by on v4 1/1
#2 lore raw
In reply to Enric Balletbo i Serra
Quoted 24 lines · Enric Balletbo i Serra

Convert the soc/rockchip/power_domain.txt binding document to json-schema and move to the power bindings directory.

---
Rob, I didn't add a number of clocks neither a number of pm_qos because will be a finger in the air number. If you still want I add it, I can add a number based on the actual users of this binding but no guarantee that we don't need to change that number in the future.

Changes in v4:
- Use hex for unit-addresses.
- Use space between compatibles in the example.
- Define child nodes for nested power domains even are duplicated but more clear that adding a regex scaped to be a valid URI.

Changes in v3:
- Fixed tab errors found by bot

Changes in v2:
- Fixed a warning that says that 'syscon' should not be used alone.
- Use patternProperties to define a new level for power-domains.
- Add const values for power-domain-cells, address-cells, etc.

Quoted 5 lines
 .../power/rockchip,power-controller.yaml      | 283 ++++++++++++++++++
 .../bindings/soc/rockchip/power_domain.txt    | 136 ---------
 2 files changed, 283 insertions(+), 136 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/power/rockchip,power-controller.yaml
 delete mode 100644 Documentation/devicetree/bindings/soc/rockchip/power_domain.txt

With the indentation fixed,