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;
}
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);
/* 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;
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));
}
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;
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__));
}
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;
#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
}\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
\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
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
/* 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
}\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
\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
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
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
#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
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
#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
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
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
#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
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
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
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
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
#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);
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;
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;
dhd->pub.txcnt_timeout = 0;
dhd->pub.hang_was_sent = 0;
+ printk("%s: Exit\n", __FUNCTION__);
DHD_OS_WAKE_UNLOCK(&dhd->pub);
return 0;
}
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
#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')
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)
#endif
#endif /* MULTIPLE_SUPPLICANT */
+ printk("%s: Exit ret=%d\n", __FUNCTION__, ret);
return ret;
}
#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) {
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) {
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();
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)
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)
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)
wifi_teardown_dt();
fail_0:
- printk("---dhd_module_init fail---\n");
wl_android_exit();
+ printk("%s: Exit error=%d\n", __FUNCTION__, error);
return error;
}
#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
DHD_TRACE(("%s: Enter\n", __FUNCTION__));
if (enable) {
- rxglom = 1;
+ rxglom = 8;
memset(buf, 0, sizeof(buf));
bcm_mkiovar("bus:rxglom",
(void *)&rxglom,
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)
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_);
#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
#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"
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
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");
{
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;
int j, k=0;
int rssi, error=0;
struct ether_addr bssid;
+ struct timeval now, timeout;
if (!g_wifi_on)
return 0;
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;
node->RSSI[j] = node->RSSI[j+1];
node->RSSI[j] = rssi;
node->dirty = 0;
+ node->tv = timeout;
goto exit;
}
prev = node;
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;
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 */
node->RSSI[j] = node->RSSI[j+1];
node->RSSI[j] = dtoh16(bi->RSSI);
node->dirty = 0;
+ node->tv = timeout;
break;
}
prev = node;
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);
{
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;
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++) {
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",
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++;
}
}
-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)
{
#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;
#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);
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
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)
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);
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);
}
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
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)
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;
#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);
#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);
#endif
#if defined(BSSCACHE)
wl_free_bss_cache(&g_bss_cache_ctrl);
- wl_run_bss_cache_timer(&g_bss_cache_ctrl, 0);
#endif
}