PD#91902:update ap6xxx module wifi driver as 1.88.45.4
authorjiamin.miao <jiamin.miao@amlogic.com>
Tue, 24 Jun 2014 02:41:18 +0000 (10:41 +0800)
committerjiamin.miao <jiamin.miao@amlogic.com>
Tue, 24 Jun 2014 02:41:18 +0000 (10:41 +0800)
13 files changed:
broadcm_40181/bcmsdh_sdmmc.c
broadcm_40181/dhd.h
broadcm_40181/dhd_cdc.c
broadcm_40181/dhd_common.c
broadcm_40181/dhd_config.c
broadcm_40181/dhd_config.h
broadcm_40181/dhd_custom_gpio.c
broadcm_40181/dhd_linux.c
broadcm_40181/dhd_sdio.c
broadcm_40181/include/epivers.h
broadcm_40181/wl_android.c
broadcm_40181/wl_android.h
broadcm_40181/wl_cfg80211.c

index 3f109186d25b691263624269be4946100c796bc4..edd365b42dc7f2f7af888d01cade35a8e0355e30 100755 (executable)
@@ -370,7 +370,8 @@ sdioh_interrupt_deregister(sdioh_info_t *sd)
        sd->intr_handler = NULL;
        sd->intr_handler_arg = NULL;
 #elif defined(HW_OOB)
-       sdioh_disable_func_intr();
+    if (dhd_download_fw_on_driverload)
+           sdioh_disable_func_intr();
 #endif /* !defined(OOB_INTR_ONLY) */
        return SDIOH_API_RC_SUCCESS;
 }
index 74613351051729ed28866f71fd503dee37a1b07a..08fd6fbc7e69117481e8e76df492739c9a981e27 100755 (executable)
@@ -535,6 +535,8 @@ extern void * dhd_os_open_image(char * filename);
 extern int dhd_os_get_image_block(char * buf, int len, void * image);
 extern void dhd_os_close_image(void * image);
 extern void dhd_os_wd_timer(void *bus, uint wdtick);
+extern void dhd_init_lock_local(dhd_pub_t * pub); // terence 20120530: fix for preinit function missed called after resume
+extern void dhd_init_unlock_local(dhd_pub_t * pub);
 extern void dhd_os_sdlock(dhd_pub_t * pub);
 extern void dhd_os_sdunlock(dhd_pub_t * pub);
 extern void dhd_os_sdlock_txq(dhd_pub_t * pub);
index 9ec4c64240a567565eff76266c11cbaa25a765bd..61807639ab07b6f5d9ab3180c116d7f9ea2062d3 100755 (executable)
@@ -240,7 +240,7 @@ dhdcdc_set_ioctl(dhd_pub_t *dhd, int ifidx, uint cmd, void *buf, uint len, uint8
        /* Check the ERROR flag */
        if (flags & CDCF_IOC_ERROR)
        {
-           DHD_ERROR(("%s: CDCF_IOC_ERROR msg->status:%d\n", __FUNCTION__, msg->status));
+           DHD_ERROR(("%s: msg->status:%x\n", __FUNCTION__, msg->status));
                ret = ltoh32(msg->status);
                /* Cache error from dongle */
                dhd->dongle_error = ret;
index 55c39821a5a4ebed439daa3197f2d903396a3a40..e797c2d10803e1df72fe21689daefc7333ae7654 100755 (executable)
@@ -1685,10 +1685,10 @@ dhd_arp_offload_set(dhd_pub_t * dhd, int arp_mode)
        retcode = dhd_wl_ioctl_cmd(dhd, WLC_SET_VAR, iovbuf, sizeof(iovbuf), TRUE, 0);
        retcode = retcode >= 0 ? 0 : retcode;
        if (retcode)
-               DHD_TRACE(("%s: failed to set ARP offload mode to 0x%x, retcode = %d\n",
+               DHD_ERROR(("%s: failed to set ARP offload mode to 0x%x, retcode = %d\n",
                        __FUNCTION__, arp_mode, retcode));
        else
-               DHD_TRACE(("%s: successfully set ARP offload mode to 0x%x\n",
+               DHD_ARPOE(("%s: successfully set ARP offload mode to 0x%x\n",
                        __FUNCTION__, arp_mode));
 }
 
@@ -1702,10 +1702,10 @@ dhd_arp_offload_enable(dhd_pub_t * dhd, int arp_enable)
        retcode = dhd_wl_ioctl_cmd(dhd, WLC_SET_VAR, iovbuf, sizeof(iovbuf), TRUE, 0);
        retcode = retcode >= 0 ? 0 : retcode;
        if (retcode)
-               DHD_TRACE(("%s: failed to enabe ARP offload to %d, retcode = %d\n",
+               DHD_ERROR(("%s: failed to enabe ARP offload to %d, retcode = %d\n",
                        __FUNCTION__, arp_enable, retcode));
        else
-               DHD_TRACE(("%s: successfully enabed ARP offload to %d\n",
+               DHD_ARPOE(("%s: successfully enabed ARP offload to %d\n",
                        __FUNCTION__, arp_enable));
        if (arp_enable) {
                uint32 version;
@@ -1772,10 +1772,10 @@ dhd_arp_offload_add_ip(dhd_pub_t *dhd, uint32 ipaddr, int idx)
        retcode = dhd_wl_ioctl_cmd(dhd, WLC_SET_VAR, iovbuf, iov_len, TRUE, idx);
 
        if (retcode)
-               DHD_TRACE(("%s: ARP ip addr add failed, retcode = %d\n",
+               DHD_ERROR(("%s: ARP ip addr add failed, retcode = %d\n",
                __FUNCTION__, retcode));
        else
-               DHD_TRACE(("%s: sARP H ipaddr entry added \n",
+               DHD_ARPOE(("%s: sARP H ipaddr entry added \n",
                __FUNCTION__));
 }
 
@@ -1798,7 +1798,7 @@ dhd_arp_get_arp_hostip_table(dhd_pub_t *dhd, void *buf, int buflen, int idx)
        retcode = dhd_wl_ioctl_cmd(dhd, WLC_GET_VAR, buf, buflen, FALSE, idx);
 
        if (retcode) {
-               DHD_TRACE(("%s: ioctl WLC_GET_VAR error %d\n",
+               DHD_ERROR(("%s: ioctl WLC_GET_VAR error %d\n",
                __FUNCTION__, retcode));
 
                return -1;
index 6a4062434e92d34abbbe3f7cb86cf909fafc1236..5cbfb9ba6122c937651615a5134fbc3de3538c83 100755 (executable)
@@ -3,10 +3,10 @@
 #include <osl.h>\r
 \r
 #include <bcmutils.h>\r
+#include <hndsoc.h>\r
 #if defined(HW_OOB)\r
 #include <bcmdefs.h>\r
 #include <bcmsdh.h>\r
-#include <hndsoc.h>\r
 #include <sdio.h>\r
 #include <sbchipc.h>\r
 #endif\r
 #include <dhd_dbg.h>\r
 #include <wl_cfg80211.h>\r
 \r
+#ifdef CONFIG_HAS_WAKELOCK\r
+#include <linux/wakelock.h>\r
+#endif\r
+\r
 /* message levels */\r
 #define CONFIG_ERROR_LEVEL     0x0001\r
 #define CONFIG_TRACE_LEVEL     0x0002\r
@@ -594,7 +598,7 @@ dhd_conf_set_roam(dhd_pub_t *dhd)
 }\r
 \r
 void\r
-dhd_conf_set_bw(dhd_pub_t *dhd)\r
+dhd_conf_set_mimo_bw_cap(dhd_pub_t *dhd)\r
 {\r
        int bcmerror = -1;\r
        char iovbuf[WL_EVENTING_MASK_LEN + 12]; /*  Room for "event_msgs" + '\0' + bitvec  */\r
@@ -603,7 +607,8 @@ dhd_conf_set_bw(dhd_pub_t *dhd)
 \r
        chip = dhd_bus_chip_id(dhd);\r
        if (chip!=BCM43362_CHIP_ID && chip!=BCM4330_CHIP_ID) {\r
-               mimo_bw_cap = dhd->conf->bw;\r
+               if (dhd->conf->mimo_bw_cap >= 0) {\r
+                       mimo_bw_cap = (uint)dhd->conf->mimo_bw_cap;\r
                if ((bcmerror = dhd_wl_ioctl_cmd(dhd, WLC_DOWN, NULL, 0, TRUE, 0)) < 0)\r
                        CONFIG_ERROR(("%s: WLC_DOWN setting failed %d\n", __FUNCTION__, bcmerror));\r
                /*  0:HT20 in ALL, 1:HT40 in ALL, 2: HT20 in 2G HT40 in 5G */\r
@@ -611,6 +616,7 @@ dhd_conf_set_bw(dhd_pub_t *dhd)
                bcm_mkiovar("mimo_bw_cap", (char *)&mimo_bw_cap, 4, iovbuf, sizeof(iovbuf));\r
                if ((bcmerror = dhd_wl_ioctl_cmd(dhd, WLC_SET_VAR, iovbuf, sizeof(iovbuf), TRUE, 0)) < 0)\r
                        CONFIG_ERROR(("%s: mimo_bw_cap setting failed %d\n", __FUNCTION__, bcmerror));\r
+               }\r
        }\r
 }\r
 \r
@@ -837,6 +843,9 @@ dhd_conf_discard_pkt_filter(dhd_pub_t *dhd)
        /* discard IPv6 multicast address FF00::/8 */\r
        dhd->pktfilter[dhd->pktfilter_count] = "112 0 0 12 0xFFFF000000000000000000000000000000000000000000000000FF 0x86DD000000000000000000000000000000000000000000000000FF";\r
        dhd->pktfilter_count++;\r
+       /* discard Netbios pkt */\r
+       dhd->pktfilter[dhd->pktfilter_count] = "120 0 0 12 0xFFFF000000000000000000FF000000000000000000000000FFFF 0x0800000000000000000000110000000000000000000000000089";\r
+       dhd->pktfilter_count++;\r
 \r
 }\r
 #endif /* PKT_FILTER_SUPPORT */\r
@@ -905,6 +914,20 @@ dhd_conf_set_ampdu_ba_wsize(dhd_pub_t *dhd)
        }\r
 }\r
 \r
+void\r
+dhd_conf_set_spect(dhd_pub_t *dhd)\r
+{\r
+       int bcmerror = -1;\r
+       int spect = 0;\r
+\r
+       if (dhd->conf->spect >= 0) {\r
+               spect = (uint)dhd->conf->spect;\r
+               printf("%s: set spect %d\n", __FUNCTION__, spect);\r
+               if ((bcmerror = dhd_wl_ioctl_cmd(dhd, WLC_SET_SPECT_MANAGMENT, &spect , sizeof(spect), true, 0)) < 0)\r
+                       CONFIG_ERROR(("%s: WLC_SET_SPECT_MANAGMENT setting failed %d\n", __FUNCTION__, bcmerror));\r
+       }\r
+}\r
+\r
 unsigned int\r
 process_config_vars(char *varbuf, unsigned int len, char *pickbuf, char *param)\r
 {\r
@@ -1190,10 +1213,10 @@ dhd_conf_read_config(dhd_pub_t *dhd)
 \r
                /* Process bandwidth */\r
                memset(pick, 0, MAXSZ_BUF);\r
-               len_val = process_config_vars(bufp, len, pick, "bw=");\r
+               len_val = process_config_vars(bufp, len, pick, "mimo_bw_cap=");\r
                if (len_val) {\r
-                       dhd->conf->bw = (uint)simple_strtol(pick, NULL, 10);\r
-                       printf("%s: bw = %d\n", __FUNCTION__, dhd->conf->bw);\r
+                       dhd->conf->mimo_bw_cap = (uint)simple_strtol(pick, NULL, 10);\r
+                       printf("%s: mimo_bw_cap = %d\n", __FUNCTION__, dhd->conf->mimo_bw_cap);\r
                }\r
 \r
                /* Process country code */\r
@@ -1505,6 +1528,14 @@ dhd_conf_read_config(dhd_pub_t *dhd)
                                dhd->conf->kso_enable = TRUE;\r
                        printf("%s: kso_enable = %d\n", __FUNCTION__, dhd->conf->kso_enable);\r
                }\r
+\r
+               /* Process spect parameters */\r
+               memset(pick, 0, MAXSZ_BUF);\r
+               len_val = process_config_vars(bufp, len, pick, "spect=");\r
+               if (len_val) {\r
+                       dhd->conf->spect = (int)simple_strtol(pick, NULL, 10);\r
+                       printf("%s: spect = %d\n", __FUNCTION__, dhd->conf->spect);\r
+               }\r
  \r
                bcmerror = 0;\r
        } else {\r
@@ -1532,7 +1563,7 @@ dhd_conf_preinit(dhd_pub_t *dhd)
        memset(dhd->conf, 0, sizeof(dhd_conf_t));\r
 \r
        dhd->conf->band = WLC_BAND_AUTO;\r
-       dhd->conf->bw = WLC_N_BW_40ALL;\r
+       dhd->conf->mimo_bw_cap = -1;\r
        if (dhd_bus_chip_id(dhd) == BCM43362_CHIP_ID ||\r
                        dhd_bus_chip_id(dhd) == BCM4330_CHIP_ID) {\r
                strcpy(dhd->conf->cspec.country_abbrev, "ALL");\r
@@ -1579,12 +1610,13 @@ dhd_conf_preinit(dhd_pub_t *dhd)
 #endif\r
        dhd->conf->srl = -1;\r
        dhd->conf->lrl = -1;\r
-       dhd->conf->bcn_timeout = 4;\r
+       dhd->conf->bcn_timeout = 8;\r
        if (dhd_bus_chip_id(dhd) == BCM4339_CHIP_ID) {\r
                dhd->conf->bus_txglom = 8;\r
                dhd->conf->ampdu_ba_wsize = 40;\r
        }\r
        dhd->conf->kso_enable = TRUE;\r
+       dhd->conf->spect = -1;\r
 \r
        return 0;\r
 }\r
@@ -1639,6 +1671,9 @@ struct sdio_early_suspend_info {
        struct early_suspend sdio_early_suspend;\r
        struct work_struct      tqueue;\r
        int do_late_resume;\r
+#if defined(CONFIG_HAS_WAKELOCK)\r
+    struct wake_lock power_wake_lock;\r
+#endif\r
 };\r
 struct sdio_early_suspend_info sdioinfo[4];\r
 \r
@@ -1660,7 +1695,7 @@ dhd_conf_wifi_stop(struct net_device *dev)
 #endif\r
                dhd_bus_devreset(bcmsdh_get_drvdata(), true);\r
                sdioh_stop(NULL);\r
-               dhd_customer_gpio_wlan_ctrl(WLAN_RESET_OFF);\r
+               dhd_customer_gpio_wlan_ctrl(WLAN_POWER_OFF);\r
                g_wifi_on = FALSE;\r
 #ifdef WL_CFG80211\r
                wl_cfg80211_user_sync(false);\r
@@ -1716,7 +1751,14 @@ dhd_conf_wifi_power(bool on)
 void\r
 dhd_conf_power_workqueue(struct work_struct *work)\r
 {\r
+#if defined(CONFIG_HAS_WAKELOCK)\r
+    struct sdio_early_suspend_info *sdioinfo =container_of(work, struct sdio_early_suspend_info, tqueue);\r
+    wake_lock(&sdioinfo->power_wake_lock);\r
+#endif\r
     dhd_conf_wifi_power(true);\r
+#if defined(CONFIG_HAS_WAKELOCK)\r
+    wake_unlock(&sdioinfo->power_wake_lock);\r
+#endif\r
 }\r
 \r
 void\r
@@ -1765,6 +1807,10 @@ dhd_conf_register_wifi_suspend(struct sdio_func *func)
                sdioinfo[func->num].sdio_early_suspend.resume = dhd_conf_late_resume;\r
                register_early_suspend(&sdioinfo[func->num].sdio_early_suspend);\r
                INIT_WORK(&sdioinfo[func->num].tqueue, dhd_conf_power_workqueue);\r
+#ifdef CONFIG_HAS_WAKELOCK\r
+        wake_lock_init(&sdioinfo[func->num].power_wake_lock, WAKE_LOCK_SUSPEND, "wifi_power_wake");\r
+        printk("init wifi power_wake lock\n");\r
+#endif\r
        }\r
 #endif\r
 }\r
@@ -1775,6 +1821,9 @@ dhd_conf_unregister_wifi_suspend(struct sdio_func *func)
 #ifdef CONFIG_HAS_EARLYSUSPEND\r
        if (func->num == 2) {\r
                if (sdioinfo[func->num].sdio_early_suspend.suspend) {\r
+#ifdef CONFIG_HAS_WAKELOCK\r
+            wake_lock_destroy(&sdioinfo[func->num].power_wake_lock);\r
+#endif\r
                        unregister_early_suspend(&sdioinfo[func->num].sdio_early_suspend);\r
                        sdioinfo[func->num].sdio_early_suspend.suspend = NULL;\r
                }\r
index 5faaa378aea9db57e1e36a767b87c9a303cd9f34..003f997575e3724728f613e118335ed3a05ab0a2 100755 (executable)
@@ -81,7 +81,7 @@ typedef struct dhd_conf {
        char fw_path[MOD_PARAM_PATHLEN];                /* Firmware path */\r
        char nv_path[MOD_PARAM_PATHLEN];                /* NVRAM path */\r
        uint band;                      /* Band, b:2.4G only, otherwise for auto */\r
-       uint bw;                        /* Bandwidth, 0:HT20ALL, 1: HT40ALL, 2:HT20IN2G_HT40PIN5G */\r
+       int mimo_bw_cap;                        /* Bandwidth, 0:HT20ALL, 1: HT40ALL, 2:HT20IN2G_HT40PIN5G */\r
        wl_country_t cspec;             /* Country */\r
        wl_channel_list_t channels;     /* Support channels */\r
        uint roam_off;          /* Roaming, 0:enable, 1:disable */\r
@@ -105,6 +105,7 @@ typedef struct dhd_conf {
        uint32 bus_txglom;      /* bus:txglom */\r
        uint32 ampdu_ba_wsize;\r
        bool kso_enable;\r
+       int spect;\r
 } dhd_conf_t;\r
 \r
 extern void *bcmsdh_get_drvdata(void);\r
@@ -123,7 +124,7 @@ int dhd_conf_get_country(dhd_pub_t *dhd, wl_country_t *cspec);
 int dhd_conf_fix_country(dhd_pub_t *dhd);\r
 bool dhd_conf_match_channel(dhd_pub_t *dhd, uint32 channel);\r
 int dhd_conf_set_roam(dhd_pub_t *dhd);\r
-void dhd_conf_set_bw(dhd_pub_t *dhd);\r
+void dhd_conf_set_mimo_bw_cap(dhd_pub_t *dhd);\r
 void dhd_conf_force_wme(dhd_pub_t *dhd);\r
 void dhd_conf_get_wme(dhd_pub_t *dhd, edcf_acparam_t *acp);\r
 void dhd_conf_set_wme(dhd_pub_t *dhd);\r
@@ -136,6 +137,7 @@ void dhd_conf_set_srl(dhd_pub_t *dhd);
 void dhd_conf_set_lrl(dhd_pub_t *dhd);\r
 void dhd_conf_set_glom(dhd_pub_t *dhd);\r
 void dhd_conf_set_ampdu_ba_wsize(dhd_pub_t *dhd);\r
+void dhd_conf_set_spect(dhd_pub_t *dhd);\r
 int dhd_conf_read_config(dhd_pub_t *dhd);\r
 int dhd_conf_preinit(dhd_pub_t *dhd);\r
 int dhd_conf_attach(dhd_pub_t *dhd);\r
index ffcd338f1005b42872319a86342865faf814e88c..2b544b483a7e2bb9dafe9f4b2b99e3defd6e9eff 100755 (executable)
@@ -130,11 +130,14 @@ dhd_customer_gpio_wlan_ctrl(int onoff)
 #if defined(CUSTOMER_HW2)
                        wifi_set_power(0, WIFI_TURNOFF_DELAY);
 #endif
+#ifdef CUSTOMER_HW_AMLOGIC
+                       //extern_wifi_set_enable(0);
+#endif /* CUSTOMER_HW_AMLOGIC */
                        WL_ERROR(("=========== WLAN placed in RESET ========\n"));
                break;
 
                case WLAN_RESET_ON:
-                       WL_TRACE(("%s: callc customer specific GPIO to remove WLAN RESET\n",
+                       WL_TRACE(("%s: call customer specific GPIO to remove WLAN RESET\n",
                                __FUNCTION__));
 #ifdef CUSTOMER_HW
                        bcm_wlan_power_on(2);
index 66cc8ede81848481d1f55d04053c7c9d0dd24f5e..39c829e95587b9a8b38e326621368db09d4995b4 100755 (executable)
@@ -308,6 +308,7 @@ typedef struct dhd_info {
        struct mutex dhd_net_if_mutex;
        struct mutex dhd_suspend_mutex;
 #endif
+    struct mutex dhd_init_mutex; // terence 20120530: fix for preinit function missed called after resume
        spinlock_t wakelock_spinlock;
        int wakelock_counter;
        int wakelock_wd_counter;
@@ -2854,7 +2855,7 @@ dhd_stop(struct net_device *net)
        int ifidx = 0;
        dhd_info_t *dhd = *(dhd_info_t **)netdev_priv(net);
        DHD_OS_WAKE_LOCK(&dhd->pub);
-       DHD_ERROR(("%s: Enter %p\n", __FUNCTION__, net));
+       printk("%s: Enter %p\n", __FUNCTION__, net);
 
        if (dhd->pub.up == 0) {
                goto exit;
@@ -2901,6 +2902,7 @@ exit:
        dhd->pub.txcnt_timeout = 0;
        dhd->pub.hang_was_sent = 0;
 
+       printk("%s: Exit\n", __FUNCTION__);
        DHD_OS_WAKE_UNLOCK(&dhd->pub);
        return 0;
 }
@@ -2916,7 +2918,7 @@ dhd_open(struct net_device *net)
        int ifidx;
        int32 ret = 0;
 
-       DHD_ERROR(("%s: Enter %p\n", __FUNCTION__, net));
+       printk("%s: Enter %p\n", __FUNCTION__, net);
 
 #if defined(MULTIPLE_SUPPLICANT)
 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 25)) && 1 && 1
@@ -2928,6 +2930,7 @@ dhd_open(struct net_device *net)
 #endif /* MULTIPLE_SUPPLICANT */
 
        DHD_OS_WAKE_LOCK(&dhd->pub);
+    dhd_init_lock_local(&dhd->pub); // terence 20120530: fix for preinit function missed called after resume
        /* Update FW path if it was changed */
        if (strlen(firmware_path) != 0) {
                if (firmware_path[strlen(firmware_path)-1] == '\n')
@@ -3026,6 +3029,7 @@ exit:
        if (ret)
                dhd_stop(net);
 
+    dhd_init_unlock_local(&dhd->pub); // terence 20120530: fix for preinit function missed called after resume
        DHD_OS_WAKE_UNLOCK(&dhd->pub);
 
 #if defined(MULTIPLE_SUPPLICANT)
@@ -3034,6 +3038,7 @@ exit:
 #endif
 #endif /* MULTIPLE_SUPPLICANT */
 
+       printk("%s: Exit ret=%d\n", __FUNCTION__, ret);
        return ret;
 }
 
@@ -3326,7 +3331,9 @@ dhd_attach(osl_t *osh, struct dhd_bus *bus, uint bus_hdrlen)
 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 25)) && 1
        mutex_init(&dhd->dhd_net_if_mutex);
        mutex_init(&dhd->dhd_suspend_mutex);
+    mutex_init(&dhd->dhd_init_mutex); // terence 20120530: fix for preinit function missed called after resume
 #endif
+    dhd_init_lock_local(&dhd->pub); // terence 20120530: fix for preinit function missed called after resume
        dhd_state |= DHD_ATTACH_STATE_WAKELOCKS_INIT;
 
        if (dhd_conf_attach(&dhd->pub) != 0) {
@@ -4016,11 +4023,12 @@ dhd_preinit_ioctls(dhd_pub_t *dhd)
        bcm_mkiovar("apsta", (char *)&apsta, 4, iovbuf, sizeof(iovbuf));
        dhd_wl_ioctl_cmd(dhd, WLC_SET_VAR, iovbuf, sizeof(iovbuf), TRUE, 0);
 #endif /* defined(AP) && !defined(WLP2P) */
-       dhd_conf_set_bw(dhd);
+       dhd_conf_set_mimo_bw_cap(dhd);
        dhd_conf_force_wme(dhd);
        dhd_conf_set_stbc(dhd);
        dhd_conf_set_srl(dhd);
        dhd_conf_set_lrl(dhd);
+       dhd_conf_set_spect(dhd);
 
 #if defined(SOFTAP)
        if (ap_fw_loaded == TRUE) {
@@ -4868,9 +4876,8 @@ dhd_free(dhd_pub_t *dhdp)
 static void __exit
 dhd_module_cleanup(void)
 {
-       printk("+++dhd_module_cleanup+++\n");
 
-       DHD_TRACE(("%s: Enter\n", __FUNCTION__));
+       printk("%s: Enter\n", __FUNCTION__);
 
        dhd_bus_unregister();
 
@@ -4883,7 +4890,7 @@ dhd_module_cleanup(void)
        dhd_customer_gpio_wlan_ctrl(WLAN_POWER_OFF);
 
        wifi_teardown_dt();
-       printk("---dhd_module_cleanup---\n");
+       printk("%s: Exit\n", __FUNCTION__);
 }
 
 #if defined(CONFIG_WIFI_CONTROL_FUNC)
@@ -4899,14 +4906,13 @@ dhd_module_init(void)
        int retry = POWERUP_MAX_RETRY;
        int chip_up = 0;
 #endif 
-       printk("+++dhd_module_init+++\n");
+
+       printk("%s: Enter\n", __FUNCTION__);
        if (wifi_setup_dt()) {
                printk("wifi_dt : fail to setup dt\n");
                goto fail_0;
        }
 
-       DHD_TRACE(("%s: Enter\n", __FUNCTION__));
-
        wl_android_init();
 
 #if defined(DHDTHREAD)
@@ -5006,11 +5012,11 @@ dhd_module_init(void)
                goto fail_2;
        }
 #endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)) */
-#if defined(WL_CFG80211)
-       wl_android_post_init();
-#endif /* defined(WL_CFG80211) */
+//#if defined(WL_CFG80211)
+//     wl_android_post_init();     // terence 20120530: fix for preinit function missed called after resume
+//#endif /* defined(WL_CFG80211) */
 
-       printk("---dhd_module_init---\n");
+       printk("%s: Exit error=%d\n", __FUNCTION__, error);
        return error;
 
 #if 1 && (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)) && defined(BCMLXSDMMC)
@@ -5029,10 +5035,10 @@ fail_1:
 
        wifi_teardown_dt();
 fail_0:
-       printk("---dhd_module_init fail---\n");
 
        wl_android_exit();
 
+       printk("%s: Exit error=%d\n", __FUNCTION__, error);
        return error;
 }
 
@@ -5873,6 +5879,24 @@ static void dhd_net_if_unlock_local(dhd_info_t *dhd)
 #endif
 }
 
+void dhd_init_lock_local(dhd_pub_t *pub) // terence 20120530: fix for preinit function missed called after resume
+{
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 25)) && 1
+       dhd_info_t *dhd = (dhd_info_t *)(pub->info);
+       if (dhd)
+               mutex_lock(&dhd->dhd_init_mutex);
+#endif
+}
+
+void dhd_init_unlock_local(dhd_pub_t *pub) // terence 20120530: fix for preinit function missed called after resume
+{
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 25)) && 1
+       dhd_info_t *dhd = (dhd_info_t *)(pub->info);
+       if (dhd)
+               mutex_unlock(&dhd->dhd_init_mutex);
+#endif
+}
+
 static void dhd_suspend_lock(dhd_pub_t *pub)
 {
 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 25)) && 1
index f94a1810338eaddbe9442b7a64e4e6fc2e39682b..8ee717d2eb95efbbb2e5d38a741f4cd38f07f35b 100755 (executable)
@@ -4550,7 +4550,7 @@ dhd_txglom_enable(dhd_pub_t *dhdp, bool enable)
        DHD_TRACE(("%s: Enter\n", __FUNCTION__));
 
        if (enable) {
-               rxglom = 1;
+               rxglom = 8;
                memset(buf, 0, sizeof(buf));
                bcm_mkiovar("bus:rxglom",
                        (void *)&rxglom,
@@ -6939,6 +6939,8 @@ dhdsdio_chipmatch(uint16 chipid)
        return FALSE;
 }
 
+extern void wl_android_post_init(void); // terence 20120530: fix for preinit function missed called after resume
+
 static void *
 dhdsdio_probe(uint16 venid, uint16 devid, uint16 bus_no, uint16 slot,
        uint16 func, uint bustype, void *regsva, osl_t * osh, void *sdh)
@@ -7135,6 +7137,9 @@ dhdsdio_probe(uint16 venid, uint16 devid, uint16 bus_no, uint16 slot,
                goto fail;
        }
 
+    wl_android_post_init(); // terence 20120530: fix for preinit function missed called after resume
+    dhd_init_unlock_local(bus->dhd);
+    
 #if defined(MULTIPLE_SUPPLICANT)
 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 25))
        mutex_unlock(&_dhd_sdio_mutex_lock_);
index a01c5efd13803dfda4a468710427bc46c59e5fd7..069a6957763be30fe255649593b2acb8f25b1af5 100755 (executable)
@@ -25,6 +25,6 @@
 #define EPI_VERSION_DEV                1.88.45
 
 
-#define        EPI_VERSION_STR         "1.88.45.3 (r420671)"
+#define        EPI_VERSION_STR         "1.88.45.4 (r420671)"
 
 #endif 
index 6cbd0330126697a6b8922fb5f78cab01c53ac900..fe585d10e94b98b1f1b3a98f29b983bb7942aa60 100755 (executable)
@@ -109,6 +109,14 @@ uint android_msg_level = ANDROID_ERROR_LEVEL;
 #define CMD_SETROAMMODE        "SETROAMMODE"
 #define CMD_SETIBSSBEACONOUIDATA       "SETIBSSBEACONOUIDATA"
 #define CMD_MIRACAST           "MIRACAST"
+#define CMD_GET_CHANNEL                        "GET_CHANNEL"
+#define CMD_SET_ROAM                   "SET_ROAM_TRIGGER"                      
+#define CMD_GET_ROAM                   "GET_ROAM_TRIGGER"
+#define CMD_SET_KEEP_ALIVE             "SET_KEEP_ALIVE"
+#define CMD_GET_KEEP_ALIVE             "GET_KEEP_ALIVE"
+#define CMD_GET_PM                             "GET_PM"
+#define CMD_SET_PM                             "SET_PM"
+#define CMD_MONITOR                    "MONITOR"
 
 #if defined(WL_SUPPORT_AUTO_CHANNEL)
 #define CMD_GET_BEST_CHANNELS  "GET_BEST_CHANNELS"
@@ -1227,6 +1235,214 @@ resume:
        return ret;
 }
 
+int
+wl_android_get_channel(
+struct net_device *dev, char* command, int total_len)
+{
+       int ret;
+       channel_info_t ci;
+       int bytes_written = 0;
+
+       if (!(ret = wldev_ioctl(dev, WLC_GET_CHANNEL, &ci, sizeof(channel_info_t), FALSE))) {
+               ANDROID_TRACE(("hw_channel %d\n", ci.hw_channel));
+               ANDROID_TRACE(("target_channel %d\n", ci.target_channel));
+               ANDROID_TRACE(("scan_channel %d\n", ci.scan_channel));
+               bytes_written = snprintf(command, sizeof(channel_info_t)+2, "channel %d", ci.hw_channel);
+               ANDROID_TRACE(("%s: command result is %s\n", __FUNCTION__, command));
+       }
+
+       return bytes_written;
+}
+
+int
+wl_android_set_roam_trigger(
+struct net_device *dev, char* command, int total_len)
+{
+       int ret = 0;
+       int roam_trigger[2];
+
+       sscanf(command, "%*s %10d", &roam_trigger[0]);
+       roam_trigger[1] = WLC_BAND_ALL;
+       
+       ret = wldev_ioctl(dev, WLC_SET_ROAM_TRIGGER, roam_trigger, sizeof(roam_trigger), 1);
+       if (ret)
+               ANDROID_ERROR(("WLC_SET_ROAM_TRIGGER ERROR %d ret=%d\n", roam_trigger[0], ret));
+
+       return ret;
+}
+
+int
+wl_android_get_roam_trigger(
+struct net_device *dev, char *command, int total_len)
+{
+       int ret;
+       int bytes_written;
+       int roam_trigger[2] = {0, 0};
+       int trigger[2]= {0, 0};
+       
+       roam_trigger[1] = WLC_BAND_2G;
+       ret = wldev_ioctl(dev, WLC_GET_ROAM_TRIGGER, roam_trigger, sizeof(roam_trigger), 0);
+       if (!ret)
+               trigger[0] = roam_trigger[0];
+       else
+               ANDROID_ERROR(("2G WLC_GET_ROAM_TRIGGER ERROR %d ret=%d\n", roam_trigger[0], ret));
+
+       roam_trigger[1] = WLC_BAND_5G;
+       ret = wldev_ioctl(dev, WLC_GET_ROAM_TRIGGER, roam_trigger, sizeof(roam_trigger), 0);
+       if (!ret)
+               trigger[1] = roam_trigger[0];
+       else
+               ANDROID_ERROR(("5G WLC_GET_ROAM_TRIGGER ERROR %d ret=%d\n", roam_trigger[0], ret));
+       
+       ANDROID_TRACE(("roam_trigger %d %d\n", trigger[0], trigger[1]));
+       bytes_written = snprintf(command, total_len, "%d %d", trigger[0], trigger[1]);
+
+       return bytes_written;
+}
+
+s32
+wl_android_set_keep_alive(struct net_device *dev, char* command, int total_len)
+{
+       char *buf;
+       const char                                              *str;
+       wl_mkeep_alive_pkt_t    mkeep_alive_pkt;
+       wl_mkeep_alive_pkt_t    *mkeep_alive_pktp;
+       int     buf_len;
+       int     str_len;
+       int res = -1;
+       uint period_msec = 0;
+
+       ANDROID_TRACE(("%s: command = %s\n", __FUNCTION__, command));
+
+       buf = kmalloc(WLC_IOCTL_MAXLEN, GFP_KERNEL);
+       sscanf(command, "%d", &period_msec);
+       memset(&mkeep_alive_pkt, 0, sizeof(wl_mkeep_alive_pkt_t));
+       str = "mkeep_alive";
+       str_len = strlen(str);
+       strncpy(buf, str, str_len);
+       buf[str_len] = '\0';
+       mkeep_alive_pktp = (wl_mkeep_alive_pkt_t *) (buf + str_len + 1);
+       mkeep_alive_pkt.period_msec = period_msec;
+       buf_len = str_len + 1;
+       mkeep_alive_pkt.version = htod16(WL_MKEEP_ALIVE_VERSION);
+       mkeep_alive_pkt.length = htod16(WL_MKEEP_ALIVE_FIXED_LEN);
+       mkeep_alive_pkt.keep_alive_id = 0;
+       mkeep_alive_pkt.len_bytes = 0;
+       buf_len += WL_MKEEP_ALIVE_FIXED_LEN;
+       /* Keep-alive attributes are set in local       variable (mkeep_alive_pkt), and
+        * then memcpy'ed into buffer (mkeep_alive_pktp) since there is no
+        * guarantee that the buffer is properly aligned.
+        */
+       memcpy((char *)mkeep_alive_pktp, &mkeep_alive_pkt, WL_MKEEP_ALIVE_FIXED_LEN);
+
+       if ((res = wldev_ioctl(dev, WLC_SET_VAR, buf, buf_len, TRUE)) != 0)
+               ANDROID_ERROR(("%s: mkeep_alive set failed. res[%d]\n", __FUNCTION__, res));
+
+       kfree(buf);
+       return res;
+}
+
+s32
+wl_android_get_keep_alive(struct net_device *dev, char *command, int total_len) {
+
+       wl_mkeep_alive_pkt_t *mkeep_alive_pktp;
+       int bytes_written = -1;
+       int res = -1, len, i = 0;
+       char* str = "mkeep_alive";
+
+       ANDROID_TRACE(("%s: command = %s\n", __FUNCTION__, command));
+
+       len = WLC_IOCTL_MEDLEN;
+       mkeep_alive_pktp = kmalloc(len, GFP_KERNEL);
+       memset(mkeep_alive_pktp, 0, len);
+       strcpy((char*)mkeep_alive_pktp, str);
+
+       if ((res = wldev_ioctl(dev, WLC_GET_VAR, mkeep_alive_pktp, len, FALSE))<0) {
+               ANDROID_ERROR(("%s: GET mkeep_alive ERROR %d\n", __FUNCTION__, res));
+               goto exit;
+       } else {
+               printf("Id            :%d\n"
+                          "Period (msec) :%d\n"
+                          "Length        :%d\n"
+                          "Packet        :0x",
+                          mkeep_alive_pktp->keep_alive_id,
+                          dtoh32(mkeep_alive_pktp->period_msec),
+                          dtoh16(mkeep_alive_pktp->len_bytes));
+               for (i=0; i<mkeep_alive_pktp->len_bytes; i++) {
+                       printf("%02x", mkeep_alive_pktp->data[i]);
+               }
+               printf("\n");
+       }
+       bytes_written = snprintf(command, total_len, "mkeep_alive_period_msec %d ", dtoh32(mkeep_alive_pktp->period_msec));
+       bytes_written += snprintf(command+bytes_written, total_len, "0x");
+       for (i=0; i<mkeep_alive_pktp->len_bytes; i++) {
+               bytes_written += snprintf(command+bytes_written, total_len, "%x", mkeep_alive_pktp->data[i]);
+       }
+       ANDROID_TRACE(("%s: command result is %s\n", __FUNCTION__, command));
+
+exit:
+       kfree(mkeep_alive_pktp);
+       return bytes_written;
+}
+
+int
+wl_android_set_pm(struct net_device *dev,char *command, int total_len)
+{
+       int pm, ret = -1;
+
+       ANDROID_TRACE(("%s: cmd %s\n", __FUNCTION__, command));
+
+       sscanf(command, "%*s %d", &pm);
+
+       ret = wldev_ioctl(dev, WLC_SET_PM, &pm, sizeof(pm), FALSE);
+       if (ret)
+               ANDROID_ERROR(("WLC_SET_PM ERROR %d ret=%d\n", pm, ret));
+
+       return ret;
+}
+
+int
+wl_android_get_pm(struct net_device *dev,char *command, int total_len)
+{
+
+       int ret = 0;
+       int pm_local;
+       char *pm;
+       int bytes_written=-1;
+
+       ret = wldev_ioctl(dev, WLC_GET_PM, &pm_local, sizeof(pm_local),FALSE);
+       if (!ret) {
+               ANDROID_TRACE(("%s: PM = %d\n", __func__, pm_local));
+               if (pm_local == PM_OFF)
+                       pm = "PM_OFF";
+               else if(pm_local == PM_MAX)
+                       pm = "PM_MAX";
+               else if(pm_local == PM_FAST)
+                       pm = "PM_FAST";
+               else {
+                       pm_local = 0;
+                       pm = "Invalid";
+               }
+               bytes_written = snprintf(command, total_len, "PM %s", pm);
+               ANDROID_TRACE(("%s: command result is %s\n", __FUNCTION__, command));
+       }
+       return bytes_written;
+}
+
+static int
+wl_android_set_monitor(struct net_device *dev, char *command, int total_len)
+{
+       int val;
+       int ret = 0;
+       int bytes_written;
+
+       sscanf(command, "%*s %d", &val);
+       bytes_written = wldev_ioctl(dev, WLC_SET_MONITOR, &val, sizeof(int), 1);
+       if (bytes_written)
+               ANDROID_ERROR(("WLC_SET_MONITOR ERROR %d ret=%d\n", val, ret));
+       return bytes_written;
+}
+
 int wl_android_priv_cmd(struct net_device *net, struct ifreq *ifr, int cmd)
 {
 #define PRIVATE_COMMAND_MAX_LEN        8192
@@ -1468,6 +1684,31 @@ int wl_android_priv_cmd(struct net_device *net, struct ifreq *ifr, int cmd)
                strlen(CMD_SETIBSSBEACONOUIDATA)) == 0)
                bytes_written = wl_android_set_ibss_beacon_ouidata(net, command,
                        priv_cmd.total_len);
+       else if(strnicmp(command, CMD_GET_CHANNEL, strlen(CMD_GET_CHANNEL)) == 0) {
+               bytes_written = wl_android_get_channel(net, command, priv_cmd.total_len);
+       }
+       else if (strnicmp(command, CMD_SET_ROAM, strlen(CMD_SET_ROAM)) == 0) {
+               bytes_written = wl_android_set_roam_trigger(net, command, priv_cmd.total_len);
+       }
+       else if (strnicmp(command, CMD_GET_ROAM, strlen(CMD_GET_ROAM)) == 0) {
+               bytes_written = wl_android_get_roam_trigger(net, command, priv_cmd.total_len);
+       }
+       else if (strnicmp(command, CMD_SET_KEEP_ALIVE, strlen(CMD_SET_KEEP_ALIVE)) == 0) {
+               int skip = strlen(CMD_SET_KEEP_ALIVE) + 1;
+               bytes_written = wl_android_set_keep_alive(net, command+skip, priv_cmd.total_len-skip);
+       }
+       else if (strnicmp(command, CMD_GET_KEEP_ALIVE, strlen(CMD_GET_KEEP_ALIVE)) == 0) {
+               int skip = strlen(CMD_GET_KEEP_ALIVE) + 1;
+               bytes_written = wl_android_get_keep_alive(net, command+skip, priv_cmd.total_len-skip);
+       }
+       else if (strnicmp(command, CMD_GET_PM, strlen(CMD_GET_PM)) == 0) {
+               bytes_written = wl_android_get_pm(net, command, priv_cmd.total_len);
+       }
+       else if (strnicmp(command, CMD_SET_PM, strlen(CMD_SET_PM)) == 0) {
+               bytes_written = wl_android_set_pm(net, command, priv_cmd.total_len);
+       }
+       else if (strnicmp(command, CMD_MONITOR, strlen(CMD_MONITOR)) == 0)
+               bytes_written = wl_android_set_monitor(net, command, priv_cmd.total_len);
        else {
                ANDROID_ERROR(("Unknown PRIVATE command %s - ignored\n", command));
                snprintf(command, 3, "OK");
@@ -2097,19 +2338,16 @@ wl_delete_dirty_rssi_cache(wl_rssi_cache_ctrl_t *rssi_cache_ctrl)
 {
        wl_rssi_cache_t *node, *prev, **rssi_head;
        int i = -1, tmp = 0;
-#if defined(BSSCACHE)
-       int max = 0;
-#else
-       int max = RSSICACHE_LEN;
-#endif
-       max = min(max, RSSICACHE_LEN);
+       struct timeval now;
+
+       do_gettimeofday(&now);
 
        rssi_head = &rssi_cache_ctrl->m_cache_head;
        node = *rssi_head;
        prev = node;
        for (;node;) {
                i++;
-               if (node->dirty > max) {
+               if (now.tv_sec > node->tv.tv_sec) {
                        if (node == *rssi_head) {
                                tmp = 1;
                                *rssi_head = node->next;
@@ -2190,6 +2428,7 @@ wl_update_connected_rssi_cache(struct net_device *net, wl_rssi_cache_ctrl_t *rss
        int j, k=0;
        int rssi, error=0;
        struct ether_addr bssid;
+       struct timeval now, timeout;
 
        if (!g_wifi_on)
                return 0;
@@ -2208,6 +2447,16 @@ wl_update_connected_rssi_cache(struct net_device *net, wl_rssi_cache_ctrl_t *rss
                return error;
        }
 
+       do_gettimeofday(&now);
+       timeout.tv_sec = now.tv_sec + BSSCACHE_TIMEOUT;
+       if (timeout.tv_sec < now.tv_sec) {
+               /*
+                * Integer overflow - assume long enough timeout to be assumed
+                * to be infinite, i.e., the timeout would never happen.
+                */
+               ANDROID_TRACE(("%s: Too long timeout (secs=%d) to ever happen - now=%lu, timeout=%lu",
+                       __FUNCTION__, BSSCACHE_TIMEOUT, now.tv_sec, timeout.tv_sec));
+       }
        /* update RSSI */
        rssi_head = &rssi_cache_ctrl->m_cache_head;
        node = *rssi_head;
@@ -2220,6 +2469,7 @@ wl_update_connected_rssi_cache(struct net_device *net, wl_rssi_cache_ctrl_t *rss
                                node->RSSI[j] = node->RSSI[j+1];
                        node->RSSI[j] = rssi;
                        node->dirty = 0;
+                       node->tv = timeout;
                        goto exit;
                }
                prev = node;
@@ -2238,6 +2488,7 @@ wl_update_connected_rssi_cache(struct net_device *net, wl_rssi_cache_ctrl_t *rss
 
        leaf->next = NULL;
        leaf->dirty = 0;
+       leaf->tv = timeout;
        memcpy(&leaf->BSSID, &bssid, ETHER_ADDR_LEN);
        for (j=0; j<RSSIAVG_LEN; j++)
                leaf->RSSI[j] = rssi;
@@ -2259,10 +2510,22 @@ wl_update_rssi_cache(wl_rssi_cache_ctrl_t *rssi_cache_ctrl, wl_scan_results_t *s
        wl_rssi_cache_t *node, *prev, *leaf, **rssi_head;
        wl_bss_info_t *bi = NULL;
        int i, j, k;
+       struct timeval now, timeout;
 
        if (!ss_list->count)
                return;
 
+       do_gettimeofday(&now);
+       timeout.tv_sec = now.tv_sec + BSSCACHE_TIMEOUT;
+       if (timeout.tv_sec < now.tv_sec) {
+               /*
+                * Integer overflow - assume long enough timeout to be assumed
+                * to be infinite, i.e., the timeout would never happen.
+                */
+               ANDROID_TRACE(("%s: Too long timeout (secs=%d) to ever happen - now=%lu, timeout=%lu",
+                       __FUNCTION__, BSSCACHE_TIMEOUT, now.tv_sec, timeout.tv_sec));
+       }
+
        rssi_head = &rssi_cache_ctrl->m_cache_head;
 
        /* update RSSI */
@@ -2279,6 +2542,7 @@ wl_update_rssi_cache(wl_rssi_cache_ctrl_t *rssi_cache_ctrl, wl_scan_results_t *s
                                        node->RSSI[j] = node->RSSI[j+1];
                                node->RSSI[j] = dtoh16(bi->RSSI);
                                node->dirty = 0;
+                               node->tv = timeout;
                                break;
                        }
                        prev = node;
@@ -2300,6 +2564,7 @@ wl_update_rssi_cache(wl_rssi_cache_ctrl_t *rssi_cache_ctrl, wl_scan_results_t *s
 
                leaf->next = NULL;
                leaf->dirty = 0;
+               leaf->tv = timeout;
                memcpy(&leaf->BSSID, &bi->BSSID, ETHER_ADDR_LEN);
                for (j=0; j<RSSIAVG_LEN; j++)
                        leaf->RSSI[j] = dtoh16(bi->RSSI);
@@ -2398,13 +2663,16 @@ wl_delete_dirty_bss_cache(wl_bss_cache_ctrl_t *bss_cache_ctrl)
 {
        wl_bss_cache_t *node, *prev, **bss_head;
        int i = -1, tmp = 0;
+       struct timeval now;
+
+       do_gettimeofday(&now);
 
        bss_head = &bss_cache_ctrl->m_cache_head;
        node = *bss_head;
        prev = node;
        for (;node;) {
                i++;
-               if (node->dirty > BSSCACHE_LEN) {
+               if (now.tv_sec > node->tv.tv_sec) {
                        if (node == *bss_head) {
                                tmp = 1;
                                *bss_head = node->next;
@@ -2486,10 +2754,22 @@ wl_update_bss_cache(wl_bss_cache_ctrl_t *bss_cache_ctrl, wl_scan_results_t *ss_l
        wl_bss_cache_t *node, *prev, *leaf, *tmp, **bss_head;
        wl_bss_info_t *bi = NULL;
        int i, k=0;
+       struct timeval now, timeout;
 
        if (!ss_list->count)
                return;
 
+       do_gettimeofday(&now);
+       timeout.tv_sec = now.tv_sec + BSSCACHE_TIMEOUT;
+       if (timeout.tv_sec < now.tv_sec) {
+               /*
+                * Integer overflow - assume long enough timeout to be assumed
+                * to be infinite, i.e., the timeout would never happen.
+                */
+               ANDROID_TRACE(("%s: Too long timeout (secs=%d) to ever happen - now=%lu, timeout=%lu",
+                       __FUNCTION__, BSSCACHE_TIMEOUT, now.tv_sec, timeout.tv_sec));
+       }
+
        bss_head = &bss_cache_ctrl->m_cache_head;
 
        for (i=0; i < ss_list->count; i++) {
@@ -2510,6 +2790,7 @@ wl_update_bss_cache(wl_bss_cache_ctrl_t *bss_cache_ctrl, wl_scan_results_t *ss_l
                                memcpy(leaf->results.bss_info, bi, dtoh32(bi->length));
                                leaf->next = node->next;
                                leaf->dirty = 0;
+                               leaf->tv = timeout;
                                leaf->results.count = 1;
                                leaf->results.version = ss_list->version;
                                ANDROID_TRACE(("%s: Update %d with BSSID %pM, RSSI=%d, SSID \"%s\", length=%d\n",
@@ -2544,6 +2825,7 @@ wl_update_bss_cache(wl_bss_cache_ctrl_t *bss_cache_ctrl, wl_scan_results_t *ss_l
                memcpy(leaf->results.bss_info, bi, dtoh32(bi->length));
                leaf->next = NULL;
                leaf->dirty = 0;
+               leaf->tv = timeout;
                leaf->results.count = 1;
                leaf->results.version = ss_list->version;
                k++;
@@ -2555,65 +2837,15 @@ wl_update_bss_cache(wl_bss_cache_ctrl_t *bss_cache_ctrl, wl_scan_results_t *ss_l
        }
 }
 
-void
-wl_run_bss_cache_timer(wl_bss_cache_ctrl_t *bss_cache_ctrl, int kick_off)
-{
-       struct timer_list **timer;
-
-       timer = &bss_cache_ctrl->m_timer;
-
-       if (*timer) {
-               if (kick_off) {
-                       (*timer)->expires = jiffies + BSSCACHE_TIME * HZ / 1000;
-                       add_timer(*timer);
-                       ANDROID_TRACE(("%s: timer starts\n", __FUNCTION__));
-               } else {
-                       del_timer_sync(*timer);
-                       ANDROID_TRACE(("%s: timer stops\n", __FUNCTION__));
-               }
-       }
-}
-
-void
-wl_set_bss_cache_timer_flag(ulong data)
-{
-       wl_bss_cache_ctrl_t *bss_cache_ctrl = (wl_bss_cache_ctrl_t *)data;
-
-       bss_cache_ctrl->m_timer_expired = 1;
-       ANDROID_TRACE(("%s called\n", __FUNCTION__));
-}
-
 void
 wl_release_bss_cache_ctrl(wl_bss_cache_ctrl_t *bss_cache_ctrl)
 {
        ANDROID_TRACE(("%s:\n", __FUNCTION__));
        wl_free_bss_cache(bss_cache_ctrl);
-       wl_run_bss_cache_timer(bss_cache_ctrl, 0);
-       if (bss_cache_ctrl->m_timer) {
-               kfree(bss_cache_ctrl->m_timer);
-       }
-}
-
-int
-wl_init_bss_cache_ctrl(wl_bss_cache_ctrl_t *bss_cache_ctrl)
-{
-       ANDROID_TRACE(("%s:\n", __FUNCTION__));
-       bss_cache_ctrl->m_timer_expired = 0;
-
-       bss_cache_ctrl->m_timer = kmalloc(sizeof(struct timer_list), GFP_KERNEL);
-       if (!bss_cache_ctrl->m_timer) {
-               ANDROID_ERROR(("%s: Memory alloc failure\n", __FUNCTION__ ));
-               return -ENOMEM;
-       }
-       init_timer(bss_cache_ctrl->m_timer);
-       bss_cache_ctrl->m_timer->function = (void *)wl_set_bss_cache_timer_flag;
-       bss_cache_ctrl->m_timer->data = (ulong)bss_cache_ctrl;
-
-       return 0;
 }
 #endif
 
-#if defined(CUSTOMER_HW) && defined(CONFIG_DHD_USE_STATIC_BUF)
+#if defined(CUSTOMER_HW_AMLOGIC) && defined(CONFIG_DHD_USE_STATIC_BUF)
 extern bcmdhd_mem_prealloc(int section, unsigned long size);
 void* wl_android_prealloc(int section, unsigned long size)
 {
index e4929848156a14a3beb2f44e8ea51ed82674d2cc..f370d5d7133924233a7c0ddeba9b745d51bb7351 100755 (executable)
@@ -115,11 +115,12 @@ s32 wl_genl_send_msg(struct net_device *ndev, u32 event_type,
 
 #if defined(RSSIAVG)
 #define RSSIAVG_LEN (4*REPEATED_SCAN_RESULT_CNT)
-#define RSSICACHE_LEN (4*REPEATED_SCAN_RESULT_CNT)
+#define RSSICACHE_TIMEOUT 15
 
 typedef struct wl_rssi_cache {
        struct wl_rssi_cache *next;
        int dirty;
+       struct timeval tv;
        struct ether_addr BSSID;
        int16 RSSI[RSSIAVG_LEN];
 } wl_rssi_cache_t;
@@ -150,19 +151,17 @@ int wl_update_rssi_offset(int rssi);
 #endif
 
 #if defined(BSSCACHE)
-#define BSSCACHE_LEN   (4*REPEATED_SCAN_RESULT_CNT)
-#define BSSCACHE_TIME  15000
+#define BSSCACHE_TIMEOUT       15
 
 typedef struct wl_bss_cache {
        struct wl_bss_cache *next;
        int dirty;
+       struct timeval tv;
        wl_scan_results_t results;
 } wl_bss_cache_t;
 
 typedef struct wl_bss_cache_ctrl {
        wl_bss_cache_t *m_cache_head;
-       struct timer_list *m_timer;
-       int m_timer_expired;
 } wl_bss_cache_ctrl_t;
 
 void wl_free_bss_cache(wl_bss_cache_ctrl_t *bss_cache_ctrl);
@@ -170,11 +169,9 @@ void wl_delete_dirty_bss_cache(wl_bss_cache_ctrl_t *bss_cache_ctrl);
 void wl_delete_disconnected_bss_cache(wl_bss_cache_ctrl_t *bss_cache_ctrl, u8 *bssid);
 void wl_reset_bss_cache(wl_bss_cache_ctrl_t *bss_cache_ctrl);
 void wl_update_bss_cache(wl_bss_cache_ctrl_t *bss_cache_ctrl, wl_scan_results_t *ss_list);
-void wl_run_bss_cache_timer(wl_bss_cache_ctrl_t *bss_cache_ctrl, int kick_off);
 void wl_release_bss_cache_ctrl(wl_bss_cache_ctrl_t *bss_cache_ctrl);
-int wl_init_bss_cache_ctrl(wl_bss_cache_ctrl_t *bss_cache_ctrl);
 #endif
-#if defined(CUSTOMER_HW) && defined(CONFIG_DHD_USE_STATIC_BUF)
+#if defined(CUSTOMER_HW_AMLOGIC) && defined(CONFIG_DHD_USE_STATIC_BUF)
 void* wl_android_prealloc(int section, unsigned long size);
 #endif
 #endif /* _wl_android_ */
\ No newline at end of file
index 5528238ca09f93da24c68572f8e7c57fd3fe9a9b..69ccd5bc00c9916f8492fd0a87cfa07de33df19f 100755 (executable)
@@ -5194,8 +5194,6 @@ wl_cfg80211_send_action_frame(struct wiphy *wiphy, struct net_device *dev,
        ulong off_chan_started_jiffies = 0;
 #endif
        dhd_pub_t *dhd = (dhd_pub_t *)(wl->pub);
-       struct net_device *dev_tmp = wl_to_prmry_ndev(wl);
-       static int cnt = 0;
 
 #ifdef WL11U
 #if defined(WL_CFG80211_P2P_DEV_IF)
@@ -5321,16 +5319,7 @@ wl_cfg80211_send_action_frame(struct wiphy *wiphy, struct net_device *dev,
                        WL_ERR(("couldn't find peer's channel.\n"));
                        wl_cfgp2p_print_actframe(true, action_frame->data, action_frame->len,
                                af_params->channel);
-                       // terence 20130721: send hang event to wpa_supplicant
-                       cnt++;
-                       if (cnt > 2) {
-                               WL_ERR(("Send hang event\n"));
-                               net_os_send_hang_message(dev_tmp);
-                               cnt = 0;
-                       }
                        goto exit;
-               } else {
-                       cnt = 0;
                }
 
                wl_clr_drv_status(wl, SCANNING, wl->afx_hdl->dev);
@@ -7231,12 +7220,11 @@ static s32 wl_inform_bss(struct wl_priv *wl)
        bss_list = wl->bss_list;
 
 #if defined(BSSCACHE)
-       if (g_bss_cache_ctrl.m_timer_expired || (p2p_is_on(wl) && p2p_scan(wl))) {
+       if (p2p_is_on(wl) && p2p_scan(wl)) {
 #if defined(RSSIAVG)
                wl_free_rssi_cache(&g_rssi_cache_ctrl);
 #endif
                wl_free_bss_cache(&g_bss_cache_ctrl);
-               g_bss_cache_ctrl.m_timer_expired ^= 1;
        }
        wl_update_bss_cache(&g_bss_cache_ctrl, bss_list);
        wl_delete_dirty_bss_cache(&g_bss_cache_ctrl);
@@ -7277,8 +7265,6 @@ static s32 wl_inform_bss(struct wl_priv *wl)
                }
                node = node->next;
        }
-       wl_run_bss_cache_timer(&g_bss_cache_ctrl, 0);
-       wl_run_bss_cache_timer(&g_bss_cache_ctrl, 1);
        bi = NULL;
 #endif
 
@@ -9119,8 +9105,8 @@ static void wl_scan_timeout(unsigned long data)
                wl_notify_iscan_complete(wl_to_iscan(wl), true);
        }
        // terence 20130729: work around to fix out of memory in firmware
-       WL_ERR(("Send hang event\n"));
-       net_os_send_hang_message(ndev);
+       //WL_ERR(("Send hang event\n"));
+       //net_os_send_hang_message(ndev);
 }
 
 static void wl_iscan_timer(unsigned long data)
@@ -10095,10 +10081,6 @@ s32 wl_cfg80211_attach(struct net_device *ndev, void *data)
        if (err)
                goto cfg80211_attach_out;
 #endif 
-#if defined(BSSCACHE)
-       if (wl_init_bss_cache_ctrl(&g_bss_cache_ctrl))
-               goto cfg80211_attach_out;
-#endif
 
        wlcfg_drv_priv = wl;
 
@@ -10977,7 +10959,6 @@ int wl_cfg80211_hang(struct net_device *dev, u16 reason)
 #endif
 #if defined(BSSCACHE)
        wl_free_bss_cache(&g_bss_cache_ctrl);
-       wl_run_bss_cache_timer(&g_bss_cache_ctrl, 0);
 #endif
        if (wl != NULL) {
                wl_link_down(wl);
@@ -11000,7 +10981,6 @@ s32 wl_cfg80211_down(void *para)
 #endif
 #if defined(BSSCACHE)
        wl_free_bss_cache(&g_bss_cache_ctrl);
-       wl_run_bss_cache_timer(&g_bss_cache_ctrl, 0);
 #endif
        err = __wl_cfg80211_down(wl);
        mutex_unlock(&wl->usr_sync);
@@ -13173,7 +13153,6 @@ void wl_cfg80211_stop(void)
 #endif
 #if defined(BSSCACHE)
        wl_free_bss_cache(&g_bss_cache_ctrl);
-       wl_run_bss_cache_timer(&g_bss_cache_ctrl, 0);
 #endif
 }