summaryrefslogtreecommitdiff
path: root/src/ec/kontron/it8516e
diff options
context:
space:
mode:
authorNico Huber <nico.huber@secunet.com>2013-07-18 11:27:30 +0200
committerStefan Reinauer <stefan.reinauer@coreboot.org>2013-07-29 23:21:11 +0200
commit260c33ba5619dba58c6e32ba998931325fe8086c (patch)
tree372ed75fa1efd37078c62174d2fefdc785372493 /src/ec/kontron/it8516e
parent8e1a7cc06fa596516dee5e083106f2ef4cd1c39f (diff)
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 <nico.huber@secunet.com> Reviewed-on: http://review.coreboot.org/3785 Tested-by: build bot (Jenkins) Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net> Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
Diffstat (limited to 'src/ec/kontron/it8516e')
-rw-r--r--src/ec/kontron/it8516e/ec.c8
1 files changed, 4 insertions, 4 deletions
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;