aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/cpufreq
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/cpufreq')
-rw-r--r--drivers/cpufreq/Kconfig2
-rw-r--r--drivers/cpufreq/cpufreq-cpu0.c16
2 files changed, 17 insertions, 1 deletions
diff --git a/drivers/cpufreq/Kconfig b/drivers/cpufreq/Kconfig
index d100926aca0a..4b029c0944af 100644
--- a/drivers/cpufreq/Kconfig
+++ b/drivers/cpufreq/Kconfig
@@ -185,7 +185,7 @@ config CPU_FREQ_GOV_CONSERVATIVE
185 185
186config GENERIC_CPUFREQ_CPU0 186config GENERIC_CPUFREQ_CPU0
187 tristate "Generic CPU0 cpufreq driver" 187 tristate "Generic CPU0 cpufreq driver"
188 depends on HAVE_CLK && REGULATOR && OF 188 depends on HAVE_CLK && REGULATOR && OF && THERMAL && CPU_THERMAL
189 select PM_OPP 189 select PM_OPP
190 help 190 help
191 This adds a generic cpufreq driver for CPU0 frequency management. 191 This adds a generic cpufreq driver for CPU0 frequency management.
diff --git a/drivers/cpufreq/cpufreq-cpu0.c b/drivers/cpufreq/cpufreq-cpu0.c
index bb7b3082efb3..0c12ffc0ebcb 100644
--- a/drivers/cpufreq/cpufreq-cpu0.c
+++ b/drivers/cpufreq/cpufreq-cpu0.c
@@ -13,7 +13,9 @@
13 13
14#include <linux/clk.h> 14#include <linux/clk.h>
15#include <linux/cpu.h> 15#include <linux/cpu.h>
16#include <linux/cpu_cooling.h>
16#include <linux/cpufreq.h> 17#include <linux/cpufreq.h>
18#include <linux/cpumask.h>
17#include <linux/err.h> 19#include <linux/err.h>
18#include <linux/module.h> 20#include <linux/module.h>
19#include <linux/of.h> 21#include <linux/of.h>
@@ -21,6 +23,7 @@
21#include <linux/platform_device.h> 23#include <linux/platform_device.h>
22#include <linux/regulator/consumer.h> 24#include <linux/regulator/consumer.h>
23#include <linux/slab.h> 25#include <linux/slab.h>
26#include <linux/thermal.h>
24 27
25static unsigned int transition_latency; 28static unsigned int transition_latency;
26static unsigned int voltage_tolerance; /* in percentage */ 29static unsigned int voltage_tolerance; /* in percentage */
@@ -29,6 +32,7 @@ static struct device *cpu_dev;
29static struct clk *cpu_clk; 32static struct clk *cpu_clk;
30static struct regulator *cpu_reg; 33static struct regulator *cpu_reg;
31static struct cpufreq_frequency_table *freq_table; 34static struct cpufreq_frequency_table *freq_table;
35static struct thermal_cooling_device *cdev;
32 36
33static int cpu0_set_target(struct cpufreq_policy *policy, unsigned int index) 37static int cpu0_set_target(struct cpufreq_policy *policy, unsigned int index)
34{ 38{
@@ -197,6 +201,17 @@ static int cpu0_cpufreq_probe(struct platform_device *pdev)
197 goto out_free_table; 201 goto out_free_table;
198 } 202 }
199 203
204 /*
205 * For now, just loading the cooling device;
206 * thermal DT code takes care of matching them.
207 */
208 if (of_find_property(np, "#cooling-cells", NULL)) {
209 cdev = of_cpufreq_cooling_register(np, cpu_present_mask);
210 if (IS_ERR(cdev))
211 pr_err("running cpufreq without cooling device: %ld\n",
212 PTR_ERR(cdev));
213 }
214
200 of_node_put(np); 215 of_node_put(np);
201 return 0; 216 return 0;
202 217
@@ -209,6 +224,7 @@ out_put_node:
209 224
210static int cpu0_cpufreq_remove(struct platform_device *pdev) 225static int cpu0_cpufreq_remove(struct platform_device *pdev)
211{ 226{
227 cpufreq_cooling_unregister(cdev);
212 cpufreq_unregister_driver(&cpu0_cpufreq_driver); 228 cpufreq_unregister_driver(&cpu0_cpufreq_driver);
213 dev_pm_opp_free_cpufreq_table(cpu_dev, &freq_table); 229 dev_pm_opp_free_cpufreq_table(cpu_dev, &freq_table);
214 230