summaryrefslogtreecommitdiffstats
path: root/drivers/thermal/rockchip_thermal.c
diff options
context:
space:
mode:
authorElaine Zhang <zhangqing@rock-chips.com>2016-02-15 08:33:29 +0100
committerEduardo Valentin <edubezval@gmail.com>2016-03-01 06:04:35 +0100
commit1d37a037dd9527df55db68aee80afa73ce40c733 (patch)
tree3b5b82e7c735e735c29958948767fb1136dc5796 /drivers/thermal/rockchip_thermal.c
parentthermal: rockchip: fix a impossible condition caused by the warning (diff)
downloadlinux-1d37a037dd9527df55db68aee80afa73ce40c733.tar.xz
linux-1d37a037dd9527df55db68aee80afa73ce40c733.zip
thermal: rockchip: fix calculation error for code_to_temp
the calculation use a global table, not their own table. so adapt the table to the correct one. Signed-off-by: Elaine Zhang <zhangqing@rock-chips.com> Signed-off-by: Caesar Wang <wxt@rock-chips.com> Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
Diffstat (limited to 'drivers/thermal/rockchip_thermal.c')
-rw-r--r--drivers/thermal/rockchip_thermal.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/thermal/rockchip_thermal.c b/drivers/thermal/rockchip_thermal.c
index 433085a97626..5c58d489eaf8 100644
--- a/drivers/thermal/rockchip_thermal.c
+++ b/drivers/thermal/rockchip_thermal.c
@@ -411,7 +411,7 @@ static int rk_tsadcv2_code_to_temp(struct chip_tsadc_table table, u32 code,
* temperature between 2 table entries is linear and interpolate
* to produce less granular result.
*/
- num = table.id[mid].temp - v2_code_table[mid - 1].temp;
+ num = table.id[mid].temp - table.id[mid - 1].temp;
num *= abs(table.id[mid - 1].code - code);
denom = abs(table.id[mid - 1].code - table.id[mid].code);
*temp = table.id[mid - 1].temp + (num / denom);