提交 7795b3da 编写于 作者: S Stefan Wahren 提交者: Zheng Zengkai

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

stable inclusion
from stable-v5.10.121
commit 83603802954068ccd1b8a3f2ccbbaf5e0862acb0
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I5L6CQ

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=83603802954068ccd1b8a3f2ccbbaf5e0862acb0

--------------------------------

[ Upstream commit 106e0121 ]

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: 59b78135 ("thermal: Add BCM2711 thermal driver")
Signed-off-by: NStefan Wahren <stefan.wahren@i2se.com>
Acked-by: NFlorian Fainelli <f.fainelli@gmail.com>
Link: https://lore.kernel.org/r/20220412195423.104511-1-stefan.wahren@i2se.comSigned-off-by: NDaniel Lezcano <daniel.lezcano@linaro.org>
Signed-off-by: NSasha Levin <sashal@kernel.org>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
Acked-by: NXie XiuQi <xiexiuqi@huawei.com>
上级 29419e1e
...@@ -38,7 +38,6 @@ static int bcm2711_get_temp(void *data, int *temp) ...@@ -38,7 +38,6 @@ static int bcm2711_get_temp(void *data, int *temp)
int offset = thermal_zone_get_offset(priv->thermal); int offset = thermal_zone_get_offset(priv->thermal);
u32 val; u32 val;
int ret; int ret;
long t;
ret = regmap_read(priv->regmap, AVS_RO_TEMP_STATUS, &val); ret = regmap_read(priv->regmap, AVS_RO_TEMP_STATUS, &val);
if (ret) if (ret)
...@@ -50,9 +49,7 @@ static int bcm2711_get_temp(void *data, int *temp) ...@@ -50,9 +49,7 @@ static int bcm2711_get_temp(void *data, int *temp)
val &= AVS_RO_TEMP_STATUS_DATA_MSK; val &= AVS_RO_TEMP_STATUS_DATA_MSK;
/* Convert a HW code to a temperature reading (millidegree celsius) */ /* Convert a HW code to a temperature reading (millidegree celsius) */
t = slope * val + offset; *temp = slope * val + offset;
*temp = t < 0 ? 0 : t;
return 0; return 0;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册