oak: enable tmp432 thermal sensor

This change enables tmp432 thermal sensor. Enter "tmp432"
or "temps" in ec console and get temperature information.

BRANCH=none
BUG=none
TEST=manual
  Enter "tmp432" to get temperature information.
  Connect the battery and enter "temps" to get temperature
  information.

Change-Id: Ie7a9fb4541c5cb3cfa6a26e95f99fe4aacb3a3d3
Signed-off-by: YH Huang <yh.huang@mediatek.com>
Reviewed-on: https://chromium-review.googlesource.com/280956
Reviewed-by: Rong Chang <rongchang@chromium.org>
Reviewed-by: Alec Berg <alecaberg@chromium.org>
This commit is contained in:
YH Huang
2015-06-22 16:55:53 +08:00
committed by ChromeOS Commit Bot
parent 8099b7b384
commit 331db691c4
2 changed files with 47 additions and 0 deletions

View File

@@ -13,6 +13,7 @@
#include "chipset.h"
#include "common.h"
#include "console.h"
#include "driver/temp_sensor/tmp432.h"
#include "extpower.h"
#include "gpio.h"
#include "hooks.h"
@@ -28,6 +29,9 @@
#include "spi.h"
#include "switch.h"
#include "task.h"
#include "temp_sensor.h"
#include "temp_sensor_chip.h"
#include "thermal.h"
#include "timer.h"
#include "usb_pd.h"
#include "usb_pd_tcpm.h"
@@ -132,6 +136,34 @@ struct pi3usb9281_config pi3usb9281_chips[] = {
BUILD_ASSERT(ARRAY_SIZE(pi3usb9281_chips) ==
CONFIG_USB_SWITCH_PI3USB9281_CHIP_COUNT);
/*
* 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, tmp432_get_val,
TMP432_IDX_LOCAL, 4},
{"TMP432_Sensor_1", TEMP_SENSOR_TYPE_BOARD, tmp432_get_val,
TMP432_IDX_REMOTE1, 4},
{"TMP432_Sensor_2", TEMP_SENSOR_TYPE_BOARD, tmp432_get_val,
TMP432_IDX_REMOTE2, 4},
{"Battery", TEMP_SENSOR_TYPE_BATTERY, charge_temp_sensor_get_val,
0, 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}, /* Battery Sensor */
};
BUILD_ASSERT(ARRAY_SIZE(thermal_params) == TEMP_SENSOR_COUNT);
static int discharging_on_ac;
/**

View File

@@ -73,6 +73,8 @@
#define CONFIG_BOARD_VERSION
#undef CONFIG_UART_CONSOLE
#define CONFIG_UART_CONSOLE 1
#define CONFIG_TEMP_SENSOR
#define CONFIG_TEMP_SENSOR_TMP432
/* UART DMA */
#undef CONFIG_UART_TX_DMA
@@ -116,6 +118,7 @@
#define I2C_PORT_BATTERY 0
#define I2C_PORT_CHARGER 0
#define I2C_PORT_PERICOM 0
#define I2C_PORT_THERMAL 0
#define I2C_PORT_PD_MCU 1
#define I2C_PORT_USB_SWITCH 1
#define I2C_PORT_TCPC 1
@@ -146,6 +149,18 @@ enum adc_channel {
ADC_CH_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,
/* Battery temperature sensor */
TEMP_SENSOR_BATTERY,
TEMP_SENSOR_COUNT
};
/* start as a sink in case we have no other power supply/battery */
#define PD_DEFAULT_STATE PD_STATE_SNK_DISCONNECTED