halbtc8812a2ant.h 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227
  1. #if (BT_SUPPORT == 1 && COEX_SUPPORT == 1)
  2. #if (RTL8812A_SUPPORT == 1)
  3. /* *******************************************
  4. * The following is for 8812A 2Ant BT Co-exist definition
  5. * ******************************************* */
  6. #define BT_AUTO_REPORT_ONLY_8812A_2ANT 0
  7. #define BT_INFO_8812A_2ANT_B_FTP BIT(7)
  8. #define BT_INFO_8812A_2ANT_B_A2DP BIT(6)
  9. #define BT_INFO_8812A_2ANT_B_HID BIT(5)
  10. #define BT_INFO_8812A_2ANT_B_SCO_BUSY BIT(4)
  11. #define BT_INFO_8812A_2ANT_B_ACL_BUSY BIT(3)
  12. #define BT_INFO_8812A_2ANT_B_INQ_PAGE BIT(2)
  13. #define BT_INFO_8812A_2ANT_B_SCO_ESCO BIT(1)
  14. #define BT_INFO_8812A_2ANT_B_CONNECTION BIT(0)
  15. #define BT_INFO_8812A_2ANT_A2DP_BASIC_RATE(_BT_INFO_EXT_) \
  16. (((_BT_INFO_EXT_&BIT(0))) ? true : false)
  17. #define BTC_RSSI_COEX_THRESH_TOL_8812A_2ANT 2
  18. #define NOISY_AP_NUM_THRESH_8812A 50
  19. enum bt_info_src_8812a_2ant {
  20. BT_INFO_SRC_8812A_2ANT_WIFI_FW = 0x0,
  21. BT_INFO_SRC_8812A_2ANT_BT_RSP = 0x1,
  22. BT_INFO_SRC_8812A_2ANT_BT_ACTIVE_SEND = 0x2,
  23. BT_INFO_SRC_8812A_2ANT_MAX
  24. };
  25. enum bt_8812a_2ant_bt_status {
  26. BT_8812A_2ANT_BT_STATUS_NON_CONNECTED_IDLE = 0x0,
  27. BT_8812A_2ANT_BT_STATUS_CONNECTED_IDLE = 0x1,
  28. BT_8812A_2ANT_BT_STATUS_INQ_PAGE = 0x2,
  29. BT_8812A_2ANT_BT_STATUS_ACL_BUSY = 0x3,
  30. BT_8812A_2ANT_BT_STATUS_SCO_BUSY = 0x4,
  31. BT_8812A_2ANT_BT_STATUS_ACL_SCO_BUSY = 0x5,
  32. BT_8812A_2ANT_BT_STATUS_MAX
  33. };
  34. enum bt_8812a_2ant_coex_algo {
  35. BT_8812A_2ANT_COEX_ALGO_UNDEFINED = 0x0,
  36. BT_8812A_2ANT_COEX_ALGO_SCO = 0x1,
  37. BT_8812A_2ANT_COEX_ALGO_SCO_HID = 0x2,
  38. BT_8812A_2ANT_COEX_ALGO_HID = 0x3,
  39. BT_8812A_2ANT_COEX_ALGO_A2DP = 0x4,
  40. BT_8812A_2ANT_COEX_ALGO_A2DP_PANHS = 0x5,
  41. BT_8812A_2ANT_COEX_ALGO_PANEDR = 0x6,
  42. BT_8812A_2ANT_COEX_ALGO_PANHS = 0x7,
  43. BT_8812A_2ANT_COEX_ALGO_PANEDR_A2DP = 0x8,
  44. BT_8812A_2ANT_COEX_ALGO_PANEDR_HID = 0x9,
  45. BT_8812A_2ANT_COEX_ALGO_HID_A2DP_PANEDR = 0xa,
  46. BT_8812A_2ANT_COEX_ALGO_HID_A2DP_PANHS = 0xb,
  47. BT_8812A_2ANT_COEX_ALGO_HID_A2DP = 0xc,
  48. BT_8812A_2ANT_COEX_ALGO_MAX = 0xd
  49. };
  50. struct coex_dm_8812a_2ant {
  51. /* fw mechanism */
  52. u8 pre_bt_dec_pwr_lvl;
  53. u8 cur_bt_dec_pwr_lvl;
  54. u8 pre_fw_dac_swing_lvl;
  55. u8 cur_fw_dac_swing_lvl;
  56. boolean cur_ignore_wlan_act;
  57. boolean pre_ignore_wlan_act;
  58. u8 pre_ps_tdma;
  59. u8 cur_ps_tdma;
  60. u8 ps_tdma_para[5];
  61. u8 ps_tdma_du_adj_type;
  62. boolean auto_tdma_adjust;
  63. boolean auto_tdma_adjust_low_rssi;
  64. boolean pre_ps_tdma_on;
  65. boolean cur_ps_tdma_on;
  66. boolean pre_bt_auto_report;
  67. boolean cur_bt_auto_report;
  68. u8 pre_lps;
  69. u8 cur_lps;
  70. u8 pre_rpwm;
  71. u8 cur_rpwm;
  72. /* sw mechanism */
  73. boolean pre_rf_rx_lpf_shrink;
  74. boolean cur_rf_rx_lpf_shrink;
  75. u32 bt_rf_0x1e_backup;
  76. boolean pre_low_penalty_ra;
  77. boolean cur_low_penalty_ra;
  78. boolean pre_dac_swing_on;
  79. u32 pre_dac_swing_lvl;
  80. boolean cur_dac_swing_on;
  81. u32 cur_dac_swing_lvl;
  82. boolean pre_adc_back_off;
  83. boolean cur_adc_back_off;
  84. boolean pre_agc_table_en;
  85. boolean cur_agc_table_en;
  86. u32 pre_val0x6c0;
  87. u32 cur_val0x6c0;
  88. u32 pre_val0x6c4;
  89. u32 cur_val0x6c4;
  90. u32 pre_val0x6c8;
  91. u32 cur_val0x6c8;
  92. u8 pre_val0x6cc;
  93. u8 cur_val0x6cc;
  94. boolean limited_dig;
  95. u32 backup_arfr_cnt1; /* Auto Rate Fallback Retry cnt */
  96. u32 backup_arfr_cnt2; /* Auto Rate Fallback Retry cnt */
  97. u16 backup_retry_limit;
  98. u8 backup_ampdu_max_time;
  99. /* algorithm related */
  100. u8 pre_algorithm;
  101. u8 cur_algorithm;
  102. u8 bt_status;
  103. u8 wifi_chnl_info[3];
  104. u32 pre_ra_mask;
  105. u32 cur_ra_mask;
  106. u8 cur_ra_mask_type;
  107. u8 pre_arfr_type;
  108. u8 cur_arfr_type;
  109. u8 pre_retry_limit_type;
  110. u8 cur_retry_limit_type;
  111. u8 pre_ampdu_time_type;
  112. u8 cur_ampdu_time_type;
  113. boolean cur_enable_pta;
  114. boolean pre_enable_pta;
  115. };
  116. struct coex_sta_8812a_2ant {
  117. boolean bt_disabled;
  118. boolean bt_link_exist;
  119. boolean sco_exist;
  120. boolean a2dp_exist;
  121. boolean hid_exist;
  122. boolean pan_exist;
  123. boolean acl_busy;
  124. boolean under_lps;
  125. boolean under_ips;
  126. u32 high_priority_tx;
  127. u32 high_priority_rx;
  128. u32 low_priority_tx;
  129. u32 low_priority_rx;
  130. u8 bt_rssi;
  131. u8 pre_bt_rssi_state;
  132. u8 pre_wifi_rssi_state[4];
  133. boolean c2h_bt_info_req_sent;
  134. u8 bt_info_c2h[BT_INFO_SRC_8812A_2ANT_MAX][10];
  135. u32 bt_info_c2h_cnt[BT_INFO_SRC_8812A_2ANT_MAX];
  136. u32 bt_info_query_cnt;
  137. boolean c2h_bt_inquiry_page;
  138. u8 bt_retry_cnt;
  139. u8 bt_info_ext;
  140. u8 scan_ap_num;
  141. boolean pre_bt_disabled;
  142. u32 pre_bt_info_c2h_cnt_bt_rsp;
  143. u32 pre_bt_info_c2h_cnt_bt_send;
  144. boolean force_lps_on;
  145. u32 bt_coex_supported_version;
  146. u32 crc_ok_cck;
  147. u32 crc_ok_11g;
  148. u32 crc_ok_11n;
  149. u32 crc_ok_11n_vht;
  150. u32 crc_err_cck;
  151. u32 crc_err_11g;
  152. u32 crc_err_11n;
  153. u32 crc_err_11n_vht;
  154. };
  155. /* *******************************************
  156. * The following is interface which will notify coex module.
  157. * ******************************************* */
  158. void ex_halbtc8812a2ant_power_on_setting(IN struct btc_coexist *btcoexist);
  159. void ex_halbtc8812a2ant_init_hw_config(IN struct btc_coexist *btcoexist,
  160. IN boolean wifi_only);
  161. void ex_halbtc8812a2ant_init_coex_dm(IN struct btc_coexist *btcoexist);
  162. void ex_halbtc8812a2ant_ips_notify(IN struct btc_coexist *btcoexist,
  163. IN u8 type);
  164. void ex_halbtc8812a2ant_lps_notify(IN struct btc_coexist *btcoexist,
  165. IN u8 type);
  166. void ex_halbtc8812a2ant_scan_notify(IN struct btc_coexist *btcoexist,
  167. IN u8 type);
  168. void ex_halbtc8812a2ant_connect_notify(IN struct btc_coexist *btcoexist,
  169. IN u8 type);
  170. void ex_halbtc8812a2ant_media_status_notify(IN struct btc_coexist *btcoexist,
  171. IN u8 type);
  172. void ex_halbtc8812a2ant_specific_packet_notify(IN struct btc_coexist *btcoexist,
  173. IN u8 type);
  174. void ex_halbtc8812a2ant_bt_info_notify(IN struct btc_coexist *btcoexist,
  175. IN u8 *tmp_buf, IN u8 length);
  176. void ex_halbtc8812a2ant_rf_status_notify(IN struct btc_coexist *btcoexist,
  177. IN u8 type);
  178. void ex_halbtc8812a2ant_halt_notify(IN struct btc_coexist *btcoexist);
  179. void ex_halbtc8812a2ant_periodical(IN struct btc_coexist *btcoexist);
  180. void ex_halbtc8812a2ant_display_coex_info(IN struct btc_coexist *btcoexist);
  181. void ex_halbtc8812a2ant_dbg_control(IN struct btc_coexist *btcoexist,
  182. IN u8 op_code, IN u8 op_len, IN u8 *pdata);
  183. void ex_halbtc8812a2ant_pta_off_on_notify(IN struct btc_coexist *btcoexist,
  184. IN u8 bt_status);
  185. #else
  186. #define ex_halbtc8812a2ant_power_on_setting(btcoexist)
  187. #define ex_halbtc8812a2ant_init_hw_config(btcoexist, wifi_only)
  188. #define ex_halbtc8812a2ant_init_coex_dm(btcoexist)
  189. #define ex_halbtc8812a2ant_ips_notify(btcoexist, type)
  190. #define ex_halbtc8812a2ant_lps_notify(btcoexist, type)
  191. #define ex_halbtc8812a2ant_scan_notify(btcoexist, type)
  192. #define ex_halbtc8812a2ant_connect_notify(btcoexist, type)
  193. #define ex_halbtc8812a2ant_media_status_notify(btcoexist, type)
  194. #define ex_halbtc8812a2ant_specific_packet_notify(btcoexist, type)
  195. #define ex_halbtc8812a2ant_bt_info_notify(btcoexist, tmp_buf, length)
  196. #define ex_halbtc8812a2ant_rf_status_notify(btcoexist, type)
  197. #define ex_halbtc8812a2ant_halt_notify(btcoexist)
  198. #define ex_halbtc8812a2ant_periodical(btcoexist)
  199. #define ex_halbtc8812a2ant_display_coex_info(btcoexist)
  200. #define ex_halbtc8812a2ant_dbg_control(btcoexist, op_code, op_len, pdata)
  201. #define ex_halbtc8812a2ant_pta_off_on_notify(btcoexist, bt_status)
  202. #endif
  203. #endif