summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorVic Yang <victoryang@google.com>2012-03-15 14:55:28 +0800
committerVic Yang <victoryang@google.com>2012-03-16 10:40:52 +0800
commit9f8e8dc6a3461cf0e8e3758db876c7b98c35a92a (patch)
tree02e5ca561dab349f9e74db3a4ecae807a1420888 /include
parent7d1884ee06793b776a8b8af3508e6cb6b7027b3f (diff)
downloadchrome-ec-9f8e8dc6a3461cf0e8e3758db876c7b98c35a92a.tar.gz
Temperature sensor grouping.
Group temperature sensors into different types so we only have to set temperature threshold for each type instead of each sensor. Signed-off-by: Vic Yang <victoryang@google.com> BUG=chrome-os-partner:8466 TEST=Fan control still works. Change-Id: I7acc714c32f282cec490b9e02d402ab91a53becf
Diffstat (limited to 'include')
-rw-r--r--include/lpc_commands.h4
-rw-r--r--include/temp_sensor.h14
-rw-r--r--include/thermal.h5
3 files changed, 19 insertions, 4 deletions
diff --git a/include/lpc_commands.h b/include/lpc_commands.h
index 61e35f009e..9aa22c8603 100644
--- a/include/lpc_commands.h
+++ b/include/lpc_commands.h
@@ -366,7 +366,7 @@ struct lpc_params_pstore_write {
/* Set thershold value */
#define EC_LPC_COMMAND_THERMAL_SET_THRESHOLD 0x50
struct lpc_params_thermal_set_threshold {
- uint8_t sensor_id;
+ uint8_t sensor_type;
uint8_t threshold_id;
uint16_t value;
} __attribute__ ((packed));
@@ -374,7 +374,7 @@ struct lpc_params_thermal_set_threshold {
/* Get threshold value */
#define EC_LPC_COMMAND_THERMAL_GET_THRESHOLD 0x51
struct lpc_params_thermal_get_threshold {
- uint8_t sensor_id;
+ uint8_t sensor_type;
uint8_t threshold_id;
} __attribute__ ((packed));
struct lpc_response_thermal_get_threshold {
diff --git a/include/temp_sensor.h b/include/temp_sensor.h
index f6051824ee..d3ce646a19 100644
--- a/include/temp_sensor.h
+++ b/include/temp_sensor.h
@@ -18,10 +18,24 @@
/* "enum temp_sensor_id" must be defined for each board in board.h. */
enum temp_sensor_id;
+/* Type of temperature sensors. */
+enum temp_sensor_type {
+ /* CPU temperature sensors. */
+ TEMP_SENSOR_TYPE_CPU = 0,
+ /* Other on-board temperature sensors. */
+ TEMP_SENSOR_TYPE_BOARD,
+ /* Case temperature sensors. */
+ TEMP_SENSOR_TYPE_CASE,
+
+ TEMP_SENSOR_TYPE_COUNT
+};
+
struct temp_sensor_t {
const char* name;
/* Flags indicating power needed by temp sensor. */
int8_t power_flags;
+ /* Temperature sensor type. */
+ enum temp_sensor_type type;
/* Read sensor value and return temperature in K. */
int (*read)(int idx);
/* Index among the same kind of sensors. */
diff --git a/include/thermal.h b/include/thermal.h
index a2c26d9d4d..ab606baaa8 100644
--- a/include/thermal.h
+++ b/include/thermal.h
@@ -8,6 +8,7 @@
#ifndef __CROS_EC_THERMAL_H
#define __CROS_EC_THERMAL_H
+#include "temp_sensor.h"
#include "util.h"
#define THERMAL_CONFIG_NO_FLAG 0x0
@@ -46,10 +47,10 @@ struct thermal_config_t {
};
/* Set the threshold temperature value. Return -1 on error. */
-int thermal_set_threshold(int sensor_id, int threshold_id, int value);
+int thermal_set_threshold(enum temp_sensor_type type, int threshold_id, int value);
/* Get the threshold temperature value. Return -1 on error. */
-int thermal_get_threshold(int sensor_id, int threshold_id);
+int thermal_get_threshold(enum temp_sensor_type type, int threshold_id);
/* Toggle automatic fan speed control. Return -1 on error. */
int thermal_toggle_auto_fan_ctrl(int auto_fan_on);