int rtl8189es_sdio_poweroff(void) { mmc_pm_gpio_ctrl("rtl8189es_shdn", 0); mmc_pm_gpio_ctrl("rtl8189es_vcc_en", 0); mmc_pm_gpio_ctrl("rtl8189es_vdd_en", 0); return 0; }
int nano_sdio_poweroff(void) { mmc_pm_gpio_ctrl("swl_n20_shdn", 0); mmc_pm_gpio_ctrl("swl_n20_vdd_en", 0); mmc_pm_gpio_ctrl("swl_n20_vcc_en", 0); return 0; }
int rtl8189es_sdio_powerup(void) { mmc_pm_gpio_ctrl("rtl8189es_vdd_en", 1); udelay(100); mmc_pm_gpio_ctrl("rtl8189es_vcc_en", 1); udelay(50); mmc_pm_gpio_ctrl("rtl8189es_shdn", 1); return 0; }
int nano_sdio_powerup(void) { mmc_pm_gpio_ctrl("swl_n20_vcc_en", 1); udelay(100); mmc_pm_gpio_ctrl("swl_n20_shdn", 1); udelay(50); mmc_pm_gpio_ctrl("swl_n20_vdd_en", 1); return 0; }
static int rfkill_set_power(void *data, bool blocked) { unsigned int mod_sel = mmc_pm_get_mod_type(); RF_MSG("rfkill set power %d\n", blocked); spin_lock(&bt_power_lock); switch (mod_sel) { case 2: /* usi bm01a */ if (!blocked) { mmc_pm_gpio_ctrl("usi_bm01a_bt_regon", 1); mmc_pm_gpio_ctrl("usi_bm01a_bt_rst", 1); } else { mmc_pm_gpio_ctrl("usi_bm01a_bt_regon", 0); mmc_pm_gpio_ctrl("usi_bm01a_bt_rst", 0); } break; case 5: /* swb b23 */ if (!blocked) { mmc_pm_gpio_ctrl("swbb23_bt_shdn", 1); } else { mmc_pm_gpio_ctrl("swbb23_bt_shdn", 0); } break; case 6: /* huawei mw269x */ if (!blocked) { mmc_pm_gpio_ctrl("hw_mw269x_bt_wake", 1); mmc_pm_gpio_ctrl("hw_mw269x_bt_enb", 1); } else { mmc_pm_gpio_ctrl("hw_mw269x_bt_enb", 0); mmc_pm_gpio_ctrl("hw_mw269x_bt_wake", 0); } break; default: RF_MSG("no bt module matched !!\n"); } spin_unlock(&bt_power_lock); msleep(100); return 0; }
/* Customer function to control hw specific wlan gpios */ void dhd_customer_gpio_wlan_ctrl(int onoff) { #if defined CONFIG_MMC_SUNXI_POWER_CONTROL unsigned int mod_sel = mmc_pm_get_mod_type(); if (mod_sel != 6) { printk("Config Error: not for huawei mw269x sdio wifi module\n"); } #endif switch (onoff) { case WLAN_RESET_OFF: WL_TRACE(("%s: call customer specific GPIO to insert WLAN RESET\n", __FUNCTION__)); #if defined CONFIG_MMC_SUNXI_POWER_CONTROL mmc_pm_gpio_ctrl("hw_mw269x_wl_enb", 0); #endif #ifdef CUSTOMER_HW bcm_wlan_power_off(2); #endif /* CUSTOMER_HW */ #ifdef CUSTOMER_HW2 wifi_set_power(0, 0); #endif WL_ERROR(("=========== WLAN placed in RESET ========\n")); break; case WLAN_RESET_ON: WL_TRACE(("%s: callc customer specific GPIO to remove WLAN RESET\n", __FUNCTION__)); #if defined CONFIG_MMC_SUNXI_POWER_CONTROL mmc_pm_gpio_ctrl("hw_mw269x_wl_enb", 1); #endif #ifdef CUSTOMER_HW bcm_wlan_power_on(2); #endif /* CUSTOMER_HW */ #ifdef CUSTOMER_HW2 wifi_set_power(1, 0); #endif WL_ERROR(("=========== WLAN going back to live ========\n")); OSL_DELAY(10000); break; case WLAN_POWER_OFF: WL_TRACE(("%s: call customer specific GPIO to turn off WL_REG_ON\n", __FUNCTION__)); #if defined CONFIG_MMC_SUNXI_POWER_CONTROL mmc_pm_gpio_ctrl("hw_mw269x_wl_enb", 0); sunximmc_rescan_card(SDIOID, 0); #endif #ifdef CUSTOMER_HW bcm_wlan_power_off(1); #endif /* CUSTOMER_HW */ break; case WLAN_POWER_ON: WL_TRACE(("%s: call customer specific GPIO to turn on WL_REG_ON\n", __FUNCTION__)); #if defined CONFIG_MMC_SUNXI_POWER_CONTROL mmc_pm_gpio_ctrl("hw_mw269x_wl_enb", 1); #endif #ifdef CUSTOMER_HW bcm_wlan_power_on(1); #endif /* CUSTOMER_HW */ /* Lets customer power to get stable */ OSL_DELAY(200); #if defined CONFIG_MMC_SUNXI_POWER_CONTROL sunximmc_rescan_card(SDIOID, 1); #endif /* CUSTOMER_HW */ break; } }
/* Customer function to control hw specific wlan gpios */ void dhd_customer_gpio_wlan_ctrl(int onoff) { #if defined CUSTOMER_ALLWINNER && defined CONFIG_SW_MMC_POWER_CONTROL unsigned int mod_sel = mmc_pm_get_mod_type(); #endif switch (onoff) { case WLAN_RESET_OFF: WL_TRACE(("%s: call customer specific GPIO to insert WLAN RESET\n", __FUNCTION__)); /* winner's power control */ #if defined CUSTOMER_ALLWINNER && defined CONFIG_SW_MMC_POWER_CONTROL switch (mod_sel) { case 2: /* usi bm01a */ mmc_pm_gpio_ctrl("usi_bm01a_wl_rst", 0); mmc_pm_gpio_ctrl("usi_bm01a_wl_regon", 0); break; case 5: /* swb b23 */ mmc_pm_gpio_ctrl("swbb23_wl_shdn", 0); break; default: printk("[bcm4329]: no wifi module matched !!\n"); } #endif #ifdef CUSTOMER_HW bcm_wlan_power_off(2); #endif /* CUSTOMER_HW */ #ifdef CUSTOMER_HW2 wifi_set_power(0, 0); #endif WL_ERROR(("=========== WLAN placed in RESET ========\n")); break; case WLAN_RESET_ON: WL_TRACE(("%s: callc customer specific GPIO to remove WLAN RESET\n", __FUNCTION__)); /* winner's power control */ #if defined CUSTOMER_ALLWINNER && defined CONFIG_SW_MMC_POWER_CONTROL switch (mod_sel) { case 2: /* usi bm01a */ mmc_pm_gpio_ctrl("usi_bm01a_wl_regon", 1); mmc_pm_gpio_ctrl("usi_bm01a_wl_rst", 1); break; case 5: /* swb b23 */ mmc_pm_gpio_ctrl("swbb23_wl_shdn", 1); break; default: printk("[bcm4329]: no wifi module matched !!\n"); } #endif #ifdef CUSTOMER_HW bcm_wlan_power_on(2); #endif /* CUSTOMER_HW */ #ifdef CUSTOMER_HW2 wifi_set_power(1, 0); #endif WL_ERROR(("=========== WLAN going back to live ========\n")); OSL_DELAY(10000); break; case WLAN_POWER_OFF: WL_TRACE(("%s: call customer specific GPIO to turn off WL_REG_ON\n", __FUNCTION__)); /* winner's power control */ #if defined CUSTOMER_ALLWINNER && defined CONFIG_SW_MMC_POWER_CONTROL switch (mod_sel) { case 2: /* usi bm01a */ mmc_pm_gpio_ctrl("usi_bm01a_wl_rst", 0); mmc_pm_gpio_ctrl("usi_bm01a_wl_regon", 0); break; case 5: /* swb b23 */ mmc_pm_gpio_ctrl("swbb23_wl_shdn", 0); break; default: printk("[bcm4329]: no wifi module matched !!\n"); } sw_mmc_rescan_card(3, 0); #endif #ifdef CUSTOMER_HW bcm_wlan_power_off(1); #endif /* CUSTOMER_HW */ break; case WLAN_POWER_ON: WL_TRACE(("%s: call customer specific GPIO to turn on WL_REG_ON\n", __FUNCTION__)); /* winner's power control */ #if defined CUSTOMER_ALLWINNER && defined CONFIG_SW_MMC_POWER_CONTROL switch (mod_sel) { case 2: /* usi bm01a */ mmc_pm_gpio_ctrl("usi_bm01a_wl_regon", 1); mmc_pm_gpio_ctrl("usi_bm01a_wl_rst", 1); break; case 5: /* swb b23 */ mmc_pm_gpio_ctrl("swbb23_wl_shdn", 1); break; default: printk("[bcm4329]: no wifi module matched !!\n"); } #endif #ifdef CUSTOMER_HW bcm_wlan_power_on(1); #endif /* CUSTOMER_HW */ /* Lets customer power to get stable */ OSL_DELAY(200); #if defined CUSTOMER_ALLWINNER && defined CONFIG_SW_MMC_POWER_CONTROL sw_mmc_rescan_card(3, 1); #endif break; } }
/* Customer function to control hw specific wlan gpios */ void dhd_customer_gpio_wlan_ctrl(int onoff) { switch (onoff) { case WLAN_RESET_OFF: { WL_TRACE(("%s: call customer specific GPIO to insert WLAN RESET\n", __FUNCTION__)); mmc_pm_gpio_ctrl("bcm40181_shdn", 0); mmc_pm_gpio_ctrl("bcm40181_vcc_en", 0); mmc_pm_gpio_ctrl("bcm40181_vdd_en", 0); printk("[bcm40181]: bcm40181_shdn=>0 !!\n"); #ifdef CUSTOMER_HW bcm_wlan_power_off(2); #endif /* CUSTOMER_HW */ #ifdef CONFIG_MACH_MAHIMAHI wifi_set_power(0, 0); #endif WL_ERROR(("=========== WLAN placed in RESET ========\n")); } break; case WLAN_RESET_ON: { WL_TRACE(("%s: callc customer specific GPIO to remove WLAN RESET\n", __FUNCTION__)); mmc_pm_gpio_ctrl("bcm40181_vcc_en", 1); udelay(100); mmc_pm_gpio_ctrl("bcm40181_shdn", 1); udelay(50); mmc_pm_gpio_ctrl("bcm40181_vdd_en", 1); printk("[bcm40181]: bcm40181_shdn=>1 !!\n"); #ifdef CUSTOMER_HW bcm_wlan_power_on(2); #endif /* CUSTOMER_HW */ #ifdef CONFIG_MACH_MAHIMAHI wifi_set_power(1, 0); #endif WL_ERROR(("=========== WLAN going back to live ========\n")); } break; case WLAN_POWER_OFF: { WL_TRACE(("%s: call customer specific GPIO to turn off WL_REG_ON\n", __FUNCTION__)); mmc_pm_gpio_ctrl("bcm40181_shdn", 0); mmc_pm_gpio_ctrl("bcm40181_vcc_en", 0); mmc_pm_gpio_ctrl("bcm40181_vdd_en", 0); sunximmc_rescan_card(3, 0); #ifdef CUSTOMER_HW bcm_wlan_power_off(1); #endif /* CUSTOMER_HW */ } break; case WLAN_POWER_ON: { WL_TRACE(("%s: call customer specific GPIO to turn on WL_REG_ON\n", __FUNCTION__)); mmc_pm_gpio_ctrl("bcm40181_vcc_en", 1); udelay(100); mmc_pm_gpio_ctrl("bcm40181_shdn", 1); udelay(50); mmc_pm_gpio_ctrl("bcm40181_vdd_en", 1); #ifdef CUSTOMER_HW bcm_wlan_power_on(1); #endif /* CUSTOMER_HW */ /* Lets customer power to get stable */ OSL_DELAY(200); sunximmc_rescan_card(3, 1); } break; } }
int rtl8723as_sdio_poweroff(void) { mmc_pm_gpio_ctrl("rtk_rtl8723as_wl_dis", 0); return 0; }
static int rfkill_set_power(void *data, bool blocked) { unsigned int mod_sel = mmc_pm_get_mod_type(); RF_MSG("rfkill set power %d\n", blocked); #ifdef AW_SUPPORT_1IN1_BT rfkill_bt_set_power(blocked); #endif spin_lock(&bt_power_lock); switch (mod_sel) { case 2: /* usi bm01a */ if (!blocked) { mmc_pm_gpio_ctrl("usi_bm01a_bt_regon", 1); mmc_pm_gpio_ctrl("usi_bm01a_bt_rst", 1); } else { mmc_pm_gpio_ctrl("usi_bm01a_bt_regon", 0); mmc_pm_gpio_ctrl("usi_bm01a_bt_rst", 0); } break; case 5: /* swb b23 */ if (!blocked) { mmc_pm_gpio_ctrl("swbb23_bt_shdn", 1); } else { mmc_pm_gpio_ctrl("swbb23_bt_shdn", 0); } break; case 6: /* huawei mw269x */ if (!blocked) { mmc_pm_gpio_ctrl("hw_mw269x_bt_wake", 1); mmc_pm_gpio_ctrl("hw_mw269x_bt_enb", 1); } else { mmc_pm_gpio_ctrl("hw_mw269x_bt_enb", 0); mmc_pm_gpio_ctrl("hw_mw269x_bt_wake", 0); } break; case 8: /* bcm40183 */ if (!blocked) { mmc_pm_gpio_ctrl("bcm40183_bt_regon", 1); mmc_pm_gpio_ctrl("bcm40183_bt_rst", 1); } else { mmc_pm_gpio_ctrl("bcm40183_bt_regon", 0); mmc_pm_gpio_ctrl("bcm40183_bt_rst", 0); } break; case 9: /* realtek rtl8723as */ if (!blocked) { mmc_pm_gpio_ctrl("rtk_rtl8723as_bt_dis", 1); } else { mmc_pm_gpio_ctrl("rtk_rtl8723as_bt_dis", 0); } break; default: RF_MSG("no bt module matched !!\n"); } spin_unlock(&bt_power_lock); msleep(100); return 0; }