<p>Vagiz Tarkhanov has uploaded this change for <strong>review</strong>.</p><p><a href="https://review.coreboot.org/22141">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">superio/ite/common: Add options to enable beeps<br><br>Add device tree options to enable beeps when exceeding temperature,<br>voltage, and fan limits. As of this commit, setting voltage and fan<br>limits is not implemented.<br><br>Change-Id: I57ce622ee4498b75f00e678c2e6d72e499925bce<br>Signed-off-by: Vagiz Trakhanov <rakkin@autistici.org><br>---<br>M src/superio/ite/common/env_ctrl.c<br>M src/superio/ite/common/env_ctrl.h<br>M src/superio/ite/common/env_ctrl_chip.h<br>3 files changed, 36 insertions(+), 3 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://review.coreboot.org:29418/coreboot refs/changes/41/22141/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">diff --git a/src/superio/ite/common/env_ctrl.c b/src/superio/ite/common/env_ctrl.c<br>index 44926bc..b78d250 100644<br>--- a/src/superio/ite/common/env_ctrl.c<br>+++ b/src/superio/ite/common/env_ctrl.c<br>@@ -232,6 +232,32 @@<br> ite_ec_write(base, ITE_EC_FAN_MAIN_CTL, reg);<br> }<br> <br>+static void enable_beeps(const u16 base, const struct ite_ec_config *const conf)<br>+{<br>+ u8 reg;<br>+ reg = 0;<br>+ u8 freq;<br>+ freq = ITE_EC_BEEP_TONE_DIVISOR(10) | ITE_EC_BEEP_FREQ_DIVISOR(10);<br>+<br>+ if (conf->tmpin_beep) {<br>+ reg |= ITE_EC_BEEP_ON_TMP_LIMIT;<br>+ ite_ec_write(base, ITE_EC_BEEP_FREQ_DIV_OF_TMPIN, freq);<br>+ }<br>+ if (conf->fan_beep) {<br>+ reg |= ITE_EC_BEEP_ON_FAN_LIMIT;<br>+ ite_ec_write(base, ITE_EC_BEEP_FREQ_DIV_OF_FAN, freq);<br>+ }<br>+ if (conf->vin_beep) {<br>+ reg |= ITE_EC_BEEP_ON_VIN_LIMIT;<br>+ ite_ec_write(base, ITE_EC_BEEP_FREQ_DIV_OF_VIN, freq);<br>+ }<br>+<br>+ if (reg) {<br>+ reg |= ite_ec_read(base, ITE_EC_BEEP_ENABLE);<br>+ ite_ec_write(base, ITE_EC_BEEP_ENABLE, reg);<br>+ }<br>+}<br>+<br> void ite_ec_init(const u16 base, const struct ite_ec_config *const conf)<br> {<br> size_t i;<br>@@ -254,6 +280,9 @@<br> for (i = 0; i < ITE_EC_FAN_CNT; ++i)<br> enable_fan(base, i + 1, &conf->fan[i]);<br> <br>+ /* Enable beeps if configured */<br>+ enable_beeps(base, conf);<br>+<br> /*<br> * System may get wrong temperature data when SIO is in<br> * busy state. Therefore, check the status and terminate<br>diff --git a/src/superio/ite/common/env_ctrl.h b/src/superio/ite/common/env_ctrl.h<br>index 8ce682e..020f383 100644<br>--- a/src/superio/ite/common/env_ctrl.h<br>+++ b/src/superio/ite/common/env_ctrl.h<br>@@ -114,8 +114,10 @@<br> #define ITE_EC_BEEP_ON_VIN_LIMIT (1 << 1)<br> #define ITE_EC_BEEP_ON_FAN_LIMIT (1 << 0)<br> #define ITE_EC_BEEP_FREQ_DIV_OF_FAN 0x5D<br>-#define ITE_EC_BEEP_FREQ_DIV_OF_VOLT 0x5E<br>-#define ITE_EC_BEEP_FREQ_DIV_OF_TEMP 0x5F<br>+#define ITE_EC_BEEP_FREQ_DIV_OF_VIN 0x5E<br>+#define ITE_EC_BEEP_FREQ_DIV_OF_TMPIN 0x5F<br>+#define ITE_EC_BEEP_TONE_DIVISOR(x) (((x) & 0x0f) << 4)<br>+#define ITE_EC_BEEP_FREQ_DIVISOR(x) (((x) & 0x0f) << 0)<br> <br> #define ITE_EC_FAN_CTL_TEMP_LIMIT_OFF(x) (0x60 + ((x)-1) * 8)<br> #define ITE_EC_FAN_CTL_TEMP_LIMIT_START(x) (0x61 + ((x)-1) * 8)<br>diff --git a/src/superio/ite/common/env_ctrl_chip.h b/src/superio/ite/common/env_ctrl_chip.h<br>index a3c6ae4..f8f2e1e 100644<br>--- a/src/superio/ite/common/env_ctrl_chip.h<br>+++ b/src/superio/ite/common/env_ctrl_chip.h<br>@@ -92,7 +92,9 @@<br> */<br> struct ite_ec_fan_config fan[ITE_EC_FAN_CNT];<br> <br>- /* FIXME: enable beep when exceeding TMPIN, VIN, FAN limits */<br>+ bool tmpin_beep;<br>+ bool fan_beep;<br>+ bool vin_beep;<br> };<br> <br> /* Some shorthands for device trees */<br></pre><p>To view, visit <a href="https://review.coreboot.org/22141">change 22141</a>. To unsubscribe, visit <a href="https://review.coreboot.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://review.coreboot.org/22141"/><meta itemprop="name" content="View Change"/></div></div>
<div style="display:none"> Gerrit-Project: coreboot </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>
<div style="display:none"> Gerrit-Change-Id: I57ce622ee4498b75f00e678c2e6d72e499925bce </div>
<div style="display:none"> Gerrit-Change-Number: 22141 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Vagiz Tarkhanov <rakkin@autistici.org> </div>