aboutsummaryrefslogtreecommitdiff
path: root/drivers/cpufreq/cpufreq-cpu0.c
diff options
context:
space:
mode:
authorZhang Rui <rui.zhang@intel.com>2014-01-02 09:39:36 +0800
committerZhang Rui <rui.zhang@intel.com>2014-01-02 09:39:36 +0800
commitc1b7bac58fb0d251f86efe7daec1a2851b7792bf (patch)
tree55b7f7e601dbfb7215f16ff3cfe0496b2d47e345 /drivers/cpufreq/cpufreq-cpu0.c
parentdea4f48a0a301b23c65af8e4fe8ccf360c272fbf (diff)
parent1beabfbea3a8648575afe04f6f3ddf107c240fb0 (diff)
Merge branch 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/evalenti/linux-soc-thermal into soc-thermal
Diffstat (limited to 'drivers/cpufreq/cpufreq-cpu0.c')
-rw-r--r--drivers/cpufreq/cpufreq-cpu0.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/drivers/cpufreq/cpufreq-cpu0.c b/drivers/cpufreq/cpufreq-cpu0.c
index d4585ce2346..91c7bb67bc7 100644
--- a/drivers/cpufreq/cpufreq-cpu0.c
+++ b/drivers/cpufreq/cpufreq-cpu0.c
@@ -13,7 +13,9 @@
#include <linux/clk.h>
#include <linux/cpu.h>
+#include <linux/cpu_cooling.h>
#include <linux/cpufreq.h>
+#include <linux/cpumask.h>
#include <linux/err.h>
#include <linux/module.h>
#include <linux/of.h>
@@ -21,6 +23,7 @@
#include <linux/platform_device.h>
#include <linux/regulator/consumer.h>
#include <linux/slab.h>
+#include <linux/thermal.h>
static unsigned int transition_latency;
static unsigned int voltage_tolerance; /* in percentage */
@@ -29,6 +32,7 @@ static struct device *cpu_dev;
static struct clk *cpu_clk;
static struct regulator *cpu_reg;
static struct cpufreq_frequency_table *freq_table;
+static struct thermal_cooling_device *cdev;
static unsigned int cpu0_get_speed(unsigned int cpu)
{
@@ -201,6 +205,17 @@ static int cpu0_cpufreq_probe(struct platform_device *pdev)
goto out_free_table;
}
+ /*
+ * For now, just loading the cooling device;
+ * thermal DT code takes care of matching them.
+ */
+ if (of_find_property(np, "#cooling-cells", NULL)) {
+ cdev = of_cpufreq_cooling_register(np, cpu_present_mask);
+ if (IS_ERR(cdev))
+ pr_err("running cpufreq without cooling device: %ld\n",
+ PTR_ERR(cdev));
+ }
+
of_node_put(np);
return 0;
@@ -213,6 +228,7 @@ out_put_node:
static int cpu0_cpufreq_remove(struct platform_device *pdev)
{
+ cpufreq_cooling_unregister(cdev);
cpufreq_unregister_driver(&cpu0_cpufreq_driver);
dev_pm_opp_free_cpufreq_table(cpu_dev, &freq_table);