Tim Wawrzynczak | 103bd5e | 2020-05-29 13:11:00 -0600 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
| 2 | |
| 3 | #ifndef _DRIVERS_INTEL_DPTF_CHIP_H_ |
| 4 | #define _DRIVERS_INTEL_DPTF_CHIP_H_ |
| 5 | |
Tim Wawrzynczak | c41f7f1 | 2020-05-29 13:56:37 -0600 | [diff] [blame] | 6 | #include <acpi/acpigen_dptf.h> |
Elyes HAOUAS | 3b3d085 | 2021-02-01 10:09:40 +0100 | [diff] [blame] | 7 | #include <timer.h> |
Tim Wawrzynczak | 07ac2ec | 2020-05-29 15:58:19 -0600 | [diff] [blame] | 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)} |
Tim Wawrzynczak | c41f7f1 | 2020-05-29 13:56:37 -0600 | [diff] [blame] | 14 | |
Sumeet R Pawnikar | 3657187 | 2021-05-11 20:05:20 +0530 | [diff] [blame] | 15 | /* Total number of OEM variables */ |
| 16 | #define DPTF_OEM_VARIABLE_COUNT 6 |
| 17 | |
Tim Wawrzynczak | 103bd5e | 2020-05-29 13:11:00 -0600 | [diff] [blame] | 18 | struct drivers_intel_dptf_config { |
Tim Wawrzynczak | c41f7f1 | 2020-05-29 13:56:37 -0600 | [diff] [blame] | 19 | struct { |
| 20 | struct dptf_active_policy active[DPTF_MAX_ACTIVE_POLICIES]; |
Tim Wawrzynczak | 3a9cde9 | 2020-05-29 14:19:15 -0600 | [diff] [blame] | 21 | struct dptf_critical_policy critical[DPTF_MAX_CRITICAL_POLICIES]; |
Tim Wawrzynczak | 7eb1136 | 2020-05-29 14:10:53 -0600 | [diff] [blame] | 22 | struct dptf_passive_policy passive[DPTF_MAX_PASSIVE_POLICIES]; |
Tim Wawrzynczak | c41f7f1 | 2020-05-29 13:56:37 -0600 | [diff] [blame] | 23 | } policies; |
Tim Wawrzynczak | 46f6fcf | 2020-05-29 14:29:53 -0600 | [diff] [blame] | 24 | |
| 25 | struct { |
| 26 | struct dptf_charger_perf charger_perf[DPTF_MAX_CHARGER_PERF_STATES]; |
Tim Wawrzynczak | 2ad8ffe | 2020-05-29 14:39:02 -0600 | [diff] [blame] | 27 | struct dptf_fan_perf fan_perf[DPTF_MAX_FAN_PERF_STATES]; |
Sumeet Pawnikar | 2f7fa55 | 2022-06-08 17:43:36 +0530 | [diff] [blame] | 28 | struct dptf_multifan_perf |
| 29 | multifan_perf[DPTF_MAX_FAN_PARTICIPANTS][DPTF_MAX_FAN_PERF_STATES]; |
Tim Wawrzynczak | bb5c255 | 2020-05-29 14:46:19 -0600 | [diff] [blame] | 30 | struct dptf_power_limits power_limits; |
Tim Wawrzynczak | 46f6fcf | 2020-05-29 14:29:53 -0600 | [diff] [blame] | 31 | } controls; |
Tim Wawrzynczak | e4d8ebc | 2020-05-29 14:58:16 -0600 | [diff] [blame] | 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; |
Sumeet Pawnikar | 2f7fa55 | 2022-06-08 17:43:36 +0530 | [diff] [blame] | 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 | |
Tim Wawrzynczak | e4d8ebc | 2020-05-29 14:58:16 -0600 | [diff] [blame] | 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; |
Sumeet R Pawnikar | 3657187 | 2021-05-11 20:05:20 +0530 | [diff] [blame] | 67 | |
| 68 | /* OEM variables */ |
| 69 | struct { |
| 70 | uint32_t oem_variables[DPTF_OEM_VARIABLE_COUNT]; |
| 71 | } oem_data; |
Varshit B Pandya | 282b3b6 | 2022-04-18 14:50:30 +0530 | [diff] [blame] | 72 | |
| 73 | /* Rest of platform Power */ |
| 74 | uint32_t prop; |
Sumeet Pawnikar | 2f7fa55 | 2022-06-08 17:43:36 +0530 | [diff] [blame] | 75 | |
| 76 | bool dptf_multifan_support; |
Tim Wawrzynczak | 103bd5e | 2020-05-29 13:11:00 -0600 | [diff] [blame] | 77 | }; |
| 78 | |
| 79 | #endif /* _DRIVERS_INTEL_DPTF_CHIP_H_ */ |