diff options
Diffstat (limited to 'board')
-rw-r--r-- | board/link/board.c | 41 | ||||
-rw-r--r-- | board/link/board_temp_sensor.c | 51 | ||||
-rw-r--r-- | board/link/build.mk | 3 |
3 files changed, 42 insertions, 53 deletions
diff --git a/board/link/board.c b/board/link/board.c index 1d0a517412..b40fdd9a6a 100644 --- a/board/link/board.c +++ b/board/link/board.c @@ -5,14 +5,18 @@ /* EC for Link board configuration */ #include "adc.h" +#include "chip_temp_sensor.h" #include "common.h" #include "extpower.h" #include "gpio.h" #include "i2c.h" #include "lid_switch.h" #include "lm4_adc.h" +#include "peci.h" #include "registers.h" #include "switch.h" +#include "temp_sensor.h" +#include "tmp006.h" #include "util.h" #include "x86_power.h" @@ -136,3 +140,40 @@ const struct i2c_port_t i2c_ports[I2C_PORTS_USED] = { {"lightbar", I2C_PORT_LIGHTBAR, 400}, {"thermal", I2C_PORT_THERMAL, 100}, }; + +#define TEMP_PCH_REG_ADDR ((0x41 << 1) | I2C_FLAG_BIG_ENDIAN) +#define TEMP_CHARGER_REG_ADDR ((0x43 << 1) | I2C_FLAG_BIG_ENDIAN) +#define TEMP_USB_REG_ADDR ((0x46 << 1) | I2C_FLAG_BIG_ENDIAN) +#define TEMP_HINGE_REG_ADDR ((0x44 << 1) | I2C_FLAG_BIG_ENDIAN) + +#define TEMP_PCH_ADDR TMP006_ADDR(I2C_PORT_THERMAL, TEMP_PCH_REG_ADDR) +#define TEMP_CHARGER_ADDR TMP006_ADDR(I2C_PORT_THERMAL, TEMP_CHARGER_REG_ADDR) +#define TEMP_USB_ADDR TMP006_ADDR(I2C_PORT_THERMAL, TEMP_USB_REG_ADDR) +#define TEMP_HINGE_ADDR TMP006_ADDR(I2C_PORT_THERMAL, TEMP_HINGE_REG_ADDR) + +/* Temperature sensors data; must be in same order as enum temp_sensor_id. */ +const struct temp_sensor_t temp_sensors[TEMP_SENSOR_COUNT] = { +#ifdef CONFIG_TMP006 + {"I2C-USB C-Die", TEMP_SENSOR_TYPE_IGNORED, tmp006_get_val, 0, 7}, + {"I2C-USB C-Object", TEMP_SENSOR_TYPE_IGNORED, tmp006_get_val, 1, 7}, + {"I2C-PCH D-Die", TEMP_SENSOR_TYPE_BOARD, tmp006_get_val, 2, 7}, + {"I2C-PCH D-Object", TEMP_SENSOR_TYPE_CASE, tmp006_get_val, 3, 7}, + {"I2C-Hinge C-Die", TEMP_SENSOR_TYPE_IGNORED, tmp006_get_val, 4, 7}, + {"I2C-Hinge C-Object", TEMP_SENSOR_TYPE_IGNORED, tmp006_get_val, 5, 7}, + {"I2C-Charger D-Die", TEMP_SENSOR_TYPE_BOARD, tmp006_get_val, 6, 7}, + {"I2C-Charger D-Object", TEMP_SENSOR_TYPE_CASE, tmp006_get_val, 7, 7}, +#endif +#ifdef CONFIG_ADC + {"ECInternal", TEMP_SENSOR_TYPE_BOARD, chip_temp_sensor_get_val, 0, 4}, +#endif +#ifdef CONFIG_PECI + {"PECI", TEMP_SENSOR_TYPE_CPU, peci_temp_sensor_get_val, 0, 2}, +#endif +}; + +const struct tmp006_t tmp006_sensors[TMP006_COUNT] = { + {"USB C", TEMP_USB_ADDR}, + {"PCH D", TEMP_PCH_ADDR}, + {"Hinge C", TEMP_HINGE_ADDR}, + {"Charger D", TEMP_CHARGER_ADDR}, +}; diff --git a/board/link/board_temp_sensor.c b/board/link/board_temp_sensor.c deleted file mode 100644 index 3427461469..0000000000 --- a/board/link/board_temp_sensor.c +++ /dev/null @@ -1,51 +0,0 @@ -/* Copyright (c) 2012 The Chromium OS Authors. All rights reserved. - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -/* Link-specific temp sensor module for Chrome EC */ - -#include "chip_temp_sensor.h" -#include "config.h" -#include "i2c.h" -#include "peci.h" -#include "temp_sensor.h" -#include "tmp006.h" -#include "util.h" - -#define TEMP_PCH_REG_ADDR ((0x41 << 1) | I2C_FLAG_BIG_ENDIAN) -#define TEMP_CHARGER_REG_ADDR ((0x43 << 1) | I2C_FLAG_BIG_ENDIAN) -#define TEMP_USB_REG_ADDR ((0x46 << 1) | I2C_FLAG_BIG_ENDIAN) -#define TEMP_HINGE_REG_ADDR ((0x44 << 1) | I2C_FLAG_BIG_ENDIAN) - -#define TEMP_PCH_ADDR TMP006_ADDR(I2C_PORT_THERMAL, TEMP_PCH_REG_ADDR) -#define TEMP_CHARGER_ADDR TMP006_ADDR(I2C_PORT_THERMAL, TEMP_CHARGER_REG_ADDR) -#define TEMP_USB_ADDR TMP006_ADDR(I2C_PORT_THERMAL, TEMP_USB_REG_ADDR) -#define TEMP_HINGE_ADDR TMP006_ADDR(I2C_PORT_THERMAL, TEMP_HINGE_REG_ADDR) - -/* Temperature sensors data; must be in same order as enum temp_sensor_id. */ -const struct temp_sensor_t temp_sensors[TEMP_SENSOR_COUNT] = { -#ifdef CONFIG_TMP006 - {"I2C-USB C-Die", TEMP_SENSOR_TYPE_IGNORED, tmp006_get_val, 0, 7}, - {"I2C-USB C-Object", TEMP_SENSOR_TYPE_IGNORED, tmp006_get_val, 1, 7}, - {"I2C-PCH D-Die", TEMP_SENSOR_TYPE_BOARD, tmp006_get_val, 2, 7}, - {"I2C-PCH D-Object", TEMP_SENSOR_TYPE_CASE, tmp006_get_val, 3, 7}, - {"I2C-Hinge C-Die", TEMP_SENSOR_TYPE_IGNORED, tmp006_get_val, 4, 7}, - {"I2C-Hinge C-Object", TEMP_SENSOR_TYPE_IGNORED, tmp006_get_val, 5, 7}, - {"I2C-Charger D-Die", TEMP_SENSOR_TYPE_BOARD, tmp006_get_val, 6, 7}, - {"I2C-Charger D-Object", TEMP_SENSOR_TYPE_CASE, tmp006_get_val, 7, 7}, -#endif -#ifdef CONFIG_ADC - {"ECInternal", TEMP_SENSOR_TYPE_BOARD, chip_temp_sensor_get_val, 0, 4}, -#endif -#ifdef CONFIG_PECI - {"PECI", TEMP_SENSOR_TYPE_CPU, peci_temp_sensor_get_val, 0, 2}, -#endif -}; - -const struct tmp006_t tmp006_sensors[TMP006_COUNT] = { - {"USB C", TEMP_USB_ADDR}, - {"PCH D", TEMP_PCH_ADDR}, - {"Hinge C", TEMP_HINGE_ADDR}, - {"Charger D", TEMP_CHARGER_ADDR}, -}; diff --git a/board/link/build.mk b/board/link/build.mk index e22d4573f7..1843369ed4 100644 --- a/board/link/build.mk +++ b/board/link/build.mk @@ -1,5 +1,5 @@ # -*- makefile -*- -# Copyright (c) 2012 The Chromium OS Authors. All rights reserved. +# Copyright (c) 2013 The Chromium OS Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. # @@ -10,4 +10,3 @@ CHIP:=lm4 board-y=board.o -board-y+=board_temp_sensor.o |