mirror of
https://github.com/Mange/rtl8192eu-linux-driver
synced 2025-12-10 08:13:52 +00:00
Add version v5.6.4
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
/******************************************************************************
|
||||
* Customer code to add GPIO control during WLAN start/stop
|
||||
*
|
||||
* Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
|
||||
* Copyright(c) 2007 - 2017 Realtek Corporation.
|
||||
*
|
||||
* 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
|
||||
@@ -12,18 +11,13 @@
|
||||
* 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_PLATFORM_SPRD
|
||||
|
||||
//gspi func & GPIO define
|
||||
#include <mach/gpio.h>//0915
|
||||
/* gspi func & GPIO define */
|
||||
#include <mach/gpio.h>/* 0915 */
|
||||
#include <mach/board.h>
|
||||
|
||||
#if !(defined ANDROID_2X)
|
||||
@@ -31,27 +25,27 @@
|
||||
#ifdef CONFIG_RTL8188E
|
||||
#include <mach/regulator.h>
|
||||
#include <linux/regulator/consumer.h>
|
||||
#endif // CONFIG_RTL8188E
|
||||
#endif /* CONFIG_RTL8188E */
|
||||
|
||||
#ifndef GPIO_WIFI_POWER
|
||||
#define GPIO_WIFI_POWER -1
|
||||
#endif // !GPIO_WIFI_POWER
|
||||
#endif /* !GPIO_WIFI_POWER */
|
||||
|
||||
#ifndef GPIO_WIFI_RESET
|
||||
#define GPIO_WIFI_RESET -1
|
||||
#endif // !GPIO_WIFI_RESET
|
||||
#endif /* !GPIO_WIFI_RESET */
|
||||
|
||||
#ifndef GPIO_WIFI_PWDN
|
||||
#define GPIO_WIFI_PWDN -1
|
||||
#endif // !GPIO_WIFI_RESET
|
||||
#endif /* !GPIO_WIFI_RESET */
|
||||
#ifdef CONFIG_GSPI_HCI
|
||||
extern unsigned int oob_irq;
|
||||
#endif // CONFIG_GSPI_HCI
|
||||
#endif /* CONFIG_GSPI_HCI */
|
||||
|
||||
#ifdef CONFIG_SDIO_HCI
|
||||
extern int rtw_mp_mode;
|
||||
#else // !CONFIG_SDIO_HCI
|
||||
#endif // !CONFIG_SDIO_HCI
|
||||
#else /* !CONFIG_SDIO_HCI */
|
||||
#endif /* !CONFIG_SDIO_HCI */
|
||||
|
||||
int rtw_wifi_gpio_init(void)
|
||||
{
|
||||
@@ -62,7 +56,7 @@ int rtw_wifi_gpio_init(void)
|
||||
|
||||
oob_irq = gpio_to_irq(GPIO_WIFI_IRQ);
|
||||
|
||||
DBG_8192C("%s oob_irq:%d\n", __func__, oob_irq);
|
||||
RTW_INFO("%s oob_irq:%d\n", __func__, oob_irq);
|
||||
}
|
||||
#endif
|
||||
if (GPIO_WIFI_RESET > 0)
|
||||
@@ -71,9 +65,9 @@ int rtw_wifi_gpio_init(void)
|
||||
gpio_request(GPIO_WIFI_POWER, "wifi_power");
|
||||
|
||||
#ifdef CONFIG_SDIO_HCI
|
||||
#if (defined(CONFIG_RTL8723B)) && (MP_DRIVER == 1)
|
||||
if(rtw_mp_mode==1){
|
||||
DBG_871X("%s GPIO_BT_RESET pin special for mp_test\n", __func__);
|
||||
#if (defined(CONFIG_RTL8723B)) && (MP_DRIVER == 1)
|
||||
if (rtw_mp_mode == 1) {
|
||||
RTW_INFO("%s GPIO_BT_RESET pin special for mp_test\n", __func__);
|
||||
if (GPIO_BT_RESET > 0)
|
||||
gpio_request(GPIO_BT_RESET , "bt_rst");
|
||||
}
|
||||
@@ -89,14 +83,14 @@ int rtw_wifi_gpio_deinit(void)
|
||||
gpio_free(GPIO_WIFI_IRQ);
|
||||
#endif
|
||||
if (GPIO_WIFI_RESET > 0)
|
||||
gpio_free(GPIO_WIFI_RESET );
|
||||
gpio_free(GPIO_WIFI_RESET);
|
||||
if (GPIO_WIFI_POWER > 0)
|
||||
gpio_free(GPIO_WIFI_POWER);
|
||||
|
||||
#ifdef CONFIG_SDIO_HCI
|
||||
#if ( defined(CONFIG_RTL8723B)) && (MP_DRIVER == 1)
|
||||
if(rtw_mp_mode==1){
|
||||
DBG_871X("%s GPIO_BT_RESET pin special for mp_test\n", __func__);
|
||||
#if (defined(CONFIG_RTL8723B)) && (MP_DRIVER == 1)
|
||||
if (rtw_mp_mode == 1) {
|
||||
RTW_INFO("%s GPIO_BT_RESET pin special for mp_test\n", __func__);
|
||||
if (GPIO_BT_RESET > 0)
|
||||
gpio_free(GPIO_BT_RESET);
|
||||
}
|
||||
@@ -108,48 +102,45 @@ int rtw_wifi_gpio_deinit(void)
|
||||
/* Customer function to control hw specific wlan gpios */
|
||||
void rtw_wifi_gpio_wlan_ctrl(int onoff)
|
||||
{
|
||||
switch (onoff)
|
||||
{
|
||||
case WLAN_PWDN_OFF:
|
||||
DBG_8192C("%s: call customer specific GPIO(%d) to set wifi power down pin to 0\n",
|
||||
__FUNCTION__, GPIO_WIFI_RESET);
|
||||
switch (onoff) {
|
||||
case WLAN_PWDN_OFF:
|
||||
RTW_INFO("%s: call customer specific GPIO(%d) to set wifi power down pin to 0\n",
|
||||
__FUNCTION__, GPIO_WIFI_RESET);
|
||||
|
||||
#ifndef CONFIG_DONT_BUS_SCAN
|
||||
if (GPIO_WIFI_RESET > 0)
|
||||
gpio_direction_output(GPIO_WIFI_RESET , 0);
|
||||
if (GPIO_WIFI_RESET > 0)
|
||||
gpio_direction_output(GPIO_WIFI_RESET , 0);
|
||||
#endif
|
||||
break;
|
||||
|
||||
case WLAN_PWDN_ON:
|
||||
DBG_8192C("%s: callc customer specific GPIO(%d) to set wifi power down pin to 1\n",
|
||||
__FUNCTION__, GPIO_WIFI_RESET);
|
||||
case WLAN_PWDN_ON:
|
||||
RTW_INFO("%s: callc customer specific GPIO(%d) to set wifi power down pin to 1\n",
|
||||
__FUNCTION__, GPIO_WIFI_RESET);
|
||||
|
||||
if (GPIO_WIFI_RESET > 0)
|
||||
gpio_direction_output(GPIO_WIFI_RESET , 1);
|
||||
if (GPIO_WIFI_RESET > 0)
|
||||
gpio_direction_output(GPIO_WIFI_RESET , 1);
|
||||
break;
|
||||
|
||||
case WLAN_POWER_OFF:
|
||||
case WLAN_POWER_OFF:
|
||||
break;
|
||||
|
||||
case WLAN_POWER_ON:
|
||||
case WLAN_POWER_ON:
|
||||
break;
|
||||
#ifdef CONFIG_SDIO_HCI
|
||||
#if ( defined(CONFIG_RTL8723B)) && (MP_DRIVER == 1)
|
||||
case WLAN_BT_PWDN_OFF:
|
||||
if(rtw_mp_mode==1)
|
||||
{
|
||||
DBG_871X("%s: call customer specific GPIO to set wifi power down pin to 0\n",
|
||||
__FUNCTION__);
|
||||
#if (defined(CONFIG_RTL8723B)) && (MP_DRIVER == 1)
|
||||
case WLAN_BT_PWDN_OFF:
|
||||
if (rtw_mp_mode == 1) {
|
||||
RTW_INFO("%s: call customer specific GPIO to set wifi power down pin to 0\n",
|
||||
__FUNCTION__);
|
||||
if (GPIO_BT_RESET > 0)
|
||||
gpio_direction_output(GPIO_BT_RESET , 0);
|
||||
}
|
||||
break;
|
||||
|
||||
case WLAN_BT_PWDN_ON:
|
||||
if(rtw_mp_mode==1)
|
||||
{
|
||||
DBG_871X("%s: callc customer specific GPIO to set wifi power down pin to 1 %x\n",
|
||||
__FUNCTION__, GPIO_BT_RESET);
|
||||
case WLAN_BT_PWDN_ON:
|
||||
if (rtw_mp_mode == 1) {
|
||||
RTW_INFO("%s: callc customer specific GPIO to set wifi power down pin to 1 %x\n",
|
||||
__FUNCTION__, GPIO_BT_RESET);
|
||||
|
||||
if (GPIO_BT_RESET > 0)
|
||||
gpio_direction_output(GPIO_BT_RESET , 1);
|
||||
@@ -160,7 +151,7 @@ void rtw_wifi_gpio_wlan_ctrl(int onoff)
|
||||
}
|
||||
}
|
||||
|
||||
#else //ANDROID_2X
|
||||
#else /* ANDROID_2X */
|
||||
|
||||
#include <mach/ldo.h>
|
||||
|
||||
@@ -190,94 +181,89 @@ int rtw_wifi_gpio_deinit(void)
|
||||
/* Customer function to control hw specific wlan gpios */
|
||||
void rtw_wifi_gpio_wlan_ctrl(int onoff)
|
||||
{
|
||||
switch (onoff)
|
||||
{
|
||||
case WLAN_PWDN_OFF:
|
||||
DBG_8192C("%s: call customer specific GPIO to set wifi power down pin to 0\n",
|
||||
__FUNCTION__);
|
||||
if (sprd_3rdparty_gpio_wifi_pwd > 0)
|
||||
{
|
||||
gpio_set_value(sprd_3rdparty_gpio_wifi_pwd, 0);
|
||||
}
|
||||
switch (onoff) {
|
||||
case WLAN_PWDN_OFF:
|
||||
RTW_INFO("%s: call customer specific GPIO to set wifi power down pin to 0\n",
|
||||
__FUNCTION__);
|
||||
if (sprd_3rdparty_gpio_wifi_pwd > 0)
|
||||
gpio_set_value(sprd_3rdparty_gpio_wifi_pwd, 0);
|
||||
|
||||
if (sprd_3rdparty_gpio_wifi_pwd == 60) {
|
||||
DBG_8192C("%s: turn off VSIM2 2.8V\n", __func__);
|
||||
LDO_TurnOffLDO(LDO_LDO_SIM2);
|
||||
}
|
||||
if (sprd_3rdparty_gpio_wifi_pwd == 60) {
|
||||
RTW_INFO("%s: turn off VSIM2 2.8V\n", __func__);
|
||||
LDO_TurnOffLDO(LDO_LDO_SIM2);
|
||||
}
|
||||
break;
|
||||
|
||||
case WLAN_PWDN_ON:
|
||||
DBG_8192C("%s: callc customer specific GPIO to set wifi power down pin to 1\n",
|
||||
__FUNCTION__);
|
||||
if (sprd_3rdparty_gpio_wifi_pwd == 60) {
|
||||
DBG_8192C("%s: turn on VSIM2 2.8V\n", __func__);
|
||||
LDO_SetVoltLevel(LDO_LDO_SIM2, LDO_VOLT_LEVEL0);
|
||||
LDO_TurnOnLDO(LDO_LDO_SIM2);
|
||||
}
|
||||
if (sprd_3rdparty_gpio_wifi_pwd > 0)
|
||||
{
|
||||
gpio_set_value(sprd_3rdparty_gpio_wifi_pwd, 1);
|
||||
}
|
||||
case WLAN_PWDN_ON:
|
||||
RTW_INFO("%s: callc customer specific GPIO to set wifi power down pin to 1\n",
|
||||
__FUNCTION__);
|
||||
if (sprd_3rdparty_gpio_wifi_pwd == 60) {
|
||||
RTW_INFO("%s: turn on VSIM2 2.8V\n", __func__);
|
||||
LDO_SetVoltLevel(LDO_LDO_SIM2, LDO_VOLT_LEVEL0);
|
||||
LDO_TurnOnLDO(LDO_LDO_SIM2);
|
||||
}
|
||||
if (sprd_3rdparty_gpio_wifi_pwd > 0)
|
||||
gpio_set_value(sprd_3rdparty_gpio_wifi_pwd, 1);
|
||||
break;
|
||||
|
||||
case WLAN_POWER_OFF:
|
||||
case WLAN_POWER_OFF:
|
||||
#ifdef CONFIG_RTL8188E
|
||||
#ifdef CONFIG_WIF1_LDO
|
||||
DBG_8192C("%s: turn off VDD-WIFI0 1.2V\n", __FUNCTION__);
|
||||
LDO_TurnOffLDO(LDO_LDO_WIF1);
|
||||
#endif //CONFIG_WIF1_LDO
|
||||
RTW_INFO("%s: turn off VDD-WIFI0 1.2V\n", __FUNCTION__);
|
||||
LDO_TurnOffLDO(LDO_LDO_WIF1);
|
||||
#endif /* CONFIG_WIF1_LDO */
|
||||
|
||||
DBG_8192C("%s: turn off VDD-WIFI0 3.3V\n", __FUNCTION__);
|
||||
LDO_TurnOffLDO(LDO_LDO_WIF0);
|
||||
RTW_INFO("%s: turn off VDD-WIFI0 3.3V\n", __FUNCTION__);
|
||||
LDO_TurnOffLDO(LDO_LDO_WIF0);
|
||||
|
||||
DBG_8192C("%s: call customer specific GPIO(%d) to turn off wifi power\n",
|
||||
__FUNCTION__, sprd_3rdparty_gpio_wifi_power);
|
||||
if (sprd_3rdparty_gpio_wifi_power != 65535)
|
||||
gpio_set_value(sprd_3rdparty_gpio_wifi_power, 0);
|
||||
RTW_INFO("%s: call customer specific GPIO(%d) to turn off wifi power\n",
|
||||
__FUNCTION__, sprd_3rdparty_gpio_wifi_power);
|
||||
if (sprd_3rdparty_gpio_wifi_power != 65535)
|
||||
gpio_set_value(sprd_3rdparty_gpio_wifi_power, 0);
|
||||
#endif
|
||||
break;
|
||||
|
||||
case WLAN_POWER_ON:
|
||||
case WLAN_POWER_ON:
|
||||
#ifdef CONFIG_RTL8188E
|
||||
DBG_8192C("%s: call customer specific GPIO(%d) to turn on wifi power\n",
|
||||
__FUNCTION__, sprd_3rdparty_gpio_wifi_power);
|
||||
if (sprd_3rdparty_gpio_wifi_power != 65535)
|
||||
gpio_set_value(sprd_3rdparty_gpio_wifi_power, 1);
|
||||
RTW_INFO("%s: call customer specific GPIO(%d) to turn on wifi power\n",
|
||||
__FUNCTION__, sprd_3rdparty_gpio_wifi_power);
|
||||
if (sprd_3rdparty_gpio_wifi_power != 65535)
|
||||
gpio_set_value(sprd_3rdparty_gpio_wifi_power, 1);
|
||||
|
||||
DBG_8192C("%s: turn on VDD-WIFI0 3.3V\n", __FUNCTION__);
|
||||
LDO_TurnOnLDO(LDO_LDO_WIF0);
|
||||
LDO_SetVoltLevel(LDO_LDO_WIF0,LDO_VOLT_LEVEL1);
|
||||
RTW_INFO("%s: turn on VDD-WIFI0 3.3V\n", __FUNCTION__);
|
||||
LDO_TurnOnLDO(LDO_LDO_WIF0);
|
||||
LDO_SetVoltLevel(LDO_LDO_WIF0, LDO_VOLT_LEVEL1);
|
||||
|
||||
#ifdef CONFIG_WIF1_LDO
|
||||
DBG_8192C("%s: turn on VDD-WIFI1 1.2V\n", __func__);
|
||||
LDO_TurnOnLDO(LDO_LDO_WIF1);
|
||||
LDO_SetVoltLevel(LDO_LDO_WIF1,LDO_VOLT_LEVEL3);
|
||||
#endif //CONFIG_WIF1_LDO
|
||||
RTW_INFO("%s: turn on VDD-WIFI1 1.2V\n", __func__);
|
||||
LDO_TurnOnLDO(LDO_LDO_WIF1);
|
||||
LDO_SetVoltLevel(LDO_LDO_WIF1, LDO_VOLT_LEVEL3);
|
||||
#endif /* CONFIG_WIF1_LDO */
|
||||
#endif
|
||||
break;
|
||||
|
||||
case WLAN_BT_PWDN_OFF:
|
||||
DBG_8192C("%s: call customer specific GPIO to set bt power down pin to 0\n",
|
||||
__FUNCTION__);
|
||||
case WLAN_BT_PWDN_OFF:
|
||||
RTW_INFO("%s: call customer specific GPIO to set bt power down pin to 0\n",
|
||||
__FUNCTION__);
|
||||
#if defined(CONFIG_RTL8723B)
|
||||
if (sprd_3rdparty_gpio_bt_reset > 0)
|
||||
gpio_set_value(sprd_3rdparty_gpio_bt_reset, 0);
|
||||
if (sprd_3rdparty_gpio_bt_reset > 0)
|
||||
gpio_set_value(sprd_3rdparty_gpio_bt_reset, 0);
|
||||
#endif
|
||||
break;
|
||||
|
||||
case WLAN_BT_PWDN_ON:
|
||||
DBG_8192C("%s: callc customer specific GPIO to set bt power down pin to 1\n",
|
||||
__FUNCTION__);
|
||||
case WLAN_BT_PWDN_ON:
|
||||
RTW_INFO("%s: callc customer specific GPIO to set bt power down pin to 1\n",
|
||||
__FUNCTION__);
|
||||
#if defined(CONFIG_RTL8723B)
|
||||
if (sprd_3rdparty_gpio_bt_reset > 0)
|
||||
gpio_set_value(sprd_3rdparty_gpio_bt_reset, 1);
|
||||
if (sprd_3rdparty_gpio_bt_reset > 0)
|
||||
gpio_set_value(sprd_3rdparty_gpio_bt_reset, 1);
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif //ANDROID_2X
|
||||
#endif /* ANDROID_2X */
|
||||
|
||||
#elif defined(CONFIG_PLATFORM_ARM_RK3066)
|
||||
#elif defined(CONFIG_PLATFORM_ARM_RK3066)
|
||||
#include <mach/iomux.h>
|
||||
|
||||
#define GPIO_WIFI_IRQ RK30_PIN2_PC2
|
||||
@@ -286,13 +272,13 @@ int rtw_wifi_gpio_init(void)
|
||||
{
|
||||
#ifdef CONFIG_GSPI_HCI
|
||||
if (GPIO_WIFI_IRQ > 0) {
|
||||
rk30_mux_api_set(GPIO2C2_LCDC1DATA18_SMCBLSN1_HSADCDATA5_NAME, GPIO2C_GPIO2C2);//jacky_test
|
||||
rk30_mux_api_set(GPIO2C2_LCDC1DATA18_SMCBLSN1_HSADCDATA5_NAME, GPIO2C_GPIO2C2);/* jacky_test */
|
||||
gpio_request(GPIO_WIFI_IRQ, "oob_irq");
|
||||
gpio_direction_input(GPIO_WIFI_IRQ);
|
||||
|
||||
oob_irq = gpio_to_irq(GPIO_WIFI_IRQ);
|
||||
|
||||
DBG_8192C("%s oob_irq:%d\n", __func__, oob_irq);
|
||||
RTW_INFO("%s oob_irq:%d\n", __func__, oob_irq);
|
||||
}
|
||||
#endif
|
||||
return 0;
|
||||
@@ -313,33 +299,31 @@ void rtw_wifi_gpio_wlan_ctrl(int onoff)
|
||||
}
|
||||
|
||||
#ifdef CONFIG_GPIO_API
|
||||
//this is a demo for extending GPIO pin[7] as interrupt mode
|
||||
struct net_device * rtl_net;
|
||||
/* this is a demo for extending GPIO pin[7] as interrupt mode */
|
||||
struct net_device *rtl_net;
|
||||
extern int rtw_register_gpio_interrupt(struct net_device *netdev, int gpio_num, void(*callback)(u8 level));
|
||||
extern int rtw_disable_gpio_interrupt(struct net_device *netdev, int gpio_num);
|
||||
void gpio_int(u8 is_high)
|
||||
{
|
||||
DBG_8192C("%s level=%d\n",__func__, is_high);
|
||||
RTW_INFO("%s level=%d\n", __func__, is_high);
|
||||
}
|
||||
int register_net_gpio_init(void)
|
||||
{
|
||||
rtl_net = dev_get_by_name(&init_net,"wlan0");
|
||||
if(!rtl_net)
|
||||
{
|
||||
DBG_871X_LEVEL(_drv_always_, "rtl_net init fail!\n");
|
||||
rtl_net = dev_get_by_name(&init_net, "wlan0");
|
||||
if (!rtl_net) {
|
||||
RTW_PRINT("rtl_net init fail!\n");
|
||||
return -1;
|
||||
}
|
||||
return rtw_register_gpio_interrupt(rtl_net,7, gpio_int);
|
||||
return rtw_register_gpio_interrupt(rtl_net, 7, gpio_int);
|
||||
}
|
||||
int unregister_net_gpio_init(void)
|
||||
{
|
||||
rtl_net = dev_get_by_name(&init_net,"wlan0");
|
||||
if(!rtl_net)
|
||||
{
|
||||
DBG_871X_LEVEL(_drv_always_, "rtl_net init fail!\n");
|
||||
rtl_net = dev_get_by_name(&init_net, "wlan0");
|
||||
if (!rtl_net) {
|
||||
RTW_PRINT("rtl_net init fail!\n");
|
||||
return -1;
|
||||
}
|
||||
return rtw_disable_gpio_interrupt(rtl_net,7);
|
||||
return rtw_disable_gpio_interrupt(rtl_net, 7);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -353,4 +337,4 @@ int rtw_wifi_gpio_init(void)
|
||||
void rtw_wifi_gpio_wlan_ctrl(int onoff)
|
||||
{
|
||||
}
|
||||
#endif //CONFIG_PLATFORM_SPRD
|
||||
#endif /* CONFIG_PLATFORM_SPRD */
|
||||
|
||||
Reference in New Issue
Block a user