diff options
author | Wonjoon Lee <woojoo.lee@samsung.com> | 2015-09-01 21:33:56 +0900 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2015-09-11 00:45:37 -0700 |
commit | 502dc50f04c5df787e95982cef4971b20e501cba (patch) | |
tree | c5b9b550600e72f5d4bc0cd3a1000fa0d0093ee5 /test | |
parent | 3f2dc44158630f0ce93633c21df8daaddb2b7324 (diff) | |
download | chrome-ec-502dc50f04c5df787e95982cef4971b20e501cba.tar.gz |
temp_sensor: Separate ADC interface and thermistor maths
Separate the bd99992gw ADC interface from the NCP15WB thermistor
adc-to-temp maths so that the thermistor can be used with various
other interfaces.
BUG=chrome-os-partner:44764
TEST=make buildall -j
Manual on Glados. Boot to S0, run "temps".
Verify that temperatures start around 28C and begin to increase after
system is powered-on for a long duration.
BRANCH=None
Change-Id: I3e72e9f390feebaac2440dbe722485f8d1cf8c56
Signed-off-by: Wonjoon Lee <woojoo.lee@samsung.com>
Reviewed-on: https://chromium-review.googlesource.com/296871
Reviewed-by: Shawn N <shawnn@chromium.org>
Diffstat (limited to 'test')
-rw-r--r-- | test/test_config.h | 4 | ||||
-rw-r--r-- | test/thermal.c | 12 |
2 files changed, 8 insertions, 8 deletions
diff --git a/test/test_config.h b/test/test_config.h index 93f9f4b072..4b49c699df 100644 --- a/test/test_config.h +++ b/test/test_config.h @@ -78,9 +78,9 @@ int board_discharge_on_ac(int enabled); #define CONFIG_CHIPSET_CAN_THROTTLE #define CONFIG_FANS 1 #define CONFIG_TEMP_SENSOR -#define CONFIG_TEMP_SENSOR_BD99992GW +#define CONFIG_THERMISTOR_NCP15WB #define I2C_PORT_THERMAL 1 -int bd99992gw_get_temp(uint16_t adc); +int ncp15wb_calculate_temp(uint16_t adc); #endif #ifdef TEST_FAN diff --git a/test/thermal.c b/test/thermal.c index 761dc9358d..6e95d37f83 100644 --- a/test/thermal.c +++ b/test/thermal.c @@ -480,11 +480,11 @@ static int test_several_limits(void) return EC_SUCCESS; } -/* Tests for bd99992gw temperature sensor ADC-to-temp calculation */ +/* Tests for ncp15wb thermistor ADC-to-temp calculation */ #define LOW_ADC_TEST_VALUE 887 /* 0 C */ #define HIGH_ADC_TEST_VALUE 100 /* > 100C */ -static int test_bd99992_adc_to_temp(void) +static int test_ncp15wb_adc_to_temp(void) { int i; uint8_t temp; @@ -513,10 +513,10 @@ static int test_bd99992_adc_to_temp(void) * decrease. */ i = LOW_ADC_TEST_VALUE; - temp = bd99992gw_get_temp(i); + temp = ncp15wb_calculate_temp(i); while (--i > HIGH_ADC_TEST_VALUE) { - new_temp = bd99992gw_get_temp(i); + new_temp = ncp15wb_calculate_temp(i); TEST_ASSERT(new_temp == temp || new_temp == temp + 1); temp = new_temp; @@ -524,7 +524,7 @@ static int test_bd99992_adc_to_temp(void) /* Verify several datapoints are within 1C accuracy */ for (i = 0; i < ARRAY_SIZE(adc_temp_datapoints); ++i) { - temp = bd99992gw_get_temp(adc_temp_datapoints[i].adc); + temp = ncp15wb_calculate_temp(adc_temp_datapoints[i].adc); ASSERT(temp >= adc_temp_datapoints[i].temp - 1 && temp <= adc_temp_datapoints[i].temp + 1); } @@ -544,6 +544,6 @@ void run_test(void) RUN_TEST(test_one_limit); RUN_TEST(test_several_limits); - RUN_TEST(test_bd99992_adc_to_temp); + RUN_TEST(test_ncp15wb_adc_to_temp); test_print_result(); } |