Commit ba297a25 authored by Ching-Te Ku's avatar Ching-Te Ku Committed by Kalle Valo

wifi: rtw89: coex: summarize Wi-Fi to BT scoreboard and inform BT one time a cycle

If Wi-Fi driver send Wi-Fi status to BT via scoreboard too frequent in a
short moment, BT will loss some of them because of hardware response time.
To avoid this issue, change the code flow. Summarize the scoreboard changes
and if the value have changed, send the scoreboard to BT only once in
a coexistence processing cycle. It also can help to reduce driver I/O.
Signed-off-by: default avatarChing-Te Ku <ku920601@realtek.com>
Signed-off-by: default avatarPing-Ke Shih <pkshih@realtek.com>
Signed-off-by: default avatarKalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20220920010939.12173-8-pkshih@realtek.com
parent f2fe93b3
...@@ -3558,11 +3558,22 @@ static void _set_bt_rx_agc(struct rtw89_dev *rtwdev) ...@@ -3558,11 +3558,22 @@ static void _set_bt_rx_agc(struct rtw89_dev *rtwdev)
/* TODO add these functions */ /* TODO add these functions */
static void _action_common(struct rtw89_dev *rtwdev) static void _action_common(struct rtw89_dev *rtwdev)
{ {
struct rtw89_btc *btc = &rtwdev->btc;
struct rtw89_btc_wl_info *wl = &btc->cx.wl;
_set_btg_ctrl(rtwdev); _set_btg_ctrl(rtwdev);
_set_wl_tx_limit(rtwdev); _set_wl_tx_limit(rtwdev);
_set_bt_afh_info(rtwdev); _set_bt_afh_info(rtwdev);
_set_bt_rx_agc(rtwdev); _set_bt_rx_agc(rtwdev);
_set_rf_trx_para(rtwdev); _set_rf_trx_para(rtwdev);
if (wl->scbd_change) {
rtw89_mac_cfg_sb(rtwdev, wl->scbd);
rtw89_debug(rtwdev, RTW89_DBG_BTC, "[BTC], write scbd: 0x%08x\n",
wl->scbd);
wl->scbd_change = false;
btc->cx.cnt_wl[BTC_WCNT_SCBDUPDATE]++;
}
} }
static void _action_by_bt(struct rtw89_dev *rtwdev) static void _action_by_bt(struct rtw89_dev *rtwdev)
...@@ -3885,20 +3896,20 @@ static void _write_scbd(struct rtw89_dev *rtwdev, u32 val, bool state) ...@@ -3885,20 +3896,20 @@ static void _write_scbd(struct rtw89_dev *rtwdev, u32 val, bool state)
struct rtw89_btc *btc = &rtwdev->btc; struct rtw89_btc *btc = &rtwdev->btc;
struct rtw89_btc_wl_info *wl = &btc->cx.wl; struct rtw89_btc_wl_info *wl = &btc->cx.wl;
u32 scbd_val = 0; u32 scbd_val = 0;
u8 force_exec = false;
if (!chip->scbd) if (!chip->scbd)
return; return;
scbd_val = state ? wl->scbd | val : wl->scbd & ~val; scbd_val = state ? wl->scbd | val : wl->scbd & ~val;
if (scbd_val == wl->scbd) if (val & BTC_WSCB_ACTIVE || val & BTC_WSCB_ON)
return; force_exec = true;
rtw89_mac_cfg_sb(rtwdev, scbd_val);
rtw89_debug(rtwdev, RTW89_DBG_BTC, "[BTC], write scbd: 0x%08x\n",
scbd_val);
wl->scbd = scbd_val;
btc->cx.cnt_wl[BTC_WCNT_SCBDUPDATE]++; if (scbd_val != wl->scbd || force_exec) {
wl->scbd = scbd_val;
wl->scbd_change = true;
}
} }
static u8 static u8
......
...@@ -1308,6 +1308,7 @@ struct rtw89_btc_wl_info { ...@@ -1308,6 +1308,7 @@ struct rtw89_btc_wl_info {
u8 port_id[RTW89_WIFI_ROLE_MLME_MAX]; u8 port_id[RTW89_WIFI_ROLE_MLME_MAX];
u8 rssi_level; u8 rssi_level;
bool scbd_change;
u32 scbd; u32 scbd;
}; };
......
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