diff mbox series

[2/2] wifi: rtw88: disable power offs for 8821C

Message ID 20240527173454.459264-3-marcin.slusarz@gmail.com (mailing list archive)
State Changes Requested
Delegated to: Ping-Ke Shih
Headers show
Series [1/2] wifi: rtw88: use RTW_FLAG_RUNNING for deciding whether to enter/leave IPS | expand

Commit Message

Marcin Ślusarz May 27, 2024, 5:34 p.m. UTC
From: Marcin Ślusarz <mslusarz@renau.com>

This chip fails to reliably wake up from power off.

After some number of power off+on cycles, it stops with endless spamming of:
rtw_8821cu 1-1:1.2: rtw_usb_reg_sec: reg 0x4e0, usb write 1 fail, status: -71
killing both Wifi and Bluetooth part of the device.

On arm, just leaving the wifi device unconfigured kills it in up to 20 minutes.
If I keep restarting wpa_supplicant I can trigger it within a minute.
Looping "ifconfig wlan0 down; ifconfig wlan0 up" also triggers it within a minute.

On x86_64 system the only way I could trigger this was via ifconfig loop,
but it took 3 hours and 20 minutes to do it.

The only thing that "fixes" the device is replugging it.

Signed-off-by: Marcin Ślusarz <mslusarz@renau.com>
Cc: Ping-Ke Shih <pkshih@realtek.com>
Cc: Larry Finger <Larry.Finger@lwfinger.net>
Cc: Kalle Valo <kvalo@kernel.org>
Cc: linux-wireless@vger.kernel.org
---
 drivers/net/wireless/realtek/rtw88/main.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)
diff mbox series

Patch

diff --git a/drivers/net/wireless/realtek/rtw88/main.c b/drivers/net/wireless/realtek/rtw88/main.c
index 7ab7a988b123..e8bfa683d7bb 100644
--- a/drivers/net/wireless/realtek/rtw88/main.c
+++ b/drivers/net/wireless/realtek/rtw88/main.c
@@ -1482,11 +1482,11 @@  void rtw_core_scan_complete(struct rtw_dev *rtwdev, struct ieee80211_vif *vif,
 
 int rtw_core_start(struct rtw_dev *rtwdev)
 {
-	int ret;
-
-	ret = rtw_power_on(rtwdev);
-	if (ret)
-		return ret;
+	if (!test_bit(RTW_FLAG_POWERON, rtwdev->flags)) {
+		int ret = rtw_power_on(rtwdev);
+		if (ret)
+			return ret;
+	}
 
 	rtw_sec_enable_sec_engine(rtwdev);
 
@@ -1534,7 +1534,9 @@  void rtw_core_stop(struct rtw_dev *rtwdev)
 
 	mutex_lock(&rtwdev->mutex);
 
-	rtw_power_off(rtwdev);
+	/* FIXME: 8821C doesn't wake up from this state from time to time */
+	if (rtwdev->chip->id != RTW_CHIP_TYPE_8821C)
+		rtw_power_off(rtwdev);
 }
 
 static void rtw_init_ht_cap(struct rtw_dev *rtwdev,