rtw88: leave PS state for dynamic mechanism

Dynamic mechanism requires BB/RF working to adjust
hardware settings. But PS state periodically turns
off BB/RF, could lead to wrong setting.

So leave PS state before DM to make sure it works.
And then check if we can enter PS state again.

Signed-off-by: Yan-Hsuan Chuang <yhchuang@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
This commit is contained in:
Yan-Hsuan Chuang 2019-10-02 10:31:23 +08:00 committed by Kalle Valo
parent d3e20fd17d
commit 37ba5de2e7

View File

@ -174,6 +174,14 @@ static void rtw_watch_dog_work(struct work_struct *work)
rtwdev->stats.tx_cnt = 0;
rtwdev->stats.rx_cnt = 0;
if (test_bit(RTW_FLAG_SCANNING, rtwdev->flags))
goto unlock;
/* make sure BB/RF is working for dynamic mech */
rtw_leave_lps(rtwdev);
rtw_phy_dynamic_mechanism(rtwdev);
/* use atomic version to avoid taking local->iflist_mtx mutex */
rtw_iterate_vifs_atomic(rtwdev, rtw_vif_watch_dog_iter, &data);
@ -184,13 +192,6 @@ static void rtw_watch_dog_work(struct work_struct *work)
if (rtw_fw_support_lps &&
data.rtwvif && !data.active && data.assoc_cnt == 1)
rtw_enter_lps(rtwdev, data.rtwvif->port);
else
rtw_leave_lps(rtwdev);
if (test_bit(RTW_FLAG_SCANNING, rtwdev->flags))
goto unlock;
rtw_phy_dynamic_mechanism(rtwdev);
rtwdev->watch_dog_cnt++;