summaryrefslogtreecommitdiffstats
path: root/drivers/thermal
diff options
context:
space:
mode:
authorYangtao Li <frank@allwinnertech.com>2020-07-24 09:11:42 +0200
committerDaniel Lezcano <daniel.lezcano@linaro.org>2020-10-12 12:08:36 +0200
commit771151bed994850c9afe48a8c8400d6aad33071a (patch)
treec4ef369257c76bd960799e427a036c86c0185b55 /drivers/thermal
parentdt-bindings: thermal: sun8i: Add binding for A100's THS controller (diff)
downloadlinux-771151bed994850c9afe48a8c8400d6aad33071a.tar.xz
linux-771151bed994850c9afe48a8c8400d6aad33071a.zip
thermal: sun8i: add TEMP_CALIB_MASK for calibration data in sun50i_h6_ths_calibrate
For sun50i_h6_ths_calibrate(), the data read from nvmem needs a round of calculation. On the other hand, the newer SOC may store other data in the space other than 12bit sensor data. Add mask operation to read data to avoid conversion error. Signed-off-by: Yangtao Li <frank@allwinnertech.com> Acked-by: Maxime Ripard <mripard@kernel.org> Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org> Link: https://lore.kernel.org/r/dcf98648c16aff7649ff82438bfce6caae3e176f.1595572867.git.frank@allwinnertech.com
Diffstat (limited to 'drivers/thermal')
-rw-r--r--drivers/thermal/sun8i_thermal.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/thermal/sun8i_thermal.c b/drivers/thermal/sun8i_thermal.c
index 74d73be16496..f423d44b9290 100644
--- a/drivers/thermal/sun8i_thermal.c
+++ b/drivers/thermal/sun8i_thermal.c
@@ -244,7 +244,7 @@ static int sun50i_h6_ths_calibrate(struct ths_device *tmdev,
ft_temp = (caldata[0] & FT_TEMP_MASK) * 100;
for (i = 0; i < tmdev->chip->sensor_num; i++) {
- int sensor_reg = caldata[i + 1];
+ int sensor_reg = caldata[i + 1] & TEMP_CALIB_MASK;
int cdata, offset;
int sensor_temp = tmdev->chip->calc_temp(tmdev, i, sensor_reg);