Skip to contentSkip to conversation

thermal: exynos: Reduce severity of too early temperature read

PATCH In review Krzysztof Kozlowski 2 participants 2 messages May 13, 2018 – May 14, 2018

Subsystems (3)
lore
Share & tools
lore

Krzysztof Kozlowski

author maintainer
#0 lore raw

PATCH 1/1 thermal: exynos: Reduce severity of too early temperature read

Thermal core tries to read temperature during sensor registering in thermal_zone_of_sensor_register(). In that time Exynos TMU driver and hardware are not yet initialized. Commit 0eb875d88aaa ("thermal:
exynos: Reading temperature makes sense only when TMU is turned on") added a boolean flag to prevent reading bogus temperature in such case but it exposed warning message during boot:

	[    3.864913] thermal thermal_zone0: failed to read out thermal zone (-22)

Return EAGAIN in such case to skip omitting such message because it might mislead user.

---
 drivers/thermal/samsung/exynos_tmu.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/thermal/samsung/exynos_tmu.c +7 -1
index 3b20309789e3..c24969d740d1 100644
@@ -666,8 +666,14 @@ static int exynos_get_temp(void *p, int *temp)
 	struct exynos_tmu_data *data = p;
 	int value, ret = 0;
 
-	if (!data || !data->tmu_read || !data->enabled)
+	if (!data || !data->tmu_read)
 		return -EINVAL;
+	else if (!data->enabled)
+		/*
+		 * Called too early, probably
+		 * from thermal_zone_of_sensor_register().
+		 */
+		return -EAGAIN;
 
 	mutex_lock(&data->lock);
 	clk_enable(data->clk);
Signature · 1 line
2.14.1
Acked-by on v1 1/1
#1 lore raw
Quoted 10 lines · Krzysztof Kozlowski

Thermal core tries to read temperature during sensor registering in thermal_zone_of_sensor_register(). In that time Exynos TMU driver and hardware are not yet initialized. Commit 0eb875d88aaa ("thermal:
exynos: Reading temperature makes sense only when TMU is turned on") added a boolean flag to prevent reading bogus temperature in such case but it exposed warning message during boot:

	[    3.864913] thermal thermal_zone0: failed to read out thermal zone (-22)

Return EAGAIN in such case to skip omitting such message because it might mislead user.

Hi Krzysztof,

I've fixed this in generic way a month ago:

	https://lkml.org/lkml/2018/4/10/376

(there has been not much feedback on it yet)

However since my patchset is not v4.17 material:

Quoted 1 line

Eduardo, please queue it for v4.17 if possible, thanks.

Quoted 14 lines
---
 drivers/thermal/samsung/exynos_tmu.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/thermal/samsung/exynos_tmu.c +1 -1
index 3b20309789e3..c24969d740d1 100644
@@ -666,8 +666,14 @@ static int exynos_get_temp(void *p, int *temp)
 	struct exynos_tmu_data *data = p;
 	int value, ret = 0;
 
-	if (!data || !data->tmu_read || !data->enabled)
+	if (!data || !data->tmu_read)

drivers/thermal/samsung/exynos_tmu.c static int exynos_get_temp(void *p, int *temp) · line 679

Quoted 10 lines
drivers/thermal/samsung/exynos_tmu.c +6 -0
 		return -EINVAL;
+	else if (!data->enabled)
+		/*
+		 * Called too early, probably
+		 * from thermal_zone_of_sensor_register().
+		 */
+		return -EAGAIN;
 
 	mutex_lock(&data->lock);
 	clk_enable(data->clk);

Best regards,
--
Bartlomiej Zolnierkiewicz
Samsung R&D Institute Poland
Samsung Electronics