halbtc8821a2ant.h 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234
  1. /******************************************************************************
  2. *
  3. * Copyright(c) 2012 Realtek Corporation.
  4. *
  5. * This program is free software; you can redistribute it and/or modify it
  6. * under the terms of version 2 of the GNU General Public License as
  7. * published by the Free Software Foundation.
  8. *
  9. * This program is distributed in the hope that it will be useful, but WITHOUT
  10. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11. * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
  12. * more details.
  13. *
  14. * The full GNU General Public License is included in this distribution in the
  15. * file called LICENSE.
  16. *
  17. * Contact Information:
  18. * wlanfae <wlanfae@realtek.com>
  19. * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
  20. * Hsinchu 300, Taiwan.
  21. *
  22. * Larry Finger <Larry.Finger@lwfinger.net>
  23. *
  24. *****************************************************************************/
  25. /*===========================================
  26. * The following is for 8821A 2Ant BT Co-exist definition
  27. *===========================================
  28. */
  29. #define BT_INFO_8821A_2ANT_B_FTP BIT7
  30. #define BT_INFO_8821A_2ANT_B_A2DP BIT6
  31. #define BT_INFO_8821A_2ANT_B_HID BIT5
  32. #define BT_INFO_8821A_2ANT_B_SCO_BUSY BIT4
  33. #define BT_INFO_8821A_2ANT_B_ACL_BUSY BIT3
  34. #define BT_INFO_8821A_2ANT_B_INQ_PAGE BIT2
  35. #define BT_INFO_8821A_2ANT_B_SCO_ESCO BIT1
  36. #define BT_INFO_8821A_2ANT_B_CONNECTION BIT0
  37. #define BTC_RSSI_COEX_THRESH_TOL_8821A_2ANT 2
  38. /* WiFi RSSI Threshold for 2-Ant TDMA/1-Ant PS-TDMA translation */
  39. #define BT_8821A_2ANT_WIFI_RSSI_COEXSWITCH_THRES 42
  40. /* BT RSSI Threshold for 2-Ant TDMA/1-Ant PS-TDMA translation */
  41. #define BT_8821A_2ANT_BT_RSSI_COEXSWITCH_THRES 46
  42. enum _BT_INFO_SRC_8821A_2ANT {
  43. BT_INFO_SRC_8821A_2ANT_WIFI_FW = 0x0,
  44. BT_INFO_SRC_8821A_2ANT_BT_RSP = 0x1,
  45. BT_INFO_SRC_8821A_2ANT_BT_ACTIVE_SEND = 0x2,
  46. BT_INFO_SRC_8821A_2ANT_MAX
  47. };
  48. enum _BT_8821A_2ANT_BT_STATUS {
  49. BT_8821A_2ANT_BT_STATUS_IDLE = 0x0,
  50. BT_8821A_2ANT_BT_STATUS_CON_IDLE = 0x1,
  51. BT_8821A_2ANT_BT_STATUS_NON_IDLE = 0x2,
  52. BT_8821A_2ANT_BT_STATUS_ACL_BUSY = 0x3,
  53. BT_8821A_2ANT_BT_STATUS_SCO_BUSY = 0x4,
  54. BT_8821A_2ANT_BT_STATUS_ACL_SCO_BUSY = 0x5,
  55. BT_8821A_2ANT_BT_STATUS_MAX
  56. };
  57. enum _BT_8821A_2ANT_COEX_ALGO {
  58. BT_8821A_2ANT_COEX_ALGO_UNDEFINED = 0x0,
  59. BT_8821A_2ANT_COEX_ALGO_SCO = 0x1,
  60. BT_8821A_2ANT_COEX_ALGO_HID = 0x2,
  61. BT_8821A_2ANT_COEX_ALGO_A2DP = 0x3,
  62. BT_8821A_2ANT_COEX_ALGO_A2DP_PANHS = 0x4,
  63. BT_8821A_2ANT_COEX_ALGO_PANEDR = 0x5,
  64. BT_8821A_2ANT_COEX_ALGO_PANHS = 0x6,
  65. BT_8821A_2ANT_COEX_ALGO_PANEDR_A2DP = 0x7,
  66. BT_8821A_2ANT_COEX_ALGO_PANEDR_HID = 0x8,
  67. BT_8821A_2ANT_COEX_ALGO_HID_A2DP_PANEDR = 0x9,
  68. BT_8821A_2ANT_COEX_ALGO_HID_A2DP = 0xa,
  69. BT_8821A_2ANT_COEX_ALGO_MAX = 0xb,
  70. };
  71. struct coex_dm_8821a_2ant {
  72. /* fw mechanism */
  73. bool pre_dec_bt_pwr_lvl;
  74. bool cur_dec_bt_pwr_lvl;
  75. u8 pre_fw_dac_swing_lvl;
  76. u8 cur_fw_dac_swing_lvl;
  77. bool cur_ignore_wlan_act;
  78. bool pre_ignore_wlan_act;
  79. u8 pre_ps_tdma;
  80. u8 cur_ps_tdma;
  81. u8 ps_tdma_para[5];
  82. u8 ps_tdma_du_adj_type;
  83. bool reset_tdma_adjust;
  84. bool auto_tdma_adjust;
  85. bool pre_ps_tdma_on;
  86. bool cur_ps_tdma_on;
  87. bool pre_bt_auto_report;
  88. bool cur_bt_auto_report;
  89. /* sw mechanism */
  90. bool pre_rf_rx_lpf_shrink;
  91. bool cur_rf_rx_lpf_shrink;
  92. u32 bt_rf0x1e_backup;
  93. bool pre_low_penalty_ra;
  94. bool cur_low_penalty_ra;
  95. bool pre_dac_swing_on;
  96. u32 pre_dac_swing_lvl;
  97. bool cur_dac_swing_on;
  98. u32 cur_dac_swing_lvl;
  99. bool pre_adc_back_off;
  100. bool cur_adc_back_off;
  101. bool pre_agc_table_en;
  102. bool cur_agc_table_en;
  103. u32 pre_val0x6c0;
  104. u32 cur_val0x6c0;
  105. u32 pre_val0x6c4;
  106. u32 cur_val0x6c4;
  107. u32 pre_val0x6c8;
  108. u32 cur_val0x6c8;
  109. u8 pre_val0x6cc;
  110. u8 cur_val0x6cc;
  111. bool limited_dig;
  112. /* algorithm related */
  113. u8 pre_algorithm;
  114. u8 cur_algorithm;
  115. u8 bt_status;
  116. u8 wifi_chnl_info[3];
  117. u8 pre_lps;
  118. u8 cur_lps;
  119. u8 pre_rpwm;
  120. u8 cur_rpwm;
  121. };
  122. struct coex_sta_8821a_2ant {
  123. bool bt_link_exist;
  124. bool sco_exist;
  125. bool a2dp_exist;
  126. bool hid_exist;
  127. bool pan_exist;
  128. bool under_lps;
  129. bool under_ips;
  130. u32 high_priority_tx;
  131. u32 high_priority_rx;
  132. u32 low_priority_tx;
  133. u32 low_priority_rx;
  134. u8 bt_rssi;
  135. bool bt_tx_rx_mask;
  136. u8 pre_bt_rssi_state;
  137. u8 pre_wifi_rssi_state[4];
  138. bool c2h_bt_info_req_sent;
  139. u8 bt_info_c2h[BT_INFO_SRC_8821A_2ANT_MAX][10];
  140. u32 bt_info_c2h_cnt[BT_INFO_SRC_8821A_2ANT_MAX];
  141. bool c2h_bt_inquiry_page;
  142. u8 bt_retry_cnt;
  143. u8 bt_info_ext;
  144. u32 crc_ok_cck;
  145. u32 crc_ok_11g;
  146. u32 crc_ok_11n;
  147. u32 crc_ok_11n_agg;
  148. u32 crc_err_cck;
  149. u32 crc_err_11g;
  150. u32 crc_err_11n;
  151. u32 crc_err_11n_agg;
  152. u8 coex_table_type;
  153. bool force_lps_on;
  154. u8 dis_ver_info_cnt;
  155. };
  156. /*===========================================
  157. * The following is interface which will notify coex module.
  158. *===========================================
  159. */
  160. void
  161. ex_btc8821a2ant_init_hwconfig(
  162. struct btc_coexist *btcoexist
  163. );
  164. void
  165. ex_btc8821a2ant_init_coex_dm(
  166. struct btc_coexist *btcoexist
  167. );
  168. void
  169. ex_btc8821a2ant_ips_notify(
  170. struct btc_coexist *btcoexist,
  171. u8 type
  172. );
  173. void
  174. ex_btc8821a2ant_lps_notify(
  175. struct btc_coexist *btcoexist,
  176. u8 type
  177. );
  178. void
  179. ex_btc8821a2ant_scan_notify(
  180. struct btc_coexist *btcoexist,
  181. u8 type
  182. );
  183. void
  184. ex_btc8821a2ant_connect_notify(
  185. struct btc_coexist *btcoexist,
  186. u8 type
  187. );
  188. void
  189. ex_btc8821a2ant_media_status_notify(
  190. struct btc_coexist *btcoexist,
  191. u8 type
  192. );
  193. void
  194. ex_btc8821a2ant_special_packet_notify(
  195. struct btc_coexist *btcoexist,
  196. u8 type
  197. );
  198. void
  199. ex_btc8821a2ant_bt_info_notify(
  200. struct btc_coexist *btcoexist,
  201. u8 *tmp_buf,
  202. u8 length
  203. );
  204. void
  205. ex_btc8821a2ant_halt_notify(
  206. struct btc_coexist *btcoexist
  207. );
  208. void
  209. ex_btc8821a2ant_periodical(
  210. struct btc_coexist *btcoexist
  211. );
  212. void
  213. ex_btc8821a2ant_display_coex_info(
  214. struct btc_coexist *btcoexist,
  215. struct seq_file *m
  216. );
  217. void ex_btc8821a2ant_pnp_notify(struct btc_coexist *btcoexist, u8 pnp_state);
  218. void ex_btc8821a2ant_pre_load_firmware(struct btc_coexist *btcoexist);