Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit aae1e8f5 authored by Yan-Hsuan Chuang's avatar Yan-Hsuan Chuang Committed by Kalle Valo
Browse files

rtlwifi: btcoex: 21a 2ant: set coex table and tdma when bt inquiry



Instead of just setting the coex table directly, we check if the
wifi is under some important activity (scanning|roaming|linking) and
mark the packets as high priority in that case.

Signed-off-by: default avatarYan-Hsuan Chuang <yhchuang@realtek.com>
Signed-off-by: default avatarLarry Finger <Larry.Finger@lwfinger.net>
Cc: Pkshih <pkshih@realtek.com>
Cc: Birming Chiu <birming@realtek.com>
Cc: Shaofu <shaofu@realtek.com>
Cc: Steven Ting <steventing@realtek.com>
Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
parent 9153c11c
Loading
Loading
Loading
Loading
+44 −7
Original line number Diff line number Diff line
@@ -1381,16 +1381,54 @@ static void btc8821a2ant_init_coex_dm(struct btc_coexist *btcoexist)
	btc8821a2ant_sw_mechanism2(btcoexist, false, false, false, 0x18);
}

static void btc8821a2ant_bt_inquiry_page(struct btc_coexist *btcoexist)
static void btc8821a2ant_action_bt_inquiry(struct btc_coexist *btcoexist)
{
	struct rtl_priv *rtlpriv = btcoexist->adapter;
	u8 wifi_rssi_state, wifi_rssi_state1, bt_rssi_state;
	bool wifi_connected = false;
	bool low_pwr_disable = true;
	bool scan = false, link = false, roam = false;

	wifi_rssi_state =
		btc8821a2ant_wifi_rssi_state(btcoexist, 0, 2, 15, 0);
	wifi_rssi_state1 = btc8821a2ant_wifi_rssi_state(btcoexist, 1, 2,
				BT_8821A_2ANT_WIFI_RSSI_COEXSWITCH_THRES, 0);
	bt_rssi_state = btc8821a2ant_bt_rssi_state(btcoexist,
		2, BT_8821A_2ANT_BT_RSSI_COEXSWITCH_THRES, 0);

	btcoexist->btc_set(btcoexist, BTC_SET_ACT_DISABLE_LOW_POWER,
			   &low_pwr_disable);
	btcoexist->btc_get(btcoexist, BTC_GET_BL_WIFI_CONNECTED,
			   &wifi_connected);

	btc8821a2ant_coex_table(btcoexist, NORMAL_EXEC, 0x55ff55ff,
				0x5afa5afa, 0xffff, 0x3);
	btc8821a2ant_ps_tdma(btcoexist, NORMAL_EXEC, true, 3);
	btcoexist->btc_get(btcoexist, BTC_GET_BL_WIFI_SCAN, &scan);
	btcoexist->btc_get(btcoexist, BTC_GET_BL_WIFI_LINK, &link);
	btcoexist->btc_get(btcoexist, BTC_GET_BL_WIFI_ROAM, &roam);

	btc8821a2ant_power_save_state(btcoexist, BTC_PS_WIFI_NATIVE, 0x0, 0x0);

	if (scan || link || roam) {
		RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_LOUD,
			 "[BTCoex], Wifi link process + BT Inq/Page!!\n");
		btc8821a2ant_coex_table_with_type(btcoexist, NORMAL_EXEC, 15);
		btc8821a2ant_ps_tdma(btcoexist, NORMAL_EXEC, true, 22);
	} else if (wifi_connected) {
		RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_LOUD,
			 "[BTCoex], Wifi connected + BT Inq/Page!!\n");
		btc8821a2ant_coex_table_with_type(btcoexist, NORMAL_EXEC, 15);
		btc8821a2ant_ps_tdma(btcoexist, NORMAL_EXEC, true, 22);
	} else {
		RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_LOUD,
			 "[BTCoex], Wifi no-link + BT Inq/Page!!\n");
		btc8821a2ant_coex_table_with_type(btcoexist, NORMAL_EXEC, 0);
		btc8821a2ant_ps_tdma(btcoexist, NORMAL_EXEC, false, 1);
	}

	btc8821a2ant_fw_dac_swing_lvl(btcoexist, FORCE_EXEC, 6);
	btc8821a2ant_dec_bt_pwr(btcoexist, NORMAL_EXEC, 0);

	btc8821a2ant_sw_mechanism1(btcoexist, false, false, false, false);
	btc8821a2ant_sw_mechanism2(btcoexist, false, false, false, 0x18);
}

static bool btc8821a2ant_is_common_action(struct btc_coexist *btcoexist)
@@ -1779,8 +1817,7 @@ static void btc8821a2ant_action_sco(struct btc_coexist *btcoexist)

	if (wifi_bw == BTC_WIFI_BW_LEGACY) {
		/* for SCO quality at 11b/g mode */
		btc8821a2ant_coex_table(btcoexist, NORMAL_EXEC,
					0x5a5a5a5a, 0x5a5a5a5a, 0xffff, 0x3);
		btc8821a2ant_coex_table_with_type(btcoexist, NORMAL_EXEC, 2);
	} else {
		/* for SCO quality & wifi performance balance at 11n mode */
		btc8821a2ant_coex_table(btcoexist, NORMAL_EXEC,
@@ -2511,7 +2548,7 @@ static void btc8821a2ant_run_coexist_mechanism(struct btc_coexist *btcoexist)
	    (BT_8821A_2ANT_COEX_ALGO_PANHS != algorithm)) {
		RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_LOUD,
			 "[BTCoex], BT is under inquiry/page scan !!\n");
		btc8821a2ant_bt_inquiry_page(btcoexist);
		btc8821a2ant_action_bt_inquiry(btcoexist);
		return;
	}