aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLukasz Majewski <l.majewski@samsung.com>2015-01-23 07:14:20 -0500
committerEduardo Valentin <edubezval@gmail.com>2015-01-24 16:33:14 -0500
commite725d26c4857e5e41975b5e74e64ce6ab09a7121 (patch)
treec7fcd2f4a123a72363e35d1e98f9f333fd600135
parent1fe391bf0234add380245dea2dd72220394fe5fd (diff)
cpufreq: exynos: Use device tree to determine if cpufreq cooling should be registered
With thermal subsystem rework it is necessary to tune current cpufreq code to use cpu frequency change as a potential cooling device. Now the cpu cooling device is registered only when proper nodes and properties are available in device tree. Lack of them, however, will not prevent cpufreq for normal operation. Signed-off-by: Lukasz Majewski <l.majewski@samsung.com> Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
-rw-r--r--drivers/cpufreq/exynos-cpufreq.c33
1 files changed, 32 insertions, 1 deletions
diff --git a/drivers/cpufreq/exynos-cpufreq.c b/drivers/cpufreq/exynos-cpufreq.c
index f99a0b0b7c06..5e98c6b1f284 100644
--- a/drivers/cpufreq/exynos-cpufreq.c
+++ b/drivers/cpufreq/exynos-cpufreq.c
@@ -18,10 +18,13 @@
18#include <linux/cpufreq.h> 18#include <linux/cpufreq.h>
19#include <linux/platform_device.h> 19#include <linux/platform_device.h>
20#include <linux/of.h> 20#include <linux/of.h>
21#include <linux/cpu_cooling.h>
22#include <linux/cpu.h>
21 23
22#include "exynos-cpufreq.h" 24#include "exynos-cpufreq.h"
23 25
24static struct exynos_dvfs_info *exynos_info; 26static struct exynos_dvfs_info *exynos_info;
27static struct thermal_cooling_device *cdev;
25static struct regulator *arm_regulator; 28static struct regulator *arm_regulator;
26static unsigned int locking_frequency; 29static unsigned int locking_frequency;
27 30
@@ -156,6 +159,7 @@ static struct cpufreq_driver exynos_driver = {
156 159
157static int exynos_cpufreq_probe(struct platform_device *pdev) 160static int exynos_cpufreq_probe(struct platform_device *pdev)
158{ 161{
162 struct device_node *cpus, *np;
159 int ret = -EINVAL; 163 int ret = -EINVAL;
160 164
161 exynos_info = kzalloc(sizeof(*exynos_info), GFP_KERNEL); 165 exynos_info = kzalloc(sizeof(*exynos_info), GFP_KERNEL);
@@ -198,9 +202,36 @@ static int exynos_cpufreq_probe(struct platform_device *pdev)
198 /* Done here as we want to capture boot frequency */ 202 /* Done here as we want to capture boot frequency */
199 locking_frequency = clk_get_rate(exynos_info->cpu_clk) / 1000; 203 locking_frequency = clk_get_rate(exynos_info->cpu_clk) / 1000;
200 204
201 if (!cpufreq_register_driver(&exynos_driver)) 205 ret = cpufreq_register_driver(&exynos_driver);
206 if (ret)
207 goto err_cpufreq_reg;
208
209 cpus = of_find_node_by_path("/cpus");
210 if (!cpus) {
211 pr_err("failed to find cpus node\n");
212 return 0;
213 }
214
215 np = of_get_next_child(cpus, NULL);
216 if (!np) {
217 pr_err("failed to find cpus child node\n");
218 of_node_put(cpus);
202 return 0; 219 return 0;
220 }
221
222 if (of_find_property(np, "#cooling-cells", NULL)) {
223 cdev = of_cpufreq_cooling_register(np,
224 cpu_present_mask);
225 if (IS_ERR(cdev))
226 pr_err("running cpufreq without cooling device: %ld\n",
227 PTR_ERR(cdev));
228 }
229 of_node_put(np);
230 of_node_put(cpus);
231
232 return 0;
203 233
234err_cpufreq_reg:
204 dev_err(&pdev->dev, "failed to register cpufreq driver\n"); 235 dev_err(&pdev->dev, "failed to register cpufreq driver\n");
205 regulator_put(arm_regulator); 236 regulator_put(arm_regulator);
206err_vdd_arm: 237err_vdd_arm: