Skip to contentSkip to conversation

thermal:imx_thermal: enter busywait cooling loop when over max CPU temp

PATCH New Tim Harvey 2 participants 3 messages Jun 9, 2015 – Jul 10, 2015

Subsystems (2)
lore
Share & tools
lore

Tim Harvey

author
#0 lore raw

PATCH 1/1 thermal:imx_thermal: enter busywait cooling loop when over max CPU temp

Remove the check for temperature being within the min/max range and enter the busywait cooling loop whenever the CPU temperature is over the critical temp. This fixes the issue where if a board was booted at a temp greater than the CPU temperature max, it would skip the loop and never indicate or try to address the overtemp issue.

---
 drivers/thermal/imx_thermal.c | 16 ++++++----------
 1 file changed, 6 insertions(+), 10 deletions(-)
drivers/thermal/imx_thermal.c +6 -10
index 0d893c9..42ca8d0 100644
@@ -130,16 +130,12 @@ int imx_thermal_get_temp(struct udevice *dev, int *temp)
 	int cpu_tmp = 0;
 
 	cpu_tmp = read_cpu_temperature(dev);
-	while (cpu_tmp > priv->minc && cpu_tmp < priv->maxc) {
-		if (cpu_tmp >= priv->critical) {
-			printf("CPU Temperature (%dC) too close to max (%dC)",
-			       cpu_tmp, priv->maxc);
-			puts(" waiting...\n");
-			udelay(5000000);
-			cpu_tmp = read_cpu_temperature(dev);
-		} else {
-			break;
-		}
+	while (cpu_tmp >= priv->critical) {
+		printf("CPU Temperature (%dC) too close to max (%dC)",
+		       cpu_tmp, priv->maxc);
+		puts(" waiting...\n");
+		udelay(5000000);
+		cpu_tmp = read_cpu_temperature(dev);
 	}
 
 	*temp = cpu_tmp;
Signature · 1 line
1.9.1
author
#1 lore raw

PATCH 1/1 thermal:imx_thermal: enter busywait cooling loop when over max CPU temp

Quoted 41 lines · Tim Harvey

Remove the check for temperature being within the min/max range and enter the busywait cooling loop whenever the CPU temperature is over the critical temp. This fixes the issue where if a board was booted at a temp greater than the CPU temperature max, it would skip the loop and never indicate or try to address the overtemp issue.

---
 drivers/thermal/imx_thermal.c | 16 ++++++----------
 1 file changed, 6 insertions(+), 10 deletions(-)
drivers/thermal/imx_thermal.c +6 -11
index 0d893c9..42ca8d0 100644
@@ -130,16 +130,12 @@ int imx_thermal_get_temp(struct udevice *dev, int *temp)
        int cpu_tmp = 0;
 
        cpu_tmp = read_cpu_temperature(dev);
-       while (cpu_tmp > priv->minc && cpu_tmp < priv->maxc) {
-               if (cpu_tmp >= priv->critical) {
-                       printf("CPU Temperature (%dC) too close to max (%dC)",
-                              cpu_tmp, priv->maxc);
-                       puts(" waiting...\n");
-                       udelay(5000000);
-                       cpu_tmp = read_cpu_temperature(dev);
-               } else {
-                       break;
-               }
+       while (cpu_tmp >= priv->critical) {
+               printf("CPU Temperature (%dC) too close to max (%dC)",
+                      cpu_tmp, priv->maxc);
+               puts(" waiting...\n");
+               udelay(5000000);
+               cpu_tmp = read_cpu_temperature(dev);
        }
 
        *temp = cpu_tmp;
--
Quoted 2 lines

1.9.1

Stefano,

Any feedback on this?

Regards,

Tim

#2 lore raw

PATCH 1/1 thermal:imx_thermal: enter busywait cooling loop when over max CPU temp

Hi Tim,

Quoted 40 lines · Tim Harvey
Quoted 39 lines · Tim Harvey

Remove the check for temperature being within the min/max range and enter the busywait cooling loop whenever the CPU temperature is over the critical temp. This fixes the issue where if a board was booted at a temp greater than the CPU temperature max, it would skip the loop and never indicate or try to address the overtemp issue.

---
 drivers/thermal/imx_thermal.c | 16 ++++++----------
 1 file changed, 6 insertions(+), 10 deletions(-)
drivers/thermal/imx_thermal.c +6 -10
index 0d893c9..42ca8d0 100644
@@ -130,16 +130,12 @@ int imx_thermal_get_temp(struct udevice *dev, int *temp)
        int cpu_tmp = 0;
 
        cpu_tmp = read_cpu_temperature(dev);
-       while (cpu_tmp > priv->minc && cpu_tmp < priv->maxc) {
-               if (cpu_tmp >= priv->critical) {
-                       printf("CPU Temperature (%dC) too close to max (%dC)",
-                              cpu_tmp, priv->maxc);
-                       puts(" waiting...\n");
-                       udelay(5000000);
-                       cpu_tmp = read_cpu_temperature(dev);
-               } else {
-                       break;
-               }
+       while (cpu_tmp >= priv->critical) {
+               printf("CPU Temperature (%dC) too close to max (%dC)",
+                      cpu_tmp, priv->maxc);
+               puts(" waiting...\n");
+               udelay(5000000);
+               cpu_tmp = read_cpu_temperature(dev);
        }
 
Quoted 8 lines
Quoted 4 lines
drivers/thermal/imx_thermal.c +0 -1
        *temp = cpu_tmp;
--

1.9.1

Stefano,

Any feedback on this?

Sure !

Applied to u-boot-imx, thanks !

Best regards,
Stefano Babic

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================