summaryrefslogtreecommitdiff
path: root/drivers/net/wireless/rtl8188EUS_linux_v4.3.0.6_12167.20140828/platform
diff options
context:
space:
mode:
authorSrikant Patnaik2015-01-11 12:28:04 +0530
committerSrikant Patnaik2015-01-11 12:28:04 +0530
commit871480933a1c28f8a9fed4c4d34d06c439a7a422 (patch)
tree8718f573808810c2a1e8cb8fb6ac469093ca2784 /drivers/net/wireless/rtl8188EUS_linux_v4.3.0.6_12167.20140828/platform
parent9d40ac5867b9aefe0722bc1f110b965ff294d30d (diff)
downloadFOSSEE-netbook-kernel-source-871480933a1c28f8a9fed4c4d34d06c439a7a422.tar.gz
FOSSEE-netbook-kernel-source-871480933a1c28f8a9fed4c4d34d06c439a7a422.tar.bz2
FOSSEE-netbook-kernel-source-871480933a1c28f8a9fed4c4d34d06c439a7a422.zip
Moved, renamed, and deleted files
The original directory structure was scattered and unorganized. Changes are basically to make it look like kernel structure.
Diffstat (limited to 'drivers/net/wireless/rtl8188EUS_linux_v4.3.0.6_12167.20140828/platform')
-rw-r--r--drivers/net/wireless/rtl8188EUS_linux_v4.3.0.6_12167.20140828/platform/platform_ARM_SUNnI_sdio.c111
-rw-r--r--drivers/net/wireless/rtl8188EUS_linux_v4.3.0.6_12167.20140828/platform/platform_ARM_SUNxI_sdio.c95
-rw-r--r--drivers/net/wireless/rtl8188EUS_linux_v4.3.0.6_12167.20140828/platform/platform_ARM_SUNxI_usb.c142
-rw-r--r--drivers/net/wireless/rtl8188EUS_linux_v4.3.0.6_12167.20140828/platform/platform_RTK_DMP_usb.c36
-rw-r--r--drivers/net/wireless/rtl8188EUS_linux_v4.3.0.6_12167.20140828/platform/platform_ops.c37
-rw-r--r--drivers/net/wireless/rtl8188EUS_linux_v4.3.0.6_12167.20140828/platform/platform_ops.h31
-rw-r--r--drivers/net/wireless/rtl8188EUS_linux_v4.3.0.6_12167.20140828/platform/platform_sprd_sdio.c89
7 files changed, 541 insertions, 0 deletions
diff --git a/drivers/net/wireless/rtl8188EUS_linux_v4.3.0.6_12167.20140828/platform/platform_ARM_SUNnI_sdio.c b/drivers/net/wireless/rtl8188EUS_linux_v4.3.0.6_12167.20140828/platform/platform_ARM_SUNnI_sdio.c
new file mode 100644
index 00000000..48065267
--- /dev/null
+++ b/drivers/net/wireless/rtl8188EUS_linux_v4.3.0.6_12167.20140828/platform/platform_ARM_SUNnI_sdio.c
@@ -0,0 +1,111 @@
+/******************************************************************************
+ *
+ * Copyright(c) 2013 Realtek Corporation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
+ *
+ *
+ ******************************************************************************/
+/*
+ * Description:
+ * This file can be applied to following platforms:
+ * CONFIG_PLATFORM_ARM_SUN6I
+ * CONFIG_PLATFORM_ARM_SUN7I
+ * CONFIG_PLATFORM_ARM_SUN8I
+ */
+#include <drv_types.h>
+#include <mach/sys_config.h>
+#ifdef CONFIG_GPIO_WAKEUP
+#include <linux/gpio.h>
+#endif
+
+#ifdef CONFIG_MMC
+static int sdc_id = -1;
+static signed int gpio_eint_wlan = -1;
+static u32 eint_wlan_handle = 0;
+#if defined(CONFIG_PLATFORM_ARM_SUN6I) || defined(CONFIG_PLATFORM_ARM_SUN7I)
+extern void sw_mci_rescan_card(unsigned id, unsigned insert);
+#elif defined(CONFIG_PLATFORM_ARM_SUN8I)
+extern void sunxi_mci_rescan_card(unsigned id, unsigned insert);
+#endif
+extern int wifi_pm_get_mod_type(void);
+extern void wifi_pm_power(int on);
+#ifdef CONFIG_GPIO_WAKEUP
+extern unsigned int oob_irq;
+#endif
+#endif // CONFIG_MMC
+
+/*
+ * Return:
+ * 0: power on successfully
+ * others: power on failed
+ */
+int platform_wifi_power_on(void)
+{
+ int ret = 0;
+
+#ifdef CONFIG_MMC
+{
+ script_item_u val;
+ script_item_value_type_e type;
+
+ unsigned int mod_sel = wifi_pm_get_mod_type();
+
+ type = script_get_item("wifi_para", "wifi_sdc_id", &val);
+ if (SCIRPT_ITEM_VALUE_TYPE_INT!=type) {
+ DBG_871X("get wifi_sdc_id failed\n");
+ ret = -1;
+ } else {
+ sdc_id = val.val;
+ DBG_871X("----- %s sdc_id: %d, mod_sel: %d\n", __FUNCTION__, sdc_id, mod_sel);
+ wifi_pm_power(1);
+ mdelay(10);
+#if defined(CONFIG_PLATFORM_ARM_SUN6I) || defined(CONFIG_PLATFORM_ARM_SUN7I)
+ sw_mci_rescan_card(sdc_id, 1);
+#elif defined(CONFIG_PLATFORM_ARM_SUN8I)
+ sunxi_mci_rescan_card(sdc_id, 1);
+#endif
+ DBG_871X("%s: power up, rescan card.\n", __FUNCTION__);
+ }
+
+#ifdef CONFIG_GPIO_WAKEUP
+ type = script_get_item("wifi_para", "rtl8723bs_wl_host_wake", &val);
+ if (SCIRPT_ITEM_VALUE_TYPE_PIO != type) {
+ DBG_871X("has no rtl8723bs_wl_wake_host\n");
+ ret = -1;
+ } else {
+ gpio_eint_wlan = val.gpio.gpio;
+#ifdef CONFIG_PLATFORM_ARM_SUN8I
+ oob_irq = gpio_to_irq(gpio_eint_wlan);
+#endif
+ }
+#endif // CONFIG_GPIO_WAKEUP
+}
+#endif // CONFIG_MMC
+
+ return ret;
+}
+
+void platform_wifi_power_off(void)
+{
+#ifdef CONFIG_MMC
+ wifi_pm_power(0);
+#if defined(CONFIG_PLATFORM_ARM_SUN6I) ||defined(CONFIG_PLATFORM_ARM_SUN7I)
+ sw_mci_rescan_card(sdc_id, 0);
+#elif defined(CONFIG_PLATFORM_ARM_SUN8I)
+ sunxi_mci_rescan_card(sdc_id, 0);
+#endif
+ DBG_871X("%s: remove card, power off.\n", __FUNCTION__);
+#endif // CONFIG_MMC
+}
diff --git a/drivers/net/wireless/rtl8188EUS_linux_v4.3.0.6_12167.20140828/platform/platform_ARM_SUNxI_sdio.c b/drivers/net/wireless/rtl8188EUS_linux_v4.3.0.6_12167.20140828/platform/platform_ARM_SUNxI_sdio.c
new file mode 100644
index 00000000..5bc888dc
--- /dev/null
+++ b/drivers/net/wireless/rtl8188EUS_linux_v4.3.0.6_12167.20140828/platform/platform_ARM_SUNxI_sdio.c
@@ -0,0 +1,95 @@
+/******************************************************************************
+ *
+ * Copyright(c) 2013 Realtek Corporation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
+ *
+ *
+ ******************************************************************************/
+#include <drv_types.h>
+
+#ifdef CONFIG_MMC_SUNXI_POWER_CONTROL
+#ifdef CONFIG_WITS_EVB_V13
+#define SDIOID 0
+#else // !CONFIG_WITS_EVB_V13
+#define SDIOID (CONFIG_CHIP_ID==1123 ? 3 : 1)
+#endif // !CONFIG_WITS_EVB_V13
+
+#define SUNXI_SDIO_WIFI_NUM_RTL8189ES 10
+extern void sunximmc_rescan_card(unsigned id, unsigned insert);
+extern int mmc_pm_get_mod_type(void);
+extern int mmc_pm_gpio_ctrl(char* name, int level);
+/*
+ * rtl8189es_shdn = port:PH09<1><default><default><0>
+ * rtl8189es_wakeup = port:PH10<1><default><default><1>
+ * rtl8189es_vdd_en = port:PH11<1><default><default><0>
+ * rtl8189es_vcc_en = port:PH12<1><default><default><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 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;
+}
+#endif // CONFIG_MMC_SUNXI_POWER_CONTROL
+
+/*
+ * Return:
+ * 0: power on successfully
+ * others: power on failed
+ */
+int platform_wifi_power_on(void)
+{
+ int ret = 0;
+#ifdef CONFIG_MMC_SUNXI_POWER_CONTROL
+ unsigned int mod_sel = mmc_pm_get_mod_type();
+#endif // CONFIG_MMC_SUNXI_POWER_CONTROL
+
+
+#ifdef CONFIG_MMC_SUNXI_POWER_CONTROL
+ if (mod_sel == SUNXI_SDIO_WIFI_NUM_RTL8189ES) {
+ rtl8189es_sdio_powerup();
+ sunximmc_rescan_card(SDIOID, 1);
+ printk("[rtl8189es] %s: power up, rescan card.\n", __FUNCTION__);
+ } else {
+ ret = -1;
+ printk("[rtl8189es] %s: mod_sel = %d is incorrect.\n", __FUNCTION__, mod_sel);
+ }
+#endif // CONFIG_MMC_SUNXI_POWER_CONTROL
+
+ return ret;
+}
+
+void platform_wifi_power_off(void)
+{
+#ifdef CONFIG_MMC_SUNXI_POWER_CONTROL
+ sunximmc_rescan_card(SDIOID, 0);
+#ifdef CONFIG_RTL8188E
+ rtl8189es_sdio_poweroff();
+ printk("[rtl8189es] %s: remove card, power off.\n", __FUNCTION__);
+#endif // CONFIG_RTL8188E
+#endif // CONFIG_MMC_SUNXI_POWER_CONTROL
+}
diff --git a/drivers/net/wireless/rtl8188EUS_linux_v4.3.0.6_12167.20140828/platform/platform_ARM_SUNxI_usb.c b/drivers/net/wireless/rtl8188EUS_linux_v4.3.0.6_12167.20140828/platform/platform_ARM_SUNxI_usb.c
new file mode 100644
index 00000000..5352313a
--- /dev/null
+++ b/drivers/net/wireless/rtl8188EUS_linux_v4.3.0.6_12167.20140828/platform/platform_ARM_SUNxI_usb.c
@@ -0,0 +1,142 @@
+/******************************************************************************
+ *
+ * Copyright(c) 2013 Realtek Corporation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
+ *
+ *
+ ******************************************************************************/
+/*
+ * Description:
+ * This file can be applied to following platforms:
+ * CONFIG_PLATFORM_ARM_SUNXI Series platform
+ *
+ */
+
+#include <drv_types.h>
+#include <mach/sys_config.h>
+
+#ifdef CONFIG_PLATFORM_ARM_SUNxI
+extern int sw_usb_disable_hcd(__u32 usbc_no);
+extern int sw_usb_enable_hcd(__u32 usbc_no);
+static int usb_wifi_host = 2;
+#endif
+
+#if defined(CONFIG_PLATFORM_ARM_SUN6I) || defined(CONFIG_PLATFORM_ARM_SUN7I)
+extern int sw_usb_disable_hcd(__u32 usbc_no);
+extern int sw_usb_enable_hcd(__u32 usbc_no);
+extern void wifi_pm_power(int on);
+static script_item_u item;
+#endif
+
+#ifdef CONFIG_PLATFORM_ARM_SUN8I
+extern int sunxi_usb_disable_hcd(__u32 usbc_no);
+extern int sunxi_usb_enable_hcd(__u32 usbc_no);
+extern void wifi_pm_power(int on);
+static script_item_u item;
+#endif
+
+
+int platform_wifi_power_on(void)
+{
+ int ret = 0;
+
+#ifdef CONFIG_PLATFORM_ARM_SUNxI
+#ifndef CONFIG_RTL8723A
+ {
+ /* ----------get usb_wifi_usbc_num------------- */
+ ret = script_parser_fetch("usb_wifi_para", "usb_wifi_usbc_num", (int *)&usb_wifi_host, 64);
+ if(ret != 0){
+ DBG_8192C("ERR: script_parser_fetch usb_wifi_usbc_num failed\n");
+ ret = -ENOMEM;
+ goto exit;
+ }
+ DBG_8192C("sw_usb_enable_hcd: usbc_num = %d\n", usb_wifi_host);
+ sw_usb_enable_hcd(usb_wifi_host);
+ }
+#endif //CONFIG_RTL8723A
+#endif //CONFIG_PLATFORM_ARM_SUNxI
+
+#if defined(CONFIG_PLATFORM_ARM_SUN6I) || defined(CONFIG_PLATFORM_ARM_SUN7I)
+ {
+ script_item_value_type_e type;
+
+ type = script_get_item("wifi_para", "wifi_usbc_id", &item);
+ if(SCIRPT_ITEM_VALUE_TYPE_INT != type){
+ printk("ERR: script_get_item wifi_usbc_id failed\n");
+ ret = -ENOMEM;
+ goto exit;
+ }
+
+ printk("sw_usb_enable_hcd: usbc_num = %d\n", item.val);
+ wifi_pm_power(1);
+ mdelay(10);
+
+ #if !(defined(CONFIG_RTL8723A)) && !(defined(CONFIG_RTL8723B))
+ sw_usb_enable_hcd(item.val);
+ #endif
+ }
+#endif //defined(CONFIG_PLATFORM_ARM_SUN6I) || defined(CONFIG_PLATFORM_ARM_SUN7I)
+
+#if defined(CONFIG_PLATFORM_ARM_SUN8I)
+ {
+ script_item_value_type_e type;
+
+ type = script_get_item("wifi_para", "wifi_usbc_id", &item);
+ if(SCIRPT_ITEM_VALUE_TYPE_INT != type){
+ printk("ERR: script_get_item wifi_usbc_id failed\n");
+ ret = -ENOMEM;
+ goto exit;
+ }
+
+ printk("sw_usb_enable_hcd: usbc_num = %d\n", item.val);
+ wifi_pm_power(1);
+ mdelay(10);
+
+ #if !(defined(CONFIG_RTL8723A)) && !(defined(CONFIG_RTL8723B))
+ sunxi_usb_enable_hcd(item.val);
+ #endif
+ }
+#endif //CONFIG_PLATFORM_ARM_SUN8I
+
+exit:
+ return ret;
+}
+
+void platform_wifi_power_off(void)
+{
+
+#ifdef CONFIG_PLATFORM_ARM_SUNxI
+#ifndef CONFIG_RTL8723A
+ DBG_8192C("sw_usb_disable_hcd: usbc_num = %d\n", usb_wifi_host);
+ sw_usb_disable_hcd(usb_wifi_host);
+#endif //ifndef CONFIG_RTL8723A
+#endif //CONFIG_PLATFORM_ARM_SUNxI
+
+#if defined(CONFIG_PLATFORM_ARM_SUN6I) || defined(CONFIG_PLATFORM_ARM_SUN7I)
+ #if !(defined(CONFIG_RTL8723A)) && !(defined(CONFIG_RTL8723B))
+ sw_usb_disable_hcd(item.val);
+ #endif
+ wifi_pm_power(0);
+#endif //defined(CONFIG_PLATFORM_ARM_SUN6I) || defined(CONFIG_PLATFORM_ARM_SUN7I)
+
+#if defined(CONFIG_PLATFORM_ARM_SUN8I)
+ #if !(defined(CONFIG_RTL8723A)) && !(defined(CONFIG_RTL8723B))
+ sunxi_usb_disable_hcd(item.val);
+ #endif
+ wifi_pm_power(0);
+#endif //defined(CONFIG_PLATFORM_ARM_SUN8I)
+
+}
+
diff --git a/drivers/net/wireless/rtl8188EUS_linux_v4.3.0.6_12167.20140828/platform/platform_RTK_DMP_usb.c b/drivers/net/wireless/rtl8188EUS_linux_v4.3.0.6_12167.20140828/platform/platform_RTK_DMP_usb.c
new file mode 100644
index 00000000..53314338
--- /dev/null
+++ b/drivers/net/wireless/rtl8188EUS_linux_v4.3.0.6_12167.20140828/platform/platform_RTK_DMP_usb.c
@@ -0,0 +1,36 @@
+/******************************************************************************
+ *
+ * Copyright(c) 2013 Realtek Corporation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
+ *
+ *
+ ******************************************************************************/
+#include <drv_types.h>
+
+int platform_wifi_power_on(void)
+{
+ int ret = 0;
+ u32 tmp;
+ tmp=readl((volatile unsigned int*)0xb801a608);
+ tmp &= 0xffffff00;
+ tmp |= 0x55;
+ writel(tmp,(volatile unsigned int*)0xb801a608);//write dummy register for 1055
+ return ret;
+}
+
+void platform_wifi_power_off(void)
+{
+}
+
diff --git a/drivers/net/wireless/rtl8188EUS_linux_v4.3.0.6_12167.20140828/platform/platform_ops.c b/drivers/net/wireless/rtl8188EUS_linux_v4.3.0.6_12167.20140828/platform/platform_ops.c
new file mode 100644
index 00000000..e9b0191f
--- /dev/null
+++ b/drivers/net/wireless/rtl8188EUS_linux_v4.3.0.6_12167.20140828/platform/platform_ops.c
@@ -0,0 +1,37 @@
+/******************************************************************************
+ *
+ * Copyright(c) 2013 Realtek Corporation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
+ *
+ *
+ ******************************************************************************/
+#ifndef CONFIG_PLATFORM_OPS
+/*
+ * Return:
+ * 0: power on successfully
+ * others: power on failed
+ */
+int platform_wifi_power_on(void)
+{
+ int ret = 0;
+
+
+ return ret;
+}
+
+void platform_wifi_power_off(void)
+{
+}
+#endif // !CONFIG_PLATFORM_OPS
diff --git a/drivers/net/wireless/rtl8188EUS_linux_v4.3.0.6_12167.20140828/platform/platform_ops.h b/drivers/net/wireless/rtl8188EUS_linux_v4.3.0.6_12167.20140828/platform/platform_ops.h
new file mode 100644
index 00000000..bd2e6683
--- /dev/null
+++ b/drivers/net/wireless/rtl8188EUS_linux_v4.3.0.6_12167.20140828/platform/platform_ops.h
@@ -0,0 +1,31 @@
+/******************************************************************************
+ *
+ * Copyright(c) 2013 Realtek Corporation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
+ *
+ *
+ ******************************************************************************/
+#ifndef __PLATFORM_OPS_H__
+#define __PLATFORM_OPS_H__
+
+/*
+ * Return:
+ * 0: power on successfully
+ * others: power on failed
+ */
+int platform_wifi_power_on(void);
+void platform_wifi_power_off(void);
+
+#endif // __PLATFORM_OPS_H__
diff --git a/drivers/net/wireless/rtl8188EUS_linux_v4.3.0.6_12167.20140828/platform/platform_sprd_sdio.c b/drivers/net/wireless/rtl8188EUS_linux_v4.3.0.6_12167.20140828/platform/platform_sprd_sdio.c
new file mode 100644
index 00000000..a4e2502f
--- /dev/null
+++ b/drivers/net/wireless/rtl8188EUS_linux_v4.3.0.6_12167.20140828/platform/platform_sprd_sdio.c
@@ -0,0 +1,89 @@
+/******************************************************************************
+ *
+ * Copyright(c) 2013 Realtek Corporation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
+ *
+ *
+ ******************************************************************************/
+#include <drv_types.h>
+
+extern void sdhci_bus_scan(void);
+#ifndef ANDROID_2X
+extern int sdhci_device_attached(void);
+#endif
+
+/*
+ * 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;
+}
+
+void platform_wifi_power_off(void)
+{
+ /* Pull down pwd pin, make wifi enter power down mode. */
+ rtw_wifi_gpio_wlan_ctrl(WLAN_PWDN_OFF);
+ rtw_mdelay_os(5);
+ rtw_wifi_gpio_deinit();
+
+#ifdef CONFIG_RTL8188E
+ rtw_wifi_gpio_wlan_ctrl(WLAN_POWER_OFF);
+#endif // CONFIG_RTL8188E
+
+#ifdef CONFIG_WOWLAN
+ if(mmc_host)
+ mmc_host->pm_flags &= ~MMC_PM_KEEP_POWER;
+#endif // CONFIG_WOWLAN
+}