summaryrefslogtreecommitdiffstats
path: root/drivers/thermal/samsung/exynos_tmu.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2016-03-24 10:45:59 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2016-03-24 10:45:59 -0700
commitfaea72dd0f155a9d349e191d74830716c702651d (patch)
treecb08f5ebfe30e167af10b730ab6468ea701cf0c5 /drivers/thermal/samsung/exynos_tmu.c
parent5b1e167d8de86d698114a0a8de61e9d1365d3e8a (diff)
parent81ad4276b505e987dd8ebbdf63605f92cd172b52 (diff)
downloadlinux-faea72dd0f155a9d349e191d74830716c702651d.tar.bz2
Merge branch 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/rzhang/linux
Pull thermal updates from Zhang Rui: - Fix a regression where bogus trip points on some Lenovo laptops start to screw up thermal control after commit 81ad4276b505 ("Thermal: initialize thermal zone device correctly"). On these Lenovo laptops, a bogus passive trip point is reported, which is 0 degree Celsius. Without commit 81ad4276b505, thermal zone fails to set cooling devices to proper cooling state, which is a bug. But with commit 81ad4276b505 applied, the processors are always throttled on these Lenovo laptops because the current temperature is always higher than the passive trip point. Fix things to ignore such bogus trip points. (Zhang Rui) - Introduce Mediatek thermal driver. (Sascha Hauer) - Introduce devm_ versions of OF thermal sensor register API. (Laxman Dewangan) - Changes in Kconfigs to allow compile test on UM arch. (Krzysztof Kozlowski) - Introduce Skylake support in intel_pch_thermal driver. (Srinivas Pandruvada) - Several small fixes on Rockchip, TI-SoC, Tegra, RCar, and Exynos thermal drivers. * 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/rzhang/linux: (26 commits) Thermal: Ignore invalid trip points thermal: trace: migrating thermal traces to use TRACE_DEFINE_ENUM() macros thermal: intel_pch_thermal: Enable Skylake PCH thermal thermal: doc: Add details of devm_thermal_zone_of_sensor_{register,unregister} thermal: of-thermal: Add devm version of thermal_zone_of_sensor_register thermal: doc: Add details of thermal_zone_of_sensor_{register,unregister} thermal: exynos: Defer probe if vtmu is present but not registered thermal: exynos: Use devm_regulator_get_optional() for vtmu thermal: exynos: List vtmu-supply as optional property in DT binding thermal: exynos: Print a message about exceeded number of supported trip-points thermal: exynos: Document number of supported trip-points thermal: exynos: Document compatible for Exynos5433 TMU thermal: mtk: allow compile testing on UM thermal: tegra_soctherm: fix sign bit of temperature thermal: Fix build error of missing devm_ioremap_resource on UM thermal: ti-soc-thermal: clean up the error handling a bit thermal: rcar: Use ARCH_RENESAS thermal: rcar_thermal: don't open code of_device_get_match_data() thermal: db8500_cpufreq_cooling: Compile with COMPILE_TEST thermal: rockchip: fix the tsadc sequence output on rk3228/rk3399 ...
Diffstat (limited to 'drivers/thermal/samsung/exynos_tmu.c')
-rw-r--r--drivers/thermal/samsung/exynos_tmu.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/drivers/thermal/samsung/exynos_tmu.c b/drivers/thermal/samsung/exynos_tmu.c
index fa61eff88496..f3ce94ec73b5 100644
--- a/drivers/thermal/samsung/exynos_tmu.c
+++ b/drivers/thermal/samsung/exynos_tmu.c
@@ -184,6 +184,7 @@
* @temp_error2: fused value of the second point trim.
* @regulator: pointer to the TMU regulator structure.
* @reg_conf: pointer to structure to register with core thermal.
+ * @ntrip: number of supported trip points.
* @tmu_initialize: SoC specific TMU initialization method
* @tmu_control: SoC specific TMU control method
* @tmu_read: SoC specific TMU temperature read method
@@ -203,6 +204,7 @@ struct exynos_tmu_data {
u16 temp_error1, temp_error2;
struct regulator *regulator;
struct thermal_zone_device *tzd;
+ unsigned int ntrip;
int (*tmu_initialize)(struct platform_device *pdev);
void (*tmu_control)(struct platform_device *pdev, bool on);
@@ -346,6 +348,14 @@ static int exynos_tmu_initialize(struct platform_device *pdev)
struct exynos_tmu_data *data = platform_get_drvdata(pdev);
int ret;
+ if (of_thermal_get_ntrips(data->tzd) > data->ntrip) {
+ dev_info(&pdev->dev,
+ "More trip points than supported by this TMU.\n");
+ dev_info(&pdev->dev,
+ "%d trip points should be configured in polling mode.\n",
+ (of_thermal_get_ntrips(data->tzd) - data->ntrip));
+ }
+
mutex_lock(&data->lock);
clk_enable(data->clk);
if (!IS_ERR(data->clk_sec))
@@ -1210,6 +1220,7 @@ static int exynos_map_dt_data(struct platform_device *pdev)
data->tmu_control = exynos4210_tmu_control;
data->tmu_read = exynos4210_tmu_read;
data->tmu_clear_irqs = exynos4210_tmu_clear_irqs;
+ data->ntrip = 4;
break;
case SOC_ARCH_EXYNOS3250:
case SOC_ARCH_EXYNOS4412:
@@ -1222,6 +1233,7 @@ static int exynos_map_dt_data(struct platform_device *pdev)
data->tmu_read = exynos4412_tmu_read;
data->tmu_set_emulation = exynos4412_tmu_set_emulation;
data->tmu_clear_irqs = exynos4210_tmu_clear_irqs;
+ data->ntrip = 4;
break;
case SOC_ARCH_EXYNOS5433:
data->tmu_initialize = exynos5433_tmu_initialize;
@@ -1229,6 +1241,7 @@ static int exynos_map_dt_data(struct platform_device *pdev)
data->tmu_read = exynos4412_tmu_read;
data->tmu_set_emulation = exynos4412_tmu_set_emulation;
data->tmu_clear_irqs = exynos4210_tmu_clear_irqs;
+ data->ntrip = 8;
break;
case SOC_ARCH_EXYNOS5440:
data->tmu_initialize = exynos5440_tmu_initialize;
@@ -1236,6 +1249,7 @@ static int exynos_map_dt_data(struct platform_device *pdev)
data->tmu_read = exynos5440_tmu_read;
data->tmu_set_emulation = exynos5440_tmu_set_emulation;
data->tmu_clear_irqs = exynos5440_tmu_clear_irqs;
+ data->ntrip = 4;
break;
case SOC_ARCH_EXYNOS7:
data->tmu_initialize = exynos7_tmu_initialize;
@@ -1243,6 +1257,7 @@ static int exynos_map_dt_data(struct platform_device *pdev)
data->tmu_read = exynos7_tmu_read;
data->tmu_set_emulation = exynos4412_tmu_set_emulation;
data->tmu_clear_irqs = exynos4210_tmu_clear_irqs;
+ data->ntrip = 8;
break;
default:
dev_err(&pdev->dev, "Platform not supported\n");
@@ -1295,7 +1310,7 @@ static int exynos_tmu_probe(struct platform_device *pdev)
* TODO: Add regulator as an SOC feature, so that regulator enable
* is a compulsory call.
*/
- data->regulator = devm_regulator_get(&pdev->dev, "vtmu");
+ data->regulator = devm_regulator_get_optional(&pdev->dev, "vtmu");
if (!IS_ERR(data->regulator)) {
ret = regulator_enable(data->regulator);
if (ret) {
@@ -1303,6 +1318,8 @@ static int exynos_tmu_probe(struct platform_device *pdev)
return ret;
}
} else {
+ if (PTR_ERR(data->regulator) == -EPROBE_DEFER)
+ return -EPROBE_DEFER;
dev_info(&pdev->dev, "Regulator node (vtmu) not found\n");
}