mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-04-02 09:21:19 -04:00
cpufreq: scmi: Prepare to move OF parsing of domain-id to cpufreq
The OF parsing of the clock domain specifier seems to better belong in the scmi cpufreq driver, rather than being implemented behind the generic ->device_domain_id() perf protocol ops. To prepare to remove the ->device_domain_id() ops, let's implement the OF parsing in the scmi cpufreq driver instead. 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-4-ulf.hansson@linaro.org Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
This commit is contained in:
committed by
Sudeep Holla
parent
3d99ed6072
commit
e336baa419
@@ -70,13 +70,24 @@ static unsigned int scmi_cpufreq_fast_switch(struct cpufreq_policy *policy,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int scmi_cpu_domain_id(struct device *cpu_dev)
|
||||
{
|
||||
struct of_phandle_args clkspec;
|
||||
|
||||
if (of_parse_phandle_with_args(cpu_dev->of_node, "clocks",
|
||||
"#clock-cells", 0, &clkspec))
|
||||
return -EINVAL;
|
||||
|
||||
return clkspec.args[0];
|
||||
}
|
||||
|
||||
static int
|
||||
scmi_get_sharing_cpus(struct device *cpu_dev, struct cpumask *cpumask)
|
||||
{
|
||||
int cpu, domain, tdomain;
|
||||
struct device *tcpu_dev;
|
||||
|
||||
domain = perf_ops->device_domain_id(cpu_dev);
|
||||
domain = scmi_cpu_domain_id(cpu_dev);
|
||||
if (domain < 0)
|
||||
return domain;
|
||||
|
||||
@@ -88,7 +99,7 @@ scmi_get_sharing_cpus(struct device *cpu_dev, struct cpumask *cpumask)
|
||||
if (!tcpu_dev)
|
||||
continue;
|
||||
|
||||
tdomain = perf_ops->device_domain_id(tcpu_dev);
|
||||
tdomain = scmi_cpu_domain_id(tcpu_dev);
|
||||
if (tdomain == domain)
|
||||
cpumask_set_cpu(cpu, cpumask);
|
||||
}
|
||||
@@ -104,7 +115,7 @@ scmi_get_cpu_power(struct device *cpu_dev, unsigned long *power,
|
||||
unsigned long Hz;
|
||||
int ret, domain;
|
||||
|
||||
domain = perf_ops->device_domain_id(cpu_dev);
|
||||
domain = scmi_cpu_domain_id(cpu_dev);
|
||||
if (domain < 0)
|
||||
return domain;
|
||||
|
||||
@@ -209,7 +220,7 @@ static int scmi_cpufreq_init(struct cpufreq_policy *policy)
|
||||
}
|
||||
|
||||
priv->cpu_dev = cpu_dev;
|
||||
priv->domain_id = perf_ops->device_domain_id(cpu_dev);
|
||||
priv->domain_id = scmi_cpu_domain_id(cpu_dev);
|
||||
|
||||
policy->driver_data = priv;
|
||||
policy->freq_table = freq_table;
|
||||
|
||||
Reference in New Issue
Block a user