aboutsummaryrefslogtreecommitdiff
path: root/src/superio/ite/common/env_ctrl.c
diff options
context:
space:
mode:
authorKrystian Hebel <krystian.hebel@3mdeb.com>2019-02-26 11:19:58 +0100
committerFelix Held <felix-coreboot@felixheld.de>2019-03-02 19:32:38 +0000
commit97445f20edf9f0cda0ad184b42eed060095ff860 (patch)
treeab4788dace2a5a3fa636e56700967aed833ef52e /src/superio/ite/common/env_ctrl.c
parent65b514c64551b8e7516c2bd66646ebf6eeec379a (diff)
superio/ite/common: add option for enabling 5 FANs
Some ITEs have more than 3 independent FAN controller outputs. As the initial implementation assumed only 3 outputs some registers are not consequently numbered. This change adds macros for accessing those registers. Additionally some chips have SmartGuardian always enabled, without the option for turning it off. For these chips bits that were responsible for ON/OFF control are either reserved or have different meaning. Another Kconfig option is added to disable ON/OFF functionality on platforms that do not support it. Change-Id: Icd60a16b6b5583a3b981bdc220aac472c2a8f40f Signed-off-by: Krystian Hebel <krystian.hebel@3mdeb.com> Reviewed-on: https://review.coreboot.org/c/31616 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Felix Held <felix-coreboot@felixheld.de> Reviewed-by: Nico Huber <nico.h@gmx.de>
Diffstat (limited to 'src/superio/ite/common/env_ctrl.c')
-rw-r--r--src/superio/ite/common/env_ctrl.c38
1 files changed, 27 insertions, 11 deletions
diff --git a/src/superio/ite/common/env_ctrl.c b/src/superio/ite/common/env_ctrl.c
index 92c9bcab3d..f69273e984 100644
--- a/src/superio/ite/common/env_ctrl.c
+++ b/src/superio/ite/common/env_ctrl.c
@@ -3,6 +3,7 @@
*
* Copyright (C) 2011 The ChromiumOS Authors. All rights reserved.
* Copyright (C) 2016 secunet Security Networks AG
+ * Copyright (C) 2019 Protectli
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -191,7 +192,9 @@ static void enable_fan(const u16 base, const u8 fan,
{
u8 reg;
- if (conf->mode == FAN_IGNORE)
+ if (conf->mode == FAN_IGNORE ||
+ (IS_ENABLED(CONFIG_SUPERIO_ITE_ENV_CTRL_NO_ONOFF) &&
+ conf->mode <= FAN_MODE_OFF))
return;
/* FAN_CTL2 might have its own frequency setting */
@@ -220,16 +223,29 @@ static void enable_fan(const u16 base, const u8 fan,
ite_ec_write(base, ITE_EC_FAN_TAC_COUNTER_ENABLE, reg);
}
- reg = ite_ec_read(base, ITE_EC_FAN_MAIN_CTL);
- if (conf->mode >= FAN_MODE_ON)
- reg |= ITE_EC_FAN_MAIN_CTL_TAC_EN(fan);
- else
- reg &= ~ITE_EC_FAN_MAIN_CTL_TAC_EN(fan);
- if (conf->mode >= FAN_SMART_SOFTWARE)
- reg |= ITE_EC_FAN_MAIN_CTL_SMART(fan);
- else
- reg &= ~ITE_EC_FAN_MAIN_CTL_SMART(fan);
- ite_ec_write(base, ITE_EC_FAN_MAIN_CTL, reg);
+ if (IS_ENABLED(CONFIG_SUPERIO_ITE_ENV_CTRL_5FANS) && fan > 3) {
+ reg = ite_ec_read(base, ITE_EC_FAN_SEC_CTL);
+ if (conf->mode >= FAN_MODE_ON)
+ reg |= ITE_EC_FAN_SEC_CTL_TAC_EN(fan);
+ else
+ reg &= ~ITE_EC_FAN_SEC_CTL_TAC_EN(fan);
+ ite_ec_write(base, ITE_EC_FAN_SEC_CTL, reg);
+ } else {
+ reg = ite_ec_read(base, ITE_EC_FAN_MAIN_CTL);
+ if (conf->mode >= FAN_MODE_ON)
+ reg |= ITE_EC_FAN_MAIN_CTL_TAC_EN(fan);
+ else
+ reg &= ~ITE_EC_FAN_MAIN_CTL_TAC_EN(fan);
+
+ /* Some ITEs have SmartGuardian always enabled */
+ if (!IS_ENABLED(CONFIG_SUPERIO_ITE_ENV_CTRL_NO_ONOFF)) {
+ if (conf->mode >= FAN_SMART_SOFTWARE)
+ reg |= ITE_EC_FAN_MAIN_CTL_SMART(fan);
+ else
+ reg &= ~ITE_EC_FAN_MAIN_CTL_SMART(fan);
+ }
+ ite_ec_write(base, ITE_EC_FAN_MAIN_CTL, reg);
+ }
}
static void enable_beeps(const u16 base, const struct ite_ec_config *const conf)