
On Mon, May 18, 2015 at 6:56 AM, Tim Harvey tharvey@gateworks.com wrote:
Replace the hard-coded values for min/max/passive with values derived from the CPU temperature grade.
Signed-off-by: Tim Harvey tharvey@gateworks.com
drivers/thermal/imx_thermal.c | 29 +++++++++++++++++++---------- 1 file changed, 19 insertions(+), 10 deletions(-)
diff --git a/drivers/thermal/imx_thermal.c b/drivers/thermal/imx_thermal.c
<snip>
-#define TEMPERATURE_MIN -40 -#define TEMPERATURE_HOT 80 -#define TEMPERATURE_MAX 125
<snip>
@@ -119,11 +124,12 @@ static int read_cpu_temperature(struct udevice *dev)
int imx_thermal_get_temp(struct udevice *dev, int *temp) {
struct thermal_data *priv = dev_get_priv(dev); int cpu_tmp = 0; cpu_tmp = read_cpu_temperature(dev);
while (cpu_tmp > TEMPERATURE_MIN && cpu_tmp < TEMPERATURE_MAX) {
if (cpu_tmp >= TEMPERATURE_HOT) {
while (cpu_tmp > priv->minc && cpu_tmp < priv->maxc) {
if (cpu_tmp >= priv->passive) { printf("CPU Temperature is %d C, too hot to boot, waiting...\n", cpu_tmp); udelay(5000000);
Ye,
I'm curious where you got your previous hard-coded values of -40/80/125 from?
The range of -40 to 125 makes me think it was assumed that the IMX6 was Automotive grade (probably a bad assumption) but I'm more curious about the value of 80C that kicks in this busywait loop above.
<snip>
/* set passive cooling temp to max - 20C */
get_cpu_temp_grade(&priv->minc, &priv->maxc);
priv->passive = priv->maxc - 20;
priv->fuse = fuse;
In my patch here I am calling your TEMPERATURE_HOT the 'passive' temp and setting it to maxc-20 which for an industrial grade CPU with a max of 105C is 85C.
Do we really want to sit in a busywait loop if the board is too hot and if so isn't maxc-20 way too aggressive? I think that I should re-work this patch and set 'passive' to 'maxc' or maybe just a few C under it instead of 20C. Until then I'll need to disable CONFIG_IMX6_THERMAL for our board because it doesn't allow us to even run at an ambient temperature of 80C with an intdustrial processor (80C is the point at which the CPU hits 85C at 800Mhz in U-Boot on our board).
Tim