diff options
author | Kevin K Wong <kevin.k.wong@intel.com> | 2014-09-11 09:32:51 -0700 |
---|---|---|
committer | ChromeOS Commit Bot <chromeos-commit-bot@chromium.org> | 2015-02-12 22:36:34 +0000 |
commit | 6506d659f6941d4d1bd95eda5f85fbfb4257e5aa (patch) | |
tree | eff199d4a45d7357d930d8654910384993785af0 | |
parent | 197ae6a78539de544aa938da1afe67faf7ee8805 (diff) | |
download | chrome-ec-6506d659f6941d4d1bd95eda5f85fbfb4257e5aa.tar.gz |
strago: Added support for temperature sensor.
BUG=none
TEST=verfiy temperature is displayed via EC console.
BRANCH=none
Change-Id: Ic43af17961361e4c971a343a0d24d310c3aaf2ac
Signed-off-by: Kevin K Wong <kevin.k.wong@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/248713
Tested-by: Divya Jyothi <divya.jyothi@intel.com>
Reviewed-by: Shawn N <shawnn@chromium.org>
Commit-Queue: Divya Jyothi <divya.jyothi@intel.com>
-rw-r--r-- | board/strago/board.c | 41 | ||||
-rwxr-xr-x | board/strago/board.h | 23 | ||||
-rwxr-xr-x | board/strago/gpio.inc | 5 |
3 files changed, 65 insertions, 4 deletions
diff --git a/board/strago/board.c b/board/strago/board.c index 1aa9762515..9aa1e3b4ac 100644 --- a/board/strago/board.c +++ b/board/strago/board.c @@ -4,12 +4,17 @@ */ /* Strago board-specific configuration */ +#include "driver/temp_sensor/tmp43x.h" #include "extpower.h" #include "gpio.h" +#include "i2c.h" #include "lid_switch.h" #include "power.h" #include "power_button.h" #include "registers.h" +#include "temp_sensor.h" +#include "temp_sensor_chip.h" +#include "thermal.h" #include "util.h" #define GPIO_KB_INPUT (GPIO_INPUT | GPIO_PULL_UP) @@ -26,3 +31,39 @@ const struct power_signal_info power_signal_list[] = { {GPIO_PCH_SLP_S4_L, 1, "SLP_S4#_DEASSERTED"}, }; BUILD_ASSERT(ARRAY_SIZE(power_signal_list) == POWER_SIGNAL_COUNT); + +const struct i2c_port_t i2c_ports[] = { + {"I2C0", I2C_PORT0, 100}, +}; +const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports); + +/* + * Temperature sensors data; must be in same order as enum temp_sensor_id. + * Sensor index and name must match those present in coreboot: + * src/mainboard/google/${board}/acpi/dptf.asl + */ +const struct temp_sensor_t temp_sensors[] = { + {"TMP432_Internal", TEMP_SENSOR_TYPE_BOARD, tmp43x_get_val, + TMP432_IDX_LOCAL, 4}, + {"TMP432_Sensor_1", TEMP_SENSOR_TYPE_BOARD, tmp43x_get_val, + TMP432_IDX_REMOTE1, 4}, + {"TMP432_Sensor_2", TEMP_SENSOR_TYPE_BOARD, tmp43x_get_val, + TMP432_IDX_REMOTE2, 4}, + {"TMP431_Internal", TEMP_SENSOR_TYPE_BOARD, tmp43x_get_val, + TMP431_IDX_LOCAL, 4}, + {"TMP431_Sensor", TEMP_SENSOR_TYPE_BOARD, tmp43x_get_val, + TMP431_IDX_REMOTE1, 4}, +}; +BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT); + +/* Thermal limits for each temp sensor. All temps are in degrees K. Must be in + * same order as enum temp_sensor_id. To always ignore any temp, use 0. + */ +struct ec_thermal_config thermal_params[] = { + {{0, 0, 0}, 0, 0}, /* TMP432_Internal */ + {{0, 0, 0}, 0, 0}, /* TMP432_Sensor_1 */ + {{0, 0, 0}, 0, 0}, /* TMP432_Sensor_2 */ + {{0, 0, 0}, 0, 0}, /* TMP431_Internal */ + {{0, 0, 0}, 0, 0}, /* TMP431_Sensor */ +}; +BUILD_ASSERT(ARRAY_SIZE(thermal_params) == TEMP_SENSOR_COUNT); diff --git a/board/strago/board.h b/board/strago/board.h index f6aa5f4290..a33454a42b 100755 --- a/board/strago/board.h +++ b/board/strago/board.h @@ -22,6 +22,7 @@ #define CONFIG_LID_SWITCH #define CONFIG_POWER_COMMON #define CONFIG_EXTPOWER_GPIO +#define CONFIG_I2C #define CONFIG_VBOOT_HASH #define CONFIG_SPI @@ -33,17 +34,23 @@ #define CONFIG_FLASH_ERASE_SIZE 0x00001000 /* erase bank size */ #define CONFIG_FLASH_WRITE_SIZE 0x00000010 /* minimum write size */ +/* I2C ports */ +#define I2C_PORT0 0 +#define I2C_PORT_THERMAL I2C_PORT0 + +#define CONFIG_TEMP_SENSOR +#define CONFIG_TEMP_SENSOR_TMP431 +#define CONFIG_TEMP_SENSOR_TMP432 + /* Ideal flash write size fills the 32-entry flash write buffer */ #define CONFIG_FLASH_WRITE_IDEAL_SIZE (32 * 4) - /* Modules we want to exclude */ #undef CONFIG_EEPROM #undef CONFIG_EOPTION #undef CONFIG_PSTORE #undef CONFIG_PECI #undef CONFIG_SWITCH -#undef CONFIG_I2C #undef CONFIG_PWM #undef CONFIG_FANS #undef CONFIG_ADC @@ -63,6 +70,18 @@ enum power_signal { POWER_SIGNAL_COUNT }; +enum temp_sensor_id { + /* TMP432 local and remote sensors */ + TEMP_SENSOR_I2C_TMP432_LOCAL, + TEMP_SENSOR_I2C_TMP432_REMOTE1, + TEMP_SENSOR_I2C_TMP432_REMOTE2, + + /* TMP431 local and remote sensors */ + TEMP_SENSOR_I2C_TMP431_LOCAL, + TEMP_SENSOR_I2C_TMP431_REMOTE1, + + TEMP_SENSOR_COUNT +}; #endif /* !__ASSEMBLER__ */ #endif /* __BOARD_H */ diff --git a/board/strago/gpio.inc b/board/strago/gpio.inc index 2ab25a924d..1e935f9bb2 100755 --- a/board/strago/gpio.inc +++ b/board/strago/gpio.inc @@ -85,10 +85,11 @@ GPIO(PCH_SLP_SX_L, PORT(21), 1, GPIO_INT_BOTH_DSLEEP, UNIMPLEMENTED(WP_L) /* Alternate functions GPIO definition */ -ALTERNATE(PORT(16), 0x24, 1, MODULE_UART, 0) /* UART0 */ +ALTERNATE(PORT(16), 0x24, 1, MODULE_UART, 0) /* UART0 */ +ALTERNATE(PORT(1), 0x60, 2, MODULE_I2C, GPIO_PULL_UP) /* I2C0: Temperature Sensor */ ALTERNATE(PORT(0), 0xfc, 3, MODULE_KEYBOARD_SCAN, GPIO_KB_OUTPUT) ALTERNATE(PORT(1), 0x03, 3, MODULE_KEYBOARD_SCAN, GPIO_KB_OUTPUT) -ALTERNATE(PORT(10) , 0xd8, 3, MODULE_KEYBOARD_SCAN, GPIO_KB_OUTPUT) +ALTERNATE(PORT(10), 0xd8, 3, MODULE_KEYBOARD_SCAN, GPIO_KB_OUTPUT) GPIO(KBD_KSO2, PORT(0),1, GPIO_KB_OUTPUT_COL2, NULL) /* Negative edge triggered irq. */ ALTERNATE(PORT(3), 0x04, 3, MODULE_KEYBOARD_SCAN, GPIO_KB_INPUT) ALTERNATE(PORT(4), 0x0d, 3, MODULE_KEYBOARD_SCAN, GPIO_KB_INPUT) |