fw-api-power.h 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338
  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. * enum iwl_device_power_flags - masks for device power command flags
  129. * @DEVIC_POWER_FLAGS_POWER_SAVE_ENA_MSK: '1' Allow to save power by turning off
  130. * receiver and transmitter. '0' - does not allow. This flag should be
  131. * always set to '1' unless one need to disable actual power down for debug
  132. * purposes.
  133. * @DEVICE_POWER_FLAGS_CAM_MSK: '1' CAM (Continuous Active Mode) is set, meaning
  134. * that power management is disabled. '0' Power management is enabled, one
  135. * of power schemes is applied.
  136. */
  137. enum iwl_device_power_flags {
  138. DEVICE_POWER_FLAGS_POWER_SAVE_ENA_MSK = BIT(0),
  139. DEVICE_POWER_FLAGS_CAM_MSK = BIT(13),
  140. };
  141. /**
  142. * struct iwl_device_power_cmd - device wide power command.
  143. * DEVICE_POWER_CMD = 0x77 (command, has simple generic response)
  144. *
  145. * @flags: Power table command flags from DEVICE_POWER_FLAGS_*
  146. */
  147. struct iwl_device_power_cmd {
  148. /* PM_POWER_TABLE_CMD_API_S_VER_6 */
  149. __le16 flags;
  150. __le16 reserved;
  151. } __packed;
  152. /**
  153. * struct iwl_mac_power_cmd - New power command containing uAPSD support
  154. * MAC_PM_POWER_TABLE = 0xA9 (command, has simple generic response)
  155. * @id_and_color: MAC contex identifier
  156. * @flags: Power table command flags from POWER_FLAGS_*
  157. * @keep_alive_seconds: Keep alive period in seconds. Default - 25 sec.
  158. * Minimum allowed:- 3 * DTIM. Keep alive period must be
  159. * set regardless of power scheme or current power state.
  160. * FW use this value also when PM is disabled.
  161. * @rx_data_timeout: Minimum time (usec) from last Rx packet for AM to
  162. * PSM transition - legacy PM
  163. * @tx_data_timeout: Minimum time (usec) from last Tx packet for AM to
  164. * PSM transition - legacy PM
  165. * @sleep_interval: not in use
  166. * @skip_dtim_periods: Number of DTIM periods to skip if Skip over DTIM flag
  167. * is set. For example, if it is required to skip over
  168. * one DTIM, this value need to be set to 2 (DTIM periods).
  169. * @rx_data_timeout_uapsd: Minimum time (usec) from last Rx packet for AM to
  170. * PSM transition - uAPSD
  171. * @tx_data_timeout_uapsd: Minimum time (usec) from last Tx packet for AM to
  172. * PSM transition - uAPSD
  173. * @lprx_rssi_threshold: Signal strength up to which LP RX can be enabled.
  174. * Default: 80dbm
  175. * @num_skip_dtim: Number of DTIMs to skip if Skip over DTIM flag is set
  176. * @snooze_interval: Maximum time between attempts to retrieve buffered data
  177. * from the AP [msec]
  178. * @snooze_window: A window of time in which PBW snoozing insures that all
  179. * packets received. It is also the minimum time from last
  180. * received unicast RX packet, before client stops snoozing
  181. * for data. [msec]
  182. * @snooze_step: TBD
  183. * @qndp_tid: TID client shall use for uAPSD QNDP triggers
  184. * @uapsd_ac_flags: Set trigger-enabled and delivery-enabled indication for
  185. * each corresponding AC.
  186. * Use IEEE80211_WMM_IE_STA_QOSINFO_AC* for correct values.
  187. * @uapsd_max_sp: Use IEEE80211_WMM_IE_STA_QOSINFO_SP_* for correct
  188. * values.
  189. * @heavy_tx_thld_packets: TX threshold measured in number of packets
  190. * @heavy_rx_thld_packets: RX threshold measured in number of packets
  191. * @heavy_tx_thld_percentage: TX threshold measured in load's percentage
  192. * @heavy_rx_thld_percentage: RX threshold measured in load's percentage
  193. * @limited_ps_threshold:
  194. */
  195. struct iwl_mac_power_cmd {
  196. /* CONTEXT_DESC_API_T_VER_1 */
  197. __le32 id_and_color;
  198. /* CLIENT_PM_POWER_TABLE_S_VER_1 */
  199. __le16 flags;
  200. __le16 keep_alive_seconds;
  201. __le32 rx_data_timeout;
  202. __le32 tx_data_timeout;
  203. __le32 rx_data_timeout_uapsd;
  204. __le32 tx_data_timeout_uapsd;
  205. u8 lprx_rssi_threshold;
  206. u8 skip_dtim_periods;
  207. __le16 snooze_interval;
  208. __le16 snooze_window;
  209. u8 snooze_step;
  210. u8 qndp_tid;
  211. u8 uapsd_ac_flags;
  212. u8 uapsd_max_sp;
  213. u8 heavy_tx_thld_packets;
  214. u8 heavy_rx_thld_packets;
  215. u8 heavy_tx_thld_percentage;
  216. u8 heavy_rx_thld_percentage;
  217. u8 limited_ps_threshold;
  218. u8 reserved;
  219. } __packed;
  220. /**
  221. * struct iwl_beacon_filter_cmd
  222. * REPLY_BEACON_FILTERING_CMD = 0xd2 (command)
  223. * @id_and_color: MAC contex identifier
  224. * @bf_energy_delta: Used for RSSI filtering, if in 'normal' state. Send beacon
  225. * to driver if delta in Energy values calculated for this and last
  226. * passed beacon is greater than this threshold. Zero value means that
  227. * the Energy change is ignored for beacon filtering, and beacon will
  228. * not be forced to be sent to driver regardless of this delta. Typical
  229. * energy delta 5dB.
  230. * @bf_roaming_energy_delta: Used for RSSI filtering, if in 'roaming' state.
  231. * Send beacon to driver if delta in Energy values calculated for this
  232. * and last passed beacon is greater than this threshold. Zero value
  233. * means that the Energy change is ignored for beacon filtering while in
  234. * Roaming state, typical energy delta 1dB.
  235. * @bf_roaming_state: Used for RSSI filtering. If absolute Energy values
  236. * calculated for current beacon is less than the threshold, use
  237. * Roaming Energy Delta Threshold, otherwise use normal Energy Delta
  238. * Threshold. Typical energy threshold is -72dBm.
  239. * @bf_temp_threshold: This threshold determines the type of temperature
  240. * filtering (Slow or Fast) that is selected (Units are in Celsuis):
  241. * If the current temperature is above this threshold - Fast filter
  242. * will be used, If the current temperature is below this threshold -
  243. * Slow filter will be used.
  244. * @bf_temp_fast_filter: Send Beacon to driver if delta in temperature values
  245. * calculated for this and the last passed beacon is greater than this
  246. * threshold. Zero value means that the temperature change is ignored for
  247. * beacon filtering; beacons will not be forced to be sent to driver
  248. * regardless of whether its temerature has been changed.
  249. * @bf_temp_slow_filter: Send Beacon to driver if delta in temperature values
  250. * calculated for this and the last passed beacon is greater than this
  251. * threshold. Zero value means that the temperature change is ignored for
  252. * beacon filtering; beacons will not be forced to be sent to driver
  253. * regardless of whether its temerature has been changed.
  254. * @bf_enable_beacon_filter: 1, beacon filtering is enabled; 0, disabled.
  255. * @bf_filter_escape_timer: Send beacons to to driver if no beacons were passed
  256. * for a specific period of time. Units: Beacons.
  257. * @ba_escape_timer: Fully receive and parse beacon if no beacons were passed
  258. * for a longer period of time then this escape-timeout. Units: Beacons.
  259. * @ba_enable_beacon_abort: 1, beacon abort is enabled; 0, disabled.
  260. */
  261. struct iwl_beacon_filter_cmd {
  262. __le32 bf_energy_delta;
  263. __le32 bf_roaming_energy_delta;
  264. __le32 bf_roaming_state;
  265. __le32 bf_temp_threshold;
  266. __le32 bf_temp_fast_filter;
  267. __le32 bf_temp_slow_filter;
  268. __le32 bf_enable_beacon_filter;
  269. __le32 bf_debug_flag;
  270. __le32 bf_escape_timer;
  271. __le32 ba_escape_timer;
  272. __le32 ba_enable_beacon_abort;
  273. } __packed;
  274. /* Beacon filtering and beacon abort */
  275. #define IWL_BF_ENERGY_DELTA_DEFAULT 5
  276. #define IWL_BF_ENERGY_DELTA_MAX 255
  277. #define IWL_BF_ENERGY_DELTA_MIN 0
  278. #define IWL_BF_ROAMING_ENERGY_DELTA_DEFAULT 1
  279. #define IWL_BF_ROAMING_ENERGY_DELTA_MAX 255
  280. #define IWL_BF_ROAMING_ENERGY_DELTA_MIN 0
  281. #define IWL_BF_ROAMING_STATE_DEFAULT 72
  282. #define IWL_BF_ROAMING_STATE_MAX 255
  283. #define IWL_BF_ROAMING_STATE_MIN 0
  284. #define IWL_BF_TEMP_THRESHOLD_DEFAULT 112
  285. #define IWL_BF_TEMP_THRESHOLD_MAX 255
  286. #define IWL_BF_TEMP_THRESHOLD_MIN 0
  287. #define IWL_BF_TEMP_FAST_FILTER_DEFAULT 1
  288. #define IWL_BF_TEMP_FAST_FILTER_MAX 255
  289. #define IWL_BF_TEMP_FAST_FILTER_MIN 0
  290. #define IWL_BF_TEMP_SLOW_FILTER_DEFAULT 5
  291. #define IWL_BF_TEMP_SLOW_FILTER_MAX 255
  292. #define IWL_BF_TEMP_SLOW_FILTER_MIN 0
  293. #define IWL_BF_ENABLE_BEACON_FILTER_DEFAULT 1
  294. #define IWL_BF_DEBUG_FLAG_DEFAULT 0
  295. #define IWL_BF_ESCAPE_TIMER_DEFAULT 50
  296. #define IWL_BF_ESCAPE_TIMER_MAX 1024
  297. #define IWL_BF_ESCAPE_TIMER_MIN 0
  298. #define IWL_BA_ESCAPE_TIMER_DEFAULT 6
  299. #define IWL_BA_ESCAPE_TIMER_D3 9
  300. #define IWL_BA_ESCAPE_TIMER_MAX 1024
  301. #define IWL_BA_ESCAPE_TIMER_MIN 0
  302. #define IWL_BA_ENABLE_BEACON_ABORT_DEFAULT 1
  303. #define IWL_BF_CMD_CONFIG_DEFAULTS \
  304. .bf_energy_delta = cpu_to_le32(IWL_BF_ENERGY_DELTA_DEFAULT), \
  305. .bf_roaming_energy_delta = \
  306. cpu_to_le32(IWL_BF_ROAMING_ENERGY_DELTA_DEFAULT), \
  307. .bf_roaming_state = cpu_to_le32(IWL_BF_ROAMING_STATE_DEFAULT), \
  308. .bf_temp_threshold = cpu_to_le32(IWL_BF_TEMP_THRESHOLD_DEFAULT), \
  309. .bf_temp_fast_filter = cpu_to_le32(IWL_BF_TEMP_FAST_FILTER_DEFAULT), \
  310. .bf_temp_slow_filter = cpu_to_le32(IWL_BF_TEMP_SLOW_FILTER_DEFAULT), \
  311. .bf_debug_flag = cpu_to_le32(IWL_BF_DEBUG_FLAG_DEFAULT), \
  312. .bf_escape_timer = cpu_to_le32(IWL_BF_ESCAPE_TIMER_DEFAULT), \
  313. .ba_escape_timer = cpu_to_le32(IWL_BA_ESCAPE_TIMER_DEFAULT)
  314. #endif