diff options
author | Dave Parker <dparker@chromium.org> | 2013-06-25 14:57:38 -0700 |
---|---|---|
committer | ChromeBot <chrome-bot@google.com> | 2013-07-11 22:32:52 -0700 |
commit | b2bc8aaa20479a87261aed8611367f11cf33c909 (patch) | |
tree | 6455c210351740621c86af9f43e40eae618f278c /board | |
parent | eb8920c93921122e19c1ccf682b76d45a0bda7fd (diff) | |
download | chrome-ec-b2bc8aaa20479a87261aed8611367f11cf33c909.tar.gz |
Basic G781 temp sensor support for Falco and Peppy.
This lets us read the internal and external temp values.
More functionality to come once we figure out what is
needed.
BUG=chrome-os-partner:20432
BRANCH=falco,peppy
TEST=run ec 'temps' command on Falco and Peppy.
Signed-off-by: Dave Parker <dparker@chromium.org>
Change-Id: I4f452f438e0a158dc8b34901e3faad3ce36d28b2
Reviewed-on: https://gerrit.chromium.org/gerrit/60145
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Reviewed-by: Duncan Laurie <dlaurie@chromium.org>
Commit-Queue: Dave Parker <dparker@chromium.org>
Tested-by: Dave Parker <dparker@chromium.org>
Diffstat (limited to 'board')
-rw-r--r-- | board/falco/board.c | 15 | ||||
-rw-r--r-- | board/falco/board.h | 24 | ||||
-rw-r--r-- | board/peppy/board.c | 15 | ||||
-rw-r--r-- | board/peppy/board.h | 22 |
4 files changed, 57 insertions, 19 deletions
diff --git a/board/falco/board.c b/board/falco/board.c index a812e8ea1a..4748cc415b 100644 --- a/board/falco/board.c +++ b/board/falco/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. */ @@ -168,11 +168,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 = { @@ -213,3 +214,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/falco/board.h b/board/falco/board.h index 2dc76d7190..ba9ffcfa59 100644 --- a/board/falco/board.h +++ b/board/falco/board.h @@ -37,6 +37,7 @@ #define CONFIG_POWER_BUTTON #define CONFIG_PWM_FAN #define CONFIG_TEMP_SENSOR +#define CONFIG_TEMP_SENSOR_G781 #define CONFIG_USB_PORT_POWER_DUMB #define CONFIG_WIRELESS @@ -181,24 +182,31 @@ enum adc_channel { /* AC Adapter ID voltage in mV */ ADC_AC_ADAPTER_ID_VOLTAGE, - /* HEY: Falco MB has only one discrete thermal sensor, but it has two - * values (one internal and one external). Both should be here. - */ - ADC_CH_COUNT }; 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 Falco */ /* 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 diff --git a/board/peppy/board.c b/board/peppy/board.c index fb97805ef7..8e7ed2e88c 100644 --- a/board/peppy/board.c +++ b/board/peppy/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/peppy/board.h b/board/peppy/board.h index a999d6f9e4..883e27a44f 100644 --- a/board/peppy/board.h +++ b/board/peppy/board.h @@ -36,6 +36,7 @@ #define CONFIG_POWER_BUTTON #define CONFIG_PWM_FAN #define CONFIG_TEMP_SENSOR +#define CONFIG_TEMP_SENSOR_G781 #define CONFIG_USB_PORT_POWER_DUMB #define CONFIG_WIRELESS @@ -48,7 +49,7 @@ /* I2C ports */ #define I2C_PORT_BATTERY 0 #define I2C_PORT_CHARGER 0 -#define I2C_PORT_THERMAL 2 +#define I2C_PORT_THERMAL 5 /* There are only two I2C ports used because battery and charger share a port */ #define I2C_PORTS_USED 2 @@ -187,16 +188,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 Peppy */ /* 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 |