mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2025-12-27 18:25:05 +00:00
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
This commit is contained in:
committed by
Dave Parker
parent
3b02beb41c
commit
6b8e8be703
@@ -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}
|
||||
};
|
||||
|
||||
@@ -8,6 +8,9 @@
|
||||
#ifndef __BOARD_H
|
||||
#define __BOARD_H
|
||||
|
||||
/* Optional features */
|
||||
#define CONFIG_PECI
|
||||
|
||||
/* 66.667 Mhz clock frequency */
|
||||
#define CPU_CLOCK 66666667
|
||||
|
||||
|
||||
@@ -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},
|
||||
};
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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 */
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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. */
|
||||
|
||||
Reference in New Issue
Block a user