aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpi-cheng.chen <pi-cheng.chen@linaro.org>2015-03-06 10:55:52 +0800
committerVincent Guittot <vincent.guittot@linaro.org>2015-04-16 11:53:23 +0200
commitfa1c0fbbc19026c97aafb22a01bbc9e6af96e71a (patch)
tree05e7e0e4f84754315b73c91c24e797db20cfe950
parent4882535501f6bc7cf18df3bc356d86f93bf89b87 (diff)
cpufreq-dt: add clock domain support
Signed-off-by: pi-cheng.chen <pi-cheng.chen@linaro.org>
-rw-r--r--drivers/cpufreq/cpufreq-dt.c14
-rw-r--r--include/linux/cpufreq-dt.h11
2 files changed, 25 insertions, 0 deletions
diff --git a/drivers/cpufreq/cpufreq-dt.c b/drivers/cpufreq/cpufreq-dt.c
index bab67db54b7e..c6386fe701ef 100644
--- a/drivers/cpufreq/cpufreq-dt.c
+++ b/drivers/cpufreq/cpufreq-dt.c
@@ -296,6 +296,20 @@ static int cpufreq_init(struct cpufreq_policy *policy)
pd = cpufreq_get_driver_data();
if (!pd || !pd->independent_clocks)
cpumask_setall(policy->cpus);
+ else if (pd && !list_empty(&pd->domain_list)) {
+ struct list_head *domain_node;
+ struct cpufreq_cpu_domain *domain;
+
+ list_for_each(domain_node, &pd->domain_list) {
+ domain = container_of(domain_node,
+ struct cpufreq_cpu_domain, node);
+ if (!cpumask_test_cpu(policy->cpu, &domain->cpus))
+ continue;
+
+ cpumask_copy(policy->cpus, &domain->cpus);
+ break;
+ }
+ }
of_node_put(np);
diff --git a/include/linux/cpufreq-dt.h b/include/linux/cpufreq-dt.h
index 0414009e2c30..a37df9aab3ce 100644
--- a/include/linux/cpufreq-dt.h
+++ b/include/linux/cpufreq-dt.h
@@ -10,6 +10,12 @@
#ifndef __CPUFREQ_DT_H__
#define __CPUFREQ_DT_H__
+struct cpufreq_cpu_domain {
+ struct list_head node;
+ /* CPUs share the same clock/power domain */
+ cpumask_t cpus;
+};
+
struct cpufreq_dt_platform_data {
/*
* True when each CPU has its own clock to control its
@@ -17,6 +23,11 @@ struct cpufreq_dt_platform_data {
* clock.
*/
bool independent_clocks;
+ /*
+ * Specify a list of CPU domains in which all CPUs inside shares
+ * the same clock and power source when independent_clocks is true.
+ */
+ struct list_head domain_list;
};
#endif /* __CPUFREQ_DT_H__ */