halbtc8192e2ant.h 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185
  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 8192E 2Ant BT Co-exist definition
  27. *****************************************************************/
  28. #define BT_AUTO_REPORT_ONLY_8192E_2ANT 0
  29. #define BT_INFO_8192E_2ANT_B_FTP BIT7
  30. #define BT_INFO_8192E_2ANT_B_A2DP BIT6
  31. #define BT_INFO_8192E_2ANT_B_HID BIT5
  32. #define BT_INFO_8192E_2ANT_B_SCO_BUSY BIT4
  33. #define BT_INFO_8192E_2ANT_B_ACL_BUSY BIT3
  34. #define BT_INFO_8192E_2ANT_B_INQ_PAGE BIT2
  35. #define BT_INFO_8192E_2ANT_B_SCO_ESCO BIT1
  36. #define BT_INFO_8192E_2ANT_B_CONNECTION BIT0
  37. #define BTC_RSSI_COEX_THRESH_TOL_8192E_2ANT 2
  38. enum bt_info_src_8192e_2ant {
  39. BT_INFO_SRC_8192E_2ANT_WIFI_FW = 0x0,
  40. BT_INFO_SRC_8192E_2ANT_BT_RSP = 0x1,
  41. BT_INFO_SRC_8192E_2ANT_BT_ACTIVE_SEND = 0x2,
  42. BT_INFO_SRC_8192E_2ANT_MAX
  43. };
  44. enum bt_8192e_2ant_bt_status {
  45. BT_8192E_2ANT_BT_STATUS_NON_CONNECTED_IDLE = 0x0,
  46. BT_8192E_2ANT_BT_STATUS_CONNECTED_IDLE = 0x1,
  47. BT_8192E_2ANT_BT_STATUS_INQ_PAGE = 0x2,
  48. BT_8192E_2ANT_BT_STATUS_ACL_BUSY = 0x3,
  49. BT_8192E_2ANT_BT_STATUS_SCO_BUSY = 0x4,
  50. BT_8192E_2ANT_BT_STATUS_ACL_SCO_BUSY = 0x5,
  51. BT_8192E_2ANT_BT_STATUS_MAX
  52. };
  53. enum bt_8192e_2ant_coex_algo {
  54. BT_8192E_2ANT_COEX_ALGO_UNDEFINED = 0x0,
  55. BT_8192E_2ANT_COEX_ALGO_SCO = 0x1,
  56. BT_8192E_2ANT_COEX_ALGO_SCO_PAN = 0x2,
  57. BT_8192E_2ANT_COEX_ALGO_HID = 0x3,
  58. BT_8192E_2ANT_COEX_ALGO_A2DP = 0x4,
  59. BT_8192E_2ANT_COEX_ALGO_A2DP_PANHS = 0x5,
  60. BT_8192E_2ANT_COEX_ALGO_PANEDR = 0x6,
  61. BT_8192E_2ANT_COEX_ALGO_PANHS = 0x7,
  62. BT_8192E_2ANT_COEX_ALGO_PANEDR_A2DP = 0x8,
  63. BT_8192E_2ANT_COEX_ALGO_PANEDR_HID = 0x9,
  64. BT_8192E_2ANT_COEX_ALGO_HID_A2DP_PANEDR = 0xa,
  65. BT_8192E_2ANT_COEX_ALGO_HID_A2DP = 0xb,
  66. BT_8192E_2ANT_COEX_ALGO_MAX = 0xc
  67. };
  68. struct coex_dm_8192e_2ant {
  69. /* fw mechanism */
  70. u8 pre_dec_bt_pwr;
  71. u8 cur_dec_bt_pwr;
  72. u8 pre_fw_dac_swing_lvl;
  73. u8 cur_fw_dac_swing_lvl;
  74. bool cur_ignore_wlan_act;
  75. bool pre_ignore_wlan_act;
  76. u8 pre_ps_tdma;
  77. u8 cur_ps_tdma;
  78. u8 ps_tdma_para[5];
  79. u8 tdma_adj_type;
  80. bool reset_tdma_adjust;
  81. bool auto_tdma_adjust;
  82. bool pre_ps_tdma_on;
  83. bool cur_ps_tdma_on;
  84. bool pre_bt_auto_report;
  85. bool cur_bt_auto_report;
  86. /* sw mechanism */
  87. bool pre_rf_rx_lpf_shrink;
  88. bool cur_rf_rx_lpf_shrink;
  89. u32 bt_rf0x1e_backup;
  90. bool pre_low_penalty_ra;
  91. bool cur_low_penalty_ra;
  92. bool pre_dac_swing_on;
  93. u32 pre_dac_swing_lvl;
  94. bool cur_dac_swing_on;
  95. u32 cur_dac_swing_lvl;
  96. bool pre_adc_back_off;
  97. bool cur_adc_back_off;
  98. bool pre_agc_table_en;
  99. bool cur_agc_table_en;
  100. u32 pre_val0x6c0;
  101. u32 cur_val0x6c0;
  102. u32 pre_val0x6c4;
  103. u32 cur_val0x6c4;
  104. u32 pre_val0x6c8;
  105. u32 cur_val0x6c8;
  106. u8 pre_val0x6cc;
  107. u8 cur_val0x6cc;
  108. bool limited_dig;
  109. u32 backup_arfr_cnt1; /* Auto Rate Fallback Retry cnt */
  110. u32 backup_arfr_cnt2; /* Auto Rate Fallback Retry cnt */
  111. u16 backup_retrylimit;
  112. u8 backup_ampdu_maxtime;
  113. /* algorithm related */
  114. u8 pre_algorithm;
  115. u8 cur_algorithm;
  116. u8 bt_status;
  117. u8 wifi_chnl_info[3];
  118. u8 pre_sstype;
  119. u8 cur_sstype;
  120. u32 prera_mask;
  121. u32 curra_mask;
  122. u8 curra_masktype;
  123. u8 pre_arfrtype;
  124. u8 cur_arfrtype;
  125. u8 pre_retrylimit_type;
  126. u8 cur_retrylimit_type;
  127. u8 pre_ampdutime_type;
  128. u8 cur_ampdutime_type;
  129. };
  130. struct coex_sta_8192e_2ant {
  131. bool bt_link_exist;
  132. bool sco_exist;
  133. bool a2dp_exist;
  134. bool hid_exist;
  135. bool pan_exist;
  136. bool under_lps;
  137. bool under_ips;
  138. u32 high_priority_tx;
  139. u32 high_priority_rx;
  140. u32 low_priority_tx;
  141. u32 low_priority_rx;
  142. u8 bt_rssi;
  143. u8 pre_bt_rssi_state;
  144. u8 pre_wifi_rssi_state[4];
  145. bool c2h_bt_info_req_sent;
  146. u8 bt_info_c2h[BT_INFO_SRC_8192E_2ANT_MAX][10];
  147. u32 bt_info_c2h_cnt[BT_INFO_SRC_8192E_2ANT_MAX];
  148. bool c2h_bt_inquiry_page;
  149. u8 bt_retry_cnt;
  150. u8 bt_info_ext;
  151. };
  152. /****************************************************************
  153. * The following is interface which will notify coex module.
  154. ****************************************************************/
  155. void ex_halbtc8192e2ant_init_hwconfig(struct btc_coexist *btcoexist);
  156. void ex_halbtc8192e2ant_init_coex_dm(struct btc_coexist *btcoexist);
  157. void ex_halbtc8192e2ant_ips_notify(struct btc_coexist *btcoexist, u8 type);
  158. void ex_halbtc8192e2ant_lps_notify(struct btc_coexist *btcoexist, u8 type);
  159. void ex_halbtc8192e2ant_scan_notify(struct btc_coexist *btcoexist, u8 type);
  160. void ex_halbtc8192e2ant_connect_notify(struct btc_coexist *btcoexist, u8 type);
  161. void ex_halbtc8192e2ant_media_status_notify(struct btc_coexist *btcoexist,
  162. u8 type);
  163. void ex_halbtc8192e2ant_special_packet_notify(struct btc_coexist *btcoexist,
  164. u8 type);
  165. void ex_halbtc8192e2ant_bt_info_notify(struct btc_coexist *btcoexist,
  166. u8 *tmpbuf, u8 length);
  167. void ex_halbtc8192e2ant_stack_operation_notify(struct btc_coexist *btcoexist,
  168. u8 type);
  169. void ex_halbtc8192e2ant_halt_notify(struct btc_coexist *btcoexist);
  170. void ex_halbtc8192e2ant_periodical(struct btc_coexist *btcoexist);
  171. void ex_halbtc8192e2ant_display_coex_info(struct btc_coexist *btcoexist);