Message ID | 20220819064811.37700-2-pkshih@realtek.com |
---|---|
State | Superseded |
Headers | show |
Series | wifi: rtw89: correct MAC and PCI settings | expand |
Ping-Ke Shih <pkshih@realtek.com> wrote: > From: Chin-Yen Lee <timlee@realtek.com> > > When starting to send heavy traffic in low power mode, > driver will call multiple tx wake notify to wake firmware > within a short time. In this situation, firmware may miss > power mode change request from driver and leads to status > error. So we change driver to call power_mode_change at most > three times to make sure firmware could get the request. > > Signed-off-by: Chin-Yen Lee <timlee@realtek.com> > Signed-off-by: Ping-Ke Shih <pkshih@realtek.com> 5 patches applied to wireless-next.git, thanks. 48c0e34755a1 wifi: rtw89: add retry to change power_mode state 704052f55ffe wifi: rtw89: 8852c: set TBTT shift configuration 8f308ae3342c wifi: rtw89: pci: fix PCI PHY auto adaption by using software restore 843059d8193c wifi: rtw89: pci: enable CLK_REQ, ASPM, L1 and L1ss for 8852c 9e3d242fd3b4 wifi: rtw89: pci: correct suspend/resume setting for variant chips
diff --git a/drivers/net/wireless/realtek/rtw89/mac.c b/drivers/net/wireless/realtek/rtw89/mac.c index 93124b815825f..61c7e79714925 100644 --- a/drivers/net/wireless/realtek/rtw89/mac.c +++ b/drivers/net/wireless/realtek/rtw89/mac.c @@ -1053,18 +1053,29 @@ void rtw89_mac_power_mode_change(struct rtw89_dev *rtwdev, bool enter) enum rtw89_rpwm_req_pwr_state state; unsigned long delay = enter ? 10 : 150; int ret; + int i; if (enter) state = rtw89_mac_get_req_pwr_state(rtwdev); else state = RTW89_MAC_RPWM_REQ_PWR_STATE_ACTIVE; - rtw89_mac_send_rpwm(rtwdev, state, false); - ret = read_poll_timeout_atomic(rtw89_mac_check_cpwm_state, ret, !ret, - delay, 15000, false, rtwdev, state); - if (ret) - rtw89_err(rtwdev, "firmware failed to ack for %s ps mode\n", - enter ? "entering" : "leaving"); + for (i = 0; i < RPWM_TRY_CNT; i++) { + rtw89_mac_send_rpwm(rtwdev, state, false); + ret = read_poll_timeout_atomic(rtw89_mac_check_cpwm_state, ret, + !ret, delay, 15000, false, + rtwdev, state); + if (!ret) + break; + + if (i == RPWM_TRY_CNT - 1) + rtw89_err(rtwdev, "firmware failed to ack for %s ps mode\n", + enter ? "entering" : "leaving"); + else + rtw89_debug(rtwdev, RTW89_DBG_UNEXP, + "%d time firmware failed to ack for %s ps mode\n", + i + 1, enter ? "entering" : "leaving"); + } } void rtw89_mac_notify_wake(struct rtw89_dev *rtwdev) diff --git a/drivers/net/wireless/realtek/rtw89/mac.h b/drivers/net/wireless/realtek/rtw89/mac.h index f66619354734d..986e359a82237 100644 --- a/drivers/net/wireless/realtek/rtw89/mac.h +++ b/drivers/net/wireless/realtek/rtw89/mac.h @@ -11,6 +11,7 @@ #define ADDR_CAM_ENT_SIZE 0x40 #define BSSID_CAM_ENT_SIZE 0x08 #define HFC_PAGE_UNIT 64 +#define RPWM_TRY_CNT 3 enum rtw89_mac_hwmod_sel { RTW89_DMAC_SEL = 0,