Felix Held | 3f3eca9 | 2020-01-23 17:12:32 +0100 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-or-later */ |
Nico Huber | e34e178 | 2016-09-29 12:33:01 +0200 | [diff] [blame] | 2 | |
| 3 | #ifndef SUPERIO_ITE_ENV_CTRL_CHIP_H |
| 4 | #define SUPERIO_ITE_ENV_CTRL_CHIP_H |
| 5 | |
| 6 | #define ITE_EC_TMPIN_CNT 3 |
Krystian Hebel | 97445f2 | 2019-02-26 11:19:58 +0100 | [diff] [blame] | 7 | |
Julius Werner | cd49cce | 2019-03-05 16:53:33 -0800 | [diff] [blame] | 8 | #if CONFIG(SUPERIO_ITE_ENV_CTRL_5FANS) |
Krystian Hebel | 97445f2 | 2019-02-26 11:19:58 +0100 | [diff] [blame] | 9 | #define ITE_EC_FAN_CNT 5 |
| 10 | #else |
Nico Huber | e34e178 | 2016-09-29 12:33:01 +0200 | [diff] [blame] | 11 | #define ITE_EC_FAN_CNT 3 |
Krystian Hebel | 97445f2 | 2019-02-26 11:19:58 +0100 | [diff] [blame] | 12 | #endif |
Nico Huber | e34e178 | 2016-09-29 12:33:01 +0200 | [diff] [blame] | 13 | |
Joel Linn | 9905d1f | 2024-03-26 18:33:38 +0100 | [diff] [blame^] | 14 | #define ITE_EC_FAN_VECTOR_CNT 2 /* A, B */ |
| 15 | |
Nico Huber | e34e178 | 2016-09-29 12:33:01 +0200 | [diff] [blame] | 16 | /* Supported thermal mode on TMPINx */ |
| 17 | enum ite_ec_thermal_mode { |
| 18 | THERMAL_MODE_DISABLED = 0, |
| 19 | THERMAL_DIODE, |
| 20 | THERMAL_RESISTOR, |
Vagiz Trakhanov | 177f773 | 2017-10-17 18:04:55 +0000 | [diff] [blame] | 21 | THERMAL_PECI, |
Nico Huber | e34e178 | 2016-09-29 12:33:01 +0200 | [diff] [blame] | 22 | }; |
| 23 | |
Vagiz Trakhanov | 17c5771 | 2017-09-28 14:21:54 +0000 | [diff] [blame] | 24 | struct ite_ec_thermal_config { |
| 25 | enum ite_ec_thermal_mode mode; |
| 26 | /* Offset is used for diode sensors and PECI */ |
| 27 | u8 offset; |
Vagiz Trakhanov | cc9c0cb | 2017-09-28 14:25:59 +0000 | [diff] [blame] | 28 | /* Limits */ |
| 29 | u8 min; |
| 30 | u8 max; |
Vagiz Trakhanov | 17c5771 | 2017-09-28 14:21:54 +0000 | [diff] [blame] | 31 | }; |
| 32 | |
Nico Huber | e34e178 | 2016-09-29 12:33:01 +0200 | [diff] [blame] | 33 | /* Bit mask for voltage pins VINx */ |
| 34 | enum ite_ec_voltage_pin { |
| 35 | VIN0 = 0x01, |
| 36 | VIN1 = 0x02, |
| 37 | VIN2 = 0x04, |
| 38 | VIN3 = 0x08, |
| 39 | VIN4 = 0x10, |
| 40 | VIN5 = 0x20, |
| 41 | VIN6 = 0x40, |
| 42 | VIN7 = 0x80, |
| 43 | VIN_ALL = 0xff |
| 44 | }; |
| 45 | |
| 46 | enum ite_ec_fan_mode { |
| 47 | FAN_IGNORE = 0, |
| 48 | FAN_MODE_ON, |
| 49 | FAN_MODE_OFF, |
| 50 | FAN_SMART_SOFTWARE, |
| 51 | FAN_SMART_AUTOMATIC, |
| 52 | }; |
| 53 | |
| 54 | struct ite_ec_fan_smartconfig { |
Michael Büchler | e693b1d | 2020-06-01 23:22:10 +0200 | [diff] [blame] | 55 | u8 tmpin; /* select TMPINx (1, 2 or 3) */ |
| 56 | u8 tmp_off; /* turn fan off below (°C) */ |
| 57 | u8 tmp_start; /* turn fan on above (°C) */ |
| 58 | u8 tmp_full; /* 100% duty cycle above (°C) */ |
| 59 | u8 tmp_delta; /* adapt fan speed when temperature changed by |
| 60 | at least `tmp_delta`°C */ |
| 61 | u8 full_lmt; /* force fan to full PWM at thermal limit */ |
| 62 | u8 smoothing; /* enable smoothing */ |
| 63 | u8 pwm_start; /* start at this duty cycle (%) */ |
| 64 | u8 slope; /* increase duty cycle by `slope`%/°C */ |
Matt DeVillier | 67f80fb | 2020-08-12 10:29:11 -0500 | [diff] [blame] | 65 | u8 clsd_loop; /* tachometer closed-loop mode enable */ |
| 66 | u16 rpm_start; /* start at this RPM (clsd_loop = 1) */ |
Nico Huber | e34e178 | 2016-09-29 12:33:01 +0200 | [diff] [blame] | 67 | }; |
| 68 | |
| 69 | struct ite_ec_fan_config { |
| 70 | enum ite_ec_fan_mode mode; |
| 71 | struct ite_ec_fan_smartconfig smart; |
| 72 | }; |
| 73 | |
Joel Linn | 9905d1f | 2024-03-26 18:33:38 +0100 | [diff] [blame^] | 74 | /* Special fan control modes that will assist smart control */ |
| 75 | struct ite_ec_fan_vector_config { |
| 76 | u8 tmpin; /* select TMPINx (1, 2 or 3) */ |
| 77 | u8 fanout; /* select FANx (1, 2 or 3) */ |
| 78 | u8 tmp_start; |
| 79 | u8 tmp_delta; |
| 80 | u8 tmp_range; /* restrict the range of the vector function, |
| 81 | 0x00 to disable */ |
| 82 | s8 slope; |
| 83 | }; |
| 84 | |
Nico Huber | e34e178 | 2016-09-29 12:33:01 +0200 | [diff] [blame] | 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 | |
Joel Linn | 9905d1f | 2024-03-26 18:33:38 +0100 | [diff] [blame^] | 101 | /* |
| 102 | * Enable special FAN vector control. |
| 103 | */ |
| 104 | struct ite_ec_fan_vector_config fan_vector[ITE_EC_FAN_VECTOR_CNT]; |
| 105 | |
Vagiz Trakhanov | 41aa5ec | 2017-10-23 13:17:44 +0000 | [diff] [blame] | 106 | bool tmpin_beep; |
| 107 | bool fan_beep; |
| 108 | bool vin_beep; |
Michał Żygowski | dcfff37 | 2018-12-31 10:45:19 +0100 | [diff] [blame] | 109 | |
| 110 | /* |
| 111 | * Enable SMBus for external thermal sensor. |
| 112 | */ |
| 113 | bool smbus_en; |
Michael Büchler | a815272 | 2020-08-02 15:38:10 +0200 | [diff] [blame] | 114 | /* |
| 115 | * Select 24 MHz clock for external host instead of an |
| 116 | * internally generated 32 MHz clock. |
| 117 | */ |
| 118 | bool smbus_24mhz; |
Nico Huber | e34e178 | 2016-09-29 12:33:01 +0200 | [diff] [blame] | 119 | }; |
| 120 | |
| 121 | /* Some shorthands for device trees */ |
Vagiz Trakhanov | 17c5771 | 2017-09-28 14:21:54 +0000 | [diff] [blame] | 122 | #define TMPIN1 ec.tmpin[0] |
| 123 | #define TMPIN2 ec.tmpin[1] |
| 124 | #define TMPIN3 ec.tmpin[2] |
| 125 | |
Nico Huber | e34e178 | 2016-09-29 12:33:01 +0200 | [diff] [blame] | 126 | #define FAN1 ec.fan[0] |
| 127 | #define FAN2 ec.fan[1] |
| 128 | #define FAN3 ec.fan[2] |
Krystian Hebel | 97445f2 | 2019-02-26 11:19:58 +0100 | [diff] [blame] | 129 | #define FAN4 ec.fan[3] |
| 130 | #define FAN5 ec.fan[4] |
Nico Huber | e34e178 | 2016-09-29 12:33:01 +0200 | [diff] [blame] | 131 | |
Joel Linn | 9905d1f | 2024-03-26 18:33:38 +0100 | [diff] [blame^] | 132 | #define FAN_VECA ec.fan_vector[0] |
| 133 | #define FAN_VECB ec.fan_vector[1] |
| 134 | |
Nico Huber | e34e178 | 2016-09-29 12:33:01 +0200 | [diff] [blame] | 135 | #endif /* SUPERIO_ITE_ENV_CTRL_CHIP_H */ |