1 /******************************************************************************
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.
8 * Copyright(c) 2012 - 2013 Intel Corporation. All rights reserved.
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of version 2 of the GNU General Public License as
12 * published by the Free Software Foundation.
14 * This program is distributed in the hope that it will be useful, but
15 * WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110,
24 * The full GNU General Public License is included in this distribution
25 * in the file called COPYING.
27 * Contact Information:
28 * Intel Linux Wireless <ilw@linux.intel.com>
29 * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
33 * Copyright(c) 2012 - 2013 Intel Corporation. All rights reserved.
34 * All rights reserved.
36 * Redistribution and use in source and binary forms, with or without
37 * modification, are permitted provided that the following conditions
40 * * Redistributions of source code must retain the above copyright
41 * notice, this list of conditions and the following disclaimer.
42 * * Redistributions in binary form must reproduce the above copyright
43 * notice, this list of conditions and the following disclaimer in
44 * the documentation and/or other materials provided with the
46 * * Neither the name Intel Corporation nor the names of its
47 * contributors may be used to endorse or promote products derived
48 * from this software without specific prior written permission.
50 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
51 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
52 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
53 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
54 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
55 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
56 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
57 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
58 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
59 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
60 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
62 *****************************************************************************/
64 #ifndef __fw_api_power_h__
65 #define __fw_api_power_h__
67 /* Power Management Commands, Responses, Notifications */
69 /* Radio LP RX Energy Threshold measured in dBm */
70 #define POWER_LPRX_RSSI_THRESHOLD 75
71 #define POWER_LPRX_RSSI_THRESHOLD_MAX 94
72 #define POWER_LPRX_RSSI_THRESHOLD_MIN 30
75 * enum iwl_scan_flags - masks for power table command flags
76 * @POWER_FLAGS_POWER_SAVE_ENA_MSK: '1' Allow to save power by turning off
77 * receiver and transmitter. '0' - does not allow.
78 * @POWER_FLAGS_POWER_MANAGEMENT_ENA_MSK: '0' Driver disables power management,
79 * '1' Driver enables PM (use rest of parameters)
80 * @POWER_FLAGS_SKIP_OVER_DTIM_MSK: '0' PM have to walk up every DTIM,
81 * '1' PM could sleep over DTIM till listen Interval.
82 * @POWER_FLAGS_SNOOZE_ENA_MSK: Enable snoozing only if uAPSD is enabled and all
83 * access categories are both delivery and trigger enabled.
84 * @POWER_FLAGS_BT_SCO_ENA: Enable BT SCO coex only if uAPSD and
85 * PBW Snoozing enabled
86 * @POWER_FLAGS_ADVANCE_PM_ENA_MSK: Advanced PM (uAPSD) enable mask
87 * @POWER_FLAGS_LPRX_ENA_MSK: Low Power RX enable.
89 enum iwl_power_flags {
90 POWER_FLAGS_POWER_SAVE_ENA_MSK = BIT(0),
91 POWER_FLAGS_POWER_MANAGEMENT_ENA_MSK = BIT(1),
92 POWER_FLAGS_SKIP_OVER_DTIM_MSK = BIT(2),
93 POWER_FLAGS_SNOOZE_ENA_MSK = BIT(5),
94 POWER_FLAGS_BT_SCO_ENA = BIT(8),
95 POWER_FLAGS_ADVANCE_PM_ENA_MSK = BIT(9),
96 POWER_FLAGS_LPRX_ENA_MSK = BIT(11),
99 #define IWL_POWER_VEC_SIZE 5
102 * struct iwl_powertable_cmd - legacy power command. Beside old API support this
103 * is used also with a new power API for device wide power settings.
104 * POWER_TABLE_CMD = 0x77 (command, has simple generic response)
106 * @flags: Power table command flags from POWER_FLAGS_*
107 * @keep_alive_seconds: Keep alive period in seconds. Default - 25 sec.
108 * Minimum allowed:- 3 * DTIM. Keep alive period must be
109 * set regardless of power scheme or current power state.
110 * FW use this value also when PM is disabled.
111 * @rx_data_timeout: Minimum time (usec) from last Rx packet for AM to
112 * PSM transition - legacy PM
113 * @tx_data_timeout: Minimum time (usec) from last Tx packet for AM to
114 * PSM transition - legacy PM
115 * @sleep_interval: not in use
116 * @skip_dtim_periods: Number of DTIM periods to skip if Skip over DTIM flag
117 * is set. For example, if it is required to skip over
118 * one DTIM, this value need to be set to 2 (DTIM periods).
119 * @lprx_rssi_threshold: Signal strength up to which LP RX can be enabled.
122 struct iwl_powertable_cmd {
123 /* PM_POWER_TABLE_CMD_API_S_VER_6 */
125 u8 keep_alive_seconds;
127 __le32 rx_data_timeout;
128 __le32 tx_data_timeout;
129 __le32 sleep_interval[IWL_POWER_VEC_SIZE];
130 __le32 skip_dtim_periods;
131 __le32 lprx_rssi_threshold;
135 * enum iwl_device_power_flags - masks for device power command flags
136 * @DEVIC_POWER_FLAGS_POWER_SAVE_ENA_MSK: '1' Allow to save power by turning off
137 * receiver and transmitter. '0' - does not allow. This flag should be
138 * always set to '1' unless one need to disable actual power down for debug
140 * @DEVICE_POWER_FLAGS_CAM_MSK: '1' CAM (Continuous Active Mode) is set, meaning
141 * that power management is disabled. '0' Power management is enabled, one
142 * of power schemes is applied.
144 enum iwl_device_power_flags {
145 DEVICE_POWER_FLAGS_POWER_SAVE_ENA_MSK = BIT(0),
146 DEVICE_POWER_FLAGS_CAM_MSK = BIT(13),
150 * struct iwl_device_power_cmd - device wide power command.
151 * DEVICE_POWER_CMD = 0x77 (command, has simple generic response)
153 * @flags: Power table command flags from DEVICE_POWER_FLAGS_*
155 struct iwl_device_power_cmd {
156 /* PM_POWER_TABLE_CMD_API_S_VER_6 */
162 * struct iwl_mac_power_cmd - New power command containing uAPSD support
163 * MAC_PM_POWER_TABLE = 0xA9 (command, has simple generic response)
164 * @id_and_color: MAC contex identifier
165 * @flags: Power table command flags from POWER_FLAGS_*
166 * @keep_alive_seconds: Keep alive period in seconds. Default - 25 sec.
167 * Minimum allowed:- 3 * DTIM. Keep alive period must be
168 * set regardless of power scheme or current power state.
169 * FW use this value also when PM is disabled.
170 * @rx_data_timeout: Minimum time (usec) from last Rx packet for AM to
171 * PSM transition - legacy PM
172 * @tx_data_timeout: Minimum time (usec) from last Tx packet for AM to
173 * PSM transition - legacy PM
174 * @sleep_interval: not in use
175 * @skip_dtim_periods: Number of DTIM periods to skip if Skip over DTIM flag
176 * is set. For example, if it is required to skip over
177 * one DTIM, this value need to be set to 2 (DTIM periods).
178 * @rx_data_timeout_uapsd: Minimum time (usec) from last Rx packet for AM to
179 * PSM transition - uAPSD
180 * @tx_data_timeout_uapsd: Minimum time (usec) from last Tx packet for AM to
181 * PSM transition - uAPSD
182 * @lprx_rssi_threshold: Signal strength up to which LP RX can be enabled.
184 * @num_skip_dtim: Number of DTIMs to skip if Skip over DTIM flag is set
185 * @snooze_interval: Maximum time between attempts to retrieve buffered data
187 * @snooze_window: A window of time in which PBW snoozing insures that all
188 * packets received. It is also the minimum time from last
189 * received unicast RX packet, before client stops snoozing
192 * @qndp_tid: TID client shall use for uAPSD QNDP triggers
193 * @uapsd_ac_flags: Set trigger-enabled and delivery-enabled indication for
194 * each corresponding AC.
195 * Use IEEE80211_WMM_IE_STA_QOSINFO_AC* for correct values.
196 * @uapsd_max_sp: Use IEEE80211_WMM_IE_STA_QOSINFO_SP_* for correct
198 * @heavy_tx_thld_packets: TX threshold measured in number of packets
199 * @heavy_rx_thld_packets: RX threshold measured in number of packets
200 * @heavy_tx_thld_percentage: TX threshold measured in load's percentage
201 * @heavy_rx_thld_percentage: RX threshold measured in load's percentage
202 * @limited_ps_threshold:
204 struct iwl_mac_power_cmd {
205 /* CONTEXT_DESC_API_T_VER_1 */
208 /* CLIENT_PM_POWER_TABLE_S_VER_1 */
210 __le16 keep_alive_seconds;
211 __le32 rx_data_timeout;
212 __le32 tx_data_timeout;
213 __le32 rx_data_timeout_uapsd;
214 __le32 tx_data_timeout_uapsd;
215 u8 lprx_rssi_threshold;
216 u8 skip_dtim_periods;
217 __le16 snooze_interval;
218 __le16 snooze_window;
223 u8 heavy_tx_thld_packets;
224 u8 heavy_rx_thld_packets;
225 u8 heavy_tx_thld_percentage;
226 u8 heavy_rx_thld_percentage;
227 u8 limited_ps_threshold;
232 * struct iwl_beacon_filter_cmd
233 * REPLY_BEACON_FILTERING_CMD = 0xd2 (command)
234 * @id_and_color: MAC contex identifier
235 * @bf_energy_delta: Used for RSSI filtering, if in 'normal' state. Send beacon
236 * to driver if delta in Energy values calculated for this and last
237 * passed beacon is greater than this threshold. Zero value means that
238 * the Energy change is ignored for beacon filtering, and beacon will
239 * not be forced to be sent to driver regardless of this delta. Typical
241 * @bf_roaming_energy_delta: Used for RSSI filtering, if in 'roaming' state.
242 * Send beacon to driver if delta in Energy values calculated for this
243 * and last passed beacon is greater than this threshold. Zero value
244 * means that the Energy change is ignored for beacon filtering while in
245 * Roaming state, typical energy delta 1dB.
246 * @bf_roaming_state: Used for RSSI filtering. If absolute Energy values
247 * calculated for current beacon is less than the threshold, use
248 * Roaming Energy Delta Threshold, otherwise use normal Energy Delta
249 * Threshold. Typical energy threshold is -72dBm.
250 * @bf_temp_threshold: This threshold determines the type of temperature
251 * filtering (Slow or Fast) that is selected (Units are in Celsuis):
252 * If the current temperature is above this threshold - Fast filter
253 * will be used, If the current temperature is below this threshold -
254 * Slow filter will be used.
255 * @bf_temp_fast_filter: Send Beacon to driver if delta in temperature values
256 * calculated for this and the last passed beacon is greater than this
257 * threshold. Zero value means that the temperature change is ignored for
258 * beacon filtering; beacons will not be forced to be sent to driver
259 * regardless of whether its temerature has been changed.
260 * @bf_temp_slow_filter: Send Beacon to driver if delta in temperature values
261 * calculated for this and the last passed beacon is greater than this
262 * threshold. Zero value means that the temperature change is ignored for
263 * beacon filtering; beacons will not be forced to be sent to driver
264 * regardless of whether its temerature has been changed.
265 * @bf_enable_beacon_filter: 1, beacon filtering is enabled; 0, disabled.
266 * @bf_filter_escape_timer: Send beacons to to driver if no beacons were passed
267 * for a specific period of time. Units: Beacons.
268 * @ba_escape_timer: Fully receive and parse beacon if no beacons were passed
269 * for a longer period of time then this escape-timeout. Units: Beacons.
270 * @ba_enable_beacon_abort: 1, beacon abort is enabled; 0, disabled.
272 struct iwl_beacon_filter_cmd {
273 __le32 bf_energy_delta;
274 __le32 bf_roaming_energy_delta;
275 __le32 bf_roaming_state;
276 __le32 bf_temp_threshold;
277 __le32 bf_temp_fast_filter;
278 __le32 bf_temp_slow_filter;
279 __le32 bf_enable_beacon_filter;
280 __le32 bf_debug_flag;
281 __le32 bf_escape_timer;
282 __le32 ba_escape_timer;
283 __le32 ba_enable_beacon_abort;
286 /* Beacon filtering and beacon abort */
287 #define IWL_BF_ENERGY_DELTA_DEFAULT 5
288 #define IWL_BF_ENERGY_DELTA_MAX 255
289 #define IWL_BF_ENERGY_DELTA_MIN 0
291 #define IWL_BF_ROAMING_ENERGY_DELTA_DEFAULT 1
292 #define IWL_BF_ROAMING_ENERGY_DELTA_MAX 255
293 #define IWL_BF_ROAMING_ENERGY_DELTA_MIN 0
295 #define IWL_BF_ROAMING_STATE_DEFAULT 72
296 #define IWL_BF_ROAMING_STATE_MAX 255
297 #define IWL_BF_ROAMING_STATE_MIN 0
299 #define IWL_BF_TEMP_THRESHOLD_DEFAULT 112
300 #define IWL_BF_TEMP_THRESHOLD_MAX 255
301 #define IWL_BF_TEMP_THRESHOLD_MIN 0
303 #define IWL_BF_TEMP_FAST_FILTER_DEFAULT 1
304 #define IWL_BF_TEMP_FAST_FILTER_MAX 255
305 #define IWL_BF_TEMP_FAST_FILTER_MIN 0
307 #define IWL_BF_TEMP_SLOW_FILTER_DEFAULT 5
308 #define IWL_BF_TEMP_SLOW_FILTER_MAX 255
309 #define IWL_BF_TEMP_SLOW_FILTER_MIN 0
311 #define IWL_BF_ENABLE_BEACON_FILTER_DEFAULT 1
313 #define IWL_BF_DEBUG_FLAG_DEFAULT 0
315 #define IWL_BF_ESCAPE_TIMER_DEFAULT 50
316 #define IWL_BF_ESCAPE_TIMER_MAX 1024
317 #define IWL_BF_ESCAPE_TIMER_MIN 0
319 #define IWL_BA_ESCAPE_TIMER_DEFAULT 6
320 #define IWL_BA_ESCAPE_TIMER_D3 9
321 #define IWL_BA_ESCAPE_TIMER_MAX 1024
322 #define IWL_BA_ESCAPE_TIMER_MIN 0
324 #define IWL_BA_ENABLE_BEACON_ABORT_DEFAULT 1
326 #define IWL_BF_CMD_CONFIG_DEFAULTS \
327 .bf_energy_delta = cpu_to_le32(IWL_BF_ENERGY_DELTA_DEFAULT), \
328 .bf_roaming_energy_delta = \
329 cpu_to_le32(IWL_BF_ROAMING_ENERGY_DELTA_DEFAULT), \
330 .bf_roaming_state = cpu_to_le32(IWL_BF_ROAMING_STATE_DEFAULT), \
331 .bf_temp_threshold = cpu_to_le32(IWL_BF_TEMP_THRESHOLD_DEFAULT), \
332 .bf_temp_fast_filter = cpu_to_le32(IWL_BF_TEMP_FAST_FILTER_DEFAULT), \
333 .bf_temp_slow_filter = cpu_to_le32(IWL_BF_TEMP_SLOW_FILTER_DEFAULT), \
334 .bf_debug_flag = cpu_to_le32(IWL_BF_DEBUG_FLAG_DEFAULT), \
335 .bf_escape_timer = cpu_to_le32(IWL_BF_ESCAPE_TIMER_DEFAULT), \
336 .ba_escape_timer = cpu_to_le32(IWL_BA_ESCAPE_TIMER_DEFAULT)