예제 #1
0
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;
}
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;
}
예제 #3
0
int wl_android_wifi_on(struct net_device *dev)
{
	int ret = 0;
	int retry = POWERUP_MAX_RETRY;

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

	dhd_net_if_lock(dev);
	if (!g_wifi_on) {
		do {
			/* fix sdio init error/timeout issue begin */
			sdioh_power_on();
			/* fix sdio init error/timeout issue end */
			dhd_customer_gpio_wlan_ctrl(WLAN_RESET_ON);
			ret = sdioh_start(NULL, 0);
			if (ret == 0)
				break;
			DHD_ERROR(("\nfailed to power up wifi chip, retry again (%d left) **\n\n",
				retry+1));
			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 */
		} while (retry-- >= 0);
		if (ret != 0) {
			DHD_ERROR(("\nfailed to power up wifi chip, max retry reached **\n\n"));
			goto exit;
		}
		ret = dhd_dev_reset(dev, FALSE);
		sdioh_start(NULL, 1);
		if (!ret) {
			if (dhd_dev_init_ioctl(dev) < 0)
				ret = -EFAULT;
		} else {
			DHD_ERROR(("%s: dhd_dev_reset failed, ret is %d\n", __FUNCTION__, ret));
		}
#if defined(PROP_TXSTATUS) && !defined(PROP_TXSTATUS_VSDB) && defined(BCMLXSDMMC)
		dhd_wlfc_init(bcmsdh_get_drvdata());
#endif
		g_wifi_on = TRUE;
	}

exit:
	dhd_net_if_unlock(dev);

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

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

	dhd_net_if_lock(dev);
	if (!g_wifi_on) {
		dhd_customer_gpio_wlan_ctrl(WLAN_RESET_ON);
		sdioh_start(NULL, 0);
		ret = dhd_dev_reset(dev, FALSE);
		sdioh_start(NULL, 1);
		if (!ret) {
			if ((dhd_dev_init_ioctl(dev)) < 0)
				 ret = -EFAULT;
		}
		g_wifi_on = 1;
	}
	dhd_net_if_unlock(dev);

	return ret;
}
예제 #5
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;
}
예제 #6
0
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);

}
/**
 * Global function definitions (declared in wl_android.h)
 */
int wl_android_wifi_on(struct net_device *dev)
{
	int ret = 0;
	int retry = 1;

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

	dhd_net_if_lock(dev);
	if (!g_wifi_on) {
		dhd_customer_gpio_wlan_ctrl(WLAN_RESET_ON);
		sdioh_start(NULL, 0);
		ret = dhd_dev_reset(dev, FALSE);
		sdioh_start(NULL, 1);
		if (!ret)
			ret = dhd_dev_init_ioctl_ret(dev);
		g_wifi_on = 1;
	}
	dhd_net_if_unlock(dev);
////////////////////////////////// Adam Patch /////////////////////////////////////
	if (ret == -EIO && retry < 5) {
		wl_android_wifi_off(dev);
		msleep(1000);
		printk("I/O Error on wifi, power down and try again. Attempt %d/5\n", retry);
		goto onretry;
	}
////////////////////////////////////////////////////////////////////////////////////
	return ret;
}
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;
}
예제 #9
0
void wl_android_post_init(void)
{
	if (!dhd_download_fw_on_driverload) {
		/* Call customer gpio to turn off power with WL_REG_ON signal */
		dhd_customer_gpio_wlan_ctrl(WLAN_RESET_OFF);
		g_wifi_on = 0;
	}
}
void wl_android_post_init(void)
{
	if (!dhd_download_fw_on_driverload) {
		
		dhd_customer_gpio_wlan_ctrl(WLAN_RESET_OFF);
		g_wifi_on = 0;
	}
}
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;
	}
}
예제 #12
0
int wl_android_wifi_on(struct net_device *dev)
{
	int ret = 0;
	int retry = POWERUP_MAX_RETRY;

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

	dhd_net_if_lock(dev);
	if (!g_wifi_on) {
		do {
			dhd_customer_gpio_wlan_ctrl(WLAN_RESET_ON);
			ret = sdioh_start(NULL, 0);
			if (ret == 0)
				break;
			DHD_ERROR(("\nfailed to power up wifi chip, retry again (%d left) **\n\n",
				retry));
			dhd_customer_gpio_wlan_ctrl(WLAN_RESET_OFF);
		} while (retry-- >= 0);
		if (ret != 0) {
			DHD_ERROR(("\nfailed to power up wifi chip, max retry reached **\n\n"));
			goto exit;
		}
		ret = dhd_dev_reset(dev, FALSE);
		sdioh_start(NULL, 1);
		if (!ret) {
			if (dhd_dev_init_ioctl(dev) < 0)
				ret = -EFAULT;
		}
		g_wifi_on = TRUE;
	}

exit:
	dhd_net_if_unlock(dev);

	return ret;
}
예제 #13
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;
}
예제 #14
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;
}
예제 #15
0
int wl_android_post_init(void)
{
	struct net_device *ndev;
	int ret = 0;
	char buf[IFNAMSIZ];
	if (!dhd_download_fw_on_driverload) {
		/* Call customer gpio to turn off power with WL_REG_ON signal */
		dhd_customer_gpio_wlan_ctrl(WLAN_RESET_OFF);
		g_wifi_on = 0;
	} else {
		memset(buf, 0, IFNAMSIZ);
#ifdef CUSTOMER_HW2
		snprintf(buf, IFNAMSIZ, "%s%d", iface_name, 0);
#else
		snprintf(buf, IFNAMSIZ, "%s%d", "eth", 0);
#endif
		if ((ndev = dev_get_by_name (&init_net, buf)) != NULL) {
			dhd_dev_init_ioctl(ndev);
			dev_put(ndev);
		}
	}
	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;
}
예제 #17
0
int wl_android_wifi_on(struct net_device *dev)
{
	int ret = 0;

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

	dhd_net_if_lock(dev);
	if (g_wifi_on == G_WLAN_SET_OFF) {
		dhd_customer_gpio_wlan_ctrl(WLAN_RESET_ON);
		sdioh_start(NULL, 0);
		ret = dhd_dev_reset(dev, FALSE);
		sdioh_start(NULL, 1);
		if (!ret)
			dhd_dev_init_ioctl(dev);
		g_wifi_on = G_WLAN_SET_ON;
	}
	dhd_net_if_unlock(dev);

	return ret;
}