thermal: rockchip: fix calculation error for code_to_temp
authorElaine Zhang <zhangqing@rock-chips.com>
Fri, 29 Jan 2016 07:39:35 +0000 (15:39 +0800)
committerGerrit Code Review <gerrit@rock-chips.com>
Mon, 1 Feb 2016 01:50:22 +0000 (09:50 +0800)
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 <zhangqing@rock-chips.com>
drivers/thermal/rockchip_thermal.c

index ae796eca2ff56a3a68f83a74080fd08c727edb1e..89c26444bfe0c5afa062ae53dba78eaa63dc62c3 100644 (file)
@@ -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);