Basic G781 temp sensor support for Slippy

This lets us read the internal and external values on the
G781 temp sensor.

BUG=chrome-os-partner:21180
BRANCH=slippy
TEST=run ec 'temps' command on Slippy.

Change-Id: Ib3a2a89efd4cfbc4a49696c79daa37bc1880a3ef
Signed-off-by: Dave Parker <dparker@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/62847
Reviewed-by: Randall Spangler <rspangler@chromium.org>
This commit is contained in:
Dave Parker
2013-07-20 00:07:27 -07:00
committed by ChromeBot
parent 46af344b87
commit 0fa59af9d2
2 changed files with 28 additions and 13 deletions

View File

@@ -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);
}

View File

@@ -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