kernel: bump 5.10 to 5.10.35
[openwrt/staging/mkresin.git] / target / linux / ipq806x / patches-5.10 / 104-2-drivers-thermal-tsens-Don-t-hardcode-sensor-slope.patch
1 From efa0d50a6c5ec7619371dfe4d3e6ca54b73787d5 Mon Sep 17 00:00:00 2001
2 From: Ansuel Smith <ansuelsmth@gmail.com>
3 Date: Wed, 25 Nov 2020 16:47:21 +0100
4 Subject: [PATCH 02/10] drivers: thermal: tsens: Don't hardcode sensor slope
5
6 Function compute_intercept_slope hardcode the sensor slope to
7 SLOPE_DEFAULT. Change this and use the default value only if a slope is
8 not defined. This is needed for tsens VER_0 that has a hardcoded slope
9 table.
10
11 Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
12 Reviewed-by: Thara Gopinath <thara.gopinath@linaro.org>
13 ---
14 drivers/thermal/qcom/tsens.c | 3 ++-
15 1 file changed, 2 insertions(+), 1 deletion(-)
16
17 --- a/drivers/thermal/qcom/tsens.c
18 +++ b/drivers/thermal/qcom/tsens.c
19 @@ -86,7 +86,8 @@ void compute_intercept_slope(struct tsen
20 "%s: sensor%d - data_point1:%#x data_point2:%#x\n",
21 __func__, i, p1[i], p2[i]);
22
23 - priv->sensor[i].slope = SLOPE_DEFAULT;
24 + if (!priv->sensor[i].slope)
25 + priv->sensor[i].slope = SLOPE_DEFAULT;
26 if (mode == TWO_PT_CALIB) {
27 /*
28 * slope (m) = adc_code2 - adc_code1 (y2 - y1)/