From f52b89b7405466ddefb65fa9337f535612e8281b Mon Sep 17 00:00:00 2001 From: Rahul Bansal Date: Mon, 13 Dec 2010 16:51:46 +0530 Subject: [bcm4329] WOW support in BCM driver Making sure that Rx pkt is acknowledged and sent to network interface by wifi driver before system goes in suspend. BUG ID 767438 Change-Id: Ie88176ec11aa1d2fe4253d9b0472d13a4742d300 Reviewed-on: http://git-master/r/12703 Reviewed-by: Rakesh Kumar Reviewed-by: Bharat Nihalani Tested-by: Bharat Nihalani --- drivers/net/wireless/bcm4329/dhd.h | 7 +++++++ drivers/net/wireless/bcm4329/dhd_linux.c | 8 ++++++++ drivers/net/wireless/bcm4329/dhd_sdio.c | 10 ++++++++++ 3 files changed, 25 insertions(+) mode change 100644 => 100755 drivers/net/wireless/bcm4329/dhd.h diff --git a/drivers/net/wireless/bcm4329/dhd.h b/drivers/net/wireless/bcm4329/dhd.h old mode 100644 new mode 100755 index 1ddf1ff61e70..41672672477e --- a/drivers/net/wireless/bcm4329/dhd.h +++ b/drivers/net/wireless/bcm4329/dhd.h @@ -47,6 +47,10 @@ #include #include +#ifdef CONFIG_HAS_WAKELOCK +#include +#endif + /* The kernel threading is sdio-specific */ #else /* LINUX */ #define ENOMEM 1 @@ -167,6 +171,9 @@ typedef struct dhd_pub { uint8 country_code[WLC_CNTRY_BUF_SZ]; char eventmask[WL_EVENTING_MASK_LEN]; +#ifdef CONFIG_HAS_WAKELOCK + struct wake_lock wow_wakelock; +#endif } dhd_pub_t; #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)) && defined(CONFIG_PM_SLEEP) diff --git a/drivers/net/wireless/bcm4329/dhd_linux.c b/drivers/net/wireless/bcm4329/dhd_linux.c index c7ef3edd908f..a052386f28a7 100644 --- a/drivers/net/wireless/bcm4329/dhd_linux.c +++ b/drivers/net/wireless/bcm4329/dhd_linux.c @@ -2153,6 +2153,10 @@ dhd_attach(osl_t *osh, struct dhd_bus *bus, uint bus_hdrlen) register_pm_notifier(&dhd_sleep_pm_notifier); #endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)) && defined(CONFIG_PM_SLEEP) */ +#ifdef CONFIG_HAS_WAKELOCK + wake_lock_init(&dhd->pub.wow_wakelock, WAKE_LOCK_SUSPEND, "wow_wake_lock"); +#endif + #ifdef CONFIG_HAS_EARLYSUSPEND dhd->early_suspend.level = EARLY_SUSPEND_LEVEL_BLANK_SCREEN + 20; dhd->early_suspend.suspend = dhd_early_suspend; @@ -2500,6 +2504,10 @@ dhd_detach(dhd_pub_t *dhdp) if (dhdp->prot) dhd_prot_detach(dhdp); +#ifdef CONFIG_HAS_WAKELOCK + wake_lock_destroy(&dhdp->wow_wakelock); +#endif + #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)) && defined(CONFIG_PM_SLEEP) unregister_pm_notifier(&dhd_sleep_pm_notifier); #endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)) && defined(CONFIG_PM_SLEEP) */ diff --git a/drivers/net/wireless/bcm4329/dhd_sdio.c b/drivers/net/wireless/bcm4329/dhd_sdio.c index ac46ca91eaeb..8915857cf2c8 100644 --- a/drivers/net/wireless/bcm4329/dhd_sdio.c +++ b/drivers/net/wireless/bcm4329/dhd_sdio.c @@ -58,6 +58,10 @@ #include #include +#ifdef CONFIG_HAS_WAKELOCK +#include +#endif + #ifdef DHD_DEBUG #include #endif /* DHD_DEBUG */ @@ -4182,6 +4186,9 @@ dhdsdio_dpc(dhd_bus_t *bus) /* Handle host mailbox indication */ if (intstatus & I_HMB_HOST_INT) { +#ifdef CONFIG_HAS_WAKELOCK + wake_lock_timeout(&bus->dhd->wow_wakelock, 3*HZ); +#endif intstatus &= ~I_HMB_HOST_INT; intstatus |= dhdsdio_hostmail(bus); } @@ -4214,6 +4221,9 @@ dhdsdio_dpc(dhd_bus_t *bus) /* On frame indication, read available frames */ if (PKT_AVAILABLE()) { +#ifdef CONFIG_HAS_WAKELOCK + wake_lock_timeout(&bus->dhd->wow_wakelock, 3*HZ); +#endif framecnt = dhdsdio_readframes(bus, rxlimit, &rxdone); if (rxdone || bus->rxskip) intstatus &= ~I_HMB_FRAME_IND; -- cgit v1.2.3