1 /* SPDX-License-Identifier: GPL-2.0 */ 2 /* Copyright(c) 2009-2012 Realtek Corporation.*/ 3 4 #ifndef __RTL8723E_HAL_BTC_H__ 5 #define __RTL8723E_HAL_BTC_H__ 6 7 #include "../wifi.h" 8 #include "btc.h" 9 #include "hal_bt_coexist.h" 10 11 #define BT_TXRX_CNT_THRES_1 1200 12 #define BT_TXRX_CNT_THRES_2 1400 13 #define BT_TXRX_CNT_THRES_3 3000 14 /* < 1200 */ 15 #define BT_TXRX_CNT_LEVEL_0 0 16 /* >= 1200 && < 1400 */ 17 #define BT_TXRX_CNT_LEVEL_1 1 18 /* >= 1400 */ 19 #define BT_TXRX_CNT_LEVEL_2 2 20 #define BT_TXRX_CNT_LEVEL_3 3 21 22 #define BT_COEX_DISABLE 0 23 #define BT_Q_PKT_OFF 0 24 #define BT_Q_PKT_ON 1 25 26 #define BT_TX_PWR_OFF 0 27 #define BT_TX_PWR_ON 1 28 29 /* TDMA mode definition */ 30 #define TDMA_2ANT 0 31 #define TDMA_1ANT 1 32 #define TDMA_NAV_OFF 0 33 #define TDMA_NAV_ON 1 34 #define TDMA_DAC_SWING_OFF 0 35 #define TDMA_DAC_SWING_ON 1 36 37 /* PTA mode related definition */ 38 #define BT_PTA_MODE_OFF 0 39 #define BT_PTA_MODE_ON 1 40 41 /* Penalty Tx Rate Adaptive */ 42 #define BT_TX_RATE_ADAPTIVE_NORMAL 0 43 #define BT_TX_RATE_ADAPTIVE_LOW_PENALTY 1 44 45 /* RF Corner */ 46 #define BT_RF_RX_LPF_CORNER_RESUME 0 47 #define BT_RF_RX_LPF_CORNER_SHRINK 1 48 49 #define C2H_EVT_HOST_CLOSE 0x00 50 #define C2H_EVT_FW_CLOSE 0xFF 51 52 enum bt_traffic_mode { 53 BT_MOTOR_EXT_BE = 0x00, 54 BT_MOTOR_EXT_GUL = 0x01, 55 BT_MOTOR_EXT_GUB = 0x02, 56 BT_MOTOR_EXT_GULB = 0x03 57 }; 58 59 enum bt_traffic_mode_profile { 60 BT_PROFILE_NONE, 61 BT_PROFILE_A2DP, 62 BT_PROFILE_PAN, 63 BT_PROFILE_HID, 64 BT_PROFILE_SCO 65 }; 66 67 /* 68 enum hci_ext_bt_operation { 69 HCI_BT_OP_NONE = 0x0, 70 HCI_BT_OP_INQUIRE_START = 0x1, 71 HCI_BT_OP_INQUIRE_FINISH = 0x2, 72 HCI_BT_OP_PAGING_START = 0x3, 73 HCI_BT_OP_PAGING_SUCCESS = 0x4, 74 HCI_BT_OP_PAGING_UNSUCCESS = 0x5, 75 HCI_BT_OP_PAIRING_START = 0x6, 76 HCI_BT_OP_PAIRING_FINISH = 0x7, 77 HCI_BT_OP_BT_DEV_ENABLE = 0x8, 78 HCI_BT_OP_BT_DEV_DISABLE = 0x9, 79 HCI_BT_OP_MAX, 80 }; 81 */ 82 83 enum bt_spec { 84 BT_SPEC_1_0_b = 0x00, 85 BT_SPEC_1_1 = 0x01, 86 BT_SPEC_1_2 = 0x02, 87 BT_SPEC_2_0_EDR = 0x03, 88 BT_SPEC_2_1_EDR = 0x04, 89 BT_SPEC_3_0_HS = 0x05, 90 BT_SPEC_4_0 = 0x06 91 }; 92 93 struct c2h_evt_hdr { 94 u8 cmd_id; 95 u8 cmd_len; 96 u8 cmd_seq; 97 }; 98 99 enum bt_state { 100 BT_INFO_STATE_DISABLED = 0, 101 BT_INFO_STATE_NO_CONNECTION = 1, 102 BT_INFO_STATE_CONNECT_IDLE = 2, 103 BT_INFO_STATE_INQ_OR_PAG = 3, 104 BT_INFO_STATE_ACL_ONLY_BUSY = 4, 105 BT_INFO_STATE_SCO_ONLY_BUSY = 5, 106 BT_INFO_STATE_ACL_SCO_BUSY = 6, 107 BT_INFO_STATE_HID_BUSY = 7, 108 BT_INFO_STATE_HID_SCO_BUSY = 8, 109 BT_INFO_STATE_MAX = 7 110 }; 111 112 enum rtl8723e_c2h_evt_v0 { 113 C2H_V0_DBG = 0, 114 C2H_V0_TSF = 1, 115 C2H_V0_AP_RPT_RSP = 2, 116 /* The FW notify the report of the specific tx packet. */ 117 C2H_V0_CCX_TX_RPT = 3, 118 C2H_V0_BT_RSSI = 4, 119 C2H_V0_BT_OP_MODE = 5, 120 C2H_V0_HW_INFO_EXCH = 10, 121 C2H_V0_C2H_H2C_TEST = 11, 122 C2H_V0_BT_INFO = 12, 123 MAX_C2HEVENT 124 }; 125 126 void rtl8723e_dm_bt_fw_coex_all_off_8723a(struct ieee80211_hw *hw); 127 void rtl8723e_dm_bt_sw_coex_all_off_8723a(struct ieee80211_hw *hw); 128 void rtl8723e_dm_bt_hw_coex_all_off_8723a(struct ieee80211_hw *hw); 129 void rtl8723e_dm_bt_coexist_8723(struct ieee80211_hw *hw); 130 void rtl8723e_dm_bt_set_bt_dm(struct ieee80211_hw *hw, 131 struct btdm_8723 *p_btdm); 132 void rtl_8723e_c2h_command_handle(struct ieee80211_hw *hw); 133 void rtl_8723e_bt_wifi_media_status_notify(struct ieee80211_hw *hw, 134 bool mstatus); 135 void rtl8723e_dm_bt_turn_off_bt_coexist_before_enter_lps( 136 struct ieee80211_hw *hw); 137 138 #endif 139