Blame SOURCES/0030-rtw89-coex-Update-BT-counters-while-receiving-report.patch

56e3f4
From 1b91f335400f3c9937b7c2b6f396352fc8ecc7f7 Mon Sep 17 00:00:00 2001
56e3f4
From: =?UTF-8?q?=C3=8D=C3=B1igo=20Huguet?= <ihuguet@redhat.com>
56e3f4
Date: Fri, 21 Jan 2022 08:49:04 +0100
56e3f4
Subject: [PATCH 30/36] rtw89: coex: Update BT counters while receiving report
56e3f4
MIME-Version: 1.0
56e3f4
Content-Type: text/plain; charset=UTF-8
56e3f4
Content-Transfer-Encoding: 8bit
56e3f4
56e3f4
Bugzilla: http://bugzilla.redhat.com/2033291
56e3f4
56e3f4
commit eb87d79911c65ab8973ee8292802f0da6b7c67a4
56e3f4
Author: Ching-Te Ku <ku920601@realtek.com>
56e3f4
Date:   Thu Dec 9 16:32:27 2021 +0800
56e3f4
56e3f4
    rtw89: coex: Update BT counters while receiving report
56e3f4
56e3f4
    Move _chk_btc_err and update_bt_cnt to _chk_btc_report(),
56e3f4
    so we can update counter/info to COEX at a proper moment,
56e3f4
    instead of relying on a user does cat the debug info periodically.
56e3f4
56e3f4
    Signed-off-by: Ching-Te Ku <ku920601@realtek.com>
56e3f4
    Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
56e3f4
    Signed-off-by: Kalle Valo <kvalo@kernel.org>
56e3f4
    Link: https://lore.kernel.org/r/20211209083229.10815-6-pkshih@realtek.com
56e3f4
56e3f4
Signed-off-by: Íñigo Huguet <ihuguet@redhat.com>
56e3f4
---
56e3f4
 drivers/net/wireless/realtek/rtw89/coex.c | 32 +++++++++++++++----------------
56e3f4
 1 file changed, 15 insertions(+), 17 deletions(-)
56e3f4
56e3f4
diff --git a/drivers/net/wireless/realtek/rtw89/coex.c b/drivers/net/wireless/realtek/rtw89/coex.c
56e3f4
index 436f5ccb193a..929818c3a776 100644
56e3f4
--- a/drivers/net/wireless/realtek/rtw89/coex.c
56e3f4
+++ b/drivers/net/wireless/realtek/rtw89/coex.c
56e3f4
@@ -1118,6 +1118,10 @@ static u32 _chk_btc_report(struct rtw89_dev *rtwdev,
56e3f4
 			diff_t = pcysta->tavg_cycle[CXT_WL] - wl_slot_set;
56e3f4
 			_chk_btc_err(rtwdev, BTC_DCNT_WL_SLOT_DRIFT, diff_t);
56e3f4
 		}
56e3f4
+
56e3f4
+		_chk_btc_err(rtwdev, BTC_DCNT_W1_FREEZE, pcysta->slot_cnt[CXST_W1]);
56e3f4
+		_chk_btc_err(rtwdev, BTC_DCNT_W1_FREEZE, pcysta->slot_cnt[CXST_W1]);
56e3f4
+		_chk_btc_err(rtwdev, BTC_DCNT_CYCLE_FREEZE, (u32)pcysta->cycles);
56e3f4
 	}
56e3f4
 
56e3f4
 	if (rpt_type == BTC_RPT_TYPE_CTRL) {
56e3f4
@@ -1127,8 +1131,17 @@ static u32 _chk_btc_report(struct rtw89_dev *rtwdev,
56e3f4
 		wl->ver_info.fw = prpt->wl_fw_ver;
56e3f4
 		dm->wl_fw_cx_offload = !!(prpt->wl_fw_cx_offload);
56e3f4
 
56e3f4
-		btc->cx.cnt_bt[BTC_BCNT_POLUT] =
56e3f4
-			rtw89_mac_get_plt_cnt(rtwdev, RTW89_MAC_0);
56e3f4
+		_chk_btc_err(rtwdev, BTC_DCNT_RPT_FREEZE,
56e3f4
+			     pfwinfo->event[BTF_EVNT_RPT]);
56e3f4
+
56e3f4
+		/* To avoid I/O if WL LPS or power-off */
56e3f4
+		if (wl->status.map.lps != BTC_LPS_RF_OFF && !wl->status.map.rf_off) {
56e3f4
+			rtwdev->chip->ops->btc_update_bt_cnt(rtwdev);
56e3f4
+			_chk_btc_err(rtwdev, BTC_DCNT_BTCNT_FREEZE, 0);
56e3f4
+
56e3f4
+			btc->cx.cnt_bt[BTC_BCNT_POLUT] =
56e3f4
+				rtw89_mac_get_plt_cnt(rtwdev, RTW89_MAC_0);
56e3f4
+		}
56e3f4
 	}
56e3f4
 
56e3f4
 	if (rpt_type >= BTC_RPT_TYPE_BT_VER &&
56e3f4
@@ -4793,7 +4806,6 @@ static void _show_bt_profile_info(struct rtw89_dev *rtwdev, struct seq_file *m)
56e3f4
 
56e3f4
 static void _show_bt_info(struct rtw89_dev *rtwdev, struct seq_file *m)
56e3f4
 {
56e3f4
-	const struct rtw89_chip_info *chip = rtwdev->chip;
56e3f4
 	struct rtw89_btc *btc = &rtwdev->btc;
56e3f4
 	struct rtw89_btc_cx *cx = &btc->cx;
56e3f4
 	struct rtw89_btc_bt_info *bt = &cx->bt;
56e3f4
@@ -4876,12 +4888,6 @@ static void _show_bt_info(struct rtw89_dev *rtwdev, struct seq_file *m)
56e3f4
 		   cx->cnt_bt[BTC_BCNT_INFOUPDATE],
56e3f4
 		   cx->cnt_bt[BTC_BCNT_INFOSAME]);
56e3f4
 
56e3f4
-	if (wl->status.map.lps || wl->status.map.rf_off)
56e3f4
-		return;
56e3f4
-
56e3f4
-	chip->ops->btc_update_bt_cnt(rtwdev);
56e3f4
-	_chk_btc_err(rtwdev, BTC_DCNT_BTCNT_FREEZE, 0);
56e3f4
-
56e3f4
 	seq_printf(m,
56e3f4
 		   " %-15s : Hi-rx = %d, Hi-tx = %d, Lo-rx = %d, Lo-tx = %d (bt_polut_wl_tx = %d)\n",
56e3f4
 		   "[trx_req_cnt]", cx->cnt_bt[BTC_BCNT_HIPRI_RX],
56e3f4
@@ -5254,8 +5260,6 @@ static void _show_fbtc_cysta(struct rtw89_dev *rtwdev, struct seq_file *m)
56e3f4
 		   pcysta->bcn_cnt[CXBCN_BT_SLOT],
56e3f4
 		   pcysta->bcn_cnt[CXBCN_BT_OK]);
56e3f4
 
56e3f4
-	_chk_btc_err(rtwdev, BTC_DCNT_CYCLE_FREEZE, (u32)pcysta->cycles);
56e3f4
-
56e3f4
 	for (i = 0; i < CXST_MAX; i++) {
56e3f4
 		if (!pcysta->slot_cnt[i])
56e3f4
 			continue;
56e3f4
@@ -5279,9 +5283,6 @@ static void _show_fbtc_cysta(struct rtw89_dev *rtwdev, struct seq_file *m)
56e3f4
 	}
56e3f4
 	seq_puts(m, "\n");
56e3f4
 
56e3f4
-	_chk_btc_err(rtwdev, BTC_DCNT_W1_FREEZE, pcysta->slot_cnt[CXST_W1]);
56e3f4
-	_chk_btc_err(rtwdev, BTC_DCNT_B1_FREEZE, pcysta->slot_cnt[CXST_B1]);
56e3f4
-
56e3f4
 	seq_printf(m, " %-15s : avg_t[wl:%d/bt:%d/lk:%d.%03d]",
56e3f4
 		   "[cycle_time]",
56e3f4
 		   pcysta->tavg_cycle[CXT_WL],
56e3f4
@@ -5633,9 +5634,6 @@ static void _show_summary(struct rtw89_dev *rtwdev, struct seq_file *m)
56e3f4
 			   pfwinfo->event[BTF_EVNT_RPT], prptctrl->rpt_cnt,
56e3f4
 			   prptctrl->rpt_enable, dm->error.val);
56e3f4
 
56e3f4
-		_chk_btc_err(rtwdev, BTC_DCNT_RPT_FREEZE,
56e3f4
-			     pfwinfo->event[BTF_EVNT_RPT]);
56e3f4
-
56e3f4
 		if (dm->error.map.wl_fw_hang)
56e3f4
 			seq_puts(m, " (WL FW Hang!!)");
56e3f4
 		seq_puts(m, "\n");
56e3f4
-- 
56e3f4
2.13.6
56e3f4