int wl_android_wifi_off(struct net_device *dev)
{
	int ret = 0;

	printk("%s in\n", __FUNCTION__);
	if (!dev) {
		DHD_ERROR(("%s: dev is null\n", __FUNCTION__));
		//return -EINVAL;
                if (g_wifi_on) {
                        sdioh_stop(NULL);
                        dhd_customer_gpio_wlan_ctrl(WLAN_RESET_OFF);
                        g_wifi_on = 0;
                }
	} else {
		dhd_net_if_lock(dev);
		if (g_wifi_on) {
			ret = dhd_dev_reset(dev, TRUE);
			sdioh_stop(NULL);
			dhd_customer_gpio_wlan_ctrl(WLAN_RESET_OFF);
			g_wifi_on = 0;
		}
		dhd_net_if_unlock(dev);
	}
	return ret;
}
示例#2
0
int wl_android_wifi_off(struct net_device *dev)
{
	int ret = 0;

	printf("in\n");
	if (!dev) {
		DHD_TRACE(("%s: dev is null\n", __FUNCTION__));
		return -EINVAL;
	}

	dhd_net_if_lock(dev);
	if (g_wifi_on) {
#if defined(PROP_TXSTATUS) && !defined(PROP_TXSTATUS_VSDB) && defined(BCMLXSDMMC)
		dhd_wlfc_deinit(bcmsdh_get_drvdata());
#endif
		ret = dhd_dev_reset(dev, TRUE);
		sdioh_stop(NULL);

		dhd_customer_gpio_wlan_ctrl(WLAN_RESET_OFF);
		/* fix sdio init error/timeout issue begin */
		sdioh_power_off();
		/* fix sdio init error/timeout issue end */
		g_wifi_on = FALSE;
	}
	dhd_net_if_unlock(dev);

	return ret;
}
void
dhd_conf_wifi_stop(struct net_device *dev)
{
    if (!dev) {
        CONFIG_ERROR(("%s: dev is null\n", __FUNCTION__));
        return;
    }

    printk("%s in 1\n", __FUNCTION__);
    dhd_net_if_lock(dev);
    printk("%s in 2: g_wifi_on=%d, name=%s\n", __FUNCTION__, g_wifi_on, dev->name);
    if (g_wifi_on) {
#ifdef WL_CFG80211
        wl_cfg80211_user_sync(true);
        wl_cfg80211_stop();
#endif
        dhd_bus_devreset(bcmsdh_get_drvdata(), true);
        sdioh_stop(NULL);
        dhd_customer_gpio_wlan_ctrl(WLAN_RESET_OFF);
        g_wifi_on = FALSE;
#ifdef WL_CFG80211
        wl_cfg80211_user_sync(false);
#endif
    }
    printk("%s out\n", __FUNCTION__);
    dhd_net_if_unlock(dev);

}
int wl_android_wifi_off(struct net_device *dev)
{
	int ret = 0;

	if (!dev) {
		ANDROID_TRACE(("%s: dev is null\n", __FUNCTION__));
		return -EINVAL;
	}

	dhd_net_if_lock(dev);
	printk("%s in\n", __FUNCTION__);
	if (g_wifi_on) {
#if defined(PROP_TXSTATUS) && !defined(PROP_TXSTATUS_VSDB)
		dhd_wlfc_deinit(bcmsdh_get_drvdata());
#endif
		ret = dhd_dev_reset(dev, TRUE);
		sdioh_stop(NULL);
		dhd_customer_gpio_wlan_ctrl(WLAN_RESET_OFF);
		g_wifi_on = FALSE;
	}
	printk("%s out\n", __FUNCTION__);
	dhd_net_if_unlock(dev);

	return ret;
}
void wl_android_post_init(void)
{
	if (!dhd_download_fw_on_driverload) {
		sdioh_stop(NULL);
		/* Call customer gpio to turn off power with WL_REG_ON signal */
		dhd_customer_gpio_wlan_ctrl(WLAN_RESET_OFF);
		g_wifi_on = 0;
	}
}
int wl_android_wifi_on(struct net_device *dev)
{
	int ret = 0;
	int retry = POWERUP_MAX_RETRY;

	if (!dev) {
		ANDROID_ERROR(("%s: dev is null\n", __FUNCTION__));
		return -EINVAL;
	}

	dhd_net_if_lock(dev);
	printk("%s in\n", __FUNCTION__);
	if (!g_wifi_on) {
		do {
			dhd_customer_gpio_wlan_ctrl(WLAN_RESET_ON);
			ret = sdioh_start(NULL, 0);
			if (ret == 0)
				break;
			ANDROID_ERROR(("\nfailed to power up wifi chip, retry again (%d left) **\n\n",
				retry+1));
			dhd_customer_gpio_wlan_ctrl(WLAN_RESET_OFF);
		} while (retry-- >= 0);
		if (ret != 0) {
			ANDROID_ERROR(("\nfailed to power up wifi chip, max retry reached **\n\n"));
			goto exit;
		}
		ret = dhd_dev_reset(dev, FALSE);
		if (ret)
			goto err;
		sdioh_start(NULL, 1);
		if (!ret) {
			if (dhd_dev_init_ioctl(dev) < 0) {
				ret = -EFAULT;
				goto err;
			}
		}
#if defined(PROP_TXSTATUS) && !defined(PROP_TXSTATUS_VSDB)
		dhd_wlfc_init(bcmsdh_get_drvdata());
#endif
		g_wifi_on = TRUE;
	}

exit:
	printk("%s: Success\n", __FUNCTION__);
	dhd_net_if_unlock(dev);
	return ret;

err:
	dhd_dev_reset(dev, TRUE);
	sdioh_stop(NULL);
	dhd_customer_gpio_wlan_ctrl(WLAN_RESET_OFF);
	printk("%s: Failed\n", __FUNCTION__);
	dhd_net_if_unlock(dev);

	return ret;
}
void wl_android_post_init(void)
{
	if (!dhd_download_fw_on_driverload) {
		/* Call customer gpio to turn off power with WL_REG_ON signal */
#if !defined(OOB_INTR_ONLY)
		sdioh_stop(NULL);
#endif /* !defined(OOB_INTR_ONLY) */
		dhd_customer_gpio_wlan_ctrl(WLAN_RESET_OFF);
		g_wifi_on = 0;
	}
}
示例#8
0
int wl_android_wifi_off(struct net_device *dev)
{
	int ret = 0;

	if (!dev) {
		DHD_TRACE(("%s: dev is null\n", __FUNCTION__));
		return -EINVAL;
	}

	dhd_net_if_lock(dev);
	if (g_wifi_on) {
		dhd_dev_reset(dev, 1);
		sdioh_stop(NULL);
		dhd_customer_gpio_wlan_ctrl(WLAN_RESET_OFF);
		g_wifi_on = 0;
	}
	dhd_net_if_unlock(dev);

	return ret;
}
示例#9
0
int wl_android_wifi_off(struct net_device *dev)
{
	int ret = 0;

	printk("%s in\n", __FUNCTION__);
	if (!dev) {
		ANDROID_TRACE(("%s: dev is null\n", __FUNCTION__));
		return -EINVAL;
	}

	dhd_net_if_lock(dev);
	if (g_wifi_on == G_WLAN_SET_ON) {
		ret = dhd_dev_reset(dev, TRUE);
		sdioh_stop(NULL);
		dhd_customer_gpio_wlan_ctrl(WLAN_RESET_OFF);
		g_wifi_on = G_WLAN_SET_OFF;
	}
	dhd_net_if_unlock(dev);

	return ret;
}
int wl_android_wifi_off(struct net_device *dev)
{
	int ret = 0;

	DHD_ERROR(("%s in\n", __FUNCTION__));
	if (!dev) {
		DHD_TRACE(("%s: dev is null\n", __FUNCTION__));
		return -EINVAL;
	}

	dhd_net_if_lock(dev);
	if (g_wifi_on) {
		dhd_dev_reset(dev, 1);
		if (dhd_download_fw_on_driverload)
			msleep(100);
		sdioh_stop(NULL);
		dhd_customer_gpio_wlan_ctrl(WLAN_RESET_OFF);
		g_wifi_on = FALSE;
	}
	dhd_net_if_unlock(dev);

	return ret;
}