aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Petazzoni <thomas.petazzoni@free-electrons.com>2014-10-19 05:30:28 -0400
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2014-10-20 18:51:01 -0400
commit34e5a5273d6aa0ee8836bd5d6111b135ffae6931 (patch)
tree7317dc2b6efc5e4f407be166f652ee51c54d4340
parent51315cdfa0521fff3059cec5fb8ffecc7f37cba7 (diff)
cpufreq: cpufreq-dt: extend with platform_data
This commit extends the cpufreq-dt driver to take a platform_data structure. This structure is for now used to tell the cpufreq-dt driver the layout of the clocks on the platform, i.e whether all CPUs share the same clock or whether each CPU has a separate clock. Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com> Acked-by: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
-rw-r--r--drivers/cpufreq/cpufreq-dt.c17
-rw-r--r--include/linux/cpufreq-dt.h22
2 files changed, 37 insertions, 2 deletions
diff --git a/drivers/cpufreq/cpufreq-dt.c b/drivers/cpufreq/cpufreq-dt.c
index 6bbb8b913446..52facdaf531e 100644
--- a/drivers/cpufreq/cpufreq-dt.c
+++ b/drivers/cpufreq/cpufreq-dt.c
@@ -18,6 +18,7 @@
18#include <linux/cpu.h> 18#include <linux/cpu.h>
19#include <linux/cpu_cooling.h> 19#include <linux/cpu_cooling.h>
20#include <linux/cpufreq.h> 20#include <linux/cpufreq.h>
21#include <linux/cpufreq-dt.h>
21#include <linux/cpumask.h> 22#include <linux/cpumask.h>
22#include <linux/err.h> 23#include <linux/err.h>
23#include <linux/module.h> 24#include <linux/module.h>
@@ -178,6 +179,7 @@ try_again:
178 179
179static int cpufreq_init(struct cpufreq_policy *policy) 180static int cpufreq_init(struct cpufreq_policy *policy)
180{ 181{
182 struct cpufreq_dt_platform_data *pd;
181 struct cpufreq_frequency_table *freq_table; 183 struct cpufreq_frequency_table *freq_table;
182 struct thermal_cooling_device *cdev; 184 struct thermal_cooling_device *cdev;
183 struct device_node *np; 185 struct device_node *np;
@@ -265,9 +267,18 @@ static int cpufreq_init(struct cpufreq_policy *policy)
265 policy->driver_data = priv; 267 policy->driver_data = priv;
266 268
267 policy->clk = cpu_clk; 269 policy->clk = cpu_clk;
268 ret = cpufreq_generic_init(policy, freq_table, transition_latency); 270 ret = cpufreq_table_validate_and_show(policy, freq_table);
269 if (ret) 271 if (ret) {
272 dev_err(cpu_dev, "%s: invalid frequency table: %d\n", __func__,
273 ret);
270 goto out_cooling_unregister; 274 goto out_cooling_unregister;
275 }
276
277 policy->cpuinfo.transition_latency = transition_latency;
278
279 pd = cpufreq_get_driver_data();
280 if (pd && !pd->independent_clocks)
281 cpumask_setall(policy->cpus);
271 282
272 of_node_put(np); 283 of_node_put(np);
273 284
@@ -335,6 +346,8 @@ static int dt_cpufreq_probe(struct platform_device *pdev)
335 if (!IS_ERR(cpu_reg)) 346 if (!IS_ERR(cpu_reg))
336 regulator_put(cpu_reg); 347 regulator_put(cpu_reg);
337 348
349 dt_cpufreq_driver.driver_data = dev_get_platdata(&pdev->dev);
350
338 ret = cpufreq_register_driver(&dt_cpufreq_driver); 351 ret = cpufreq_register_driver(&dt_cpufreq_driver);
339 if (ret) 352 if (ret)
340 dev_err(cpu_dev, "failed register driver: %d\n", ret); 353 dev_err(cpu_dev, "failed register driver: %d\n", ret);
diff --git a/include/linux/cpufreq-dt.h b/include/linux/cpufreq-dt.h
new file mode 100644
index 000000000000..0414009e2c30
--- /dev/null
+++ b/include/linux/cpufreq-dt.h
@@ -0,0 +1,22 @@
1/*
2 * Copyright (C) 2014 Marvell
3 * Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation.
8 */
9
10#ifndef __CPUFREQ_DT_H__
11#define __CPUFREQ_DT_H__
12
13struct cpufreq_dt_platform_data {
14 /*
15 * True when each CPU has its own clock to control its
16 * frequency, false when all CPUs are controlled by a single
17 * clock.
18 */
19 bool independent_clocks;
20};
21
22#endif /* __CPUFREQ_DT_H__ */