Path: blob/master/ALFA-W1F1/RTL8814AU/platform/platform_sprd_sdio.c
1307 views
/******************************************************************************1*2* Copyright(c) 2013 - 2017 Realtek Corporation.3*4* This program is free software; you can redistribute it and/or modify it5* under the terms of version 2 of the GNU General Public License as6* published by the Free Software Foundation.7*8* This program is distributed in the hope that it will be useful, but WITHOUT9* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or10* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for11* more details.12*13*****************************************************************************/14#include <drv_types.h>1516extern void sdhci_bus_scan(void);17#ifndef ANDROID_2X18extern int sdhci_device_attached(void);19#endif2021/*22* Return:23* 0: power on successfully24* others: power on failed25*/26int platform_wifi_power_on(void)27{28int ret = 0;293031#ifdef CONFIG_RTL8188E32rtw_wifi_gpio_wlan_ctrl(WLAN_POWER_ON);33#endif /* CONFIG_RTL8188E */3435/* Pull up pwd pin, make wifi leave power down mode. */36rtw_wifi_gpio_init();37rtw_wifi_gpio_wlan_ctrl(WLAN_PWDN_ON);3839#if (MP_DRIVER == 1) && (defined(CONFIG_RTL8723A) || defined(CONFIG_RTL8723B))40/* Pull up BT reset pin. */41rtw_wifi_gpio_wlan_ctrl(WLAN_BT_PWDN_ON);42#endif43rtw_mdelay_os(5);4445sdhci_bus_scan();46#ifdef CONFIG_RTL8723B47/* YJ,test,130305 */48rtw_mdelay_os(1000);49#endif50#ifdef ANDROID_2X51rtw_mdelay_os(200);52#else /* !ANDROID_2X */53if (1) {54int i = 0;5556for (i = 0; i <= 50; i++) {57msleep(10);58if (sdhci_device_attached())59break;60printk("%s delay times:%d\n", __func__, i);61}62}63#endif /* !ANDROID_2X */6465return ret;66}6768void platform_wifi_power_off(void)69{70/* Pull down pwd pin, make wifi enter power down mode. */71rtw_wifi_gpio_wlan_ctrl(WLAN_PWDN_OFF);72rtw_mdelay_os(5);73rtw_wifi_gpio_deinit();7475#ifdef CONFIG_RTL8188E76rtw_wifi_gpio_wlan_ctrl(WLAN_POWER_OFF);77#endif /* CONFIG_RTL8188E */7879#ifdef CONFIG_WOWLAN80if (mmc_host)81mmc_host->pm_flags &= ~MMC_PM_KEEP_POWER;82#endif /* CONFIG_WOWLAN */83}848586