/* * Control BT/WIFI LDO always power on accoding to Realtek 8723as chip spec */ static int wifi_bt_ldo_enable(void) { int err; struct regulator *regulator_wifi_bt = NULL; printk("RTL871X(adapter): %s enter\n", __func__); if (GPIO_WIFI_POWERON > 0) { gpio_request(GPIO_WIFI_POWERON, "wifi_pwron"); gpio_direction_output(GPIO_WIFI_POWERON, 1); } regulator_wifi_bt = regulator_get(NULL, "vddcmmb1p2"); if (IS_ERR(regulator_wifi_bt)){ pr_err("Can't get regulator for vddcmmb1p2\n"); return -1; } err = regulator_set_voltage(regulator_wifi_bt, 1800000, 1800000); if (err){ pr_err("RTL871X(adapter): Can't set regulator to voltage 1.8V\n"); return -1; } regulator_enable(regulator_wifi_bt); #ifdef CONFIG_WLAN_SDIO regulator_wifi_bt = regulator_get(NULL, "vddsd1"); if (IS_ERR(regulator_wifi_bt)){ pr_err("RTL871X(adapter): Can't get regulator for VDD_SDIO\n"); return -1; } err = regulator_set_voltage(regulator_wifi_bt, 1800000, 1800000); if (err){ pr_err("RTL871X(adapter): Can't set regulator to valtage 1.8V\n"); return -1; } regulator_enable(regulator_wifi_bt); if (GPIO_WIFI_RESET > 0) { gpio_request(GPIO_WIFI_RESET , "wifi_rst"); gpio_direction_output(GPIO_WIFI_RESET , 1); msleep(5); sdhci_bus_scan(); printk("RTL871X(adapter): %s after bus scan\n", __func__); } #endif printk("RTL871X(adapter): %s exit\n", __func__); return 0; }
int wlan_device_set_carddetect(int val) { pr_info("%s: %d\n", __func__, val); #if 0 wlan_device_cd = val; if (wifi_status_cb) { wifi_status_cb(val, wifi_status_cb_devid); } else pr_warning("%s: Nobody to notify\n", __func__); #endif #ifdef CONFIG_WLAN_SDIO sdhci_bus_scan(); #endif return 0; }
/* * 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; }