Skip to content

Commit

Permalink
thermal: rockchip: fix calculation error for code_to_temp
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Elaine Zhang authored and Eduardo Valentin committed Mar 1, 2016
1 parent 43b4eb9 commit 1d37a03
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/thermal/rockchip_thermal.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 1d37a03

Please sign in to comment.