From: Elaine Zhang Date: Fri, 29 Jan 2016 07:39:35 +0000 (+0800) Subject: thermal: rockchip: fix calculation error for code_to_temp X-Git-Tag: firefly_0821_release~3437 X-Git-Url: http://plrg.eecs.uci.edu/git/?a=commitdiff_plain;h=53eedb49feb49790b94c00365a7c173a244607c8;p=firefly-linux-kernel-4.4.55.git 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. Change-Id: Id416e41910de297259a85a3ae06f4cc3c5788035 Signed-off-by: Elaine Zhang --- diff --git a/drivers/thermal/rockchip_thermal.c b/drivers/thermal/rockchip_thermal.c index ae796eca2ff5..89c26444bfe0 100644 --- a/drivers/thermal/rockchip_thermal.c +++ b/drivers/thermal/rockchip_thermal.c @@ -327,7 +327,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);