Commit 1d37a037 authored by Elaine Zhang's avatar Elaine Zhang Committed by Eduardo Valentin

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: default avatarElaine Zhang <zhangqing@rock-chips.com>
Signed-off-by: default avatarCaesar Wang <wxt@rock-chips.com>
Signed-off-by: default avatarEduardo Valentin <edubezval@gmail.com>
parent 43b4eb9f
...@@ -411,7 +411,7 @@ static int rk_tsadcv2_code_to_temp(struct chip_tsadc_table table, u32 code, ...@@ -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 * temperature between 2 table entries is linear and interpolate
* to produce less granular result. * 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); num *= abs(table.id[mid - 1].code - code);
denom = abs(table.id[mid - 1].code - table.id[mid].code); denom = abs(table.id[mid - 1].code - table.id[mid].code);
*temp = table.id[mid - 1].temp + (num / denom); *temp = table.id[mid - 1].temp + (num / denom);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment