duos: add wifi power control GPIO
This commit is contained in:
@ -35,6 +35,12 @@
|
|||||||
max-frequency = <187500000>;
|
max-frequency = <187500000>;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
&wifi_pin {
|
||||||
|
compatible = "cvitek,wifi-pin";
|
||||||
|
poweron-gpio = <&porta 15 GPIO_ACTIVE_HIGH>;
|
||||||
|
wakeup-gpio = <&porte 7 GPIO_ACTIVE_HIGH>;
|
||||||
|
};
|
||||||
|
|
||||||
&uart4 {
|
&uart4 {
|
||||||
status = "okay";
|
status = "okay";
|
||||||
};
|
};
|
||||||
|
|||||||
@ -428,6 +428,7 @@ CONFIG_ION_CARVEOUT_HEAP=y
|
|||||||
CONFIG_ION_CMA_HEAP=y
|
CONFIG_ION_CMA_HEAP=y
|
||||||
# CONFIG_IOMMU_SUPPORT is not set
|
# CONFIG_IOMMU_SUPPORT is not set
|
||||||
CONFIG_CV1835_SYSDMA_REMAP=y
|
CONFIG_CV1835_SYSDMA_REMAP=y
|
||||||
|
CONFIG_CVI_WIFI_PIN=y
|
||||||
CONFIG_PWM=y
|
CONFIG_PWM=y
|
||||||
CONFIG_SIFIVE_PLIC=y
|
CONFIG_SIFIVE_PLIC=y
|
||||||
CONFIG_ANDROID=y
|
CONFIG_ANDROID=y
|
||||||
|
|||||||
@ -35,6 +35,12 @@
|
|||||||
max-frequency = <187500000>;
|
max-frequency = <187500000>;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
&wifi_pin {
|
||||||
|
compatible = "cvitek,wifi-pin";
|
||||||
|
poweron-gpio = <&porta 15 GPIO_ACTIVE_HIGH>;
|
||||||
|
wakeup-gpio = <&porte 7 GPIO_ACTIVE_HIGH>;
|
||||||
|
};
|
||||||
|
|
||||||
&uart4 {
|
&uart4 {
|
||||||
status = "okay";
|
status = "okay";
|
||||||
};
|
};
|
||||||
|
|||||||
@ -428,6 +428,7 @@ CONFIG_ION_CARVEOUT_HEAP=y
|
|||||||
CONFIG_ION_CMA_HEAP=y
|
CONFIG_ION_CMA_HEAP=y
|
||||||
# CONFIG_IOMMU_SUPPORT is not set
|
# CONFIG_IOMMU_SUPPORT is not set
|
||||||
CONFIG_CV1835_SYSDMA_REMAP=y
|
CONFIG_CV1835_SYSDMA_REMAP=y
|
||||||
|
CONFIG_CVI_WIFI_PIN=y
|
||||||
CONFIG_PWM=y
|
CONFIG_PWM=y
|
||||||
CONFIG_SIFIVE_PLIC=y
|
CONFIG_SIFIVE_PLIC=y
|
||||||
CONFIG_ANDROID=y
|
CONFIG_ANDROID=y
|
||||||
|
|||||||
@ -653,7 +653,7 @@
|
|||||||
cvi,card_name = "cv182x_internal_PDM";
|
cvi,card_name = "cv182x_internal_PDM";
|
||||||
};
|
};
|
||||||
|
|
||||||
wifi_pin {
|
wifi_pin: wifi_pin {
|
||||||
compatible = "cvitek,wifi-pin";
|
compatible = "cvitek,wifi-pin";
|
||||||
poweron-gpio = <&porta 18 GPIO_ACTIVE_HIGH>;
|
poweron-gpio = <&porta 18 GPIO_ACTIVE_HIGH>;
|
||||||
wakeup-gpio = <&porte 7 GPIO_ACTIVE_HIGH>;
|
wakeup-gpio = <&porte 7 GPIO_ACTIVE_HIGH>;
|
||||||
|
|||||||
@ -17,10 +17,6 @@ function set_gpio()
|
|||||||
echo ${gpio_val} > ${gpio_path}/value
|
echo ${gpio_val} > ${gpio_path}/value
|
||||||
}
|
}
|
||||||
|
|
||||||
# WIFI Power ON
|
|
||||||
wifi_power=495
|
|
||||||
set_gpio ${wifi_power} 1
|
|
||||||
|
|
||||||
# Host Wake BT
|
# Host Wake BT
|
||||||
host_wake_bt=362
|
host_wake_bt=362
|
||||||
set_gpio ${host_wake_bt} 1
|
set_gpio ${host_wake_bt} 1
|
||||||
|
|||||||
@ -15,6 +15,7 @@
|
|||||||
#include <linux/semaphore.h>
|
#include <linux/semaphore.h>
|
||||||
#include <linux/debugfs.h>
|
#include <linux/debugfs.h>
|
||||||
#include <linux/kthread.h>
|
#include <linux/kthread.h>
|
||||||
|
#include <linux/gpio.h>
|
||||||
#include "aicsdio_txrxif.h"
|
#include "aicsdio_txrxif.h"
|
||||||
#include "aicsdio.h"
|
#include "aicsdio.h"
|
||||||
#include "aic_bsp_driver.h"
|
#include "aic_bsp_driver.h"
|
||||||
@ -42,6 +43,11 @@ extern void extern_wifi_set_enable(int is_on);
|
|||||||
extern void set_power_control_lock(int lock);
|
extern void set_power_control_lock(int lock);
|
||||||
#endif//for AML
|
#endif//for AML
|
||||||
|
|
||||||
|
#ifdef CONFIG_PLATFORM_CVITEK
|
||||||
|
extern int cvi_get_wifi_pwr_on_gpio(void);
|
||||||
|
extern int cvi_sdio_rescan(void);
|
||||||
|
static int cvi_wifi_power_gpio = -1;
|
||||||
|
#endif //CONFIG_PLATFORM_CVITEK
|
||||||
|
|
||||||
static int aicbsp_platform_power_on(void);
|
static int aicbsp_platform_power_on(void);
|
||||||
static void aicbsp_platform_power_off(void);
|
static void aicbsp_platform_power_off(void);
|
||||||
@ -67,10 +73,6 @@ module_param_string(saved_sdk_ver, saved_sdk_ver,64, 0660);
|
|||||||
|
|
||||||
extern int testmode;
|
extern int testmode;
|
||||||
|
|
||||||
#ifdef CONFIG_PLATFORM_CVITEK
|
|
||||||
extern int cvi_sdio_rescan(void);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define SDIO_DEVICE_ID_AIC8801_FUNC2 0x0146
|
#define SDIO_DEVICE_ID_AIC8801_FUNC2 0x0146
|
||||||
#define SDIO_DEVICE_ID_AIC8800D80_FUNC2 0x0182
|
#define SDIO_DEVICE_ID_AIC8800D80_FUNC2 0x0182
|
||||||
|
|
||||||
@ -508,6 +510,28 @@ static int aicbsp_platform_power_on(void)
|
|||||||
rockchip_wifi_set_carddetect(1);
|
rockchip_wifi_set_carddetect(1);
|
||||||
#endif /*CONFIG_PLATFORM_ROCKCHIP2*/
|
#endif /*CONFIG_PLATFORM_ROCKCHIP2*/
|
||||||
|
|
||||||
|
#ifdef CONFIG_PLATFORM_CVITEK
|
||||||
|
printk("======== CVITEK WLAN_POWER_ON ========\n");
|
||||||
|
cvi_wifi_power_gpio = cvi_get_wifi_pwr_on_gpio();
|
||||||
|
if (cvi_wifi_power_gpio >= 0) {
|
||||||
|
ret = gpio_request(cvi_wifi_power_gpio, "WLAN_POWER");
|
||||||
|
if (ret < 0) {
|
||||||
|
printk("%s: gpio_request(%d) for WLAN_POWER failed\n",
|
||||||
|
__func__, cvi_wifi_power_gpio);
|
||||||
|
cvi_wifi_power_gpio = -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (cvi_wifi_power_gpio >= 0) {
|
||||||
|
ret = gpio_direction_output(cvi_wifi_power_gpio, 1);
|
||||||
|
if (ret) {
|
||||||
|
printk("%s: WLAN_POWER output high failed!\n", __func__);
|
||||||
|
return -EIO;
|
||||||
|
}
|
||||||
|
mdelay(50);
|
||||||
|
}
|
||||||
|
#endif //CONFIG_PLATFORM_CVITEK
|
||||||
|
|
||||||
sema_init(&aic_chipup_sem, 0);
|
sema_init(&aic_chipup_sem, 0);
|
||||||
ret = aicbsp_reg_sdio_notify(&aic_chipup_sem);
|
ret = aicbsp_reg_sdio_notify(&aic_chipup_sem);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
@ -521,10 +545,11 @@ static int aicbsp_platform_power_on(void)
|
|||||||
sunxi_wlan_set_power(1);
|
sunxi_wlan_set_power(1);
|
||||||
mdelay(50);
|
mdelay(50);
|
||||||
sunxi_mmc_rescan_card(aicbsp_bus_index);
|
sunxi_mmc_rescan_card(aicbsp_bus_index);
|
||||||
|
|
||||||
#endif //CONFIG_PLATFORM_ALLWINNER
|
#endif //CONFIG_PLATFORM_ALLWINNER
|
||||||
|
|
||||||
#ifdef CONFIG_PLATFORM_CVITEK
|
#ifdef CONFIG_PLATFORM_CVITEK
|
||||||
printk("---aic,%s,%d: cvi_sdio_rescan\n", __func__, __LINE__);
|
printk("%s,%d: cvi_sdio_rescan\n", __func__, __LINE__);
|
||||||
cvi_sdio_rescan();
|
cvi_sdio_rescan();
|
||||||
//udelay(1000);
|
//udelay(1000);
|
||||||
#endif
|
#endif
|
||||||
@ -547,11 +572,19 @@ static int aicbsp_platform_power_on(void)
|
|||||||
extern_wifi_set_enable(0);
|
extern_wifi_set_enable(0);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#ifdef CONFIG_PLATFORM_ROCKCHIP2
|
#ifdef CONFIG_PLATFORM_ROCKCHIP2
|
||||||
rockchip_wifi_power(0);
|
rockchip_wifi_power(0);
|
||||||
#endif /*CONFIG_PLATFORM_ROCKCHIP2*/
|
#endif /*CONFIG_PLATFORM_ROCKCHIP2*/
|
||||||
|
|
||||||
|
#ifdef CONFIG_PLATFORM_CVITEK
|
||||||
|
if (cvi_wifi_power_gpio >= 0) {
|
||||||
|
ret = gpio_direction_output(cvi_wifi_power_gpio, 0);
|
||||||
|
if (ret) {
|
||||||
|
printk("%s: WLAN_POWER output low failed!\n", __func__);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif //CONFIG_PLATFORM_CVITEK
|
||||||
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -580,6 +613,14 @@ static void aicbsp_platform_power_off(void)
|
|||||||
extern_wifi_set_enable(0);
|
extern_wifi_set_enable(0);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef CONFIG_PLATFORM_CVITEK
|
||||||
|
printk("======== CVITEK WLAN_POWER_OFF ========\n");
|
||||||
|
if (cvi_wifi_power_gpio >= 0) {
|
||||||
|
if(gpio_direction_output(cvi_wifi_power_gpio, 0)) {
|
||||||
|
printk("%s: WLAN_POWER output low failed!\n", __func__);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif //CONFIG_PLATFORM_CVITEK
|
||||||
|
|
||||||
sdio_dbg("%s\n", __func__);
|
sdio_dbg("%s\n", __func__);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user