summaryrefslogtreecommitdiff
path: root/baseboard
diff options
context:
space:
mode:
authorDevin Lu <devin.lu@quantatw.com>2020-06-04 08:58:12 +0800
committerCommit Bot <commit-bot@chromium.org>2020-06-15 00:11:18 +0000
commite2a86fa31cda43b76ddfec4df6a1a9cf91f90e6c (patch)
treec5fc13476bb08ca81e53d34c74db012de24c7d46 /baseboard
parent6bf64c105990fb33b6ffdbb603ca0dff8f4085a6 (diff)
downloadchrome-ec-e2a86fa31cda43b76ddfec4df6a1a9cf91f90e6c.tar.gz
zork/baseboard: move temperature sensors definition to board variant
There are some differences with temperature sensors for each zork variant. This patch move temperature sensors definition to board variant. BUG=b:157711232 BRANCH=none TEST=Verified console "temps" can read temperature. Build all zork board variant. Signed-off-by: Devin Lu <Devin.Lu@quantatw.com> Change-Id: Ib109ea5adc98e6b6825f8c91db19911dc682a52e Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2227787 Reviewed-by: Edward Hill <ecgh@chromium.org> Commit-Queue: Edward Hill <ecgh@chromium.org> Tested-by: Edward Hill <ecgh@chromium.org>
Diffstat (limited to 'baseboard')
-rw-r--r--baseboard/zork/baseboard.c57
-rw-r--r--baseboard/zork/baseboard.h17
-rw-r--r--baseboard/zork/variant_dalboz.c44
3 files changed, 48 insertions, 70 deletions
diff --git a/baseboard/zork/baseboard.c b/baseboard/zork/baseboard.c
index 703e188024..a848341bb2 100644
--- a/baseboard/zork/baseboard.c
+++ b/baseboard/zork/baseboard.c
@@ -18,8 +18,6 @@
#include "cros_board_info.h"
#include "driver/accelgyro_bmi_common.h"
#include "driver/retimer/pi3hdx1204.h"
-#include "driver/temp_sensor/sb_tsi.h"
-#include "driver/temp_sensor/tmp432.h"
#include "driver/usb_mux/amd_fp5.h"
#include "ec_commands.h"
#include "extpower.h"
@@ -39,7 +37,6 @@
#include "system.h"
#include "task.h"
#include "tcpci.h"
-#include "temp_sensor.h"
#include "thermistor.h"
#include "usb_mux.h"
#include "usb_pd.h"
@@ -55,24 +52,6 @@ const enum gpio_signal hibernate_wake_pins[] = {
};
const int hibernate_wake_pins_used = ARRAY_SIZE(hibernate_wake_pins);
-const struct adc_t adc_channels[] = {
- [ADC_TEMP_SENSOR_CHARGER] = {
- .name = "CHARGER",
- .input_ch = NPCX_ADC_CH2,
- .factor_mul = ADC_MAX_VOLT,
- .factor_div = ADC_READ_MAX + 1,
- .shift = 0,
- },
- [ADC_TEMP_SENSOR_SOC] = {
- .name = "SOC",
- .input_ch = NPCX_ADC_CH3,
- .factor_mul = ADC_MAX_VOLT,
- .factor_div = ADC_READ_MAX + 1,
- .shift = 0,
- },
-};
-BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT);
-
const struct power_signal_info power_signal_list[] = {
[X86_SLP_S3_N] = {
.gpio = GPIO_PCH_SLP_S3_L,
@@ -169,7 +148,7 @@ struct keyboard_scan_config keyscan_config = {
* Values are calculated from the "Resistance VS. Temperature" table on the
* Murata page for part NCP15WB473F03RC. Vdd=3.3V, R=30.9Kohm.
*/
-static const struct thermistor_data_pair thermistor_data[] = {
+const struct thermistor_data_pair thermistor_data[] = {
{ 2761 / THERMISTOR_SCALING_FACTOR, 0},
{ 2492 / THERMISTOR_SCALING_FACTOR, 10},
{ 2167 / THERMISTOR_SCALING_FACTOR, 20},
@@ -185,13 +164,13 @@ static const struct thermistor_data_pair thermistor_data[] = {
{ 283 / THERMISTOR_SCALING_FACTOR, 100}
};
-static const struct thermistor_info thermistor_info = {
+const struct thermistor_info thermistor_info = {
.scaling_factor = THERMISTOR_SCALING_FACTOR,
.num_pairs = ARRAY_SIZE(thermistor_data),
.data = thermistor_data,
};
-static int board_get_temp(int idx, int *temp_k)
+int board_get_temp(int idx, int *temp_k)
{
int mv;
int temp_c;
@@ -222,36 +201,6 @@ static int board_get_temp(int idx, int *temp_k)
return EC_SUCCESS;
}
-const struct temp_sensor_t temp_sensors[] = {
- [TEMP_SENSOR_CHARGER] = {
- .name = "Charger",
- .type = TEMP_SENSOR_TYPE_BOARD,
- .read = board_get_temp,
- .idx = TEMP_SENSOR_CHARGER,
- },
- [TEMP_SENSOR_SOC] = {
- .name = "SOC",
- .type = TEMP_SENSOR_TYPE_BOARD,
- .read = board_get_temp,
- .idx = TEMP_SENSOR_SOC,
- },
- [TEMP_SENSOR_CPU] = {
- .name = "CPU",
- .type = TEMP_SENSOR_TYPE_CPU,
- .read = sb_tsi_get_val,
- .idx = 0,
- },
-#ifdef BOARD_MORPHIUS
- [TEMP_SENSOR_5V_REGULATOR] = {
- .name = "5V_REGULATOR",
- .type = TEMP_SENSOR_TYPE_BOARD,
- .read = tmp432_get_val,
- .idx = TMP432_IDX_LOCAL,
- },
-#endif
-};
-BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT);
-
#ifndef TEST_BUILD
void lid_angle_peripheral_enable(int enable)
{
diff --git a/baseboard/zork/baseboard.h b/baseboard/zork/baseboard.h
index 239c1d583d..04fd6d34c6 100644
--- a/baseboard/zork/baseboard.h
+++ b/baseboard/zork/baseboard.h
@@ -271,12 +271,6 @@
#include "math_util.h"
#include "registers.h"
-enum adc_channel {
- ADC_TEMP_SENSOR_CHARGER,
- ADC_TEMP_SENSOR_SOC,
- ADC_CH_COUNT
-};
-
enum power_signal {
X86_SLP_S3_N,
X86_SLP_S5_N,
@@ -285,16 +279,6 @@ enum power_signal {
POWER_SIGNAL_COUNT
};
-enum temp_sensor_id {
- TEMP_SENSOR_CHARGER = 0,
- TEMP_SENSOR_SOC,
- TEMP_SENSOR_CPU,
-#ifdef BOARD_MORPHIUS
- TEMP_SENSOR_5V_REGULATOR,
-#endif
- TEMP_SENSOR_COUNT
-};
-
enum fan_channel {
FAN_CH_0 = 0,
/* Number of FAN channels */
@@ -359,6 +343,7 @@ int board_tcpc_fast_role_swap_enable(int port, int enable);
void pi3hdx1204_retimer_power(void);
__override_proto int check_hdmi_hpd_status(void);
+int board_get_temp(int idx, int *temp_k);
#endif /* !__ASSEMBLER__ */
diff --git a/baseboard/zork/variant_dalboz.c b/baseboard/zork/variant_dalboz.c
index a3eb193e3e..bea1a15d9c 100644
--- a/baseboard/zork/variant_dalboz.c
+++ b/baseboard/zork/variant_dalboz.c
@@ -3,12 +3,56 @@
* found in the LICENSE file.
*/
+#include "adc.h"
+#include "adc_chip.h"
#include "charger.h"
#include "common.h"
#include "driver/charger/isl9241.h"
+#include "driver/temp_sensor/sb_tsi.h"
#include "gpio.h"
#include "hooks.h"
#include "i2c.h"
+#include "temp_sensor.h"
+
+const struct adc_t adc_channels[] = {
+ [ADC_TEMP_SENSOR_CHARGER] = {
+ .name = "CHARGER",
+ .input_ch = NPCX_ADC_CH2,
+ .factor_mul = ADC_MAX_VOLT,
+ .factor_div = ADC_READ_MAX + 1,
+ .shift = 0,
+ },
+ [ADC_TEMP_SENSOR_SOC] = {
+ .name = "SOC",
+ .input_ch = NPCX_ADC_CH3,
+ .factor_mul = ADC_MAX_VOLT,
+ .factor_div = ADC_READ_MAX + 1,
+ .shift = 0,
+ },
+};
+BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT);
+
+const struct temp_sensor_t temp_sensors[] = {
+ [TEMP_SENSOR_CHARGER] = {
+ .name = "Charger",
+ .type = TEMP_SENSOR_TYPE_BOARD,
+ .read = board_get_temp,
+ .idx = TEMP_SENSOR_CHARGER,
+ },
+ [TEMP_SENSOR_SOC] = {
+ .name = "SOC",
+ .type = TEMP_SENSOR_TYPE_BOARD,
+ .read = board_get_temp,
+ .idx = TEMP_SENSOR_SOC,
+ },
+ [TEMP_SENSOR_CPU] = {
+ .name = "CPU",
+ .type = TEMP_SENSOR_TYPE_CPU,
+ .read = sb_tsi_get_val,
+ .idx = 0,
+ },
+};
+BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT);
const struct i2c_port_t i2c_ports[] = {
{