1 /* SPDX-License-Identifier: GPL-2.0-or-later */
3 #ifndef SUPERIO_ITE_ENV_CTRL_CHIP_H
4 #define SUPERIO_ITE_ENV_CTRL_CHIP_H
6 #define ITE_EC_TMPIN_CNT 3
8 #if CONFIG(SUPERIO_ITE_ENV_CTRL_5FANS)
9 #define ITE_EC_FAN_CNT 5
11 #define ITE_EC_FAN_CNT 3
14 #define ITE_EC_FAN_VECTOR_CNT 2 /* A, B */
16 /* Supported thermal mode on TMPINx */
17 enum ite_ec_thermal_mode
{
18 THERMAL_MODE_DISABLED
= 0,
24 struct ite_ec_thermal_config
{
25 enum ite_ec_thermal_mode mode
;
26 /* Offset is used for diode sensors and PECI */
33 /* Bit mask for voltage pins VINx */
34 enum ite_ec_voltage_pin
{
46 enum ite_ec_fan_mode
{
54 struct ite_ec_fan_smartconfig
{
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 */
65 u8 clsd_loop
; /* tachometer closed-loop mode enable */
66 u16 rpm_start
; /* start at this RPM (clsd_loop = 1) */
69 struct ite_ec_fan_config
{
70 enum ite_ec_fan_mode mode
;
71 struct ite_ec_fan_smartconfig smart
;
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) */
80 u8 tmp_range
; /* restrict the range of the vector function,
85 struct ite_ec_config
{
87 * Enable reading of voltage pins VINx.
89 enum ite_ec_voltage_pin vin_mask
;
92 * Enable temperature sensors in given mode.
94 struct ite_ec_thermal_config tmpin
[ITE_EC_TMPIN_CNT
];
97 * Enable a FAN in given mode.
99 struct ite_ec_fan_config fan
[ITE_EC_FAN_CNT
];
102 * Enable special FAN vector control.
104 struct ite_ec_fan_vector_config fan_vector
[ITE_EC_FAN_VECTOR_CNT
];
111 * Enable SMBus for external thermal sensor.
115 * Select 24 MHz clock for external host instead of an
116 * internally generated 32 MHz clock.
121 /* Some shorthands for device trees */
122 #define TMPIN1 ec.tmpin[0]
123 #define TMPIN2 ec.tmpin[1]
124 #define TMPIN3 ec.tmpin[2]
126 #define FAN1 ec.fan[0]
127 #define FAN2 ec.fan[1]
128 #define FAN3 ec.fan[2]
129 #define FAN4 ec.fan[3]
130 #define FAN5 ec.fan[4]
132 #define FAN_VECA ec.fan_vector[0]
133 #define FAN_VECB ec.fan_vector[1]
135 #endif /* SUPERIO_ITE_ENV_CTRL_CHIP_H */