1 /* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */ 2 /* 3 * Copyright (C) 2012-2014, 2019-2022, 2024-2025 Intel Corporation 4 * Copyright (C) 2013-2015 Intel Mobile Communications GmbH 5 * Copyright (C) 2016-2017 Intel Deutschland GmbH 6 */ 7 #ifndef __iwl_fw_api_phy_h__ 8 #define __iwl_fw_api_phy_h__ 9 #include <linux/types.h> 10 #include <linux/bits.h> 11 #if defined(__FreeBSD__) 12 #include <linux/bitops.h> 13 #endif 14 15 /** 16 * enum iwl_phy_ops_subcmd_ids - PHY group commands 17 */ 18 enum iwl_phy_ops_subcmd_ids { 19 /** 20 * @CMD_DTS_MEASUREMENT_TRIGGER_WIDE: 21 * Uses either &struct iwl_dts_measurement_cmd or 22 * &struct iwl_ext_dts_measurement_cmd 23 */ 24 CMD_DTS_MEASUREMENT_TRIGGER_WIDE = 0x0, 25 26 /** 27 * @CTDP_CONFIG_CMD: &struct iwl_ctdp_cmd 28 */ 29 CTDP_CONFIG_CMD = 0x03, 30 31 /** 32 * @TEMP_REPORTING_THRESHOLDS_CMD: &struct temp_report_ths_cmd 33 */ 34 TEMP_REPORTING_THRESHOLDS_CMD = 0x04, 35 36 /** 37 * @PER_CHAIN_LIMIT_OFFSET_CMD: &struct iwl_geo_tx_power_profiles_cmd_v1, 38 * &struct iwl_geo_tx_power_profiles_cmd_v2, 39 * &struct iwl_geo_tx_power_profiles_cmd_v3, 40 * &struct iwl_geo_tx_power_profiles_cmd_v4 or 41 * &struct iwl_geo_tx_power_profiles_cmd_v5 42 */ 43 PER_CHAIN_LIMIT_OFFSET_CMD = 0x05, 44 45 /** 46 * @PER_PLATFORM_ANT_GAIN_CMD: &union iwl_ppag_table_cmd 47 */ 48 PER_PLATFORM_ANT_GAIN_CMD = 0x07, 49 50 /** 51 * @AP_TX_POWER_CONSTRAINTS_CMD: &struct iwl_txpower_constraints_cmd 52 */ 53 AP_TX_POWER_CONSTRAINTS_CMD = 0x0C, 54 55 /** 56 * @CT_KILL_NOTIFICATION: &struct ct_kill_notif 57 */ 58 CT_KILL_NOTIFICATION = 0xFE, 59 60 /** 61 * @DTS_MEASUREMENT_NOTIF_WIDE: 62 * &struct iwl_dts_measurement_notif_v1 or 63 * &struct iwl_dts_measurement_notif 64 */ 65 DTS_MEASUREMENT_NOTIF_WIDE = 0xFF, 66 }; 67 68 /* DTS measurements */ 69 70 enum iwl_dts_measurement_flags { 71 DTS_TRIGGER_CMD_FLAGS_TEMP = BIT(0), 72 DTS_TRIGGER_CMD_FLAGS_VOLT = BIT(1), 73 }; 74 75 /** 76 * struct iwl_dts_measurement_cmd - request DTS temp and/or voltage measurements 77 * 78 * @flags: indicates which measurements we want as specified in 79 * &enum iwl_dts_measurement_flags 80 */ 81 struct iwl_dts_measurement_cmd { 82 __le32 flags; 83 } __packed; /* TEMPERATURE_MEASUREMENT_TRIGGER_CMD_S */ 84 85 /** 86 * enum iwl_dts_control_measurement_mode - DTS measurement type 87 * @DTS_AUTOMATIC: Automatic mode (full SW control). Provide temperature read 88 * back (latest value. Not waiting for new value). Use automatic 89 * SW DTS configuration. 90 * @DTS_REQUEST_READ: Request DTS read. Configure DTS with manual settings, 91 * trigger DTS reading and provide read back temperature read 92 * when available. 93 * @DTS_OVER_WRITE: over-write the DTS temperatures in the SW until next read 94 * @DTS_DIRECT_WITHOUT_MEASURE: DTS returns its latest temperature result, 95 * without measurement trigger. 96 */ 97 enum iwl_dts_control_measurement_mode { 98 DTS_AUTOMATIC = 0, 99 DTS_REQUEST_READ = 1, 100 DTS_OVER_WRITE = 2, 101 DTS_DIRECT_WITHOUT_MEASURE = 3, 102 }; 103 104 /** 105 * enum iwl_dts_used - DTS to use or used for measurement in the DTS request 106 * @DTS_USE_TOP: Top 107 * @DTS_USE_CHAIN_A: chain A 108 * @DTS_USE_CHAIN_B: chain B 109 * @DTS_USE_CHAIN_C: chain C 110 * @XTAL_TEMPERATURE: read temperature from xtal 111 */ 112 enum iwl_dts_used { 113 DTS_USE_TOP = 0, 114 DTS_USE_CHAIN_A = 1, 115 DTS_USE_CHAIN_B = 2, 116 DTS_USE_CHAIN_C = 3, 117 XTAL_TEMPERATURE = 4, 118 }; 119 120 /** 121 * enum iwl_dts_bit_mode - bit-mode to use in DTS request read mode 122 * @DTS_BIT6_MODE: bit 6 mode 123 * @DTS_BIT8_MODE: bit 8 mode 124 */ 125 enum iwl_dts_bit_mode { 126 DTS_BIT6_MODE = 0, 127 DTS_BIT8_MODE = 1, 128 }; 129 130 /** 131 * struct iwl_ext_dts_measurement_cmd - request extended DTS temp measurements 132 * @control_mode: see &enum iwl_dts_control_measurement_mode 133 * @temperature: used when over write DTS mode is selected 134 * @sensor: set temperature sensor to use. See &enum iwl_dts_used 135 * @avg_factor: average factor to DTS in request DTS read mode 136 * @bit_mode: value defines the DTS bit mode to use. See &enum iwl_dts_bit_mode 137 * @step_duration: step duration for the DTS 138 */ 139 struct iwl_ext_dts_measurement_cmd { 140 __le32 control_mode; 141 __le32 temperature; 142 __le32 sensor; 143 __le32 avg_factor; 144 __le32 bit_mode; 145 __le32 step_duration; 146 } __packed; /* XVT_FW_DTS_CONTROL_MEASUREMENT_REQUEST_API_S */ 147 148 /** 149 * struct iwl_dts_measurement_notif_v1 - measurements notification 150 * 151 * @temp: the measured temperature 152 * @voltage: the measured voltage 153 */ 154 struct iwl_dts_measurement_notif_v1 { 155 __le32 temp; 156 __le32 voltage; 157 } __packed; /* TEMPERATURE_MEASUREMENT_TRIGGER_NTFY_S_VER_1*/ 158 159 /** 160 * struct iwl_dts_measurement_notif - measurements notification 161 * 162 * @temp: the measured temperature 163 * @voltage: the measured voltage 164 * @threshold_idx: the trip index that was crossed 165 */ 166 struct iwl_dts_measurement_notif { 167 __le32 temp; 168 __le32 voltage; 169 __le32 threshold_idx; 170 } __packed; /* TEMPERATURE_MEASUREMENT_TRIGGER_NTFY_S_VER_2 */ 171 172 /** 173 * struct iwl_dts_measurement_resp - measurements response 174 * 175 * @temp: the measured temperature 176 */ 177 struct iwl_dts_measurement_resp { 178 __le32 temp; 179 } __packed; /* CMD_DTS_MEASUREMENT_RSP_API_S_VER_1 */ 180 181 /** 182 * struct ct_kill_notif - CT-kill entry notification 183 * This structure represent both versions of this notification. 184 * 185 * @temperature: the current temperature in celsius 186 * @dts: only in v2: DTS that trigger the CT Kill bitmap: 187 * bit 0: ToP master 188 * bit 1: PA chain A master 189 * bit 2: PA chain B master 190 * bit 3: ToP slave 191 * bit 4: PA chain A slave 192 * bit 5: PA chain B slave) 193 * bits 6,7: reserved (set to 0) 194 * @scheme: only for v2: scheme that trigger the CT Kill (0-SW, 1-HW) 195 */ 196 struct ct_kill_notif { 197 __le16 temperature; 198 u8 dts; 199 u8 scheme; 200 } __packed; /* CT_KILL_NOTIFICATION_API_S_VER_1, CT_KILL_NOTIFICATION_API_S_VER_2 */ 201 202 /** 203 * enum iwl_ctdp_cmd_operation - CTDP command operations 204 * @CTDP_CMD_OPERATION_START: update the current budget 205 * @CTDP_CMD_OPERATION_STOP: stop ctdp 206 * @CTDP_CMD_OPERATION_REPORT: get the average budget 207 */ 208 enum iwl_ctdp_cmd_operation { 209 CTDP_CMD_OPERATION_START = 0x1, 210 CTDP_CMD_OPERATION_STOP = 0x2, 211 CTDP_CMD_OPERATION_REPORT = 0x4, 212 };/* CTDP_CMD_OPERATION_TYPE_E */ 213 214 /** 215 * struct iwl_ctdp_cmd - track and manage the FW power consumption budget 216 * 217 * @operation: see &enum iwl_ctdp_cmd_operation 218 * @budget: the budget in milliwatt 219 * @window_size: defined in API but not used 220 */ 221 struct iwl_ctdp_cmd { 222 __le32 operation; 223 __le32 budget; 224 __le32 window_size; 225 } __packed; 226 227 #define IWL_MAX_DTS_TRIPS 8 228 229 /** 230 * struct temp_report_ths_cmd - set temperature thresholds 231 * 232 * @num_temps: number of temperature thresholds passed 233 * @thresholds: array with the thresholds to be configured 234 */ 235 struct temp_report_ths_cmd { 236 __le32 num_temps; 237 __le16 thresholds[IWL_MAX_DTS_TRIPS]; 238 } __packed; /* GRP_PHY_TEMP_REPORTING_THRESHOLDS_CMD */ 239 240 #endif /* __iwl_fw_api_phy_h__ */ 241