halbtc8723b1ant.h 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226
  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 8723B 1ANT BT Co-exist definition
  27. **********************************************************************/
  28. #define BT_INFO_8723B_1ANT_B_FTP BIT7
  29. #define BT_INFO_8723B_1ANT_B_A2DP BIT6
  30. #define BT_INFO_8723B_1ANT_B_HID BIT5
  31. #define BT_INFO_8723B_1ANT_B_SCO_BUSY BIT4
  32. #define BT_INFO_8723B_1ANT_B_ACL_BUSY BIT3
  33. #define BT_INFO_8723B_1ANT_B_INQ_PAGE BIT2
  34. #define BT_INFO_8723B_1ANT_B_SCO_ESCO BIT1
  35. #define BT_INFO_8723B_1ANT_B_CONNECTION BIT0
  36. #define BT_INFO_8723B_1ANT_A2DP_BASIC_RATE(_BT_INFO_EXT_) \
  37. (((_BT_INFO_EXT_&BIT0)) ? true : false)
  38. #define BTC_RSSI_COEX_THRESH_TOL_8723B_1ANT 2
  39. #define BT_8723B_1ANT_WIFI_NOISY_THRESH 50
  40. enum _BT_INFO_SRC_8723B_1ANT {
  41. BT_INFO_SRC_8723B_1ANT_WIFI_FW = 0x0,
  42. BT_INFO_SRC_8723B_1ANT_BT_RSP = 0x1,
  43. BT_INFO_SRC_8723B_1ANT_BT_ACTIVE_SEND = 0x2,
  44. BT_INFO_SRC_8723B_1ANT_MAX
  45. };
  46. enum _BT_8723B_1ANT_BT_STATUS {
  47. BT_8723B_1ANT_BT_STATUS_NON_CONNECTED_IDLE = 0x0,
  48. BT_8723B_1ANT_BT_STATUS_CONNECTED_IDLE = 0x1,
  49. BT_8723B_1ANT_BT_STATUS_INQ_PAGE = 0x2,
  50. BT_8723B_1ANT_BT_STATUS_ACL_BUSY = 0x3,
  51. BT_8723B_1ANT_BT_STATUS_SCO_BUSY = 0x4,
  52. BT_8723B_1ANT_BT_STATUS_ACL_SCO_BUSY = 0x5,
  53. BT_8723B_1ANT_BT_STATUS_MAX
  54. };
  55. enum _BT_8723B_1ANT_WIFI_STATUS {
  56. BT_8723B_1ANT_WIFI_STATUS_NON_CONNECTED_IDLE = 0x0,
  57. BT_8723B_1ANT_WIFI_STATUS_NON_CONNECTED_ASSO_AUTH_SCAN = 0x1,
  58. BT_8723B_1ANT_WIFI_STATUS_CONNECTED_SCAN = 0x2,
  59. BT_8723B_1ANT_WIFI_STATUS_CONNECTED_SPECIAL_PKT = 0x3,
  60. BT_8723B_1ANT_WIFI_STATUS_CONNECTED_IDLE = 0x4,
  61. BT_8723B_1ANT_WIFI_STATUS_CONNECTED_BUSY = 0x5,
  62. BT_8723B_1ANT_WIFI_STATUS_MAX
  63. };
  64. enum _BT_8723B_1ANT_COEX_ALGO {
  65. BT_8723B_1ANT_COEX_ALGO_UNDEFINED = 0x0,
  66. BT_8723B_1ANT_COEX_ALGO_SCO = 0x1,
  67. BT_8723B_1ANT_COEX_ALGO_HID = 0x2,
  68. BT_8723B_1ANT_COEX_ALGO_A2DP = 0x3,
  69. BT_8723B_1ANT_COEX_ALGO_A2DP_PANHS = 0x4,
  70. BT_8723B_1ANT_COEX_ALGO_PANEDR = 0x5,
  71. BT_8723B_1ANT_COEX_ALGO_PANHS = 0x6,
  72. BT_8723B_1ANT_COEX_ALGO_PANEDR_A2DP = 0x7,
  73. BT_8723B_1ANT_COEX_ALGO_PANEDR_HID = 0x8,
  74. BT_8723B_1ANT_COEX_ALGO_HID_A2DP_PANEDR = 0x9,
  75. BT_8723B_1ANT_COEX_ALGO_HID_A2DP = 0xa,
  76. BT_8723B_1ANT_COEX_ALGO_MAX = 0xb,
  77. };
  78. struct coex_dm_8723b_1ant {
  79. /* hw setting */
  80. u8 pre_ant_pos_type;
  81. u8 cur_ant_pos_type;
  82. /* fw mechanism */
  83. bool cur_ignore_wlan_act;
  84. bool pre_ignore_wlan_act;
  85. u8 pre_ps_tdma;
  86. u8 cur_ps_tdma;
  87. u8 ps_tdma_para[5];
  88. u8 ps_tdma_du_adj_type;
  89. bool auto_tdma_adjust;
  90. bool pre_ps_tdma_on;
  91. bool cur_ps_tdma_on;
  92. bool pre_bt_auto_report;
  93. bool cur_bt_auto_report;
  94. u8 pre_lps;
  95. u8 cur_lps;
  96. u8 pre_rpwm;
  97. u8 cur_rpwm;
  98. /* sw mechanism */
  99. bool pre_low_penalty_ra;
  100. bool cur_low_penalty_ra;
  101. u32 pre_val0x6c0;
  102. u32 cur_val0x6c0;
  103. u32 pre_val0x6c4;
  104. u32 cur_val0x6c4;
  105. u32 pre_val0x6c8;
  106. u32 cur_val0x6c8;
  107. u8 pre_val0x6cc;
  108. u8 cur_val0x6cc;
  109. bool limited_dig;
  110. u32 backup_arfr_cnt1; /* Auto Rate Fallback Retry cnt */
  111. u32 backup_arfr_cnt2; /* Auto Rate Fallback Retry cnt */
  112. u16 backup_retry_limit;
  113. u8 backup_ampdu_max_time;
  114. /* algorithm related */
  115. u8 pre_algorithm;
  116. u8 cur_algorithm;
  117. u8 bt_status;
  118. u8 wifi_chnl_info[3];
  119. u32 prera_mask;
  120. u32 curra_mask;
  121. u8 pre_arfr_type;
  122. u8 cur_arfr_type;
  123. u8 pre_retry_limit_type;
  124. u8 cur_retry_limit_type;
  125. u8 pre_ampdu_time_type;
  126. u8 cur_ampdu_time_type;
  127. u32 arp_cnt;
  128. u8 error_condition;
  129. };
  130. struct coex_sta_8723b_1ant {
  131. bool bt_disabled;
  132. bool bt_link_exist;
  133. bool sco_exist;
  134. bool a2dp_exist;
  135. bool hid_exist;
  136. bool pan_exist;
  137. bool bt_hi_pri_link_exist;
  138. u8 num_of_profile;
  139. bool bt_abnormal_scan;
  140. bool under_lps;
  141. bool under_ips;
  142. u32 special_pkt_period_cnt;
  143. u32 high_priority_tx;
  144. u32 high_priority_rx;
  145. u32 low_priority_tx;
  146. u32 low_priority_rx;
  147. u8 bt_rssi;
  148. u8 pre_bt_rssi_state;
  149. u8 pre_wifi_rssi_state[4];
  150. bool bt_tx_rx_mask;
  151. bool c2h_bt_info_req_sent;
  152. u8 bt_info_c2h[BT_INFO_SRC_8723B_1ANT_MAX][10];
  153. u32 bt_info_c2h_cnt[BT_INFO_SRC_8723B_1ANT_MAX];
  154. bool bt_whck_test;
  155. bool c2h_bt_inquiry_page;
  156. bool c2h_bt_remote_name_req;
  157. bool wifi_is_high_pri_task;
  158. u8 bt_retry_cnt;
  159. u8 bt_info_ext;
  160. u8 scan_ap_num;
  161. bool cck_ever_lock;
  162. u8 coex_table_type;
  163. bool force_lps_on;
  164. u32 pop_event_cnt;
  165. u32 crc_ok_cck;
  166. u32 crc_ok_11g;
  167. u32 crc_ok_11n;
  168. u32 crc_ok_11n_agg;
  169. u32 crc_err_cck;
  170. u32 crc_err_11g;
  171. u32 crc_err_11n;
  172. u32 crc_err_11n_agg;
  173. bool cck_lock;
  174. bool pre_ccklock;
  175. u32 wrong_profile_notification;
  176. u8 a2dp_bit_pool;
  177. u8 cut_version;
  178. };
  179. /*************************************************************************
  180. * The following is interface which will notify coex module.
  181. *************************************************************************/
  182. void ex_btc8723b1ant_power_on_setting(struct btc_coexist *btcoexist);
  183. void ex_btc8723b1ant_init_hwconfig(struct btc_coexist *btcoexist,
  184. bool wifi_only);
  185. void ex_btc8723b1ant_init_coex_dm(struct btc_coexist *btcoexist);
  186. void ex_btc8723b1ant_ips_notify(struct btc_coexist *btcoexist, u8 type);
  187. void ex_btc8723b1ant_lps_notify(struct btc_coexist *btcoexist, u8 type);
  188. void ex_btc8723b1ant_scan_notify(struct btc_coexist *btcoexist, u8 type);
  189. void ex_btc8723b1ant_connect_notify(struct btc_coexist *btcoexist, u8 type);
  190. void ex_btc8723b1ant_media_status_notify(struct btc_coexist *btcoexist,
  191. u8 type);
  192. void ex_btc8723b1ant_special_packet_notify(struct btc_coexist *btcoexist,
  193. u8 type);
  194. void ex_btc8723b1ant_bt_info_notify(struct btc_coexist *btcoexist,
  195. u8 *tmpbuf, u8 length);
  196. void ex_btc8723b1ant_rf_status_notify(struct btc_coexist *btcoexist,
  197. u8 type);
  198. void ex_btc8723b1ant_halt_notify(struct btc_coexist *btcoexist);
  199. void ex_btc8723b1ant_pnp_notify(struct btc_coexist *btcoexist, u8 pnpstate);
  200. void ex_btc8723b1ant_coex_dm_reset(struct btc_coexist *btcoexist);
  201. void ex_btc8723b1ant_periodical(struct btc_coexist *btcoexist);
  202. void ex_btc8723b1ant_display_coex_info(struct btc_coexist *btcoexist,
  203. struct seq_file *m);
  204. void ex_btc8723b1ant_pnp_notify(struct btc_coexist *btcoexist, u8 pnp_state);