Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

thermal: rockchip: enhance the tsadc's bandgap feature for rk3399

Due to the voltage ripple, the sensing data of the tsadc is not accurate.
And in this patch, the bandgap feature is enhanced to remove the voltage
ripple, and then the tsadc can sense the temperature more precisely.

Obsolete codes are removed as well.

Signed-off-by: Rocky Hao <rocky.hao@rock-chips.com>
Signed-off-by: Caesar Wang <wxt@rock-chips.com>
Cc: Eduardo Valentin <edubezval@gmail.com>
Cc: Zhang Rui <rui.zhang@intel.com>
Cc: Heiko Stuebner <heiko@sntech.de>
Cc: linux-pm@vger.kernel.org
Tested-by: Stephen Barber <smbarber@chromium.org>
Signed-off-by: Zhang Rui <rui.zhang@intel.com>

authored by

Rocky Hao and committed by
Zhang Rui
23f75e48 5b97469a

+6 -5
+6 -5
drivers/thermal/rockchip_thermal.c
··· 222 222 #define GRF_TSADC_TESTBIT_L 0x0e648 223 223 #define GRF_TSADC_TESTBIT_H 0x0e64c 224 224 225 - #define GRF_TSADC_TSEN_PD_ON (0x30003 << 0) 226 - #define GRF_TSADC_TSEN_PD_OFF (0x30000 << 0) 227 225 #define GRF_SARADC_TESTBIT_ON (0x10001 << 2) 228 226 #define GRF_TSADC_TESTBIT_H_ON (0x10001 << 2) 227 + #define GRF_TSADC_VCM_EN_L (0x10001 << 7) 228 + #define GRF_TSADC_VCM_EN_H (0x10001 << 7) 229 229 230 230 /** 231 231 * struct tsadc_table - code to temperature conversion table ··· 567 567 regs + TSADCV2_HIGHT_TSHUT_DEBOUNCE); 568 568 569 569 } else { 570 - regmap_write(grf, GRF_TSADC_TESTBIT_L, GRF_TSADC_TSEN_PD_ON); 571 - mdelay(10); 572 - regmap_write(grf, GRF_TSADC_TESTBIT_L, GRF_TSADC_TSEN_PD_OFF); 570 + /* Enable the voltage common mode feature */ 571 + regmap_write(grf, GRF_TSADC_TESTBIT_L, GRF_TSADC_VCM_EN_L); 572 + regmap_write(grf, GRF_TSADC_TESTBIT_H, GRF_TSADC_VCM_EN_H); 573 + 573 574 usleep_range(15, 100); /* The spec note says at least 15 us */ 574 575 regmap_write(grf, GRF_SARADC_TESTBIT, GRF_SARADC_TESTBIT_ON); 575 576 regmap_write(grf, GRF_TSADC_TESTBIT_H, GRF_TSADC_TESTBIT_H_ON);