diff options
author | Nico Huber <nico.huber@secunet.com> | 2016-09-29 12:33:01 +0200 |
---|---|---|
committer | Nico Huber <nico.h@gmx.de> | 2016-11-17 11:27:38 +0100 |
commit | e34e178ca3f31064e9c4cced4243524d08579007 (patch) | |
tree | b25104e3f9c50c0c7cd84490aed86dc59e2b5d76 /src/superio/ite/common/env_ctrl_chip.h | |
parent | c70cc4d70d1205abe6bc7c06039f2b8443234709 (diff) |
sio/ite/common: Add generic environment-controller driver
The environment-controller entity is shared by many ITE super-i/o
chips. There are some differences between the chips, though. To cover
that, the super-i/o chip should select Kconfig options of this driver
accordingly.
The current implementation isn't exhaustive: It covers only those
parts that are connected on boards I could test, plus those that are
currently used by the IT8772F. The latter could be ported to use this
driver if somebody minds to test it.
Change-Id: I7a40f677f667d103ce1d09a3e468915729067803
Signed-off-by: Nico Huber <nico.huber@secunet.com>
Reviewed-on: https://review.coreboot.org/17284
Tested-by: build bot (Jenkins)
Reviewed-by: Martin Roth <martinroth@google.com>
Diffstat (limited to 'src/superio/ite/common/env_ctrl_chip.h')
-rw-r--r-- | src/superio/ite/common/env_ctrl_chip.h | 100 |
1 files changed, 100 insertions, 0 deletions
diff --git a/src/superio/ite/common/env_ctrl_chip.h b/src/superio/ite/common/env_ctrl_chip.h new file mode 100644 index 0000000000..f01c574d47 --- /dev/null +++ b/src/superio/ite/common/env_ctrl_chip.h @@ -0,0 +1,100 @@ +/* + * This file is part of the coreboot project. + * + * Copyright (C) 2011 The ChromiumOS Authors. All rights reserved. + * Copyright (C) 2016 secunet Security Networks AG + * + * 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 + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#ifndef SUPERIO_ITE_ENV_CTRL_CHIP_H +#define SUPERIO_ITE_ENV_CTRL_CHIP_H + +#define ITE_EC_TMPIN_CNT 3 +#define ITE_EC_FAN_CNT 3 + +/* Supported thermal mode on TMPINx */ +enum ite_ec_thermal_mode { + THERMAL_MODE_DISABLED = 0, + THERMAL_DIODE, + THERMAL_RESISTOR, +}; + +/* Bit mask for voltage pins VINx */ +enum ite_ec_voltage_pin { + VIN0 = 0x01, + VIN1 = 0x02, + VIN2 = 0x04, + VIN3 = 0x08, + VIN4 = 0x10, + VIN5 = 0x20, + VIN6 = 0x40, + VIN7 = 0x80, + VIN_ALL = 0xff +}; + +enum ite_ec_fan_mode { + FAN_IGNORE = 0, + FAN_MODE_ON, + FAN_MODE_OFF, + FAN_SMART_SOFTWARE, + FAN_SMART_AUTOMATIC, +}; + +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 */ +}; + +struct ite_ec_fan_config { + enum ite_ec_fan_mode mode; + struct ite_ec_fan_smartconfig smart; +}; + +struct ite_ec_config { + /* + * Enable external temperature sensor to use PECI GetTemp() + * command and store in register TMPIN 1, 2, or 3. + */ + u8 peci_tmpin; + + /* + * Enable thermal mode on TMPINx. + */ + enum ite_ec_thermal_mode tmpin_mode[ITE_EC_TMPIN_CNT]; + + /* + * Enable reading of voltage pins VINx. + */ + enum ite_ec_voltage_pin vin_mask; + + /* + * Enable a FAN in given mode. + */ + struct ite_ec_fan_config fan[ITE_EC_FAN_CNT]; +}; + +/* Some shorthands for device trees */ +#define TMPIN1 ec.tmpin_mode[0] +#define TMPIN2 ec.tmpin_mode[1] +#define TMPIN3 ec.tmpin_mode[2] +#define FAN1 ec.fan[0] +#define FAN2 ec.fan[1] +#define FAN3 ec.fan[2] + +#endif /* SUPERIO_ITE_ENV_CTRL_CHIP_H */ |