phy-ctxt.h 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  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. *
  12. * This program is free software; you can redistribute it and/or modify
  13. * it under the terms of version 2 of the GNU General Public License as
  14. * published by the Free Software Foundation.
  15. *
  16. * This program is distributed in the hope that it will be useful, but
  17. * WITHOUT ANY WARRANTY; without even the implied warranty of
  18. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  19. * General Public License for more details.
  20. *
  21. * The full GNU General Public License is included in this distribution
  22. * in the file called COPYING.
  23. *
  24. * Contact Information:
  25. * Intel Linux Wireless <linuxwifi@intel.com>
  26. * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
  27. *
  28. * BSD LICENSE
  29. *
  30. * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved.
  31. * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH
  32. * Copyright(c) 2016 - 2017 Intel Deutschland GmbH
  33. * All rights reserved.
  34. *
  35. * Redistribution and use in source and binary forms, with or without
  36. * modification, are permitted provided that the following conditions
  37. * are met:
  38. *
  39. * * Redistributions of source code must retain the above copyright
  40. * notice, this list of conditions and the following disclaimer.
  41. * * Redistributions in binary form must reproduce the above copyright
  42. * notice, this list of conditions and the following disclaimer in
  43. * the documentation and/or other materials provided with the
  44. * distribution.
  45. * * Neither the name Intel Corporation nor the names of its
  46. * contributors may be used to endorse or promote products derived
  47. * from this software without specific prior written permission.
  48. *
  49. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  50. * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  51. * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  52. * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  53. * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  54. * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  55. * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  56. * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  57. * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  58. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  59. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  60. *
  61. *****************************************************************************/
  62. #ifndef __iwl_fw_api_phy_ctxt_h__
  63. #define __iwl_fw_api_phy_ctxt_h__
  64. /* Supported bands */
  65. #define PHY_BAND_5 (0)
  66. #define PHY_BAND_24 (1)
  67. /* Supported channel width, vary if there is VHT support */
  68. #define PHY_VHT_CHANNEL_MODE20 (0x0)
  69. #define PHY_VHT_CHANNEL_MODE40 (0x1)
  70. #define PHY_VHT_CHANNEL_MODE80 (0x2)
  71. #define PHY_VHT_CHANNEL_MODE160 (0x3)
  72. /*
  73. * Control channel position:
  74. * For legacy set bit means upper channel, otherwise lower.
  75. * For VHT - bit-2 marks if the control is lower/upper relative to center-freq
  76. * bits-1:0 mark the distance from the center freq. for 20Mhz, offset is 0.
  77. * center_freq
  78. * |
  79. * 40Mhz |_______|_______|
  80. * 80Mhz |_______|_______|_______|_______|
  81. * 160Mhz |_______|_______|_______|_______|_______|_______|_______|_______|
  82. * code 011 010 001 000 | 100 101 110 111
  83. */
  84. #define PHY_VHT_CTRL_POS_1_BELOW (0x0)
  85. #define PHY_VHT_CTRL_POS_2_BELOW (0x1)
  86. #define PHY_VHT_CTRL_POS_3_BELOW (0x2)
  87. #define PHY_VHT_CTRL_POS_4_BELOW (0x3)
  88. #define PHY_VHT_CTRL_POS_1_ABOVE (0x4)
  89. #define PHY_VHT_CTRL_POS_2_ABOVE (0x5)
  90. #define PHY_VHT_CTRL_POS_3_ABOVE (0x6)
  91. #define PHY_VHT_CTRL_POS_4_ABOVE (0x7)
  92. /*
  93. * @band: PHY_BAND_*
  94. * @channel: channel number
  95. * @width: PHY_[VHT|LEGACY]_CHANNEL_*
  96. * @ctrl channel: PHY_[VHT|LEGACY]_CTRL_*
  97. */
  98. struct iwl_fw_channel_info {
  99. u8 band;
  100. u8 channel;
  101. u8 width;
  102. u8 ctrl_pos;
  103. } __packed;
  104. #define PHY_RX_CHAIN_DRIVER_FORCE_POS (0)
  105. #define PHY_RX_CHAIN_DRIVER_FORCE_MSK \
  106. (0x1 << PHY_RX_CHAIN_DRIVER_FORCE_POS)
  107. #define PHY_RX_CHAIN_VALID_POS (1)
  108. #define PHY_RX_CHAIN_VALID_MSK \
  109. (0x7 << PHY_RX_CHAIN_VALID_POS)
  110. #define PHY_RX_CHAIN_FORCE_SEL_POS (4)
  111. #define PHY_RX_CHAIN_FORCE_SEL_MSK \
  112. (0x7 << PHY_RX_CHAIN_FORCE_SEL_POS)
  113. #define PHY_RX_CHAIN_FORCE_MIMO_SEL_POS (7)
  114. #define PHY_RX_CHAIN_FORCE_MIMO_SEL_MSK \
  115. (0x7 << PHY_RX_CHAIN_FORCE_MIMO_SEL_POS)
  116. #define PHY_RX_CHAIN_CNT_POS (10)
  117. #define PHY_RX_CHAIN_CNT_MSK \
  118. (0x3 << PHY_RX_CHAIN_CNT_POS)
  119. #define PHY_RX_CHAIN_MIMO_CNT_POS (12)
  120. #define PHY_RX_CHAIN_MIMO_CNT_MSK \
  121. (0x3 << PHY_RX_CHAIN_MIMO_CNT_POS)
  122. #define PHY_RX_CHAIN_MIMO_FORCE_POS (14)
  123. #define PHY_RX_CHAIN_MIMO_FORCE_MSK \
  124. (0x1 << PHY_RX_CHAIN_MIMO_FORCE_POS)
  125. /* TODO: fix the value, make it depend on firmware at runtime? */
  126. #define NUM_PHY_CTX 3
  127. /* TODO: complete missing documentation */
  128. /**
  129. * struct iwl_phy_context_cmd - config of the PHY context
  130. * ( PHY_CONTEXT_CMD = 0x8 )
  131. * @id_and_color: ID and color of the relevant Binding
  132. * @action: action to perform, one of FW_CTXT_ACTION_*
  133. * @apply_time: 0 means immediate apply and context switch.
  134. * other value means apply new params after X usecs
  135. * @tx_param_color: ???
  136. * @ci: channel info
  137. * @txchain_info: ???
  138. * @rxchain_info: ???
  139. * @acquisition_data: ???
  140. * @dsp_cfg_flags: set to 0
  141. */
  142. struct iwl_phy_context_cmd {
  143. /* COMMON_INDEX_HDR_API_S_VER_1 */
  144. __le32 id_and_color;
  145. __le32 action;
  146. /* PHY_CONTEXT_DATA_API_S_VER_1 */
  147. __le32 apply_time;
  148. __le32 tx_param_color;
  149. struct iwl_fw_channel_info ci;
  150. __le32 txchain_info;
  151. __le32 rxchain_info;
  152. __le32 acquisition_data;
  153. __le32 dsp_cfg_flags;
  154. } __packed; /* PHY_CONTEXT_CMD_API_VER_1 */
  155. #endif /* __iwl_fw_api_phy_ctxt_h__ */