fw-api-power.h 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400
  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 - 2014 Intel Mobile Communications GmbH
  10. *
  11. * This program is free software; you can redistribute it and/or modify
  12. * it under the terms of version 2 of the GNU General Public License as
  13. * published by the Free Software Foundation.
  14. *
  15. * This program is distributed in the hope that it will be useful, but
  16. * WITHOUT ANY WARRANTY; without even the implied warranty of
  17. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  18. * General Public License for more details.
  19. *
  20. * You should have received a copy of the GNU General Public License
  21. * along with this program; if not, write to the Free Software
  22. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110,
  23. * USA
  24. *
  25. * The full GNU General Public License is included in this distribution
  26. * in the file called COPYING.
  27. *
  28. * Contact Information:
  29. * Intel Linux Wireless <ilw@linux.intel.com>
  30. * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
  31. *
  32. * BSD LICENSE
  33. *
  34. * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved.
  35. * Copyright(c) 2013 - 2014 Intel Mobile Communications GmbH
  36. * All rights reserved.
  37. *
  38. * Redistribution and use in source and binary forms, with or without
  39. * modification, are permitted provided that the following conditions
  40. * are met:
  41. *
  42. * * Redistributions of source code must retain the above copyright
  43. * notice, this list of conditions and the following disclaimer.
  44. * * Redistributions in binary form must reproduce the above copyright
  45. * notice, this list of conditions and the following disclaimer in
  46. * the documentation and/or other materials provided with the
  47. * distribution.
  48. * * Neither the name Intel Corporation nor the names of its
  49. * contributors may be used to endorse or promote products derived
  50. * from this software without specific prior written permission.
  51. *
  52. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  53. * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  54. * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  55. * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  56. * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  57. * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  58. * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  59. * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  60. * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  61. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  62. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  63. *
  64. *****************************************************************************/
  65. #ifndef __fw_api_power_h__
  66. #define __fw_api_power_h__
  67. /* Power Management Commands, Responses, Notifications */
  68. /**
  69. * enum iwl_ltr_config_flags - masks for LTR config command flags
  70. * @LTR_CFG_FLAG_FEATURE_ENABLE: Feature operational status
  71. * @LTR_CFG_FLAG_HW_DIS_ON_SHADOW_REG_ACCESS: allow LTR change on shadow
  72. * memory access
  73. * @LTR_CFG_FLAG_HW_EN_SHRT_WR_THROUGH: allow LTR msg send on ANY LTR
  74. * reg change
  75. * @LTR_CFG_FLAG_HW_DIS_ON_D0_2_D3: allow LTR msg send on transition from
  76. * D0 to D3
  77. * @LTR_CFG_FLAG_SW_SET_SHORT: fixed static short LTR register
  78. * @LTR_CFG_FLAG_SW_SET_LONG: fixed static short LONG register
  79. * @LTR_CFG_FLAG_DENIE_C10_ON_PD: allow going into C10 on PD
  80. */
  81. enum iwl_ltr_config_flags {
  82. LTR_CFG_FLAG_FEATURE_ENABLE = BIT(0),
  83. LTR_CFG_FLAG_HW_DIS_ON_SHADOW_REG_ACCESS = BIT(1),
  84. LTR_CFG_FLAG_HW_EN_SHRT_WR_THROUGH = BIT(2),
  85. LTR_CFG_FLAG_HW_DIS_ON_D0_2_D3 = BIT(3),
  86. LTR_CFG_FLAG_SW_SET_SHORT = BIT(4),
  87. LTR_CFG_FLAG_SW_SET_LONG = BIT(5),
  88. LTR_CFG_FLAG_DENIE_C10_ON_PD = BIT(6),
  89. };
  90. /**
  91. * struct iwl_ltr_config_cmd - configures the LTR
  92. * @flags: See %enum iwl_ltr_config_flags
  93. */
  94. struct iwl_ltr_config_cmd {
  95. __le32 flags;
  96. __le32 static_long;
  97. __le32 static_short;
  98. } __packed;
  99. /* Radio LP RX Energy Threshold measured in dBm */
  100. #define POWER_LPRX_RSSI_THRESHOLD 75
  101. #define POWER_LPRX_RSSI_THRESHOLD_MAX 94
  102. #define POWER_LPRX_RSSI_THRESHOLD_MIN 30
  103. /**
  104. * enum iwl_power_flags - masks for power table command flags
  105. * @POWER_FLAGS_POWER_SAVE_ENA_MSK: '1' Allow to save power by turning off
  106. * receiver and transmitter. '0' - does not allow.
  107. * @POWER_FLAGS_POWER_MANAGEMENT_ENA_MSK: '0' Driver disables power management,
  108. * '1' Driver enables PM (use rest of parameters)
  109. * @POWER_FLAGS_SKIP_OVER_DTIM_MSK: '0' PM have to walk up every DTIM,
  110. * '1' PM could sleep over DTIM till listen Interval.
  111. * @POWER_FLAGS_SNOOZE_ENA_MSK: Enable snoozing only if uAPSD is enabled and all
  112. * access categories are both delivery and trigger enabled.
  113. * @POWER_FLAGS_BT_SCO_ENA: Enable BT SCO coex only if uAPSD and
  114. * PBW Snoozing enabled
  115. * @POWER_FLAGS_ADVANCE_PM_ENA_MSK: Advanced PM (uAPSD) enable mask
  116. * @POWER_FLAGS_LPRX_ENA_MSK: Low Power RX enable.
  117. * @POWER_FLAGS_AP_UAPSD_MISBEHAVING_ENA_MSK: AP/GO's uAPSD misbehaving
  118. * detection enablement
  119. */
  120. enum iwl_power_flags {
  121. POWER_FLAGS_POWER_SAVE_ENA_MSK = BIT(0),
  122. POWER_FLAGS_POWER_MANAGEMENT_ENA_MSK = BIT(1),
  123. POWER_FLAGS_SKIP_OVER_DTIM_MSK = BIT(2),
  124. POWER_FLAGS_SNOOZE_ENA_MSK = BIT(5),
  125. POWER_FLAGS_BT_SCO_ENA = BIT(8),
  126. POWER_FLAGS_ADVANCE_PM_ENA_MSK = BIT(9),
  127. POWER_FLAGS_LPRX_ENA_MSK = BIT(11),
  128. POWER_FLAGS_UAPSD_MISBEHAVING_ENA_MSK = BIT(12),
  129. };
  130. #define IWL_POWER_VEC_SIZE 5
  131. /**
  132. * struct iwl_powertable_cmd - legacy power command. Beside old API support this
  133. * is used also with a new power API for device wide power settings.
  134. * POWER_TABLE_CMD = 0x77 (command, has simple generic response)
  135. *
  136. * @flags: Power table command flags from POWER_FLAGS_*
  137. * @keep_alive_seconds: Keep alive period in seconds. Default - 25 sec.
  138. * Minimum allowed:- 3 * DTIM. Keep alive period must be
  139. * set regardless of power scheme or current power state.
  140. * FW use this value also when PM is disabled.
  141. * @rx_data_timeout: Minimum time (usec) from last Rx packet for AM to
  142. * PSM transition - legacy PM
  143. * @tx_data_timeout: Minimum time (usec) from last Tx packet for AM to
  144. * PSM transition - legacy PM
  145. * @sleep_interval: not in use
  146. * @skip_dtim_periods: Number of DTIM periods to skip if Skip over DTIM flag
  147. * is set. For example, if it is required to skip over
  148. * one DTIM, this value need to be set to 2 (DTIM periods).
  149. * @lprx_rssi_threshold: Signal strength up to which LP RX can be enabled.
  150. * Default: 80dbm
  151. */
  152. struct iwl_powertable_cmd {
  153. /* PM_POWER_TABLE_CMD_API_S_VER_6 */
  154. __le16 flags;
  155. u8 keep_alive_seconds;
  156. u8 debug_flags;
  157. __le32 rx_data_timeout;
  158. __le32 tx_data_timeout;
  159. __le32 sleep_interval[IWL_POWER_VEC_SIZE];
  160. __le32 skip_dtim_periods;
  161. __le32 lprx_rssi_threshold;
  162. } __packed;
  163. /**
  164. * enum iwl_device_power_flags - masks for device power command flags
  165. * @DEVIC_POWER_FLAGS_POWER_SAVE_ENA_MSK: '1' Allow to save power by turning off
  166. * receiver and transmitter. '0' - does not allow. This flag should be
  167. * always set to '1' unless one need to disable actual power down for debug
  168. * purposes.
  169. * @DEVICE_POWER_FLAGS_CAM_MSK: '1' CAM (Continuous Active Mode) is set, meaning
  170. * that power management is disabled. '0' Power management is enabled, one
  171. * of power schemes is applied.
  172. */
  173. enum iwl_device_power_flags {
  174. DEVICE_POWER_FLAGS_POWER_SAVE_ENA_MSK = BIT(0),
  175. DEVICE_POWER_FLAGS_CAM_MSK = BIT(13),
  176. };
  177. /**
  178. * struct iwl_device_power_cmd - device wide power command.
  179. * DEVICE_POWER_CMD = 0x77 (command, has simple generic response)
  180. *
  181. * @flags: Power table command flags from DEVICE_POWER_FLAGS_*
  182. */
  183. struct iwl_device_power_cmd {
  184. /* PM_POWER_TABLE_CMD_API_S_VER_6 */
  185. __le16 flags;
  186. __le16 reserved;
  187. } __packed;
  188. /**
  189. * struct iwl_mac_power_cmd - New power command containing uAPSD support
  190. * MAC_PM_POWER_TABLE = 0xA9 (command, has simple generic response)
  191. * @id_and_color: MAC contex identifier
  192. * @flags: Power table command flags from POWER_FLAGS_*
  193. * @keep_alive_seconds: Keep alive period in seconds. Default - 25 sec.
  194. * Minimum allowed:- 3 * DTIM. Keep alive period must be
  195. * set regardless of power scheme or current power state.
  196. * FW use this value also when PM is disabled.
  197. * @rx_data_timeout: Minimum time (usec) from last Rx packet for AM to
  198. * PSM transition - legacy PM
  199. * @tx_data_timeout: Minimum time (usec) from last Tx packet for AM to
  200. * PSM transition - legacy PM
  201. * @sleep_interval: not in use
  202. * @skip_dtim_periods: Number of DTIM periods to skip if Skip over DTIM flag
  203. * is set. For example, if it is required to skip over
  204. * one DTIM, this value need to be set to 2 (DTIM periods).
  205. * @rx_data_timeout_uapsd: Minimum time (usec) from last Rx packet for AM to
  206. * PSM transition - uAPSD
  207. * @tx_data_timeout_uapsd: Minimum time (usec) from last Tx packet for AM to
  208. * PSM transition - uAPSD
  209. * @lprx_rssi_threshold: Signal strength up to which LP RX can be enabled.
  210. * Default: 80dbm
  211. * @num_skip_dtim: Number of DTIMs to skip if Skip over DTIM flag is set
  212. * @snooze_interval: Maximum time between attempts to retrieve buffered data
  213. * from the AP [msec]
  214. * @snooze_window: A window of time in which PBW snoozing insures that all
  215. * packets received. It is also the minimum time from last
  216. * received unicast RX packet, before client stops snoozing
  217. * for data. [msec]
  218. * @snooze_step: TBD
  219. * @qndp_tid: TID client shall use for uAPSD QNDP triggers
  220. * @uapsd_ac_flags: Set trigger-enabled and delivery-enabled indication for
  221. * each corresponding AC.
  222. * Use IEEE80211_WMM_IE_STA_QOSINFO_AC* for correct values.
  223. * @uapsd_max_sp: Use IEEE80211_WMM_IE_STA_QOSINFO_SP_* for correct
  224. * values.
  225. * @heavy_tx_thld_packets: TX threshold measured in number of packets
  226. * @heavy_rx_thld_packets: RX threshold measured in number of packets
  227. * @heavy_tx_thld_percentage: TX threshold measured in load's percentage
  228. * @heavy_rx_thld_percentage: RX threshold measured in load's percentage
  229. * @limited_ps_threshold:
  230. */
  231. struct iwl_mac_power_cmd {
  232. /* CONTEXT_DESC_API_T_VER_1 */
  233. __le32 id_and_color;
  234. /* CLIENT_PM_POWER_TABLE_S_VER_1 */
  235. __le16 flags;
  236. __le16 keep_alive_seconds;
  237. __le32 rx_data_timeout;
  238. __le32 tx_data_timeout;
  239. __le32 rx_data_timeout_uapsd;
  240. __le32 tx_data_timeout_uapsd;
  241. u8 lprx_rssi_threshold;
  242. u8 skip_dtim_periods;
  243. __le16 snooze_interval;
  244. __le16 snooze_window;
  245. u8 snooze_step;
  246. u8 qndp_tid;
  247. u8 uapsd_ac_flags;
  248. u8 uapsd_max_sp;
  249. u8 heavy_tx_thld_packets;
  250. u8 heavy_rx_thld_packets;
  251. u8 heavy_tx_thld_percentage;
  252. u8 heavy_rx_thld_percentage;
  253. u8 limited_ps_threshold;
  254. u8 reserved;
  255. } __packed;
  256. /*
  257. * struct iwl_uapsd_misbehaving_ap_notif - FW sends this notification when
  258. * associated AP is identified as improperly implementing uAPSD protocol.
  259. * PSM_UAPSD_AP_MISBEHAVING_NOTIFICATION = 0x78
  260. * @sta_id: index of station in uCode's station table - associated AP ID in
  261. * this context.
  262. */
  263. struct iwl_uapsd_misbehaving_ap_notif {
  264. __le32 sta_id;
  265. u8 mac_id;
  266. u8 reserved[3];
  267. } __packed;
  268. /**
  269. * struct iwl_beacon_filter_cmd
  270. * REPLY_BEACON_FILTERING_CMD = 0xd2 (command)
  271. * @id_and_color: MAC contex identifier
  272. * @bf_energy_delta: Used for RSSI filtering, if in 'normal' state. Send beacon
  273. * to driver if delta in Energy values calculated for this and last
  274. * passed beacon is greater than this threshold. Zero value means that
  275. * the Energy change is ignored for beacon filtering, and beacon will
  276. * not be forced to be sent to driver regardless of this delta. Typical
  277. * energy delta 5dB.
  278. * @bf_roaming_energy_delta: Used for RSSI filtering, if in 'roaming' state.
  279. * Send beacon to driver if delta in Energy values calculated for this
  280. * and last passed beacon is greater than this threshold. Zero value
  281. * means that the Energy change is ignored for beacon filtering while in
  282. * Roaming state, typical energy delta 1dB.
  283. * @bf_roaming_state: Used for RSSI filtering. If absolute Energy values
  284. * calculated for current beacon is less than the threshold, use
  285. * Roaming Energy Delta Threshold, otherwise use normal Energy Delta
  286. * Threshold. Typical energy threshold is -72dBm.
  287. * @bf_temp_threshold: This threshold determines the type of temperature
  288. * filtering (Slow or Fast) that is selected (Units are in Celsuis):
  289. * If the current temperature is above this threshold - Fast filter
  290. * will be used, If the current temperature is below this threshold -
  291. * Slow filter will be used.
  292. * @bf_temp_fast_filter: Send Beacon to driver if delta in temperature values
  293. * calculated for this and the last passed beacon is greater than this
  294. * threshold. Zero value means that the temperature change is ignored for
  295. * beacon filtering; beacons will not be forced to be sent to driver
  296. * regardless of whether its temerature has been changed.
  297. * @bf_temp_slow_filter: Send Beacon to driver if delta in temperature values
  298. * calculated for this and the last passed beacon is greater than this
  299. * threshold. Zero value means that the temperature change is ignored for
  300. * beacon filtering; beacons will not be forced to be sent to driver
  301. * regardless of whether its temerature has been changed.
  302. * @bf_enable_beacon_filter: 1, beacon filtering is enabled; 0, disabled.
  303. * @bf_filter_escape_timer: Send beacons to to driver if no beacons were passed
  304. * for a specific period of time. Units: Beacons.
  305. * @ba_escape_timer: Fully receive and parse beacon if no beacons were passed
  306. * for a longer period of time then this escape-timeout. Units: Beacons.
  307. * @ba_enable_beacon_abort: 1, beacon abort is enabled; 0, disabled.
  308. */
  309. struct iwl_beacon_filter_cmd {
  310. __le32 bf_energy_delta;
  311. __le32 bf_roaming_energy_delta;
  312. __le32 bf_roaming_state;
  313. __le32 bf_temp_threshold;
  314. __le32 bf_temp_fast_filter;
  315. __le32 bf_temp_slow_filter;
  316. __le32 bf_enable_beacon_filter;
  317. __le32 bf_debug_flag;
  318. __le32 bf_escape_timer;
  319. __le32 ba_escape_timer;
  320. __le32 ba_enable_beacon_abort;
  321. } __packed;
  322. /* Beacon filtering and beacon abort */
  323. #define IWL_BF_ENERGY_DELTA_DEFAULT 5
  324. #define IWL_BF_ENERGY_DELTA_D0I3 20
  325. #define IWL_BF_ENERGY_DELTA_MAX 255
  326. #define IWL_BF_ENERGY_DELTA_MIN 0
  327. #define IWL_BF_ROAMING_ENERGY_DELTA_DEFAULT 1
  328. #define IWL_BF_ROAMING_ENERGY_DELTA_D0I3 20
  329. #define IWL_BF_ROAMING_ENERGY_DELTA_MAX 255
  330. #define IWL_BF_ROAMING_ENERGY_DELTA_MIN 0
  331. #define IWL_BF_ROAMING_STATE_DEFAULT 72
  332. #define IWL_BF_ROAMING_STATE_D0I3 72
  333. #define IWL_BF_ROAMING_STATE_MAX 255
  334. #define IWL_BF_ROAMING_STATE_MIN 0
  335. #define IWL_BF_TEMP_THRESHOLD_DEFAULT 112
  336. #define IWL_BF_TEMP_THRESHOLD_D0I3 112
  337. #define IWL_BF_TEMP_THRESHOLD_MAX 255
  338. #define IWL_BF_TEMP_THRESHOLD_MIN 0
  339. #define IWL_BF_TEMP_FAST_FILTER_DEFAULT 1
  340. #define IWL_BF_TEMP_FAST_FILTER_D0I3 1
  341. #define IWL_BF_TEMP_FAST_FILTER_MAX 255
  342. #define IWL_BF_TEMP_FAST_FILTER_MIN 0
  343. #define IWL_BF_TEMP_SLOW_FILTER_DEFAULT 5
  344. #define IWL_BF_TEMP_SLOW_FILTER_D0I3 5
  345. #define IWL_BF_TEMP_SLOW_FILTER_MAX 255
  346. #define IWL_BF_TEMP_SLOW_FILTER_MIN 0
  347. #define IWL_BF_ENABLE_BEACON_FILTER_DEFAULT 1
  348. #define IWL_BF_DEBUG_FLAG_DEFAULT 0
  349. #define IWL_BF_DEBUG_FLAG_D0I3 0
  350. #define IWL_BF_ESCAPE_TIMER_DEFAULT 0
  351. #define IWL_BF_ESCAPE_TIMER_D0I3 0
  352. #define IWL_BF_ESCAPE_TIMER_MAX 1024
  353. #define IWL_BF_ESCAPE_TIMER_MIN 0
  354. #define IWL_BA_ESCAPE_TIMER_DEFAULT 6
  355. #define IWL_BA_ESCAPE_TIMER_D0I3 6
  356. #define IWL_BA_ESCAPE_TIMER_D3 9
  357. #define IWL_BA_ESCAPE_TIMER_MAX 1024
  358. #define IWL_BA_ESCAPE_TIMER_MIN 0
  359. #define IWL_BA_ENABLE_BEACON_ABORT_DEFAULT 1
  360. #define IWL_BF_CMD_CONFIG(mode) \
  361. .bf_energy_delta = cpu_to_le32(IWL_BF_ENERGY_DELTA ## mode), \
  362. .bf_roaming_energy_delta = \
  363. cpu_to_le32(IWL_BF_ROAMING_ENERGY_DELTA ## mode), \
  364. .bf_roaming_state = cpu_to_le32(IWL_BF_ROAMING_STATE ## mode), \
  365. .bf_temp_threshold = cpu_to_le32(IWL_BF_TEMP_THRESHOLD ## mode), \
  366. .bf_temp_fast_filter = cpu_to_le32(IWL_BF_TEMP_FAST_FILTER ## mode), \
  367. .bf_temp_slow_filter = cpu_to_le32(IWL_BF_TEMP_SLOW_FILTER ## mode), \
  368. .bf_debug_flag = cpu_to_le32(IWL_BF_DEBUG_FLAG ## mode), \
  369. .bf_escape_timer = cpu_to_le32(IWL_BF_ESCAPE_TIMER ## mode), \
  370. .ba_escape_timer = cpu_to_le32(IWL_BA_ESCAPE_TIMER ## mode)
  371. #define IWL_BF_CMD_CONFIG_DEFAULTS IWL_BF_CMD_CONFIG(_DEFAULT)
  372. #define IWL_BF_CMD_CONFIG_D0I3 IWL_BF_CMD_CONFIG(_D0I3)
  373. #endif