public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Liu Jason <Hui.Liu@freescale.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] thermal: imx_thermal: increase critical temperature threshold
Date: Thu, 21 May 2015 15:55:19 +0000	[thread overview]
Message-ID: <1432223716874.47933@freescale.com> (raw)
In-Reply-To: <1432222806-15970-1-git-send-email-tharvey@gateworks.com>



________________________________________
From: Tim Harvey <tharvey@gateworks.com>
Sent: Thursday, May 21, 2015 11:40 PM
To: Stefano Babic
Cc: u-boot at lists.denx.de; Stefan Roese; Eric Nelson; Heiko Schocher; Nikita Kiryanov; Jon Nettleton; Liu Hui-R64343; Li Ye-B37916; Estevam Fabio-R49496; Christian Gmeiner; Markus Niebel; Fan Peng-B51431
Subject: [U-Boot] [PATCH] 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>
---
 drivers/thermal/imx_thermal.c | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)


Looks good to me, thus:

Acked-by: Jason Liu <r64343@freescale.com> 

Jason Liu

diff --git a/drivers/thermal/imx_thermal.c b/drivers/thermal/imx_thermal.c
index b5dab63..0d893c9 100644
--- a/drivers/thermal/imx_thermal.c
+++ b/drivers/thermal/imx_thermal.c
@@ -19,6 +19,8 @@
 #include <thermal.h>
 #include <imx_thermal.h>

+/* board will busyloop until this many degrees C below CPU max temperature */
+#define TEMPERATURE_HOT_DELTA   5 /* CPU maxT - 5C */
 #define FACTOR0                        10000000
 #define FACTOR1                        15976
 #define FACTOR2                        4297157
@@ -34,7 +36,7 @@

 struct thermal_data {
        unsigned int fuse;
-       int passive;
+       int critical;
        int minc;
        int maxc;
 };
@@ -129,9 +131,10 @@ int imx_thermal_get_temp(struct udevice *dev, int *temp)

        cpu_tmp = read_cpu_temperature(dev);
        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);
+               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 {
@@ -164,9 +167,9 @@ static int imx_thermal_probe(struct udevice *dev)
                return -EPERM;
        }

-       /* set passive cooling temp to max - 20C */
+       /* set critical cooling temp */
        get_cpu_temp_grade(&priv->minc, &priv->maxc);
-       priv->passive = priv->maxc - 20;
+       priv->critical = priv->maxc - TEMPERATURE_HOT_DELTA;
        priv->fuse = fuse;

        enable_thermal_clk();
--
1.9.1

  reply	other threads:[~2015-05-21 15:55 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-21 15:40 [U-Boot] [PATCH] thermal: imx_thermal: increase critical temperature threshold Tim Harvey
2015-05-21 15:55 ` Liu Jason [this message]
2015-05-26 12:23 ` Stefano Babic

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1432223716874.47933@freescale.com \
    --to=hui.liu@freescale.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox