Debian Codegraph @

src/drivers/i2c/nct7802y/chip.h

raw symbols SCIP
1 /* SPDX-License-Identifier: GPL-2.0-only */
2
3 #ifndef DRIVERS_I2C_NCT7802Y_CHIP_H
4 #define DRIVERS_I2C_NCT7802Y_CHIP_H
5
6 #include <stdint.h>
7
8 #define NCT7802Y_PECI_CNT 2
9 #define NCT7802Y_FAN_CNT 3
10 #define NCT7802Y_RTD_CNT 3
11
12 /* Remote temperature diode sensors mode */
13 enum nct7802y_rtd_mode {
14 RTD_CLOSED = 0,
15 RTD_CURRENT_MODE,
16 RTD_THERMISTOR_MODE,
17 RTD_VOLTAGE_MODE,
18 };
19
20 enum nct7802y_peci_mode {
21 PECI_DISABLED = 0,
22 PECI_DOMAIN_0,
23 PECI_DOMAIN_1,
24 PECI_HIGHEST,
25 };
26
27 struct nct7802y_peci_config {
28 enum nct7802y_peci_mode mode;
29 u8 base_temp;
30 };
31
32 enum nct7802y_fan_mode {
33 FAN_IGNORE = 0,
34 FAN_MANUAL,
35 FAN_SMART,
36 };
37
38 enum nct7802y_fan_smartmode {
39 SMART_FAN_DUTY = 0, /* Target values given in duty cycle %. */
40 SMART_FAN_RPM, /* Target values given in RPM. */
41 };
42
43 enum nct7802y_fan_speed {
44 FAN_SPEED_NORMAL = 0, /* RPM values <= 12,750. */
45 FAN_SPPED_HIGHSPEED, /* RPM values <= 25,500. */
46 };
47
48 enum nct7802y_fan_pecierror {
49 PECI_ERROR_KEEP = 0, /* Keep current value. */
50 PECI_ERROR_VALUE, /* Use `pecierror_minduty`. */
51 PECI_ERROR_FULLSPEED, /* Run PWM at 100% duty cycle. */
52 };
53
54 enum nct7802y_temp_source {
55 TEMP_SOURCE_REMOTE_1 = 0,
56 TEMP_SOURCE_REMOTE_2,
57 TEMP_SOURCE_REMOTE_3,
58 TEMP_SOURCE_LOCAL,
59 TEMP_SOURCE_PECI_0,
60 TEMP_SOURCE_PECI_1,
61 TEMP_SOURCE_PROGRAMMABLE_0,
62 TEMP_SOURCE_PROGRAMMABLE_1,
63 };
64
65 struct nct7802y_sensors_config {
66 bool local_enable;
67 enum nct7802y_rtd_mode rtd[NCT7802Y_RTD_CNT];
68 };
69
70 struct nct7802y_fan_smartconfig {
71 enum nct7802y_fan_smartmode mode;
72 enum nct7802y_fan_speed speed;
73 enum nct7802y_temp_source tempsrc;
74 struct {
75 u8 temp;
76 u16 target;
77 } table[4];
78 u8 critical_temp;
79 };
80
81 struct nct7802y_fan_config {
82 enum nct7802y_fan_mode mode;
83 union {
84 u8 duty_cycle;
85 struct nct7802y_fan_smartconfig smart;
86 };
87 };
88
89 /* Implements only those parts currently used by coreboot mainboards. */
90 struct drivers_i2c_nct7802y_config {
91 struct nct7802y_peci_config peci[NCT7802Y_PECI_CNT];
92 struct nct7802y_fan_config fan[NCT7802Y_FAN_CNT];
93 struct nct7802y_sensors_config sensors;
94 enum nct7802y_fan_pecierror on_pecierror;
95 u8 pecierror_minduty;
96 };
97
98 #endif /* DRIVERS_I2C_NCT7802Y_CHIP_H */