diff options
author | Vagiz Trakhanov <rakkin@autistici.org> | 2017-09-28 14:21:54 +0000 |
---|---|---|
committer | Martin Roth <martinroth@google.com> | 2017-10-22 02:19:15 +0000 |
commit | 17c577153042b6559bf7a9dca6ae9f644b18d770 (patch) | |
tree | ee9c3c2381a73e6b9c7d36521a1af1c99aa2c6ac /src/superio/ite/common/env_ctrl_chip.h | |
parent | c85890d0d8887462e72837c3ae6dd5b6842a81cb (diff) |
superio/ite/common: Add temperature offset
Add a devicetree option to set temperature adjustment registers
required for thermal diode sensors and PECI. However, this commit does
not have the code needed to make PECI interface actually use these
registers. It only applies to diodes.
As a temporary workaround, one can set both THERMAL_DIODE and peci_tmpin
to the same TMPIN, e.g. TMPIN3.mode="THERMAL_DIODE" and peci_tmpin="3".
PECI, apparently, takes precedence over diode, so the adjustment register
will be set and PECI activated. Or simply use the followup patch, which
makes THERMAL_PECI a mode like THERMAL_DIODE.
I don't have hardware to test THERMAL_DIODE mode, but in case of PECI,
without this patch I had about -60°C on idle. Now, with offset 97,
which was taken from vendor bios, PECI readings became reasonable 35°C.
TEST=Set a temperature offset, then ensure that the value you set is
reflected in /sys/class/hwmon/hwmon*/temp[1-3]_offset
Change-Id: Ibce6809ca86b6c7c0c696676e309665fc57965d4
Signed-off-by: Vagiz Tarkhanov <rakkin@autistici.org>
Reviewed-on: https://review.coreboot.org/21843
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Nico Huber <nico.h@gmx.de>
Diffstat (limited to 'src/superio/ite/common/env_ctrl_chip.h')
-rw-r--r-- | src/superio/ite/common/env_ctrl_chip.h | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/src/superio/ite/common/env_ctrl_chip.h b/src/superio/ite/common/env_ctrl_chip.h index f01c574d47..8eb908e77a 100644 --- a/src/superio/ite/common/env_ctrl_chip.h +++ b/src/superio/ite/common/env_ctrl_chip.h @@ -28,6 +28,12 @@ enum ite_ec_thermal_mode { THERMAL_RESISTOR, }; +struct ite_ec_thermal_config { + enum ite_ec_thermal_mode mode; + /* Offset is used for diode sensors and PECI */ + u8 offset; +}; + /* Bit mask for voltage pins VINx */ enum ite_ec_voltage_pin { VIN0 = 0x01, @@ -74,25 +80,28 @@ struct ite_ec_config { u8 peci_tmpin; /* - * Enable thermal mode on TMPINx. + * Enable reading of voltage pins VINx. */ - enum ite_ec_thermal_mode tmpin_mode[ITE_EC_TMPIN_CNT]; + enum ite_ec_voltage_pin vin_mask; /* - * Enable reading of voltage pins VINx. + * Enable temperature sensors in given mode. */ - enum ite_ec_voltage_pin vin_mask; + struct ite_ec_thermal_config tmpin[ITE_EC_TMPIN_CNT]; /* * Enable a FAN in given mode. */ struct ite_ec_fan_config fan[ITE_EC_FAN_CNT]; + + /* FIXME: enable beep when exceeding TMPIN, VIN, FAN limits */ }; /* Some shorthands for device trees */ -#define TMPIN1 ec.tmpin_mode[0] -#define TMPIN2 ec.tmpin_mode[1] -#define TMPIN3 ec.tmpin_mode[2] +#define TMPIN1 ec.tmpin[0] +#define TMPIN2 ec.tmpin[1] +#define TMPIN3 ec.tmpin[2] + #define FAN1 ec.fan[0] #define FAN2 ec.fan[1] #define FAN3 ec.fan[2] |