Skip to contentSkip to conversation

ARM: dts: exynos: Do not ignore real-world fuse values for thermal zone 0 on Exynos5420

PATCH In review Krzysztof Kozlowski 2 participants 5 messages Mar 12, 2019 Stable branch

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ARM: dts: exynos: Do not ignore real-world fuse values for thermal zone 0 on Exynos5420

commit 28928a3ce142b2e4e5a7a0f067cefb41a3d2c3f9 upstream.

In Odroid XU3 Lite board, the temperature levels reported for thermal zone 0 were weird. In warm room:

	/sys/class/thermal/thermal_zone0/temp:32000
	/sys/class/thermal/thermal_zone1/temp:51000
	/sys/class/thermal/thermal_zone2/temp:55000
	/sys/class/thermal/thermal_zone3/temp:54000
	/sys/class/thermal/thermal_zone4/temp:51000

Sometimes after booting the value was even equal to ambient temperature which is highly unlikely to be a real temperature of sensor in SoC.

The thermal sensor's calibration (trimming) is based on fused values. In case of the board above, the fused values are: 35, 52, 43, 58 and 43 (corresponding to each TMU device). However driver defined a minimum value for fused data as 40 and for smaller values it was using a hard-coded 55 instead. This lead to mapping data from sensor to wrong temperatures for thermal zone 0.

Various vendor 3.10 trees (Hardkernel's based on Samsung LSI, Artik 10) do not impose any limits on fused values. Since we do not have any knowledge about these limits, use 0 as a minimum accepted fused value. This should essentially allow accepting any reasonable fused value thus behaving like vendor driver.

The exynos5420-tmu-sensor-conf.dtsi is copied directly from existing exynos4412 with one change - the samsung,tmu_min_efuse_value.

---
 arch/arm/boot/dts/exynos5420-tmu-sensor-conf.dtsi | 25 +++++++++++++++++++++++
 arch/arm/boot/dts/exynos5420.dtsi                 | 10 ++++-----
 2 files changed, 30 insertions(+), 5 deletions(-)
 create mode 100644 arch/arm/boot/dts/exynos5420-tmu-sensor-conf.dtsi
arch/arm/boot/dts/exynos5420-tmu-sensor-conf.dtsi new file +25 -0
new file mode 100644
index 000000000000..c8771c660550
@@ -0,0 +1,25 @@
+/*
+ * Device tree sources for Exynos5420 TMU sensor configuration
+ *
+ * Copyright (c) 2014 Lukasz Majewski <[email protected]>
+ * Copyright (c) 2017 Krzysztof Kozlowski <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ */
+
+#include <dt-bindings/thermal/thermal_exynos.h>
+
+#thermal-sensor-cells = <0>;
+samsung,tmu_gain = <8>;
+samsung,tmu_reference_voltage = <16>;
+samsung,tmu_noise_cancel_mode = <4>;
+samsung,tmu_efuse_value = <55>;
+samsung,tmu_min_efuse_value = <0>;
+samsung,tmu_max_efuse_value = <100>;
+samsung,tmu_first_point_trim = <25>;
+samsung,tmu_second_point_trim = <85>;
+samsung,tmu_default_temp_offset = <50>;
+samsung,tmu_cal_type = <TYPE_ONE_POINT_TRIMMING>;
arch/arm/boot/dts/exynos5420.dtsi +5 -5
index 1b3d6c769a3c..d5edb7766942 100644
@@ -777,7 +777,7 @@
 		interrupts = <0 65 0>;
 		clocks = <&clock CLK_TMU>;
 		clock-names = "tmu_apbif";
-		#include "exynos4412-tmu-sensor-conf.dtsi"
+		#include "exynos5420-tmu-sensor-conf.dtsi"
 	};
 
 	tmu_cpu1: tmu@10064000 {
@@ -786,7 +786,7 @@
 		interrupts = <0 183 0>;
 		clocks = <&clock CLK_TMU>;
 		clock-names = "tmu_apbif";
-		#include "exynos4412-tmu-sensor-conf.dtsi"
+		#include "exynos5420-tmu-sensor-conf.dtsi"
 	};
 
 	tmu_cpu2: tmu@10068000 {
@@ -795,7 +795,7 @@
 		interrupts = <0 184 0>;
 		clocks = <&clock CLK_TMU>, <&clock CLK_TMU>;
 		clock-names = "tmu_apbif", "tmu_triminfo_apbif";
-		#include "exynos4412-tmu-sensor-conf.dtsi"
+		#include "exynos5420-tmu-sensor-conf.dtsi"
 	};
 
 	tmu_cpu3: tmu@1006c000 {
@@ -804,7 +804,7 @@
 		interrupts = <0 185 0>;
 		clocks = <&clock CLK_TMU>, <&clock CLK_TMU_GPU>;
 		clock-names = "tmu_apbif", "tmu_triminfo_apbif";
-		#include "exynos4412-tmu-sensor-conf.dtsi"
+		#include "exynos5420-tmu-sensor-conf.dtsi"
 	};
 
 	tmu_gpu: tmu@100a0000 {
@@ -813,7 +813,7 @@
 		interrupts = <0 215 0>;
 		clocks = <&clock CLK_TMU_GPU>, <&clock CLK_TMU>;
 		clock-names = "tmu_apbif", "tmu_triminfo_apbif";
-		#include "exynos4412-tmu-sensor-conf.dtsi"
+		#include "exynos5420-tmu-sensor-conf.dtsi"
 	};
 
 	thermal-zones {
Signature · 1 line
2.7.4
maintainer
#1 lore raw
Quoted 36 lines · Krzysztof Kozlowski

commit 28928a3ce142b2e4e5a7a0f067cefb41a3d2c3f9 upstream.

In Odroid XU3 Lite board, the temperature levels reported for thermal zone 0 were weird. In warm room:

	/sys/class/thermal/thermal_zone0/temp:32000
	/sys/class/thermal/thermal_zone1/temp:51000
	/sys/class/thermal/thermal_zone2/temp:55000
	/sys/class/thermal/thermal_zone3/temp:54000
	/sys/class/thermal/thermal_zone4/temp:51000

Sometimes after booting the value was even equal to ambient temperature which is highly unlikely to be a real temperature of sensor in SoC.

The thermal sensor's calibration (trimming) is based on fused values. In case of the board above, the fused values are: 35, 52, 43, 58 and 43 (corresponding to each TMU device). However driver defined a minimum value for fused data as 40 and for smaller values it was using a hard-coded 55 instead. This lead to mapping data from sensor to wrong temperatures for thermal zone 0.

Various vendor 3.10 trees (Hardkernel's based on Samsung LSI, Artik 10) do not impose any limits on fused values. Since we do not have any knowledge about these limits, use 0 as a minimum accepted fused value. This should essentially allow accepting any reasonable fused value thus behaving like vendor driver.

The exynos5420-tmu-sensor-conf.dtsi is copied directly from existing exynos4412 with one change - the samsung,tmu_min_efuse_value.

Quoted 5 lines
---
 arch/arm/boot/dts/exynos5420-tmu-sensor-conf.dtsi | 25 +++++++++++++++++++++++
 arch/arm/boot/dts/exynos5420.dtsi                 | 10 ++++-----
 2 files changed, 30 insertions(+), 5 deletions(-)
 create mode 100644 arch/arm/boot/dts/exynos5420-tmu-sensor-conf.dtsi

this backport does not apply to 4.9.y, but only 4.4.y. Can you also send a 4.9.y backport so that someone moving from 4.4.y to 4.9.y does not get a regression?

thanks,

greg k-h

#2 lore raw
Quoted 44 lines · Greg KH
Quoted 36 lines · Krzysztof Kozlowski

commit 28928a3ce142b2e4e5a7a0f067cefb41a3d2c3f9 upstream.

In Odroid XU3 Lite board, the temperature levels reported for thermal zone 0 were weird. In warm room:

      /sys/class/thermal/thermal_zone0/temp:32000
      /sys/class/thermal/thermal_zone1/temp:51000
      /sys/class/thermal/thermal_zone2/temp:55000
      /sys/class/thermal/thermal_zone3/temp:54000
      /sys/class/thermal/thermal_zone4/temp:51000

Sometimes after booting the value was even equal to ambient temperature which is highly unlikely to be a real temperature of sensor in SoC.

The thermal sensor's calibration (trimming) is based on fused values. In case of the board above, the fused values are: 35, 52, 43, 58 and 43 (corresponding to each TMU device). However driver defined a minimum value for fused data as 40 and for smaller values it was using a hard-coded 55 instead. This lead to mapping data from sensor to wrong temperatures for thermal zone 0.

Various vendor 3.10 trees (Hardkernel's based on Samsung LSI, Artik 10) do not impose any limits on fused values. Since we do not have any knowledge about these limits, use 0 as a minimum accepted fused value. This should essentially allow accepting any reasonable fused value thus behaving like vendor driver.

The exynos5420-tmu-sensor-conf.dtsi is copied directly from existing exynos4412 with one change - the samsung,tmu_min_efuse_value.

Quoted 5 lines
---
 arch/arm/boot/dts/exynos5420-tmu-sensor-conf.dtsi | 25 +++++++++++++++++++++++
 arch/arm/boot/dts/exynos5420.dtsi                 | 10 ++++-----
 2 files changed, 30 insertions(+), 5 deletions(-)
 create mode 100644 arch/arm/boot/dts/exynos5420-tmu-sensor-conf.dtsi
Quoted 3 lines

this backport does not apply to 4.9.y, but only 4.4.y. Can you also send a 4.9.y backport so that someone moving from 4.4.y to 4.9.y does not get a regression?

v4.9 should also get it and you can apply directly the upstream commit:
28928a3ce142b2e4e5a7a0f067cefb41a3d2c3f9
(v4.4 required indentation adjustment)

Shall I send a version for v4.9 or can you apply the upstream directly?

Best regards,
Krzysztof

maintainer
#3 lore raw
Quoted 49 lines · Krzysztof Kozlowski
Quoted 44 lines · Greg KH
Quoted 36 lines · Krzysztof Kozlowski

commit 28928a3ce142b2e4e5a7a0f067cefb41a3d2c3f9 upstream.

In Odroid XU3 Lite board, the temperature levels reported for thermal zone 0 were weird. In warm room:

      /sys/class/thermal/thermal_zone0/temp:32000
      /sys/class/thermal/thermal_zone1/temp:51000
      /sys/class/thermal/thermal_zone2/temp:55000
      /sys/class/thermal/thermal_zone3/temp:54000
      /sys/class/thermal/thermal_zone4/temp:51000

Sometimes after booting the value was even equal to ambient temperature which is highly unlikely to be a real temperature of sensor in SoC.

The thermal sensor's calibration (trimming) is based on fused values. In case of the board above, the fused values are: 35, 52, 43, 58 and 43 (corresponding to each TMU device). However driver defined a minimum value for fused data as 40 and for smaller values it was using a hard-coded 55 instead. This lead to mapping data from sensor to wrong temperatures for thermal zone 0.

Various vendor 3.10 trees (Hardkernel's based on Samsung LSI, Artik 10) do not impose any limits on fused values. Since we do not have any knowledge about these limits, use 0 as a minimum accepted fused value. This should essentially allow accepting any reasonable fused value thus behaving like vendor driver.

The exynos5420-tmu-sensor-conf.dtsi is copied directly from existing exynos4412 with one change - the samsung,tmu_min_efuse_value.

Quoted 5 lines
---
 arch/arm/boot/dts/exynos5420-tmu-sensor-conf.dtsi | 25 +++++++++++++++++++++++
 arch/arm/boot/dts/exynos5420.dtsi                 | 10 ++++-----
 2 files changed, 30 insertions(+), 5 deletions(-)
 create mode 100644 arch/arm/boot/dts/exynos5420-tmu-sensor-conf.dtsi
Quoted 3 lines

this backport does not apply to 4.9.y, but only 4.4.y. Can you also send a 4.9.y backport so that someone moving from 4.4.y to 4.9.y does not get a regression?

Quoted 5 lines

v4.9 should also get it and you can apply directly the upstream commit:
28928a3ce142b2e4e5a7a0f067cefb41a3d2c3f9
(v4.4 required indentation adjustment)

Shall I send a version for v4.9 or can you apply the upstream directly?

The upstream version does not apply directly at all:

checking file arch/arm/boot/dts/exynos5420-tmu-sensor-conf.dtsi checking file arch/arm/boot/dts/exynos5420.dtsi
Hunk #1 succeeded at 703 with fuzz 1 (offset 4 lines). Hunk #2 FAILED at 708.
Hunk #3 succeeded at 712 with fuzz 1 (offset -5 lines). Hunk #4 succeeded at 721 with fuzz 1 (offset -5 lines). Hunk #5 succeeded at 730 with fuzz 1 (offset -5 lines). 1 out of 5 hunks FAILED

so yes, a backport is needed :)

thanks,

greg k-h

#4 lore raw
Quoted 68 lines · Greg KH
Quoted 49 lines · Krzysztof Kozlowski
Quoted 44 lines · Greg KH
Quoted 36 lines · Krzysztof Kozlowski

commit 28928a3ce142b2e4e5a7a0f067cefb41a3d2c3f9 upstream.

In Odroid XU3 Lite board, the temperature levels reported for thermal zone 0 were weird. In warm room:

      /sys/class/thermal/thermal_zone0/temp:32000
      /sys/class/thermal/thermal_zone1/temp:51000
      /sys/class/thermal/thermal_zone2/temp:55000
      /sys/class/thermal/thermal_zone3/temp:54000
      /sys/class/thermal/thermal_zone4/temp:51000

Sometimes after booting the value was even equal to ambient temperature which is highly unlikely to be a real temperature of sensor in SoC.

The thermal sensor's calibration (trimming) is based on fused values. In case of the board above, the fused values are: 35, 52, 43, 58 and 43 (corresponding to each TMU device). However driver defined a minimum value for fused data as 40 and for smaller values it was using a hard-coded 55 instead. This lead to mapping data from sensor to wrong temperatures for thermal zone 0.

Various vendor 3.10 trees (Hardkernel's based on Samsung LSI, Artik 10) do not impose any limits on fused values. Since we do not have any knowledge about these limits, use 0 as a minimum accepted fused value. This should essentially allow accepting any reasonable fused value thus behaving like vendor driver.

The exynos5420-tmu-sensor-conf.dtsi is copied directly from existing exynos4412 with one change - the samsung,tmu_min_efuse_value.

Quoted 5 lines
---
 arch/arm/boot/dts/exynos5420-tmu-sensor-conf.dtsi | 25 +++++++++++++++++++++++
 arch/arm/boot/dts/exynos5420.dtsi                 | 10 ++++-----
 2 files changed, 30 insertions(+), 5 deletions(-)
 create mode 100644 arch/arm/boot/dts/exynos5420-tmu-sensor-conf.dtsi
Quoted 3 lines

this backport does not apply to 4.9.y, but only 4.4.y. Can you also send a 4.9.y backport so that someone moving from 4.4.y to 4.9.y does not get a regression?

Quoted 5 lines

v4.9 should also get it and you can apply directly the upstream commit:
28928a3ce142b2e4e5a7a0f067cefb41a3d2c3f9
(v4.4 required indentation adjustment)

Shall I send a version for v4.9 or can you apply the upstream directly?

The upstream version does not apply directly at all:

checking file arch/arm/boot/dts/exynos5420-tmu-sensor-conf.dtsi checking file arch/arm/boot/dts/exynos5420.dtsi
Hunk #1 succeeded at 703 with fuzz 1 (offset 4 lines). Hunk #2 FAILED at 708.
Hunk #3 succeeded at 712 with fuzz 1 (offset -5 lines). Hunk #4 succeeded at 721 with fuzz 1 (offset -5 lines). Hunk #5 succeeded at 730 with fuzz 1 (offset -5 lines). 1 out of 5 hunks FAILED

Quoted 1 line

so yes, a backport is needed :)

Ah, it seems that differences were solvable for cherry-pick but not for apply. Sure, let me send a backport.

Best regards,
Krzysztof