Skip to content

Commit 771151b

Browse files
Yangtao Lidlezcano
authored andcommitted
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
1 parent 691f189 commit 771151b

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

drivers/thermal/sun8i_thermal.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ static int sun50i_h6_ths_calibrate(struct ths_device *tmdev,
244244
ft_temp = (caldata[0] & FT_TEMP_MASK) * 100;
245245

246246
for (i = 0; i < tmdev->chip->sensor_num; i++) {
247-
int sensor_reg = caldata[i + 1];
247+
int sensor_reg = caldata[i + 1] & TEMP_CALIB_MASK;
248248
int cdata, offset;
249249
int sensor_temp = tmdev->chip->calc_temp(tmdev, i, sensor_reg);
250250

0 commit comments

Comments
 (0)