extern int dhd_os_wake_lock(dhd_pub_t *pub);
extern int dhd_os_wake_unlock(dhd_pub_t *pub);
extern int dhd_os_wake_lock_timeout(dhd_pub_t *pub);
-extern int dhd_os_wake_lock_timeout_enable(dhd_pub_t *pub);
+extern int dhd_os_wake_lock_timeout_enable(dhd_pub_t *pub, int val);
inline static void MUTEX_LOCK_SOFTAP_SET_INIT(dhd_pub_t * dhdp)
{
#define DHD_OS_WAKE_LOCK(pub) dhd_os_wake_lock(pub)
#define DHD_OS_WAKE_UNLOCK(pub) dhd_os_wake_unlock(pub)
#define DHD_OS_WAKE_LOCK_TIMEOUT(pub) dhd_os_wake_lock_timeout(pub)
-#define DHD_OS_WAKE_LOCK_TIMEOUT_ENABLE(pub) dhd_os_wake_lock_timeout_enable(pub)
-
+#define DHD_OS_WAKE_LOCK_TIMEOUT_ENABLE(pub, val) dhd_os_wake_lock_timeout_enable(pub, val)
+#define DHD_PACKET_TIMEOUT 1
+#define DHD_EVENT_TIMEOUT 2
/* interface operations (register, remove) should be atomic, use this lock to prevent race
* condition among wifi on/off and interface operation functions
int i;
dhd_if_t *ifp;
wl_event_msg_t event;
+ int tout = DHD_PACKET_TIMEOUT;
DHD_TRACE(("%s: Enter\n", __FUNCTION__));
if (event.event_type == WLC_E_BTA_HCI_EVENT) {
dhd_bta_doevt(dhdp, data, event.datalen);
}
+ tout = DHD_EVENT_TIMEOUT;
}
ASSERT(ifidx < DHD_MAX_IFS && dhd->iflist[ifidx]);
#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0) */
}
}
- DHD_OS_WAKE_LOCK_TIMEOUT_ENABLE(dhdp);
+ DHD_OS_WAKE_LOCK_TIMEOUT_ENABLE(dhdp, tout);
}
void
ret = dhd->wakelock_timeout_enable;
#ifdef CONFIG_HAS_WAKELOCK
if (dhd->wakelock_timeout_enable)
- wake_lock_timeout(&dhd->wl_rxwake, HZ);
+ wake_lock_timeout(&dhd->wl_rxwake,
+ dhd->wakelock_timeout_enable * HZ);
#endif
dhd->wakelock_timeout_enable = 0;
spin_unlock_irqrestore(&dhd->wakelock_spinlock, flags);
return ret;
}
-int dhd_os_wake_lock_timeout_enable(dhd_pub_t *pub)
+int dhd_os_wake_lock_timeout_enable(dhd_pub_t *pub, int val)
{
dhd_info_t *dhd = (dhd_info_t *)(pub->info);
unsigned long flags;
if (dhd) {
spin_lock_irqsave(&dhd->wakelock_spinlock, flags);
- dhd->wakelock_timeout_enable = 1;
+ if (val > dhd->wakelock_timeout_enable)
+ dhd->wakelock_timeout_enable = val;
spin_unlock_irqrestore(&dhd->wakelock_spinlock, flags);
}
return 0;
}
-int net_os_wake_lock_timeout_enable(struct net_device *dev)
+int net_os_wake_lock_timeout_enable(struct net_device *dev, int val)
{
dhd_info_t *dhd = *(dhd_info_t **)netdev_priv(dev);
int ret = 0;
if (dhd)
- ret = dhd_os_wake_lock_timeout_enable(&dhd->pub);
+ ret = dhd_os_wake_lock_timeout_enable(&dhd->pub, val);
return ret;
}
static void wl_wakeup_event(struct wl_priv *wl)
{
- if (wl->event_tsk.thr_pid >= 0)
+ if (wl->event_tsk.thr_pid >= 0) {
+ DHD_OS_WAKE_LOCK(wl->pub);
up(&wl->event_tsk.sema);
+ }
}
static s32 wl_event_handler(void *data)
e = wl_deq_event(wl);
if (unlikely(!e)) {
WL_ERR(("equeue empty..\n"));
+ DHD_OS_WAKE_UNLOCK(wl->pub);
return 0;
}
WL_DBG(("event type (%d), if idx: %d\n", e->etype, e->emsg.ifidx));
WL_DBG(("Unknown Event (%d): ignoring\n", e->etype));
}
wl_put_event(e);
+ DHD_OS_WAKE_UNLOCK(wl->pub);
}
WL_DBG(("%s was terminated\n", __func__));
complete_and_exit(&tsk->completed, 0);
strcpy(extra, flag);
wrqu.data.length = strlen(extra);
wireless_send_event(dev, cmd, &wrqu, extra);
- net_os_wake_lock_timeout_enable(dev);
+ net_os_wake_lock_timeout_enable(dev, DHD_EVENT_TIMEOUT);
WL_TRACE(("Send IWEVCUSTOM Event as %s\n", extra));
return 0;
WL_TRACE(("Link UP\n"));
}
- net_os_wake_lock_timeout_enable(dev);
wrqu.addr.sa_family = ARPHRD_ETHER;
break;
case WLC_E_ACTION_FRAME:
WL_ERROR(("%s Event WLC_E_PFN_NET_FOUND, send %s up : find %s len=%d\n",
__FUNCTION__, PNO_EVENT_UP, netinfo->pfnsubnet.SSID,
netinfo->pfnsubnet.SSID_len));
- net_os_wake_lock_timeout_enable(dev);
cmd = IWEVCUSTOM;
memset(&wrqu, 0, sizeof(wrqu));
strcpy(extra, PNO_EVENT_UP);
extern int net_os_wake_lock(struct net_device *dev);
extern int net_os_wake_unlock(struct net_device *dev);
extern int net_os_wake_lock_timeout(struct net_device *dev);
-extern int net_os_wake_lock_timeout_enable(struct net_device *dev);
+extern int net_os_wake_lock_timeout_enable(struct net_device *dev, int val);
extern int net_os_set_suspend_disable(struct net_device *dev, int val);
extern int net_os_set_suspend(struct net_device *dev, int val);
extern int net_os_set_dtim_skip(struct net_device *dev, int val);
extern int net_os_wake_lock(struct net_device *dev);
extern int net_os_wake_unlock(struct net_device *dev);
extern int net_os_wake_lock_timeout(struct net_device *dev);
-extern int net_os_wake_lock_timeout_enable(struct net_device *dev);
+extern int net_os_wake_lock_timeout_enable(struct net_device *dev, int val);
extern int net_os_set_dtim_skip(struct net_device *dev, int val);
extern int net_os_set_suspend_disable(struct net_device *dev, int val);
extern int net_os_set_suspend(struct net_device *dev, int val);