summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSue Chen <sue.chen@quanta.corp-partner.google.com>2021-12-20 15:49:54 +0800
committerCommit Bot <commit-bot@chromium.org>2021-12-23 03:59:19 +0000
commit5785c1dbb935f9cdca7b2591517db6a1135978f2 (patch)
tree46cf1a87b79e33653d0cc00b49c8468b280881d8
parenta1886180045644e7a787016b38a29600524fed67 (diff)
downloadchrome-ec-5785c1dbb935f9cdca7b2591517db6a1135978f2.tar.gz
Dewatt: Ambient temp sensor use PCT2075
Dewatt use PCT2075 for ambient temp sensor. BUG=none BRANCH=none TEST=make sure ectool/console can read ambient temp correctly. Signed-off-by: Sue Chen <sue.chen@quanta.corp-partner.google.com> Change-Id: I6590462170816d850d96283de31a2e3620941f06 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3350268 Reviewed-by: Diana Z <dzigterman@chromium.org> Reviewed-by: Rob Barnes <robbarnes@google.com>
-rw-r--r--board/dewatt/board.c26
-rw-r--r--board/dewatt/board.h9
2 files changed, 21 insertions, 14 deletions
diff --git a/board/dewatt/board.c b/board/dewatt/board.c
index 9d9ed1bbc1..c22a430782 100644
--- a/board/dewatt/board.c
+++ b/board/dewatt/board.c
@@ -17,7 +17,7 @@
#include "driver/retimer/ps8811.h"
#include "driver/retimer/ps8818.h"
#include "driver/temp_sensor/sb_tsi.h"
-#include "driver/temp_sensor/tmp112.h"
+#include "driver/temp_sensor/pct2075.h"
#include "extpower.h"
#include "gpio.h"
#include "hooks.h"
@@ -30,7 +30,7 @@
#include "tablet_mode.h"
#include "temp_sensor.h"
#include "temp_sensor/thermistor.h"
-#include "temp_sensor/tmp112.h"
+#include "temp_sensor/pct2075.h"
#include "thermal.h"
#include "usb_mux.h"
@@ -303,7 +303,7 @@ DECLARE_HOOK(HOOK_INIT, board_init, HOOK_PRIO_DEFAULT);
static void board_chipset_startup(void)
{
if (get_board_version() > 1)
- tmp112_init();
+ pct2075_init();
}
DECLARE_HOOK(HOOK_CHIPSET_STARTUP, board_chipset_startup,
HOOK_PRIO_DEFAULT);
@@ -313,7 +313,7 @@ int board_get_soc_temp_k(int idx, int *temp_k)
if (chipset_in_state(CHIPSET_STATE_HARD_OFF))
return EC_ERROR_NOT_POWERED;
- return tmp112_get_val_k(idx, temp_k);
+ return pct2075_get_val_k(idx, temp_k);
}
int board_get_soc_temp_mk(int *temp_mk)
@@ -321,7 +321,7 @@ int board_get_soc_temp_mk(int *temp_mk)
if (chipset_in_state(CHIPSET_STATE_HARD_OFF))
return EC_ERROR_NOT_POWERED;
- return tmp112_get_val_mk(TMP112_SOC, temp_mk);
+ return pct2075_get_val_mk(PCT2075_SOC, temp_mk);
}
int board_get_ambient_temp_mk(int *temp_mk)
@@ -329,7 +329,7 @@ int board_get_ambient_temp_mk(int *temp_mk)
if (chipset_in_state(CHIPSET_STATE_HARD_OFF))
return EC_ERROR_NOT_POWERED;
- return tmp112_get_val_mk(TMP112_AMB, temp_mk);
+ return pct2075_get_val_mk(PCT2075_AMB, temp_mk);
}
/* ADC Channels */
@@ -375,18 +375,18 @@ BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT);
/* Temp Sensors */
static int board_get_memory_temp(int, int *);
-const struct tmp112_sensor_t tmp112_sensors[] = {
- { I2C_PORT_SENSOR, TMP112_I2C_ADDR_FLAGS0 },
- { I2C_PORT_SENSOR, TMP112_I2C_ADDR_FLAGS1 },
+const struct pct2075_sensor_t pct2075_sensors[] = {
+ { I2C_PORT_SENSOR, PCT2075_I2C_ADDR_FLAGS0 },
+ { I2C_PORT_SENSOR, PCT2075_I2C_ADDR_FLAGS7 },
};
-BUILD_ASSERT(ARRAY_SIZE(tmp112_sensors) == TMP112_COUNT);
+BUILD_ASSERT(ARRAY_SIZE(pct2075_sensors) == PCT2075_COUNT);
const struct temp_sensor_t temp_sensors[] = {
[TEMP_SENSOR_SOC] = {
.name = "SOC",
.type = TEMP_SENSOR_TYPE_BOARD,
.read = board_get_soc_temp_k,
- .idx = TMP112_SOC,
+ .idx = PCT2075_SOC,
},
[TEMP_SENSOR_CHARGER] = {
.name = "Charger",
@@ -409,8 +409,8 @@ const struct temp_sensor_t temp_sensors[] = {
[TEMP_SENSOR_AMBIENT] = {
.name = "Ambient",
.type = TEMP_SENSOR_TYPE_BOARD,
- .read = tmp112_get_val_k,
- .idx = TMP112_AMB,
+ .read = pct2075_get_val_k,
+ .idx = PCT2075_AMB,
},
};
BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT);
diff --git a/board/dewatt/board.h b/board/dewatt/board.h
index 0aba330819..5aa4960d3a 100644
--- a/board/dewatt/board.h
+++ b/board/dewatt/board.h
@@ -54,7 +54,7 @@
#define CONFIG_LED_ONOFF_STATES
/* Thermal Config */
-#define CONFIG_TEMP_SENSOR_TMP112
+#define CONFIG_TEMP_SENSOR_PCT2075
#ifndef __ASSEMBLER__
@@ -95,6 +95,13 @@ enum temp_sensor_id {
TEMP_SENSOR_COUNT
};
+/* PCT2075 sensors */
+enum pct2075_sensor {
+ PCT2075_SOC,
+ PCT2075_AMB,
+ PCT2075_COUNT,
+};
+
#endif /* !__ASSEMBLER__ */
#endif /* __CROS_EC_BOARD_H */