halbtc8723b2ant.h 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205
  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. #ifndef _HAL8723B_2_ANT
  26. #define _HAL8723B_2_ANT
  27. /************************************************************************
  28. * The following is for 8723B 2Ant BT Co-exist definition
  29. ************************************************************************/
  30. #define BT_INFO_8723B_2ANT_B_FTP BIT7
  31. #define BT_INFO_8723B_2ANT_B_A2DP BIT6
  32. #define BT_INFO_8723B_2ANT_B_HID BIT5
  33. #define BT_INFO_8723B_2ANT_B_SCO_BUSY BIT4
  34. #define BT_INFO_8723B_2ANT_B_ACL_BUSY BIT3
  35. #define BT_INFO_8723B_2ANT_B_INQ_PAGE BIT2
  36. #define BT_INFO_8723B_2ANT_B_SCO_ESCO BIT1
  37. #define BT_INFO_8723B_2ANT_B_CONNECTION BIT0
  38. #define BTC_RSSI_COEX_THRESH_TOL_8723B_2ANT 2
  39. /* WiFi RSSI Threshold for 2-Ant TDMA/1-Ant PS-TDMA translation */
  40. #define BT_8723B_2ANT_WIFI_RSSI_COEXSWITCH_THRES 42
  41. /* BT RSSI Threshold for 2-Ant TDMA/1-Ant PS-TDMA translation */
  42. #define BT_8723B_2ANT_BT_RSSI_COEXSWITCH_THRES 46
  43. enum BT_INFO_SRC_8723B_2ANT {
  44. BT_INFO_SRC_8723B_2ANT_WIFI_FW = 0x0,
  45. BT_INFO_SRC_8723B_2ANT_BT_RSP = 0x1,
  46. BT_INFO_SRC_8723B_2ANT_BT_ACTIVE_SEND = 0x2,
  47. BT_INFO_SRC_8723B_2ANT_MAX
  48. };
  49. enum BT_8723B_2ANT_BT_STATUS {
  50. BT_8723B_2ANT_BT_STATUS_NON_CONNECTED_IDLE = 0x0,
  51. BT_8723B_2ANT_BT_STATUS_CONNECTED_IDLE = 0x1,
  52. BT_8723B_2ANT_BT_STATUS_INQ_PAGE = 0x2,
  53. BT_8723B_2ANT_BT_STATUS_ACL_BUSY = 0x3,
  54. BT_8723B_2ANT_BT_STATUS_SCO_BUSY = 0x4,
  55. BT_8723B_2ANT_BT_STATUS_ACL_SCO_BUSY = 0x5,
  56. BT_8723B_2ANT_BT_STATUS_MAX
  57. };
  58. enum BT_8723B_2ANT_COEX_ALGO {
  59. BT_8723B_2ANT_COEX_ALGO_UNDEFINED = 0x0,
  60. BT_8723B_2ANT_COEX_ALGO_SCO = 0x1,
  61. BT_8723B_2ANT_COEX_ALGO_HID = 0x2,
  62. BT_8723B_2ANT_COEX_ALGO_A2DP = 0x3,
  63. BT_8723B_2ANT_COEX_ALGO_A2DP_PANHS = 0x4,
  64. BT_8723B_2ANT_COEX_ALGO_PANEDR = 0x5,
  65. BT_8723B_2ANT_COEX_ALGO_PANHS = 0x6,
  66. BT_8723B_2ANT_COEX_ALGO_PANEDR_A2DP = 0x7,
  67. BT_8723B_2ANT_COEX_ALGO_PANEDR_HID = 0x8,
  68. BT_8723B_2ANT_COEX_ALGO_HID_A2DP_PANEDR = 0x9,
  69. BT_8723B_2ANT_COEX_ALGO_HID_A2DP = 0xa,
  70. BT_8723B_2ANT_COEX_ALGO_MAX = 0xb,
  71. };
  72. struct coex_dm_8723b_2ant {
  73. /* fw mechanism */
  74. bool pre_dec_bt_pwr_lvl;
  75. bool cur_dec_bt_pwr_lvl;
  76. u8 pre_fw_dac_swing_lvl;
  77. u8 cur_fw_dac_swing_lvl;
  78. bool cur_ignore_wlan_act;
  79. bool pre_ignore_wlan_act;
  80. u8 pre_ps_tdma;
  81. u8 cur_ps_tdma;
  82. u8 ps_tdma_para[5];
  83. u8 ps_tdma_du_adj_type;
  84. bool reset_tdma_adjust;
  85. bool auto_tdma_adjust;
  86. bool pre_ps_tdma_on;
  87. bool cur_ps_tdma_on;
  88. bool pre_bt_auto_report;
  89. bool cur_bt_auto_report;
  90. /* sw mechanism */
  91. bool pre_rf_rx_lpf_shrink;
  92. bool cur_rf_rx_lpf_shrink;
  93. u32 bt_rf0x1e_backup;
  94. bool pre_low_penalty_ra;
  95. bool cur_low_penalty_ra;
  96. bool pre_dac_swing_on;
  97. u32 pre_dac_swing_lvl;
  98. bool cur_dac_swing_on;
  99. u32 cur_dac_swing_lvl;
  100. bool pre_adc_back_off;
  101. bool cur_adc_back_off;
  102. bool pre_agc_table_en;
  103. bool cur_agc_table_en;
  104. u32 pre_val0x6c0;
  105. u32 cur_val0x6c0;
  106. u32 pre_val0x6c4;
  107. u32 cur_val0x6c4;
  108. u32 pre_val0x6c8;
  109. u32 cur_val0x6c8;
  110. u8 pre_val0x6cc;
  111. u8 cur_val0x6cc;
  112. bool limited_dig;
  113. /* algorithm related */
  114. u8 pre_algorithm;
  115. u8 cur_algorithm;
  116. u8 bt_status;
  117. u8 wifi_chnl_info[3];
  118. u8 pre_lps;
  119. u8 cur_lps;
  120. u8 pre_rpwm;
  121. u8 cur_rpwm;
  122. bool is_switch_to_1dot5_ant;
  123. u8 switch_thres_offset;
  124. };
  125. struct coex_sta_8723b_2ant {
  126. bool bt_link_exist;
  127. bool sco_exist;
  128. bool a2dp_exist;
  129. bool hid_exist;
  130. bool pan_exist;
  131. bool bt_abnormal_scan;
  132. bool under_lps;
  133. bool under_ips;
  134. u32 high_priority_tx;
  135. u32 high_priority_rx;
  136. u32 low_priority_tx;
  137. u32 low_priority_rx;
  138. u8 bt_rssi;
  139. bool bt_tx_rx_mask;
  140. u8 pre_bt_rssi_state;
  141. u8 pre_wifi_rssi_state[4];
  142. bool c2h_bt_info_req_sent;
  143. u8 bt_info_c2h[BT_INFO_SRC_8723B_2ANT_MAX][10];
  144. u32 bt_info_c2h_cnt[BT_INFO_SRC_8723B_2ANT_MAX];
  145. bool c2h_bt_inquiry_page;
  146. bool c2h_bt_remote_name_req;
  147. u8 bt_retry_cnt;
  148. u8 bt_info_ext;
  149. u32 pop_event_cnt;
  150. u8 scan_ap_num;
  151. u32 crc_ok_cck;
  152. u32 crc_ok_11g;
  153. u32 crc_ok_11n;
  154. u32 crc_ok_11n_agg;
  155. u32 crc_err_cck;
  156. u32 crc_err_11g;
  157. u32 crc_err_11n;
  158. u32 crc_err_11n_agg;
  159. bool force_lps_on;
  160. u8 dis_ver_info_cnt;
  161. u8 a2dp_bit_pool;
  162. };
  163. /*********************************************************************
  164. * The following is interface which will notify coex module.
  165. *********************************************************************/
  166. void ex_btc8723b2ant_init_hwconfig(struct btc_coexist *btcoexist);
  167. void ex_btc8723b2ant_init_coex_dm(struct btc_coexist *btcoexist);
  168. void ex_btc8723b2ant_ips_notify(struct btc_coexist *btcoexist, u8 type);
  169. void ex_btc8723b2ant_lps_notify(struct btc_coexist *btcoexist, u8 type);
  170. void ex_btc8723b2ant_scan_notify(struct btc_coexist *btcoexist, u8 type);
  171. void ex_btc8723b2ant_connect_notify(struct btc_coexist *btcoexist, u8 type);
  172. void ex_btc8723b2ant_media_status_notify(struct btc_coexist *btcoexist,
  173. u8 type);
  174. void ex_btc8723b2ant_special_packet_notify(struct btc_coexist *btcoexist,
  175. u8 type);
  176. void ex_btc8723b2ant_bt_info_notify(struct btc_coexist *btcoexist,
  177. u8 *tmpbuf, u8 length);
  178. void ex_btc8723b2ant_halt_notify(struct btc_coexist *btcoexist);
  179. void ex_btc8723b2ant_periodical(struct btc_coexist *btcoexist);
  180. void ex_btc8723b2ant_display_coex_info(struct btc_coexist *btcoexist,
  181. struct seq_file *m);
  182. void ex_btc8723b2ant_pnp_notify(struct btc_coexist *btcoexist, u8 pnp_state);
  183. void ex_btc8723b2ant_pre_load_firmware(struct btc_coexist *btcoexist);
  184. void ex_btc8723b2ant_power_on_setting(struct btc_coexist *btcoexist);
  185. #endif