thermal: rockchip: fix calculation error for code_to_temp
authorElaine Zhang <zhangqing@rock-chips.com>
Mon, 15 Feb 2016 07:33:29 +0000 (15:33 +0800)
committerEduardo Valentin <edubezval@gmail.com>
Tue, 1 Mar 2016 05:04:35 +0000 (21:04 -0800)
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>
drivers/thermal/rockchip_thermal.c

index 433085a97626f207afb111596034aad3098441ab..5c58d489eaf8ca950ac4a378c8837e4e23cff117 100644 (file)
@@ -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);