thermal: rockchip: fixes the code_to_temp for tsadc driver
authorCaesar Wang <wxt@rock-chips.com>
Tue, 5 Apr 2016 03:41:06 +0000 (11:41 +0800)
committerGerrit Code Review <gerrit@rock-chips.com>
Tue, 5 Apr 2016 05:59:37 +0000 (13:59 +0800)
commit72463f4c3d4cc0ff58d925222d6abe00492c52c7
tree8c526af4598f956fcd8c79e503e40f236ea5c3a7
parent3fbafa3e99f6cf4372f304a4e343abb575d41802
thermal: rockchip: fixes the code_to_temp for tsadc driver

We should judge the table.id[mid].code insearch algorithm on matter the
adc value increment or decrement.

Or otherwise, the temperature return the incorrect value in some cases.
[    1.438589] adc_val=402,temp=-40000
[    1.438903] adc_val=403,temp=-39375
[    1.439217] adc_val=404,temp=-38750
...
[    1.441102] adc_val=410,temp=-40000
[    1.441416] adc_val=411,temp=-34445
[    1.441737] adc_val=412,temp=-33889
...

Let's fix it right now.

Fixes commit 020ba95
"thermal: rockchip: Add the sort mode for adc value increment or decrement"

Change-Id: Icac84d06ebf463439ca11db5a19d629b4b2b865c
Reported-by: Rocky Hao <rocky.hao@rock-chips.com>
Signed-off-by: Caesar Wang <wxt@rock-chips.com>
drivers/thermal/rockchip_thermal.c