UPSTREAM: cpufreq: scmi: Add support to parse domain-id using #power-domain-cells

The performance domain-id can be described in DT using the power-domains
property or the clock property. The latter is already supported, so let's
add support for the power-domains too.

Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Link: https://lore.kernel.org/r/20230825112633.236607-12-ulf.hansson@linaro.org
Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>

Bug: 323966425
Change-Id: Ie5acc6a7ca1528064779700aa71a6c6cef7f0139
(cherry picked from commit 92b2028b00ff987272a10fee980c7412ae7ebea6)
Signed-off-by: Nikunj Kela <quic_nkela@quicinc.com>
Signed-off-by: Anant Goel <quic_anantg@quicinc.com>
This commit is contained in:
Ulf Hansson
2023-08-25 13:26:31 +02:00
committed by Anant Goel
parent 0ccb8d6efa
commit c638aef4e9

View File

@@ -72,13 +72,25 @@ static unsigned int scmi_cpufreq_fast_switch(struct cpufreq_policy *policy,
static int scmi_cpu_domain_id(struct device *cpu_dev) static int scmi_cpu_domain_id(struct device *cpu_dev)
{ {
struct of_phandle_args clkspec; struct device_node *np = cpu_dev->of_node;
struct of_phandle_args domain_id;
int index;
if (of_parse_phandle_with_args(cpu_dev->of_node, "clocks", if (of_parse_phandle_with_args(np, "clocks", "#clock-cells", 0,
"#clock-cells", 0, &clkspec)) &domain_id)) {
return -EINVAL; /* Find the corresponding index for power-domain "perf". */
index = of_property_match_string(np, "power-domain-names",
"perf");
if (index < 0)
return -EINVAL;
return clkspec.args[0]; if (of_parse_phandle_with_args(np, "power-domains",
"#power-domain-cells", index,
&domain_id))
return -EINVAL;
}
return domain_id.args[0];
} }
static int static int