diff options
author | Zhang Rui <rui.zhang@intel.com> | 2017-07-05 09:51:32 +0300 |
---|---|---|
committer | Zhang Rui <rui.zhang@intel.com> | 2017-07-05 09:51:32 +0300 |
commit | 467aebee872af7f5e703809e19a66de633a1aa2c (patch) | |
tree | 21a80e16c5e7a3c1d34c60fb6f6274eb9e6c1347 /drivers/thermal/ti-soc-thermal | |
parent | c0bc126f97fb929b3ae02c1c62322645d70eb408 (diff) | |
parent | 1fe3854a83b580727c9464b37b62ba77ead1d6f6 (diff) | |
download | linux-467aebee872af7f5e703809e19a66de633a1aa2c.tar.xz |
Merge branch 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/evalenti/linux-soc-thermal into thermal-soc
Diffstat (limited to 'drivers/thermal/ti-soc-thermal')
-rw-r--r-- | drivers/thermal/ti-soc-thermal/ti-thermal-common.c | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/drivers/thermal/ti-soc-thermal/ti-thermal-common.c b/drivers/thermal/ti-soc-thermal/ti-thermal-common.c index 02790f69e26c..c211a8e4a210 100644 --- a/drivers/thermal/ti-soc-thermal/ti-thermal-common.c +++ b/drivers/thermal/ti-soc-thermal/ti-thermal-common.c @@ -28,6 +28,7 @@ #include <linux/kernel.h> #include <linux/workqueue.h> #include <linux/thermal.h> +#include <linux/cpufreq.h> #include <linux/cpumask.h> #include <linux/cpu_cooling.h> #include <linux/of.h> @@ -37,6 +38,7 @@ /* common data structures */ struct ti_thermal_data { + struct cpufreq_policy *policy; struct thermal_zone_device *ti_thermal; struct thermal_zone_device *pcb_tz; struct thermal_cooling_device *cool_dev; @@ -247,15 +249,19 @@ int ti_thermal_register_cpu_cooling(struct ti_bandgap *bgp, int id) if (!data) return -EINVAL; + data->policy = cpufreq_cpu_get(0); + if (!data->policy) { + pr_debug("%s: CPUFreq policy not found\n", __func__); + return -EPROBE_DEFER; + } + /* Register cooling device */ - data->cool_dev = cpufreq_cooling_register(cpu_present_mask); + data->cool_dev = cpufreq_cooling_register(data->policy); if (IS_ERR(data->cool_dev)) { int ret = PTR_ERR(data->cool_dev); - - if (ret != -EPROBE_DEFER) - dev_err(bgp->dev, - "Failed to register cpu cooling device %d\n", - ret); + dev_err(bgp->dev, "Failed to register cpu cooling device %d\n", + ret); + cpufreq_cpu_put(data->policy); return ret; } @@ -270,8 +276,10 @@ int ti_thermal_unregister_cpu_cooling(struct ti_bandgap *bgp, int id) data = ti_bandgap_get_sensor_data(bgp, id); - if (data) + if (data) { cpufreq_cooling_unregister(data->cool_dev); + cpufreq_cpu_put(data->policy); + } return 0; } |