summaryrefslogtreecommitdiff
path: root/driver/temp_sensor
diff options
context:
space:
mode:
authorDawid Niedzwiecki <dn@semihalf.com>2021-04-20 14:12:36 +0200
committerCommit Bot <commit-bot@chromium.org>2021-04-22 01:42:36 +0000
commit97f1427e200b70d0654d7391f45697f48d1a3d4c (patch)
tree2a7c00ee9720d01956694ee055a7497a51cdf7b6 /driver/temp_sensor
parent11427bfeb18b81afeb5fcf67ed5205748ce5be20 (diff)
downloadchrome-ec-97f1427e200b70d0654d7391f45697f48d1a3d4c.tar.gz
thermisor: move header to include dir
Move the "thermistor.h" header to the include/driver/temp_sensor directory. It is used by the Zephyr shim, so the change is useful to include the header. BUG=b:180403276 BRANCH=none TEST=make buildall Signed-off-by: Dawid Niedzwiecki <dn@semihalf.com> Change-Id: I0e83df97e50a3b324440b65ddb900ddf135f2439 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2843323 Reviewed-by: Keith Short <keithshort@chromium.org> Commit-Queue: Keith Short <keithshort@chromium.org>
Diffstat (limited to 'driver/temp_sensor')
-rw-r--r--driver/temp_sensor/bd99992gw.c2
-rw-r--r--driver/temp_sensor/ec_adc.c2
-rw-r--r--driver/temp_sensor/thermistor.c2
-rw-r--r--driver/temp_sensor/thermistor.h150
-rw-r--r--driver/temp_sensor/thermistor_ncp15wb.c2
5 files changed, 4 insertions, 154 deletions
diff --git a/driver/temp_sensor/bd99992gw.c b/driver/temp_sensor/bd99992gw.c
index 0fc8f094b4..e66642224c 100644
--- a/driver/temp_sensor/bd99992gw.c
+++ b/driver/temp_sensor/bd99992gw.c
@@ -17,7 +17,7 @@
#include "hooks.h"
#include "i2c.h"
#include "temp_sensor.h"
-#include "thermistor.h"
+#include "temp_sensor/thermistor.h"
#include "timer.h"
#include "util.h"
diff --git a/driver/temp_sensor/ec_adc.c b/driver/temp_sensor/ec_adc.c
index db174e33dc..196d191e47 100644
--- a/driver/temp_sensor/ec_adc.c
+++ b/driver/temp_sensor/ec_adc.c
@@ -9,7 +9,7 @@
#include "common.h"
#include "console.h"
#include "ec_adc.h"
-#include "thermistor.h"
+#include "temp_sensor/thermistor.h"
#include "util.h"
/* Get temperature from requested sensor */
diff --git a/driver/temp_sensor/thermistor.c b/driver/temp_sensor/thermistor.c
index dab0e985ce..5a704bf990 100644
--- a/driver/temp_sensor/thermistor.c
+++ b/driver/temp_sensor/thermistor.c
@@ -8,7 +8,7 @@
#include "adc.h"
#include "common.h"
#include "gpio.h"
-#include "thermistor.h"
+#include "temp_sensor/thermistor.h"
#include "util.h"
int thermistor_linear_interpolate(uint16_t mv,
diff --git a/driver/temp_sensor/thermistor.h b/driver/temp_sensor/thermistor.h
deleted file mode 100644
index 7ebe2b42ac..0000000000
--- a/driver/temp_sensor/thermistor.h
+++ /dev/null
@@ -1,150 +0,0 @@
-/* Copyright 2015 The Chromium OS Authors. All rights reserved.
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-/* Thermistor module for Chrome EC */
-
-#ifndef __CROS_EC_TEMP_SENSOR_THERMISTOR_H
-#define __CROS_EC_TEMP_SENSOR_THERMISTOR_H
-
-struct thermistor_data_pair {
- uint8_t mv; /* Scaled voltage level at ADC (in mV) */
- uint8_t temp; /* Temperature in Celsius */
-};
-
-struct thermistor_info {
- uint8_t scaling_factor; /* Scaling factor for voltage in data pair. */
- uint8_t num_pairs; /* Number of data pairs. */
-
- /*
- * Values between given data pairs will be calculated as points on
- * a line. Pairs can be derived using the Steinhart-Hart equation.
- *
- * Guidelines for data sets:
- * - Must contain at least two pairs.
- * - First and last pairs are the max and min.
- * - Pairs must be sorted in descending order.
- * - 5 pairs should provide reasonable accuracy in most cases. Use
- * points where the slope changes significantly or to recalibrate
- * the algorithm if needed.
- */
- const struct thermistor_data_pair *data;
-};
-
-/**
- * Calculate temperature using linear interpolation of data points.
- *
- * Given a set of datapoints, the algorithm will calculate the "step" in
- * between each one in order to interpolate missing entries.
- *
- * @param mv Value read from ADC (in millivolts).
- * @param info Reference data set and info.
- *
- * @return temperature in C
- */
-int thermistor_linear_interpolate(uint16_t mv,
- const struct thermistor_info *info);
-
-#ifdef CONFIG_THERMISTOR_NCP15WB
-/**
- * ncp15wb temperature conversion routine.
- *
- * @param adc 10bit raw data on adc.
- *
- * @return temperature in C.
- */
-int ncp15wb_calculate_temp(uint16_t adc);
-#endif /* CONFIG_THERMISTOR_NCP15WB */
-
-#ifdef CONFIG_STEINHART_HART_3V3_13K7_47K_4050B
-/**
- * Reads the specified ADC channel and uses a lookup table and interpolation to
- * return a temperature in degrees K.
- *
- * The lookup table is based off of a resistor divider circuit on 3.3V with a
- * 13.7K resistor in series with a thermistor with nominal value of 47K (at 25C)
- * and a B (25/100) value of 4050.
- *
- * @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)
- *
- * @return EC_SUCCESS, or non-zero if error.
- */
-int get_temp_3v3_13k7_47k_4050b(int idx_adc, int *temp_ptr);
-#endif
-
-#ifdef CONFIG_STEINHART_HART_3V3_51K1_47K_4050B
-/**
- * Reads the specified ADC channel and uses a lookup table and interpolation to
- * return a temperature in degrees K.
- *
- * The lookup table is based off of a resistor divider circuit on 3.3V with a
- * 51.1K resistor in series with a thermistor with nominal value of 47K (at 25C)
- * and a B (25/100) value of 4050.
- *
- * @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)
- *
- * @return EC_SUCCESS, or non-zero if error.
- */
-int get_temp_3v3_51k1_47k_4050b(int idx_adc, int *temp_ptr);
-#endif
-
-#ifdef CONFIG_STEINHART_HART_6V0_51K1_47K_4050B
-/**
- * Reads the specified ADC channel and uses a lookup table and interpolation to
- * return a temperature in degrees K.
- *
- * The lookup table is based off of a resistor divider circuit on 6.0V with a
- * 51.1K resistor in series with a thermistor with nominal value of 47K (at 25C)
- * and a B (25/100) value of 4050.
- *
- * @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)
- *
- * @return EC_SUCCESS, or non-zero if error.
- */
-int get_temp_6v0_51k1_47k_4050b(int idx_adc, int *temp_ptr);
-#endif
-
-#ifdef CONFIG_STEINHART_HART_3V0_22K6_47K_4050B
-/**
- * Reads the specified ADC channel and uses a lookup table and interpolation to
- * return a temperature in degrees K.
- *
- * The lookup table is based off of a resistor divider circuit on 3V with a
- * 22.6K resistor in series with a thermistor with nominal value of 47K (at 25C)
- * and a B (25/100) value of 4050.
- *
- * @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)
- *
- * @return EC_SUCCESS, or non-zero if error.
- */
-int get_temp_3v0_22k6_47k_4050b(int idx_adc, int *temp_ptr);
-#endif
-
-#ifdef CONFIG_STEINHART_HART_3V3_30K9_47K_4050B
-/**
- * Reads the specified ADC channel and uses a lookup table and interpolation to
- * return a temperature in degrees K.
- *
- * The lookup table is based off of a resistor divider circuit on 3.3V with a
- * 30.9K resistor in series with a thermistor with nominal value of 47K (at 25C)
- * and a B (25/100) value of 4050.
- *
- * @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)
- *
- * @return EC_SUCCESS, or non-zero if error.
- */
-int get_temp_3v3_30k9_47k_4050b(int idx_adc, int *temp_ptr);
-#endif
-
-#endif /* __CROS_EC_TEMP_SENSOR_THERMISTOR_NCP15WB_H */
diff --git a/driver/temp_sensor/thermistor_ncp15wb.c b/driver/temp_sensor/thermistor_ncp15wb.c
index 51e884ed35..dba06ee326 100644
--- a/driver/temp_sensor/thermistor_ncp15wb.c
+++ b/driver/temp_sensor/thermistor_ncp15wb.c
@@ -6,7 +6,7 @@
/* NCP15WB thermistor module for Chrome EC */
#include "common.h"
-#include "thermistor.h"
+#include "temp_sensor/thermistor.h"
#include "util.h"
/*