fw-api-power.h 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311
  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 - 2013 Intel Corporation. All rights reserved.
  9. *
  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.
  13. *
  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.
  18. *
  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,
  22. * USA
  23. *
  24. * The full GNU General Public License is included in this distribution
  25. * in the file called COPYING.
  26. *
  27. * Contact Information:
  28. * Intel Linux Wireless <ilw@linux.intel.com>
  29. * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
  30. *
  31. * BSD LICENSE
  32. *
  33. * Copyright(c) 2012 - 2013 Intel Corporation. All rights reserved.
  34. * All rights reserved.
  35. *
  36. * Redistribution and use in source and binary forms, with or without
  37. * modification, are permitted provided that the following conditions
  38. * are met:
  39. *
  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
  45. * distribution.
  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.
  49. *
  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.
  61. *
  62. *****************************************************************************/
  63. #ifndef __fw_api_power_h__
  64. #define __fw_api_power_h__
  65. /* Power Management Commands, Responses, Notifications */
  66. /* Radio LP RX Energy Threshold measured in dBm */
  67. #define POWER_LPRX_RSSI_THRESHOLD 75
  68. #define POWER_LPRX_RSSI_THRESHOLD_MAX 94
  69. #define POWER_LPRX_RSSI_THRESHOLD_MIN 30
  70. /**
  71. * enum iwl_scan_flags - masks for power table command flags
  72. * @POWER_FLAGS_POWER_SAVE_ENA_MSK: '1' Allow to save power by turning off
  73. * receiver and transmitter. '0' - does not allow.
  74. * @POWER_FLAGS_POWER_MANAGEMENT_ENA_MSK: '0' Driver disables power management,
  75. * '1' Driver enables PM (use rest of parameters)
  76. * @POWER_FLAGS_SKIP_OVER_DTIM_MSK: '0' PM have to walk up every DTIM,
  77. * '1' PM could sleep over DTIM till listen Interval.
  78. * @POWER_FLAGS_SNOOZE_ENA_MSK: Enable snoozing only if uAPSD is enabled and all
  79. * access categories are both delivery and trigger enabled.
  80. * @POWER_FLAGS_BT_SCO_ENA: Enable BT SCO coex only if uAPSD and
  81. * PBW Snoozing enabled
  82. * @POWER_FLAGS_ADVANCE_PM_ENA_MSK: Advanced PM (uAPSD) enable mask
  83. * @POWER_FLAGS_LPRX_ENA_MSK: Low Power RX enable.
  84. */
  85. enum iwl_power_flags {
  86. POWER_FLAGS_POWER_SAVE_ENA_MSK = BIT(0),
  87. POWER_FLAGS_POWER_MANAGEMENT_ENA_MSK = BIT(1),
  88. POWER_FLAGS_SKIP_OVER_DTIM_MSK = BIT(2),
  89. POWER_FLAGS_SNOOZE_ENA_MSK = BIT(5),
  90. POWER_FLAGS_BT_SCO_ENA = BIT(8),
  91. POWER_FLAGS_ADVANCE_PM_ENA_MSK = BIT(9),
  92. POWER_FLAGS_LPRX_ENA_MSK = BIT(11),
  93. };
  94. #define IWL_POWER_VEC_SIZE 5
  95. /**
  96. * struct iwl_powertable_cmd - legacy power command. Beside old API support this
  97. * is used also with a new power API for device wide power settings.
  98. * POWER_TABLE_CMD = 0x77 (command, has simple generic response)
  99. *
  100. * @flags: Power table command flags from POWER_FLAGS_*
  101. * @keep_alive_seconds: Keep alive period in seconds. Default - 25 sec.
  102. * Minimum allowed:- 3 * DTIM. Keep alive period must be
  103. * set regardless of power scheme or current power state.
  104. * FW use this value also when PM is disabled.
  105. * @rx_data_timeout: Minimum time (usec) from last Rx packet for AM to
  106. * PSM transition - legacy PM
  107. * @tx_data_timeout: Minimum time (usec) from last Tx packet for AM to
  108. * PSM transition - legacy PM
  109. * @sleep_interval: not in use
  110. * @skip_dtim_periods: Number of DTIM periods to skip if Skip over DTIM flag
  111. * is set. For example, if it is required to skip over
  112. * one DTIM, this value need to be set to 2 (DTIM periods).
  113. * @lprx_rssi_threshold: Signal strength up to which LP RX can be enabled.
  114. * Default: 80dbm
  115. */
  116. struct iwl_powertable_cmd {
  117. /* PM_POWER_TABLE_CMD_API_S_VER_6 */
  118. __le16 flags;
  119. u8 keep_alive_seconds;
  120. u8 debug_flags;
  121. __le32 rx_data_timeout;
  122. __le32 tx_data_timeout;
  123. __le32 sleep_interval[IWL_POWER_VEC_SIZE];
  124. __le32 skip_dtim_periods;
  125. __le32 lprx_rssi_threshold;
  126. } __packed;
  127. /**
  128. * struct iwl_mac_power_cmd - New power command containing uAPSD support
  129. * MAC_PM_POWER_TABLE = 0xA9 (command, has simple generic response)
  130. * @id_and_color: MAC contex identifier
  131. * @flags: Power table command flags from POWER_FLAGS_*
  132. * @keep_alive_seconds: Keep alive period in seconds. Default - 25 sec.
  133. * Minimum allowed:- 3 * DTIM. Keep alive period must be
  134. * set regardless of power scheme or current power state.
  135. * FW use this value also when PM is disabled.
  136. * @rx_data_timeout: Minimum time (usec) from last Rx packet for AM to
  137. * PSM transition - legacy PM
  138. * @tx_data_timeout: Minimum time (usec) from last Tx packet for AM to
  139. * PSM transition - legacy PM
  140. * @sleep_interval: not in use
  141. * @skip_dtim_periods: Number of DTIM periods to skip if Skip over DTIM flag
  142. * is set. For example, if it is required to skip over
  143. * one DTIM, this value need to be set to 2 (DTIM periods).
  144. * @rx_data_timeout_uapsd: Minimum time (usec) from last Rx packet for AM to
  145. * PSM transition - uAPSD
  146. * @tx_data_timeout_uapsd: Minimum time (usec) from last Tx packet for AM to
  147. * PSM transition - uAPSD
  148. * @lprx_rssi_threshold: Signal strength up to which LP RX can be enabled.
  149. * Default: 80dbm
  150. * @num_skip_dtim: Number of DTIMs to skip if Skip over DTIM flag is set
  151. * @snooze_interval: Maximum time between attempts to retrieve buffered data
  152. * from the AP [msec]
  153. * @snooze_window: A window of time in which PBW snoozing insures that all
  154. * packets received. It is also the minimum time from last
  155. * received unicast RX packet, before client stops snoozing
  156. * for data. [msec]
  157. * @snooze_step: TBD
  158. * @qndp_tid: TID client shall use for uAPSD QNDP triggers
  159. * @uapsd_ac_flags: Set trigger-enabled and delivery-enabled indication for
  160. * each corresponding AC.
  161. * Use IEEE80211_WMM_IE_STA_QOSINFO_AC* for correct values.
  162. * @uapsd_max_sp: Use IEEE80211_WMM_IE_STA_QOSINFO_SP_* for correct
  163. * values.
  164. * @heavy_tx_thld_packets: TX threshold measured in number of packets
  165. * @heavy_rx_thld_packets: RX threshold measured in number of packets
  166. * @heavy_tx_thld_percentage: TX threshold measured in load's percentage
  167. * @heavy_rx_thld_percentage: RX threshold measured in load's percentage
  168. * @limited_ps_threshold:
  169. */
  170. struct iwl_mac_power_cmd {
  171. /* CONTEXT_DESC_API_T_VER_1 */
  172. __le32 id_and_color;
  173. /* CLIENT_PM_POWER_TABLE_S_VER_1 */
  174. __le16 flags;
  175. __le16 keep_alive_seconds;
  176. __le32 rx_data_timeout;
  177. __le32 tx_data_timeout;
  178. __le32 rx_data_timeout_uapsd;
  179. __le32 tx_data_timeout_uapsd;
  180. u8 lprx_rssi_threshold;
  181. u8 skip_dtim_periods;
  182. __le16 snooze_interval;
  183. __le16 snooze_window;
  184. u8 snooze_step;
  185. u8 qndp_tid;
  186. u8 uapsd_ac_flags;
  187. u8 uapsd_max_sp;
  188. u8 heavy_tx_thld_packets;
  189. u8 heavy_rx_thld_packets;
  190. u8 heavy_tx_thld_percentage;
  191. u8 heavy_rx_thld_percentage;
  192. u8 limited_ps_threshold;
  193. u8 reserved;
  194. } __packed;
  195. /**
  196. * struct iwl_beacon_filter_cmd
  197. * REPLY_BEACON_FILTERING_CMD = 0xd2 (command)
  198. * @id_and_color: MAC contex identifier
  199. * @bf_energy_delta: Used for RSSI filtering, if in 'normal' state. Send beacon
  200. * to driver if delta in Energy values calculated for this and last
  201. * passed beacon is greater than this threshold. Zero value means that
  202. * the Energy change is ignored for beacon filtering, and beacon will
  203. * not be forced to be sent to driver regardless of this delta. Typical
  204. * energy delta 5dB.
  205. * @bf_roaming_energy_delta: Used for RSSI filtering, if in 'roaming' state.
  206. * Send beacon to driver if delta in Energy values calculated for this
  207. * and last passed beacon is greater than this threshold. Zero value
  208. * means that the Energy change is ignored for beacon filtering while in
  209. * Roaming state, typical energy delta 1dB.
  210. * @bf_roaming_state: Used for RSSI filtering. If absolute Energy values
  211. * calculated for current beacon is less than the threshold, use
  212. * Roaming Energy Delta Threshold, otherwise use normal Energy Delta
  213. * Threshold. Typical energy threshold is -72dBm.
  214. * @bf_temp_threshold: This threshold determines the type of temperature
  215. * filtering (Slow or Fast) that is selected (Units are in Celsuis):
  216. * If the current temperature is above this threshold - Fast filter
  217. * will be used, If the current temperature is below this threshold -
  218. * Slow filter will be used.
  219. * @bf_temp_fast_filter: Send Beacon to driver if delta in temperature values
  220. * calculated for this and the last passed beacon is greater than this
  221. * threshold. Zero value means that the temperature change is ignored for
  222. * beacon filtering; beacons will not be forced to be sent to driver
  223. * regardless of whether its temerature has been changed.
  224. * @bf_temp_slow_filter: Send Beacon to driver if delta in temperature values
  225. * calculated for this and the last passed beacon is greater than this
  226. * threshold. Zero value means that the temperature change is ignored for
  227. * beacon filtering; beacons will not be forced to be sent to driver
  228. * regardless of whether its temerature has been changed.
  229. * @bf_enable_beacon_filter: 1, beacon filtering is enabled; 0, disabled.
  230. * @bf_filter_escape_timer: Send beacons to to driver if no beacons were passed
  231. * for a specific period of time. Units: Beacons.
  232. * @ba_escape_timer: Fully receive and parse beacon if no beacons were passed
  233. * for a longer period of time then this escape-timeout. Units: Beacons.
  234. * @ba_enable_beacon_abort: 1, beacon abort is enabled; 0, disabled.
  235. */
  236. struct iwl_beacon_filter_cmd {
  237. __le32 bf_energy_delta;
  238. __le32 bf_roaming_energy_delta;
  239. __le32 bf_roaming_state;
  240. __le32 bf_temp_threshold;
  241. __le32 bf_temp_fast_filter;
  242. __le32 bf_temp_slow_filter;
  243. __le32 bf_enable_beacon_filter;
  244. __le32 bf_debug_flag;
  245. __le32 bf_escape_timer;
  246. __le32 ba_escape_timer;
  247. __le32 ba_enable_beacon_abort;
  248. } __packed;
  249. /* Beacon filtering and beacon abort */
  250. #define IWL_BF_ENERGY_DELTA_DEFAULT 5
  251. #define IWL_BF_ENERGY_DELTA_MAX 255
  252. #define IWL_BF_ENERGY_DELTA_MIN 0
  253. #define IWL_BF_ROAMING_ENERGY_DELTA_DEFAULT 1
  254. #define IWL_BF_ROAMING_ENERGY_DELTA_MAX 255
  255. #define IWL_BF_ROAMING_ENERGY_DELTA_MIN 0
  256. #define IWL_BF_ROAMING_STATE_DEFAULT 72
  257. #define IWL_BF_ROAMING_STATE_MAX 255
  258. #define IWL_BF_ROAMING_STATE_MIN 0
  259. #define IWL_BF_TEMP_THRESHOLD_DEFAULT 112
  260. #define IWL_BF_TEMP_THRESHOLD_MAX 255
  261. #define IWL_BF_TEMP_THRESHOLD_MIN 0
  262. #define IWL_BF_TEMP_FAST_FILTER_DEFAULT 1
  263. #define IWL_BF_TEMP_FAST_FILTER_MAX 255
  264. #define IWL_BF_TEMP_FAST_FILTER_MIN 0
  265. #define IWL_BF_TEMP_SLOW_FILTER_DEFAULT 5
  266. #define IWL_BF_TEMP_SLOW_FILTER_MAX 255
  267. #define IWL_BF_TEMP_SLOW_FILTER_MIN 0
  268. #define IWL_BF_ENABLE_BEACON_FILTER_DEFAULT 1
  269. #define IWL_BF_DEBUG_FLAG_DEFAULT 0
  270. #define IWL_BF_ESCAPE_TIMER_DEFAULT 50
  271. #define IWL_BF_ESCAPE_TIMER_MAX 1024
  272. #define IWL_BF_ESCAPE_TIMER_MIN 0
  273. #define IWL_BA_ESCAPE_TIMER_DEFAULT 6
  274. #define IWL_BA_ESCAPE_TIMER_D3 6
  275. #define IWL_BA_ESCAPE_TIMER_MAX 1024
  276. #define IWL_BA_ESCAPE_TIMER_MIN 0
  277. #define IWL_BA_ENABLE_BEACON_ABORT_DEFAULT 1
  278. #define IWL_BF_CMD_CONFIG_DEFAULTS \
  279. .bf_energy_delta = cpu_to_le32(IWL_BF_ENERGY_DELTA_DEFAULT), \
  280. .bf_roaming_energy_delta = \
  281. cpu_to_le32(IWL_BF_ROAMING_ENERGY_DELTA_DEFAULT), \
  282. .bf_roaming_state = cpu_to_le32(IWL_BF_ROAMING_STATE_DEFAULT), \
  283. .bf_temp_threshold = cpu_to_le32(IWL_BF_TEMP_THRESHOLD_DEFAULT), \
  284. .bf_temp_fast_filter = cpu_to_le32(IWL_BF_TEMP_FAST_FILTER_DEFAULT), \
  285. .bf_temp_slow_filter = cpu_to_le32(IWL_BF_TEMP_SLOW_FILTER_DEFAULT), \
  286. .bf_debug_flag = cpu_to_le32(IWL_BF_DEBUG_FLAG_DEFAULT), \
  287. .bf_escape_timer = cpu_to_le32(IWL_BF_ESCAPE_TIMER_DEFAULT), \
  288. .ba_escape_timer = cpu_to_le32(IWL_BA_ESCAPE_TIMER_DEFAULT)
  289. #endif