Commit b2283dad authored by Ping-Ke Shih's avatar Ping-Ke Shih Committed by Kalle Valo

rtlwifi: btcoex: Add common function for qeurying BT information

This commit implement the common function to sort old features, and add
more new features that are get_supported_feature, get_supported_version,
get_ant_det_val, ble_scan_type, ble_scan_para, bt_dev_info,
forbidden_slot_val, afh_map and etc.
Signed-off-by: default avatarPing-Ke Shih <pkshih@realtek.com>
Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
parent 3afb7da4
......@@ -278,6 +278,8 @@ enum btc_get_type {
BTC_GET_U4_VENDOR,
BTC_GET_U4_SUPPORTED_VERSION,
BTC_GET_U4_SUPPORTED_FEATURE,
BTC_GET_U4_BT_DEVICE_INFO,
BTC_GET_U4_BT_FORBIDDEN_SLOT_VAL,
BTC_GET_U4_WIFI_IQK_TOTAL,
BTC_GET_U4_WIFI_IQK_OK,
BTC_GET_U4_WIFI_IQK_FAIL,
......@@ -452,6 +454,17 @@ struct btc_bt_info {
u8 lps_val;
u8 rpwm_val;
u32 ra_mask;
u32 afh_map_l;
u32 afh_map_m;
u16 afh_map_h;
u32 bt_supported_feature;
u32 bt_supported_version;
u32 bt_device_info;
u32 bt_forb_slot_val;
u8 bt_ant_det_val;
u8 bt_ble_scan_type;
u32 bt_ble_scan_para;
};
struct btc_stack_info {
......@@ -507,6 +520,40 @@ enum btc_antenna_pos {
BTC_ANTENNA_AT_AUX_PORT = 0x2,
};
enum btc_mp_h2c_op_code {
BT_OP_GET_BT_VERSION = 0,
BT_OP_WRITE_REG_ADDR = 12,
BT_OP_WRITE_REG_VALUE = 13,
BT_OP_READ_REG = 17,
BT_OP_GET_AFH_MAP_L = 30,
BT_OP_GET_AFH_MAP_M = 31,
BT_OP_GET_AFH_MAP_H = 32,
BT_OP_GET_BT_COEX_SUPPORTED_FEATURE = 42,
BT_OP_GET_BT_COEX_SUPPORTED_VERSION = 43,
BT_OP_GET_BT_ANT_DET_VAL = 44,
BT_OP_GET_BT_BLE_SCAN_PARA = 45,
BT_OP_GET_BT_BLE_SCAN_TYPE = 46,
BT_OP_GET_BT_DEVICE_INFO = 48,
BT_OP_GET_BT_FORBIDDEN_SLOT_VAL = 49,
BT_OP_MAX
};
enum btc_mp_h2c_req_num {
/* 4 bits only */
BT_SEQ_DONT_CARE = 0,
BT_SEQ_GET_BT_VERSION = 0xE,
BT_SEQ_GET_AFH_MAP_L = 0x5,
BT_SEQ_GET_AFH_MAP_M = 0x6,
BT_SEQ_GET_AFH_MAP_H = 0x9,
BT_SEQ_GET_BT_COEX_SUPPORTED_FEATURE = 0x7,
BT_SEQ_GET_BT_COEX_SUPPORTED_VERSION = 0x8,
BT_SEQ_GET_BT_ANT_DET_VAL = 0x2,
BT_SEQ_GET_BT_BLE_SCAN_PARA = 0x3,
BT_SEQ_GET_BT_BLE_SCAN_TYPE = 0x4,
BT_SEQ_GET_BT_DEVICE_INFO = 0xA,
BT_SEQ_GET_BT_FORB_SLOT_VAL = 0xB,
};
struct btc_coexist {
/* make sure only one adapter can bind the data context */
bool binded;
......@@ -530,6 +577,8 @@ struct btc_coexist {
struct btc_statistics statistics;
u8 pwr_mode_val[10];
struct completion bt_mp_comp;
/* function pointers - io related */
u8 (*btc_read_1byte)(void *btc_context, u32 reg_addr);
void (*btc_write_1byte)(void *btc_context, u32 reg_addr, u32 data);
......@@ -562,6 +611,13 @@ struct btc_coexist {
void (*btc_set_bt_reg)(void *btc_context, u8 reg_type, u32 offset,
u32 value);
u32 (*btc_get_bt_coex_supported_feature)(void *btcoexist);
u32 (*btc_get_bt_coex_supported_version)(void *btcoexist);
u8 (*btc_get_ant_det_val_from_bt)(void *btcoexist);
u8 (*btc_get_ble_scan_type_from_bt)(void *btcoexist);
u32 (*btc_get_ble_scan_para_from_bt)(void *btcoexist, u8 scan_type);
bool (*btc_get_bt_afh_map_from_bt)(void *btcoexist, u8 map_type,
u8 *afh_map);
};
bool halbtc_is_wifi_uplink(struct rtl_priv *adapter);
......
......@@ -291,6 +291,7 @@ void rtl_btc_btmpinfo_notify(struct rtl_priv *rtlpriv, u8 *tmp_buf, u8 length)
u8 extid, seq, len;
u16 bt_real_fw_ver;
u8 bt_fw_ver;
u8 *data;
if (!btcoexist)
return;
......@@ -305,15 +306,60 @@ void rtl_btc_btmpinfo_notify(struct rtl_priv *rtlpriv, u8 *tmp_buf, u8 length)
len = tmp_buf[1] >> 4;
seq = tmp_buf[2] >> 4;
data = &tmp_buf[3];
/* BT Firmware version response */
if (seq == 0x0E) {
switch (seq) {
case BT_SEQ_GET_BT_VERSION:
bt_real_fw_ver = tmp_buf[3] | (tmp_buf[4] << 8);
bt_fw_ver = tmp_buf[5];
btcoexist->bt_info.bt_real_fw_ver = bt_real_fw_ver;
btcoexist->bt_info.bt_fw_ver = bt_fw_ver;
break;
case BT_SEQ_GET_AFH_MAP_L:
btcoexist->bt_info.afh_map_l = le32_to_cpu(*(__le32 *)data);
break;
case BT_SEQ_GET_AFH_MAP_M:
btcoexist->bt_info.afh_map_m = le32_to_cpu(*(__le32 *)data);
break;
case BT_SEQ_GET_AFH_MAP_H:
btcoexist->bt_info.afh_map_h = le16_to_cpu(*(__le16 *)data);
break;
case BT_SEQ_GET_BT_COEX_SUPPORTED_FEATURE:
btcoexist->bt_info.bt_supported_feature = tmp_buf[3] |
(tmp_buf[4] << 8);
break;
case BT_SEQ_GET_BT_COEX_SUPPORTED_VERSION:
btcoexist->bt_info.bt_supported_version = tmp_buf[3] |
(tmp_buf[4] << 8);
break;
case BT_SEQ_GET_BT_ANT_DET_VAL:
btcoexist->bt_info.bt_ant_det_val = tmp_buf[3];
break;
case BT_SEQ_GET_BT_BLE_SCAN_PARA:
btcoexist->bt_info.bt_ble_scan_para = tmp_buf[3] |
(tmp_buf[4] << 8) |
(tmp_buf[5] << 16) |
(tmp_buf[6] << 24);
break;
case BT_SEQ_GET_BT_BLE_SCAN_TYPE:
btcoexist->bt_info.bt_ble_scan_type = tmp_buf[3];
break;
case BT_SEQ_GET_BT_DEVICE_INFO:
btcoexist->bt_info.bt_device_info =
le32_to_cpu(*(__le32 *)data);
break;
case BT_OP_GET_BT_FORBIDDEN_SLOT_VAL:
btcoexist->bt_info.bt_forb_slot_val =
le32_to_cpu(*(__le32 *)data);
break;
}
RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_LOUD,
"btmpinfo complete req_num=%d\n", seq);
complete(&btcoexist->bt_mp_comp);
}
bool rtl_btc_is_limited_dig(struct rtl_priv *rtlpriv)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment