From 260c33ba5619dba58c6e32ba998931325fe8086c Mon Sep 17 00:00:00 2001 From: Nico Huber Date: Thu, 18 Jul 2013 11:27:30 +0200 Subject: ec/kontron/it8516e: Remove some unsafe bit shifting The EC expects the temperature in 64ths degree C. Alter it8516e_set_fan_temperature() to just export this interface and make the calculation more obvious. Change-Id: Ibe241b7909f4c02b30b1e1200a1850d47695a765 Signed-off-by: Nico Huber Reviewed-on: http://review.coreboot.org/3785 Tested-by: build bot (Jenkins) Reviewed-by: Paul Menzel Reviewed-by: Stefan Reinauer --- src/ec/kontron/it8516e/ec.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/ec/kontron/it8516e') diff --git a/src/ec/kontron/it8516e/ec.c b/src/ec/kontron/it8516e/ec.c index d4e6019fd5..858ded5653 100644 --- a/src/ec/kontron/it8516e/ec.c +++ b/src/ec/kontron/it8516e/ec.c @@ -79,15 +79,15 @@ static void it8516e_set_fan_speed(const u8 idx, const u16 speed) send_ec_data(speed >> 8); } -static void it8516e_set_fan_temperature(const u8 idx, const u8 temp) +static void it8516e_set_fan_temperature(const u8 idx, const u16 temp) { if (send_ec_command(IT8516E_CMD_SET_FAN_TEMP)) return; if (send_ec_data(idx)) return; - if (send_ec_data((temp << 6) & 0xff)) + if (send_ec_data(temp & 0xff)) return; - send_ec_data(((temp << 6) >> 8) & 0xff); + send_ec_data(temp >> 8); } static void it8516e_set_fan_limits(const u8 idx, const u8 min, const u8 max) @@ -147,7 +147,7 @@ static void it8516e_set_fan_from_options(const config_t *const config, printk(BIOS_DEBUG, "Setting it8516e fan%d control to %d C.\n", fan_idx + 1, fan_target); - it8516e_set_fan_temperature(fan_idx, fan_target); + it8516e_set_fan_temperature(fan_idx, fan_target * 64); fanX_min[3] = '1' + fan_idx; fanX_max[3] = '1' + fan_idx; -- cgit v1.2.3