aboutsummaryrefslogtreecommitdiff
path: root/src/superio/ite/common/env_ctrl.c
diff options
context:
space:
mode:
authorVagiz Trakhanov <rakkin@autistici.org>2017-10-23 13:17:44 +0000
committerPatrick Georgi <pgeorgi@google.com>2018-05-04 10:28:30 +0000
commit41aa5ec2d672f84c9e1651654ecd289c9d2b24b2 (patch)
tree6351cf6dde01a0e7be88238000a4c22980a65a82 /src/superio/ite/common/env_ctrl.c
parent8f6ea30597615ecfe12e71b359fe674e25007361 (diff)
superio/ite/common: Add options to enable beeps
Add device tree options to enable beeps when exceeding temperature, voltage, and fan limits. As of this commit, setting voltage and fan limits is not implemented. Change-Id: I57ce622ee4498b75f00e678c2e6d72e499925bce Signed-off-by: Vagiz Trakhanov <rakkin@autistici.org> Reviewed-on: https://review.coreboot.org/22141 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Patrick Georgi <pgeorgi@google.com>
Diffstat (limited to 'src/superio/ite/common/env_ctrl.c')
-rw-r--r--src/superio/ite/common/env_ctrl.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/superio/ite/common/env_ctrl.c b/src/superio/ite/common/env_ctrl.c
index 44926bc3ec..1dc5bb68f5 100644
--- a/src/superio/ite/common/env_ctrl.c
+++ b/src/superio/ite/common/env_ctrl.c
@@ -232,6 +232,30 @@ static void enable_fan(const u16 base, const u8 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)
+{
+ u8 reg = 0;
+ u8 freq = ITE_EC_BEEP_TONE_DIVISOR(10) | ITE_EC_BEEP_FREQ_DIVISOR(10);
+
+ if (conf->tmpin_beep) {
+ reg |= ITE_EC_BEEP_ON_TMP_LIMIT;
+ ite_ec_write(base, ITE_EC_BEEP_FREQ_DIV_OF_TMPIN, freq);
+ }
+ if (conf->fan_beep) {
+ reg |= ITE_EC_BEEP_ON_FAN_LIMIT;
+ ite_ec_write(base, ITE_EC_BEEP_FREQ_DIV_OF_FAN, freq);
+ }
+ if (conf->vin_beep) {
+ reg |= ITE_EC_BEEP_ON_VIN_LIMIT;
+ ite_ec_write(base, ITE_EC_BEEP_FREQ_DIV_OF_VIN, freq);
+ }
+
+ if (reg) {
+ reg |= ite_ec_read(base, ITE_EC_BEEP_ENABLE);
+ ite_ec_write(base, ITE_EC_BEEP_ENABLE, reg);
+ }
+}
+
void ite_ec_init(const u16 base, const struct ite_ec_config *const conf)
{
size_t i;
@@ -254,6 +278,9 @@ void ite_ec_init(const u16 base, const struct ite_ec_config *const conf)
for (i = 0; i < ITE_EC_FAN_CNT; ++i)
enable_fan(base, i + 1, &conf->fan[i]);
+ /* Enable beeps if configured */
+ enable_beeps(base, conf);
+
/*
* System may get wrong temperature data when SIO is in
* busy state. Therefore, check the status and terminate