diff options
author | Aaron Massey <aaronmassey@google.com> | 2021-09-24 11:22:12 -0600 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2021-09-24 19:47:45 +0000 |
commit | 465c9dc87a353f48b969da0631c4fd2b6df32a4f (patch) | |
tree | eae7fa5a0f92cb81af315eb7912267167ed078e1 /include/driver | |
parent | fc2b67a878f6c57c02569253032fc5d09f6c581e (diff) | |
download | chrome-ec-465c9dc87a353f48b969da0631c4fd2b6df32a4f.tar.gz |
zephyr: drivers: thermistors are device tree nodes
Thermistor drivers now query the device tree for configuration.
Thermistor tests have been updated to be parameterized
on all thermistors enabled in the device tree.
BRANCH=none
BUG=b:184374937
TEST= 1) zmake testall
2) make runhosttests
Cq-Depend: chromium:3161332
Signed-off-by: Aaron Massey <aaronmassey@chromium.org>
Change-Id: Ic5330cd5c33e79e192428ca857651de9a225856e
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3133812
Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
Tested-by: Aaron Massey <aaronmassey@google.com>
Commit-Queue: Aaron Massey <aaronmassey@google.com>
Diffstat (limited to 'include/driver')
-rw-r--r-- | include/driver/temp_sensor/thermistor.h | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/include/driver/temp_sensor/thermistor.h b/include/driver/temp_sensor/thermistor.h index 7ebe2b42ac..adcd5c5be4 100644 --- a/include/driver/temp_sensor/thermistor.h +++ b/include/driver/temp_sensor/thermistor.h @@ -147,4 +147,20 @@ int get_temp_3v0_22k6_47k_4050b(int idx_adc, int *temp_ptr); int get_temp_3v3_30k9_47k_4050b(int idx_adc, int *temp_ptr); #endif -#endif /* __CROS_EC_TEMP_SENSOR_THERMISTOR_NCP15WB_H */ +/** + * Reads the sensor's ADC channel and uses a lookup table and interpolation to + * argument thermistor_info for interpolation to return a temperature in degrees + * K. + * + * @param idx_adc The idx value from the temp_sensor_t struct, which is + * the ADC channel to read and convert to degrees K + * @param temp_ptr Destination for temperature (in degrees K) + * @param info Structure containing information about the underlying thermistor + * that is necessary to interpolate temperature + * + * @return EC_SUCCESS, or non-zero if error. + */ +int thermistor_get_temperature(int idx_adc, int *temp_ptr, + const struct thermistor_info *info); + +#endif /* __CROS_EC_TEMP_SENSOR_THERMISTOR_NCP15WB_H */ |