Commit c45ee4ff authored by Yoni Divinsky's avatar Yoni Divinsky Committed by John W. Linville

wlcore: change the wait for event mechanism

wlcore needs to wait for certain events for example
for roc complete event. Usually the events are received
from the FW very fast, therefore wlcore can poll with
a short delay and if after a second the event was
not received yet poll with a long (1-5 msec) delay.

This implementation is similar to the sending of
commands to the FW.

Empirically the change reduced the wait for roc event
from ~10-40msec to 100s of usecs.

[replace udelay/msleep with usleep_range - Arik]
Signed-off-by: default avatarYoni Divinsky <yoni.divinsky@ti.com>
Signed-off-by: default avatarArik Nemtsov <arik@wizery.com>
parent c24ec83b
...@@ -39,6 +39,7 @@ ...@@ -39,6 +39,7 @@
#include "hw_ops.h" #include "hw_ops.h"
#define WL1271_CMD_FAST_POLL_COUNT 50 #define WL1271_CMD_FAST_POLL_COUNT 50
#define WL1271_WAIT_EVENT_FAST_POLL_COUNT 20
/* /*
* send command to firmware * send command to firmware
...@@ -138,6 +139,7 @@ static int wl1271_cmd_wait_for_event_or_timeout(struct wl1271 *wl, ...@@ -138,6 +139,7 @@ static int wl1271_cmd_wait_for_event_or_timeout(struct wl1271 *wl,
u32 *events_vector; u32 *events_vector;
u32 event; u32 event;
unsigned long timeout_time; unsigned long timeout_time;
u16 poll_count = 0;
int ret = 0; int ret = 0;
*timeout = false; *timeout = false;
...@@ -156,7 +158,11 @@ static int wl1271_cmd_wait_for_event_or_timeout(struct wl1271 *wl, ...@@ -156,7 +158,11 @@ static int wl1271_cmd_wait_for_event_or_timeout(struct wl1271 *wl,
goto out; goto out;
} }
msleep(1); poll_count++;
if (poll_count < WL1271_WAIT_EVENT_FAST_POLL_COUNT)
usleep_range(50, 51);
else
usleep_range(1000, 5000);
/* read from both event fields */ /* read from both event fields */
ret = wlcore_read(wl, wl->mbox_ptr[0], events_vector, ret = wlcore_read(wl, wl->mbox_ptr[0], events_vector,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment