linux/debian/patches-debian/powerpc-calibrate-tau.patch

70 lines
2.3 KiB
Diff

#! /bin/sh -e
##
## All lines beginning with `## DP:' are a description of the patch.
## DP: Description: Adds support TAU calibration on G3 processors
## DP: Patch author: Nicolas DET <nd@bplan-gmbh.de>
## DP: Upstream status: submitted
diff -aurN a/arch/ppc/Kconfig b/arch/ppc/Kconfig
--- a/arch/ppc/Kconfig 2005-06-06 11:22:29.000000000 -0400
+++ b/arch/ppc/Kconfig 2005-06-17 20:48:38.000000000 -0400
@@ -198,6 +198,24 @@
If in doubt, say N here.
+config TAU_CALIBRATED
+ bool "The CPU sensor has been calibrated."
+ depends on TAU
+ help
+ Enable it you got the real temperature with an external sensor
+ and you know the offset between the one advertised by the CPU
+ and the real one
+
+config TAU_CALIBRATED_VALUE
+ int "Offset of the themal sensor"
+ depends on TAU_CALIBRATED
+ default "0"
+ help
+ This is the offset of the thermal sensor compare to the real value
+ For example, if you get 27°C in /proc/cpuinfo (uncalibrated) and
+ you know real one is 53°C, then you should set 26 as offset.
+ value = Real val - CPU val;
+
config MATH_EMULATION
bool "Math emulation"
depends on 4xx || 8xx || E500
diff -aurN a/arch/ppc/kernel/setup.c b/arch/ppc/kernel/setup.c
--- a/arch/ppc/kernel/setup.c 2005-06-06 11:22:29.000000000 -0400
+++ b/arch/ppc/kernel/setup.c 2005-06-17 20:50:14.000000000 -0400
@@ -201,17 +201,25 @@
#ifdef CONFIG_TAU
if (cur_cpu_spec[i]->cpu_features & CPU_FTR_TAU) {
+#ifdef CONFIG_TAU_CALIBRATED
+ int is_calibrated = 1;
+ int temp_offset = CONFIG_TAU_CALIBRATED_VALUE;
+#else
+ int is_calibrated = 0;
+ int temp_offset = 0;
+#endif
#ifdef CONFIG_TAU_AVERAGE
/* more straightforward, but potentially misleading */
- seq_printf(m, "temperature \t: %u C (uncalibrated)\n",
- cpu_temp(i));
+ seq_printf(m, "temperature \t: %u C %s- average\n",
+ cpu_temp(i) + temp_offset, is_calibrated ? "" : "(uncalibrated) " );
#else
/* show the actual temp sensor range */
u32 temp;
temp = cpu_temp_both(i);
- seq_printf(m, "temperature \t: %u-%u C (uncalibrated)\n",
- temp & 0xff, temp >> 16);
-#endif
+ seq_printf(m, "temperature \t: %u-%u C %s\n",
+ (temp & 0xff) + temp_offset, (temp >> 16) + temp_offset, is_calibrated ? "" : "(uncalibrated)" );
+
+#endif /* CONFIG_TAU_AVERAGE */
}
#endif /* CONFIG_TAU */