From 7f0f1c31153745dc777d73236fce0e4284bfd58d Mon Sep 17 00:00:00 2001 From: yj Date: Thu, 24 Jan 2013 17:05:10 +0800 Subject: [PATCH] LR097 rk3188 : mod config and enable wifi & bluetooth & camera .. --- arch/arm/mach-rk30/board-LR097-sdmmc-config.c | 122 ++++++++++++++++++ .../arm/mach-rk30/board-rk3168-LR097-camera.c | 61 +++++---- arch/arm/mach-rk30/board-rk3168-LR097.c | 4 +- 3 files changed, 159 insertions(+), 28 deletions(-) create mode 100644 arch/arm/mach-rk30/board-LR097-sdmmc-config.c diff --git a/arch/arm/mach-rk30/board-LR097-sdmmc-config.c b/arch/arm/mach-rk30/board-LR097-sdmmc-config.c new file mode 100644 index 000000000000..e5a03a5d7586 --- /dev/null +++ b/arch/arm/mach-rk30/board-LR097-sdmmc-config.c @@ -0,0 +1,122 @@ +/***************************************************************************************** + * arch/arm/mach-rkxx/baord-xxx-sdmmc-config.c + * + * Copyright (C) 2013 ROCKCHIP, Inc. + * + * Description: + * define the gpio for SD-MMC-SDIO-Wifi functions according to your own projects. + * + * Author: Michael Xie + * 15 Jan,2013 + * E-mail: xbw@rock-chips.com + * + ******************************************************************************************/ + +/* +** If you select the macro of CONFIG_SDMMC0_RK29_WRITE_PROTECT, You must define the following values. +** Otherwise, there is no need to define the following values¡£ +*/ +//#define SDMMC0_WRITE_PROTECT_PIN RK30_PIN3_PB2 //According to your own project to set the value of write-protect-pin. +//#define SDMMC0_WRITE_PROTECT_ENABLE_VALUE GPIO_HIGH + +/* +** If you select the macro of CONFIG_SDMMC1_RK29_WRITE_PROTECT, You must define the following values. +** Otherwise, there is no need to define the following values¡£ +*/ +//#define SDMMC1_WRITE_PROTECT_PIN RK30_PIN3_PB3 //According to your own project to set the value of write-protect-pin. +//#define SDMMC1_WRITE_PROTECT_ENABLE_VALUE GPIO_HIGH + +/* +** If you select the macro of CONFIG_RK29_SDIO_IRQ_FROM_GPIO, You must define the following values. +** Otherwise, there is no need to define the following values¡£ +*/ +//#define RK29SDK_WIFI_SDIO_CARD_INT RK30_PIN3_PD2 + + +/* +* define sdcard PowerEn-pin +*/ +#define RK29SDK_SD_CARD_PWR_EN RK30_PIN3_PA1 +#define RK29SDK_SD_CARD_PWR_EN_LEVEL GPIO_LOW + +/* +* define the card-detect-pin. +*/ +#define RK29SDK_SD_CARD_DETECT_N RK30_PIN3_PB0 //According to your own project to set the value of card-detect-pin. +#define RK29SDK_SD_CARD_INSERT_LEVEL GPIO_LOW // set the voltage of insert-card. Please pay attention to the default setting. + +/* +* Define wifi module's power and reset gpio, and gpio sensitive level. +* Please set the value according to your own project. +* +* Well, you just own engineering module to set the value in the corresponding module branch. +* Otherwise, you do not define this macro, eliminate it. +* +*/ +#define WIFI_HOST_WAKE RK30_PIN3_PD2 //If you do not select this function, leave it alone. + +#if defined(CONFIG_RTL8192CU) || defined(CONFIG_RTL8188EU) + #define RK30SDK_WIFI_GPIO_POWER_N RK30_PIN3_PD0 + #define RK30SDK_WIFI_GPIO_POWER_ENABLE_VALUE GPIO_LOW//GPIO_HIGH + +#elif defined(CONFIG_BCM4329) || defined(CONFIG_BCM4319) || defined(CONFIG_RK903) || defined(CONFIG_RK901) + #define RK30SDK_WIFI_GPIO_POWER_N RK30_PIN3_PD0 + #define RK30SDK_WIFI_GPIO_POWER_ENABLE_VALUE GPIO_HIGH + + #define RK30SDK_WIFI_GPIO_RESET_N RK30_PIN2_PA7 + #define RK30SDK_WIFI_GPIO_RESET_ENABLE_VALUE GPIO_HIGH + +#elif defined(CONFIG_MT5931_MT6622) || defined(CONFIG_MT5931) + + #if 1 + #define RK30SDK_WIFI_GPIO_POWER_N RK30_PIN3_PD0 + #define RK30SDK_WIFI_GPIO_POWER_ENABLE_VALUE GPIO_HIGH + + //#define RK30SDK_WIFI_GPIO_RESET_N RK30_PIN3_PD1 + //#define RK30SDK_WIFI_GPIO_RESET_ENABLE_VALUE GPIO_HIGH + + #else + #define RK30SDK_WIFI_GPIO_POWER_N RK30_PIN0_PA5 + #define RK30SDK_WIFI_GPIO_POWER_ENABLE_VALUE GPIO_HIGH + + #define RK30SDK_WIFI_GPIO_RESET_N RK30_PIN3_PD1 + #define RK30SDK_WIFI_GPIO_RESET_ENABLE_VALUE GPIO_HIGH + #endif + +#elif defined(CONFIG_MT6620) + #define COMBO_MODULE_MT6620_CDT 1 // to control antsel2,antsel3 and gps_lan foot when using AcSip or Cdtech chip. + //- 1--use Cdtech chip; 0--unuse CDT chip + + //power, PMU_EN + #define RK30SDK_WIFI_GPIO_POWER_N RK30_PIN3_PC7 + #define RK30SDK_WIFI_GPIO_POWER_ENABLE_VALUE GPIO_HIGH + //reset, DAIRST,SYSRST_B + #define RK30SDK_WIFI_GPIO_RESET_N RK30_PIN3_PD1 + #define RK30SDK_WIFI_GPIO_RESET_ENABLE_VALUE GPIO_HIGH + //VDDIO + //#define RK30SDK_WIFI_GPIO_VCCIO_WL RK30_PIN0_PD2 //You do not get control of the foot, and you do not need to define the macro + //#define RK30SDK_WIFI_GPIO_VCCIO_WL_ENABLE_VALUE GPIO_HIGH + //WIFI_INT_B + #define RK30SDK_WIFI_GPIO_WIFI_INT_B RK30_PIN3_PD2 + #define RK30SDK_WIFI_GPIO_WIFI_INT_B_ENABLE_VALUE GPIO_HIGH + //BGF_INT_B + #define RK30SDK_WIFI_GPIO_BGF_INT_B RK30_PIN6_PA7 + #define RK30SDK_WIFI_GPIO_BGF_INT_B_ENABLE_VALUE GPIO_HIGH + //GPS_SYNC + #define RK30SDK_WIFI_GPIO_GPS_SYNC RK30_PIN3_PD0 + #define RK30SDK_WIFI_GPIO_GPS_SYNC_ENABLE_VALUE GPIO_HIGH + + #if COMBO_MODULE_MT6620_CDT + //ANTSEL2 + #define RK30SDK_WIFI_GPIO_ANTSEL2 RK30_PIN4_PD4 + #define RK30SDK_WIFI_GPIO_ANTSEL2_ENABLE_VALUE GPIO_LOW //use 6620 in CDT chip, LOW--work; High--no work. + //ANTSEL3 + #define RK30SDK_WIFI_GPIO_ANTSEL3 RK30_PIN4_PD3 + #define RK30SDK_WIFI_GPIO_ANTSEL3_ENABLE_VALUE GPIO_HIGH //use 6620 in CDT chip, High--work; Low--no work.. + //GPS_LAN + #define RK30SDK_WIFI_GPIO_GPS_LAN RK30_PIN4_PD6 + #define RK30SDK_WIFI_GPIO_GPS_LAN_ENABLE_VALUE GPIO_HIGH //use 6620 in CDT chip, High--work; Low--no work.. + #endif // #if COMBO_MODULE_MT6620_CDT--#endif +#endif + + diff --git a/arch/arm/mach-rk30/board-rk3168-LR097-camera.c b/arch/arm/mach-rk30/board-rk3168-LR097-camera.c index 2ecd17ff24d3..708f764f8e66 100644 --- a/arch/arm/mach-rk30/board-rk3168-LR097-camera.c +++ b/arch/arm/mach-rk30/board-rk3168-LR097-camera.c @@ -151,9 +151,13 @@ #define CONFIG_SENSOR_POWERDOWN_IOCTL_USR 0 #define CONFIG_SENSOR_FLASH_IOCTL_USR 0 -static void rk_cif_power(int on) +static void rk_cif_power(struct rk29camera_gpio_res *res,int on) { struct regulator *ldo_18,*ldo_28; + int camera_power = res->gpio_power; + int camera_ioflag = res->gpio_flag; + int camera_io_init = res->gpio_init; + ldo_28 = regulator_get(NULL, "act_ldo8"); // vcc28_cif ldo_18 = regulator_get(NULL, "act_ldo3"); // vcc18_cif if (ldo_28 == NULL || IS_ERR(ldo_28) || ldo_18 == NULL || IS_ERR(ldo_18)){ @@ -161,49 +165,52 @@ static void rk_cif_power(int on) return; } if(on == 0){ - regulator_disable(ldo_28); + while(regulator_is_enabled(ldo_28)>0) + regulator_disable(ldo_28); regulator_put(ldo_28); - regulator_disable(ldo_18); + + while(regulator_is_enabled(ldo_18)>0) + regulator_disable(ldo_18); regulator_put(ldo_18); - mdelay(500); - } - else{ - regulator_set_voltage(ldo_28, 2800000, 2800000); - regulator_enable(ldo_28); - // printk("%s set ldo7 vcc28_cif=%dmV end\n", __func__, regulator_get_voltage(ldo_28)); - regulator_put(ldo_28); + + mdelay(10); + if (camera_power != INVALID_GPIO) { + if (camera_io_init & RK29_CAM_POWERACTIVE_MASK) { + gpio_set_value(camera_power, (((~camera_ioflag)&RK29_CAM_POWERACTIVE_MASK)>>RK29_CAM_POWERACTIVE_BITPOS)); + // dprintk("%s..%s..PowerPin=%d ..PinLevel = %x \n",__FUNCTION__,res->dev_name, camera_power, (((~camera_ioflag)&RK29_CAM_POWERACTIVE_MASK)>>RK29_CAM_POWERACTIVE_BITPOS)); + } + } + } + else{ + regulator_set_voltage(ldo_28, 2800000, 2800000); + regulator_enable(ldo_28); + // printk("%s set ldo7 vcc28_cif=%dmV end\n", __func__, regulator_get_voltage(ldo_28)); + regulator_put(ldo_28); regulator_set_voltage(ldo_18, 1800000, 1800000); // regulator_set_suspend_voltage(ldo, 1800000); regulator_enable(ldo_18); // printk("%s set ldo1 vcc18_cif=%dmV end\n", __func__, regulator_get_voltage(ldo_18)); regulator_put(ldo_18); - } + if (camera_power != INVALID_GPIO) { + if (camera_io_init & RK29_CAM_POWERACTIVE_MASK) { + gpio_set_value(camera_power, ((camera_ioflag&RK29_CAM_POWERACTIVE_MASK)>>RK29_CAM_POWERACTIVE_BITPOS)); + mdelay(10); + } + +} + + } } #if CONFIG_SENSOR_POWER_IOCTL_USR static int sensor_power_usr_cb (struct rk29camera_gpio_res *res,int on) { //#error "CONFIG_SENSOR_POWER_IOCTL_USR is 1, sensor_power_usr_cb function must be writed!!"; - rk_cif_power(on); + rk_cif_power(res,on); return 0; } #endif - -#if CONFIG_SENSOR_RESET_IOCTL_USR -static int sensor_reset_usr_cb (struct rk29camera_gpio_res *res,int on) -{ - #error "CONFIG_SENSOR_RESET_IOCTL_USR is 1, sensor_reset_usr_cb function must be writed!!"; -} -#endif - -#if CONFIG_SENSOR_POWERDOWN_IOCTL_USR -static int sensor_powerdown_usr_cb (struct rk29camera_gpio_res *res,int on) -{ - #error "CONFIG_SENSOR_POWERDOWN_IOCTL_USR is 1, sensor_powerdown_usr_cb function must be writed!!"; -} -#endif - #if CONFIG_SENSOR_FLASH_IOCTL_USR static int sensor_flash_usr_cb (struct rk29camera_gpio_res *res,int on) { diff --git a/arch/arm/mach-rk30/board-rk3168-LR097.c b/arch/arm/mach-rk30/board-rk3168-LR097.c index 9e76dc5c2c4a..44d2159aa991 100755 --- a/arch/arm/mach-rk30/board-rk3168-LR097.c +++ b/arch/arm/mach-rk30/board-rk3168-LR097.c @@ -892,7 +892,9 @@ static struct platform_device device_ion = { * SDMMC devices, include the module of SD,MMC,and sdio.noted by xbw at 2012-03-05 **************************************************************************************************/ #ifdef CONFIG_SDMMC_RK29 -#include "board-rk30-sdk-sdmmc.c" +#include "board-LR097-sdmmc-config.c" +#include "../plat-rk/rk-sdmmc-ops.c" +#include "../plat-rk/rk-sdmmc-wifi.c" #endif //endif ---#ifdef CONFIG_SDMMC_RK29 #ifdef CONFIG_SDMMC0_RK29 -- 2.34.1