diff mbox series

[RFC,v2,03/19] dt-bindings: power: thead,th1520: Add support for power domains

Message ID 20241223125553.3527812-4-m.wilczynski@samsung.com (mailing list archive)
State New
Headers show
Series [RFC,v2,01/19] dt-bindings: clock: Add VO subsystem clocks and update address requirements | expand

Commit Message

Michal Wilczynski Dec. 23, 2024, 12:55 p.m. UTC
Introduce a device tree binding for the T-HEAD TH1520 power domain
controller. This allows devices to specify their power domain
dependencies, thereby improving power management for subsystems such as
the GPU. The new YAML schema describes the power domain node for the
T-HEAD TH1520 SoC.

Signed-off-by: Michal Wilczynski <m.wilczynski@samsung.com>
---
 .../bindings/power/thead,th1520-power.yaml    | 42 +++++++++++++++++++
 MAINTAINERS                                   |  1 +
 .../dt-bindings/power/thead,th1520-power.h    | 18 ++++++++
 3 files changed, 61 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/power/thead,th1520-power.yaml
 create mode 100644 include/dt-bindings/power/thead,th1520-power.h

Comments

Michal Wilczynski Dec. 23, 2024, 4:02 p.m. UTC | #1
On 12/23/24 16:16, Rob Herring (Arm) wrote:
> 
> On Mon, 23 Dec 2024 13:55:37 +0100, Michal Wilczynski wrote:
>> Introduce a device tree binding for the T-HEAD TH1520 power domain
>> controller. This allows devices to specify their power domain
>> dependencies, thereby improving power management for subsystems such as
>> the GPU. The new YAML schema describes the power domain node for the
>> T-HEAD TH1520 SoC.
>>
>> Signed-off-by: Michal Wilczynski <m.wilczynski@samsung.com>
>> ---
>>  .../bindings/power/thead,th1520-power.yaml    | 42 +++++++++++++++++++
>>  MAINTAINERS                                   |  1 +
>>  .../dt-bindings/power/thead,th1520-power.h    | 18 ++++++++
>>  3 files changed, 61 insertions(+)
>>  create mode 100644 Documentation/devicetree/bindings/power/thead,th1520-power.yaml
>>  create mode 100644 include/dt-bindings/power/thead,th1520-power.h
>>
> 
> My bot found errors running 'make dt_binding_check' on your patch:
> 
> yamllint warnings/errors:
> 
> dtschema/dtc warnings/errors:
> Documentation/devicetree/bindings/power/thead,th1520-power.example.dtb: /example-0/firmware/aon: failed to match any schema with compatible: ['thead,th1520-aon']

It is introduced in the next commit in this patch series.
Krzysztof Kozlowski Dec. 23, 2024, 4:06 p.m. UTC | #2
On 23/12/2024 17:02, Michal Wilczynski wrote:
>>>  .../bindings/power/thead,th1520-power.yaml    | 42 +++++++++++++++++++
>>>  MAINTAINERS                                   |  1 +
>>>  .../dt-bindings/power/thead,th1520-power.h    | 18 ++++++++
>>>  3 files changed, 61 insertions(+)
>>>  create mode 100644 Documentation/devicetree/bindings/power/thead,th1520-power.yaml
>>>  create mode 100644 include/dt-bindings/power/thead,th1520-power.h
>>>
>>
>> My bot found errors running 'make dt_binding_check' on your patch:
>>
>> yamllint warnings/errors:
>>
>> dtschema/dtc warnings/errors:
>> Documentation/devicetree/bindings/power/thead,th1520-power.example.dtb: /example-0/firmware/aon: failed to match any schema with compatible: ['thead,th1520-aon']
> 
> It is introduced in the next commit in this patch series.

Then your patchset is not bisectable. Reorder patches.

Best regards,
Krzysztof
Krzysztof Kozlowski Dec. 23, 2024, 4:09 p.m. UTC | #3
On 23/12/2024 13:55, Michal Wilczynski wrote:
> +  compatible:
> +    const: thead,th1520-pd
> +
> +  "#power-domain-cells":
> +    const: 1
> +
> +additionalProperties: false
> +
> +required:
> +  - compatible
> +  - "#power-domain-cells"
> +
> +examples:
> +  - |
> +    firmware {

Drop

> +        aon: aon {
> +            compatible = "thead,th1520-aon";
> +            mboxes = <&mbox_910t 1>;
> +            mbox-names = "aon";

Drop aon node... but the main problem is you do not have any resources
in your power-domain device node, assuming your binding is complete.
This suggests that this is part of aon, not separate device. Fold the
device node into its parent (so everything goes to AON).

> +
> +            pd: power-domain {
> +                compatible = "thead,th1520-pd";
> +                #power-domain-cells = <1>;
> +            };
> +        };
> +    };

Best regards,
Krzysztof
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/power/thead,th1520-power.yaml b/Documentation/devicetree/bindings/power/thead,th1520-power.yaml
new file mode 100644
index 000000000000..28ff86f2cb05
--- /dev/null
+++ b/Documentation/devicetree/bindings/power/thead,th1520-power.yaml
@@ -0,0 +1,42 @@ 
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/power/thead,th1520-power.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: T-HEAD TH1520 Power Domain
+
+description: |
+  The T-HEAD TH1520 SoC includes a power domain controller responsible for
+  managing the power states of various hardware domains such as the GPU.
+
+maintainers:
+  - Michal Wilczynski <m.wilczynski@samsung.com>
+
+properties:
+  compatible:
+    const: thead,th1520-pd
+
+  "#power-domain-cells":
+    const: 1
+
+additionalProperties: false
+
+required:
+  - compatible
+  - "#power-domain-cells"
+
+examples:
+  - |
+    firmware {
+        aon: aon {
+            compatible = "thead,th1520-aon";
+            mboxes = <&mbox_910t 1>;
+            mbox-names = "aon";
+
+            pd: power-domain {
+                compatible = "thead,th1520-pd";
+                #power-domain-cells = <1>;
+            };
+        };
+    };
diff --git a/MAINTAINERS b/MAINTAINERS
index 910305c11e8a..c0e9639ac210 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -20192,6 +20192,7 @@  F:	Documentation/devicetree/bindings/clock/thead,th1520-clk-ap.yaml
 F:	Documentation/devicetree/bindings/mailbox/thead,th1520-mbox.yaml
 F:	Documentation/devicetree/bindings/net/thead,th1520-gmac.yaml
 F:	Documentation/devicetree/bindings/pinctrl/thead,th1520-pinctrl.yaml
+F:	Documentation/devicetree/bindings/power/thead,th1520-power.yaml
 F:	arch/riscv/boot/dts/thead/
 F:	drivers/clk/thead/clk-th1520-ap.c
 F:	drivers/mailbox/mailbox-th1520.c
diff --git a/include/dt-bindings/power/thead,th1520-power.h b/include/dt-bindings/power/thead,th1520-power.h
new file mode 100644
index 000000000000..45835f25010d
--- /dev/null
+++ b/include/dt-bindings/power/thead,th1520-power.h
@@ -0,0 +1,18 @@ 
+/* SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) */
+/*
+ * Copyright (C) 2022 Alibaba Group Holding Limited.
+ * Copyright (c) 2024 Samsung Electronics Co., Ltd.
+ * Author: Michal Wilczynski <m.wilczynski@samsung.com>
+ */
+
+#ifndef __DT_BINDINGS_POWER_TH1520_H
+#define __DT_BINDINGS_POWER_TH1520_H
+
+#define TH1520_AON_VDEC_PD	1
+#define TH1520_AON_NPU_PD	2
+#define TH1520_AON_VENC_PD	3
+#define TH1520_AON_GPU_PD	4
+#define TH1520_AON_DSP0_PD	5
+#define TH1520_AON_DSP1_PD	6
+
+#endif