xref: /aosp_15_r20/external/coreboot/src/drivers/intel/dptf/chip.h (revision b9411a12aaaa7e1e6a6fb7c5e057f44ee179a49c)
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 
3 #ifndef _DRIVERS_INTEL_DPTF_CHIP_H_
4 #define _DRIVERS_INTEL_DPTF_CHIP_H_
5 
6 #include <acpi/acpigen_dptf.h>
7 #include <timer.h>
8 
9 #define DPTF_PASSIVE(src, tgt, tmp, prd) \
10 	{.source = DPTF_##src, .target = DPTF_##tgt, .temp = (tmp), .period = (prd)}
11 #define DPTF_CRITICAL(src, tmp, typ) \
12 	{.source = DPTF_##src, .temp = (tmp), .type = DPTF_CRITICAL_##typ}
13 #define TEMP_PCT(t, p) {.temp = (t), .fan_pct = (p)}
14 
15 /* Total number of OEM variables */
16 #define DPTF_OEM_VARIABLE_COUNT		6
17 
18 struct drivers_intel_dptf_config {
19 	struct {
20 		struct dptf_active_policy active[DPTF_MAX_ACTIVE_POLICIES];
21 		struct dptf_critical_policy critical[DPTF_MAX_CRITICAL_POLICIES];
22 		struct dptf_passive_policy passive[DPTF_MAX_PASSIVE_POLICIES];
23 	} policies;
24 
25 	struct {
26 		struct dptf_charger_perf charger_perf[DPTF_MAX_CHARGER_PERF_STATES];
27 		struct dptf_fan_perf fan_perf[DPTF_MAX_FAN_PERF_STATES];
28 		struct dptf_multifan_perf
29 			multifan_perf[DPTF_MAX_FAN_PARTICIPANTS][DPTF_MAX_FAN_PERF_STATES];
30 		struct dptf_power_limits power_limits;
31 	} controls;
32 
33 	/* Note that all values in this struct are optional */
34 	struct {
35 		struct {
36 			/* True means _FSL is percentages, False means _FSL is Control values */
37 			bool fine_grained_control;
38 			/*
39 			 * Recommended minimum step size in percentage points to adjust fan
40 			 * speed when utilizing fine-grained control (1-9)
41 			 */
42 			uint8_t step_size;
43 			/*
44 			 * True means the platform will issue a Notify (0x80) to the fan device
45 			 * if a a low fan speed is detected
46 			 */
47 			bool low_speed_notify;
48 		} fan;
49 
50 		/* For multiple TFN fan options */
51 		struct {
52 			bool fine_grained_control;
53 			uint8_t step_size;
54 			bool low_speed_notify;
55 		} multifan_options[DPTF_MAX_FAN_PARTICIPANTS];
56 
57 		struct {
58 			/*
59 			 * The amount of hysteresis implemented in circuitry or in the platform
60 			 * EC's firmware implementation (using the GTSH object)
61 			 */
62 			uint8_t hysteresis;
63 			/* Name applied to TSR (using the _STR object) */
64 			const char *desc;
65 		} tsr[DPTF_MAX_TSR];
66 	} options;
67 
68 	/* OEM variables */
69 	struct {
70 		uint32_t oem_variables[DPTF_OEM_VARIABLE_COUNT];
71 	} oem_data;
72 
73 	/* Rest of platform Power */
74 	uint32_t prop;
75 
76 	/* Device Configuration */
77 	uint32_t dcfg;
78 
79 	bool dptf_multifan_support;
80 };
81 
82 #endif /* _DRIVERS_INTEL_DPTF_CHIP_H_ */
83