summaryrefslogtreecommitdiff
path: root/src/ec/kontron/it8516e
diff options
context:
space:
mode:
authorNico Huber <nico.huber@secunet.com>2013-07-12 14:35:00 +0200
committerStefan Reinauer <stefan.reinauer@coreboot.org>2013-07-29 23:17:58 +0200
commit6d6a2ac0559a324603d1c323239e2e6e6e58af77 (patch)
tree1eac97946fc6791c3dd668af39591b09c23ca816 /src/ec/kontron/it8516e
parent933b5df6a84d0eaf25b035aef83351f1506c3aa1 (diff)
ec/kontron/it8516e: Add option for external temperature sensor
The IT8516E firmware of Kontron supports some selected external sensors attached to the EC via SMBUS or GPIO16. Change-Id: I4c451c360a393e916430e3bea04a95847455cef7 Signed-off-by: Nico Huber <nico.huber@secunet.com> Reviewed-on: http://review.coreboot.org/3772 Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net> Tested-by: build bot (Jenkins) Reviewed-by: Ronald G. Minnich <rminnich@gmail.com>
Diffstat (limited to 'src/ec/kontron/it8516e')
-rw-r--r--src/ec/kontron/it8516e/chip.h10
-rw-r--r--src/ec/kontron/it8516e/ec.c15
-rw-r--r--src/ec/kontron/it8516e/ec.h11
3 files changed, 33 insertions, 3 deletions
diff --git a/src/ec/kontron/it8516e/chip.h b/src/ec/kontron/it8516e/chip.h
index dddc5e0846..5638efd696 100644
--- a/src/ec/kontron/it8516e/chip.h
+++ b/src/ec/kontron/it8516e/chip.h
@@ -26,10 +26,14 @@
struct ec_kontron_it8516e_config {
/*
- * Per fan settings
- * Can be overwritten by fan1_mode, fan2_mode, fan1_target
- * and fan2_target options
+ * Fan settings (fan1: CPU; fan2: System)
+ * Can be overwritten by
+ * systemp_type,
+ * fan1_mode, fan2_mode,
+ * fan1_target, and fan2_target
+ * nvram options.
*/
+ enum it8516e_systemp_types default_systemp;
enum it8516e_fan_modes default_fan_mode[2];
u16 default_fan_target[2]; /* PWM: % / Speed: RPM / Thermal: °C */
};
diff --git a/src/ec/kontron/it8516e/ec.c b/src/ec/kontron/it8516e/ec.c
index fa7bbc8450..7cf41d95be 100644
--- a/src/ec/kontron/it8516e/ec.c
+++ b/src/ec/kontron/it8516e/ec.c
@@ -30,6 +30,8 @@
typedef struct ec_kontron_it8516e_config config_t;
enum { /* EC commands */
+ IT8516E_CMD_SET_SYSTEMP_TYPE = 0x06,
+ IT8516E_CMD_GET_SYSTEMP_TYPE = 0x07,
IT8516E_CMD_GET_FAN_MODE = 0x10,
IT8516E_CMD_SET_FAN_MODE = 0x11,
IT8516E_CMD_GET_FAN_PWM = 0x12,
@@ -40,6 +42,13 @@ enum { /* EC commands */
IT8516E_CMD_SET_FAN_TEMP = 0x17,
};
+static void it8516e_set_systemp_type(const u8 type)
+{
+ if (send_ec_command(IT8516E_CMD_SET_SYSTEMP_TYPE))
+ return;
+ send_ec_data(type);
+}
+
static void it8516e_set_fan_mode(const u8 idx, const u8 mode)
{
if (send_ec_command(IT8516E_CMD_SET_FAN_MODE))
@@ -138,6 +147,12 @@ static void it8516e_pm2_init(const device_t dev)
ec_set_ports(find_resource(dev, PNP_IDX_IO1)->base,
find_resource(dev, PNP_IDX_IO0)->base);
+ u8 systemp_type = config->default_systemp;
+ get_option(&systemp_type, "systemp_type");
+ if (systemp_type >= IT8516E_SYSTEMP_LASTPLUSONE)
+ systemp_type = IT8516E_SYSTEMP_NONE;
+ it8516e_set_systemp_type(systemp_type);
+
it8516e_set_fan_from_options(config, 0);
it8516e_set_fan_from_options(config, 1);
}
diff --git a/src/ec/kontron/it8516e/ec.h b/src/ec/kontron/it8516e/ec.h
index 5bd2801e20..b1930e1aad 100644
--- a/src/ec/kontron/it8516e/ec.h
+++ b/src/ec/kontron/it8516e/ec.h
@@ -40,4 +40,15 @@ enum it8516e_fan_modes { /* Possible modes of fan control */
IT8516E_MODE_THERMAL = 0x03,
};
+enum it8516e_systemp_types { /* Possible sources of system temperature */
+ IT8516E_SYSTEMP_NONE = 0x00,
+ IT8516E_SYSTEMP_AMD = 0x01,
+ IT8516E_SYSTEMP_LM75_90 = 0x02,
+ IT8516E_SYSTEMP_GPIO16 = 0x03,
+ IT8516E_SYSTEMP_LM75_9e = 0x04,
+
+ /* add any new types above this line. */
+ IT8516E_SYSTEMP_LASTPLUSONE,
+};
+
#endif