halbtc8812a1ant.h 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230
  1. #if (BT_SUPPORT == 1 && COEX_SUPPORT == 1)
  2. #if (RTL8812A_SUPPORT == 1)
  3. /* *******************************************
  4. * The following is for 8812A 1ANT BT Co-exist definition
  5. * ******************************************* */
  6. #define BT_AUTO_REPORT_ONLY_8812A_1ANT 1
  7. #define BT_INFO_8812A_1ANT_B_FTP BIT(7)
  8. #define BT_INFO_8812A_1ANT_B_A2DP BIT(6)
  9. #define BT_INFO_8812A_1ANT_B_HID BIT(5)
  10. #define BT_INFO_8812A_1ANT_B_SCO_BUSY BIT(4)
  11. #define BT_INFO_8812A_1ANT_B_ACL_BUSY BIT(3)
  12. #define BT_INFO_8812A_1ANT_B_INQ_PAGE BIT(2)
  13. #define BT_INFO_8812A_1ANT_B_SCO_ESCO BIT(1)
  14. #define BT_INFO_8812A_1ANT_B_CONNECTION BIT(0)
  15. #define BT_INFO_8812A_1ANT_A2DP_BASIC_RATE(_BT_INFO_EXT_) \
  16. (((_BT_INFO_EXT_&BIT(0))) ? true : false)
  17. #define BTC_RSSI_COEX_THRESH_TOL_8812A_1ANT 2
  18. #define BT_8812A_1ANT_WIFI_NOISY_THRESH 30 /* max: 255 */
  19. enum bt_info_src_8812a_1ant {
  20. BT_INFO_SRC_8812A_1ANT_WIFI_FW = 0x0,
  21. BT_INFO_SRC_8812A_1ANT_BT_RSP = 0x1,
  22. BT_INFO_SRC_8812A_1ANT_BT_ACTIVE_SEND = 0x2,
  23. BT_INFO_SRC_8812A_1ANT_MAX
  24. };
  25. enum bt_8812a_1ant_bt_status {
  26. BT_8812A_1ANT_BT_STATUS_NON_CONNECTED_IDLE = 0x0,
  27. BT_8812A_1ANT_BT_STATUS_CONNECTED_IDLE = 0x1,
  28. BT_8812A_1ANT_BT_STATUS_INQ_PAGE = 0x2,
  29. BT_8812A_1ANT_BT_STATUS_ACL_BUSY = 0x3,
  30. BT_8812A_1ANT_BT_STATUS_SCO_BUSY = 0x4,
  31. BT_8812A_1ANT_BT_STATUS_ACL_SCO_BUSY = 0x5,
  32. BT_8812A_1ANT_BT_STATUS_MAX
  33. };
  34. enum bt_8812a_1ant_wifi_status {
  35. BT_8812A_1ANT_WIFI_STATUS_NON_CONNECTED_IDLE = 0x0,
  36. BT_8812A_1ANT_WIFI_STATUS_NON_CONNECTED_ASSO_AUTH_SCAN = 0x1,
  37. BT_8812A_1ANT_WIFI_STATUS_CONNECTED_SCAN = 0x2,
  38. BT_8812A_1ANT_WIFI_STATUS_CONNECTED_SPECIFIC_PKT = 0x3,
  39. BT_8812A_1ANT_WIFI_STATUS_CONNECTED_IDLE = 0x4,
  40. BT_8812A_1ANT_WIFI_STATUS_CONNECTED_BUSY = 0x5,
  41. BT_8812A_1ANT_WIFI_STATUS_MAX
  42. };
  43. enum bt_8812a_1ant_coex_algo {
  44. BT_8812A_1ANT_COEX_ALGO_UNDEFINED = 0x0,
  45. BT_8812A_1ANT_COEX_ALGO_SCO = 0x1,
  46. BT_8812A_1ANT_COEX_ALGO_HID = 0x2,
  47. BT_8812A_1ANT_COEX_ALGO_A2DP = 0x3,
  48. BT_8812A_1ANT_COEX_ALGO_A2DP_PANHS = 0x4,
  49. BT_8812A_1ANT_COEX_ALGO_PANEDR = 0x5,
  50. BT_8812A_1ANT_COEX_ALGO_PANHS = 0x6,
  51. BT_8812A_1ANT_COEX_ALGO_PANEDR_A2DP = 0x7,
  52. BT_8812A_1ANT_COEX_ALGO_PANEDR_HID = 0x8,
  53. BT_8812A_1ANT_COEX_ALGO_HID_A2DP_PANEDR = 0x9,
  54. BT_8812A_1ANT_COEX_ALGO_HID_A2DP = 0xa,
  55. BT_8812A_1ANT_COEX_ALGO_MAX = 0xb,
  56. };
  57. struct coex_dm_8812a_1ant {
  58. /* hw setting */
  59. u8 pre_ant_pos_type;
  60. u8 cur_ant_pos_type;
  61. /* fw mechanism */
  62. boolean cur_ignore_wlan_act;
  63. boolean pre_ignore_wlan_act;
  64. u8 pre_ps_tdma;
  65. u8 cur_ps_tdma;
  66. u8 ps_tdma_para[5];
  67. u8 ps_tdma_du_adj_type;
  68. boolean auto_tdma_adjust;
  69. boolean pre_ps_tdma_on;
  70. boolean cur_ps_tdma_on;
  71. boolean pre_bt_auto_report;
  72. boolean cur_bt_auto_report;
  73. u8 pre_lps;
  74. u8 cur_lps;
  75. u8 pre_rpwm;
  76. u8 cur_rpwm;
  77. /* sw mechanism */
  78. boolean pre_low_penalty_ra;
  79. boolean cur_low_penalty_ra;
  80. u32 pre_val0x6c0;
  81. u32 cur_val0x6c0;
  82. u32 pre_val0x6c4;
  83. u32 cur_val0x6c4;
  84. u32 pre_val0x6c8;
  85. u32 cur_val0x6c8;
  86. u8 pre_val0x6cc;
  87. u8 cur_val0x6cc;
  88. boolean limited_dig;
  89. u32 backup_arfr_cnt1; /* Auto Rate Fallback Retry cnt */
  90. u32 backup_arfr_cnt2; /* Auto Rate Fallback Retry cnt */
  91. u16 backup_retry_limit;
  92. u8 backup_ampdu_max_time;
  93. /* algorithm related */
  94. u8 pre_algorithm;
  95. u8 cur_algorithm;
  96. u8 bt_status;
  97. u8 wifi_chnl_info[3];
  98. u32 pre_ra_mask;
  99. u32 cur_ra_mask;
  100. u8 pre_arfr_type;
  101. u8 cur_arfr_type;
  102. u8 pre_retry_limit_type;
  103. u8 cur_retry_limit_type;
  104. u8 pre_ampdu_time_type;
  105. u8 cur_ampdu_time_type;
  106. u32 arp_cnt;
  107. u8 error_condition;
  108. };
  109. struct coex_sta_8812a_1ant {
  110. boolean bt_disabled;
  111. boolean bt_link_exist;
  112. boolean sco_exist;
  113. boolean a2dp_exist;
  114. boolean hid_exist;
  115. boolean pan_exist;
  116. boolean under_lps;
  117. boolean under_ips;
  118. u32 specific_pkt_period_cnt;
  119. u32 high_priority_tx;
  120. u32 high_priority_rx;
  121. u32 low_priority_tx;
  122. u32 low_priority_rx;
  123. s8 bt_rssi;
  124. boolean bt_tx_rx_mask;
  125. u8 pre_bt_rssi_state;
  126. u8 pre_wifi_rssi_state[4];
  127. boolean c2h_bt_info_req_sent;
  128. u8 bt_info_c2h[BT_INFO_SRC_8812A_1ANT_MAX][10];
  129. u32 bt_info_c2h_cnt[BT_INFO_SRC_8812A_1ANT_MAX];
  130. u32 bt_info_query_cnt;
  131. boolean c2h_bt_inquiry_page;
  132. boolean c2h_bt_page; /* Add for win8.1 page out issue */
  133. boolean wifi_is_high_pri_task; /* Add for win8.1 page out issue */
  134. u8 bt_retry_cnt;
  135. u8 bt_info_ext;
  136. u32 pop_event_cnt;
  137. u8 scan_ap_num;
  138. u32 crc_ok_cck;
  139. u32 crc_ok_11g;
  140. u32 crc_ok_11n;
  141. u32 crc_ok_11n_agg;
  142. u32 crc_err_cck;
  143. u32 crc_err_11g;
  144. u32 crc_err_11n;
  145. u32 crc_err_11n_agg;
  146. boolean cck_lock;
  147. boolean pre_ccklock;
  148. u8 coex_table_type;
  149. boolean force_lps_on;
  150. };
  151. /* *******************************************
  152. * The following is interface which will notify coex module.
  153. * ******************************************* */
  154. void ex_halbtc8812a1ant_power_on_setting(IN struct btc_coexist *btcoexist);
  155. void ex_halbtc8812a1ant_pre_load_firmware(IN struct btc_coexist *btcoexist);
  156. void ex_halbtc8812a1ant_init_hw_config(IN struct btc_coexist *btcoexist,
  157. IN boolean wifi_only);
  158. void ex_halbtc8812a1ant_init_coex_dm(IN struct btc_coexist *btcoexist);
  159. void ex_halbtc8812a1ant_ips_notify(IN struct btc_coexist *btcoexist,
  160. IN u8 type);
  161. void ex_halbtc8812a1ant_lps_notify(IN struct btc_coexist *btcoexist,
  162. IN u8 type);
  163. void ex_halbtc8812a1ant_scan_notify(IN struct btc_coexist *btcoexist,
  164. IN u8 type);
  165. void ex_halbtc8812a1ant_connect_notify(IN struct btc_coexist *btcoexist,
  166. IN u8 type);
  167. void ex_halbtc8812a1ant_media_status_notify(IN struct btc_coexist *btcoexist,
  168. IN u8 type);
  169. void ex_halbtc8812a1ant_specific_packet_notify(IN struct btc_coexist *btcoexist,
  170. IN u8 type);
  171. void ex_halbtc8812a1ant_bt_info_notify(IN struct btc_coexist *btcoexist,
  172. IN u8 *tmp_buf, IN u8 length);
  173. void ex_halbtc8812a1ant_rf_status_notify(IN struct btc_coexist *btcoexist,
  174. IN u8 type);
  175. void ex_halbtc8812a1ant_halt_notify(IN struct btc_coexist *btcoexist);
  176. void ex_halbtc8812a1ant_pnp_notify(IN struct btc_coexist *btcoexist,
  177. IN u8 pnp_state);
  178. void ex_halbtc8812a1ant_coex_dm_reset(IN struct btc_coexist *btcoexist);
  179. void ex_halbtc8812a1ant_periodical(IN struct btc_coexist *btcoexist);
  180. void ex_halbtc8812a1ant_dbg_control(IN struct btc_coexist *btcoexist,
  181. IN u8 op_code, IN u8 op_len, IN u8 *pdata);
  182. void ex_halbtc8812a1ant_display_coex_info(IN struct btc_coexist *btcoexist);
  183. #else
  184. #define ex_halbtc8812a1ant_power_on_setting(btcoexist)
  185. #define ex_halbtc8812a1ant_pre_load_firmware(btcoexist)
  186. #define ex_halbtc8812a1ant_init_hw_config(btcoexist, wifi_only)
  187. #define ex_halbtc8812a1ant_init_coex_dm(btcoexist)
  188. #define ex_halbtc8812a1ant_ips_notify(btcoexist, type)
  189. #define ex_halbtc8812a1ant_lps_notify(btcoexist, type)
  190. #define ex_halbtc8812a1ant_scan_notify(btcoexist, type)
  191. #define ex_halbtc8812a1ant_connect_notify(btcoexist, type)
  192. #define ex_halbtc8812a1ant_media_status_notify(btcoexist, type)
  193. #define ex_halbtc8812a1ant_specific_packet_notify(btcoexist, type)
  194. #define ex_halbtc8812a1ant_bt_info_notify(btcoexist, tmp_buf, length)
  195. #define ex_halbtc8812a1ant_rf_status_notify(btcoexist, type)
  196. #define ex_halbtc8812a1ant_halt_notify(btcoexist)
  197. #define ex_halbtc8812a1ant_pnp_notify(btcoexist, pnp_state)
  198. #define ex_halbtc8812a1ant_coex_dm_reset(btcoexist)
  199. #define ex_halbtc8812a1ant_periodical(btcoexist)
  200. #define ex_halbtc8812a1ant_dbg_control(btcoexist, op_code, op_len, pdata)
  201. #define ex_halbtc8812a1ant_display_coex_info(btcoexist)
  202. #endif
  203. #endif