From e693b1d549621acfd20aaad876d4d5888ad5ca99 Mon Sep 17 00:00:00 2001 From: Michael Büchler Date: Mon, 1 Jun 2020 23:22:10 +0200 Subject: superio/ite: configure EC for fans to full at thermal limit MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This applies to the automatic fan control mode of the environment controller (EC). Previously the affected bit was always cleared while the default value is 1 according to datasheets. Add a variable that can be set per mainboard in devicetree.cb. In the IT8783E datasheet that bit is marked as reserved. Signed-off-by: Michael Büchler Change-Id: Ie74102ac0d54be33558c161c9c84594d121772b1 Reviewed-on: https://review.coreboot.org/c/coreboot/+/44165 Tested-by: build bot (Jenkins) Reviewed-by: Felix Held --- src/superio/ite/common/env_ctrl.c | 6 +++++- src/superio/ite/common/env_ctrl.h | 1 + src/superio/ite/common/env_ctrl_chip.h | 19 ++++++++++--------- 3 files changed, 16 insertions(+), 10 deletions(-) (limited to 'src/superio/ite') diff --git a/src/superio/ite/common/env_ctrl.c b/src/superio/ite/common/env_ctrl.c index f63bfd3eea..fbf74468b0 100644 --- a/src/superio/ite/common/env_ctrl.c +++ b/src/superio/ite/common/env_ctrl.c @@ -113,6 +113,7 @@ static void fan_smartconfig(const u16 base, const u8 fan, u8 pwm_ctrl; u8 pwm_start = 0; u8 pwm_auto = 0; + u8 delta_temp; if (mode == FAN_SMART_SOFTWARE) { pwm_ctrl = ITE_EC_FAN_CTL_PWM_MODE_SOFTWARE; @@ -145,8 +146,11 @@ static void fan_smartconfig(const u16 base, const u8 fan, /* Full speed above 127°C by default */ pnp_write_hwm5_index(base, ITE_EC_FAN_CTL_TEMP_LIMIT_FULL(fan), conf->tmp_full ? conf->tmp_full : 127); + + delta_temp = ITE_EC_FAN_CTL_DELTA_TEMP_INTRVL(conf->tmp_delta); + delta_temp |= ITE_EC_FAN_CTL_FULL_AT_THRML_LMT(conf->full_lmt); pnp_write_hwm5_index(base, ITE_EC_FAN_CTL_DELTA_TEMP(fan), - ITE_EC_FAN_CTL_DELTA_TEMP_INTRVL(conf->tmp_delta)); + delta_temp); } pnp_write_hwm5_index(base, ITE_EC_FAN_CTL_PWM_CONTROL(fan), pwm_ctrl); diff --git a/src/superio/ite/common/env_ctrl.h b/src/superio/ite/common/env_ctrl.h index e8fb1f5b01..7bce8097f5 100644 --- a/src/superio/ite/common/env_ctrl.h +++ b/src/superio/ite/common/env_ctrl.h @@ -185,6 +185,7 @@ static const u8 ITE_EC_TEMP_ADJUST[] = { 0x56, 0x57, 0x59 }; /* Common for ITE_EC_FAN_CTL_DELTA_TEMP */ #define ITE_EC_FAN_CTL_DELTA_TEMP_INTRVL(c) ((c) & 0x1f) +#define ITE_EC_FAN_CTL_FULL_AT_THRML_LMT(x) (((x) & 0x1) << 6) #define ITE_EC_FAN_CTL_TARGET_ZONE(x) (0x66 + ((x)-1) * 8) #define ITE_EC_FAN_CTL_TARGET_ZONE_MASK 0x0f diff --git a/src/superio/ite/common/env_ctrl_chip.h b/src/superio/ite/common/env_ctrl_chip.h index 6a027b90f1..09577a4d84 100644 --- a/src/superio/ite/common/env_ctrl_chip.h +++ b/src/superio/ite/common/env_ctrl_chip.h @@ -50,15 +50,16 @@ enum ite_ec_fan_mode { }; struct ite_ec_fan_smartconfig { - u8 tmpin; /* select TMPINx (1, 2 or 3) */ - u8 tmp_off; /* turn fan off below (°C) */ - u8 tmp_start; /* turn fan on above (°C) */ - u8 tmp_full; /* 100% duty cycle above (°C) */ - u8 tmp_delta; /* adapt fan speed when temperature - changed by at least `tmp_delta`°C */ - u8 smoothing; /* enable smoothing */ - u8 pwm_start; /* start at this duty cycle (%) */ - u8 slope; /* increase duty cycle by `slope`%/°C */ + u8 tmpin; /* select TMPINx (1, 2 or 3) */ + u8 tmp_off; /* turn fan off below (°C) */ + u8 tmp_start; /* turn fan on above (°C) */ + u8 tmp_full; /* 100% duty cycle above (°C) */ + u8 tmp_delta; /* adapt fan speed when temperature changed by + at least `tmp_delta`°C */ + u8 full_lmt; /* force fan to full PWM at thermal limit */ + u8 smoothing; /* enable smoothing */ + u8 pwm_start; /* start at this duty cycle (%) */ + u8 slope; /* increase duty cycle by `slope`%/°C */ }; struct ite_ec_fan_config { -- cgit v1.2.3