From: Stefano Babic <sbabic@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] thermal: imx_thermal: fix busywait if IMX6 temp <0C
Date: Fri, 10 Jul 2015 10:16:06 +0200 [thread overview]
Message-ID: <559F7F46.8070108@denx.de> (raw)
In-Reply-To: <1436395783-8427-1-git-send-email-tharvey@gateworks.com>
Hi Tim,
On 09/07/2015 00:49, Tim Harvey wrote:
> The temperature calculation must be typecasted to keep the compiler
> from sign extending a negative value prior to division.
>
> This fixes an issue where if the CPU temperature is <0C it will get stuck
> in the busywait loop until the CPU heats up to 0C.
>
> Cc: Ye Li <b37916@freescale.com>
> Cc: Jason Liu <r64343@freescale.com>
> Signed-off-by: Tim Harvey <tharvey@gateworks.com>
> ---
> drivers/thermal/imx_thermal.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/thermal/imx_thermal.c b/drivers/thermal/imx_thermal.c
> index 0d893c9..6d1ac97 100644
> --- a/drivers/thermal/imx_thermal.c
> +++ b/drivers/thermal/imx_thermal.c
> @@ -115,7 +115,7 @@ static int read_cpu_temperature(struct udevice *dev)
> writel(TEMPSENSE0_FINISHED, &anatop->tempsense0_clr);
>
> /* milli_Tmeas = c2 - Nmeas * c1 */
> - temperature = (c2 - n_meas * c1)/1000;
> + temperature = (long)(c2 - n_meas * c1)/1000;
>
> /* power down anatop thermal sensor */
> writel(TEMPSENSE0_POWER_DOWN, &anatop->tempsense0_set);
>
Applied to u-boot-imx, thanks !
Best regards,
Stefano Babic
--
=====================================================================
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
=====================================================================
prev parent reply other threads:[~2015-07-10 8:16 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-08 22:49 [U-Boot] [PATCH] thermal: imx_thermal: fix busywait if IMX6 temp <0C Tim Harvey
2015-07-10 8:16 ` Stefano Babic [this message]
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=559F7F46.8070108@denx.de \
--to=sbabic@denx.de \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.