summaryrefslogtreecommitdiff
path: root/src/drivers/intel/dptf/chip.h
blob: 7f931824f8f25fb8730731cdaac4a57627c5a317 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
/* SPDX-License-Identifier: GPL-2.0-only */

#ifndef _DRIVERS_INTEL_DPTF_CHIP_H_
#define _DRIVERS_INTEL_DPTF_CHIP_H_

#include <acpi/acpigen_dptf.h>
#include <timer.h>

#define DPTF_PASSIVE(src, tgt, tmp, prd) \
	{.source = DPTF_##src, .target = DPTF_##tgt, .temp = (tmp), .period = (prd)}
#define DPTF_CRITICAL(src, tmp, typ) \
	{.source = DPTF_##src, .temp = (tmp), .type = DPTF_CRITICAL_##typ}
#define TEMP_PCT(t, p) {.temp = (t), .fan_pct = (p)}

/* Total number of OEM variables */
#define DPTF_OEM_VARIABLE_COUNT		6

struct drivers_intel_dptf_config {
	struct {
		struct dptf_active_policy active[DPTF_MAX_ACTIVE_POLICIES];
		struct dptf_critical_policy critical[DPTF_MAX_CRITICAL_POLICIES];
		struct dptf_passive_policy passive[DPTF_MAX_PASSIVE_POLICIES];
	} policies;

	struct {
		struct dptf_charger_perf charger_perf[DPTF_MAX_CHARGER_PERF_STATES];
		struct dptf_fan_perf fan_perf[DPTF_MAX_FAN_PERF_STATES];
		struct dptf_multifan_perf
			multifan_perf[DPTF_MAX_FAN_PARTICIPANTS][DPTF_MAX_FAN_PERF_STATES];
		struct dptf_power_limits power_limits;
	} controls;

	/* Note that all values in this struct are optional */
	struct {
		struct {
			/* True means _FSL is percentages, False means _FSL is Control values */
			bool fine_grained_control;
			/*
			 * Recommended minimum step size in percentage points to adjust fan
			 * speed when utilizing fine-grained control (1-9)
			 */
			uint8_t step_size;
			/*
			 * True means the platform will issue a Notify (0x80) to the fan device
			 * if a a low fan speed is detected
			 */
			bool low_speed_notify;
		} fan;

		/* For multiple TFN fan options */
		struct {
			bool fine_grained_control;
			uint8_t step_size;
			bool low_speed_notify;
		} multifan_options[DPTF_MAX_FAN_PARTICIPANTS];

		struct {
			/*
			 * The amount of hysteresis implemented in circuitry or in the platform
			 * EC's firmware implementation (using the GTSH object)
			 */
			uint8_t hysteresis;
			/* Name applied to TSR (using the _STR object) */
			const char *desc;
		} tsr[DPTF_MAX_TSR];
	} options;

	/* OEM variables */
	struct {
		uint32_t oem_variables[DPTF_OEM_VARIABLE_COUNT];
	} oem_data;

	/* Rest of platform Power */
	uint32_t prop;

	/* Device Configuration */
	uint32_t dcfg;

	bool dptf_multifan_support;
};

#endif /* _DRIVERS_INTEL_DPTF_CHIP_H_ */