From: hjc Date: Wed, 7 Aug 2013 03:28:21 +0000 (+0800) Subject: rk3028a_86v: add board defined,fix some basic function X-Git-Tag: firefly_0821_release~6737 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=a734a687595fefcd3031151c2211c53c2798b481;p=firefly-linux-kernel-4.4.55.git rk3028a_86v: add board defined,fix some basic function --- diff --git a/arch/arm/configs/rk3028a_86v_defconfig b/arch/arm/configs/rk3028a_86v_defconfig index 3eb6db0ef4ab..3c4246e3174e 100644 --- a/arch/arm/configs/rk3028a_86v_defconfig +++ b/arch/arm/configs/rk3028a_86v_defconfig @@ -183,6 +183,8 @@ CONFIG_BT_HCIUART_H4=y CONFIG_BT_HCIUART_LL=y CONFIG_BT_HCIBCM4325=y CONFIG_BT_AUTOSLEEP=y +CONFIG_CFG80211=y +CONFIG_MAC80211=y CONFIG_RFKILL=y CONFIG_RFKILL_RK=y CONFIG_DEVTMPFS=y @@ -210,8 +212,7 @@ CONFIG_PHYLIB=y # CONFIG_NETDEV_1000 is not set # CONFIG_NETDEV_10000 is not set CONFIG_WLAN_80211=y -CONFIG_RKWIFI=y -CONFIG_BCM4330=y +CONFIG_RTL8188EU=y CONFIG_USB_USBNET=y CONFIG_PPP=y CONFIG_PPP_MULTILINK=y @@ -244,6 +245,8 @@ CONFIG_TOUCHSCREEN_GSLX680_RK3028=y CONFIG_INPUT_MISC=y CONFIG_INPUT_KEYCHORD=y CONFIG_INPUT_UINPUT=y +CONFIG_GS_MMA7660=y +CONFIG_GS_MMA8452=y CONFIG_SENSOR_DEVICE=y CONFIG_GSENSOR_DEVICE=y CONFIG_GS_MXC6225=y @@ -268,7 +271,9 @@ CONFIG_EXPANDED_GPIO_IRQ_NUM=0 CONFIG_SPI_FPGA_GPIO_NUM=0 CONFIG_SPI_FPGA_GPIO_IRQ_NUM=0 CONFIG_POWER_SUPPLY=y -CONFIG_TEST_POWER=y +CONFIG_BATTERY_RK30_ADC_FAC=y +CONFIG_BATTERY_RK30_AC_CHARGE=y +CONFIG_BATTERY_RK30_VOL3V8=y # CONFIG_HWMON is not set CONFIG_MFD_TPS65910=y CONFIG_MFD_WM831X_I2C=y @@ -277,11 +282,14 @@ CONFIG_REGULATOR=y CONFIG_REGULATOR_TPS65910=y CONFIG_REGULATOR_WM831X=y CONFIG_REGULATOR_ACT8846=y -CONFIG_RK30_PWM_REGULATOR=y CONFIG_MEDIA_SUPPORT=y CONFIG_VIDEO_DEV=y CONFIG_SOC_CAMERA=y -CONFIG_SOC_CAMERA_OV2659=y +# CONFIG_SOC_CAMERA_OV3640 is not set +# CONFIG_SOC_CAMERA_OV5642 is not set +# CONFIG_SOC_CAMERA_OV5640 is not set +CONFIG_SOC_CAMERA_GC0308=y +CONFIG_SOC_CAMERA_GC2035=y CONFIG_VIDEO_RK29=y CONFIG_VIDEO_RK29_CAMMEM_ION=y CONFIG_ION=y diff --git a/arch/arm/mach-rk3026/board-rk3028a-86v-camera.c b/arch/arm/mach-rk3026/board-rk3028a-86v-camera.c index 1b355f74eda8..f79b57ed2ed1 100755 --- a/arch/arm/mach-rk3026/board-rk3028a-86v-camera.c +++ b/arch/arm/mach-rk3026/board-rk3028a-86v-camera.c @@ -34,30 +34,37 @@ Comprehensive camera device registration: */ static struct rkcamera_platform_data new_camera[] = { - new_camera_device(RK29_CAM_SENSOR_OV5642, + new_camera_device(RK29_CAM_SENSOR_GC2035, back, - RK2928_PIN3_PB3, - 0, + RK30_PIN3_PB3, 0, 0, + 1, 0), + new_camera_device(RK29_CAM_SENSOR_GC0308, + front, + RK30_PIN3_PD7, + 0, + 0, + 1, + 0), new_camera_device_end }; /*---------------- Camera Sensor Macro Define Begin ------------------------*/ /*---------------- Camera Sensor Configuration Macro Begin ------------------------*/ -#define CONFIG_SENSOR_0 RK29_CAM_SENSOR_OV5642 /* back camera sensor */ -#define CONFIG_SENSOR_IIC_ADDR_0 0 -#define CONFIG_SENSOR_IIC_ADAPTER_ID_0 0 +#define CONFIG_SENSOR_0 RK29_CAM_SENSOR_GC2035 /* back camera sensor */ +#define CONFIG_SENSOR_IIC_ADDR_0 0x00 +#define CONFIG_SENSOR_IIC_ADAPTER_ID_0 1 #define CONFIG_SENSOR_CIF_INDEX_0 0 #define CONFIG_SENSOR_ORIENTATION_0 90 #define CONFIG_SENSOR_POWER_PIN_0 INVALID_GPIO #define CONFIG_SENSOR_RESET_PIN_0 INVALID_GPIO -#define CONFIG_SENSOR_POWERDN_PIN_0 RK2928_PIN3_PB3 +#define CONFIG_SENSOR_POWERDN_PIN_0 RK30_PIN3_PB3 #define CONFIG_SENSOR_FALSH_PIN_0 INVALID_GPIO #define CONFIG_SENSOR_POWERACTIVE_LEVEL_0 RK29_CAM_POWERACTIVE_L #define CONFIG_SENSOR_RESETACTIVE_LEVEL_0 RK29_CAM_RESETACTIVE_L #define CONFIG_SENSOR_POWERDNACTIVE_LEVEL_0 RK29_CAM_POWERDNACTIVE_H -#define CONFIG_SENSOR_FLASHACTIVE_LEVEL_0 RK29_CAM_FLASHACTIVE_L +#define CONFIG_SENSOR_FLASHACTIVE_LEVEL_0 RK29_CAM_FLASHACTIVE_H #define CONFIG_SENSOR_QCIF_FPS_FIXED_0 15000 #define CONFIG_SENSOR_240X160_FPS_FIXED_0 15000 @@ -114,14 +121,14 @@ static struct rkcamera_platform_data new_camera[] = { #define CONFIG_SENSOR_SVGA_FPS_FIXED_02 15000 #define CONFIG_SENSOR_720P_FPS_FIXED_02 30000 -#define CONFIG_SENSOR_1 RK29_CAM_SENSOR_OV2659 /* front camera sensor 0 */ -#define CONFIG_SENSOR_IIC_ADDR_1 0// 0x60 -#define CONFIG_SENSOR_IIC_ADAPTER_ID_1 3 +#define CONFIG_SENSOR_1 RK29_CAM_SENSOR_GC0308 /* front camera sensor 0 */ +#define CONFIG_SENSOR_IIC_ADDR_1 0x00 +#define CONFIG_SENSOR_IIC_ADAPTER_ID_1 1 #define CONFIG_SENSOR_CIF_INDEX_1 0 #define CONFIG_SENSOR_ORIENTATION_1 270 #define CONFIG_SENSOR_POWER_PIN_1 INVALID_GPIO #define CONFIG_SENSOR_RESET_PIN_1 INVALID_GPIO -#define CONFIG_SENSOR_POWERDN_PIN_1 RK2928_PIN3_PB3 +#define CONFIG_SENSOR_POWERDN_PIN_1 RK30_PIN3_PD7 #define CONFIG_SENSOR_FALSH_PIN_1 INVALID_GPIO #define CONFIG_SENSOR_POWERACTIVE_LEVEL_1 RK29_CAM_POWERACTIVE_L #define CONFIG_SENSOR_RESETACTIVE_LEVEL_1 RK29_CAM_RESETACTIVE_L diff --git a/arch/arm/mach-rk3026/board-rk3028a-86v-sdmmc-config.c b/arch/arm/mach-rk3026/board-rk3028a-86v-sdmmc-config.c index 9626c1b80a89..e5eca17ddf66 100644 --- a/arch/arm/mach-rk3026/board-rk3028a-86v-sdmmc-config.c +++ b/arch/arm/mach-rk3026/board-rk3028a-86v-sdmmc-config.c @@ -68,15 +68,15 @@ int rk31sdk_get_sdmmc0_pin_io_voltage(void) * Otherwise, you do not define this macro, eliminate it. * */ -#if defined(CONFIG_RTL8192CU) || defined(CONFIG_RTL8188EU) - #define RK30SDK_WIFI_GPIO_POWER_N RK30_PIN3_PD0 +#if defined(CONFIG_RTL8192CU) || defined(CONFIG_RTL8188EU) || defined(CONFIG_RTL8723AU) || defined(CONFIG_MT7601) + #define RK30SDK_WIFI_GPIO_POWER_N RK30_PIN3_PD3 #define RK30SDK_WIFI_GPIO_POWER_ENABLE_VALUE GPIO_LOW//GPIO_HIGH -#elif defined(CONFIG_BCM4330) || defined(CONFIG_BCM4329) || defined(CONFIG_BCM4319) || defined(CONFIG_RK903) || defined(CONFIG_RK901) - #define RK30SDK_WIFI_GPIO_POWER_N RK30_PIN3_PD0 +#elif defined(CONFIG_BCM4329) || defined(CONFIG_BCM4319) || defined(CONFIG_RKWIFI) || defined(CONFIG_RTL8189ES) + #define RK30SDK_WIFI_GPIO_POWER_N RK30_PIN3_PD3 #define RK30SDK_WIFI_GPIO_POWER_ENABLE_VALUE GPIO_HIGH - #define RK30SDK_WIFI_GPIO_RESET_N RK30_PIN2_PA7 + #define RK30SDK_WIFI_GPIO_RESET_N RK30_PIN0_PC2 // RK30_PIN2_PA7 #define RK30SDK_WIFI_GPIO_RESET_ENABLE_VALUE GPIO_HIGH #elif defined(CONFIG_MT5931_MT6622) || defined(CONFIG_MT5931) @@ -97,14 +97,14 @@ int rk31sdk_get_sdmmc0_pin_io_voltage(void) #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. + #define COMBO_MODULE_MT6620_CDT 0 // 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 + //power, PMU_EN//hjc test + #define RK30SDK_WIFI_GPIO_POWER_N RK30_PIN0_PB5 #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_N RK30_PIN3_PD0 #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 @@ -113,10 +113,10 @@ int rk31sdk_get_sdmmc0_pin_io_voltage(void) #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 RK30_PIN0_PA5 #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 RK30_PIN3_PD1 #define RK30SDK_WIFI_GPIO_GPS_SYNC_ENABLE_VALUE GPIO_HIGH #if COMBO_MODULE_MT6620_CDT @@ -144,13 +144,13 @@ int rk31sdk_get_sdio_wifi_voltage(void) /****************************************************************************** ** Please tell me how much wifi-module uses voltage in your project. ******************************************************************************/ -#if defined(CONFIG_BCM4330) || defined(CONFIG_BCM4329) || defined(CONFIG_BCM4319) || defined(CONFIG_RK903) || defined(CONFIG_RK901) +#if defined(CONFIG_BCM4329) || defined(CONFIG_BCM4319) || defined(CONFIG_RKWIFI) voltage = 1800 ; //power 1800mV #elif defined(CONFIG_MT5931_MT6622)||defined(CONFIG_MT5931) voltage = 1800 ; //power 1800V #elif defined(CONFIG_MT6620) - voltage = 2800 ; //power 2800V + voltage = 1800 ; //power 2800V #elif defined(CONFIG_RDA5990)||defined(CONFIG_RTL8723AS) voltage = 3300 ; //power 3300V #else diff --git a/arch/arm/mach-rk3026/board-rk3028a-86v.c b/arch/arm/mach-rk3026/board-rk3028a-86v.c index 0a503bddeea8..39b8e7054d0c 100755 --- a/arch/arm/mach-rk3026/board-rk3028a-86v.c +++ b/arch/arm/mach-rk3026/board-rk3028a-86v.c @@ -59,6 +59,9 @@ #include "../../../drivers/video/rockchip/hdmi/rk_hdmi.h" #endif +#if defined(CONFIG_GPS_RK) +#include "../../../drivers/misc/gps/rk_gps/rk_gps.h" +#endif #include "board-rk3028a-86v-camera.c" /*********************************************************** @@ -454,6 +457,7 @@ static int rk_platform_add_display_devices(void) * gsensor ************************************************************/ #if defined (CONFIG_GS_MMA8452) +#define MMA8452_INT_PIN GS_INT_PIN static int mma8452_init_platform_hw(void) { return 0; @@ -468,8 +472,37 @@ static struct sensor_platform_data mma8452_info = { }; #endif +/*MMA7660 gsensor*/ +#if defined (CONFIG_GS_MMA7660) +#define MMA7660_INT_PIN GS_INT_PIN + +static int mma7660_init_platform_hw(void) +{ + //rk30_mux_api_set(GPIO1B2_SPI_RXD_UART1_SIN_NAME, GPIO1B_GPIO1B2); + + return 0; +} + +static struct sensor_platform_data mma7660_info = { + .type = SENSOR_TYPE_ACCEL, + .irq_enable = 1, + .poll_delay_ms = 30, + .init_platform_hw = mma7660_init_platform_hw, +#ifndef CONFIG_MFD_RK616 + #ifdef CONFIG_TOUCHSCREEN_GSLX680_RK3168 + .orientation = {-1, 0, 0, 0, -1, 0, 0, 0, 1}, + #else + .orientation = {0, -1, 0, -1, 0, 0, 0, 0, -1}, + #endif +#else + .orientation = {1, 0, 0, 0, -1, 0, 0, 0, -1}, +#endif +}; +#endif + + #if defined (CONFIG_GS_MXC6225) -#define MXC6225_INT_PIN RK30_PIN3_PD1 +#define MXC6225_INT_PIN GS_INT_PIN static int mxc6225_init_platform_hw(void) { @@ -743,6 +776,35 @@ struct rk29_sdmmc_platform_data default_sdmmc1_data = { }; #endif //endif--#ifdef CONFIG_SDMMC1_RK29 +#ifdef CONFIG_BATTERY_RK30_ADC_FAC +static struct rk30_adc_battery_platform_data rk30_adc_battery_platdata = { + .dc_det_pin = RK30_PIN1_PB4, + .batt_low_pin = INVALID_GPIO, + .charge_set_pin = INVALID_GPIO, + .charge_ok_pin = RK30_PIN1_PA0, + .usb_det_pin = INVALID_GPIO, + .dc_det_level = GPIO_LOW, + .charge_ok_level = GPIO_HIGH, + + .reference_voltage = 1800, // the rK2928 is 3300;RK3066 and rk29 are 2500;rk3066B is 1800; + .pull_up_res = 200, //divider resistance , pull-up resistor + .pull_down_res = 120, //divider resistance , pull-down resistor + + .is_reboot_charging = 1, + .save_capacity = 1 , + .low_voltage_protection = 3600, +}; + +static struct platform_device rk30_device_adc_battery = { + .name = "rk30-battery", + .id = -1, + .dev = { + .platform_data = &rk30_adc_battery_platdata, + }, +}; +#endif + + /*********************************************************** * rfkill ************************************************************/ @@ -836,7 +898,7 @@ static struct platform_device device_ion = { #ifdef CONFIG_SND_SOC_RK3026 struct rk3026_codec_pdata rk3026_codec_pdata_info={ - .spk_ctl_gpio = INVALID_GPIO, + .spk_ctl_gpio = RK2928_PIN3_PD4, .hp_ctl_gpio = RK2928_PIN3_PD4, }; @@ -997,8 +1059,8 @@ static struct pmu_info tps65910_dcdc_info[] = { }, { .name = "vio", //vcc_io - .min_uv = 3000000, - .max_uv = 3000000, + .min_uv = 3300000, + .max_uv = 3300000, }, }; @@ -1010,8 +1072,8 @@ static struct pmu_info tps65910_ldo_info[] = { },*/ { .name = "vdig1", //vcc18_cif - .min_uv = 1800000, - .max_uv = 1800000, + .min_uv = 2800000,//1800000, + .max_uv = 2800000,//1800000, }, { .name = "vdig2", //vdd11 @@ -1063,20 +1125,116 @@ void __sramfunc board_pmu_resume(void) #endif } +#if defined(CONFIG_GPS_RK) +#define GPS_OSCEN_PIN RK2928_PIN1_PB0 +#define GPS_RXEN_PIN RK2928_PIN1_PB0 + +static int rk_gps_io_init(void) +{ + printk("%s \n", __FUNCTION__); + + gpio_request(GPS_OSCEN_PIN, NULL); + gpio_direction_output(GPS_OSCEN_PIN, GPIO_LOW); + + iomux_set(GPS_CLK);//GPS_CLK + iomux_set(GPS_MAG);//GPS_MAG + iomux_set(GPS_SIGN);//GPS_SIGN +#if 0 + gpio_request(RK30_PIN1_PA6, NULL); + gpio_direction_output(RK30_PIN1_PA6, GPIO_LOW); + + gpio_request(RK30_PIN1_PA5, NULL); + gpio_direction_output(RK30_PIN1_PA5, GPIO_LOW); + + gpio_request(RK30_PIN1_PA7, NULL); + gpio_direction_output(RK30_PIN1_PA7, GPIO_LOW); +#endif + return 0; +} +static int rk_gps_power_up(void) +{ + printk("%s \n", __FUNCTION__); + + return 0; +} + +static int rk_gps_power_down(void) +{ + printk("%s \n", __FUNCTION__); + + return 0; +} + +static int rk_gps_reset_set(int level) +{ + return 0; +} +static int rk_enable_hclk_gps(void) +{ + struct clk *gps_aclk = NULL; + gps_aclk = clk_get(NULL, "aclk_gps"); + if(gps_aclk) { + clk_enable(gps_aclk); + clk_put(gps_aclk); + printk("%s \n", __FUNCTION__); + } + else + printk("get gps aclk fail\n"); + return 0; +} +static int rk_disable_hclk_gps(void) +{ + struct clk *gps_aclk = NULL; + gps_aclk = clk_get(NULL, "aclk_gps"); + if(gps_aclk) { + //TO wait long enough until GPS ISR is finished. + msleep(5); + clk_disable(gps_aclk); + clk_put(gps_aclk); + printk("%s \n", __FUNCTION__); + } + else + printk("get gps aclk fail\n"); + return 0; +} +static struct rk_gps_data rk_gps_info = { + .io_init = rk_gps_io_init, + .power_up = rk_gps_power_up, + .power_down = rk_gps_power_down, + .reset = rk_gps_reset_set, + .enable_hclk_gps = rk_enable_hclk_gps, + .disable_hclk_gps = rk_disable_hclk_gps, + .GpsSign = RK2928_PIN1_PA5, + .GpsMag = RK2928_PIN1_PA4, //GPIO index + .GpsClk = RK2928_PIN1_PA2, //GPIO index + .GpsVCCEn = GPS_OSCEN_PIN, //GPIO index +#if 0 + .GpsSpi_CSO = RK30_PIN1_PA4, //GPIO index + .GpsSpiClk = RK30_PIN1_PA5, //GPIO index + .GpsSpiMOSI = RK30_PIN1_PA7, //GPIO index +#endif + .GpsIrq = IRQ_GPS, + .GpsSpiEn = 0, + .GpsAdcCh = 2, + .u32GpsPhyAddr = RK2928_GPS_PHYS, + .u32GpsPhySize = RK2928_GPS_SIZE, +}; + +static struct platform_device rk_device_gps = { + .name = "gps_hv5820b", + .id = -1, + .dev = { + .platform_data = &rk_gps_info, + } + }; +#endif + + /*********************************************************** * i2c ************************************************************/ #ifdef CONFIG_I2C0_RK30 static struct i2c_board_info __initdata i2c0_info[] = { -#if defined (CONFIG_GS_MMA8452) - { - .type = "gs_mma8452", - .addr = 0x1d, - .flags = 0, - .irq = GS_INT_PIN, - .platform_data = &mma8452_info, - }, -#endif #if defined (CONFIG_MFD_TPS65910) { .type = "tps65910", @@ -1101,7 +1259,24 @@ static struct i2c_board_info __initdata i2c1_info[] = { .platform_data = &mxc6225_info, }, #endif - +#if defined (CONFIG_GS_MMA7660) + { + .type = "gs_mma7660",//gs_mma7660 + .addr = 0x4c, + .flags = 0, + .irq = MMA7660_INT_PIN, + .platform_data = &mma7660_info, + }, +#endif +#if defined (CONFIG_GS_MMA8452) + { + .type = "gs_mma8452", + .addr = 0x1d, + .flags = 0, + .irq = MMA8452_INT_PIN, + .platform_data = &mma8452_info, + }, +#endif }; #endif @@ -1186,9 +1361,15 @@ static struct platform_device *devices[] __initdata = { #ifdef CONFIG_RFKILL_RK &device_rfkill_rk, #endif +#ifdef CONFIG_BATTERY_RK30_ADC_FAC + &rk30_device_adc_battery, +#endif #ifdef CONFIG_SND_SOC_RK3026 &rk3026_codec, #endif +#ifdef CONFIG_GPS_RK + &rk_device_gps, +#endif }; static void rk30_pm_power_off(void) @@ -1239,6 +1420,14 @@ static void __init rk30_reserve(void) #ifdef CONFIG_ION rk30_ion_pdata.heaps[0].base = board_mem_reserve_add("ion", ION_RESERVE_SIZE); #endif + +#ifdef CONFIG_VIDEO_RK29 + rk30_camera_request_reserve_mem(); +#endif +#ifdef CONFIG_GPS_RK + //it must be more than 8MB + rk_gps_info.u32MemoryPhyAddr = board_mem_reserve_add("gps", SZ_8M); +#endif board_mem_reserved(); }