summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRandall Spangler <rspangler@chromium.org>2012-02-10 16:30:35 -0800
committerDave Parker <dparker@chromium.org>2012-02-13 10:41:34 -0800
commit6b8e8be7033a2808ff4839bc27765bcc5d7e4e63 (patch)
treec3cd58960dd68a5671ff8d61a097dd8335b39449
parent3b02beb41cb82e2b843418afd0b0d46890e3702f (diff)
downloadchrome-ec-6b8e8be7033a2808ff4839bc27765bcc5d7e4e63.tar.gz
Fix discovery and bds builds, which don't have temp sensor or peci
Remove id field from temp_sensor_t struct, since it's only used by the console command (which already knows the id, because it's looping over it). Signed-off-by: Randall Spangler <rspangler@chromium.org> BUG=none TEST='temps' Change-Id: I0970850073d644509cd5501d7ac4421c7373143b
-rw-r--r--board/bds/board_temp_sensor.c4
-rw-r--r--board/link/board.h3
-rw-r--r--board/link/board_temp_sensor.c12
-rw-r--r--chip/lm4/chip_temp_sensor.c4
-rw-r--r--chip/lm4/config.h1
-rw-r--r--chip/lm4/peci.c4
-rw-r--r--common/temp_sensor.c4
-rw-r--r--include/peci.h3
-rw-r--r--include/temp_sensor.h3
9 files changed, 18 insertions, 20 deletions
diff --git a/board/bds/board_temp_sensor.c b/board/bds/board_temp_sensor.c
index 65b73005a1..2efa002cb9 100644
--- a/board/bds/board_temp_sensor.c
+++ b/board/bds/board_temp_sensor.c
@@ -15,8 +15,8 @@
TMP006_ADDR(I2C_PORT_THERMAL, TEMP_CASE_DIE_REG_ADDR)
const struct temp_sensor_t temp_sensors[TEMP_SENSOR_COUNT] = {
- {"ECInternal", TEMP_SENSOR_EC_INTERNAL, TEMP_SENSOR_NO_ADDR,
+ {"ECInternal", TEMP_SENSOR_NO_ADDR,
chip_temp_sensor_read, TEMP_SENSOR_NO_PRINT},
- {"CaseDie", TEMP_SENSOR_CASE_DIE, TEMP_CASE_DIE_ADDR,
+ {"CaseDie", TEMP_CASE_DIE_ADDR,
temp_sensor_tmp006_read_die_temp, temp_sensor_tmp006_print}
};
diff --git a/board/link/board.h b/board/link/board.h
index 69ea870f06..c340f85b85 100644
--- a/board/link/board.h
+++ b/board/link/board.h
@@ -8,6 +8,9 @@
#ifndef __BOARD_H
#define __BOARD_H
+/* Optional features */
+#define CONFIG_PECI
+
/* 66.667 Mhz clock frequency */
#define CPU_CLOCK 66666667
diff --git a/board/link/board_temp_sensor.c b/board/link/board_temp_sensor.c
index 2477e36f34..a8f3fae104 100644
--- a/board/link/board_temp_sensor.c
+++ b/board/link/board_temp_sensor.c
@@ -25,16 +25,16 @@
* temp_sensor_id.
*/
const struct temp_sensor_t temp_sensors[TEMP_SENSOR_COUNT] = {
- {"I2C_CPU", TEMP_SENSOR_I2C_DIE_NEAR_CPU, TEMP_CPU_ADDR,
+ {"I2C_CPU", TEMP_CPU_ADDR,
temp_sensor_tmp006_read_die_temp, temp_sensor_tmp006_print},
- {"I2C_PCH", TEMP_SENSOR_I2C_DIE_NEAR_PCH, TEMP_PCH_ADDR,
+ {"I2C_PCH", TEMP_PCH_ADDR,
temp_sensor_tmp006_read_die_temp, temp_sensor_tmp006_print},
- {"I2C_DDR", TEMP_SENSOR_I2C_DIE_NEAR_DDR, TEMP_DDR_ADDR,
+ {"I2C_DDR", TEMP_DDR_ADDR,
temp_sensor_tmp006_read_die_temp, temp_sensor_tmp006_print},
- {"I2C_Charger", TEMP_SENSOR_I2C_DIE_NEAR_CHARGER, TEMP_CHARGER_ADDR,
+ {"I2C_Charger", TEMP_CHARGER_ADDR,
temp_sensor_tmp006_read_die_temp, temp_sensor_tmp006_print},
- {"ECInternal", TEMP_SENSOR_EC_INTERNAL, TEMP_SENSOR_NO_ADDR,
+ {"ECInternal", TEMP_SENSOR_NO_ADDR,
chip_temp_sensor_read, TEMP_SENSOR_NO_PRINT},
- {"PECI", TEMP_SENSOR_CPU_PECI, TEMP_SENSOR_NO_ADDR,
+ {"PECI", TEMP_SENSOR_NO_ADDR,
peci_temp_sensor_read, TEMP_SENSOR_NO_PRINT},
};
diff --git a/chip/lm4/chip_temp_sensor.c b/chip/lm4/chip_temp_sensor.c
index d810216851..b81d2b5383 100644
--- a/chip/lm4/chip_temp_sensor.c
+++ b/chip/lm4/chip_temp_sensor.c
@@ -11,10 +11,6 @@
int chip_temp_sensor_read(const struct temp_sensor_t* sensor)
{
- /* LM4 only has internal temperature sensor */
- if (sensor->id != TEMP_SENSOR_EC_INTERNAL)
- return EC_ERROR_INVAL;
-
return adc_read_channel(ADC_CH_EC_TEMP);
}
diff --git a/chip/lm4/config.h b/chip/lm4/config.h
index 033810c682..f2224f8226 100644
--- a/chip/lm4/config.h
+++ b/chip/lm4/config.h
@@ -37,7 +37,6 @@
#define CONFIG_PWM
#define CONFIG_TEMP_SENSOR
#define CONFIG_CHARGER
-#define CONFIG_PECI
/* Compile for running from RAM instead of flash */
/* #define COMPILE_FOR_RAM */
diff --git a/chip/lm4/peci.c b/chip/lm4/peci.c
index fc0d09f71d..eb82989be3 100644
--- a/chip/lm4/peci.c
+++ b/chip/lm4/peci.c
@@ -10,6 +10,7 @@
#include "gpio.h"
#include "peci.h"
#include "registers.h"
+#include "temp_sensor.h"
#include "uart.h"
#include "util.h"
@@ -52,9 +53,6 @@ int peci_get_cpu_temp(void)
int peci_temp_sensor_read(const struct temp_sensor_t* sensor)
{
- if (sensor->id != TEMP_SENSOR_CPU_PECI)
- return EC_ERROR_INVAL;
-
return peci_get_cpu_temp();
}
diff --git a/common/temp_sensor.c b/common/temp_sensor.c
index d4285653ed..9a0abbdcbc 100644
--- a/common/temp_sensor.c
+++ b/common/temp_sensor.c
@@ -169,7 +169,7 @@ static int command_temps(int argc, char **argv)
for (i = 0; i < TEMP_SENSOR_COUNT; ++i) {
uart_printf(" Temp from %s: ", temp_sensors[i].name);
- t = temp_sensor_read(temp_sensors[i].id);
+ t = temp_sensor_read(i);
if (t < 0) {
uart_printf("Error.\n\n");
rv = -1;
@@ -185,7 +185,7 @@ static int command_temps(int argc, char **argv)
}
DECLARE_CONSOLE_COMMAND(temps, command_temps);
-static int command_sensor_info(int argc, char ** argv)
+static int command_sensor_info(int argc, char **argv)
{
int i;
int rv;
diff --git a/include/peci.h b/include/peci.h
index 95c9d0efe8..11aead9bb1 100644
--- a/include/peci.h
+++ b/include/peci.h
@@ -9,7 +9,8 @@
#define __CROS_EC_PECI_H
#include "common.h"
-#include "temp_sensor.h"
+
+struct temp_sensor_t;
/* Initializes the module. */
int peci_init(void);
diff --git a/include/temp_sensor.h b/include/temp_sensor.h
index a89dbe7e5a..fb35260e12 100644
--- a/include/temp_sensor.h
+++ b/include/temp_sensor.h
@@ -12,9 +12,10 @@
#include "board.h"
/* "enum temp_sensor_id" must be defined for each board in board.h. */
+enum temp_sensor_id;
+
struct temp_sensor_t {
const char* name;
- enum temp_sensor_id id;
/* Sensor address. Used by read and print functions. */
int addr;
/* Read sensor value and return temperature in K. */