summaryrefslogtreecommitdiff
path: root/driver/temp_sensor
diff options
context:
space:
mode:
Diffstat (limited to 'driver/temp_sensor')
-rw-r--r--driver/temp_sensor/adt7481.c352
-rw-r--r--driver/temp_sensor/adt7481.h178
-rw-r--r--driver/temp_sensor/amd_r19me4070.c90
-rw-r--r--driver/temp_sensor/amd_r19me4070.h20
-rw-r--r--driver/temp_sensor/bd99992gw.c182
-rw-r--r--driver/temp_sensor/bd99992gw.h90
-rw-r--r--driver/temp_sensor/ec_adc.c56
-rw-r--r--driver/temp_sensor/ec_adc.h24
-rw-r--r--driver/temp_sensor/f75303.c93
-rw-r--r--driver/temp_sensor/f75303.h40
-rw-r--r--driver/temp_sensor/g753.c192
-rw-r--r--driver/temp_sensor/g753.h53
-rw-r--r--driver/temp_sensor/g78x.c238
-rw-r--r--driver/temp_sensor/g78x.h140
-rw-r--r--driver/temp_sensor/oti502.c67
-rw-r--r--driver/temp_sensor/oti502.h27
-rw-r--r--driver/temp_sensor/sb_tsi.c41
-rw-r--r--driver/temp_sensor/sb_tsi.h46
-rw-r--r--driver/temp_sensor/thermistor.c273
-rw-r--r--driver/temp_sensor/thermistor.md106
-rw-r--r--driver/temp_sensor/thermistor_ncp15wb.c100
-rw-r--r--driver/temp_sensor/tmp006.c504
-rw-r--r--driver/temp_sensor/tmp006.h43
-rw-r--r--driver/temp_sensor/tmp112.c124
-rw-r--r--driver/temp_sensor/tmp112.h66
-rw-r--r--driver/temp_sensor/tmp411.c330
-rw-r--r--driver/temp_sensor/tmp411.h140
-rw-r--r--driver/temp_sensor/tmp432.c399
-rw-r--r--driver/temp_sensor/tmp432.h143
-rw-r--r--driver/temp_sensor/tmp468.c101
-rw-r--r--driver/temp_sensor/tmp468.h126
31 files changed, 0 insertions, 4384 deletions
diff --git a/driver/temp_sensor/adt7481.c b/driver/temp_sensor/adt7481.c
deleted file mode 100644
index cbd32e5cd5..0000000000
--- a/driver/temp_sensor/adt7481.c
+++ /dev/null
@@ -1,352 +0,0 @@
-/* Copyright 2017 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.
- */
-
-/* ADT7481 temperature sensor module for Chrome EC */
-
-#include "common.h"
-#include "console.h"
-#include "adt7481.h"
-#include "gpio.h"
-#include "i2c.h"
-#include "hooks.h"
-#include "util.h"
-
-static int temp_val_local;
-static int temp_val_remote1;
-static int temp_val_remote2;
-static uint8_t is_sensor_shutdown;
-
-/**
- * Determine whether the sensor is powered.
- *
- * @return non-zero the adt7481 sensor is powered.
- */
-static int has_power(void)
-{
-#ifdef CONFIG_TEMP_SENSOR_POWER_GPIO
- return gpio_get_level(CONFIG_TEMP_SENSOR_POWER_GPIO);
-#else
- return !is_sensor_shutdown;
-#endif
-}
-
-static int raw_read8(const int offset, int *data_ptr)
-{
- return i2c_read8(I2C_PORT_THERMAL, ADT7481_I2C_ADDR_FLAGS,
- offset, data_ptr);
-}
-
-static int raw_write8(const int offset, int data)
-{
- return i2c_write8(I2C_PORT_THERMAL, ADT7481_I2C_ADDR_FLAGS,
- offset, data);
-}
-
-static int get_temp(const int offset, int *temp_ptr)
-{
- int rv;
- int temp_raw = 0;
-
- rv = raw_read8(offset, &temp_raw);
- if (rv < 0)
- return rv;
-
- *temp_ptr = (int)(int8_t)temp_raw;
- return EC_SUCCESS;
-}
-
-#ifdef CONFIG_CMD_TEMP_SENSOR
-static int adt7481_set_temp(const int offset, int temp)
-{
- if (temp < -127 || temp > 127)
- return EC_ERROR_INVAL;
-
- return raw_write8(offset, (uint8_t)temp);
-}
-#endif
-
-int adt7481_get_val(int idx, int *temp_ptr)
-{
- if (!has_power())
- return EC_ERROR_NOT_POWERED;
-
- switch (idx) {
- case ADT7481_IDX_LOCAL:
- *temp_ptr = temp_val_local;
- break;
- case ADT7481_IDX_REMOTE1:
- *temp_ptr = temp_val_remote1;
- break;
- case ADT7481_IDX_REMOTE2:
- *temp_ptr = temp_val_remote2;
- break;
- default:
- return EC_ERROR_UNKNOWN;
- }
-
- return EC_SUCCESS;
-}
-
-static int adt7481_shutdown(uint8_t want_shutdown)
-{
- int ret, value;
-
- if (want_shutdown == is_sensor_shutdown)
- return EC_SUCCESS;
-
- ret = raw_read8(ADT7481_CONFIGURATION1_R, &value);
- if (ret < 0) {
- ccprintf("ERROR: Temp sensor I2C read8 error.\n");
- return ret;
- }
-
- if (want_shutdown && !(value & ADT7481_CONFIG1_RUN_L)) {
- /* adt7481 is running, and want it to shutdown */
- /* CONFIG REG1 BIT6: 0=Run, 1=Shutdown */
- /* shut it down */
- value |= ADT7481_CONFIG1_RUN_L;
- ret = raw_write8(ADT7481_CONFIGURATION1_R, value);
- } else if (!want_shutdown && (value & ADT7481_CONFIG1_RUN_L)) {
- /* adt7481 is shutdown, and want turn it on */
- value &= ~ADT7481_CONFIG1_RUN_L;
- ret = raw_write8(ADT7481_CONFIGURATION1_R, value);
- }
- /* else, the current setting is exactly what you want */
-
- is_sensor_shutdown = want_shutdown;
- return ret;
-}
-
-static int adt7481_set_therm_mode(void)
-{
- int ret = 0;
- int data = 0;
-
- ret = raw_read8(ADT7481_CONFIGURATION1_R, &data);
- if (ret)
- return EC_ERROR_UNKNOWN;
-
- data |= ADT7481_CONFIG1_MODE;
- ret = raw_write8(ADT7481_CONFIGURATION1_W, data);
- if (ret)
- return EC_ERROR_UNKNOWN;
-
- return EC_SUCCESS;
-}
-
-int adt7481_set_therm_limit(int channel, int limit_c, int hysteresis)
-{
- int ret = 0;
- int reg = 0;
-
- if (channel >= ADT7481_CHANNEL_COUNT)
- return EC_ERROR_INVAL;
-
- if (hysteresis > ADT7481_HYSTERESIS_HIGH_LIMIT ||
- hysteresis < ADT7481_HYSTERESIS_LOW_LIMIT)
- return EC_ERROR_INVAL;
-
- /* hysteresis must be less than high limit */
- if (hysteresis > limit_c)
- return EC_ERROR_INVAL;
-
- if (adt7481_set_therm_mode() != EC_SUCCESS)
- return EC_ERROR_UNKNOWN;
-
- switch (channel) {
- case ADT7481_CHANNEL_LOCAL:
- reg = ADT7481_LOCAL_HIGH_LIMIT_W;
- break;
- case ADT7481_CHANNEL_REMOTE1:
- reg = ADT7481_REMOTE1_HIGH_LIMIT_W;
- break;
- case ADT7481_CHANNEL_REMOTE2:
- reg = ADT7481_REMOTE2_HIGH_LIMIT;
- break;
- }
-
- ret = raw_write8(reg, limit_c);
- if (ret)
- return EC_ERROR_UNKNOWN;
-
- ret = raw_write8(ADT7481_THERM_HYSTERESIS, hysteresis);
- if (ret)
- return EC_ERROR_UNKNOWN;
-
- return EC_SUCCESS;
-}
-
-static void adt7481_temp_sensor_poll(void)
-{
- int temp_c;
-
- if (!has_power())
- return;
-
- if (get_temp(ADT7481_LOCAL, &temp_c) == EC_SUCCESS)
- temp_val_local = C_TO_K(temp_c);
-
- if (get_temp(ADT7481_REMOTE1, &temp_c) == EC_SUCCESS)
- temp_val_remote1 = C_TO_K(temp_c);
-
- if (get_temp(ADT7481_REMOTE2, &temp_c) == EC_SUCCESS)
- temp_val_remote2 = C_TO_K(temp_c);
-}
-DECLARE_HOOK(HOOK_SECOND, adt7481_temp_sensor_poll, HOOK_PRIO_TEMP_SENSOR);
-
-#ifdef CONFIG_CMD_TEMP_SENSOR
-static void print_temps(
- const char *name,
- const int adt7481_temp_reg,
- const int adt7481_therm_limit_reg,
- const int adt7481_high_limit_reg,
- const int adt7481_low_limit_reg)
-{
- int value;
-
- if (!has_power()) {
- ccprintf(" ADT7481 is shutdown\n");
- return;
- }
-
- ccprintf("%s:\n", name);
-
- if (get_temp(adt7481_temp_reg, &value) == EC_SUCCESS)
- ccprintf(" Temp %3dC\n", value);
-
- if (get_temp(adt7481_therm_limit_reg, &value) == EC_SUCCESS)
- ccprintf(" Therm Trip %3dC\n", value);
-
- if (get_temp(adt7481_high_limit_reg, &value) == EC_SUCCESS)
- ccprintf(" High Alarm %3dC\n", value);
-
- if (get_temp(adt7481_low_limit_reg, &value) == EC_SUCCESS)
- ccprintf(" Low Alarm %3dC\n", value);
-}
-
-static int print_status(void)
-{
- int value;
-
- print_temps("Local", ADT7481_LOCAL,
- ADT7481_LOCAL_THERM_LIMIT,
- ADT7481_LOCAL_HIGH_LIMIT_R,
- ADT7481_LOCAL_LOW_LIMIT_R);
-
- print_temps("Remote1", ADT7481_REMOTE1,
- ADT7481_REMOTE1_THERM_LIMIT,
- ADT7481_REMOTE1_HIGH_LIMIT_R,
- ADT7481_REMOTE1_LOW_LIMIT_R);
-
- print_temps("Remote2", ADT7481_REMOTE2,
- ADT7481_REMOTE2_THERM_LIMIT,
- ADT7481_REMOTE2_HIGH_LIMIT,
- ADT7481_REMOTE2_LOW_LIMIT);
-
- ccprintf("\n");
-
- if (raw_read8(ADT7481_STATUS1_R, &value) == EC_SUCCESS)
- ccprintf("STATUS1: %pb\n", BINARY_VALUE(value, 8));
-
- if (raw_read8(ADT7481_STATUS2_R, &value) == EC_SUCCESS)
- ccprintf("STATUS2: %pb\n", BINARY_VALUE(value, 8));
-
- if (raw_read8(ADT7481_CONFIGURATION1_R, &value) == EC_SUCCESS)
- ccprintf("CONFIG1: %pb\n", BINARY_VALUE(value, 8));
-
- if (raw_read8(ADT7481_CONFIGURATION2, &value) == EC_SUCCESS)
- ccprintf("CONFIG2: %pb\n", BINARY_VALUE(value, 8));
-
- return EC_SUCCESS;
-}
-
-static int command_adt7481(int argc, char **argv)
-{
- char *command;
- char *e;
- char *power;
- int data;
- int offset;
- int rv;
-
- /* handle "power" command before checking the power status. */
- if ((argc == 3) && !strcasecmp(argv[1], "power")) {
- power = argv[2];
- if (!strncasecmp(power, "on", sizeof("on"))) {
- rv = adt7481_set_power(ADT7481_POWER_ON);
- if (!rv)
- print_status();
- } else if (!strncasecmp(power, "off", sizeof("off")))
- rv = adt7481_set_power(ADT7481_POWER_OFF);
- else
- return EC_ERROR_PARAM2;
- ccprintf("Set ADT7481 %s\n", power);
- return rv;
- }
-
- if (!has_power()) {
- ccprintf("ERROR: Temp sensor not powered.\n");
- return EC_ERROR_NOT_POWERED;
- }
-
- /* If no args just print status */
- if (argc == 1)
- return print_status();
-
- if (argc < 3)
- return EC_ERROR_PARAM_COUNT;
-
- command = argv[1];
- offset = strtoi(argv[2], &e, 0);
- if (*e || offset < 0 || offset > 255)
- return EC_ERROR_PARAM2;
-
- if (!strcasecmp(command, "getbyte")) {
- rv = raw_read8(offset, &data);
- if (rv < 0)
- return rv;
- ccprintf("Byte at offset 0x%02x is %pb\n",
- offset, BINARY_VALUE(data, 8));
- return rv;
- }
-
- /* Remaining commands are "adt7481 set-command offset data" */
- if (argc != 4)
- return EC_ERROR_PARAM_COUNT;
-
- data = strtoi(argv[3], &e, 0);
- if (*e)
- return EC_ERROR_PARAM3;
-
- if (!strcasecmp(command, "settemp")) {
- ccprintf("Setting 0x%02x to %dC\n", offset, data);
- rv = adt7481_set_temp(offset, data);
- } else if (!strcasecmp(command, "setbyte")) {
- ccprintf("Setting 0x%02x to 0x%02x\n", offset, data);
- rv = raw_write8(offset, data);
- } else
- return EC_ERROR_PARAM1;
-
- return rv;
-}
-DECLARE_CONSOLE_COMMAND(adt7481, command_adt7481,
- "[settemp|setbyte <offset> <value>] or [getbyte <offset>] or"
- "[power <on|off>]. "
- "Temps in Celsius.",
- "Print tmp432 temp sensor status or set parameters.");
-#endif
-
-int adt7481_set_power(enum adt7481_power_state power_on)
-{
-#ifndef CONFIG_TEMP_SENSOR_POWER_GPIO
- uint8_t shutdown = (power_on == ADT7481_POWER_OFF) ? 1 : 0;
-
- return adt7481_shutdown(shutdown);
-#else
- gpio_set_level(CONFIG_TEMP_SENSOR_POWER_GPIO, power_on);
- return EC_SUCCESS;
-#endif
-}
-
diff --git a/driver/temp_sensor/adt7481.h b/driver/temp_sensor/adt7481.h
deleted file mode 100644
index 78541a0a3b..0000000000
--- a/driver/temp_sensor/adt7481.h
+++ /dev/null
@@ -1,178 +0,0 @@
-/* Copyright 2017 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.
- */
-
-/* ADT7481 temperature sensor module for Chrome EC */
-
-#ifndef __CROS_EC_ADT7481_H
-#define __CROS_EC_ADT7481_H
-
-#define ADT7481_I2C_ADDR_FLAGS 0x4B
-
-#define ADT7481_IDX_LOCAL 0
-#define ADT7481_IDX_REMOTE1 1
-#define ADT7481_IDX_REMOTE2 2
-
-/* Chip-specific registers */
-#define ADT7481_LOCAL 0x00
-#define ADT7481_REMOTE1 0x01
-#define ADT7481_STATUS1_R 0x02
-#define ADT7481_CONFIGURATION1_R 0x03
-#define ADT7481_CONVERSION_RATE_R 0x04
-#define ADT7481_LOCAL_HIGH_LIMIT_R 0x05
-#define ADT7481_LOCAL_LOW_LIMIT_R 0x06
-#define ADT7481_REMOTE1_HIGH_LIMIT_R 0x07
-#define ADT7481_REMOTE1_LOW_LIMIT_R 0x08
-#define ADT7481_CONFIGURATION1_W 0x09
-#define ADT7481_CONVERSION_RATE_W 0x0a
-#define ADT7481_LOCAL_HIGH_LIMIT_W 0x0b
-#define ADT7481_LOCAL_LOW_LIMIT_W 0x0c
-#define ADT7481_REMOTE1_HIGH_LIMIT_W 0x0d
-#define ADT7481_REMOTE1_LOW_LIMIT_W 0x0e
-#define ADT7481_ONESHOT_W 0x0f
-#define ADT7481_REMOTE1_EXTD_R 0x10
-#define ADT7481_REMOTE1_OFFSET 0x11
-#define ADT7481_REMOTE1_OFFSET_EXTD 0x12
-#define ADT7481_REMOTE1_HIGH_LIMIT_EXTD 0x13
-#define ADT7481_REMOTE1_LOW_LIMIT_EXTD 0x14
-#define ADT7481_REMOTE1_THERM_LIMIT 0x19
-#define ADT7481_LOCAL_THERM_LIMIT 0x20
-#define ADT7481_THERM_HYSTERESIS 0x21
-#define ADT7481_CONSECUTIVE_ALERT 0x22
-#define ADT7481_STATUS2_R 0x23
-#define ADT7481_CONFIGURATION2 0x24
-#define ADT7481_REMOTE2 0x30
-#define ADT7481_REMOTE2_HIGH_LIMIT 0x31
-#define ADT7481_REMOTE2_LOW_LIMIT 0x32
-#define ADT7481_REMOTE2_EXTD_R 0x33
-#define ADT7481_REMOTE2_OFFSET 0x34
-#define ADT7481_REMOTE2_OFFSET_EXTD 0x35
-#define ADT7481_REMOTE2_HIGH_LIMIT_EXTD 0x36
-#define ADT7481_REMOTE2_LOW_LIMIT_EXTD 0x37
-#define ADT7481_REMOTE2_THERM_LIMIT 0x39
-#define ADT7481_DEVICE_ID 0x3d
-#define ADT7481_MANUFACTURER_ID 0x3e
-
-/* Config1 register bits */
-#define ADT7481_CONFIG1_REMOTE1_ALERT_MASK BIT(0)
-#define ADT7481_CONFIG1_REMOTE2_ALERT_MASK BIT(1)
-#define ADT7481_CONFIG1_TEMP_RANGE BIT(2)
-#define ADT7481_CONFIG1_SEL_REMOTE2 BIT(3)
-/* ADT7481_CONFIG1_MODE bit is use to enable THERM mode */
-#define ADT7481_CONFIG1_MODE BIT(5)
-#define ADT7481_CONFIG1_RUN_L BIT(6)
-/* mask all alerts on ALERT# pin */
-#define ADT7481_CONFIG1_ALERT_MASK_L BIT(7)
-
-/* Config2 register bits */
-#define ADT7481_CONFIG2_LOCK BIT(7)
-
-/* Conversion Rate/Channel Select Register */
-#define ADT7481_CONV_RATE_MASK (0x0f)
-#define ADT7481_CONV_RATE_16S (0x00)
-#define ADT7481_CONV_RATE_8S (0x01)
-#define ADT7481_CONV_RATE_4S (0x02)
-#define ADT7481_CONV_RATE_2S (0x03)
-#define ADT7481_CONV_RATE_1S (0x04)
-#define ADT7481_CONV_RATE_500MS (0x05)
-#define ADT7481_CONV_RATE_250MS (0x06)
-#define ADT7481_CONV_RATE_125MS (0x07)
-#define ADT7481_CONV_RATE_62500US (0x08)
-#define ADT7481_CONV_RATE_31250US (0x09)
-#define ADT7481_CONV_RATE_15500US (0x0a)
-/* continuous mode 73 ms averaging */
-#define ADT7481_CONV_RATE_73MS_AVE (0x0b)
-#define ADT7481_CONV_CHAN_SELECT_MASK (0x30)
-#define ADT7481_CONV_CHAN_SEL_ROUND_ROBIN (0 << 4)
-#define ADT7481_CONV_CHAN_SEL_LOCAL BIT(4)
-#define ADT7481_CONV_CHAN_SEL_REMOTE1 (2 << 4)
-#define ADT7481_CONV_CHAN_SEL_REMOTE2 (3 << 4)
-#define ADT7481_CONV_AVERAGING_L BIT(7)
-
-
-/* Status1 register bits */
-#define ADT7481_STATUS1_LOCAL_THERM_ALARM BIT(0)
-#define ADT7481_STATUS1_REMOTE1_THERM_ALARM BIT(1)
-#define ADT7481_STATUS1_REMOTE1_OPEN BIT(2)
-#define ADT7481_STATUS1_REMOTE1_LOW_ALARM BIT(3)
-#define ADT7481_STATUS1_REMOTE1_HIGH_ALARM BIT(4)
-#define ADT7481_STATUS1_LOCAL_LOW_ALARM BIT(5)
-#define ADT7481_STATUS1_LOCAL_HIGH_ALARM BIT(6)
-#define ADT7481_STATUS1_BUSY BIT(7)
-
-/* Status2 register bits */
-#define ADT7481_STATUS2_ALERT BIT(0)
-#define ADT7481_STATUS2_REMOTE2_THERM_ALARM BIT(1)
-#define ADT7481_STATUS2_REMOTE2_OPEN BIT(2)
-#define ADT7481_STATUS2_REMOTE2_LOW_ALARM BIT(3)
-#define ADT7481_STATUS2_REMOTE2_HIGH_ALARM BIT(4)
-
-/* Consecutive Alert register */
-#define ADT7481_CONSEC_MASK (0xf)
-#define ADT7481_CONSEC_1 (0x0)
-#define ADT7481_CONSEC_2 (0x2)
-#define ADT7481_CONSEC_3 (0x6)
-#define ADT7481_CONSEC_4 (0xe)
-#define ADT7481_CONSEC_EN_SCL_TIMEOUT BIT(5)
-#define ADT7481_CONSEC_EN_SDA_TIMEOUT BIT(6)
-#define ADT7481_CONSEC_MASK_LOCAL_ALERT BIT(7)
-
-
-/* Limits */
-#define ADT7481_HYSTERESIS_HIGH_LIMIT 255
-#define ADT7481_HYSTERESIS_LOW_LIMIT 0
-
-enum adt7481_power_state {
- ADT7481_POWER_OFF = 0,
- ADT7481_POWER_ON,
- ADT7481_POWER_COUNT
-};
-
-enum adt7481_channel_id {
- ADT7481_CHANNEL_LOCAL,
- ADT7481_CHANNEL_REMOTE1,
- ADT7481_CHANNEL_REMOTE2,
-
- ADT7481_CHANNEL_COUNT
-};
-
-/**
- * Get the last polled value of a sensor.
- *
- * @param idx Index to read. Idx indicates whether to read die
- * temperature or external temperature.
- * @param temp_ptr Destination for temperature in K.
- *
- * @return EC_SUCCESS if successful, non-zero if error.
- */
-int adt7481_get_val(int idx, int *temp_ptr);
-
-/**
- * Power control function of ADT7481 temperature sensor.
- *
- * @param power_on ADT7481_POWER_ON: turn ADT7481 sensor on.
- * ADT7481_POWER_OFF: shut ADT7481 sensor down.
- *
- * @return EC_SUCCESS if successful, non-zero if error.
- */
-int adt7481_set_power(enum adt7481_power_state power_on);
-
-/*
- * Set ADT7481 ALERT#/THERM2# pin to THERM mode, and give a limit
- * for a specific channel.
- *
- * @param channel specific a channel
- *
- * @param limit_c High limit temperature, default: 85C
- *
- * @param hysteresis Hysteresis temperature, default: 10C
- * All channels share the same hysteresis
- *
- * In THERM mode, ALERT# pin will trigger(Low) by itself when any
- * channel's temperature is greater( >= )than channel's limit_c,
- * and release(High) by itself when channel's temperature is lower
- * than (limit_c - hysteresis)
- */
-int adt7481_set_therm_limit(int channel, int limit_c, int hysteresis);
-#endif /* __CROS_EC_ADT7481_H */
diff --git a/driver/temp_sensor/amd_r19me4070.c b/driver/temp_sensor/amd_r19me4070.c
deleted file mode 100644
index b331a1a3eb..0000000000
--- a/driver/temp_sensor/amd_r19me4070.c
+++ /dev/null
@@ -1,90 +0,0 @@
-/* Copyright 2020 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.
- */
-
-/* R19ME4070 temperature sensor module for Chrome EC */
-
-#include "chipset.h"
-#include "common.h"
-#include "console.h"
-#include "hooks.h"
-#include "i2c.h"
-#include "amd_r19me4070.h"
-#include "power.h"
-
-#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ## args)
-#define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ## args)
-
-/* GPU I2C address */
-#define GPU_ADDR_FLAGS 0x0041
-
-#define GPU_INIT_OFFSET 0x01
-#define GPU_TEMPERATURE_OFFSET 0x03
-
-static int initialized;
-/*
- * Tell SMBus we want to read 4 Byte from register offset(0x01665A)
- */
-static const uint8_t gpu_init_write_value[5] = {
- 0x04, 0x0F, 0x01, 0x66, 0x5A,
-};
-
-static void gpu_init_temp_sensor(void)
-{
- int rv;
- rv = i2c_write_block(I2C_PORT_GPU, GPU_ADDR_FLAGS, GPU_INIT_OFFSET,
- gpu_init_write_value,
- ARRAY_SIZE(gpu_init_write_value));
- if (rv == EC_SUCCESS) {
- initialized = 1;
- return;
- }
- CPRINTS("init GPU fail");
-}
-
-/* INIT GPU first before read the GPU's die tmeperature. */
-int get_temp_R19ME4070(int idx, int *temp_ptr)
-{
- uint8_t reg[5];
- int rv;
-
- /*
- * We shouldn't read the GPU temperature when the state
- * is not in S0, because GPU is enabled in S0.
- */
- if ((power_get_state()) != POWER_S0) {
- *temp_ptr = C_TO_K(0);
- return EC_ERROR_BUSY;
- }
- /* if no INIT GPU, must init it first and wait 1 sec. */
- if (!initialized) {
- gpu_init_temp_sensor();
- *temp_ptr = C_TO_K(0);
- return EC_ERROR_BUSY;
- }
- rv = i2c_read_block(I2C_PORT_GPU, GPU_ADDR_FLAGS,
- GPU_TEMPERATURE_OFFSET, reg, ARRAY_SIZE(reg));
- if (rv) {
- CPRINTS("read GPU Temperature fail");
- *temp_ptr = C_TO_K(0);
- return rv;
- }
- /*
- * The register is four bytes, bit[17:9] represents the GPU temperature.
- * 0x000 : 0 ゚C
- * 0x001 : 1 ゚C
- * 0x002 : 2 ゚C
- * ...
- * 0x1FF : 511 ゚C
- * -------------------------------
- * reg[4] = bit0 - bit7
- * reg[3] = bit8 - bit15
- * reg[2] = bit16 - bit23
- * reg[1] = bit24 - bit31
- * reg[0] = 0x04
- */
- *temp_ptr = C_TO_K(reg[3] >> 1);
-
- return EC_SUCCESS;
-}
diff --git a/driver/temp_sensor/amd_r19me4070.h b/driver/temp_sensor/amd_r19me4070.h
deleted file mode 100644
index d3c7977ba5..0000000000
--- a/driver/temp_sensor/amd_r19me4070.h
+++ /dev/null
@@ -1,20 +0,0 @@
-/* Copyright 2020 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.
- */
-
-/* GPU R19ME4070 configuration */
-
-#ifndef __CROS_EC_R19ME4070_H
-#define __CROS_EC_R19ME4070_H
-
-/* GPU features */
-#define R19ME4070_LOCAL 0
-
-/*
- * get GPU temperature value and move to *tem_ptr
- * One second trigger ,Use I2C read GPU's Die temperature.
- */
-int get_temp_R19ME4070(int idx, int *temp_ptr);
-
-#endif /* __CROS_EC_AMD_R19ME4070_H */
diff --git a/driver/temp_sensor/bd99992gw.c b/driver/temp_sensor/bd99992gw.c
deleted file mode 100644
index e66642224c..0000000000
--- a/driver/temp_sensor/bd99992gw.c
+++ /dev/null
@@ -1,182 +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.
- */
-
-/*
- * BD99992GW PMIC temperature sensor module for Chrome EC.
- * Note that ADC / temperature sensor registers are only active while
- * the PMIC is in S0.
- */
-
-#include "bd99992gw.h"
-#include "chipset.h"
-#include "common.h"
-#include "console.h"
-#include "gpio.h"
-#include "hooks.h"
-#include "i2c.h"
-#include "temp_sensor.h"
-#include "temp_sensor/thermistor.h"
-#include "timer.h"
-#include "util.h"
-
-/* Console output macros */
-#define CPUTS(outstr) cputs(CC_THERMAL, outstr)
-#define CPRINTS(format, args...) cprints(CC_THERMAL, format, ## args)
-
-/* List of active channels, ordered by pointer register */
-static enum bd99992gw_adc_channel
- active_channels[BD99992GW_ADC_POINTER_REG_COUNT];
-
-/*
- * Use 27ms as the period between ADC conversions, as we will typically be
- * sampling temperature sensors every second, and 27ms is the longest
- * supported period.
- */
-#define ADC_LOOP_PERIOD BD99992GW_ADC1CNTL1_SLP27MS
-
-static int raw_read8(const int offset, int *data_ptr)
-{
- int ret;
- ret = i2c_read8(I2C_PORT_THERMAL, BD99992GW_I2C_ADDR_FLAGS,
- offset, data_ptr);
- if (ret != EC_SUCCESS)
- CPRINTS("bd99992gw read fail %d", ret);
- return ret;
-}
-
-static int raw_write8(const int offset, int data)
-{
- int ret;
- ret = i2c_write8(I2C_PORT_THERMAL, BD99992GW_I2C_ADDR_FLAGS,
- offset, data);
- if (ret != EC_SUCCESS)
- CPRINTS("bd99992gw write fail %d", ret);
- return ret;
-}
-
-static void bd99992gw_init(void)
-{
- int i;
- int active_channel_count = 0;
- uint8_t pointer_reg = BD99992GW_REG_ADC1ADDR0;
-
- /* Mark active channels from the board temp sensor table */
- for (i = 0; i < TEMP_SENSOR_COUNT; ++i)
- if (temp_sensors[i].read == bd99992gw_get_val)
- active_channels[active_channel_count++] =
- temp_sensors[i].idx;
-
- /* Make sure we don't have too many active channels. */
- ASSERT(active_channel_count <= ARRAY_SIZE(active_channels));
-
- /* Mark the first unused channel so we know where to stop searching */
- if (active_channel_count != ARRAY_SIZE(active_channels))
- active_channels[active_channel_count] =
- BD99992GW_ADC_CHANNEL_NONE;
-
- /* Now write pointer regs with channel to monitor */
- for (i = 0; i < active_channel_count; ++i)
- /* Write stop bit on last channel */
- if (raw_write8(pointer_reg + i, active_channels[i] |
- ((i == active_channel_count - 1) ?
- BD99992GW_ADC1ADDR_STOP : 0)))
- return;
-
- /* Enable ADC interrupts */
- if (raw_write8(BD99992GW_REG_MADC1INT, 0xf & ~BD99992GW_MADC1INT_RND))
- return;
- if (raw_write8(BD99992GW_REG_IRQLVL1MSK, BD99992GW_IRQLVL1MSK_MADC))
- return;
-
- /* Enable ADC sequencing */
- if (raw_write8(BD99992GW_REG_ADC1CNTL2, BD99992GW_ADC1CNTL2_ADCTHERM))
- return;
-
- /* Start round-robin conversions at 27ms period */
- raw_write8(BD99992GW_REG_ADC1CNTL1, ADC_LOOP_PERIOD |
- BD99992GW_ADC1CNTL1_ADEN | BD99992GW_ADC1CNTL1_ADSTRT);
-}
-/*
- * Some regs only work in S0, so we must initialize on AP startup in
- * addition to INIT.
- */
-DECLARE_HOOK(HOOK_INIT, bd99992gw_init, HOOK_PRIO_DEFAULT);
-DECLARE_HOOK(HOOK_CHIPSET_RESUME, bd99992gw_init, HOOK_PRIO_DEFAULT);
-
-/* Convert ADC result to temperature in celsius */
-static int bd99992gw_get_temp(uint16_t adc)
-{
-#ifdef CONFIG_THERMISTOR_NCP15WB
- return ncp15wb_calculate_temp(adc);
-#else
-#error "Unknown thermistor for bd99992gw"
- return 0;
-#endif
-}
-
-/* Get temperature from requested sensor */
-int bd99992gw_get_val(int idx, int *temp_ptr)
-{
- uint16_t adc;
- int i, read, ret;
- enum bd99992gw_adc_channel channel;
-
- /* ADC unit is only functional in S0 */
- if (!chipset_in_state(CHIPSET_STATE_ON))
- return EC_ERROR_NOT_POWERED;
-
- /* Find requested channel */
- for (i = 0; i < ARRAY_SIZE(active_channels); ++i) {
- channel = active_channels[i];
- if (channel == idx ||
- channel == BD99992GW_ADC_CHANNEL_NONE)
- break;
- }
-
- /* Make sure we found it */
- if (i == ARRAY_SIZE(active_channels) ||
- active_channels[i] != idx) {
- CPRINTS("Bad ADC channel %d", idx);
- return EC_ERROR_INVAL;
- }
-
- /* Pause conversions */
- ret = raw_write8(0x80,
- ADC_LOOP_PERIOD |
- BD99992GW_ADC1CNTL1_ADEN |
- BD99992GW_ADC1CNTL1_ADSTRT |
- BD99992GW_ADC1CNTL1_ADPAUSE);
- if (ret)
- return ret;
-
- /* Read 10-bit ADC result */
- ret = raw_read8(BD99992GW_REG_ADC1DATA0L + 2 * i, &read);
- if (ret)
- return ret;
- adc = read;
- ret = raw_read8(BD99992GW_REG_ADC1DATA0H + 2 * i, &read);
- if (ret)
- return ret;
- adc |= read << 2;
-
- /* Convert temperature to C / K */
- *temp_ptr = C_TO_K(bd99992gw_get_temp(adc));
-
- /* Clear interrupts */
- ret = raw_write8(BD99992GW_REG_ADC1INT, BD99992GW_ADC1INT_RND);
- if (ret)
- return ret;
- ret = raw_write8(BD99992GW_REG_IRQLVL1, BD99992GW_IRQLVL1_ADC);
- if (ret)
- return ret;
-
- /* Resume conversions */
- ret = raw_write8(BD99992GW_REG_ADC1CNTL1, ADC_LOOP_PERIOD |
- BD99992GW_ADC1CNTL1_ADEN | BD99992GW_ADC1CNTL1_ADSTRT);
- if (ret)
- return ret;
-
- return EC_SUCCESS;
-}
diff --git a/driver/temp_sensor/bd99992gw.h b/driver/temp_sensor/bd99992gw.h
deleted file mode 100644
index c461012c45..0000000000
--- a/driver/temp_sensor/bd99992gw.h
+++ /dev/null
@@ -1,90 +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.
- */
-
-/* G781 temperature sensor module for Chrome EC */
-
-#ifndef __CROS_EC_TEMP_SENSOR_BD99992GW_H
-#define __CROS_EC_TEMP_SENSOR_BD99992GW_H
-
-#define BD99992GW_I2C_ADDR_FLAGS 0x30
-
-/* ADC channels */
-enum bd99992gw_adc_channel {
- BD99992GW_ADC_CHANNEL_NONE = -1,
- BD99992GW_ADC_CHANNEL_BATTERY = 0,
- BD99992GW_ADC_CHANNEL_AC = 1,
- BD99992GW_ADC_CHANNEL_SYSTHERM0 = 2,
- BD99992GW_ADC_CHANNEL_SYSTHERM1 = 3,
- BD99992GW_ADC_CHANNEL_SYSTHERM2 = 4,
- BD99992GW_ADC_CHANNEL_SYSTHERM3 = 5,
- BD99992GW_ADC_CHANNEL_DIE_TEMP = 6,
- BD99992GW_ADC_CHANNEL_VDC = 7,
- BD99992GW_ADC_CHANNEL_COUNT = 8,
-};
-
-/* Registers */
-#define BD99992GW_REG_IRQLVL1 0x02
-#define BD99992GW_IRQLVL1_ADC BIT(1) /* ADC IRQ asserted */
-
-#define BD99992GW_REG_ADC1INT 0x03
-#define BD99992GW_ADC1INT_RND BIT(0) /* RR cycle completed */
-
-#define BD99992GW_REG_MADC1INT 0x0a
-#define BD99992GW_MADC1INT_RND BIT(0) /* RR cycle mask */
-
-#define BD99992GW_REG_IRQLVL1MSK 0x13
-#define BD99992GW_IRQLVL1MSK_MADC BIT(1) /* ADC IRQ mask */
-
-#define BD99992GW_REG_ADC1CNTL1 0x80
-#define BD99992GW_ADC1CNTL1_SLP27MS (0x6 << 3) /* 27ms between pass */
-#define BD99992GW_ADC1CNTL1_NOLOOP (0x7 << 3) /* Single loop pass only */
-#define BD99992GW_ADC1CNTL1_ADPAUSE BIT(2) /* ADC pause */
-#define BD99992GW_ADC1CNTL1_ADSTRT BIT(1) /* ADC start */
-#define BD99992GW_ADC1CNTL1_ADEN BIT(0) /* ADC enable */
-
-#define BD99992GW_REG_ADC1CNTL2 0x81
-#define BD99992GW_ADC1CNTL2_ADCTHERM BIT(0) /* Enable ADC sequencing */
-
- /* ADC1 Pointer file regs - assign to proper bd99992gw_adc_channel */
-#define BD99992GW_ADC_POINTER_REG_COUNT 8
-#define BD99992GW_REG_ADC1ADDR0 0x82
-#define BD99992GW_REG_ADC1ADDR1 0x83
-#define BD99992GW_REG_ADC1ADDR2 0x84
-#define BD99992GW_REG_ADC1ADDR3 0x85
-#define BD99992GW_REG_ADC1ADDR4 0x86
-#define BD99992GW_REG_ADC1ADDR5 0x87
-#define BD99992GW_REG_ADC1ADDR6 0x88
-#define BD99992GW_REG_ADC1ADDR7 0x89
-#define BD99992GW_ADC1ADDR_STOP BIT(3) /* Last conversion channel */
-
-/* Result registers */
-#define BD99992GW_REG_ADC1DATA0L 0x95
-#define BD99992GW_REG_ADC1DATA0H 0x96
-#define BD99992GW_REG_ADC1DATA1L 0x97
-#define BD99992GW_REG_ADC1DATA1H 0x98
-#define BD99992GW_REG_ADC1DATA2L 0x99
-#define BD99992GW_REG_ADC1DATA2H 0x9a
-#define BD99992GW_REG_ADC1DATA3L 0x9b
-#define BD99992GW_REG_ADC1DATA3H 0x9c
-#define BD99992GW_REG_ADC1DATA4L 0x9d
-#define BD99992GW_REG_ADC1DATA4H 0x9e
-#define BD99992GW_REG_ADC1DATA5L 0x9f
-#define BD99992GW_REG_ADC1DATA5H 0xa0
-#define BD99992GW_REG_ADC1DATA6L 0xa1
-#define BD99992GW_REG_ADC1DATA6H 0xa2
-#define BD99992GW_REG_ADC1DATA7L 0xa3
-#define BD99992GW_REG_ADC1DATA7H 0xa4
-
-/**
- * Get the latest value from the sensor.
- *
- * @param idx ADC channel to read.
- * @param temp_ptr Destination for temperature in K.
- *
- * @return EC_SUCCESS if successful, non-zero if error.
- */
-int bd99992gw_get_val(int idx, int *temp_ptr);
-
-#endif /* __CROS_EC_TEMP_SENSOR_BD99992GW_H */
diff --git a/driver/temp_sensor/ec_adc.c b/driver/temp_sensor/ec_adc.c
deleted file mode 100644
index 196d191e47..0000000000
--- a/driver/temp_sensor/ec_adc.c
+++ /dev/null
@@ -1,56 +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.
- */
-
-/* EC_ADC driver for Chrome EC */
-
-#include "adc.h"
-#include "common.h"
-#include "console.h"
-#include "ec_adc.h"
-#include "temp_sensor/thermistor.h"
-#include "util.h"
-
-/* Get temperature from requested sensor */
-static int get_temp(int idx, int *temp_ptr)
-{
- int temp_raw = 0;
-
- /* Read 10-bit ADC result */
- temp_raw = adc_read_channel(idx);
-
- if (temp_raw == ADC_READ_ERROR)
- return EC_ERROR_UNKNOWN;
-
- /* TODO : Need modification here if the result is not 10-bit */
-
- /* If there is no thermistor calculation function.
- * 1. Add adjusting function like thermistor_ncp15wb.c
- * 2. Place function here with ifdef
- * 3. define it on board.h
- */
-#ifdef CONFIG_THERMISTOR_NCP15WB
- *temp_ptr = ncp15wb_calculate_temp((uint16_t) temp_raw);
-#else
-#error "Unknown thermistor for ec_adc"
- return EC_ERROR_UNKNOWN;
-#endif
-
- return EC_SUCCESS;
-}
-
-int ec_adc_get_val(int idx, int *temp_ptr)
-{
- int ret;
- int temp_c;
-
- if(idx < 0 || idx >= ADC_CH_COUNT)
- return EC_ERROR_INVAL;
-
- ret = get_temp(idx, &temp_c);
- if (ret == EC_SUCCESS)
- *temp_ptr = C_TO_K(temp_c);
-
- return ret;
-}
diff --git a/driver/temp_sensor/ec_adc.h b/driver/temp_sensor/ec_adc.h
deleted file mode 100644
index 8ff213e95d..0000000000
--- a/driver/temp_sensor/ec_adc.h
+++ /dev/null
@@ -1,24 +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.
- */
-
-/* ec_adc which uses adc and thermistors module for Chrome EC
- * Some EC has it's own ADC modules, define here EC's max ADC channels.
- * We can consider every channel as a thermal sensor.
- */
-
-#ifndef __CROS_EC_TEMP_SENSOR_EC_ADC_H
-#define __CROS_EC_TEMP_SENSOR_EC_ADC_H
-
-/**
- * Get the latest value from the sensor.
- *
- * @param idx ADC channel to read.
- * @param temp_ptr Destination for temperature in K.
- *
- * @return EC_SUCCESS if successful, non-zero if error.
- */
-int ec_adc_get_val(int idx, int *temp_ptr);
-
-#endif /* __CROS_EC_TEMP_SENSOR_EC_ADC_H */
diff --git a/driver/temp_sensor/f75303.c b/driver/temp_sensor/f75303.c
deleted file mode 100644
index 6b8895a252..0000000000
--- a/driver/temp_sensor/f75303.c
+++ /dev/null
@@ -1,93 +0,0 @@
-/* Copyright 2018 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.
- */
-
-/* F75303 temperature sensor module for Chrome EC */
-
-#include "common.h"
-#include "f75303.h"
-#include "i2c.h"
-#include "hooks.h"
-#include "util.h"
-#include "console.h"
-
-static int temps[F75303_IDX_COUNT];
-static int8_t fake_temp[F75303_IDX_COUNT] = {-1, -1, -1};
-
-/**
- * Read 8 bits register from temp sensor.
- */
-static int raw_read8(const int offset, int *data)
-{
- return i2c_read8(I2C_PORT_THERMAL, F75303_I2C_ADDR_FLAGS,
- offset, data);
-}
-
-static int get_temp(const int offset, int *temp)
-{
- int rv;
- int temp_raw = 0;
-
- rv = raw_read8(offset, &temp_raw);
- if (rv != 0)
- return rv;
-
- *temp = C_TO_K(temp_raw);
- return EC_SUCCESS;
-}
-
-int f75303_get_val(int idx, int *temp)
-{
- if (idx < 0 || F75303_IDX_COUNT <= idx)
- return EC_ERROR_INVAL;
-
- if (fake_temp[idx] != -1) {
- *temp = C_TO_K(fake_temp[idx]);
- return EC_SUCCESS;
- }
-
- *temp = temps[idx];
- return EC_SUCCESS;
-}
-
-static void f75303_sensor_poll(void)
-{
- get_temp(F75303_TEMP_LOCAL, &temps[F75303_IDX_LOCAL]);
- get_temp(F75303_TEMP_REMOTE1, &temps[F75303_IDX_REMOTE1]);
- get_temp(F75303_TEMP_REMOTE2, &temps[F75303_IDX_REMOTE2]);
-}
-DECLARE_HOOK(HOOK_SECOND, f75303_sensor_poll, HOOK_PRIO_TEMP_SENSOR);
-
-static int f75303_set_fake_temp(int argc, char **argv)
-{
- int index;
- int value;
- char *e;
-
- if (argc != 3)
- return EC_ERROR_PARAM_COUNT;
-
- index = strtoi(argv[1], &e, 0);
- if ((*e) || (index < 0) || (index >= F75303_IDX_COUNT))
- return EC_ERROR_PARAM1;
-
- if (!strcasecmp(argv[2], "off")) {
- fake_temp[index] = -1;
- ccprintf("Turn off fake temp mode for sensor %u.\n", index);
- return EC_SUCCESS;
- }
-
- value = strtoi(argv[2], &e, 0);
-
- if ((*e) || (value < 0) || (value > 100))
- return EC_ERROR_PARAM2;
-
- fake_temp[index] = value;
- ccprintf("Force sensor %u = %uC.\n", index, value);
-
- return EC_SUCCESS;
-}
-DECLARE_CONSOLE_COMMAND(f75303, f75303_set_fake_temp,
- "<index> <value>|off",
- "Set fake temperature of sensor f75303.");
diff --git a/driver/temp_sensor/f75303.h b/driver/temp_sensor/f75303.h
deleted file mode 100644
index bdfd2624f0..0000000000
--- a/driver/temp_sensor/f75303.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/* Copyright 2018 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.
- */
-
-/* F75303 temperature sensor module for Chrome EC */
-
-#ifndef __CROS_EC_F75303_H
-#define __CROS_EC_F75303_H
-
-#ifdef BOARD_MUSHU
-#define F75303_I2C_ADDR_FLAGS 0x4D
-#else
-#define F75303_I2C_ADDR_FLAGS 0x4C
-#endif
-
-enum f75303_index {
- F75303_IDX_LOCAL = 0,
- F75303_IDX_REMOTE1,
- F75303_IDX_REMOTE2,
- F75303_IDX_COUNT,
-};
-
-/* F75303 register */
-#define F75303_TEMP_LOCAL 0x00
-#define F75303_TEMP_REMOTE1 0x01
-#define F75303_TEMP_REMOTE2 0x23
-
-/**
- * Get the last polled value of a sensor.
- *
- * @param idx Index to read. Idx indicates whether to read die
- * temperature or external temperature.
- * @param temp Destination for temperature in K.
- *
- * @return EC_SUCCESS if successful, non-zero if error.
- */
-int f75303_get_val(int idx, int *temp);
-
-#endif /* __CROS_EC_F75303_H */
diff --git a/driver/temp_sensor/g753.c b/driver/temp_sensor/g753.c
deleted file mode 100644
index 857263c161..0000000000
--- a/driver/temp_sensor/g753.c
+++ /dev/null
@@ -1,192 +0,0 @@
-/* Copyright 2019 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.
- */
-
-/* G753 temperature sensor module for Chrome EC */
-
-#include "common.h"
-#include "console.h"
-#include "g753.h"
-#include "gpio.h"
-#include "i2c.h"
-#include "hooks.h"
-#include "util.h"
-
-static int temp_val_local;
-
-/**
- * Determine whether the sensor is powered.
- *
- * @return non-zero the g753 sensor is powered.
- */
-static int has_power(void)
-{
-#ifdef CONFIG_TEMP_SENSOR_POWER_GPIO
- return gpio_get_level(CONFIG_TEMP_SENSOR_POWER_GPIO);
-#else
- return 1;
-#endif
-}
-
-static int raw_read8(const int offset, int *data_ptr)
-{
- return i2c_read8(I2C_PORT_THERMAL, G753_I2C_ADDR_FLAGS,
- offset, data_ptr);
-}
-
-#ifdef CONFIG_CMD_TEMP_SENSOR
-static int raw_write8(const int offset, int data)
-{
- return i2c_write8(I2C_PORT_THERMAL, G753_I2C_ADDR_FLAGS,
- offset, data);
-}
-#endif
-
-static int get_temp(const int offset, int *temp_ptr)
-{
- int rv;
- int temp_raw = 0;
-
- rv = raw_read8(offset, &temp_raw);
- if (rv < 0)
- return rv;
-
- *temp_ptr = (int)(int8_t)temp_raw;
- return EC_SUCCESS;
-}
-
-#ifdef CONFIG_CMD_TEMP_SENSOR
-static int set_temp(const int offset, int temp)
-{
- if (temp < -127 || temp > 127)
- return EC_ERROR_INVAL;
-
- return raw_write8(offset, (uint8_t)temp);
-}
-#endif
-
-int g753_get_val(int idx, int *temp_ptr)
-{
- if (!has_power())
- return EC_ERROR_NOT_POWERED;
-
- switch (idx) {
- case G753_IDX_INTERNAL:
- *temp_ptr = temp_val_local;
- break;
- default:
- return EC_ERROR_UNKNOWN;
- }
-
- return EC_SUCCESS;
-}
-
-static void temp_sensor_poll(void)
-{
- if (!has_power())
- return;
-
- get_temp(G753_TEMP_LOCAL, &temp_val_local);
- temp_val_local = C_TO_K(temp_val_local);
-}
-DECLARE_HOOK(HOOK_SECOND, temp_sensor_poll, HOOK_PRIO_TEMP_SENSOR);
-
-#ifdef CONFIG_CMD_TEMP_SENSOR
-static void print_temps(const char *name,
- const int temp_reg,
- const int high_limit_reg)
-{
- int value;
-
- ccprintf("%s:\n", name);
-
- if (get_temp(temp_reg, &value) == EC_SUCCESS)
- ccprintf(" Temp: %3dC\n", value);
-
- if (get_temp(high_limit_reg, &value) == EC_SUCCESS)
- ccprintf(" High Alarm: %3dC\n", value);
-
-}
-
-static int print_status(void)
-{
- int value;
-
- if (!has_power()) {
- ccprintf("ERROR: Temp sensor not powered.\n");
- return EC_ERROR_NOT_POWERED;
- }
-
- print_temps("Local", G753_TEMP_LOCAL,
- G753_LOCAL_TEMP_HIGH_LIMIT_R);
-
- ccprintf("\n");
-
- if (raw_read8(G753_STATUS, &value) == EC_SUCCESS)
- ccprintf("STATUS: %pb\n", BINARY_VALUE(value, 8));
-
- if (raw_read8(G753_CONFIGURATION_R, &value) == EC_SUCCESS)
- ccprintf("CONFIG: %pb\n", BINARY_VALUE(value, 8));
-
- return EC_SUCCESS;
-}
-
-static int command_g753(int argc, char **argv)
-{
- char *command;
- char *e;
- int data;
- int offset;
- int rv;
-
- if (!has_power()) {
- ccprintf("ERROR: Temp sensor not powered.\n");
- return EC_ERROR_NOT_POWERED;
- }
-
- /* If no args just print status */
- if (argc == 1)
- return print_status();
-
- if (argc < 3)
- return EC_ERROR_PARAM_COUNT;
-
- command = argv[1];
- offset = strtoi(argv[2], &e, 0);
- if (*e || offset < 0 || offset > 255)
- return EC_ERROR_PARAM2;
-
- if (!strcasecmp(command, "getbyte")) {
- rv = raw_read8(offset, &data);
- if (rv < 0)
- return rv;
- ccprintf("Byte at offset 0x%02x is %pb\n",
- offset, BINARY_VALUE(data, 8));
- return rv;
- }
-
- /* Remaining commands are of the form "g753 set-command offset data" */
- if (argc != 4)
- return EC_ERROR_PARAM_COUNT;
-
- data = strtoi(argv[3], &e, 0);
- if (*e)
- return EC_ERROR_PARAM3;
-
- if (!strcasecmp(command, "settemp")) {
- ccprintf("Setting 0x%02x to %dC\n", offset, data);
- rv = set_temp(offset, data);
- } else if (!strcasecmp(command, "setbyte")) {
- ccprintf("Setting 0x%02x to 0x%02x\n", offset, data);
- rv = raw_write8(offset, data);
- } else
- return EC_ERROR_PARAM1;
-
- return rv;
-}
-DECLARE_CONSOLE_COMMAND(g753, command_g753,
- "[settemp|setbyte <offset> <value>] or [getbyte <offset>]. "
- "Temps in Celsius.",
- "Print g753 temp sensor status or set parameters.");
-#endif
diff --git a/driver/temp_sensor/g753.h b/driver/temp_sensor/g753.h
deleted file mode 100644
index 04c412bfbb..0000000000
--- a/driver/temp_sensor/g753.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/* Copyright 2019 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.
- */
-
-/* G753 temperature sensor module for Chrome EC */
-
-#ifndef __CROS_EC_G753_H
-#define __CROS_EC_G753_H
-
-
-#define G753_I2C_ADDR_FLAGS 0x48
-
-#define G753_IDX_INTERNAL 0
-
-/* G753 register */
-#define G753_TEMP_LOCAL 0x00
-#define G753_STATUS 0x02
-#define G753_CONFIGURATION_R 0x03
-#define G753_CONVERSION_RATE_R 0x04
-#define G753_LOCAL_TEMP_HIGH_LIMIT_R 0x05
-#define G753_CONFIGURATION_W 0x09
-#define G753_CONVERSION_RATE_W 0x0A
-#define G753_LOCAL_TEMP_HIGH_LIMIT_W 0x0B
-#define G753_ONESHOT 0x0F
-#define G753_Customer_Data_Log_Register_1 0x2D
-#define G753_Customer_Data_Log_Register_2 0x2E
-#define G753_Customer_Data_Log_Register_3 0x2F
-#define G753_ALERT_MODE 0xBF
-#define G753_CHIP_ID 0xFD
-#define G753_VENDOR_ID 0xFE
-#define G753_DEVICE_ID 0xFF
-
-/* Config register bits */
-#define G753_CONFIGURATION_STANDBY BIT(6)
-#define G753_CONFIGURATION_ALERT_MASK BIT(7)
-
-/* Status register bits */
-#define G753_STATUS_LOCAL_TEMP_HIGH_ALARM BIT(6)
-#define G753_STATUS_BUSY BIT(7)
-
-/**
- * Get the last polled value of a sensor.
- *
- * @param idx Index to read. Idx indicates whether to read die
- * temperature or external temperature.
- * @param temp_ptr Destination for temperature in K.
- *
- * @return EC_SUCCESS if successful, non-zero if error.
- */
-int g753_get_val(int idx, int *temp_ptr);
-
-#endif /* __CROS_EC_G753_H */
diff --git a/driver/temp_sensor/g78x.c b/driver/temp_sensor/g78x.c
deleted file mode 100644
index aef13d3d68..0000000000
--- a/driver/temp_sensor/g78x.c
+++ /dev/null
@@ -1,238 +0,0 @@
-/* Copyright 2016 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.
- */
-
-/* G781/G782 temperature sensor module for Chrome EC */
-
-#include "common.h"
-#include "console.h"
-#include "g78x.h"
-#include "gpio.h"
-#include "i2c.h"
-#include "hooks.h"
-#include "util.h"
-
-static int temp_val_local;
-static int temp_val_remote1;
-#ifdef CONFIG_TEMP_SENSOR_G782
-static int temp_val_remote2;
-#endif
-
-/**
- * Determine whether the sensor is powered.
- *
- * @return non-zero the g781/g782 sensor is powered.
- */
-static int has_power(void)
-{
-#ifdef CONFIG_TEMP_SENSOR_POWER_GPIO
- return gpio_get_level(CONFIG_TEMP_SENSOR_POWER_GPIO);
-#else
- return 1;
-#endif
-}
-
-static int raw_read8(const int offset, int *data_ptr)
-{
- return i2c_read8(I2C_PORT_THERMAL, G78X_I2C_ADDR_FLAGS,
- offset, data_ptr);
-}
-
-#ifdef CONFIG_CMD_TEMP_SENSOR
-static int raw_write8(const int offset, int data)
-{
- return i2c_write8(I2C_PORT_THERMAL, G78X_I2C_ADDR_FLAGS,
- offset, data);
-}
-#endif
-
-static int get_temp(const int offset, int *temp_ptr)
-{
- int rv;
- int temp_raw = 0;
-
- rv = raw_read8(offset, &temp_raw);
- if (rv < 0)
- return rv;
-
- *temp_ptr = (int)(int8_t)temp_raw;
- return EC_SUCCESS;
-}
-
-#ifdef CONFIG_CMD_TEMP_SENSOR
-static int set_temp(const int offset, int temp)
-{
- if (temp < -127 || temp > 127)
- return EC_ERROR_INVAL;
-
- return raw_write8(offset, (uint8_t)temp);
-}
-#endif
-
-int g78x_get_val(int idx, int *temp_ptr)
-{
- if (!has_power())
- return EC_ERROR_NOT_POWERED;
-
- switch (idx) {
- case G78X_IDX_INTERNAL:
- *temp_ptr = temp_val_local;
- break;
- case G78X_IDX_EXTERNAL1:
- *temp_ptr = temp_val_remote1;
- break;
-#ifdef CONFIG_TEMP_SENSOR_G782
- case G78X_IDX_EXTERNAL2:
- *temp_ptr = temp_val_remote2;
- break;
-#endif
- default:
- return EC_ERROR_UNKNOWN;
- }
-
- return EC_SUCCESS;
-}
-
-static void temp_sensor_poll(void)
-{
- if (!has_power())
- return;
-
- get_temp(G78X_TEMP_LOCAL, &temp_val_local);
- temp_val_local = C_TO_K(temp_val_local);
-
- get_temp(G78X_TEMP_REMOTE1, &temp_val_remote1);
- temp_val_remote1 = C_TO_K(temp_val_remote1);
-
-#ifdef CONFIG_TEMP_SENSOR_G782
- get_temp(G78X_TEMP_REMOTE2, &temp_val_remote2);
- temp_val_remote2 = C_TO_K(temp_val_remote2);
-#endif
-}
-DECLARE_HOOK(HOOK_SECOND, temp_sensor_poll, HOOK_PRIO_TEMP_SENSOR);
-
-#ifdef CONFIG_CMD_TEMP_SENSOR
-static void print_temps(const char *name,
- const int temp_reg,
- const int therm_limit_reg,
- const int high_limit_reg,
- const int low_limit_reg)
-{
- int value;
-
- ccprintf("%s:\n", name);
-
- if (get_temp(temp_reg, &value) == EC_SUCCESS)
- ccprintf(" Temp: %3dC\n", value);
-
- if (get_temp(therm_limit_reg, &value) == EC_SUCCESS)
- ccprintf(" Therm Trip: %3dC\n", value);
-
- if (get_temp(high_limit_reg, &value) == EC_SUCCESS)
- ccprintf(" High Alarm: %3dC\n", value);
-
- if (get_temp(low_limit_reg, &value) == EC_SUCCESS)
- ccprintf(" Low Alarm: %3dC\n", value);
-}
-
-static int print_status(void)
-{
- int value;
-
- if (!has_power()) {
- ccprintf("ERROR: Temp sensor not powered.\n");
- return EC_ERROR_NOT_POWERED;
- }
-
- print_temps("Local", G78X_TEMP_LOCAL,
- G78X_LOCAL_TEMP_THERM_LIMIT,
- G78X_LOCAL_TEMP_HIGH_LIMIT_R,
- G78X_LOCAL_TEMP_LOW_LIMIT_R);
-
- print_temps("Remote1", G78X_TEMP_REMOTE1,
- G78X_REMOTE1_TEMP_THERM_LIMIT,
- G78X_REMOTE1_TEMP_HIGH_LIMIT_R,
- G78X_REMOTE1_TEMP_LOW_LIMIT_R);
-
-#ifdef CONFIG_TEMP_SENSOR_G782
- print_temps("Remote2", G78X_TEMP_REMOTE1,
- G78X_REMOTE2_TEMP_THERM_LIMIT,
- G78X_REMOTE2_TEMP_HIGH_LIMIT_R,
- G78X_REMOTE2_TEMP_LOW_LIMIT_R);
-#endif
-
- ccprintf("\n");
-
- if (raw_read8(G78X_STATUS, &value) == EC_SUCCESS)
- ccprintf("STATUS: %pb\n", BINARY_VALUE(value, 8));
-
-#ifdef CONFIG_TEMP_SENSOR_G782
- if (raw_read8(G78X_STATUS1, &value) == EC_SUCCESS)
- ccprintf("STATUS1: %pb\n", BINARY_VALUE(value, 8));
-#endif
-
- if (raw_read8(G78X_CONFIGURATION_R, &value) == EC_SUCCESS)
- ccprintf("CONFIG: %pb\n", BINARY_VALUE(value, 8));
-
- return EC_SUCCESS;
-}
-
-static int command_g78x(int argc, char **argv)
-{
- char *command;
- char *e;
- int data;
- int offset;
- int rv;
-
- if (!has_power()) {
- ccprintf("ERROR: Temp sensor not powered.\n");
- return EC_ERROR_NOT_POWERED;
- }
-
- /* If no args just print status */
- if (argc == 1)
- return print_status();
-
- if (argc < 3)
- return EC_ERROR_PARAM_COUNT;
-
- command = argv[1];
- offset = strtoi(argv[2], &e, 0);
- if (*e || offset < 0 || offset > 255)
- return EC_ERROR_PARAM2;
-
- if (!strcasecmp(command, "getbyte")) {
- rv = raw_read8(offset, &data);
- if (rv < 0)
- return rv;
- ccprintf("Byte at offset 0x%02x is %pb\n",
- offset, BINARY_VALUE(data, 8));
- return rv;
- }
-
- /* Remaining commands are of the form "g78x set-command offset data" */
- if (argc != 4)
- return EC_ERROR_PARAM_COUNT;
-
- data = strtoi(argv[3], &e, 0);
- if (*e)
- return EC_ERROR_PARAM3;
-
- if (!strcasecmp(command, "settemp")) {
- ccprintf("Setting 0x%02x to %dC\n", offset, data);
- rv = set_temp(offset, data);
- } else if (!strcasecmp(command, "setbyte")) {
- ccprintf("Setting 0x%02x to 0x%02x\n", offset, data);
- rv = raw_write8(offset, data);
- } else
- return EC_ERROR_PARAM1;
-
- return rv;
-}
-DECLARE_CONSOLE_COMMAND(g78x, command_g78x,
- "[settemp|setbyte <offset> <value>] or [getbyte <offset>]. "
- "Temps in Celsius.",
- "Print g781/g782 temp sensor status or set parameters.");
-#endif
diff --git a/driver/temp_sensor/g78x.h b/driver/temp_sensor/g78x.h
deleted file mode 100644
index fdd987fcbd..0000000000
--- a/driver/temp_sensor/g78x.h
+++ /dev/null
@@ -1,140 +0,0 @@
-/* Copyright 2016 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.
- */
-
-/* G781/G782 temperature sensor module for Chrome EC */
-
-#ifndef __CROS_EC_G78X_H
-#define __CROS_EC_G78X_H
-
-#if defined(CONFIG_TEMP_SENSOR_G781) && defined(CONFIG_TEMP_SENSOR_G782)
-#error Cannot support both G781 and G782 together!
-#endif
-
-#define G78X_I2C_ADDR_FLAGS 0x4C
-
-#define G78X_IDX_INTERNAL 0
-#define G78X_IDX_EXTERNAL1 1
-#define G78X_IDX_EXTERNAL2 2
-
-#if defined(CONFIG_TEMP_SENSOR_G781)
-/* G781 register */
-#define G78X_TEMP_LOCAL 0x00
-#define G78X_TEMP_REMOTE1 0x01
-#define G78X_STATUS 0x02
-#define G78X_CONFIGURATION_R 0x03
-#define G78X_CONVERSION_RATE_R 0x04
-#define G78X_LOCAL_TEMP_HIGH_LIMIT_R 0x05
-#define G78X_LOCAL_TEMP_LOW_LIMIT_R 0x06
-#define G78X_REMOTE1_TEMP_HIGH_LIMIT_R 0x07
-#define G78X_REMOTE1_TEMP_LOW_LIMIT_R 0x08
-#define G78X_CONFIGURATION_W 0x09
-#define G78X_CONVERSION_RATE_W 0x0a
-#define G78X_LOCAL_TEMP_HIGH_LIMIT_W 0x0b
-#define G78X_LOCAL_TEMP_LOW_LIMIT_W 0x0c
-#define G78X_REMOTE1_TEMP_HIGH_LIMIT_W 0x0d
-#define G78X_REMOTE1_TEMP_LOW_LIMIT_W 0x0e
-#define G78X_ONESHOT 0x0f
-#define G78X_REMOTE1_TEMP_EXTENDED 0x10
-#define G78X_REMOTE1_TEMP_OFFSET_HIGH 0x11
-#define G78X_REMOTE1_TEMP_OFFSET_EXTD 0x12
-#define G78X_REMOTE1_T_HIGH_LIMIT_EXTD 0x13
-#define G78X_REMOTE1_T_LOW_LIMIT_EXTD 0x14
-#define G78X_REMOTE1_TEMP_THERM_LIMIT 0x19
-#define G78X_LOCAL_TEMP_THERM_LIMIT 0x20
-#define G78X_THERM_HYSTERESIS 0x21
-#define G78X_ALERT_FAULT_QUEUE_CODE 0x22
-#define G78X_MANUFACTURER_ID 0xFE
-#define G78X_DEVICE_ID 0xFF
-
-/* Config register bits */
-#define G78X_CONFIGURATION_STANDBY BIT(6)
-#define G78X_CONFIGURATION_ALERT_MASK BIT(7)
-
-/* Status register bits */
-#define G78X_STATUS_LOCAL_TEMP_THERM_ALARM BIT(0)
-#define G78X_STATUS_REMOTE1_TEMP_THERM_ALARM BIT(1)
-#define G78X_STATUS_REMOTE1_TEMP_FAULT BIT(2)
-#define G78X_STATUS_REMOTE1_TEMP_LOW_ALARM BIT(3)
-#define G78X_STATUS_REMOTE1_TEMP_HIGH_ALARM BIT(4)
-#define G78X_STATUS_LOCAL_TEMP_LOW_ALARM BIT(5)
-#define G78X_STATUS_LOCAL_TEMP_HIGH_ALARM BIT(6)
-#define G78X_STATUS_BUSY BIT(7)
-
-#elif defined(CONFIG_TEMP_SENSOR_G782)
-/* G782 register */
-#define G78X_TEMP_LOCAL 0x00
-#define G78X_TEMP_REMOTE1 0x01
-#define G78X_TEMP_REMOTE2 0x02
-#define G78X_STATUS 0x03
-#define G78X_CONFIGURATION_R 0x04
-#define G78X_CONFIGURATION_W 0x04
-#define G78X_CONVERSION_RATE_R 0x05
-#define G78X_CONVERSION_RATE_W 0x05
-#define G78X_LOCAL_TEMP_HIGH_LIMIT_R 0x06
-#define G78X_LOCAL_TEMP_HIGH_LIMIT_W 0x06
-#define G78X_LOCAL_TEMP_LOW_LIMIT_R 0x07
-#define G78X_LOCAL_TEMP_LOW_LIMIT_W 0x07
-#define G78X_REMOTE1_TEMP_HIGH_LIMIT_R 0x08
-#define G78X_REMOTE1_TEMP_HIGH_LIMIT_W 0x08
-#define G78X_REMOTE1_TEMP_LOW_LIMIT_R 0x09
-#define G78X_REMOTE1_TEMP_LOW_LIMIT_W 0x09
-#define G78X_REMOTE2_TEMP_HIGH_LIMIT_R 0x0a
-#define G78X_REMOTE2_TEMP_HIGH_LIMIT_W 0x0a
-#define G78X_REMOTE2_TEMP_LOW_LIMIT_R 0x0b
-#define G78X_REMOTE2_TEMP_LOW_LIMIT_W 0x0b
-#define G78X_ONESHOT 0x0c
-#define G78X_REMOTE1_TEMP_EXTENDED 0x0d
-#define G78X_REMOTE1_TEMP_OFFSET_HIGH 0x0e
-#define G78X_REMOTE1_TEMP_OFFSET_EXTD 0x0f
-#define G78X_REMOTE1_T_HIGH_LIMIT_EXTD 0x10
-#define G78X_REMOTE1_T_LOW_LIMIT_EXTD 0x11
-#define G78X_REMOTE1_TEMP_THERM_LIMIT 0x12
-#define G78X_REMOTE2_TEMP_EXTENDED 0x13
-#define G78X_REMOTE2_TEMP_OFFSET_HIGH 0x14
-#define G78X_REMOTE2_TEMP_OFFSET_EXTD 0x15
-#define G78X_REMOTE2_T_HIGH_LIMIT_EXTD 0x16
-#define G78X_REMOTE2_T_LOW_LIMIT_EXTD 0x17
-#define G78X_REMOTE2_TEMP_THERM_LIMIT 0x18
-#define G78X_STATUS1 0x19
-#define G78X_LOCAL_TEMP_THERM_LIMIT 0x20
-#define G78X_THERM_HYSTERESIS 0x21
-#define G78X_ALERT_FAULT_QUEUE_CODE 0x22
-#define G78X_MANUFACTURER_ID 0xFE
-#define G78X_DEVICE_ID 0xFF
-
-/* Config register bits */
-#define G78X_CONFIGURATION_REMOTE2_DIS BIT(5)
-#define G78X_CONFIGURATION_STANDBY BIT(6)
-#define G78X_CONFIGURATION_ALERT_MASK BIT(7)
-
-/* Status register bits */
-#define G78X_STATUS_LOCAL_TEMP_LOW_ALARM BIT(0)
-#define G78X_STATUS_LOCAL_TEMP_HIGH_ALARM BIT(1)
-#define G78X_STATUS_LOCAL_TEMP_THERM_ALARM BIT(2)
-#define G78X_STATUS_REMOTE2_TEMP_THERM_ALARM BIT(3)
-#define G78X_STATUS_REMOTE1_TEMP_THERM_ALARM BIT(4)
-#define G78X_STATUS_REMOTE2_TEMP_FAULT BIT(5)
-#define G78X_STATUS_REMOTE1_TEMP_FAULT BIT(6)
-#define G78X_STATUS_BUSY BIT(7)
-
-/* Status1 register bits */
-#define G78X_STATUS_REMOTE2_TEMP_LOW_ALARM BIT(4)
-#define G78X_STATUS_REMOTE2_TEMP_HIGH_ALARM BIT(5)
-#define G78X_STATUS_REMOTE1_TEMP_LOW_ALARM BIT(6)
-#define G78X_STATUS_REMOTE1_TEMP_HIGH_ALARM BIT(7)
-#endif
-
-/**
- * Get the last polled value of a sensor.
- *
- * @param idx Index to read. Idx indicates whether to read die
- * temperature or external temperature.
- * @param temp_ptr Destination for temperature in K.
- *
- * @return EC_SUCCESS if successful, non-zero if error.
- */
-int g78x_get_val(int idx, int *temp_ptr);
-
-#endif /* __CROS_EC_G78X_H */
diff --git a/driver/temp_sensor/oti502.c b/driver/temp_sensor/oti502.c
deleted file mode 100644
index 8a420363e8..0000000000
--- a/driver/temp_sensor/oti502.c
+++ /dev/null
@@ -1,67 +0,0 @@
-/* Copyright 2019 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.
- */
-
-/* OTI502 temperature sensor module for Chrome EC */
-
-#include "common.h"
-#include "console.h"
-#include "oti502.h"
-#include "i2c.h"
-#include "hooks.h"
-#include "util.h"
-
-static int temp_val_ambient; /* Ambient is chip temperature*/
-static int temp_val_object; /* Object is IR temperature */
-
-static int oti502_read_block(const int offset, uint8_t *data, int len)
-{
- return i2c_read_block(I2C_PORT_THERMAL, OTI502_I2C_ADDR_FLAGS,
- offset, data, len);
-}
-
-int oti502_get_val(int idx, int *temp_ptr)
-{
- switch (idx) {
- case OTI502_IDX_AMBIENT:
- *temp_ptr = temp_val_ambient;
- break;
- case OTI502_IDX_OBJECT:
- *temp_ptr = temp_val_object;
- break;
- default:
- return EC_ERROR_UNKNOWN;
- }
-
- return EC_SUCCESS;
-}
-
-static void temp_sensor_poll(void)
-{
- uint8_t temp_val[6];
-
- memset(temp_val, 0, sizeof(temp_val));
-
- oti502_read_block(0x80, temp_val, sizeof(temp_val));
-
- if (temp_val[2] >= 0x80) {
- /* Treat temperature as 0 degree C if temperature is negative*/
- temp_val_ambient = 0;
- ccprintf("Temperature ambient is negative !\n");
- } else {
- temp_val_ambient = ((temp_val[1] << 8) + temp_val[0]) / 200;
- temp_val_ambient = C_TO_K(temp_val_ambient);
- }
-
- if (temp_val[5] >= 0x80) {
- /* Treat temperature as 0 degree C if temperature is negative*/
- temp_val_object = 0;
- ccprintf("Temperature object is negative !\n");
- } else {
- temp_val_object = ((temp_val[4] << 8) + temp_val[5]) / 200;
- temp_val_object = C_TO_K(temp_val_object);
- }
-}
-DECLARE_HOOK(HOOK_SECOND, temp_sensor_poll, HOOK_PRIO_TEMP_SENSOR);
-
diff --git a/driver/temp_sensor/oti502.h b/driver/temp_sensor/oti502.h
deleted file mode 100644
index 4e846282c1..0000000000
--- a/driver/temp_sensor/oti502.h
+++ /dev/null
@@ -1,27 +0,0 @@
-/* Copyright 2019 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.
- */
-
-/* OTI502 temperature sensor module for Chrome EC */
-
-#ifndef __CROS_EC_OTI502_H
-#define __CROS_EC_OTI502_H
-
-#define OTI502_I2C_ADDR_FLAGS 0x10
-
-#define OTI502_IDX_AMBIENT 0
-#define OTI502_IDX_OBJECT 1
-
-/**
- * Get the last polled value of a sensor.
- *
- * @param idx Index to read. Idx indicates whether to read die
- * temperature or external temperature.
- * @param temp_ptr Destination for temperature in K.
- *
- * @return EC_SUCCESS if successful, non-zero if error.
- */
-int oti502_get_val(int idx, int *temp_ptr);
-
-#endif /* __CROS_EC_OTI502_H */
diff --git a/driver/temp_sensor/sb_tsi.c b/driver/temp_sensor/sb_tsi.c
deleted file mode 100644
index ba47bcb727..0000000000
--- a/driver/temp_sensor/sb_tsi.c
+++ /dev/null
@@ -1,41 +0,0 @@
-/* Copyright 2016 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.
- */
-
-/*
- * SB-TSI: SB Temperature Sensor Interface.
- * This is an I2C temp sensor on the AMD Stony Ridge FT4 SOC.
- */
-
-#include "chipset.h"
-#include "common.h"
-#include "console.h"
-#include "gpio.h"
-#include "hooks.h"
-#include "i2c.h"
-#include "sb_tsi.h"
-#include "util.h"
-
-static int raw_read8(const int offset, int *data_ptr)
-{
- return i2c_read8(I2C_PORT_THERMAL_AP, SB_TSI_I2C_ADDR_FLAGS,
- offset, data_ptr);
-}
-
-int sb_tsi_get_val(int idx, int *temp_ptr)
-{
- int ret;
- /* There is only one temp sensor on the FT4 */
- if (idx != 0)
- return EC_ERROR_PARAM1;
- /* FT4 SB-TSI sensor only powered in S0 */
- if (!chipset_in_state(CHIPSET_STATE_ON))
- return EC_ERROR_NOT_POWERED;
- /* Read the value over I2C */
- ret = raw_read8(SB_TSI_TEMP_H, temp_ptr);
- if (ret)
- return ret;
- *temp_ptr = C_TO_K(*temp_ptr);
- return EC_SUCCESS;
-}
diff --git a/driver/temp_sensor/sb_tsi.h b/driver/temp_sensor/sb_tsi.h
deleted file mode 100644
index b7113dbc70..0000000000
--- a/driver/temp_sensor/sb_tsi.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/* Copyright 2016 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.
- */
-
-/*
- * SB-TSI: SB Temperature Sensor Interface.
- * This is an I2C temp sensor on the AMD Stony Ridge FT4 SOC.
- */
-
-#ifndef __CROS_EC_SB_TSI_H
-#define __CROS_EC_SB_TSI_H
-
-#define SB_TSI_I2C_ADDR_FLAGS 0x4C
-
-/* G781 register */
-#define SB_TSI_TEMP_H 0x01
-#define SB_TSI_STATUS 0x02
-#define SB_TSI_CONFIG_1 0x03
-#define SB_TSI_UPDATE_RATE 0x04
-#define SB_TSI_HIGH_TEMP_THRESHOLD_H 0x07
-#define SB_TSI_LOW_TEMP_THRESHOLD_H 0x08
-#define SB_TSI_CONFIG_2 0x09
-#define SB_TSI_TEMP_L 0x10
-#define SB_TSI_TEMP_OFFSET_H 0x11
-#define SB_TSI_TEMP_OFFSET_L 0x12
-#define SB_TSI_HIGH_TEMP_THRESHOLD_L 0x13
-#define SB_TSI_LOW_TEMP_THRESHOLD_L 0x14
-#define SB_TSI_TIMEOUT_CONFIG 0x22
-#define SB_TSI_PSTATE_LIMIT_CONFIG 0x2F
-#define SB_TSI_ALERT_THRESHOLD 0x32
-#define SB_TSI_ALERT_CONFIG 0xBF
-#define SB_TSI_MANUFACTURE_ID 0xFE
-#define SB_TSI_REVISION 0xFF
-
-/**
- * Get the value of a sensor in K.
- *
- * @param idx Index to read. Only 0 is valid for sb_tsi.
- * @param temp_ptr Destination for temperature in K.
- *
- * @return EC_SUCCESS if successful, non-zero if error.
- */
-int sb_tsi_get_val(int idx, int *temp_ptr);
-
-#endif /* __CROS_EC_SB_TSI_H */
diff --git a/driver/temp_sensor/thermistor.c b/driver/temp_sensor/thermistor.c
deleted file mode 100644
index ffa780cb07..0000000000
--- a/driver/temp_sensor/thermistor.c
+++ /dev/null
@@ -1,273 +0,0 @@
-/* Copyright 2018 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.
- */
-
-/*
- * Common thermistor code for Chrome EC. See ./thermistor.md for table of
- * resistance of a 47kΩ B4050 thermistor
- */
-
-#include "adc.h"
-#include "common.h"
-#include "gpio.h"
-#include "temp_sensor/thermistor.h"
-#include "util.h"
-
-int thermistor_linear_interpolate(uint16_t mv,
- const struct thermistor_info *info)
-{
- const struct thermistor_data_pair *data = info->data;
- int v_high = 0, v_low = 0, t_low, t_high, num_steps;
- int head, tail, mid = 0;
-
- /* We need at least two points to form a line. */
- ASSERT(info->num_pairs >= 2);
-
- /*
- * If input value is out of bounds return the lowest or highest
- * value in the data sets provided.
- */
- if (mv > data[0].mv * info->scaling_factor)
- return data[0].temp;
- else if (mv < data[info->num_pairs - 1].mv * info->scaling_factor)
- return data[info->num_pairs - 1].temp;
-
- head = 0;
- tail = info->num_pairs - 1;
- while (head != tail) {
- mid = (head + tail) / 2;
- v_high = data[mid].mv * info->scaling_factor;
- v_low = data[mid + 1].mv * info->scaling_factor;
-
- if ((mv <= v_high) && (mv >= v_low))
- break;
- else if (mv > v_high)
- tail = mid;
- else if (mv < v_low)
- head = mid + 1;
- }
-
- t_low = data[mid].temp;
- t_high = data[mid + 1].temp;
-
- /*
- * The obvious way of doing this is to figure out how many mV per
- * degree are in between the two points (mv_per_deg_c), and then how
- * many of those exist between the input voltage and voltage of
- * lower temperature :
- * 1. mv_per_deg_c = (v_high - v_low) / (t_high - t_low)
- * 2. num_steps = (v_high - mv) / mv_per_deg_c
- * 3. result = t_low + num_steps
- *
- * Combine #1 and #2 to mitigate precision loss due to integer division.
- */
- num_steps = ((v_high - mv) * (t_high - t_low)) / (v_high - v_low);
- return t_low + num_steps;
-}
-
-#if defined(CONFIG_STEINHART_HART_3V3_51K1_47K_4050B) || \
- defined(CONFIG_STEINHART_HART_3V3_13K7_47K_4050B) || \
- defined(CONFIG_STEINHART_HART_6V0_51K1_47K_4050B) || \
- defined(CONFIG_STEINHART_HART_3V0_22K6_47K_4050B) || \
- defined(CONFIG_STEINHART_HART_3V3_30K9_47K_4050B) || \
- defined(CONFIG_ZEPHYR)
-int thermistor_get_temperature(int idx_adc, int *temp_ptr,
- const struct thermistor_info *info)
-{
- int mv;
-
-#ifdef CONFIG_TEMP_SENSOR_POWER_GPIO
- /*
- * If the power rail for the thermistor circuit is not enabled, then
- * need to ignore any ADC measurments.
- */
- if (!gpio_get_level(CONFIG_TEMP_SENSOR_POWER_GPIO))
- return EC_ERROR_NOT_POWERED;
-#endif /* CONFIG_TEMP_SENSOR_POWER_GPIO */
- mv = adc_read_channel(idx_adc);
- if (mv < 0)
- return EC_ERROR_UNKNOWN;
-
- *temp_ptr = thermistor_linear_interpolate(mv, info);
- *temp_ptr = C_TO_K(*temp_ptr);
- return EC_SUCCESS;
-}
-#endif
-
-#ifdef CONFIG_STEINHART_HART_3V3_51K1_47K_4050B
-/*
- * Data derived from Steinhart-Hart equation in a resistor divider circuit with
- * Vdd=3300mV, R = 51.1Kohm, and thermistor (B = 4050, T0 = 298.15 K, nominal
- * resistance (R0) = 47Kohm).
- */
-#define THERMISTOR_SCALING_FACTOR_51_47 11
-static const struct thermistor_data_pair thermistor_data_51_47[] = {
- { 2484 / THERMISTOR_SCALING_FACTOR_51_47, 0 },
- { 2142 / THERMISTOR_SCALING_FACTOR_51_47, 10 },
- { 1767 / THERMISTOR_SCALING_FACTOR_51_47, 20 },
- { 1400 / THERMISTOR_SCALING_FACTOR_51_47, 30 },
- { 1072 / THERMISTOR_SCALING_FACTOR_51_47, 40 },
- { 802 / THERMISTOR_SCALING_FACTOR_51_47, 50 },
- { 593 / THERMISTOR_SCALING_FACTOR_51_47, 60 },
- { 436 / THERMISTOR_SCALING_FACTOR_51_47, 70 },
- { 321 / THERMISTOR_SCALING_FACTOR_51_47, 80 },
- { 276 / THERMISTOR_SCALING_FACTOR_51_47, 85 },
- { 237 / THERMISTOR_SCALING_FACTOR_51_47, 90 },
- { 204 / THERMISTOR_SCALING_FACTOR_51_47, 95 },
- { 177 / THERMISTOR_SCALING_FACTOR_51_47, 100 },
-};
-
-static const struct thermistor_info thermistor_info_51_47 = {
- .scaling_factor = THERMISTOR_SCALING_FACTOR_51_47,
- .num_pairs = ARRAY_SIZE(thermistor_data_51_47),
- .data = thermistor_data_51_47,
-};
-
-int get_temp_3v3_51k1_47k_4050b(int idx_adc, int *temp_ptr)
-{
- return thermistor_get_temperature(idx_adc, temp_ptr,
- &thermistor_info_51_47);
-}
-#endif /* CONFIG_STEINHART_HART_3V3_51K1_47K_4050B */
-
-#ifdef CONFIG_STEINHART_HART_3V3_13K7_47K_4050B
-/*
- * Data derived from Steinhart-Hart equation in a resistor divider circuit with
- * Vdd=3300mV, R = 13.7Kohm, and thermistor (B = 4050, T0 = 298.15 K, nominal
- * resistance (R0) = 47Kohm).
- */
-#define THERMISTOR_SCALING_FACTOR_13_47 13
-static const struct thermistor_data_pair thermistor_data_13_47[] = {
- { 3033 / THERMISTOR_SCALING_FACTOR_13_47, 0 },
- { 2882 / THERMISTOR_SCALING_FACTOR_13_47, 10 },
- { 2677 / THERMISTOR_SCALING_FACTOR_13_47, 20 },
- { 2420 / THERMISTOR_SCALING_FACTOR_13_47, 30 },
- { 2119 / THERMISTOR_SCALING_FACTOR_13_47, 40 },
- { 1799 / THERMISTOR_SCALING_FACTOR_13_47, 50 },
- { 1485 / THERMISTOR_SCALING_FACTOR_13_47, 60 },
- { 1197 / THERMISTOR_SCALING_FACTOR_13_47, 70 },
- { 947 / THERMISTOR_SCALING_FACTOR_13_47, 80 },
- { 839 / THERMISTOR_SCALING_FACTOR_13_47, 85 },
- { 741 / THERMISTOR_SCALING_FACTOR_13_47, 90 },
- { 653 / THERMISTOR_SCALING_FACTOR_13_47, 95 },
- { 576 / THERMISTOR_SCALING_FACTOR_13_47, 100 },
-};
-
-static const struct thermistor_info thermistor_info_13_47 = {
- .scaling_factor = THERMISTOR_SCALING_FACTOR_13_47,
- .num_pairs = ARRAY_SIZE(thermistor_data_13_47),
- .data = thermistor_data_13_47,
-};
-
-int get_temp_3v3_13k7_47k_4050b(int idx_adc, int *temp_ptr)
-{
- return thermistor_get_temperature(idx_adc, temp_ptr,
- &thermistor_info_13_47);
-}
-#endif /* CONFIG_STEINHART_HART_3V3_13K7_47K_4050B */
-
-#ifdef CONFIG_STEINHART_HART_6V0_51K1_47K_4050B
-/*
- * Data derived from Steinhart-Hart equation in a resistor divider circuit with
- * Vdd=6000mV, R = 51.1Kohm, and thermistor (B = 4050, T0 = 298.15 K, nominal
- * resistance (R0) = 47Kohm).
- */
-#define THERMISTOR_SCALING_FACTOR_6V0_51_47 18
-static const struct thermistor_data_pair thermistor_data_6v0_51_47[] = {
- { 4517 / THERMISTOR_SCALING_FACTOR_6V0_51_47, 0 },
- { 3895 / THERMISTOR_SCALING_FACTOR_6V0_51_47, 10 },
- { 3214 / THERMISTOR_SCALING_FACTOR_6V0_51_47, 20 },
- { 2546 / THERMISTOR_SCALING_FACTOR_6V0_51_47, 30 },
- { 1950 / THERMISTOR_SCALING_FACTOR_6V0_51_47, 40 },
- { 1459 / THERMISTOR_SCALING_FACTOR_6V0_51_47, 50 },
- { 1079 / THERMISTOR_SCALING_FACTOR_6V0_51_47, 60 },
- { 794 / THERMISTOR_SCALING_FACTOR_6V0_51_47, 70 },
- { 584 / THERMISTOR_SCALING_FACTOR_6V0_51_47, 80 },
- { 502 / THERMISTOR_SCALING_FACTOR_6V0_51_47, 85 },
- { 432 / THERMISTOR_SCALING_FACTOR_6V0_51_47, 90 },
- { 372 / THERMISTOR_SCALING_FACTOR_6V0_51_47, 95 },
- { 322 / THERMISTOR_SCALING_FACTOR_6V0_51_47, 100 },
-};
-
-static const struct thermistor_info thermistor_info_6v0_51_47 = {
- .scaling_factor = THERMISTOR_SCALING_FACTOR_6V0_51_47,
- .num_pairs = ARRAY_SIZE(thermistor_data_6v0_51_47),
- .data = thermistor_data_6v0_51_47,
-};
-
-int get_temp_6v0_51k1_47k_4050b(int idx_adc, int *temp_ptr)
-{
- return thermistor_get_temperature(idx_adc, temp_ptr,
- &thermistor_info_6v0_51_47);
-}
-#endif /* CONFIG_STEINHART_HART_6V0_51K1_47K_4050B */
-
-#ifdef CONFIG_STEINHART_HART_3V0_22K6_47K_4050B
-/*
- * Data derived from Steinhart-Hart equation in a resistor divider circuit with
- * Vdd=3000mV, R = 22.6Kohm, and thermistor (B = 4050, T0 = 298.15 K, nominal
- * resistance (R0) = 47Kohm).
- */
-#define THERMISTOR_SCALING_FACTOR_22_47 11
-static const struct thermistor_data_pair thermistor_data_22_47[] = {
- { 2619 / THERMISTOR_SCALING_FACTOR_22_47, 0 },
- { 2421 / THERMISTOR_SCALING_FACTOR_22_47, 10 },
- { 2168 / THERMISTOR_SCALING_FACTOR_22_47, 20 },
- { 1875 / THERMISTOR_SCALING_FACTOR_22_47, 30 },
- { 1563 / THERMISTOR_SCALING_FACTOR_22_47, 40 },
- { 1262 / THERMISTOR_SCALING_FACTOR_22_47, 50 },
- { 994 / THERMISTOR_SCALING_FACTOR_22_47, 60 },
- { 769 / THERMISTOR_SCALING_FACTOR_22_47, 70 },
- { 588 / THERMISTOR_SCALING_FACTOR_22_47, 80 },
- { 513 / THERMISTOR_SCALING_FACTOR_22_47, 85 },
- { 448 / THERMISTOR_SCALING_FACTOR_22_47, 90 },
- { 390 / THERMISTOR_SCALING_FACTOR_22_47, 95 },
- { 340 / THERMISTOR_SCALING_FACTOR_22_47, 100 },
-};
-
-static const struct thermistor_info thermistor_info_22_47 = {
- .scaling_factor = THERMISTOR_SCALING_FACTOR_22_47,
- .num_pairs = ARRAY_SIZE(thermistor_data_22_47),
- .data = thermistor_data_22_47,
-};
-
-int get_temp_3v0_22k6_47k_4050b(int idx_adc, int *temp_ptr)
-{
- return thermistor_get_temperature(idx_adc, temp_ptr,
- &thermistor_info_22_47);
-}
-#endif /* CONFIG_STEINHART_HART_3V0_22K6_47K_4050B */
-
-#ifdef CONFIG_STEINHART_HART_3V3_30K9_47K_4050B
-/*
- * Data derived from Steinhart-Hart equation in a resistor divider circuit with
- * Vdd=3300mV, R = 30.9Kohm, and thermistor (B = 4050, T0 = 298.15 K, nominal
- * resistance (R0) = 47Kohm).
- */
-#define THERMISTOR_SCALING_FACTOR_31_47 11
-static const struct thermistor_data_pair thermistor_data_31_47[] = {
- { 2753 / THERMISTOR_SCALING_FACTOR_31_47, 0 },
- { 2487 / THERMISTOR_SCALING_FACTOR_31_47, 10 },
- { 2165 / THERMISTOR_SCALING_FACTOR_31_47, 20 },
- { 1813 / THERMISTOR_SCALING_FACTOR_31_47, 30 },
- { 1145 / THERMISTOR_SCALING_FACTOR_31_47, 50 },
- { 878 / THERMISTOR_SCALING_FACTOR_31_47, 60 },
- { 665 / THERMISTOR_SCALING_FACTOR_31_47, 70 },
- { 500 / THERMISTOR_SCALING_FACTOR_31_47, 80 },
- { 375 / THERMISTOR_SCALING_FACTOR_31_47, 90 },
- { 282 / THERMISTOR_SCALING_FACTOR_31_47, 100 },
-};
-
-static const struct thermistor_info thermistor_info_31_47 = {
- .scaling_factor = THERMISTOR_SCALING_FACTOR_31_47,
- .num_pairs = ARRAY_SIZE(thermistor_data_31_47),
- .data = thermistor_data_31_47,
-};
-
-int get_temp_3v3_30k9_47k_4050b(int idx_adc, int *temp_ptr)
-{
- return thermistor_get_temperature(idx_adc, temp_ptr,
- &thermistor_info_31_47);
-}
-#endif /* CONFIG_STEINHART_HART_3V3_30K9_47K_4050B */
diff --git a/driver/temp_sensor/thermistor.md b/driver/temp_sensor/thermistor.md
deleted file mode 100644
index bb9faa04ef..0000000000
--- a/driver/temp_sensor/thermistor.md
+++ /dev/null
@@ -1,106 +0,0 @@
-We used the following resistance table for a 47kΩ B4050 thermistor in the
-[thermistor.c](./thermistor.c) tables.
-
-C° | kΩ
---- | -----
-0 | 155.7
-1 | 147.9
-2 | 140.6
-3 | 133.7
-4 | 127.2
-5 | 121.0
-6 | 115.1
-7 | 109.6
-8 | 104.3
-9 | 99.31
-10 | 94.6
-11 | 90.13
-12 | 85.89
-13 | 81.87
-14 | 78.07
-15 | 74.45
-16 | 71.02
-17 | 67.77
-18 | 64.68
-19 | 61.75
-20 | 58.97
-21 | 56.32
-22 | 53.81
-23 | 51.43
-24 | 49.16
-25 | 47.0
-26 | 44.95
-27 | 42.99
-28 | 41.13
-29 | 39.36
-30 | 37.68
-31 | 36.07
-32 | 34.54
-33 | 33.08
-34 | 31.69
-35 | 30.36
-36 | 29.1
-37 | 27.9
-38 | 26.75
-39 | 25.65
-40 | 24.61
-41 | 23.61
-42 | 22.66
-43 | 21.75
-44 | 20.88
-45 | 20.05
-46 | 19.26
-47 | 18.5
-48 | 17.78
-49 | 17.09
-50 | 16.43
-51 | 15.8
-52 | 15.2
-53 | 14.62
-54 | 14.07
-55 | 13.54
-56 | 13.03
-57 | 12.55
-58 | 12.09
-59 | 11.64
-60 | 11.21
-61 | 10.8
-62 | 10.41
-63 | 10.04
-64 | 9.676
-65 | 9.331
-66 | 8.999
-67 | 8.68
-68 | 8.374
-69 | 8.081
-70 | 7.799
-71 | 7.528
-72 | 7.268
-73 | 7.018
-74 | 6.777
-75 | 6.546
-76 | 6.324
-77 | 6.111
-78 | 5.906
-79 | 5.708
-80 | 5.518
-81 | 5.335
-82 | 5.16
-83 | 4.99
-84 | 4.827
-85 | 4.671
-86 | 4.519
-87 | 4.374
-88 | 4.233
-89 | 4.098
-90 | 3.968
-91 | 3.842
-92 | 3.721
-93 | 3.605
-94 | 3.492
-95 | 3.384
-96 | 3.279
-97 | 3.179
-98 | 3.082
-99 | 2.988
-100 | 2.898
diff --git a/driver/temp_sensor/thermistor_ncp15wb.c b/driver/temp_sensor/thermistor_ncp15wb.c
deleted file mode 100644
index dba06ee326..0000000000
--- a/driver/temp_sensor/thermistor_ncp15wb.c
+++ /dev/null
@@ -1,100 +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.
- */
-
-/* NCP15WB thermistor module for Chrome EC */
-
-#include "common.h"
-#include "temp_sensor/thermistor.h"
-#include "util.h"
-
-/*
- * ADC-to-temp conversion assumes recommended thermistor / resistor
- * configuration (NCP15WB* / 24.9K) with a 10-bit ADC.
- * For 50C through 100C, use linear interpolation from discreet points
- * in table below. For temps < 50C, use a simplified linear function.
- */
-#define ADC_DISCREET_RANGE_START_TEMP 50
-/* 10 bit ADC result corresponding to START_TEMP */
-#define ADC_DISCREET_RANGE_START_RESULT 407
-
-#define ADC_DISCREET_RANGE_LIMIT_TEMP 100
-/* 10 bit ADC result corresponding to LIMIT_TEMP */
-#define ADC_DISCREET_RANGE_LIMIT_RESULT 107
-
-/* Table entries in steppings of 5C */
-#define ADC_DISCREET_RANGE_STEP 5
-
-/* Discreet range ADC results (9 bit) per temperature, in 5 degree steps */
-static const uint8_t adc_result[] = {
- 203, /* 50 C */
- 178, /* 55 C */
- 157, /* 60 C */
- 138, /* 65 C */
- 121, /* 70 C */
- 106, /* 75 C */
- 93, /* 80 C */
- 81, /* 85 C */
- 70, /* 90 C */
- 61, /* 95 C */
- 53, /* 100 C */
-};
-
-/*
- * From 20C (reasonable lower limit of temperatures we care about accuracy)
- * to 50C, the temperature curve is roughly linear, so we don't need to include
- * data points in our table.
- */
-#define adc_to_temp(result) (ADC_DISCREET_RANGE_START_TEMP - \
- (((result) - ADC_DISCREET_RANGE_START_RESULT) * 3 + 16) / 32)
-
-/* Convert ADC result (10 bit) to temperature in celsius */
-int ncp15wb_calculate_temp(uint16_t adc)
-{
- int temp;
- int head, tail, mid;
- uint8_t delta, step;
-
- /* Is ADC result in linear range? */
- if (adc >= ADC_DISCREET_RANGE_START_RESULT)
- temp = adc_to_temp(adc);
- /* Hotter than our discreet range limit? */
- else if (adc <= ADC_DISCREET_RANGE_LIMIT_RESULT)
- temp = ADC_DISCREET_RANGE_LIMIT_TEMP;
- /* We're in the discreet range */
- else {
- /* Table uses 9 bit ADC values */
- adc /= 2;
-
- /* Binary search to find proper table entry */
- head = 0;
- tail = ARRAY_SIZE(adc_result) - 1;
- while (head != tail) {
- mid = (head + tail) / 2;
- if (adc_result[mid] >= adc &&
- adc_result[mid+1] < adc)
- break;
- if (adc_result[mid] > adc)
- head = mid + 1;
- else
- tail = mid;
- }
-
- /* Now fit between table entries using linear interpolation. */
- if (head != tail) {
- delta = adc_result[mid] - adc_result[mid + 1];
- step = ((adc_result[mid] - adc) *
- ADC_DISCREET_RANGE_STEP + delta / 2) / delta;
- } else {
- /* Edge case where adc = max */
- mid = head;
- step = 0;
- }
-
- temp = ADC_DISCREET_RANGE_START_TEMP +
- ADC_DISCREET_RANGE_STEP * mid + step;
- }
-
- return temp;
-}
diff --git a/driver/temp_sensor/tmp006.c b/driver/temp_sensor/tmp006.c
deleted file mode 100644
index e4794ccc4a..0000000000
--- a/driver/temp_sensor/tmp006.c
+++ /dev/null
@@ -1,504 +0,0 @@
-/* Copyright 2014 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.
- */
-
-/* TMP006 temperature sensor module for Chrome EC */
-
-#include "common.h"
-#include "console.h"
-#include "gpio.h"
-#include "hooks.h"
-#include "host_command.h"
-#include "i2c.h"
-#include "math.h"
-#include "task.h"
-#include "temp_sensor.h"
-#include "tmp006.h"
-#include "util.h"
-
-/* Console output macros */
-#define CPUTS(outstr) cputs(CC_THERMAL, outstr)
-#define CPRINTS(format, args...) cprints(CC_THERMAL, format, ## args)
-
-/*
- * Alg 0 was what's in the TMP006 User's Guide. Alg 1 is Alg 0, but with
- * some filters applied to the Tdie input and Tobj output (see
- * crosbug.com/p/32260).
- */
-#define ALGORITHM_NUM 1
-#define ALGORITHM_PARAMS 12
-
-/* Flags for tdata->fail */
-#define FAIL_INIT BIT(0) /* Just initialized */
-#define FAIL_POWER BIT(1) /* Sensor not powered */
-#define FAIL_I2C BIT(2) /* I2C communication error */
-#define FAIL_NOT_READY BIT(3) /* Data not ready */
-
-/* State and conversion factors to track for each sensor */
-struct tmp006_data_t {
- /* chip info */
- int16_t v_raw; /* TMP006_REG_VOBJ */
- int16_t t_raw0; /* TMP006_REG_TDIE */
- int fail; /* Fail flags; non-zero if last read failed */
- /* calibration params */
- float s0, a1, a2; /* Sensitivity factors */
- float b0, b1, b2; /* Self-heating correction */
- float c2; /* Seebeck effect */
- float d0, d1, ds; /* Tdie filter and slope adjustment */
- float e0, e1; /* Tobj output filter */
- /* FIR filter stages */
- float tdie1, tobj1;
-};
-static struct tmp006_data_t tmp006_data[TMP006_COUNT];
-
-/* Default state and conversion factors */
-static const struct tmp006_data_t tmp006_data_default = {
- .fail = FAIL_INIT,
-
- /* Alg 0 params from User's Guide */
- .s0 = 0.0f, /* zero == "uncalibrated" */
- .a1 = 1.75e-3f,
- .a2 = -1.678e-5f,
- .b0 = -2.94e-5f,
- .b1 = -5.7e-7f,
- .b2 = 4.63e-9f,
- .c2 = 13.4f,
-
- /* Additional Alg 1 filter params */
- .d0 = 0.2f,
- .d1 = 0.8f,
- .ds = 1.48e-4,
- .e0 = 0.1f,
- .e1 = 0.9f,
-};
-
-static int tmp006_has_power(int idx)
-{
-#ifdef CONFIG_TEMP_SENSOR_POWER_GPIO
- return gpio_get_level(CONFIG_TEMP_SENSOR_POWER_GPIO);
-#else
- return 1;
-#endif
-}
-
-static void tmp006_poll_sensor(int sensor_id)
-{
- struct tmp006_data_t *tdata = tmp006_data + sensor_id;
- int t, v, rv;
- int addr_flags = tmp006_sensors[sensor_id].addr_flags;
-
- /* Invalidate the filter history if there is any error */
- if (tdata->fail) {
- tdata->tdie1 = 0.0f;
- tdata->tobj1 = 0.0;
- }
-
- if (!tmp006_has_power(sensor_id)) {
- tdata->fail |= FAIL_POWER;
- return;
- }
-
- /*
- * If sensor has just initialized and/or has lost power, wait for
- * data ready; otherwise, we read garbage data.
- */
- if (tdata->fail & (FAIL_POWER | FAIL_INIT)) {
- rv = i2c_read16(TMP006_PORT(addr_flags),
- TMP006_REG(addr_flags),
- TMP006_REG_CONFIG, &v);
- if (rv) {
- tdata->fail |= FAIL_I2C;
- return;
- } else if (!(v & 0x80)) {
- /* Bit 7 is the Data Ready bit */
- tdata->fail |= FAIL_NOT_READY;
- return;
- }
- }
-
- rv = i2c_read16(TMP006_PORT(addr_flags),
- TMP006_REG(addr_flags),
- TMP006_REG_TDIE, &t);
- if (rv) {
- tdata->fail |= FAIL_I2C;
- return;
- }
-
- rv = i2c_read16(TMP006_PORT(addr_flags),
- TMP006_REG(addr_flags),
- TMP006_REG_VOBJ, &v);
- if (rv) {
- tdata->fail |= FAIL_I2C;
- return;
- }
-
- tdata->t_raw0 = t;
- tdata->v_raw = v;
-
- tdata->fail = 0;
-}
-
-/*****************************************************************************/
-/* Hooks */
-
-static void tmp006_init(void)
-{
- int i;
-
- for (i = 0; i < TMP006_COUNT; ++i)
- tmp006_data[i] = tmp006_data_default;
-}
-DECLARE_HOOK(HOOK_INIT, tmp006_init, HOOK_PRIO_DEFAULT);
-
-static void tmp006_poll(void)
-{
- int i;
-
- for (i = 0; i < TMP006_COUNT; ++i)
- tmp006_poll_sensor(i);
-}
-DECLARE_HOOK(HOOK_SECOND, tmp006_poll, HOOK_PRIO_TEMP_SENSOR);
-
-/*****************************************************************************/
-/* Interface to the rest of the EC */
-
-/* This just returns Tdie */
-static int tmp006_read_die_temp_k(const struct tmp006_data_t *tdata,
- int *temp_ptr)
-{
- if (tdata->fail)
- return EC_ERROR_UNKNOWN;
-
- /* Tdie reg is signed 1/128 degrees C, resolution 1/32 degrees */
- *temp_ptr = (int)tdata->t_raw0 / 128 + 273;
- return EC_SUCCESS;
-}
-
-/*
- * This uses Tdie and Vobj and a bunch of magic parameters to calculate the
- * object temperature, Tobj.
- */
-static int tmp006_read_object_temp_k(struct tmp006_data_t *tdata,
- int *temp_ptr)
-{
- float tdie, vobj;
- float tx, s, vos, vx, fv, tobj, t4;
- float tdie_filtered, tdie_slope, tobj_filtered;
-
- if (tdata->fail)
- return EC_ERROR_UNKNOWN;
-
- if (!tdata->s0)
- return EC_ERROR_NOT_CALIBRATED;
-
- /* Tdie reg is signed 1/128 degrees C, resolution 1/32 degrees
- * We need degrees K */
- tdie = (float)tdata->t_raw0 / 128.0f + 273.15f;
- /* Vobj reg is signed int, LSB = 156.25 nV
- * We need volts */
- vobj = (float)tdata->v_raw / 156.25f * 1e-9f;
-
- /* Alg1: apply filter to tdie. If tdie1 is 0K, initialize it. */
- if (tdata->tdie1 == 0.0f)
- tdata->tdie1 = tdie;
- tdie_filtered = tdata->d0 * tdie + tdata->d1 * tdata->tdie1;
- tdie_slope = tdie - tdie_filtered;
- /* Remember the current Tdie for next time */
- tdata->tdie1 = tdie;
-
- /* Calculate according to TMP006 users guide. */
- tx = tdie - 298.15f;
- /* s is the sensitivity */
- s = tdata->s0 * (1.0f + tdata->a1 * tx + tdata->a2 * tx * tx);
- /* vos is the offset voltage */
- vos = tdata->b0 + tdata->b1 * tx + tdata->b2 * tx * tx;
- /* Alg1: use Tdie FIR here */
- vx = vobj - vos + tdie_slope * tdata->ds;
- /* fv is Seebeck coefficient f(vobj) */
- fv = vx + tdata->c2 * vx * vx;
-
- t4 = tdie * tdie * tdie * tdie + fv / s;
- tobj = sqrtf(sqrtf(t4));
-
- /* Alg1: apply another filter on the calculated tobj. */
- if (tdata->tobj1 == 0.0f)
- tdata->tobj1 = tobj;
-
- tobj_filtered = tdata->e0 * tobj + tdata->e1 * tdata->tobj1;
- tdata->tobj1 = tobj;
-
- /* return integer degrees K */
- *temp_ptr = tobj_filtered;
-
- return EC_SUCCESS;
-}
-
-int tmp006_get_val(int idx, int *temp_ptr)
-{
- /*
- * Note: idx is a thermal sensor index, where the top N-1 bits are the
- * TMP006 index and the bottom bit is (0=die, 1=remote).
- */
- int tidx = idx >> 1;
- struct tmp006_data_t *tdata = tmp006_data + tidx;
-
- if (tdata->fail & FAIL_POWER) {
- /*
- * Sensor isn't powered, or hasn't successfully provided data
- * since being powered. Keep reporting not-powered until
- * we get good data (which will clear FAIL_POWER) or there is
- * an I2C error.
- */
- return (tdata->fail & FAIL_I2C) ? EC_ERROR_UNKNOWN :
- EC_ERROR_NOT_POWERED;
- }
-
- /* Check the low bit to determine which temperature to read. */
- if ((idx & 0x1) == 0)
- return tmp006_read_die_temp_k(tdata, temp_ptr);
- else
- return tmp006_read_object_temp_k(tdata, temp_ptr);
-}
-
-/*****************************************************************************/
-/* Host commands */
-
-enum ec_status tmp006_get_calibration(struct host_cmd_handler_args *args)
-{
- const struct ec_params_tmp006_get_calibration *p = args->params;
- struct ec_response_tmp006_get_calibration_v1 *r1 = args->response;
- const struct tmp006_data_t *tdata;
-
- if (p->index >= TMP006_COUNT)
- return EC_RES_INVALID_PARAM;
-
- tdata = tmp006_data + p->index;
-
- r1->algorithm = ALGORITHM_NUM;
- r1->num_params = ALGORITHM_PARAMS;
- r1->val[0] = tdata->s0;
- r1->val[1] = tdata->a1;
- r1->val[2] = tdata->a2;
- r1->val[3] = tdata->b0;
- r1->val[4] = tdata->b1;
- r1->val[5] = tdata->b2;
- r1->val[6] = tdata->c2;
- r1->val[7] = tdata->d0;
- r1->val[8] = tdata->d1;
- r1->val[9] = tdata->ds;
- r1->val[10] = tdata->e0;
- r1->val[11] = tdata->e1;
-
- args->response_size = sizeof(*r1) +
- r1->num_params * sizeof(r1->val[0]);
-
- return EC_RES_SUCCESS;
-}
-DECLARE_HOST_COMMAND(EC_CMD_TMP006_GET_CALIBRATION,
- tmp006_get_calibration,
- EC_VER_MASK(1));
-
-enum ec_status tmp006_set_calibration(struct host_cmd_handler_args *args)
-{
- const struct ec_params_tmp006_set_calibration_v1 *p1 = args->params;
- struct tmp006_data_t *tdata;
-
- if (p1->index >= TMP006_COUNT)
- return EC_RES_INVALID_PARAM;
-
- /* We only have one algorithm today */
- if (p1->algorithm != ALGORITHM_NUM ||
- p1->num_params != ALGORITHM_PARAMS)
- return EC_RES_INVALID_PARAM;
-
- tdata = tmp006_data + p1->index;
-
- tdata->s0 = p1->val[0];
- tdata->a1 = p1->val[1];
- tdata->a2 = p1->val[2];
- tdata->b0 = p1->val[3];
- tdata->b1 = p1->val[4];
- tdata->b2 = p1->val[5];
- tdata->c2 = p1->val[6];
- tdata->d0 = p1->val[7];
- tdata->d1 = p1->val[8];
- tdata->ds = p1->val[9];
- tdata->e0 = p1->val[10];
- tdata->e1 = p1->val[11];
-
- return EC_RES_SUCCESS;
-}
-DECLARE_HOST_COMMAND(EC_CMD_TMP006_SET_CALIBRATION,
- tmp006_set_calibration,
- EC_VER_MASK(1));
-
-enum ec_status tmp006_get_raw(struct host_cmd_handler_args *args)
-{
- const struct ec_params_tmp006_get_raw *p = args->params;
- struct ec_response_tmp006_get_raw *r = args->response;
- const struct tmp006_data_t *tdata;
-
- if (p->index >= TMP006_COUNT)
- return EC_RES_INVALID_PARAM;
-
- tdata = tmp006_data + p->index;
-
- /* Vobj reg is signed int, LSB = 156.25 nV
- * response units are nV */
- r->v = ((int)tdata->v_raw * 15625) / 100;
-
- /* Tdie reg is signed 1/128 degrees C, resolution 1/32 degrees
- * response units are 1/100 degrees K */
- r->t = ((int)tdata->t_raw0 * 100) / 128 + 27315;
-
- args->response_size = sizeof(*r);
-
- return EC_RES_SUCCESS;
-}
-DECLARE_HOST_COMMAND(EC_CMD_TMP006_GET_RAW,
- tmp006_get_raw,
- EC_VER_MASK(0));
-
-/*****************************************************************************/
-/* Console commands */
-
-#ifdef CONFIG_CMD_TEMP_SENSOR
-/**
- * Print temperature info for a sensor; used by console command.
- */
-static int tmp006_print(int idx)
-{
- int vraw, v;
- int traw, t;
- int rv;
- int d;
- int addr_flags = tmp006_sensors[idx].addr_flags;
-
-
- ccprintf("Debug data from %s:\n", tmp006_sensors[idx].name);
-
- if (!tmp006_has_power(idx)) {
- ccputs("Sensor powered off.\n");
- return EC_ERROR_UNKNOWN;
- }
-
- rv = i2c_read16(TMP006_PORT(addr_flags),
- TMP006_REG(addr_flags),
- TMP006_REG_MANUFACTURER_ID, &d);
- if (rv)
- return rv;
- ccprintf(" Manufacturer ID: 0x%04x\n", d);
-
- rv = i2c_read16(TMP006_PORT(addr_flags),
- TMP006_REG(addr_flags),
- TMP006_REG_DEVICE_ID, &d);
- ccprintf(" Device ID: 0x%04x\n", d);
-
- rv = i2c_read16(TMP006_PORT(addr_flags),
- TMP006_REG(addr_flags),
- TMP006_REG_CONFIG, &d);
- ccprintf(" Config: 0x%04x\n", d);
-
- rv = i2c_read16(TMP006_PORT(addr_flags),
- TMP006_REG(addr_flags),
- TMP006_REG_VOBJ, &vraw);
-
- v = ((int)vraw * 15625) / 100;
- ccprintf(" Voltage: 0x%04x = %d nV\n", vraw, v);
-
- rv = i2c_read16(TMP006_PORT(addr_flags),
- TMP006_REG(addr_flags),
- TMP006_REG_TDIE, &traw);
- t = (int)traw;
- ccprintf(" Temperature: 0x%04x = %d.%02d C\n",
- traw, t / 128, t > 0 ? t % 128 : 128 - (t % 128));
-
- return EC_SUCCESS;
-}
-
-static int command_sensor_info(int argc, char **argv)
-{
- int i;
- int rv, rv1;
- int a = 0, b = TMP006_COUNT;
-
- if (argc > 1) {
- char *e = 0;
- i = strtoi(argv[1], &e, 0);
- if (*e || i < 0 || i >= TMP006_COUNT)
- return EC_ERROR_PARAM1;
- a = i;
- b = i + 1;
- }
-
- rv1 = EC_SUCCESS;
- for (i = a; i < b; i++) {
- rv = tmp006_print(i);
- if (rv != EC_SUCCESS)
- rv1 = rv;
- cflush();
- }
-
- return rv1;
-}
-DECLARE_CONSOLE_COMMAND(tmp006, command_sensor_info,
- "[ <index> ]",
- "Print TMP006 sensors");
-#endif
-
-/* Disable the t6cal command until/unless we have FP support in printf */
-#if 0
-static int command_t6cal(int argc, char **argv)
-{
- struct tmp006_data_t *tdata;
- char *e;
- int v;
- int i;
-
- if (argc < 2) {
- ccprintf("# Name S0 b0"
- " b1 b2\n");
- for (i = 0; i < TMP006_COUNT; i++) {
- tdata = tmp006_data + i;
- ccprintf("%d %-11s"
- "%7de-17 %7de-8 %7de-10 %7de-12\n",
- i, tmp006_sensors[i].name,
- (int)(tdata->s0 * 1e17f),
- (int)(tdata->b0 * 1e8f),
- (int)(tdata->b1 * 1e10f),
- (int)(tdata->b2 * 1e12f));
- }
-
- return EC_SUCCESS;
- }
-
- if (argc != 4)
- return EC_ERROR_PARAM_COUNT;
-
- i = strtoi(argv[1], &e, 0);
- if (*e || i < 0 || i >= TMP006_COUNT)
- return EC_ERROR_PARAM1;
- tdata = tmp006_data + i;
-
- v = strtoi(argv[3], &e, 0);
- if (*e)
- return EC_ERROR_PARAM3;
-
- if (!strcasecmp(argv[2], "s0"))
- tdata->s0 = (float)v * 1e-17f;
- else if (!strcasecmp(argv[2], "b0"))
- tdata->b0 = (float)v * 1e-8f;
- else if (!strcasecmp(argv[2], "b1"))
- tdata->b1 = (float)v * 1e-10f;
- else if (!strcasecmp(argv[2], "b2"))
- tdata->b2 = (float)v * 1e-12f;
- else
- return EC_ERROR_PARAM2;
-
- return EC_SUCCESS;
-}
-DECLARE_CONSOLE_COMMAND(t6cal, command_t6cal,
- "[<index> <coeff_name> <radix>]",
- "Set/print TMP006 calibration");
-#endif
diff --git a/driver/temp_sensor/tmp006.h b/driver/temp_sensor/tmp006.h
deleted file mode 100644
index 594dbc711a..0000000000
--- a/driver/temp_sensor/tmp006.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/* Copyright 2014 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.
- */
-
-/* TMP006 temperature sensor module for Chrome EC */
-
-#ifndef __CROS_EC_TMP006_H
-#define __CROS_EC_TMP006_H
-
-/* Registers within the TMP006 chip */
-#define TMP006_REG_VOBJ 0x00
-#define TMP006_REG_TDIE 0x01
-#define TMP006_REG_CONFIG 0x02
-#define TMP006_REG_MANUFACTURER_ID 0xfe
-#define TMP006_REG_DEVICE_ID 0xff
-
-/* I2C address components */
-#define TMP006_ADDR(PORT, REG) ((PORT << 16) + REG)
-#define TMP006_PORT(ADDR) (ADDR >> 16)
-#define TMP006_REG(ADDR) (ADDR & 0xffff)
-
-struct tmp006_t {
- const char *name;
- int addr_flags; /* I2C address formed by TMP006_ADDR macro. */
-};
-
-/* Names and addresses of the sensors we have */
-extern const struct tmp006_t tmp006_sensors[];
-
-/**
- * Get the last polled value of a sensor.
- *
- * @param idx Index to read. The low bit in idx indicates whether
- * to read die temperature or object temperature. The
- * other bits serve as internal index to tmp006 module.
- * @param temp_ptr Destination for temperature in K.
- *
- * @return EC_SUCCESS if successful, non-zero if error.
- */
-int tmp006_get_val(int idx, int *temp_ptr);
-
-#endif /* __CROS_EC_TMP006_H */
diff --git a/driver/temp_sensor/tmp112.c b/driver/temp_sensor/tmp112.c
deleted file mode 100644
index 4da5c4e0e8..0000000000
--- a/driver/temp_sensor/tmp112.c
+++ /dev/null
@@ -1,124 +0,0 @@
-/* Copyright 2016 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.
- */
-
-/* TMP112 temperature sensor module for Chrome EC */
-
-#include "common.h"
-#include "console.h"
-#include "tmp112.h"
-#include "i2c.h"
-#include "hooks.h"
-#include "math_util.h"
-#include "util.h"
-
-#define TMP112_RESOLUTION 12
-#define TMP112_SHIFT1 (16 - TMP112_RESOLUTION)
-#define TMP112_SHIFT2 (TMP112_RESOLUTION - 8)
-
-#define CPRINTS(format, args...) cprints(CC_THERMAL, format, ## args)
-
-static int temp_mk_local[TMP112_COUNT];
-
-static int raw_read16(int sensor, const int offset, int *data_ptr)
-{
-#ifdef CONFIG_I2C_BUS_MAY_BE_UNPOWERED
- /*
- * Don't try to read if the port is unpowered
- */
- if (!board_is_i2c_port_powered(tmp112_sensors[sensor].i2c_port))
- return EC_ERROR_NOT_POWERED;
-#endif
- return i2c_read16(tmp112_sensors[sensor].i2c_port,
- tmp112_sensors[sensor].i2c_addr_flags,
- offset, data_ptr);
-}
-
-static int raw_write16(int sensor, const int offset, int data)
-{
-#ifdef CONFIG_I2C_BUS_MAY_BE_UNPOWERED
- /*
- * Don't try to write if the port is unpowered
- */
- if (!board_is_i2c_port_powered(tmp112_sensors[sensor].i2c_port))
- return EC_ERROR_NOT_POWERED;
-#endif
- return i2c_write16(tmp112_sensors[sensor].i2c_port,
- tmp112_sensors[sensor].i2c_addr_flags,
- offset, data);
-}
-
-static int get_reg_temp(int sensor, int *temp_ptr)
-{
- int rv;
- int temp_raw = 0;
-
- rv = raw_read16(sensor, TMP112_REG_TEMP, &temp_raw);
- if (rv)
- return rv;
-
- *temp_ptr = (int)(int16_t)temp_raw;
- return EC_SUCCESS;
-}
-
-static inline int tmp112_reg_to_mk(int16_t reg)
-{
- int temp_mc;
-
- temp_mc = (((reg >> TMP112_SHIFT1) * 1000) >> TMP112_SHIFT2);
-
- return MILLI_CELSIUS_TO_MILLI_KELVIN(temp_mc);
-}
-
-int tmp112_get_val_k(int idx, int *temp_k_ptr)
-{
- if (idx >= TMP112_COUNT)
- return EC_ERROR_INVAL;
-
- *temp_k_ptr = MILLI_KELVIN_TO_KELVIN(temp_mk_local[idx]);
- return EC_SUCCESS;
-}
-
-int tmp112_get_val_mk(int idx, int *temp_mk_ptr)
-{
- if (idx >= TMP112_COUNT)
- return EC_ERROR_INVAL;
-
- *temp_mk_ptr = temp_mk_local[idx];
- return EC_SUCCESS;
-}
-
-static void tmp112_poll(void)
-{
- int s;
- int temp_reg = 0;
-
- for (s = 0; s < TMP112_COUNT; s++) {
- if (get_reg_temp(s, &temp_reg) == EC_SUCCESS)
- temp_mk_local[s] = tmp112_reg_to_mk(temp_reg);
- }
-}
-DECLARE_HOOK(HOOK_SECOND, tmp112_poll, HOOK_PRIO_TEMP_SENSOR);
-
-void tmp112_init(void)
-{
- int tmp, s, rv;
- int set_mask, clr_mask;
-
- /* 12 bit mode */
- set_mask = (3 << 5);
-
- /* not oneshot mode */
- clr_mask = BIT(7);
-
- for (s = 0; s < TMP112_COUNT; s++) {
- rv = raw_read16(s, TMP112_REG_CONF, &tmp);
- if (rv != EC_SUCCESS) {
- CPRINTS("TMP112-%d: Failed to init (rv %d)", s, rv);
- continue;
- }
- raw_write16(s, TMP112_REG_CONF, (tmp & ~clr_mask) | set_mask);
- }
-}
-DECLARE_HOOK(HOOK_INIT, tmp112_init, HOOK_PRIO_DEFAULT);
diff --git a/driver/temp_sensor/tmp112.h b/driver/temp_sensor/tmp112.h
deleted file mode 100644
index d1b97b138c..0000000000
--- a/driver/temp_sensor/tmp112.h
+++ /dev/null
@@ -1,66 +0,0 @@
-/* Copyright 2016 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.
- */
-
-#ifndef __CROS_EC_TMP112_H
-#define __CROS_EC_TMP112_H
-
-#include "i2c.h"
-
-#define TMP112_I2C_ADDR_FLAGS0 (0x48 | I2C_FLAG_BIG_ENDIAN)
-#define TMP112_I2C_ADDR_FLAGS1 (0x49 | I2C_FLAG_BIG_ENDIAN)
-#define TMP112_I2C_ADDR_FLAGS2 (0x4A | I2C_FLAG_BIG_ENDIAN)
-#define TMP112_I2C_ADDR_FLAGS3 (0x4B | I2C_FLAG_BIG_ENDIAN)
-
-#define TMP112_REG_TEMP 0x00
-#define TMP112_REG_CONF 0x01
-#define TMP112_REG_HYST 0x02
-#define TMP112_REG_MAX 0x03
-
-/*
- * I2C port and address information for all the board TMP112 sensors should be
- * defined in an array of the following structures, with an enum tmp112_sensor
- * indexing the array. The enum tmp112_sensor shall end with a TMP112_COUNT
- * defining the maximum number of sensors for the board.
- */
-
-struct tmp112_sensor_t {
- int i2c_port;
- int i2c_addr_flags;
-};
-
-extern const struct tmp112_sensor_t tmp112_sensors[];
-
-/**
- * Get the last polled value of a sensor.
- *
- * @param idx Index to read, from board's enum tmp112_sensor
- * definition
- *
- * @param temp_k_ptr Destination for temperature in K.
- *
- * @return EC_SUCCESS if successful, non-zero if error.
- */
-int tmp112_get_val_k(int idx, int *temp_k_ptr);
-
-/**
- * Get the last polled value of a sensor.
- *
- * @param idx Index to read, from board's enum tmp112_sensor
- * definition
- *
- * @param temp_mk_ptr Destination for temperature in mK.
- *
- * @return EC_SUCCESS if successful, non-zero if error.
- */
-int tmp112_get_val_mk(int idx, int *temp_mk_ptr);
-
-/**
- * Init the sensors. Note, this will run automatically on HOOK_INIT, but is
- * made available for boards which may not always power the sensor in all
- * states.
- */
-void tmp112_init(void);
-
-#endif /* __CROS_EC_TMP112_H */
diff --git a/driver/temp_sensor/tmp411.c b/driver/temp_sensor/tmp411.c
deleted file mode 100644
index ef22052da8..0000000000
--- a/driver/temp_sensor/tmp411.c
+++ /dev/null
@@ -1,330 +0,0 @@
-/* Copyright 2017 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.
- */
-
-/* TMP411 temperature sensor module for Chrome EC */
-
-#include "common.h"
-#include "console.h"
-#include "tmp411.h"
-#include "gpio.h"
-#include "i2c.h"
-#include "hooks.h"
-#include "util.h"
-
-static int temp_val_local;
-static int temp_val_remote1;
-static uint8_t is_sensor_shutdown;
-
-/**
- * Determine whether the sensor is powered.
- *
- * @return non-zero the tmp411 sensor is powered.
- */
-static int has_power(void)
-{
-#ifdef CONFIG_TEMP_SENSOR_POWER_GPIO
- return gpio_get_level(CONFIG_TEMP_SENSOR_POWER_GPIO);
-#else
- return !is_sensor_shutdown;
-#endif
-}
-
-static int raw_read8(const int offset, int *data_ptr)
-{
- return i2c_read8(I2C_PORT_THERMAL, TMP411_I2C_ADDR, offset, data_ptr);
-}
-
-static int raw_write8(const int offset, int data)
-{
- return i2c_write8(I2C_PORT_THERMAL, TMP411_I2C_ADDR, offset, data);
-}
-
-static int get_temp(const int offset, int *temp_ptr)
-{
- int rv;
- int temp_raw = 0;
-
- rv = raw_read8(offset, &temp_raw);
- if (rv < 0)
- return rv;
-
- *temp_ptr = (int)(int8_t)temp_raw;
- return EC_SUCCESS;
-}
-
-#ifdef CONFIG_CMD_TEMP_SENSOR
-static int tmp411_set_temp(const int offset, int temp)
-{
- if (temp < -127 || temp > 127)
- return EC_ERROR_INVAL;
-
- return raw_write8(offset, (uint8_t)temp);
-}
-#endif
-
-int tmp411_get_val(int idx, int *temp_ptr)
-{
- if (!has_power())
- return EC_ERROR_NOT_POWERED;
-
- switch (idx) {
- case TMP411_IDX_LOCAL:
- *temp_ptr = temp_val_local;
- break;
- case TMP411_IDX_REMOTE1:
- *temp_ptr = temp_val_remote1;
- break;
- default:
- return EC_ERROR_UNKNOWN;
- }
-
- return EC_SUCCESS;
-}
-
-static int tmp411_shutdown(uint8_t want_shutdown)
-{
- int ret, value;
-
- if (want_shutdown == is_sensor_shutdown)
- return EC_SUCCESS;
-
- ret = raw_read8(TMP411_CONFIGURATION1_R, &value);
- if (ret < 0) {
- ccprintf("ERROR: Temp sensor I2C read8 error.\n");
- return ret;
- }
-
- if (want_shutdown && !(value & TMP411_CONFIG1_RUN_L)) {
- /* tmp411 is running, and want it to shutdown */
- /* CONFIG REG1 BIT6: 0=Run, 1=Shutdown */
- /* shut it down */
- value |= TMP411_CONFIG1_RUN_L;
- ret = raw_write8(TMP411_CONFIGURATION1_R, value);
- } else if (!want_shutdown && (value & TMP411_CONFIG1_RUN_L)) {
- /* tmp411 is shutdown, and want turn it on */
- value &= ~TMP411_CONFIG1_RUN_L;
- ret = raw_write8(TMP411_CONFIGURATION1_R, value);
- }
- /* else, the current setting is exactly what you want */
-
- is_sensor_shutdown = want_shutdown;
- return ret;
-}
-
-static int tmp411_set_therm_mode(void)
-{
- int ret = 0;
- int data = 0;
-
- ret = raw_read8(TMP411_CONFIGURATION1_R, &data);
- if (ret)
- return EC_ERROR_UNKNOWN;
-
- data |= TMP411_CONFIG1_MODE;
- ret = raw_write8(TMP411_CONFIGURATION1_W, data);
- if (ret)
- return EC_ERROR_UNKNOWN;
-
- return EC_SUCCESS;
-}
-
-int tmp411_set_therm_limit(int channel, int limit_c, int hysteresis)
-{
- int ret = 0;
- int reg = 0;
-
- if (channel >= TMP411_CHANNEL_COUNT)
- return EC_ERROR_INVAL;
-
- if (hysteresis > TMP411_HYSTERESIS_HIGH_LIMIT ||
- hysteresis < TMP411_HYSTERESIS_LOW_LIMIT)
- return EC_ERROR_INVAL;
-
- /* hysteresis must be less than high limit */
- if (hysteresis > limit_c)
- return EC_ERROR_INVAL;
-
- if (tmp411_set_therm_mode() != EC_SUCCESS)
- return EC_ERROR_UNKNOWN;
-
- switch (channel) {
- case TMP411_CHANNEL_LOCAL:
- reg = TMP411_LOCAL_HIGH_LIMIT_W;
- break;
- case TMP411_CHANNEL_REMOTE1:
- reg = TMP411_REMOTE1_HIGH_LIMIT_W;
- break;
- }
-
- ret = raw_write8(reg, limit_c);
- if (ret)
- return EC_ERROR_UNKNOWN;
-
- ret = raw_write8(TMP411_THERM_HYSTERESIS, hysteresis);
- if (ret)
- return EC_ERROR_UNKNOWN;
-
- return EC_SUCCESS;
-}
-
-static void tmp411_temp_sensor_poll(void)
-{
- int temp_c;
-
- if (!has_power())
- return;
-
- if (get_temp(TMP411_LOCAL, &temp_c) == EC_SUCCESS)
- temp_val_local = C_TO_K(temp_c);
-
- if (get_temp(TMP411_REMOTE1, &temp_c) == EC_SUCCESS)
- temp_val_remote1 = C_TO_K(temp_c);
-
-}
-DECLARE_HOOK(HOOK_SECOND, tmp411_temp_sensor_poll, HOOK_PRIO_TEMP_SENSOR);
-
-#ifdef CONFIG_CMD_TEMP_SENSOR
-static void print_temps(
- const char *name,
- const int tmp411_temp_reg,
- const int tmp411_therm_limit_reg,
- const int tmp411_high_limit_reg,
- const int tmp411_low_limit_reg)
-{
- int value;
-
- if (!has_power()) {
- ccprintf(" TMP411 is shutdown\n");
- return;
- }
-
- ccprintf("%s:\n", name);
-
- if (get_temp(tmp411_temp_reg, &value) == EC_SUCCESS)
- ccprintf(" Temp %3dC\n", value);
-
- if (get_temp(tmp411_therm_limit_reg, &value) == EC_SUCCESS)
- ccprintf(" Therm Trip %3dC\n", value);
-
- if (get_temp(tmp411_high_limit_reg, &value) == EC_SUCCESS)
- ccprintf(" High Alarm %3dC\n", value);
-
- if (get_temp(tmp411_low_limit_reg, &value) == EC_SUCCESS)
- ccprintf(" Low Alarm %3dC\n", value);
-}
-
-static int print_status(void)
-{
- int value;
-
- print_temps("Local", TMP411_LOCAL,
- TMP411_LOCAL_THERM_LIMIT,
- TMP411_LOCAL_HIGH_LIMIT_R,
- TMP411_LOCAL_LOW_LIMIT_R);
-
- print_temps("Remote1", TMP411_REMOTE1,
- TMP411_REMOTE1_THERM_LIMIT,
- TMP411_REMOTE1_HIGH_LIMIT_R,
- TMP411_REMOTE1_LOW_LIMIT_R);
-
- ccprintf("\n");
-
- if (raw_read8(TMP411_STATUS_R, &value) == EC_SUCCESS)
- ccprintf("STATUS: %pb\n", BINARY_VALUE(value, 8));
-
- if (raw_read8(TMP411_CONFIGURATION1_R, &value) == EC_SUCCESS)
- ccprintf("CONFIG1: %pb\n", BINARY_VALUE(value, 8));
-
- return EC_SUCCESS;
-}
-
-static int command_tmp411(int argc, char **argv)
-{
- char *command;
- char *e;
- char *power;
- int data;
- int offset;
- int rv;
-
- /* handle "power" command before checking the power status. */
- if ((argc == 3) && !strcasecmp(argv[1], "power")) {
- power = argv[2];
- if (!strncasecmp(power, "on", sizeof("on"))) {
- rv = tmp411_set_power(TMP411_POWER_ON);
- if (!rv)
- print_status();
- } else if (!strncasecmp(power, "off", sizeof("off")))
- rv = tmp411_set_power(TMP411_POWER_OFF);
- else
- return EC_ERROR_PARAM2;
- ccprintf("Set TMP411 %s\n", power);
- return rv;
- }
-
- if (!has_power()) {
- ccprintf("ERROR: Temp sensor not powered.\n");
- return EC_ERROR_NOT_POWERED;
- }
-
- /* If no args just print status */
- if (argc == 1)
- return print_status();
-
- if (argc < 3)
- return EC_ERROR_PARAM_COUNT;
-
- command = argv[1];
- offset = strtoi(argv[2], &e, 0);
- if (*e || offset < 0 || offset > 255)
- return EC_ERROR_PARAM2;
-
- if (!strcasecmp(command, "getbyte")) {
- rv = raw_read8(offset, &data);
- if (rv < 0)
- return rv;
- ccprintf("Byte at offset 0x%02x is %pb\n",
- offset, BINARY_VALUE(data, 8));
- return rv;
- }
-
- /* Remaining commands are "tmp411 set-command offset data" */
- if (argc != 4)
- return EC_ERROR_PARAM_COUNT;
-
- data = strtoi(argv[3], &e, 0);
- if (*e)
- return EC_ERROR_PARAM3;
-
- if (!strcasecmp(command, "settemp")) {
- ccprintf("Setting 0x%02x to %dC\n", offset, data);
- rv = tmp411_set_temp(offset, data);
- } else if (!strcasecmp(command, "setbyte")) {
- ccprintf("Setting 0x%02x to 0x%02x\n", offset, data);
- rv = raw_write8(offset, data);
- } else
- return EC_ERROR_PARAM1;
-
- return rv;
-}
-DECLARE_CONSOLE_COMMAND(tmp411, command_tmp411,
- "[settemp|setbyte <offset> <value>] or [getbyte <offset>] or"
- "[power <on|off>]. "
- "Temps in Celsius.",
- "Print tmp411 temp sensor status or set parameters.");
-#endif
-
-int tmp411_set_power(enum tmp411_power_state power_on)
-{
-#ifndef CONFIG_TEMP_SENSOR_POWER_GPIO
- uint8_t shutdown = (power_on == TMP411_POWER_OFF) ? 1 : 0;
-
- return tmp411_shutdown(shutdown);
-#else
- gpio_set_level(CONFIG_TEMP_SENSOR_POWER_GPIO, power_on);
- return EC_SUCCESS;
-#endif
-}
-
diff --git a/driver/temp_sensor/tmp411.h b/driver/temp_sensor/tmp411.h
deleted file mode 100644
index ef1b23278c..0000000000
--- a/driver/temp_sensor/tmp411.h
+++ /dev/null
@@ -1,140 +0,0 @@
-/* Copyright 2017 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.
- */
-
-/* TMP411 temperature sensor module for Chrome EC */
-
-#ifndef __CROS_EC_TMP411_H
-#define __CROS_EC_TMP411_H
-
-#define TMP411_I2C_ADDR_FLAGS 0x4C
-
-#define TMP411_IDX_LOCAL 0
-#define TMP411_IDX_REMOTE1 1
-#define TMP411_IDX_REMOTE2 2
-
-/* Chip-specific registers */
-#define TMP411_LOCAL 0x00
-#define TMP411_REMOTE1 0x01
-#define TMP411_STATUS_R 0x02
-#define TMP411_CONFIGURATION1_R 0x03
-#define TMP411_CONVERSION_RATE_R 0x04
-#define TMP411_LOCAL_HIGH_LIMIT_R 0x05
-#define TMP411_LOCAL_LOW_LIMIT_R 0x06
-#define TMP411_REMOTE1_HIGH_LIMIT_R 0x07
-#define TMP411_REMOTE1_LOW_LIMIT_R 0x08
-#define TMP411_CONFIGURATION1_W 0x09
-#define TMP411_CONVERSION_RATE_W 0x0a
-#define TMP411_LOCAL_HIGH_LIMIT_W 0x0b
-#define TMP411_LOCAL_LOW_LIMIT_W 0x0c
-#define TMP411_REMOTE1_HIGH_LIMIT_W 0x0d
-#define TMP411_REMOTE1_LOW_LIMIT_W 0x0e
-#define TMP411_ONESHOT 0x0f
-#define TMP411_REMOTE1_EXTD 0x10
-#define TMP411_REMOTE1_HIGH_LIMIT_EXTD 0x13
-#define TMP411_REMOTE1_LOW_LIMIT_EXTD 0x14
-#define TMP411_REMOTE2_HIGH_LIMIT_R 0x15
-#define TMP411_REMOTE2_HIGH_LIMIT_W 0x15
-#define TMP411_REMOTE2_LOW_LIMIT_R 0x16
-#define TMP411_REMOTE2_LOW_LIMIT_W 0x16
-#define TMP411_REMOTE2_HIGH_LIMIT_EXTD 0x17
-#define TMP411_REMOTE2_LOW_LIMIT_EXTD 0x18
-#define TMP411_REMOTE1_THERM_LIMIT 0x19
-#define TMP411_REMOTE2_THERM_LIMIT 0x1a
-#define TMP411_STATUS_FAULT 0x1b
-#define TMP411_CHANNEL_MASK 0x1f
-#define TMP411_LOCAL_THERM_LIMIT 0x20
-#define TMP411_THERM_HYSTERESIS 0x21
-#define TMP411_CONSECUTIVE_ALERT 0x22
-#define TMP411_REMOTE2 0x23
-#define TMP411_REMOTE2_EXTD 0x24
-#define TMP411_BETA_RANGE_CH1 0x25
-#define TMP411_BETA_RANGE_CH2 0x26
-#define TMP411_NFACTOR_REMOTE1 0x27
-#define TMP411_NFACTOR_REMOTE2 0x28
-#define TMP411_LOCAL_EXTD 0x29
-#define TMP411_STATUS_LIMIT_HIGH 0x35
-#define TMP411_STATUS_LIMIT_LOW 0x36
-#define TMP411_STATUS_THERM 0x37
-#define TMP411_RESET_W 0xfc
-#define TMP411_MANUFACTURER_ID 0xfe
-#define TMP411_DEVICE_ID 0xff
-
-#define TMP411A_DEVICE_ID_VAL 0x12
-#define TMP411B_DEVICE_ID_VAL 0x13
-#define TMP411C_DEVICE_ID_VAL 0x10
-#define TMP411d_DEVICE_ID_VAL 0x12
-
-/* Config register bits */
-#define TMP411_CONFIG1_TEMP_RANGE BIT(2)
-/* TMP411_CONFIG1_MODE bit is use to enable THERM mode */
-#define TMP411_CONFIG1_MODE BIT(5)
-#define TMP411_CONFIG1_RUN_L BIT(6)
-#define TMP411_CONFIG1_ALERT_MASK_L BIT(7)
-
-/* Status register bits */
-#define TMP411_STATUS_TEMP_THERM_ALARM BIT(1)
-#define TMP411_STATUS_OPEN BIT(2)
-#define TMP411_STATUS_TEMP_LOW_ALARM BIT(3)
-#define TMP411_STATUS_TEMP_HIGH_ALARM BIT(4)
-#define TMP411_STATUS_LOCAL_TEMP_LOW_ALARM BIT(5)
-#define TMP411_STATUS_LOCAL_TEMP_HIGH_ALARM BIT(6)
-#define TMP411_STATUS_BUSY BIT(7)
-
-/* Limits */
-#define TMP411_HYSTERESIS_HIGH_LIMIT 255
-#define TMP411_HYSTERESIS_LOW_LIMIT 0
-
-enum tmp411_power_state {
- TMP411_POWER_OFF = 0,
- TMP411_POWER_ON,
- TMP411_POWER_COUNT
-};
-
-enum tmp411_channel_id {
- TMP411_CHANNEL_LOCAL,
- TMP411_CHANNEL_REMOTE1,
-
- TMP411_CHANNEL_COUNT
-};
-
-/**
- * Get the last polled value of a sensor.
- *
- * @param idx Index to read. Idx indicates whether to read die
- * temperature or external temperature.
- * @param temp_ptr Destination for temperature in K.
- *
- * @return EC_SUCCESS if successful, non-zero if error.
- */
-int tmp411_get_val(int idx, int *temp_ptr);
-
-/**
- * Power control function of tmp411 temperature sensor.
- *
- * @param power_on TMP411_POWER_ON: turn tmp411 sensor on.
- * TMP411_POWER_OFF: shut tmp411 sensor down.
- *
- * @return EC_SUCCESS if successful, non-zero if error.
- */
-int tmp411_set_power(enum tmp411_power_state power_on);
-
-/*
- * Set TMP411 ALERT#/THERM2# pin to THERM mode, and give a limit
- * for a specific channel.
- *
- * @param channel specific a channel
- *
- * @param limit_c High limit temperature, default: 85C
- *
- * @param hysteresis Hysteresis temperature, default: 10C
- * All channels share the same hysteresis
- *
- * In THERM mode, ALERT# pin will trigger(Low) by itself when any
- * channel's temperature is greater( >= )than channel's limit_c,
- * and release(High) by itself when channel's temperature is lower
- * than (limit_c - hysteresis)
- */
-int tmp411_set_therm_limit(int channel, int limit_c, int hysteresis);
-#endif /* __CROS_EC_TMP411_H */
diff --git a/driver/temp_sensor/tmp432.c b/driver/temp_sensor/tmp432.c
deleted file mode 100644
index 6260678dcd..0000000000
--- a/driver/temp_sensor/tmp432.c
+++ /dev/null
@@ -1,399 +0,0 @@
-/* Copyright 2013 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.
- */
-
-/* TMP432 temperature sensor module for Chrome EC */
-
-#include "common.h"
-#include "console.h"
-#include "tmp432.h"
-#include "gpio.h"
-#include "i2c.h"
-#include "hooks.h"
-#include "util.h"
-
-static int temp_val_local;
-static int temp_val_remote1;
-static int temp_val_remote2;
-#ifndef CONFIG_TEMP_SENSOR_POWER_GPIO
-static uint8_t is_sensor_shutdown;
-#endif
-static int fake_temp[TMP432_IDX_COUNT] = {-1, -1, -1};
-
-/**
- * Determine whether the sensor is powered.
- *
- * @return non-zero the tmp432 sensor is powered.
- */
-static int has_power(void)
-{
-#ifdef CONFIG_TEMP_SENSOR_POWER_GPIO
- return gpio_get_level(CONFIG_TEMP_SENSOR_POWER_GPIO);
-#else
- return !is_sensor_shutdown;
-#endif
-}
-
-static int raw_read8(const int offset, int *data_ptr)
-{
- return i2c_read8(I2C_PORT_THERMAL, TMP432_I2C_ADDR_FLAGS,
- offset, data_ptr);
-}
-
-static int raw_write8(const int offset, int data)
-{
- return i2c_write8(I2C_PORT_THERMAL, TMP432_I2C_ADDR_FLAGS,
- offset, data);
-}
-
-static int get_temp(const int offset, int *temp_ptr)
-{
- int rv;
- int temp_raw = 0;
-
- rv = raw_read8(offset, &temp_raw);
- if (rv < 0)
- return rv;
-
- *temp_ptr = (int)(int8_t)temp_raw;
- return EC_SUCCESS;
-}
-
-#ifdef CONFIG_CMD_TEMP_SENSOR
-static int tmp432_set_temp(const int offset, int temp)
-{
- if (temp < -127 || temp > 127)
- return EC_ERROR_INVAL;
-
- return raw_write8(offset, (uint8_t)temp);
-}
-#endif
-
-int tmp432_get_val(int idx, int *temp_ptr)
-{
- if (!has_power())
- return EC_ERROR_NOT_POWERED;
-
- switch (idx) {
- case TMP432_IDX_LOCAL:
- *temp_ptr = temp_val_local;
- break;
- case TMP432_IDX_REMOTE1:
- *temp_ptr = temp_val_remote1;
- break;
- case TMP432_IDX_REMOTE2:
- *temp_ptr = temp_val_remote2;
- break;
- default:
- return EC_ERROR_UNKNOWN;
- }
-
- return EC_SUCCESS;
-}
-
-#ifndef CONFIG_TEMP_SENSOR_POWER_GPIO
-static int tmp432_shutdown(uint8_t want_shutdown)
-{
- int ret, value;
-
- if (want_shutdown == is_sensor_shutdown)
- return EC_SUCCESS;
-
- ret = raw_read8(TMP432_CONFIGURATION1_R, &value);
- if (ret < 0) {
- ccprintf("ERROR: Temp sensor I2C read8 error.\n");
- return ret;
- }
-
- if (want_shutdown && !(value & TMP432_CONFIG1_RUN_L)) {
- /* tmp432 is running, and want it to shutdown */
- /* CONFIG REG1 BIT6: 0=Run, 1=Shutdown */
- /* shut it down */
- value |= TMP432_CONFIG1_RUN_L;
- ret = raw_write8(TMP432_CONFIGURATION1_R, value);
- } else if (!want_shutdown && (value & TMP432_CONFIG1_RUN_L)) {
- /* tmp432 is shutdown, and want turn it on */
- value &= ~TMP432_CONFIG1_RUN_L;
- ret = raw_write8(TMP432_CONFIGURATION1_R, value);
- }
- /* else, the current setting is exactly what you want */
-
- is_sensor_shutdown = want_shutdown;
- return ret;
-}
-#endif
-
-static int tmp432_set_therm_mode(void)
-{
- int ret = 0;
- int data = 0;
-
- ret = raw_read8(TMP432_CONFIGURATION1_R, &data);
- if (ret)
- return EC_ERROR_UNKNOWN;
-
- data |= TMP432_CONFIG1_MODE;
- ret = raw_write8(TMP432_CONFIGURATION1_W, data);
- if (ret)
- return EC_ERROR_UNKNOWN;
-
- return EC_SUCCESS;
-}
-
-int tmp432_set_therm_limit(int channel, int limit_c, int hysteresis)
-{
- int ret = 0;
- int reg = 0;
-
- if (channel >= TMP432_CHANNEL_COUNT)
- return EC_ERROR_INVAL;
-
- if (hysteresis > TMP432_HYSTERESIS_HIGH_LIMIT ||
- hysteresis < TMP432_HYSTERESIS_LOW_LIMIT)
- return EC_ERROR_INVAL;
-
- /* hysteresis must be less than high limit */
- if (hysteresis > limit_c)
- return EC_ERROR_INVAL;
-
- if (tmp432_set_therm_mode() != EC_SUCCESS)
- return EC_ERROR_UNKNOWN;
-
- switch (channel) {
- case TMP432_CHANNEL_LOCAL:
- reg = TMP432_LOCAL_HIGH_LIMIT_W;
- break;
- case TMP432_CHANNEL_REMOTE1:
- reg = TMP432_REMOTE1_HIGH_LIMIT_W;
- break;
- case TMP432_CHANNEL_REMOTE2:
- reg = TMP432_REMOTE2_HIGH_LIMIT_W;
- break;
- }
-
- ret = raw_write8(reg, limit_c);
- if (ret)
- return EC_ERROR_UNKNOWN;
-
- ret = raw_write8(TMP432_THERM_HYSTERESIS, hysteresis);
- if (ret)
- return EC_ERROR_UNKNOWN;
-
- return EC_SUCCESS;
-}
-
-static void temp_sensor_poll(void)
-{
- int temp_c;
-
- if (!has_power())
- return;
-
- if (fake_temp[TMP432_IDX_LOCAL] != -1) {
- temp_val_local = C_TO_K(fake_temp[TMP432_IDX_LOCAL]);
- } else {
- if (get_temp(TMP432_LOCAL, &temp_c) == EC_SUCCESS)
- temp_val_local = C_TO_K(temp_c);
- /* else: Keep previous value when it fails */
- }
-
- if (fake_temp[TMP432_IDX_REMOTE1] != -1) {
- temp_val_remote1 = C_TO_K(fake_temp[TMP432_IDX_REMOTE1]);
- } else {
- if (get_temp(TMP432_REMOTE1, &temp_c) == EC_SUCCESS)
- temp_val_remote1 = C_TO_K(temp_c);
- /* else: Keep previous value when it fails */
- }
-
- if (fake_temp[TMP432_IDX_REMOTE2] != -1) {
- temp_val_remote2 = C_TO_K(fake_temp[TMP432_IDX_REMOTE2]);
- } else {
- if (get_temp(TMP432_REMOTE2, &temp_c) == EC_SUCCESS)
- temp_val_remote2 = C_TO_K(temp_c);
- /* else: Keep previous value when it fails */
- }
-}
-DECLARE_HOOK(HOOK_SECOND, temp_sensor_poll, HOOK_PRIO_TEMP_SENSOR);
-
-#ifdef CONFIG_CMD_TEMP_SENSOR
-static int tmp432_set_fake_temp(int index, int degree_c)
-{
- if ((index < 0) || (index >= TMP432_IDX_COUNT))
- return EC_ERROR_INVAL;
-
- fake_temp[index] = degree_c;
- ccprintf("New degree will be updated 1 sec later\n\n");
-
- return EC_SUCCESS;
-}
-
-static void print_temps(
- const char *name,
- const int tmp432_temp_reg,
- const int tmp432_therm_limit_reg,
- const int tmp432_high_limit_reg,
- const int tmp432_low_limit_reg)
-{
- int value;
-
- if (!has_power()) {
- ccprintf(" TMP432 is shutdown\n");
- return;
- }
-
- ccprintf("%s:\n", name);
-
- if (get_temp(tmp432_temp_reg, &value) == EC_SUCCESS)
- ccprintf(" Temp %3dC\n", value);
-
- if (get_temp(tmp432_therm_limit_reg, &value) == EC_SUCCESS)
- ccprintf(" Therm Trip %3dC\n", value);
-
- if (get_temp(tmp432_high_limit_reg, &value) == EC_SUCCESS)
- ccprintf(" High Alarm %3dC\n", value);
-
- if (get_temp(tmp432_low_limit_reg, &value) == EC_SUCCESS)
- ccprintf(" Low Alarm %3dC\n", value);
-}
-
-static int print_status(void)
-{
- int value, i;
-
- print_temps("Local", TMP432_LOCAL,
- TMP432_LOCAL_THERM_LIMIT,
- TMP432_LOCAL_HIGH_LIMIT_R,
- TMP432_LOCAL_LOW_LIMIT_R);
-
- print_temps("Remote1", TMP432_REMOTE1,
- TMP432_REMOTE1_THERM_LIMIT,
- TMP432_REMOTE1_HIGH_LIMIT_R,
- TMP432_REMOTE1_LOW_LIMIT_R);
-
- print_temps("Remote2", TMP432_REMOTE2,
- TMP432_REMOTE2_THERM_LIMIT,
- TMP432_REMOTE2_HIGH_LIMIT_R,
- TMP432_REMOTE2_LOW_LIMIT_R);
-
- ccprintf("\n");
-
- for (i = 0; i < TMP432_IDX_COUNT; ++i) {
- ccprintf("fake temperature[%d]= ", i);
- if (fake_temp[i] == -1) {
- ccprintf("Not overridden\n");
- continue;
- }
-
- if (tmp432_get_val(i, &value) == EC_SUCCESS)
- ccprintf("%d C or %d K\n", (value - 273), value);
- else
- ccprintf("Access error\n");
- }
-
- ccprintf("\n");
-
- if (raw_read8(TMP432_STATUS, &value) == EC_SUCCESS)
- ccprintf("STATUS: %pb\n", BINARY_VALUE(value, 8));
-
- if (raw_read8(TMP432_CONFIGURATION1_R, &value) == EC_SUCCESS)
- ccprintf("CONFIG1: %pb\n", BINARY_VALUE(value, 8));
-
- if (raw_read8(TMP432_CONFIGURATION2_R, &value) == EC_SUCCESS)
- ccprintf("CONFIG2: %pb\n", BINARY_VALUE(value, 8));
-
- return EC_SUCCESS;
-}
-
-static int command_tmp432(int argc, char **argv)
-{
- char *command;
- char *e;
- char *power;
- int data;
- int offset;
- int rv;
-
- /* handle "power" command before checking the power status. */
- if ((argc == 3) && !strcasecmp(argv[1], "power")) {
- power = argv[2];
- if (!strncasecmp(power, "on", sizeof("on"))) {
- rv = tmp432_set_power(TMP432_POWER_ON);
- if (!rv)
- print_status();
- }
- else if (!strncasecmp(power, "off", sizeof("off")))
- rv = tmp432_set_power(TMP432_POWER_OFF);
- else
- return EC_ERROR_PARAM2;
- ccprintf("Set TMP432 %s\n", power);
- return rv;
- }
-
- if (!has_power()) {
- ccprintf("ERROR: Temp sensor not powered.\n");
- return EC_ERROR_NOT_POWERED;
- }
-
- /* If no args just print status */
- if (argc == 1)
- return print_status();
-
- if (argc < 3)
- return EC_ERROR_PARAM_COUNT;
-
- command = argv[1];
- offset = strtoi(argv[2], &e, 0);
- if (*e || offset < 0 || offset > 255)
- return EC_ERROR_PARAM2;
-
- if (!strcasecmp(command, "getbyte")) {
- rv = raw_read8(offset, &data);
- if (rv < 0)
- return rv;
- ccprintf("Byte at offset 0x%02x is %pb\n",
- offset, BINARY_VALUE(data, 8));
- return rv;
- }
-
- /* Remaining commands are "tmp432 set-command offset data" */
- if (argc != 4)
- return EC_ERROR_PARAM_COUNT;
-
- data = strtoi(argv[3], &e, 0);
- if (*e)
- return EC_ERROR_PARAM3;
-
- if (!strcasecmp(command, "settemp")) {
- ccprintf("Setting 0x%02x to %dC\n", offset, data);
- rv = tmp432_set_temp(offset, data);
- } else if (!strcasecmp(command, "setbyte")) {
- ccprintf("Setting 0x%02x to 0x%02x\n", offset, data);
- rv = raw_write8(offset, data);
- } else if (!strcasecmp(command, "fake")) {
- ccprintf("Hook temperature\n");
- rv = tmp432_set_fake_temp(offset, data);
- print_status();
- } else
- return EC_ERROR_PARAM1;
-
- return rv;
-}
-DECLARE_CONSOLE_COMMAND(tmp432, command_tmp432,
- "[settemp|setbyte <offset> <value>] or [getbyte <offset>] or"
- "[fake <index> <value>] or [power <on|off>]. "
- "Temps in Celsius.",
- "Print tmp432 temp sensor status or set parameters.");
-#endif
-
-int tmp432_set_power(enum tmp432_power_state power_on)
-{
-#ifndef CONFIG_TEMP_SENSOR_POWER_GPIO
- uint8_t shutdown = (power_on == TMP432_POWER_OFF) ? 1 : 0;
- return tmp432_shutdown(shutdown);
-#else
- gpio_set_level(CONFIG_TEMP_SENSOR_POWER_GPIO, power_on);
- return EC_SUCCESS;
-#endif
-}
-
diff --git a/driver/temp_sensor/tmp432.h b/driver/temp_sensor/tmp432.h
deleted file mode 100644
index e58e39a4a0..0000000000
--- a/driver/temp_sensor/tmp432.h
+++ /dev/null
@@ -1,143 +0,0 @@
-/* Copyright 2013 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.
- */
-
-/* TMP432 temperature sensor module for Chrome EC */
-
-#ifndef __CROS_EC_TMP432_H
-#define __CROS_EC_TMP432_H
-
-#define TMP432_I2C_ADDR_FLAGS 0x4C
-
-#define TMP432_IDX_LOCAL 0
-#define TMP432_IDX_REMOTE1 1
-#define TMP432_IDX_REMOTE2 2
-#define TMP432_IDX_COUNT 3
-
-/* Chip-specific registers */
-#define TMP432_LOCAL 0x00
-#define TMP432_REMOTE1 0x01
-#define TMP432_STATUS 0x02
-#define TMP432_CONFIGURATION1_R 0x03
-#define TMP432_CONVERSION_RATE_R 0x04
-#define TMP432_LOCAL_HIGH_LIMIT_R 0x05
-#define TMP432_LOCAL_LOW_LIMIT_R 0x06
-#define TMP432_REMOTE1_HIGH_LIMIT_R 0x07
-#define TMP432_REMOTE1_LOW_LIMIT_R 0x08
-#define TMP432_CONFIGURATION1_W 0x09
-#define TMP432_CONVERSION_RATE_W 0x0a
-#define TMP432_LOCAL_HIGH_LIMIT_W 0x0b
-#define TMP432_LOCAL_LOW_LIMIT_W 0x0c
-#define TMP432_REMOTE1_HIGH_LIMIT_W 0x0d
-#define TMP432_REMOTE1_LOW_LIMIT_W 0x0e
-#define TMP432_ONESHOT 0x0f
-#define TMP432_REMOTE1_EXTD 0x10
-#define TMP432_REMOTE1_HIGH_LIMIT_EXTD 0x13
-#define TMP432_REMOTE1_LOW_LIMIT_EXTD 0x14
-#define TMP432_REMOTE2_HIGH_LIMIT_R 0x15
-#define TMP432_REMOTE2_HIGH_LIMIT_W 0x15
-#define TMP432_REMOTE2_LOW_LIMIT_R 0x16
-#define TMP432_REMOTE2_LOW_LIMIT_W 0x16
-#define TMP432_REMOTE2_HIGH_LIMIT_EXTD 0x17
-#define TMP432_REMOTE2_LOW_LIMIT_EXTD 0x18
-#define TMP432_REMOTE1_THERM_LIMIT 0x19
-#define TMP432_REMOTE2_THERM_LIMIT 0x1a
-#define TMP432_STATUS_FAULT 0x1b
-#define TMP432_CHANNEL_MASK 0x1f
-#define TMP432_LOCAL_THERM_LIMIT 0x20
-#define TMP432_THERM_HYSTERESIS 0x21
-#define TMP432_CONSECUTIVE_ALERT 0x22
-#define TMP432_REMOTE2 0x23
-#define TMP432_REMOTE2_EXTD 0x24
-#define TMP432_BETA_RANGE_CH1 0x25
-#define TMP432_BETA_RANGE_CH2 0x26
-#define TMP432_NFACTOR_REMOTE1 0x27
-#define TMP432_NFACTOR_REMOTE2 0x28
-#define TMP432_LOCAL_EXTD 0x29
-#define TMP432_STATUS_LIMIT_HIGH 0x35
-#define TMP432_STATUS_LIMIT_LOW 0x36
-#define TMP432_STATUS_THERM 0x37
-#define TMP432_LOCAL_HIGH_LIMIT_EXTD 0x3d
-#define TMP432_LOCAL_LOW_LIMIT_EXTD 0x3e
-#define TMP432_CONFIGURATION2_R 0x3f
-#define TMP432_CONFIGURATION2_W 0x3f
-#define TMP432_RESET_W 0xfc
-#define TMP432_DEVICE_ID 0xfd
-#define TMP432_MANUFACTURER_ID 0xfe
-
-/* Config register bits */
-#define TMP432_CONFIG1_TEMP_RANGE BIT(2)
-/* TMP432_CONFIG1_MODE bit is use to enable THERM mode */
-#define TMP432_CONFIG1_MODE BIT(5)
-#define TMP432_CONFIG1_RUN_L BIT(6)
-#define TMP432_CONFIG1_ALERT_MASK_L BIT(7)
-#define TMP432_CONFIG2_RESISTANCE_CORRECTION BIT(2)
-#define TMP432_CONFIG2_LOCAL_ENABLE BIT(3)
-#define TMP432_CONFIG2_REMOTE1_ENABLE BIT(4)
-#define TMP432_CONFIG2_REMOTE2_ENABLE BIT(5)
-
-/* Status register bits */
-#define TMP432_STATUS_TEMP_THERM_ALARM BIT(1)
-#define TMP432_STATUS_OPEN BIT(2)
-#define TMP432_STATUS_TEMP_LOW_ALARM BIT(3)
-#define TMP432_STATUS_TEMP_HIGH_ALARM BIT(4)
-#define TMP432_STATUS_BUSY BIT(7)
-
-/* Limintaions */
-#define TMP432_HYSTERESIS_HIGH_LIMIT 255
-#define TMP432_HYSTERESIS_LOW_LIMIT 0
-
-enum tmp432_power_state {
- TMP432_POWER_OFF = 0,
- TMP432_POWER_ON,
- TMP432_POWER_COUNT
-};
-
-enum tmp432_channel_id {
- TMP432_CHANNEL_LOCAL,
- TMP432_CHANNEL_REMOTE1,
- TMP432_CHANNEL_REMOTE2,
-
- TMP432_CHANNEL_COUNT
-};
-
-/**
- * Get the last polled value of a sensor.
- *
- * @param idx Index to read. Idx indicates whether to read die
- * temperature or external temperature.
- * @param temp_ptr Destination for temperature in K.
- *
- * @return EC_SUCCESS if successful, non-zero if error.
- */
-int tmp432_get_val(int idx, int *temp_ptr);
-
-/**
- * Power control function of tmp432 temperature sensor.
- *
- * @param power_on TMP432_POWER_ON: turn tmp432 sensor on.
- * TMP432_POWER_OFF: shut tmp432 sensor down.
- *
- * @return EC_SUCCESS if successful, non-zero if error.
- */
-int tmp432_set_power(enum tmp432_power_state power_on);
-
-/*
- * Set TMP432 ALERT#/THERM2# pin to THERM mode, and give a limit
- * for a specific channel.
- *
- * @param channel specific a channel
- *
- * @param limit_c High limit temperature, default: 85C
- *
- * @param hysteresis Hysteresis temperature, default: 10C
- * All channels share the same hysteresis
- *
- * In THERM mode, ALERT# pin will trigger(Low) by itself when any
- * channel's temperature is greater( >= )than channel's limit_c,
- * and release(High) by itself when channel's temperature is lower
- * than (limit_c - hysteresis)
- */
-int tmp432_set_therm_limit(int channel, int limit_c, int hysteresis);
-#endif /* __CROS_EC_TMP432_H */
diff --git a/driver/temp_sensor/tmp468.c b/driver/temp_sensor/tmp468.c
deleted file mode 100644
index 46e77ca696..0000000000
--- a/driver/temp_sensor/tmp468.c
+++ /dev/null
@@ -1,101 +0,0 @@
-/* Copyright 2018 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.
- */
-
-/* TMP468 temperature sensor module for Chrome EC */
-
-#include "common.h"
-#include "console.h"
-#include "tmp432.h"
-#include "gpio.h"
-#include "i2c.h"
-#include "hooks.h"
-#include "util.h"
-
-#include "tmp468.h"
-
-
-static int fake_temp[TMP468_CHANNEL_COUNT] = {-1, -1, -1, -1, -1, -1, -1 , -1, -1};
-static int temp_val[TMP468_CHANNEL_COUNT] = {0, 0, 0, 0, 0, 0, 0 , 0, 0};
-static uint8_t is_sensor_shutdown;
-
-static int has_power(void)
-{
- return !is_sensor_shutdown;
-}
-
-static int raw_read16(const int offset, int *data_ptr)
-{
- return i2c_read16(I2C_PORT_THERMAL, TMP468_I2C_ADDR_FLAGS,
- offset, data_ptr);
-}
-
-static int raw_write16(const int offset, int data_ptr)
-{
- return i2c_write16(I2C_PORT_THERMAL, TMP468_I2C_ADDR_FLAGS,
- offset, data_ptr);
-}
-
-static int tmp468_shutdown(uint8_t want_shutdown)
-{
- int ret, value;
-
- if (want_shutdown == is_sensor_shutdown)
- return EC_SUCCESS;
-
- ret = raw_read16(TMP468_CONFIGURATION, &value);
- if (ret < 0) {
- ccprintf("ERROR: Temp sensor I2C read16 error.\n");
- return ret;
- }
-
- if (want_shutdown)
- value |= TMP468_SHUTDOWN;
- else
- value &= ~TMP468_SHUTDOWN;
-
- ret = raw_write16(TMP468_CONFIGURATION, value);
- if (ret == EC_SUCCESS)
- is_sensor_shutdown = want_shutdown;
-
- return EC_SUCCESS;
-}
-
-int tmp468_get_val(int idx, int *temp_ptr)
-{
- if(!has_power())
- return EC_ERROR_NOT_POWERED;
-
- if (idx < TMP468_CHANNEL_COUNT) {
- *temp_ptr = C_TO_K(temp_val[idx]);
- return EC_SUCCESS;
- }
-
- return EC_ERROR_INVAL;
-}
-
-static void temp_sensor_poll(void)
-{
- int i, ret;
-
- if (!has_power())
- return;
-
- for (i = 0; i < TMP468_CHANNEL_COUNT; i++)
- if (fake_temp[i] != -1) {
- temp_val[i] = fake_temp[i];
- } else {
- ret = raw_read16(TMP468_LOCAL + i, &temp_val[i]);
- if (ret < 0)
- return;
- temp_val[i] >>= TMP468_SHIFT1;
- }
-}
-DECLARE_HOOK(HOOK_SECOND, temp_sensor_poll, HOOK_PRIO_TEMP_SENSOR);
-
-int tmp468_set_power(enum tmp468_power_state power_on)
-{
- uint8_t shutdown = (power_on == TMP468_POWER_OFF) ? 1 : 0;
- return tmp468_shutdown(shutdown);
-}
diff --git a/driver/temp_sensor/tmp468.h b/driver/temp_sensor/tmp468.h
deleted file mode 100644
index 59fbd20477..0000000000
--- a/driver/temp_sensor/tmp468.h
+++ /dev/null
@@ -1,126 +0,0 @@
-/* Copyright 2018 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.
- */
-
-/* TMP468 temperature sensor module for Chrome EC */
-
-#ifndef __CROS_EC_TMP468_H
-#define __CROS_EC_TMP468_H
-
-#define TMP468_I2C_ADDR_FLAGS (0x48 | I2C_FLAG_BIG_ENDIAN)
-#define TMP468_SHIFT1 7
-
-#define TMP468_LOCAL 0x00
-#define TMP468_REMOTE1 0x01
-#define TMP468_REMOTE2 0x02
-#define TMP468_REMOTE3 0x03
-#define TMP468_REMOTE4 0x04
-#define TMP468_REMOTE5 0x05
-#define TMP468_REMOTE6 0x06
-#define TMP468_REMOTE7 0x07
-#define TMP468_REMOTE8 0x08
-
-#define TMP468_SRST 0x20
-#define TMP468_THERM 0x21
-#define TMP468_THERM2 0x22
-#define TMP468_ROPEN 0x23
-
-#define TMP468_CONFIGURATION 0x30
-#define TMP468_THERM_HYST 0x38
-
-#define TMP468_LOCAL_LOW_LIMIT 0x39
-#define TMP468_LOCAL_HIGH_LIMT 0x3a
-
-#define TMP468_REMOTE1_OFFSET 0x40
-#define TMP468_REMOTE1_NFACTOR 0x41
-#define TMP468_REMOTE1_LOW_LIMIT 0x41
-#define TMP468_REMOTE1_HIGH_LIMIT 0x42
-
-#define TMP468_REMOTE2_OFFSET 0x48
-#define TMP468_REMOTE2_NFACTOR 0x49
-#define TMP468_REMOTE2_LOW_LIMIT 0x4a
-#define TMP468_REMOTE2_HIGH_LIMIT 0x4b
-
-#define TMP468_REMOTE3_OFFSET 0x50
-#define TMP468_REMOTE3_NFACTOR 0x51
-#define TMP468_REMOTE3_LOW_LIMIT 0x52
-#define TMP468_REMOTE3_HIGH_LIMIT 0x53
-
-#define TMP468_REMOTE4_OFFSET 0x58
-#define TMP468_REMOTE4_NFACTOR 0x59
-#define TMP468_REMOTE4_LOW_LIMIT 0x59
-#define TMP468_REMOTE4_HIGH_LIMIT 0x5a
-
-#define TMP468_REMOTE5_OFFSET 0x60
-#define TMP468_REMOTE5_NFACTOR 0x61
-#define TMP468_REMOTE5_LOW_LIMIT 0x62
-#define TMP468_REMOTE5_HIGH_LIMIT 0x63
-
-#define TMP468_REMOTE6_OFFSET 0x68
-#define TMP468_REMOTE6_NFACTOR 0x69
-#define TMP468_REMOTE6_LOW_LIMIT 0x6a
-#define TMP468_REMOTE6_HIGH_LIMIT 0x6b
-
-#define TMP468_REMOTE7_OFFSET 0x70
-#define TMP468_REMOTE7_NFACTOR 0x71
-#define TMP468_REMOTE7_LOW_LIMIT 0x72
-#define TMP468_REMOTE7_HIGH_LIMIT 0x73
-
-#define TMP468_REMOTE8_OFFSET 0x78
-#define TMP468_REMOTE8_NFACTOR 0x79
-#define TMP468_REMOTE8_LOW_LIMIT 0x7a
-#define TMP468_REMOTE8_HIGH_LIMIT 0x7b
-
-#define TMP468_LOCK 0xc4
-
-#define TMP468_DEVICE_ID 0xfd
-#define TMP468_MANUFACTURER_ID 0xfe
-
-#define TMP468_SHUTDOWN BIT(5)
-
-enum tmp468_channel_id {
- TMP468_CHANNEL_LOCAL,
-
- TMP468_CHANNEL_REMOTE1,
- TMP468_CHANNEL_REMOTE2,
- TMP468_CHANNEL_REMOTE3,
- TMP468_CHANNEL_REMOTE4,
- TMP468_CHANNEL_REMOTE5,
- TMP468_CHANNEL_REMOTE6,
- TMP468_CHANNEL_REMOTE7,
- TMP468_CHANNEL_REMOTE8,
-
- TMP468_CHANNEL_COUNT
-};
-
-enum tmp468_power_state {
- TMP468_POWER_OFF = 0,
- TMP468_POWER_ON,
-
- TMP468_POWER_COUNT
-};
-
-
-/**
- * Get the last polled value of a sensor.
- *
- * @param idx Index to read. Idx indicates whether to read die
- * temperature or external temperature.
- * @param temp_ptr Destination for temperature in K.
- *
- * @return EC_SUCCESS if successful, non-zero if error.
- */
-int tmp468_get_val(int idx, int *temp_ptr);
-
-/**
- * Power control function of tmp432 temperature sensor.
- *
- * @param power_on TMP468_POWER_ON: turn tmp468 sensor on.
- * TMP468_POWER_OFF: shut tmp468 sensor down.
- *
- * @return EC_SUCCESS if successful, non-zero if error.
- */
-int tmp468_set_power(enum tmp468_power_state power_on);
-
-#endif /* __CROS_EC_TMP468_H */