linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] thermal: bcm2711_thermal: Don't clamp temperature at zero
@ 2022-04-12 19:54 Stefan Wahren
  2022-04-13 17:01 ` Florian Fainelli
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Stefan Wahren @ 2022-04-12 19:54 UTC (permalink / raw)
  To: Florian Fainelli, Rafael J . Wysocki, Daniel Lezcano,
	Amit Kucheria, Zhang Rui
  Cc: bcm-kernel-feedback-list, Nicolas Saenz Julienne, linux-pm,
	linux-rpi-kernel, linux-arm-kernel, Stefan Wahren

The thermal sensor on BCM2711 is capable of negative temperatures, so don't
clamp the measurements at zero. Since this was the only use for variable t,
drop it.

This change based on a patch by Dom Cobley, who also tested the fix.

Fixes: 59b781352dc4 ("thermal: Add BCM2711 thermal driver")
Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
---
 drivers/thermal/broadcom/bcm2711_thermal.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/thermal/broadcom/bcm2711_thermal.c b/drivers/thermal/broadcom/bcm2711_thermal.c
index 1ec57d9ecf53..e9bef5c3414b 100644
--- a/drivers/thermal/broadcom/bcm2711_thermal.c
+++ b/drivers/thermal/broadcom/bcm2711_thermal.c
@@ -38,7 +38,6 @@ static int bcm2711_get_temp(void *data, int *temp)
 	int offset = thermal_zone_get_offset(priv->thermal);
 	u32 val;
 	int ret;
-	long t;
 
 	ret = regmap_read(priv->regmap, AVS_RO_TEMP_STATUS, &val);
 	if (ret)
@@ -50,9 +49,7 @@ static int bcm2711_get_temp(void *data, int *temp)
 	val &= AVS_RO_TEMP_STATUS_DATA_MSK;
 
 	/* Convert a HW code to a temperature reading (millidegree celsius) */
-	t = slope * val + offset;
-
-	*temp = t < 0 ? 0 : t;
+	*temp = slope * val + offset;
 
 	return 0;
 }
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] thermal: bcm2711_thermal: Don't clamp temperature at zero
  2022-04-12 19:54 [PATCH] thermal: bcm2711_thermal: Don't clamp temperature at zero Stefan Wahren
@ 2022-04-13 17:01 ` Florian Fainelli
  2022-04-13 17:03 ` Daniel Lezcano
  2022-05-19 12:44 ` [thermal: thermal/next] thermal/drivers/bcm2711: " thermal-bot for Stefan Wahren
  2 siblings, 0 replies; 4+ messages in thread
From: Florian Fainelli @ 2022-04-13 17:01 UTC (permalink / raw)
  To: Stefan Wahren, Rafael J . Wysocki, Daniel Lezcano, Amit Kucheria,
	Zhang Rui
  Cc: bcm-kernel-feedback-list, Nicolas Saenz Julienne, linux-pm,
	linux-rpi-kernel, linux-arm-kernel



On 4/12/2022 12:54 PM, Stefan Wahren wrote:
> The thermal sensor on BCM2711 is capable of negative temperatures, so don't
> clamp the measurements at zero. Since this was the only use for variable t,
> drop it.
> 
> This change based on a patch by Dom Cobley, who also tested the fix.
> 
> Fixes: 59b781352dc4 ("thermal: Add BCM2711 thermal driver")
> Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>

Acked-by: Florian Fainelli <f.fainelli@gmail.com>
-- 
Florian

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] thermal: bcm2711_thermal: Don't clamp temperature at zero
  2022-04-12 19:54 [PATCH] thermal: bcm2711_thermal: Don't clamp temperature at zero Stefan Wahren
  2022-04-13 17:01 ` Florian Fainelli
@ 2022-04-13 17:03 ` Daniel Lezcano
  2022-05-19 12:44 ` [thermal: thermal/next] thermal/drivers/bcm2711: " thermal-bot for Stefan Wahren
  2 siblings, 0 replies; 4+ messages in thread
From: Daniel Lezcano @ 2022-04-13 17:03 UTC (permalink / raw)
  To: Stefan Wahren, Florian Fainelli, Rafael J . Wysocki,
	Amit Kucheria, Zhang Rui
  Cc: bcm-kernel-feedback-list, Nicolas Saenz Julienne, linux-pm,
	linux-rpi-kernel, linux-arm-kernel

On 12/04/2022 21:54, Stefan Wahren wrote:
> The thermal sensor on BCM2711 is capable of negative temperatures, so don't
> clamp the measurements at zero. Since this was the only use for variable t,
> drop it.
> 
> This change based on a patch by Dom Cobley, who also tested the fix.
> 
> Fixes: 59b781352dc4 ("thermal: Add BCM2711 thermal driver")
> Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>

Applied, thanks


-- 
<http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [thermal: thermal/next] thermal/drivers/bcm2711: Don't clamp temperature at zero
  2022-04-12 19:54 [PATCH] thermal: bcm2711_thermal: Don't clamp temperature at zero Stefan Wahren
  2022-04-13 17:01 ` Florian Fainelli
  2022-04-13 17:03 ` Daniel Lezcano
@ 2022-05-19 12:44 ` thermal-bot for Stefan Wahren
  2 siblings, 0 replies; 4+ messages in thread
From: thermal-bot for Stefan Wahren @ 2022-05-19 12:44 UTC (permalink / raw)
  To: linux-pm
  Cc: Stefan Wahren, Florian Fainelli, Daniel Lezcano, rui.zhang, amitk

The following commit has been merged into the thermal/next branch of thermal:

Commit-ID:     106e0121e243de4da7d634338089a68a8da2abe9
Gitweb:        https://git.kernel.org/pub/scm/linux/kernel/git/thermal/linux.git//106e0121e243de4da7d634338089a68a8da2abe9
Author:        Stefan Wahren <stefan.wahren@i2se.com>
AuthorDate:    Tue, 12 Apr 2022 21:54:23 +02:00
Committer:     Daniel Lezcano <daniel.lezcano@linaro.org>
CommitterDate: Thu, 19 May 2022 12:11:51 +02:00

thermal/drivers/bcm2711: Don't clamp temperature at zero

The thermal sensor on BCM2711 is capable of negative temperatures, so don't
clamp the measurements at zero. Since this was the only use for variable t,
drop it.

This change based on a patch by Dom Cobley, who also tested the fix.

Fixes: 59b781352dc4 ("thermal: Add BCM2711 thermal driver")
Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
Acked-by: Florian Fainelli <f.fainelli@gmail.com>
Link: https://lore.kernel.org/r/20220412195423.104511-1-stefan.wahren@i2se.com
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
---
 drivers/thermal/broadcom/bcm2711_thermal.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/thermal/broadcom/bcm2711_thermal.c b/drivers/thermal/broadcom/bcm2711_thermal.c
index 1ec57d9..e9bef5c 100644
--- a/drivers/thermal/broadcom/bcm2711_thermal.c
+++ b/drivers/thermal/broadcom/bcm2711_thermal.c
@@ -38,7 +38,6 @@ static int bcm2711_get_temp(void *data, int *temp)
 	int offset = thermal_zone_get_offset(priv->thermal);
 	u32 val;
 	int ret;
-	long t;
 
 	ret = regmap_read(priv->regmap, AVS_RO_TEMP_STATUS, &val);
 	if (ret)
@@ -50,9 +49,7 @@ static int bcm2711_get_temp(void *data, int *temp)
 	val &= AVS_RO_TEMP_STATUS_DATA_MSK;
 
 	/* Convert a HW code to a temperature reading (millidegree celsius) */
-	t = slope * val + offset;
-
-	*temp = t < 0 ? 0 : t;
+	*temp = slope * val + offset;
 
 	return 0;
 }

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-05-19 12:44 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-12 19:54 [PATCH] thermal: bcm2711_thermal: Don't clamp temperature at zero Stefan Wahren
2022-04-13 17:01 ` Florian Fainelli
2022-04-13 17:03 ` Daniel Lezcano
2022-05-19 12:44 ` [thermal: thermal/next] thermal/drivers/bcm2711: " thermal-bot for Stefan Wahren

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).