The RK3588 has three CPU frequency domains, with CPUs grouped into
three cpufreq policies.

Add a DTPM hierarchy for the RK3588 with one CPU node per cpufreq
policy, represented by cpu@0, cpu@400 and cpu@600. Group the three CPU
domains under a virtual package node attached to the RK3588 root node.

Add the RK3588 compatible to the Rockchip DTPM match table to select
the new hierarchy.

Signed-off-by: Daniel Lezcano <[email protected]>
---
 drivers/soc/rockchip/dtpm.c | 48 +++++++++++++++++++++++++++++++++++++
 1 file changed, 48 insertions(+)

diff --git a/drivers/soc/rockchip/dtpm.c b/drivers/soc/rockchip/dtpm.c
index 5f7f238a15fe..3d9367d05803 100644
--- a/drivers/soc/rockchip/dtpm.c
+++ b/drivers/soc/rockchip/dtpm.c
@@ -62,8 +62,56 @@ static struct powercap_hierarchy __initdata rk3399_hierarchy 
= {
        .nr_nodes = ARRAY_SIZE(rk3399_nodes),
 };
 
+static struct dtpm_node rk3588_cpu0 = {
+       .type = DTPM_NODE_DT,
+       .path = "/cpus/cpu@0",
+};
+
+static struct dtpm_node rk3588_cpu4 = {
+       .type = DTPM_NODE_DT,
+       .path = "/cpus/cpu@400",
+};
+
+static struct dtpm_node rk3588_cpu6 = {
+       .type = DTPM_NODE_DT,
+       .path = "/cpus/cpu@600",
+};
+
+static struct powercap_node __initdata rk3588_nodes[] = {
+       [0] = {
+               .name = "rk3588",
+               .data = &rockchip_virtual,
+       },
+       [1] = {
+               .name = "package",
+               .parent = &rk3588_nodes[0],
+               .data = &rockchip_virtual,
+       },
+       [2] = {
+               .name = "cpu0-cpufreq",
+               .parent = &rk3588_nodes[1],
+               .data = &rk3588_cpu0,
+       },
+       [3] = {
+               .name = "cpu4-cpufreq",
+               .parent = &rk3588_nodes[1],
+               .data = &rk3588_cpu4,
+       },
+       [4] = {
+               .name = "cpu6-cpufreq",
+               .parent = &rk3588_nodes[1],
+               .data = &rk3588_cpu6,
+       },
+};
+
+static struct powercap_hierarchy __initdata rk3588_hierarchy = {
+       .nodes = rk3588_nodes,
+       .nr_nodes = ARRAY_SIZE(rk3588_nodes),
+};
+
 static struct of_device_id __initdata rockchip_dtpm_match_table[] = {
         { .compatible = "rockchip,rk3399", .data = &rk3399_hierarchy },
+        { .compatible = "rockchip,rk3588", .data = &rk3588_hierarchy },
         {},
 };
 
-- 
2.43.0


Reply via email to