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>
This commit is contained in:
parent
8e1a7cc06f
commit
260c33ba56
@ -79,15 +79,15 @@ static void it8516e_set_fan_speed(const u8 idx, const u16 speed)
|
|||||||
send_ec_data(speed >> 8);
|
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))
|
if (send_ec_command(IT8516E_CMD_SET_FAN_TEMP))
|
||||||
return;
|
return;
|
||||||
if (send_ec_data(idx))
|
if (send_ec_data(idx))
|
||||||
return;
|
return;
|
||||||
if (send_ec_data((temp << 6) & 0xff))
|
if (send_ec_data(temp & 0xff))
|
||||||
return;
|
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)
|
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,
|
printk(BIOS_DEBUG,
|
||||||
"Setting it8516e fan%d control to %d C.\n",
|
"Setting it8516e fan%d control to %d C.\n",
|
||||||
fan_idx + 1, fan_target);
|
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_min[3] = '1' + fan_idx;
|
||||||
fanX_max[3] = '1' + fan_idx;
|
fanX_max[3] = '1' + fan_idx;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user