Commit 32c9edc4 authored by Zhang Rui's avatar Zhang Rui

Merge branch 'fixes' of...

Merge branch 'fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/evalenti/linux-soc-thermal into thermal-soc
parents 59c56eb6 503ccc3f
This diff is collapsed.
...@@ -18,7 +18,6 @@ ...@@ -18,7 +18,6 @@
*/ */
#include <linux/cpu_cooling.h> #include <linux/cpu_cooling.h>
#include <linux/cpufreq.h>
#include <linux/err.h> #include <linux/err.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/of.h> #include <linux/of.h>
...@@ -28,18 +27,17 @@ ...@@ -28,18 +27,17 @@
static int db8500_cpufreq_cooling_probe(struct platform_device *pdev) static int db8500_cpufreq_cooling_probe(struct platform_device *pdev)
{ {
struct thermal_cooling_device *cdev; struct thermal_cooling_device *cdev;
struct cpumask mask_val;
/* make sure cpufreq driver has been initialized */ cdev = cpufreq_cooling_register(cpu_present_mask);
if (!cpufreq_frequency_get_table(0)) if (IS_ERR(cdev)) {
return -EPROBE_DEFER; int ret = PTR_ERR(cdev);
cpumask_set_cpu(0, &mask_val); if (ret != -EPROBE_DEFER)
cdev = cpufreq_cooling_register(&mask_val); dev_err(&pdev->dev,
"Failed to register cooling device %d\n",
ret);
if (IS_ERR(cdev)) { return ret;
dev_err(&pdev->dev, "Failed to register cooling device\n");
return PTR_ERR(cdev);
} }
platform_set_drvdata(pdev, cdev); platform_set_drvdata(pdev, cdev);
......
...@@ -9,7 +9,6 @@ ...@@ -9,7 +9,6 @@
#include <linux/clk.h> #include <linux/clk.h>
#include <linux/cpu_cooling.h> #include <linux/cpu_cooling.h>
#include <linux/cpufreq.h>
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/device.h> #include <linux/device.h>
#include <linux/init.h> #include <linux/init.h>
...@@ -454,15 +453,10 @@ static int imx_thermal_probe(struct platform_device *pdev) ...@@ -454,15 +453,10 @@ static int imx_thermal_probe(struct platform_device *pdev)
const struct of_device_id *of_id = const struct of_device_id *of_id =
of_match_device(of_imx_thermal_match, &pdev->dev); of_match_device(of_imx_thermal_match, &pdev->dev);
struct imx_thermal_data *data; struct imx_thermal_data *data;
struct cpumask clip_cpus;
struct regmap *map; struct regmap *map;
int measure_freq; int measure_freq;
int ret; int ret;
if (!cpufreq_get_current_driver()) {
dev_dbg(&pdev->dev, "no cpufreq driver!");
return -EPROBE_DEFER;
}
data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL); data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL);
if (!data) if (!data)
return -ENOMEM; return -ENOMEM;
...@@ -516,12 +510,13 @@ static int imx_thermal_probe(struct platform_device *pdev) ...@@ -516,12 +510,13 @@ static int imx_thermal_probe(struct platform_device *pdev)
regmap_write(map, MISC0 + REG_SET, MISC0_REFTOP_SELBIASOFF); regmap_write(map, MISC0 + REG_SET, MISC0_REFTOP_SELBIASOFF);
regmap_write(map, TEMPSENSE0 + REG_SET, TEMPSENSE0_POWER_DOWN); regmap_write(map, TEMPSENSE0 + REG_SET, TEMPSENSE0_POWER_DOWN);
cpumask_set_cpu(0, &clip_cpus); data->cdev = cpufreq_cooling_register(cpu_present_mask);
data->cdev = cpufreq_cooling_register(&clip_cpus);
if (IS_ERR(data->cdev)) { if (IS_ERR(data->cdev)) {
ret = PTR_ERR(data->cdev); ret = PTR_ERR(data->cdev);
if (ret != -EPROBE_DEFER)
dev_err(&pdev->dev, dev_err(&pdev->dev,
"failed to register cpufreq cooling device: %d\n", ret); "failed to register cpufreq cooling device: %d\n",
ret);
return ret; return ret;
} }
......
config EXYNOS_THERMAL config EXYNOS_THERMAL
tristate "Exynos thermal management unit driver" tristate "Exynos thermal management unit driver"
depends on ARCH_HAS_BANDGAP && OF depends on OF
help help
If you say yes here you get support for the TMU (Thermal Management If you say yes here you get support for the TMU (Thermal Management
Unit) driver for SAMSUNG EXYNOS series of SoCs. This driver initialises Unit) driver for SAMSUNG EXYNOS series of SoCs. This driver initialises
......
...@@ -347,7 +347,6 @@ void exynos_report_trigger(struct thermal_sensor_conf *conf) ...@@ -347,7 +347,6 @@ void exynos_report_trigger(struct thermal_sensor_conf *conf)
int exynos_register_thermal(struct thermal_sensor_conf *sensor_conf) int exynos_register_thermal(struct thermal_sensor_conf *sensor_conf)
{ {
int ret; int ret;
struct cpumask mask_val;
struct exynos_thermal_zone *th_zone; struct exynos_thermal_zone *th_zone;
if (!sensor_conf || !sensor_conf->read_temperature) { if (!sensor_conf || !sensor_conf->read_temperature) {
...@@ -367,13 +366,14 @@ int exynos_register_thermal(struct thermal_sensor_conf *sensor_conf) ...@@ -367,13 +366,14 @@ int exynos_register_thermal(struct thermal_sensor_conf *sensor_conf)
* sensor * sensor
*/ */
if (sensor_conf->cooling_data.freq_clip_count > 0) { if (sensor_conf->cooling_data.freq_clip_count > 0) {
cpumask_set_cpu(0, &mask_val);
th_zone->cool_dev[th_zone->cool_dev_size] = th_zone->cool_dev[th_zone->cool_dev_size] =
cpufreq_cooling_register(&mask_val); cpufreq_cooling_register(cpu_present_mask);
if (IS_ERR(th_zone->cool_dev[th_zone->cool_dev_size])) { if (IS_ERR(th_zone->cool_dev[th_zone->cool_dev_size])) {
ret = PTR_ERR(th_zone->cool_dev[th_zone->cool_dev_size]);
if (ret != -EPROBE_DEFER)
dev_err(sensor_conf->dev, dev_err(sensor_conf->dev,
"Failed to register cpufreq cooling device\n"); "Failed to register cpufreq cooling device: %d\n",
ret = -EINVAL; ret);
goto err_unregister; goto err_unregister;
} }
th_zone->cool_dev_size++; th_zone->cool_dev_size++;
......
...@@ -927,7 +927,10 @@ static int exynos_tmu_probe(struct platform_device *pdev) ...@@ -927,7 +927,10 @@ static int exynos_tmu_probe(struct platform_device *pdev)
/* Register the sensor with thermal management interface */ /* Register the sensor with thermal management interface */
ret = exynos_register_thermal(sensor_conf); ret = exynos_register_thermal(sensor_conf);
if (ret) { if (ret) {
dev_err(&pdev->dev, "Failed to register thermal interface\n"); if (ret != -EPROBE_DEFER)
dev_err(&pdev->dev,
"Failed to register thermal interface: %d\n",
ret);
goto err_clk; goto err_clk;
} }
data->reg_conf = sensor_conf; data->reg_conf = sensor_conf;
......
...@@ -930,7 +930,7 @@ int thermal_zone_bind_cooling_device(struct thermal_zone_device *tz, ...@@ -930,7 +930,7 @@ int thermal_zone_bind_cooling_device(struct thermal_zone_device *tz,
struct thermal_zone_device *pos1; struct thermal_zone_device *pos1;
struct thermal_cooling_device *pos2; struct thermal_cooling_device *pos2;
unsigned long max_state; unsigned long max_state;
int result; int result, ret;
if (trip >= tz->trips || (trip < 0 && trip != THERMAL_TRIPS_NONE)) if (trip >= tz->trips || (trip < 0 && trip != THERMAL_TRIPS_NONE))
return -EINVAL; return -EINVAL;
...@@ -947,7 +947,9 @@ int thermal_zone_bind_cooling_device(struct thermal_zone_device *tz, ...@@ -947,7 +947,9 @@ int thermal_zone_bind_cooling_device(struct thermal_zone_device *tz,
if (tz != pos1 || cdev != pos2) if (tz != pos1 || cdev != pos2)
return -EINVAL; return -EINVAL;
cdev->ops->get_max_state(cdev, &max_state); ret = cdev->ops->get_max_state(cdev, &max_state);
if (ret)
return ret;
/* lower default 0, upper default max_state */ /* lower default 0, upper default max_state */
lower = lower == THERMAL_NO_LIMIT ? 0 : lower; lower = lower == THERMAL_NO_LIMIT ? 0 : lower;
......
...@@ -28,7 +28,6 @@ ...@@ -28,7 +28,6 @@
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/workqueue.h> #include <linux/workqueue.h>
#include <linux/thermal.h> #include <linux/thermal.h>
#include <linux/cpufreq.h>
#include <linux/cpumask.h> #include <linux/cpumask.h>
#include <linux/cpu_cooling.h> #include <linux/cpu_cooling.h>
#include <linux/of.h> #include <linux/of.h>
...@@ -407,17 +406,17 @@ int ti_thermal_register_cpu_cooling(struct ti_bandgap *bgp, int id) ...@@ -407,17 +406,17 @@ int ti_thermal_register_cpu_cooling(struct ti_bandgap *bgp, int id)
if (!data) if (!data)
return -EINVAL; return -EINVAL;
if (!cpufreq_get_current_driver()) {
dev_dbg(bgp->dev, "no cpufreq driver yet\n");
return -EPROBE_DEFER;
}
/* Register cooling device */ /* Register cooling device */
data->cool_dev = cpufreq_cooling_register(cpu_present_mask); data->cool_dev = cpufreq_cooling_register(cpu_present_mask);
if (IS_ERR(data->cool_dev)) { if (IS_ERR(data->cool_dev)) {
int ret = PTR_ERR(data->cool_dev);
if (ret != -EPROBE_DEFER)
dev_err(bgp->dev, dev_err(bgp->dev,
"Failed to register cpufreq cooling device\n"); "Failed to register cpu cooling device %d\n",
return PTR_ERR(data->cool_dev); ret);
return ret;
} }
ti_bandgap_set_sensor_data(bgp, id, data); ti_bandgap_set_sensor_data(bgp, id, data);
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
#define _DT_BINDINGS_THERMAL_THERMAL_H #define _DT_BINDINGS_THERMAL_THERMAL_H
/* On cooling devices upper and lower limits */ /* On cooling devices upper and lower limits */
#define THERMAL_NO_LIMIT (-1UL) #define THERMAL_NO_LIMIT (~0)
#endif #endif
...@@ -50,7 +50,7 @@ static inline struct thermal_cooling_device * ...@@ -50,7 +50,7 @@ static inline struct thermal_cooling_device *
of_cpufreq_cooling_register(struct device_node *np, of_cpufreq_cooling_register(struct device_node *np,
const struct cpumask *clip_cpus) const struct cpumask *clip_cpus)
{ {
return NULL; return ERR_PTR(-ENOSYS);
} }
#endif #endif
...@@ -65,13 +65,13 @@ unsigned long cpufreq_cooling_get_level(unsigned int cpu, unsigned int freq); ...@@ -65,13 +65,13 @@ unsigned long cpufreq_cooling_get_level(unsigned int cpu, unsigned int freq);
static inline struct thermal_cooling_device * static inline struct thermal_cooling_device *
cpufreq_cooling_register(const struct cpumask *clip_cpus) cpufreq_cooling_register(const struct cpumask *clip_cpus)
{ {
return NULL; return ERR_PTR(-ENOSYS);
} }
static inline struct thermal_cooling_device * static inline struct thermal_cooling_device *
of_cpufreq_cooling_register(struct device_node *np, of_cpufreq_cooling_register(struct device_node *np,
const struct cpumask *clip_cpus) const struct cpumask *clip_cpus)
{ {
return NULL; return ERR_PTR(-ENOSYS);
} }
static inline static inline
void cpufreq_cooling_unregister(struct thermal_cooling_device *cdev) void cpufreq_cooling_unregister(struct thermal_cooling_device *cdev)
......
...@@ -38,7 +38,7 @@ ...@@ -38,7 +38,7 @@
#define THERMAL_CSTATE_INVALID -1UL #define THERMAL_CSTATE_INVALID -1UL
/* No upper/lower limit requirement */ /* No upper/lower limit requirement */
#define THERMAL_NO_LIMIT THERMAL_CSTATE_INVALID #define THERMAL_NO_LIMIT ((u32)~0)
/* Unit conversion macros */ /* Unit conversion macros */
#define KELVIN_TO_CELSIUS(t) (long)(((long)t-2732 >= 0) ? \ #define KELVIN_TO_CELSIUS(t) (long)(((long)t-2732 >= 0) ? \
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment