mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-05 18:39:59 +00:00
wifi: rtw89: add retry to change power_mode state
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> Signed-off-by: Kalle Valo <kvalo@kernel.org> Link: https://lore.kernel.org/r/20220819064811.37700-2-pkshih@realtek.com
This commit is contained in:
parent
08aa80777b
commit
48c0e34755
2 changed files with 18 additions and 6 deletions
|
@ -1054,18 +1054,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)
|
||||
|
|
|
@ -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,
|
||||
|
|
Loading…
Reference in a new issue