Loading...
1/* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */
2/*
3 * Copyright (C) 2012-2014, 2019-2022 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
10/**
11 * enum iwl_phy_ops_subcmd_ids - PHY group commands
12 */
13enum iwl_phy_ops_subcmd_ids {
14 /**
15 * @CMD_DTS_MEASUREMENT_TRIGGER_WIDE:
16 * Uses either &struct iwl_dts_measurement_cmd or
17 * &struct iwl_ext_dts_measurement_cmd
18 */
19 CMD_DTS_MEASUREMENT_TRIGGER_WIDE = 0x0,
20
21 /**
22 * @CTDP_CONFIG_CMD: &struct iwl_mvm_ctdp_cmd
23 */
24 CTDP_CONFIG_CMD = 0x03,
25
26 /**
27 * @TEMP_REPORTING_THRESHOLDS_CMD: &struct temp_report_ths_cmd
28 */
29 TEMP_REPORTING_THRESHOLDS_CMD = 0x04,
30
31 /**
32 * @PER_CHAIN_LIMIT_OFFSET_CMD: &struct iwl_geo_tx_power_profiles_cmd_v1,
33 * &struct iwl_geo_tx_power_profiles_cmd_v2,
34 * &struct iwl_geo_tx_power_profiles_cmd_v3,
35 * &struct iwl_geo_tx_power_profiles_cmd_v4 or
36 * &struct iwl_geo_tx_power_profiles_cmd_v5
37 */
38 PER_CHAIN_LIMIT_OFFSET_CMD = 0x05,
39
40 /**
41 * @PER_PLATFORM_ANT_GAIN_CMD: &union iwl_ppag_table_cmd
42 */
43 PER_PLATFORM_ANT_GAIN_CMD = 0x07,
44
45 /**
46 * @CT_KILL_NOTIFICATION: &struct ct_kill_notif
47 */
48 CT_KILL_NOTIFICATION = 0xFE,
49
50 /**
51 * @DTS_MEASUREMENT_NOTIF_WIDE:
52 * &struct iwl_dts_measurement_notif_v1 or
53 * &struct iwl_dts_measurement_notif_v2
54 */
55 DTS_MEASUREMENT_NOTIF_WIDE = 0xFF,
56};
57
58/* DTS measurements */
59
60enum iwl_dts_measurement_flags {
61 DTS_TRIGGER_CMD_FLAGS_TEMP = BIT(0),
62 DTS_TRIGGER_CMD_FLAGS_VOLT = BIT(1),
63};
64
65/**
66 * struct iwl_dts_measurement_cmd - request DTS temp and/or voltage measurements
67 *
68 * @flags: indicates which measurements we want as specified in
69 * &enum iwl_dts_measurement_flags
70 */
71struct iwl_dts_measurement_cmd {
72 __le32 flags;
73} __packed; /* TEMPERATURE_MEASUREMENT_TRIGGER_CMD_S */
74
75/**
76* enum iwl_dts_control_measurement_mode - DTS measurement type
77* @DTS_AUTOMATIC: Automatic mode (full SW control). Provide temperature read
78* back (latest value. Not waiting for new value). Use automatic
79* SW DTS configuration.
80* @DTS_REQUEST_READ: Request DTS read. Configure DTS with manual settings,
81* trigger DTS reading and provide read back temperature read
82* when available.
83* @DTS_OVER_WRITE: over-write the DTS temperatures in the SW until next read
84* @DTS_DIRECT_WITHOUT_MEASURE: DTS returns its latest temperature result,
85* without measurement trigger.
86*/
87enum iwl_dts_control_measurement_mode {
88 DTS_AUTOMATIC = 0,
89 DTS_REQUEST_READ = 1,
90 DTS_OVER_WRITE = 2,
91 DTS_DIRECT_WITHOUT_MEASURE = 3,
92};
93
94/**
95* enum iwl_dts_used - DTS to use or used for measurement in the DTS request
96* @DTS_USE_TOP: Top
97* @DTS_USE_CHAIN_A: chain A
98* @DTS_USE_CHAIN_B: chain B
99* @DTS_USE_CHAIN_C: chain C
100* @XTAL_TEMPERATURE: read temperature from xtal
101*/
102enum iwl_dts_used {
103 DTS_USE_TOP = 0,
104 DTS_USE_CHAIN_A = 1,
105 DTS_USE_CHAIN_B = 2,
106 DTS_USE_CHAIN_C = 3,
107 XTAL_TEMPERATURE = 4,
108};
109
110/**
111* enum iwl_dts_bit_mode - bit-mode to use in DTS request read mode
112* @DTS_BIT6_MODE: bit 6 mode
113* @DTS_BIT8_MODE: bit 8 mode
114*/
115enum iwl_dts_bit_mode {
116 DTS_BIT6_MODE = 0,
117 DTS_BIT8_MODE = 1,
118};
119
120/**
121 * struct iwl_ext_dts_measurement_cmd - request extended DTS temp measurements
122 * @control_mode: see &enum iwl_dts_control_measurement_mode
123 * @temperature: used when over write DTS mode is selected
124 * @sensor: set temperature sensor to use. See &enum iwl_dts_used
125 * @avg_factor: average factor to DTS in request DTS read mode
126 * @bit_mode: value defines the DTS bit mode to use. See &enum iwl_dts_bit_mode
127 * @step_duration: step duration for the DTS
128 */
129struct iwl_ext_dts_measurement_cmd {
130 __le32 control_mode;
131 __le32 temperature;
132 __le32 sensor;
133 __le32 avg_factor;
134 __le32 bit_mode;
135 __le32 step_duration;
136} __packed; /* XVT_FW_DTS_CONTROL_MEASUREMENT_REQUEST_API_S */
137
138/**
139 * struct iwl_dts_measurement_notif_v1 - measurements notification
140 *
141 * @temp: the measured temperature
142 * @voltage: the measured voltage
143 */
144struct iwl_dts_measurement_notif_v1 {
145 __le32 temp;
146 __le32 voltage;
147} __packed; /* TEMPERATURE_MEASUREMENT_TRIGGER_NTFY_S_VER_1*/
148
149/**
150 * struct iwl_dts_measurement_notif_v2 - measurements notification
151 *
152 * @temp: the measured temperature
153 * @voltage: the measured voltage
154 * @threshold_idx: the trip index that was crossed
155 */
156struct iwl_dts_measurement_notif_v2 {
157 __le32 temp;
158 __le32 voltage;
159 __le32 threshold_idx;
160} __packed; /* TEMPERATURE_MEASUREMENT_TRIGGER_NTFY_S_VER_2 */
161
162/**
163 * struct iwl_dts_measurement_resp - measurements response
164 *
165 * @temp: the measured temperature
166 */
167struct iwl_dts_measurement_resp {
168 __le32 temp;
169} __packed; /* CMD_DTS_MEASUREMENT_RSP_API_S_VER_1 */
170
171/**
172 * struct ct_kill_notif - CT-kill entry notification
173 * This structure represent both versions of this notification.
174 *
175 * @temperature: the current temperature in celsius
176 * @dts: only in v2: DTS that trigger the CT Kill bitmap:
177 * bit 0: ToP master
178 * bit 1: PA chain A master
179 * bit 2: PA chain B master
180 * bit 3: ToP slave
181 * bit 4: PA chain A slave
182 * bit 5: PA chain B slave)
183 * bits 6,7: reserved (set to 0)
184 * @scheme: only for v2: scheme that trigger the CT Kill (0-SW, 1-HW)
185 */
186struct ct_kill_notif {
187 __le16 temperature;
188 u8 dts;
189 u8 scheme;
190} __packed; /* CT_KILL_NOTIFICATION_API_S_VER_1, CT_KILL_NOTIFICATION_API_S_VER_2 */
191
192/**
193* enum ctdp_cmd_operation - CTDP command operations
194* @CTDP_CMD_OPERATION_START: update the current budget
195* @CTDP_CMD_OPERATION_STOP: stop ctdp
196* @CTDP_CMD_OPERATION_REPORT: get the average budget
197*/
198enum iwl_mvm_ctdp_cmd_operation {
199 CTDP_CMD_OPERATION_START = 0x1,
200 CTDP_CMD_OPERATION_STOP = 0x2,
201 CTDP_CMD_OPERATION_REPORT = 0x4,
202};/* CTDP_CMD_OPERATION_TYPE_E */
203
204/**
205 * struct iwl_mvm_ctdp_cmd - track and manage the FW power consumption budget
206 *
207 * @operation: see &enum iwl_mvm_ctdp_cmd_operation
208 * @budget: the budget in milliwatt
209 * @window_size: defined in API but not used
210 */
211struct iwl_mvm_ctdp_cmd {
212 __le32 operation;
213 __le32 budget;
214 __le32 window_size;
215} __packed;
216
217#define IWL_MAX_DTS_TRIPS 8
218
219/**
220 * struct temp_report_ths_cmd - set temperature thresholds
221 *
222 * @num_temps: number of temperature thresholds passed
223 * @thresholds: array with the thresholds to be configured
224 */
225struct temp_report_ths_cmd {
226 __le32 num_temps;
227 __le16 thresholds[IWL_MAX_DTS_TRIPS];
228} __packed; /* GRP_PHY_TEMP_REPORTING_THRESHOLDS_CMD */
229
230#endif /* __iwl_fw_api_phy_h__ */
1/******************************************************************************
2 *
3 * This file is provided under a dual BSD/GPLv2 license. When using or
4 * redistributing this file, you may do so under either license.
5 *
6 * GPL LICENSE SUMMARY
7 *
8 * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved.
9 * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH
10 * Copyright(c) 2016 - 2017 Intel Deutschland GmbH
11 * Copyright(c) 2019 Intel Corporation
12 *
13 * This program is free software; you can redistribute it and/or modify
14 * it under the terms of version 2 of the GNU General Public License as
15 * published by the Free Software Foundation.
16 *
17 * This program is distributed in the hope that it will be useful, but
18 * WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 * General Public License for more details.
21 *
22 * The full GNU General Public License is included in this distribution
23 * in the file called COPYING.
24 *
25 * Contact Information:
26 * Intel Linux Wireless <linuxwifi@intel.com>
27 * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
28 *
29 * BSD LICENSE
30 *
31 * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved.
32 * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH
33 * Copyright(c) 2016 - 2017 Intel Deutschland GmbH
34 * Copyright(c) 2019 Intel Corporation
35 * All rights reserved.
36 *
37 * Redistribution and use in source and binary forms, with or without
38 * modification, are permitted provided that the following conditions
39 * are met:
40 *
41 * * Redistributions of source code must retain the above copyright
42 * notice, this list of conditions and the following disclaimer.
43 * * Redistributions in binary form must reproduce the above copyright
44 * notice, this list of conditions and the following disclaimer in
45 * the documentation and/or other materials provided with the
46 * distribution.
47 * * Neither the name Intel Corporation nor the names of its
48 * contributors may be used to endorse or promote products derived
49 * from this software without specific prior written permission.
50 *
51 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
52 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
53 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
54 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
55 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
56 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
57 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
58 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
59 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
60 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
61 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
62 *
63 *****************************************************************************/
64
65#ifndef __iwl_fw_api_phy_h__
66#define __iwl_fw_api_phy_h__
67
68/**
69 * enum iwl_phy_ops_subcmd_ids - PHY group commands
70 */
71enum iwl_phy_ops_subcmd_ids {
72 /**
73 * @CMD_DTS_MEASUREMENT_TRIGGER_WIDE:
74 * Uses either &struct iwl_dts_measurement_cmd or
75 * &struct iwl_ext_dts_measurement_cmd
76 */
77 CMD_DTS_MEASUREMENT_TRIGGER_WIDE = 0x0,
78
79 /**
80 * @CTDP_CONFIG_CMD: &struct iwl_mvm_ctdp_cmd
81 */
82 CTDP_CONFIG_CMD = 0x03,
83
84 /**
85 * @TEMP_REPORTING_THRESHOLDS_CMD: &struct temp_report_ths_cmd
86 */
87 TEMP_REPORTING_THRESHOLDS_CMD = 0x04,
88
89 /**
90 * @GEO_TX_POWER_LIMIT: &struct iwl_geo_tx_power_profiles_cmd
91 */
92 GEO_TX_POWER_LIMIT = 0x05,
93
94 /**
95 * @PER_PLATFORM_ANT_GAIN_CMD: &struct iwl_ppag_table_cmd
96 */
97 PER_PLATFORM_ANT_GAIN_CMD = 0x07,
98
99 /**
100 * @CT_KILL_NOTIFICATION: &struct ct_kill_notif
101 */
102 CT_KILL_NOTIFICATION = 0xFE,
103
104 /**
105 * @DTS_MEASUREMENT_NOTIF_WIDE:
106 * &struct iwl_dts_measurement_notif_v1 or
107 * &struct iwl_dts_measurement_notif_v2
108 */
109 DTS_MEASUREMENT_NOTIF_WIDE = 0xFF,
110};
111
112/* DTS measurements */
113
114enum iwl_dts_measurement_flags {
115 DTS_TRIGGER_CMD_FLAGS_TEMP = BIT(0),
116 DTS_TRIGGER_CMD_FLAGS_VOLT = BIT(1),
117};
118
119/**
120 * struct iwl_dts_measurement_cmd - request DTS temp and/or voltage measurements
121 *
122 * @flags: indicates which measurements we want as specified in
123 * &enum iwl_dts_measurement_flags
124 */
125struct iwl_dts_measurement_cmd {
126 __le32 flags;
127} __packed; /* TEMPERATURE_MEASUREMENT_TRIGGER_CMD_S */
128
129/**
130* enum iwl_dts_control_measurement_mode - DTS measurement type
131* @DTS_AUTOMATIC: Automatic mode (full SW control). Provide temperature read
132* back (latest value. Not waiting for new value). Use automatic
133* SW DTS configuration.
134* @DTS_REQUEST_READ: Request DTS read. Configure DTS with manual settings,
135* trigger DTS reading and provide read back temperature read
136* when available.
137* @DTS_OVER_WRITE: over-write the DTS temperatures in the SW until next read
138* @DTS_DIRECT_WITHOUT_MEASURE: DTS returns its latest temperature result,
139* without measurement trigger.
140*/
141enum iwl_dts_control_measurement_mode {
142 DTS_AUTOMATIC = 0,
143 DTS_REQUEST_READ = 1,
144 DTS_OVER_WRITE = 2,
145 DTS_DIRECT_WITHOUT_MEASURE = 3,
146};
147
148/**
149* enum iwl_dts_used - DTS to use or used for measurement in the DTS request
150* @DTS_USE_TOP: Top
151* @DTS_USE_CHAIN_A: chain A
152* @DTS_USE_CHAIN_B: chain B
153* @DTS_USE_CHAIN_C: chain C
154* @XTAL_TEMPERATURE: read temperature from xtal
155*/
156enum iwl_dts_used {
157 DTS_USE_TOP = 0,
158 DTS_USE_CHAIN_A = 1,
159 DTS_USE_CHAIN_B = 2,
160 DTS_USE_CHAIN_C = 3,
161 XTAL_TEMPERATURE = 4,
162};
163
164/**
165* enum iwl_dts_bit_mode - bit-mode to use in DTS request read mode
166* @DTS_BIT6_MODE: bit 6 mode
167* @DTS_BIT8_MODE: bit 8 mode
168*/
169enum iwl_dts_bit_mode {
170 DTS_BIT6_MODE = 0,
171 DTS_BIT8_MODE = 1,
172};
173
174/**
175 * struct iwl_ext_dts_measurement_cmd - request extended DTS temp measurements
176 * @control_mode: see &enum iwl_dts_control_measurement_mode
177 * @temperature: used when over write DTS mode is selected
178 * @sensor: set temperature sensor to use. See &enum iwl_dts_used
179 * @avg_factor: average factor to DTS in request DTS read mode
180 * @bit_mode: value defines the DTS bit mode to use. See &enum iwl_dts_bit_mode
181 * @step_duration: step duration for the DTS
182 */
183struct iwl_ext_dts_measurement_cmd {
184 __le32 control_mode;
185 __le32 temperature;
186 __le32 sensor;
187 __le32 avg_factor;
188 __le32 bit_mode;
189 __le32 step_duration;
190} __packed; /* XVT_FW_DTS_CONTROL_MEASUREMENT_REQUEST_API_S */
191
192/**
193 * struct iwl_dts_measurement_notif_v1 - measurements notification
194 *
195 * @temp: the measured temperature
196 * @voltage: the measured voltage
197 */
198struct iwl_dts_measurement_notif_v1 {
199 __le32 temp;
200 __le32 voltage;
201} __packed; /* TEMPERATURE_MEASUREMENT_TRIGGER_NTFY_S_VER_1*/
202
203/**
204 * struct iwl_dts_measurement_notif_v2 - measurements notification
205 *
206 * @temp: the measured temperature
207 * @voltage: the measured voltage
208 * @threshold_idx: the trip index that was crossed
209 */
210struct iwl_dts_measurement_notif_v2 {
211 __le32 temp;
212 __le32 voltage;
213 __le32 threshold_idx;
214} __packed; /* TEMPERATURE_MEASUREMENT_TRIGGER_NTFY_S_VER_2 */
215
216/**
217 * struct ct_kill_notif - CT-kill entry notification
218 *
219 * @temperature: the current temperature in celsius
220 * @reserved: reserved
221 */
222struct ct_kill_notif {
223 __le16 temperature;
224 __le16 reserved;
225} __packed; /* GRP_PHY_CT_KILL_NTF */
226
227/**
228* enum ctdp_cmd_operation - CTDP command operations
229* @CTDP_CMD_OPERATION_START: update the current budget
230* @CTDP_CMD_OPERATION_STOP: stop ctdp
231* @CTDP_CMD_OPERATION_REPORT: get the average budget
232*/
233enum iwl_mvm_ctdp_cmd_operation {
234 CTDP_CMD_OPERATION_START = 0x1,
235 CTDP_CMD_OPERATION_STOP = 0x2,
236 CTDP_CMD_OPERATION_REPORT = 0x4,
237};/* CTDP_CMD_OPERATION_TYPE_E */
238
239/**
240 * struct iwl_mvm_ctdp_cmd - track and manage the FW power consumption budget
241 *
242 * @operation: see &enum iwl_mvm_ctdp_cmd_operation
243 * @budget: the budget in milliwatt
244 * @window_size: defined in API but not used
245 */
246struct iwl_mvm_ctdp_cmd {
247 __le32 operation;
248 __le32 budget;
249 __le32 window_size;
250} __packed;
251
252#define IWL_MAX_DTS_TRIPS 8
253
254/**
255 * struct temp_report_ths_cmd - set temperature thresholds
256 *
257 * @num_temps: number of temperature thresholds passed
258 * @thresholds: array with the thresholds to be configured
259 */
260struct temp_report_ths_cmd {
261 __le32 num_temps;
262 __le16 thresholds[IWL_MAX_DTS_TRIPS];
263} __packed; /* GRP_PHY_TEMP_REPORTING_THRESHOLDS_CMD */
264
265#endif /* __iwl_fw_api_phy_h__ */