diff mbox series

[08/11] thermal: exynos: stop using the threshold mechanism on Exynos 4210

Message ID 20230829091853.626011-9-m.majewski2@samsung.com (mailing list archive)
State Accepted
Commit d7a5b431911c5d9da7fbff852433e6f99a4c6616
Headers show
Series [01/11] ARM: dts: exynos: enable polling in Exynos 4210 | expand

Commit Message

Mateusz Majewski Aug. 29, 2023, 9:18 a.m. UTC
Exynos 4210 supports setting a base threshold value, which is added to
all trip points. This might be useful, but is not really necessary in
our usecase, so we always set it to 0 to simplify the code a bit.

Additionally, this change makes it so that we convert the value to the
calibrated one in a slightly different place. This is more correct
morally, though it does not make any change when single-point
calibration is being used (which is the case currently).

Signed-off-by: Mateusz Majewski <m.majewski2@samsung.com>
---
 drivers/thermal/samsung/exynos_tmu.c | 17 +++--------------
 1 file changed, 3 insertions(+), 14 deletions(-)

Comments

Krzysztof Kozlowski Aug. 29, 2023, 10:02 a.m. UTC | #1
On 29/08/2023 11:18, Mateusz Majewski wrote:
> Exynos 4210 supports setting a base threshold value, which is added to
> all trip points. This might be useful, but is not really necessary in
> our usecase, so we always set it to 0 to simplify the code a bit.
> 
> Additionally, this change makes it so that we convert the value to the
> calibrated one in a slightly different place. This is more correct
> morally, though it does not make any change when single-point

I don't think code placement is an aspect of morality, yet okay:

Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>


Best regards,
Krzysztof
diff mbox series

Patch

diff --git a/drivers/thermal/samsung/exynos_tmu.c b/drivers/thermal/samsung/exynos_tmu.c
index 5da44f43715d..6c107fe9fd27 100644
--- a/drivers/thermal/samsung/exynos_tmu.c
+++ b/drivers/thermal/samsung/exynos_tmu.c
@@ -336,20 +336,7 @@  static void exynos_tmu_control(struct platform_device *pdev, bool on)
 static void exynos4210_tmu_set_trip_temp(struct exynos_tmu_data *data,
 					 int trip_id, u8 temp)
 {
-	struct thermal_trip trip;
-	u8 ref, th_code;
-
-	if (thermal_zone_get_trip(data->tzd, 0, &trip))
-		return;
-
-	ref = trip.temperature / MCELSIUS;
-
-	if (trip_id == 0) {
-		th_code = temp_to_code(data, ref);
-		writeb(th_code, data->base + EXYNOS4210_TMU_REG_THRESHOLD_TEMP);
-	}
-
-	temp -= ref;
+	temp = temp_to_code(data, temp);
 	writeb(temp, data->base + EXYNOS4210_TMU_REG_TRIG_LEVEL0 + trip_id * 4);
 }
 
@@ -364,6 +351,8 @@  static void exynos4210_tmu_initialize(struct platform_device *pdev)
 	struct exynos_tmu_data *data = platform_get_drvdata(pdev);
 
 	sanitize_temp_error(data, readl(data->base + EXYNOS_TMU_REG_TRIMINFO));
+
+	writeb(0, data->base + EXYNOS4210_TMU_REG_THRESHOLD_TEMP);
 }
 
 static void exynos4412_tmu_set_trip_temp(struct exynos_tmu_data *data,