Skip to content

Commit

Permalink
thermal/drivers/bcm2711: Don't clamp temperature at zero
Browse files Browse the repository at this point in the history
[ Upstream commit 106e012 ]

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: 59b7813 ("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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
lategoodbye authored and gregkh committed Jun 9, 2022
1 parent d50d1c7 commit c4e1280
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions drivers/thermal/broadcom/bcm2711_thermal.c
Expand Up @@ -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)
Expand All @@ -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;
}
Expand Down

0 comments on commit c4e1280

Please sign in to comment.