int IW8101_wlan_power_on(int flag) { static struct wake_lock *wifi_wake_lock = &iw8101_data.wifi_wake_lock; struct regulator *power = iw8101_data.wifi_power; int reset = iw8101_data.wifi_reset; if (wifi_wake_lock == NULL) pr_warn("%s: invalid wifi_wake_lock\n", __func__); else if (power == NULL) pr_warn("%s: invalid power\n", __func__); else if (!gpio_is_valid(reset)) pr_warn("%s: invalid reset\n", __func__); else goto start; return -ENODEV; start: pr_debug("wlan power on:%d\n", flag); writel(gpio_bakup[0] & 0x1f00000, (void *)(0xb0010300 + PXINTS)); writel(~gpio_bakup[0] & 0x1f00000, (void *)(0xb0010300 + PXINTC)); writel(gpio_bakup[1] & 0x1f00000, (void *)(0xb0010300 + PXMSKS)); writel(~gpio_bakup[1] & 0x1f00000, (void *)(0xb0010300 + PXMSKC)); writel(gpio_bakup[2] & 0x1f00000, (void *)(0xb0010300 + PXPAT1S)); writel(~gpio_bakup[2] & 0x1f00000, (void *)(0xb0010300 + PXPAT1C)); writel(gpio_bakup[3] & 0x1f00000, (void *)(0xb0010300 + PXPAT0S)); writel(~gpio_bakup[3] & 0x1f00000, (void *)(0xb0010300 + PXPAT0C)); jzrtc_enable_clk32k(); msleep(200); switch(flag) { case RESET: regulator_enable(power); jzmmc_clk_ctrl(1, 1); gpio_set_value(reset, 0); msleep(200); gpio_set_value(reset, 1); msleep(200); break; case NORMAL: regulator_enable(power); gpio_set_value(reset, 0); msleep(200); gpio_set_value(reset, 1); msleep(200); jzmmc_manual_detect(1, 1); break; } wake_lock(wifi_wake_lock); return 0; }
int bcm_wlan_power_off(int flag) { static struct wake_lock *wifi_wake_lock = &bcm_data.wifi_wake_lock; #ifdef WL_REG_EN int wl_reg_on = WL_REG_EN; #endif #ifdef WL_RST_EN int reset = bcm_data.wifi_reset; #endif if (wifi_wake_lock == NULL) pr_warn("%s: invalid wifi_wake_lock\n", __func__); #ifdef WL_RST_EN else if (!gpio_is_valid(reset)) pr_warn("%s: invalid reset\n", __func__); #endif else goto start; return -ENODEV; start: pr_debug("wlan power off:%d\n", flag); switch(flag) { case RESET: #ifdef WL_RST_EN gpio_direction_output(reset, 0); #endif #ifdef WL_REG_EN udelay(65); gpio_direction_output(wl_reg_on,0); #endif jzmmc_clk_ctrl(1, 0); break; case NORMAL: #ifdef WL_RST_EN gpio_direction_output(reset, 0); #endif udelay(65); /* * control wlan reg on pin */ #ifdef WL_REG_EN gpio_direction_output(wl_reg_on,0); #endif msleep(200); jzmmc_manual_detect(1, 0); break; } // wake_unlock(wifi_wake_lock); bcm_power_down(); wifi_le_set_io(); return 0; }
int IW8101_wlan_power_off(int flag) { static struct wake_lock *wifi_wake_lock = &iw8101_data.wifi_wake_lock; struct regulator *power = iw8101_data.wifi_power; int reset = iw8101_data.wifi_reset; printk("cljiang---IW8101_wlan_power_off\n"); if (wifi_wake_lock == NULL) pr_warn("%s: invalid wifi_wake_lock\n", __func__); else if (power == NULL) pr_warn("%s: invalid power\n", __func__); else if (!gpio_is_valid(reset)) pr_warn("%s: invalid reset\n", __func__); else goto start; return -ENODEV; start: pr_debug("wlan power off:%d\n", flag); switch(flag) { case RESET: gpio_set_value(reset, 0); regulator_disable(power); wlan_pw_en_disable(); jzmmc_clk_ctrl(1, 0); break; case NORMAL: gpio_set_value(reset, 0); regulator_disable(power); wlan_pw_en_disable(); jzmmc_manual_detect(1, 0); break; } wake_unlock(wifi_wake_lock); clk_32k_off(); // jzrtc_disable_clk32k();/*clk32k off*/ /* gpio_bakup[0] = (unsigned int)readl((void *)(0xb0010300 + PXINT)) & 0x1f00000; gpio_bakup[1] = (unsigned int)readl((void *)(0xb0010300 + PXMSK)) & 0x1f00000; gpio_bakup[2] = (unsigned int)readl((void *)(0xb0010300 + PXPAT1)) & 0x1f00000; gpio_bakup[3] = (unsigned int)readl((void *)(0xb0010300 + PXPAT0)) & 0x1f00000; writel(0x1f00000, (void *)(0xb0010300 + PXINTC)); writel(0x1f00000, (void *)(0xb0010300 + PXMSKS)); writel(0x1f00000, (void *)(0xb0010300 + PXPAT1S)); */ return 0; }
/* It calls jzmmc_manual_detect() to re-scan SDIO card */ int ssv_wlan_power_on(int flag) { static struct wake_lock *wifi_wake_lock = &ssv_6xxx_data.wifi_wake_lock; //struct regulator *wifi_vbat = ssv_6xxx_data.wifi_vbat; //struct regulator *wifi_vddio = ssv_6xxx_data.wifi_vddio; int reset = ssv_6xxx_data.wifi_reset; /* if (wifi_wake_lock == NULL) pr_warn("%s: invalid wifi_wake_lock\n", __func__); else if (wifi_vbat == NULL) pr_warn("%s: invalid wifi_vbat\n", __func__); else if (wifi_vddio == NULL) pr_warn("%s: invalid wifi_vddio\n", __func__); else if (!gpio_is_valid(reset)) pr_warn("%s: invalid reset\n", __func__); else goto start; return -ENODEV; start: */ printk("wlan power on:%d\n", flag); wake_lock(wifi_wake_lock); //rtc32k_enable(); switch(flag) { case RESET: wlan_pw_en_enable(); jzmmc_clk_ctrl(WLAN_SDIO_INDEX, 1); gpio_direction_output(reset, 0); msleep(100); gpio_direction_output(reset, 1); break; case NORMAL: wlan_pw_en_enable(); gpio_direction_output(reset, 0); msleep(200); gpio_direction_output(reset, 1); jzmmc_manual_detect(WLAN_SDIO_INDEX, 1); break; } wake_unlock(wifi_wake_lock); return 0; }
int bcm_wlan_power_on(int flag) { static struct wake_lock *wifi_wake_lock = &bcm_ap6212_data.wifi_wake_lock; struct regulator *wifi_vbat = bcm_ap6212_data.wifi_vbat; struct regulator *wifi_vddio = bcm_ap6212_data.wifi_vddio; int reset = bcm_ap6212_data.wifi_reset; if (wifi_wake_lock == NULL) pr_warn("%s: invalid wifi_wake_lock\n", __func__); else if (wifi_vbat == NULL) pr_warn("%s: invalid wifi_vbat\n", __func__); else if (wifi_vddio == NULL) pr_warn("%s: invalid wifi_vddio\n", __func__); else if (!gpio_is_valid(reset)) pr_warn("%s: invalid reset\n", __func__); else goto start; return -ENODEV; start: pr_debug("wlan power on:%d\n", flag); wake_lock(wifi_wake_lock); rtc32k_enable(); switch(flag) { case RESET: wlan_pw_en_enable(); jzmmc_clk_ctrl(WLAN_SDIO_INDEX, 1); gpio_set_value(reset, 0); msleep(100); gpio_set_value(reset, 1); break; case NORMAL: wlan_pw_en_enable(); gpio_set_value(reset, 0); msleep(100); gpio_set_value(reset, 1); jzmmc_manual_detect(WLAN_SDIO_INDEX, 1); break; } wake_unlock(wifi_wake_lock); return 0; }
int IW8101_wlan_power_off(int flag) { static struct wake_lock *wifi_wake_lock = &iw8101_data.wifi_wake_lock; struct regulator *power = iw8101_data.wifi_power; int reset = iw8101_data.wifi_reset; if (wifi_wake_lock == NULL) pr_warn("%s: invalid wifi_wake_lock\n", __func__); else if (power == NULL) pr_warn("%s: invalid power\n", __func__); else if (!gpio_is_valid(reset)) pr_warn("%s: invalid reset\n", __func__); else goto start; return -ENODEV; start: pr_debug("wlan power off:%d\n", flag); switch(flag) { case RESET: gpio_set_value(reset, 0); regulator_disable(power); jzmmc_clk_ctrl(1, 0); break; case NORMAL: gpio_set_value(reset, 0); regulator_disable(power); jzmmc_manual_detect(1, 0); break; } wake_unlock(wifi_wake_lock); jzrtc_disable_clk32k(); return 0; }
int bcm_wlan_power_on(int flag) { static struct wake_lock *wifi_wake_lock = &bcm_data.wifi_wake_lock; #ifdef WL_REG_EN int wl_reg_on = WL_REG_EN; #endif #ifdef WL_RST_EN int reset = bcm_data.wifi_reset; #endif if (wifi_wake_lock == NULL) pr_warn("%s: invalid wifi_wake_lock\n", __func__); #ifdef WL_RST_EN else if (!gpio_is_valid(reset)) pr_warn("%s: invalid reset\n", __func__); #endif else goto start; return -ENODEV; start: pr_debug("wlan power on:%d\n", flag); wifi_le_restore_io(); bcm_power_on(); msleep(200); switch(flag) { case RESET: #ifdef WL_REG_EN gpio_direction_output(wl_reg_on, 1); msleep(200); #endif jzmmc_clk_ctrl(1, 1); #ifdef WL_RST_EN gpio_direction_output(reset, 0); msleep(200); gpio_direction_output(reset, 1); msleep(200); #endif break; case NORMAL: //msleep(200); useless msleep, by snmu for android-6.0 speed up,warn:it is probably cause has bug. #ifdef WL_REG_EN gpio_direction_output(wl_reg_on,1); //msleep(200); useless msleep, by snmu for android-6.0 speed up,warn:it is probably cause has bug. #endif #ifdef WL_RST_EN gpio_direction_output(reset, 0); msleep(200); gpio_direction_output(reset, 1); msleep(200); #endif jzmmc_manual_detect(1, 1); break; } // wake_lock(wifi_wake_lock); return 0; }