/* * Return: * 0: power on successfully * others: power on failed */ int platform_wifi_power_on(void) { int ret = 0; #ifdef CONFIG_RTL8188E rtw_wifi_gpio_wlan_ctrl(WLAN_POWER_ON); #endif /* CONFIG_RTL8188E */ /* Pull up pwd pin, make wifi leave power down mode. */ rtw_wifi_gpio_init(); rtw_wifi_gpio_wlan_ctrl(WLAN_PWDN_ON); #if (MP_DRIVER == 1) && (defined(CONFIG_RTL8723A) || defined(CONFIG_RTL8723B)) /* Pull up BT reset pin. */ rtw_wifi_gpio_wlan_ctrl(WLAN_BT_PWDN_ON); #endif rtw_mdelay_os(5); sdhci_bus_scan(); #ifdef CONFIG_RTL8723B /* YJ,test,130305 */ rtw_mdelay_os(1000); #endif #ifdef ANDROID_2X rtw_mdelay_os(200); #else /* !ANDROID_2X */ if (1) { int i = 0; for (i = 0; i <= 50; i++) { msleep(10); if (sdhci_device_attached()) break; printk("%s delay times:%d\n", __func__, i); } } #endif /* !ANDROID_2X */ return ret; }
static int __init wlan_bt_late_init(void) { int i = 0; printk("RTL871X(adapter): %s enter\n", __func__); /* sdhci_device_attach in wifi driver will fail * because mmc->card is NULL in first wifi on * after reboot, this will cause suspend/resume * fail, so we add bus_scan here before first * wifi on, but we should push down rst in late_init * because bus_scan is in queue work */ if (GPIO_WIFI_RESET > 0) { for (i = 0; i <= 100; i++) { msleep(10); if (sdhci_device_attached()) break; } printk("RTL871X(adapter): %s after delay %d times (10ms)\n", __func__, i); gpio_direction_output(GPIO_WIFI_RESET , 0); } return 0; }