diff --git a/board/slippy/board.c b/board/slippy/board.c index 92782827ad..a70c4682fd 100644 --- a/board/slippy/board.c +++ b/board/slippy/board.c @@ -23,8 +23,8 @@ #include "registers.h" #include "switch.h" #include "temp_sensor.h" +#include "temp_sensor_g781.h" #include "timer.h" -#include "tmp006.h" #include "util.h" /* GPIO signal list. Must match order from enum gpio_signal. */ @@ -162,11 +162,12 @@ const struct i2c_port_t i2c_ports[I2C_PORTS_USED] = { /* Temperature sensors data; must be in same order as enum temp_sensor_id. */ const struct temp_sensor_t temp_sensors[TEMP_SENSOR_COUNT] = { -/* HEY: Need correct I2C addresses and read function for external sensor */ - {"ECInternal", TEMP_SENSOR_TYPE_BOARD, chip_temp_sensor_get_val, 0, 4}, #ifdef CONFIG_PECI {"PECI", TEMP_SENSOR_TYPE_CPU, peci_temp_sensor_get_val, 0, 2}, #endif + {"ECInternal", TEMP_SENSOR_TYPE_BOARD, chip_temp_sensor_get_val, 0, 4}, + {"G781Internal", TEMP_SENSOR_TYPE_BOARD, g781_get_val, 0, 4}, + {"G781External", TEMP_SENSOR_TYPE_BOARD, g781_get_val, 1, 4}, }; struct keyboard_scan_config keyscan_config = { @@ -207,3 +208,11 @@ void board_process_wake_events(uint32_t active_wake_events) else gpio_set_level(GPIO_PCH_WAKE_L, 1); } + +/** + * Board-specific g781 power state. + */ +int board_g781_has_power(void) +{ + return gpio_get_level(GPIO_PP3300_DX_EN); +} diff --git a/board/slippy/board.h b/board/slippy/board.h index ed9530d5aa..2c42fb77cd 100644 --- a/board/slippy/board.h +++ b/board/slippy/board.h @@ -37,6 +37,7 @@ #define CONFIG_POWER_BUTTON_X86 #define CONFIG_PWM_FAN #define CONFIG_TEMP_SENSOR +#define CONFIG_TEMP_SENSOR_G781 #define CONFIG_USB_PORT_POWER_DUMB #define CONFIG_WIRELESS #define CONFIG_WP_ACTIVE_HIGH @@ -176,12 +177,6 @@ enum adc_channel { /* EC internal die temperature in degrees K. */ ADC_CH_EC_TEMP = 0, - /* HEY: Slippy MB has only one discrete thermal sensor, but it has two - * values (one internal and one external). Both should be here. - * HEY: There may be a BAT_TEMP sensor on the battery pack too. - * On Slippy, that's PB4/AIN10 - */ - /* HEY: Be prepared to read this (ICMNT). */ /* Charger current in mA. */ ADC_CH_CHARGER_CURRENT, @@ -190,16 +185,27 @@ enum adc_channel { }; enum temp_sensor_id { - /* HEY - need two I2C sensor values */ - +#ifdef CONFIG_PECI + /* CPU die temperature via PECI */ + TEMP_SENSOR_CPU_PECI = 0, /* EC internal temperature sensor */ TEMP_SENSOR_EC_INTERNAL, - /* CPU die temperature via PECI */ - TEMP_SENSOR_CPU_PECI, +#else + /* EC internal temperature sensor */ + TEMP_SENSOR_EC_INTERNAL = 0, +#endif + /* G781 internal and external sensors */ + TEMP_SENSOR_I2C_G781_INTERNAL, + TEMP_SENSOR_I2C_G781_EXTERNAL, TEMP_SENSOR_COUNT }; +/** + * Board-specific g781 power state. + */ +int board_g781_has_power(void); + /* HEY: The below stuff is for Link. Pick a different pin for Slippy */ /* Target value for BOOTCFG. This is set to PE2/USB1_CTL1, which has an external * pullup. If this signal is pulled to ground when the EC boots, the EC will get