Commit be56de6f332563ba5d4d70d720bf9e053efb7472

Authored by Tim Harvey
Committed by Stefano Babic
1 parent 7254d92ebc

thermal: imx_thermal: increase critical temperature threshold

The CPU temperature grade from OTP is now used to define the critical
threshold at which point we busyloop until we are below, however this
threshold is still too low.

Instead of 20C below the max CPU temperature, change it to 5C defined now
by TEMPERATURE_HOT_DETLA for clarity. Rename 'passive' to 'critical'
as that better defines our use case here. Additionally change the output
of the busyloop message to show the max CPU temperature as well as current.

Before:
CPU Temperature is 101 C, too hot to boot, waiting...
CPU Temperature is 101 C, too hot to boot, waiting...

After:
CPU Temperature (101C) too close to max (105C) waiting...
CPU Temperature (101C) too close to max (105C) waiting...

Cc: Stefan Roese <sr@denx.de>
Cc: Eric Nelson <eric.nelson@boundarydevices.com>
Cc: Heiko Schocher <hs@denx.de>
Cc: Nikita Kiryanov <nikita@compulab.co.il>
Cc: Jon Nettleton <jon.nettleton@gmail.com>
Cc: Jason Liu <r64343@freescale.com>
Cc: Ye Li <b37916@freescale.com>
Cc: Fabio Estevam <fabio.estevam@freescale.com>
Cc: Christian Gmeiner <christian.gmeiner@gmail.com>
Cc: Markus Niebel <Markus.Niebel@tq-group.com>
Cc: Peng Fan <b51431@freescale.com>
Signed-off-by: Tim Harvey <tharvey@gateworks.com>

Showing 1 changed file with 9 additions and 6 deletions Side-by-side Diff

drivers/thermal/imx_thermal.c
... ... @@ -19,6 +19,8 @@
19 19 #include <thermal.h>
20 20 #include <imx_thermal.h>
21 21  
  22 +/* board will busyloop until this many degrees C below CPU max temperature */
  23 +#define TEMPERATURE_HOT_DELTA 5 /* CPU maxT - 5C */
22 24 #define FACTOR0 10000000
23 25 #define FACTOR1 15976
24 26 #define FACTOR2 4297157
... ... @@ -34,7 +36,7 @@
34 36  
35 37 struct thermal_data {
36 38 unsigned int fuse;
37   - int passive;
  39 + int critical;
38 40 int minc;
39 41 int maxc;
40 42 };
... ... @@ -129,9 +131,10 @@
129 131  
130 132 cpu_tmp = read_cpu_temperature(dev);
131 133 while (cpu_tmp > priv->minc && cpu_tmp < priv->maxc) {
132   - if (cpu_tmp >= priv->passive) {
133   - printf("CPU Temperature is %d C, too hot to boot, waiting...\n",
134   - cpu_tmp);
  134 + if (cpu_tmp >= priv->critical) {
  135 + printf("CPU Temperature (%dC) too close to max (%dC)",
  136 + cpu_tmp, priv->maxc);
  137 + puts(" waiting...\n");
135 138 udelay(5000000);
136 139 cpu_tmp = read_cpu_temperature(dev);
137 140 } else {
138 141  
... ... @@ -164,9 +167,9 @@
164 167 return -EPERM;
165 168 }
166 169  
167   - /* set passive cooling temp to max - 20C */
  170 + /* set critical cooling temp */
168 171 get_cpu_temp_grade(&priv->minc, &priv->maxc);
169   - priv->passive = priv->maxc - 20;
  172 + priv->critical = priv->maxc - TEMPERATURE_HOT_DELTA;
170 173 priv->fuse = fuse;
171 174  
172 175 enable_thermal_clk();