FROMLIST: rtw88: use shorter delay time to poll PS state

When TX packet arrives, driver should leave deep PS state to make
sure the DMA is working. After requested to leave deep PS state,
driver needs to poll the PS state to check if the mode has been
changed successfully. The driver used to check the state of the
hardware every 20 msecs, which means upon the first failure of
state check, the CPU is delayed 20 msecs for next check. This is
harmful for some time-sensitive applications such as media players.

So, use shorter delay time each check from 20 msecs to 100 usecs.
The state should be changed in several tries. But we still need
to reserve ~15 msecs in total in case of the state just took too
long to be changed successfully. If the states of driver and the
hardware is not synchronized, the power state could be locked
forever, which mean we could never enter/leave the PS state.

Signed-off-by: Yan-Hsuan Chuang <yhchuang@realtek.com>
(am from https://patchwork.kernel.org/patch/11320947/)
(also found at https://lkml.kernel.org/r/20200107142729.17716-1-yhchuang@realtek.com)

BUG=b:124400293
BUG=b:146868244
TEST=play music or video locally with wifi connected, then wifi
     will try to leave/enter PS state periodically, and see if
     there's any sound glitch (VLC/Google Play Music)

Change-Id: I4cf64ce7c9dc065ec6923e00f3fda3e199f19a66
Signed-off-by: Yan-Hsuan Chuang <yhchuang@realtek.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/kernel/+/1989626
Reviewed-by: Sean Paul <seanpaul@chromium.org>
Reviewed-by: Brian Norris <briannorris@chromium.org>
Commit-Queue: Brian Norris <briannorris@chromium.org>
(cherry picked from commit fef4ca83ffec55c087e34ff8506f1fbae36f6896)
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/kernel/+/2001813
Tested-by: Brian Norris <briannorris@chromium.org>
1 file changed