Nico Huber | e34e178 | 2016-09-29 12:33:01 +0200 | [diff] [blame] | 1 | /* |
| 2 | * This file is part of the coreboot project. |
| 3 | * |
| 4 | * Copyright (C) 2011 The ChromiumOS Authors. All rights reserved. |
| 5 | * Copyright (C) 2016 secunet Security Networks AG |
Krystian Hebel | 97445f2 | 2019-02-26 11:19:58 +0100 | [diff] [blame] | 6 | * Copyright (C) 2019 Protectli |
Nico Huber | e34e178 | 2016-09-29 12:33:01 +0200 | [diff] [blame] | 7 | * |
| 8 | * This program is free software; you can redistribute it and/or modify |
| 9 | * it under the terms of the GNU General Public License as published by |
| 10 | * the Free Software Foundation; either version 2 of the License, or |
| 11 | * (at your option) any later version. |
| 12 | * |
| 13 | * This program is distributed in the hope that it will be useful, |
| 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 16 | * GNU General Public License for more details. |
| 17 | */ |
| 18 | |
| 19 | #ifndef SUPERIO_ITE_ENV_CTRL_CHIP_H |
| 20 | #define SUPERIO_ITE_ENV_CTRL_CHIP_H |
| 21 | |
| 22 | #define ITE_EC_TMPIN_CNT 3 |
Krystian Hebel | 97445f2 | 2019-02-26 11:19:58 +0100 | [diff] [blame] | 23 | |
Julius Werner | cd49cce | 2019-03-05 16:53:33 -0800 | [diff] [blame] | 24 | #if CONFIG(SUPERIO_ITE_ENV_CTRL_5FANS) |
Krystian Hebel | 97445f2 | 2019-02-26 11:19:58 +0100 | [diff] [blame] | 25 | #define ITE_EC_FAN_CNT 5 |
| 26 | #else |
Nico Huber | e34e178 | 2016-09-29 12:33:01 +0200 | [diff] [blame] | 27 | #define ITE_EC_FAN_CNT 3 |
Krystian Hebel | 97445f2 | 2019-02-26 11:19:58 +0100 | [diff] [blame] | 28 | #endif |
Nico Huber | e34e178 | 2016-09-29 12:33:01 +0200 | [diff] [blame] | 29 | |
| 30 | /* Supported thermal mode on TMPINx */ |
| 31 | enum ite_ec_thermal_mode { |
| 32 | THERMAL_MODE_DISABLED = 0, |
| 33 | THERMAL_DIODE, |
| 34 | THERMAL_RESISTOR, |
Vagiz Trakhanov | 177f773 | 2017-10-17 18:04:55 +0000 | [diff] [blame] | 35 | THERMAL_PECI, |
Nico Huber | e34e178 | 2016-09-29 12:33:01 +0200 | [diff] [blame] | 36 | }; |
| 37 | |
Vagiz Trakhanov | 17c5771 | 2017-09-28 14:21:54 +0000 | [diff] [blame] | 38 | struct ite_ec_thermal_config { |
| 39 | enum ite_ec_thermal_mode mode; |
| 40 | /* Offset is used for diode sensors and PECI */ |
| 41 | u8 offset; |
Vagiz Trakhanov | cc9c0cb | 2017-09-28 14:25:59 +0000 | [diff] [blame] | 42 | /* Limits */ |
| 43 | u8 min; |
| 44 | u8 max; |
Vagiz Trakhanov | 17c5771 | 2017-09-28 14:21:54 +0000 | [diff] [blame] | 45 | }; |
| 46 | |
Nico Huber | e34e178 | 2016-09-29 12:33:01 +0200 | [diff] [blame] | 47 | /* Bit mask for voltage pins VINx */ |
| 48 | enum ite_ec_voltage_pin { |
| 49 | VIN0 = 0x01, |
| 50 | VIN1 = 0x02, |
| 51 | VIN2 = 0x04, |
| 52 | VIN3 = 0x08, |
| 53 | VIN4 = 0x10, |
| 54 | VIN5 = 0x20, |
| 55 | VIN6 = 0x40, |
| 56 | VIN7 = 0x80, |
| 57 | VIN_ALL = 0xff |
| 58 | }; |
| 59 | |
| 60 | enum ite_ec_fan_mode { |
| 61 | FAN_IGNORE = 0, |
| 62 | FAN_MODE_ON, |
| 63 | FAN_MODE_OFF, |
| 64 | FAN_SMART_SOFTWARE, |
| 65 | FAN_SMART_AUTOMATIC, |
| 66 | }; |
| 67 | |
| 68 | struct ite_ec_fan_smartconfig { |
| 69 | u8 tmpin; /* select TMPINx (1, 2 or 3) */ |
| 70 | u8 tmp_off; /* turn fan off below (°C) */ |
| 71 | u8 tmp_start; /* turn fan on above (°C) */ |
| 72 | u8 tmp_full; /* 100% duty cycle above (°C) */ |
| 73 | u8 tmp_delta; /* adapt fan speed when temperature |
| 74 | changed by at least `tmp_delta`°C */ |
| 75 | u8 smoothing; /* enable smoothing */ |
| 76 | u8 pwm_start; /* start at this duty cycle (%) */ |
| 77 | u8 slope; /* increase duty cycle by `slope`%/°C */ |
| 78 | }; |
| 79 | |
| 80 | struct ite_ec_fan_config { |
| 81 | enum ite_ec_fan_mode mode; |
| 82 | struct ite_ec_fan_smartconfig smart; |
| 83 | }; |
| 84 | |
| 85 | struct ite_ec_config { |
| 86 | /* |
Nico Huber | e34e178 | 2016-09-29 12:33:01 +0200 | [diff] [blame] | 87 | * Enable reading of voltage pins VINx. |
| 88 | */ |
| 89 | enum ite_ec_voltage_pin vin_mask; |
| 90 | |
| 91 | /* |
Vagiz Trakhanov | 17c5771 | 2017-09-28 14:21:54 +0000 | [diff] [blame] | 92 | * Enable temperature sensors in given mode. |
| 93 | */ |
| 94 | struct ite_ec_thermal_config tmpin[ITE_EC_TMPIN_CNT]; |
| 95 | |
| 96 | /* |
Nico Huber | e34e178 | 2016-09-29 12:33:01 +0200 | [diff] [blame] | 97 | * Enable a FAN in given mode. |
| 98 | */ |
| 99 | struct ite_ec_fan_config fan[ITE_EC_FAN_CNT]; |
Vagiz Trakhanov | 17c5771 | 2017-09-28 14:21:54 +0000 | [diff] [blame] | 100 | |
Vagiz Trakhanov | 41aa5ec | 2017-10-23 13:17:44 +0000 | [diff] [blame] | 101 | bool tmpin_beep; |
| 102 | bool fan_beep; |
| 103 | bool vin_beep; |
Michał Żygowski | dcfff37 | 2018-12-31 10:45:19 +0100 | [diff] [blame] | 104 | |
| 105 | /* |
| 106 | * Enable SMBus for external thermal sensor. |
| 107 | */ |
| 108 | bool smbus_en; |
Nico Huber | e34e178 | 2016-09-29 12:33:01 +0200 | [diff] [blame] | 109 | }; |
| 110 | |
| 111 | /* Some shorthands for device trees */ |
Vagiz Trakhanov | 17c5771 | 2017-09-28 14:21:54 +0000 | [diff] [blame] | 112 | #define TMPIN1 ec.tmpin[0] |
| 113 | #define TMPIN2 ec.tmpin[1] |
| 114 | #define TMPIN3 ec.tmpin[2] |
| 115 | |
Nico Huber | e34e178 | 2016-09-29 12:33:01 +0200 | [diff] [blame] | 116 | #define FAN1 ec.fan[0] |
| 117 | #define FAN2 ec.fan[1] |
| 118 | #define FAN3 ec.fan[2] |
Krystian Hebel | 97445f2 | 2019-02-26 11:19:58 +0100 | [diff] [blame] | 119 | #define FAN4 ec.fan[3] |
| 120 | #define FAN5 ec.fan[4] |
Nico Huber | e34e178 | 2016-09-29 12:33:01 +0200 | [diff] [blame] | 121 | |
| 122 | #endif /* SUPERIO_ITE_ENV_CTRL_CHIP_H */ |