#include <mach/vpu_mem.h>
#include <mach/sram.h>
#include <mach/ddr.h>
+#include <mach/cpufreq.h>
#include <linux/regulator/rk29-pwm-regulator.h>
#include <linux/regulator/machine.h>
#include <linux/mtd/nand.h>
#include <linux/mtd/partitions.h>
-
+#include <linux/i2c-gpio.h>
+#include <linux/mpu.h>
#include "devices.h"
+
#if defined(CONFIG_MTK23D)
#include <linux/mtk23d.h>
#endif
+#ifdef CONFIG_USE_GPIO_GENERATE_WAVE
+#include "../../../drivers/testcode/gpio_wave.h"
+#endif
+
#include "../../../drivers/headset_observe/rk_headset.h"
/*set touchscreen different type header*/
#if defined(CONFIG_TOUCHSCREEN_XPT2046_NORMAL_SPI)
#elif defined(CONFIG_TOUCHSCREEN_XPT2046_CBN_SPI)
#include "../../../drivers/input/touchscreen/xpt2046_cbn_ts.h"
#endif
-
#include "../../../drivers/misc/gps/rk29_gps.h"
#include "../../../drivers/serial/sc8800.h"
+#ifdef CONFIG_VIDEO_RK29
+/*---------------- 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 0x78
+#define CONFIG_SENSOR_IIC_ADAPTER_ID_0 1
+#define CONFIG_SENSOR_POWER_PIN_0 INVALID_GPIO
+#define CONFIG_SENSOR_RESET_PIN_0 INVALID_GPIO
+#define CONFIG_SENSOR_POWERDN_PIN_0 RK29_PIN6_PB7
+#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_1 RK29_CAM_SENSOR_OV2659 /* front camera sensor */
+#define CONFIG_SENSOR_IIC_ADDR_1 0x60
+#define CONFIG_SENSOR_IIC_ADAPTER_ID_1 1
+#define CONFIG_SENSOR_POWER_PIN_1 INVALID_GPIO
+#define CONFIG_SENSOR_RESET_PIN_1 INVALID_GPIO
+#define CONFIG_SENSOR_POWERDN_PIN_1 RK29_PIN5_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
+#define CONFIG_SENSOR_POWERDNACTIVE_LEVEL_1 RK29_CAM_POWERDNACTIVE_H
+#define CONFIG_SENSOR_FLASHACTIVE_LEVEL_1 RK29_CAM_FLASHACTIVE_L
+#endif //#ifdef CONFIG_VIDEO_RK29
+/*---------------- Camera Sensor Configuration Macro End------------------------*/
+#include "../../../drivers/media/video/rk29_camera.c"
+/*---------------- Camera Sensor Macro Define End ------------------------*/
+
/* Set memory size of pmem */
#ifdef CONFIG_RK29_MEM_SIZE_M
#else
#define SDRAM_SIZE SZ_512M
#endif
-#define PMEM_GPU_SIZE SZ_64M
+#define PMEM_GPU_SIZE SZ_16M
#define PMEM_UI_SIZE SZ_32M
#define PMEM_VPU_SIZE SZ_64M
-#define PMEM_CAM_SIZE 0x01300000
+#define PMEM_CAM_SIZE PMEM_CAM_NECESSARY
#ifdef CONFIG_VIDEO_RK29_WORK_IPP
#define MEM_CAMIPP_SIZE SZ_4M
#else
#endif
#define MEM_FB_SIZE (3*SZ_2M)
#ifdef CONFIG_FB_WORK_IPP
+#ifdef CONFIG_FB_SCALING_OSD_1080P
+#define MEM_FBIPP_SIZE SZ_16M //1920 x 1080 x 2 x 2 //RGB565 = x2;RGB888 = x4
+#else
#define MEM_FBIPP_SIZE SZ_8M //1920 x 1080 x 2 x 2 //RGB565 = x2;RGB888 = x4
+#endif
#else
#define MEM_FBIPP_SIZE 0
#endif
-#define PMEM_GPU_BASE ((u32)RK29_SDRAM_PHYS + SDRAM_SIZE - PMEM_GPU_SIZE)
+#if SDRAM_SIZE > SZ_512M
+#define PMEM_GPU_BASE (RK29_SDRAM_PHYS + SZ_512M - PMEM_GPU_SIZE)
+#else
+#define PMEM_GPU_BASE (RK29_SDRAM_PHYS + SDRAM_SIZE - PMEM_GPU_SIZE)
+#endif
#define PMEM_UI_BASE (PMEM_GPU_BASE - PMEM_UI_SIZE)
#define PMEM_VPU_BASE (PMEM_UI_BASE - PMEM_VPU_SIZE)
#define PMEM_CAM_BASE (PMEM_VPU_BASE - PMEM_CAM_SIZE)
.io_deinit = rk29_lcd_io_deinit,
};
+int rk29_fb_io_enable(void)
+{
+ if(FB_DISPLAY_ON_PIN != INVALID_GPIO)
+ {
+ gpio_direction_output(FB_DISPLAY_ON_PIN, 0);
+ gpio_set_value(FB_DISPLAY_ON_PIN, FB_DISPLAY_ON_VALUE);
+ }
+ if(FB_LCD_STANDBY_PIN != INVALID_GPIO)
+ {
+ gpio_direction_output(FB_LCD_STANDBY_PIN, 0);
+ gpio_set_value(FB_LCD_STANDBY_PIN, FB_LCD_STANDBY_VALUE);
+ }
+ return 0;
+}
+
+int rk29_fb_io_disable(void)
+{
+ if(FB_DISPLAY_ON_PIN != INVALID_GPIO)
+ {
+ gpio_direction_output(FB_DISPLAY_ON_PIN, 0);
+ gpio_set_value(FB_DISPLAY_ON_PIN, !FB_DISPLAY_ON_VALUE);
+ }
+ if(FB_LCD_STANDBY_PIN != INVALID_GPIO)
+ {
+ gpio_direction_output(FB_LCD_STANDBY_PIN, 0);
+ gpio_set_value(FB_LCD_STANDBY_PIN, !FB_LCD_STANDBY_VALUE);
+ }
+ return 0;
+}
static int rk29_fb_io_init(struct rk29_fb_setting_info *fb_setting)
{
gpio_direction_output(FB_LCD_CABC_EN_PIN, 0);
gpio_set_value(FB_LCD_CABC_EN_PIN, GPIO_LOW);
}
+ rk29_fb_io_enable(); //enable it
return ret;
}
static struct rk29fb_info rk29_fb_info = {
.fb_id = FB_ID,
- .disp_on_pin = FB_DISPLAY_ON_PIN,
- .disp_on_value = FB_DISPLAY_ON_VALUE,
- .standby_pin = FB_LCD_STANDBY_PIN,
- .standby_value = FB_LCD_STANDBY_VALUE,
.mcu_fmk_pin = FB_MCU_FMK_PIN,
.lcd_info = &rk29_lcd_info,
.io_init = rk29_fb_io_init,
+ .io_enable = rk29_fb_io_enable,
+ .io_disable = rk29_fb_io_disable,
};
/* rk29 fb resource */
.name = "pmem",
.start = PMEM_UI_BASE,
.size = PMEM_UI_SIZE,
- .no_allocator = 0,
+ .no_allocator = 1,
.cached = 1,
};
};
-static struct android_pmem_platform_data android_pmem_cam_pdata = {
- .name = "pmem_cam",
- .start = PMEM_CAM_BASE,
- .size = PMEM_CAM_SIZE,
- .no_allocator = 1,
- .cached = 1,
-};
-
-static struct platform_device android_pmem_cam_device = {
- .name = "android_pmem",
- .id = 1,
- .dev = {
- .platform_data = &android_pmem_cam_pdata,
- },
-};
-
-
static struct vpu_mem_platform_data vpu_mem_pdata = {
.name = "vpu_mem",
.start = PMEM_VPU_BASE,
};
#endif
+
#if defined(CONFIG_TOUCHSCREEN_GT801_IIC)
#include "../../../drivers/input/touchscreen/gt801_ts.h"
#define GT801_GPIO_INT RK29_PIN4_PD5
};
#endif
+
+#if defined(CONFIG_TOUCHSCREEN_GT818_IIC)
+#include "../../../drivers/input/touchscreen/gt818_ts.h"
+#define GT818_GPIO_INT RK29_PIN4_PD5
+#define GT818_GPIO_RESET RK29_PIN6_PC3
+static struct gt818_platform_data gt818_info = {
+ .model = 818,
+ .swap_xy = 0,
+ .x_min = 0,
+ .x_max = 480,
+ .y_min = 0,
+ .y_max = 800,
+ .gpio_reset = GT818_GPIO_RESET,
+ .gpio_reset_active_low = 0,
+ .gpio_pendown = GT818_GPIO_INT,
+ .pendown_iomux_name = GPIO4D5_CPUTRACECTL_NAME,
+ .resetpin_iomux_name = NULL,
+ .pendown_iomux_mode = GPIO4H_GPIO4D5,
+ .resetpin_iomux_mode = 0,
+};
+#endif
+
+#if defined(CONFIG_TOUCHSCREEN_ILI2102_IIC)
+#include "../../../drivers/input/touchscreen/ili2102_ts.h"
+#define GT801_GPIO_INT RK29_PIN4_PD5
+#define GT801_GPIO_RESET RK29_PIN6_PC3
+static struct ili2102_platform_data ili2102_info = {
+ .model = 2102,
+ .swap_xy = 0,
+ .x_min = 0,
+ .x_max = 481,
+ .y_min = 0,
+ .y_max = 801,
+ .gpio_reset = GT801_GPIO_RESET,
+ .gpio_reset_active_low = 1,
+ .gpio_pendown = GT801_GPIO_INT,
+ .pendown_iomux_name = GPIO4D5_CPUTRACECTL_NAME,
+ .resetpin_iomux_name = NULL,
+ .pendown_iomux_mode = GPIO4H_GPIO4D5,
+ .resetpin_iomux_mode = 0,
+};
+#endif
+
/* EETI_EGALAX touch I2C */
#if defined (CONFIG_EETI_EGALAX)
#define TOUCH_RESET_PIN RK29_PIN6_PC3
};
#endif
+#if defined (CONFIG_MPU_SENSORS_MPU3050)
+/*mpu3050*/
+static struct mpu3050_platform_data mpu3050_data = {
+ .int_config = 0x10,
+ //.orientation = { 1, 0, 0,0, -1, 0,0, 0, 1 },
+ //.orientation = { 0, 1, 0,-1, 0, 0,0, 0, -1 },
+ //.orientation = { -1, 0, 0,0, -1, 0,0, 0, -1 },
+ //.orientation = { 0, 1, 0, -1, 0, 0, 0, 0, 1 },
+ .orientation = { 1, 0, 0,0, 1, 0, 0, 0, 1 },
+ .level_shifter = 0,
+#if defined (CONFIG_MPU_SENSORS_KXTF9)
+ .accel = {
+#ifdef CONFIG_MPU_SENSORS_MPU3050_MODULE
+ .get_slave_descr = NULL ,
+#else
+ .get_slave_descr = get_accel_slave_descr ,
+#endif
+ .adapt_num = 0, // The i2c bus to which the mpu device is
+ // connected
+ //.irq = RK29_PIN6_PC4,
+ .bus = EXT_SLAVE_BUS_SECONDARY, //The secondary I2C of MPU
+ .address = 0x0f,
+ //.orientation = { 1, 0, 0,0, 1, 0,0, 0, 1 },
+ //.orientation = { 0, -1, 0,-1, 0, 0,0, 0, -1 },
+ //.orientation = { 0, 1, 0,1, 0, 0,0, 0, -1 },
+ //.orientation = { 0, 1 ,0, -1 ,0, 0, 0, 0, 1 },
+ .orientation = {1, 0, 0, 0, 1, 0, 0, 0, 1},
+ },
+#endif
+#if defined (CONFIG_MPU_SENSORS_AK8975)
+ .compass = {
+#ifdef CONFIG_MPU_SENSORS_MPU3050_MODULE
+ .get_slave_descr = NULL,/*ak5883_get_slave_descr,*/
+#else
+ .get_slave_descr = get_compass_slave_descr,
+#endif
+ .adapt_num = 0, // The i2c bus to which the compass device is.
+ // It can be difference with mpu
+ // connected
+ //.irq = RK29_PIN6_PC5,
+ .bus = EXT_SLAVE_BUS_PRIMARY,
+ .address = 0x0d,
+ //.orientation = { -1, 0, 0,0, -1, 0,0, 0, 1 },
+ //.orientation = { 0, -1, 0,-1, 0, 0,0, 0, -1 },
+ //.orientation = { 0, 1, 0,1, 0, 0,0, 0, -1 },
+ //.orientation = { 0, -1, 0, 1, 0, 0, 0, 0, 1 },
+ .orientation = {0, 1, 0, -1, 0, 0, 0, 0, 1},
+ },
+};
+#endif
+#endif
+
#if defined(CONFIG_GPIO_WM831X)
struct rk29_gpio_expander_info wm831x_gpio_settinginfo[] = {
{
//ILIM = 900ma
ret = wm831x_reg_read(parm, WM831X_POWER_STATE) & 0xffff;
wm831x_reg_write(parm, WM831X_POWER_STATE, (ret&0xfff8) | 0x04);
+
+ //BATT_FET_ENA = 1
+ wm831x_set_bits(parm, WM831X_RESET_CONTROL,0x1000,0x1000);
+ ret = wm831x_reg_read(parm, WM831X_RESET_CONTROL) & 0xffff;
+ printk("%s:WM831X_RESET_CONTROL=0x%x\n",__FUNCTION__,ret);
+
#if 0
wm831x_set_bits(parm, WM831X_LDO_ENABLE, (1 << 3), 0);
wm831x_set_bits(parm, WM831X_LDO_ENABLE, (1 << 7), 0);
dcdc = regulator_get(NULL, "dcdc3"); // 1th IO
regulator_set_voltage(dcdc,3000000,3000000);
+ regulator_set_suspend_voltage(dcdc, 2800000);
regulator_enable(dcdc);
printk("%s set dcdc3=%dmV end\n", __FUNCTION__, regulator_get_voltage(dcdc));
regulator_put(dcdc);
ldo = regulator_get(NULL, "ldo10"); // 1th modem IO
regulator_set_voltage(ldo,3000000,3000000);
+ regulator_set_suspend_voltage(ldo,3000000);
regulator_enable(ldo);
printk("%s set ldo10=%dmV end\n", __FUNCTION__, regulator_get_voltage(ldo));
regulator_put(ldo);
dcdc = regulator_get(NULL, "dcdc2"); // 2th CORE
regulator_set_voltage(dcdc,1300000,1300000);
+ regulator_set_suspend_voltage(dcdc,1000000);
regulator_enable(dcdc);
printk("%s set dcdc2=%dmV end\n", __FUNCTION__, regulator_get_voltage(dcdc));
regulator_put(dcdc);
dcdc = regulator_get(NULL, "dcdc1"); // 3th ddr
regulator_set_voltage(dcdc,1800000,1800000);
+ regulator_set_suspend_voltage(ldo, 1800000);
regulator_enable(dcdc);
printk("%s set dcdc1=%dmV end\n", __FUNCTION__, regulator_get_voltage(dcdc));
regulator_put(dcdc);
ldo = regulator_get(NULL, "ldo1"); // 3th nand
regulator_set_voltage(ldo,1800000,1800000);
+ regulator_set_suspend_voltage(ldo,1800000);
regulator_enable(ldo);
printk("%s set ldo1=%dmV end\n", __FUNCTION__, regulator_get_voltage(ldo));
regulator_put(ldo);
ldo = regulator_get(NULL, "ldo4"); // 4th usb
regulator_set_voltage(ldo,2500000,2500000);
+ regulator_set_suspend_voltage(ldo,0000000);
regulator_enable(ldo);
printk("%s set ldo4=%dmV end\n", __FUNCTION__, regulator_get_voltage(ldo));
regulator_put(ldo);
ldo = regulator_get(NULL, "ldo7"); // 5th usb
regulator_set_voltage(ldo,3300000,3300000);
+ regulator_set_suspend_voltage(ldo,3300000);
regulator_enable(ldo);
printk("%s set ldo7=%dmV end\n", __FUNCTION__, regulator_get_voltage(ldo));
regulator_put(ldo);
udelay(100);
dcdc = regulator_get(NULL, "dcdc4"); // backlight
- regulator_set_voltage(dcdc,20000000,20000000);
+ regulator_set_voltage(dcdc,20000000,20000000);
+ regulator_set_suspend_voltage(dcdc, 20000000);
regulator_enable(dcdc);
printk("%s set dcdc4=%dmV end\n", __FUNCTION__, regulator_get_voltage(dcdc));
regulator_put(dcdc);
ldo = regulator_get(NULL, "ldo2"); //lcd
regulator_set_voltage(ldo,3000000,3000000);
+ regulator_set_suspend_voltage(ldo,3000000);
regulator_enable(ldo);
printk("%s set ldo2=%dmV end\n", __FUNCTION__, regulator_get_voltage(ldo));
regulator_put(ldo);
- ldo = regulator_get(NULL, "ldo3"); //sram
- regulator_set_voltage(ldo,1800000,1800000);
- regulator_enable(ldo);
- printk("%s set ldo3=%dmV end\n", __FUNCTION__, regulator_get_voltage(ldo));
- regulator_put(ldo);
ldo = regulator_get(NULL, "ldo5"); //tf
regulator_set_voltage(ldo,3000000,3000000);
+ regulator_set_suspend_voltage(ldo,3000000);
regulator_enable(ldo);
printk("%s set ldo5=%dmV end\n", __FUNCTION__, regulator_get_voltage(ldo));
regulator_put(ldo);
ldo = regulator_get(NULL, "ldo6"); //camera
regulator_set_voltage(ldo,1800000,1800000);
+ regulator_set_suspend_voltage(ldo,1800000);
regulator_enable(ldo);
printk("%s set ldo6=%dmV end\n", __FUNCTION__, regulator_get_voltage(ldo));
regulator_put(ldo);
+
+
+#if 0
+ ldo = regulator_get(NULL, "ldo3"); //sram
+ regulator_set_voltage(ldo,1800000,1800000);
+ regulator_set_suspend_voltage(ldo,1800000);
+ regulator_enable(ldo);
+ printk("%s set ldo3=%dmV end\n", __FUNCTION__, regulator_get_voltage(ldo));
+ regulator_put(ldo);
+
+
ldo = regulator_get(NULL, "ldo8"); //cmmb
regulator_set_voltage(ldo,1200000,1200000);
+ regulator_set_suspend_voltage(ldo,1200000);
regulator_enable(ldo);
printk("%s set ldo8=%dmV end\n", __FUNCTION__, regulator_get_voltage(ldo));
regulator_put(ldo);
ldo = regulator_get(NULL, "ldo9"); //cmmb
regulator_set_voltage(ldo,3000000,3000000);
+ regulator_set_suspend_voltage(ldo,3000000);
regulator_enable(ldo);
printk("%s set ldo9=%dmV end\n", __FUNCTION__, regulator_get_voltage(ldo));
regulator_put(ldo);
-
+#endif
+
#endif
ldo = regulator_get(NULL, "ldo11");
int wm831x_last_deinit(struct wm831x *parm)
{
+ struct regulator* ldo;
+
printk("%s\n", __FUNCTION__);
+ ldo = regulator_get(NULL, "ldo1");
+ regulator_disable(ldo);
+ regulator_put(ldo);
+
+ ldo = regulator_get(NULL, "ldo2");
+ regulator_disable(ldo);
+ regulator_put(ldo);
+
+ ldo = regulator_get(NULL, "ldo3");
+ regulator_disable(ldo);
+ regulator_put(ldo);
+
+ ldo = regulator_get(NULL, "ldo4");
+ //regulator_disable(ldo);
+ regulator_put(ldo);
+
+ ldo = regulator_get(NULL, "ldo5");
+ regulator_disable(ldo);
+ regulator_put(ldo);
+
+ ldo = regulator_get(NULL, "ldo6");
+ regulator_disable(ldo);
+ regulator_put(ldo);
+
+ ldo = regulator_get(NULL, "ldo7");
+ regulator_disable(ldo);
+ regulator_put(ldo);
+
+ ldo = regulator_get(NULL, "ldo8");
+ //regulator_disable(ldo);
+ regulator_put(ldo);
+
+ ldo = regulator_get(NULL, "ldo9");
+ regulator_disable(ldo);
+ regulator_put(ldo);
+
+ ldo = regulator_get(NULL, "ldo10");
+ regulator_disable(ldo);
+ regulator_put(ldo);
+
return 0;
}
.off_mask = 1, /** Mask OFF while charging */
.trickle_ilim = 200, /** Trickle charge current limit, in mA */
.vsel = 4200, /** Target voltage, in mV */
- .eoc_iterm = 90, /** End of trickle charge current, in mA */
- .fast_ilim = 1000, /** Fast charge current limit, in mA */
- .timeout = 180, /** Charge cycle timeout, in minutes */
+ .eoc_iterm = 50, /** End of trickle charge current, in mA */
+ .fast_ilim = 500, /** Fast charge current limit, in mA */
+ .timeout = 480, /** Charge cycle timeout, in minutes */
.syslo = 3300, /* syslo threshold, in mV*/
.sysok = 3500, /* sysko threshold, in mV*/
};
.settinginfo=wm831x_gpio_settinginfo,
.settinginfolen=ARRAY_SIZE(wm831x_gpio_settinginfo),
.pin_type_init = wm831x_init_pin_type,
- .irq_base= NR_AIC_IRQS + 2*NUM_GROUP + TCA6424_TOTOL_GPIO_IRQ_NUM + CONFIG_SPI_FPGA_GPIO_IRQ_NUM,
+ .irq_base= NR_AIC_IRQS + 7*NUM_GROUP,
#endif
.backlight = &wm831x_backlight_platdata,
};
#endif
+#if defined(CONFIG_RK29_GPIO_SUSPEND)
+static void gpio_set_request(void)
+{
+ gpio_request(RK29_PIN6_PA0, NULL);
+ gpio_request(RK29_PIN6_PA1, NULL);
+ gpio_request(RK29_PIN6_PA2, NULL);
+ gpio_request(RK29_PIN6_PA3, NULL);
+ gpio_request(RK29_PIN6_PA4, NULL);
+ gpio_request(RK29_PIN6_PA5, NULL);
+ gpio_request(RK29_PIN6_PA6, NULL);
+
+ gpio_request(RK29_PIN2_PA5, NULL);
+ gpio_request(RK29_PIN2_PA4, NULL);
+ gpio_request(RK29_PIN2_PB0, NULL);
+ gpio_request(RK29_PIN2_PB1, NULL);
+ gpio_request(RK29_PIN2_PB2, NULL);
+ gpio_request(RK29_PIN2_PB3, NULL);
+
+ gpio_request(RK29_PIN1_PA4, NULL);
+ gpio_request(RK29_PIN1_PA3, NULL);
+
+ gpio_request(RK29_PIN2_PC7, NULL);
+ gpio_request(RK29_PIN2_PC6, NULL);
+ gpio_request(RK29_PIN2_PC5, NULL);
+ gpio_request(RK29_PIN2_PC4, NULL);
+ gpio_request(RK29_PIN2_PC3, NULL);
+ gpio_request(RK29_PIN2_PC2, NULL);
+ gpio_request(RK29_PIN2_PC1, NULL);
+ gpio_request(RK29_PIN2_PC0, NULL);
+}
+static void gpio_set_free(void)
+{
+ gpio_free(RK29_PIN6_PA0);
+ gpio_free(RK29_PIN6_PA1);
+ gpio_free(RK29_PIN6_PA2);
+ gpio_free(RK29_PIN6_PA3);
+ gpio_free(RK29_PIN6_PA4);
+ gpio_free(RK29_PIN6_PA5);
+ gpio_free(RK29_PIN6_PA6);
+
+ gpio_free(RK29_PIN2_PA5);
+ gpio_free(RK29_PIN2_PA4);
+ gpio_free(RK29_PIN2_PB0);
+ gpio_free(RK29_PIN2_PB1);
+ gpio_free(RK29_PIN2_PB2);
+ gpio_free(RK29_PIN2_PB3);
+
+ gpio_free(RK29_PIN1_PA4);
+ gpio_free(RK29_PIN1_PA3);
+
+ gpio_free(RK29_PIN2_PC7);
+ gpio_free(RK29_PIN2_PC6);
+ gpio_free(RK29_PIN2_PC5);
+ gpio_free(RK29_PIN2_PC4);
+ gpio_free(RK29_PIN2_PC3);
+ gpio_free(RK29_PIN2_PC2);
+ gpio_free(RK29_PIN2_PC1);
+ gpio_free(RK29_PIN2_PC0);
+}
+
+static void rk29_keygpio_suspend(void)
+{
+ gpio_pull_updown(RK29_PIN6_PA0, 0);
+ gpio_pull_updown(RK29_PIN6_PA1, 0);
+ gpio_pull_updown(RK29_PIN6_PA2, 0);
+ gpio_pull_updown(RK29_PIN6_PA3, 0);
+ gpio_pull_updown(RK29_PIN6_PA4, 0);
+ gpio_pull_updown(RK29_PIN6_PA5, 0);
+ gpio_pull_updown(RK29_PIN6_PA6, 0);//key pullup/pulldown disable
+
+ gpio_pull_updown(RK29_PIN2_PA4, 0);
+ gpio_pull_updown(RK29_PIN2_PA5, 0);
+ gpio_pull_updown(RK29_PIN2_PB0, 0);
+ gpio_pull_updown(RK29_PIN2_PB1, 0);
+ gpio_pull_updown(RK29_PIN2_PB2, 0);
+ gpio_pull_updown(RK29_PIN2_PB3, 0);
+}
+
+static void rk29_keygpio_resume(void)
+{
+ gpio_pull_updown(RK29_PIN6_PA0, 1);
+ gpio_pull_updown(RK29_PIN6_PA1, 1);
+ gpio_pull_updown(RK29_PIN6_PA2, 1);
+ gpio_pull_updown(RK29_PIN6_PA3, 1);
+ gpio_pull_updown(RK29_PIN6_PA4, 1);
+ gpio_pull_updown(RK29_PIN6_PA5, 1);
+ gpio_pull_updown(RK29_PIN6_PA6, 1);//key pullup/pulldown enable
+
+ gpio_pull_updown(RK29_PIN2_PA4, 1);
+ gpio_pull_updown(RK29_PIN2_PA5, 1);
+ gpio_pull_updown(RK29_PIN2_PB0, 1);
+ gpio_pull_updown(RK29_PIN2_PB1, 1);
+ gpio_pull_updown(RK29_PIN2_PB2, 1);
+ gpio_pull_updown(RK29_PIN2_PB3, 1);
+}
+
+static void spi_gpio_suspend(void)
+{
+ rk29_mux_api_set(GPIO1A4_EMMCWRITEPRT_SPI0CS1_NAME,GPIO1L_GPIO1A4); //set iomux is gpio mode
+ rk29_mux_api_set(GPIO1A3_EMMCDETECTN_SPI1CS1_NAME,GPIO1L_GPIO1A3);
+
+ rk29_mux_api_set(GPIO2C7_SPI1RXD_NAME,GPIO2H_GPIO2C7);
+ rk29_mux_api_set(GPIO2C6_SPI1TXD_NAME,GPIO2H_GPIO2C6);
+ //rk29_mux_api_set(GPIO2C5_SPI1CSN0_NAME,GPIO2H_GPIO2C5);
+ rk29_mux_api_set(GPIO2C4_SPI1CLK_NAME,GPIO2H_GPIO2C4);
+ rk29_mux_api_set(GPIO2C3_SPI0RXD_NAME,GPIO2H_GPIO2C3);
+ rk29_mux_api_set(GPIO2C2_SPI0TXD_NAME,GPIO2H_GPIO2C2);
+ rk29_mux_api_set(GPIO2C1_SPI0CSN0_NAME,GPIO2H_GPIO2C1);
+ rk29_mux_api_set(GPIO2C0_SPI0CLK_NAME,GPIO2H_GPIO2C0);
+
+ gpio_direction_input(RK29_PIN1_PA4); //set gpio is input
+ gpio_direction_input(RK29_PIN1_PA3);
+ gpio_direction_input(RK29_PIN2_PC7);
+ gpio_direction_input(RK29_PIN2_PC6);
+ // gpio_direction_input(RK29_PIN2_PC5);
+ gpio_direction_input(RK29_PIN2_PC4);
+ gpio_direction_input(RK29_PIN2_PC3);
+ gpio_direction_input(RK29_PIN2_PC2);
+ gpio_direction_input(RK29_PIN2_PC1);
+ gpio_direction_input(RK29_PIN2_PC0);
+
+ gpio_pull_updown(RK29_PIN1_PA4, 0); //set gpio pullup/down disable
+ gpio_pull_updown(RK29_PIN1_PA3, 0);
+
+ gpio_pull_updown(RK29_PIN2_PC7, 0);
+ gpio_pull_updown(RK29_PIN2_PC6, 0);
+ //gpio_pull_updown(RK29_PIN2_PC5, 0);
+ gpio_pull_updown(RK29_PIN2_PC4, 0);
+ gpio_pull_updown(RK29_PIN2_PC3, 0);
+ gpio_pull_updown(RK29_PIN2_PC2, 0);
+ gpio_pull_updown(RK29_PIN2_PC1, 0);
+ gpio_pull_updown(RK29_PIN2_PC0, 0);
+}
+
+static void spi_gpio_resume(void)
+{
+ gpio_pull_updown(RK29_PIN1_PA4, 1); //set gpio pullup/down enable
+ gpio_pull_updown(RK29_PIN1_PA3, 1);
+
+ gpio_pull_updown(RK29_PIN2_PC7, 1);
+ gpio_pull_updown(RK29_PIN2_PC6, 1);
+ //gpio_pull_updown(RK29_PIN2_PC5, 1);
+ gpio_pull_updown(RK29_PIN2_PC4, 1);
+ gpio_pull_updown(RK29_PIN2_PC3, 1);
+ gpio_pull_updown(RK29_PIN2_PC2, 1);
+ gpio_pull_updown(RK29_PIN2_PC1, 1);
+ gpio_pull_updown(RK29_PIN2_PC0, 1);
+
+ rk29_mux_api_set(GPIO1A4_EMMCWRITEPRT_SPI0CS1_NAME,GPIO1L_SPI0_CSN1); //set iomux is spi mode
+ rk29_mux_api_set(GPIO1A3_EMMCDETECTN_SPI1CS1_NAME,GPIO1L_SPI1_CSN1);
+
+ rk29_mux_api_set(GPIO2C7_SPI1RXD_NAME,GPIO2H_SPI1_RXD);
+ rk29_mux_api_set(GPIO2C6_SPI1TXD_NAME,GPIO2H_SPI1_TXD);
+ //rk29_mux_api_set(GPIO2C5_SPI1CSN0_NAME,GPIO2H_SPI1_CSN0);
+ rk29_mux_api_set(GPIO2C4_SPI1CLK_NAME, GPIO2H_SPI1_CLK);
+ rk29_mux_api_set(GPIO2C3_SPI0RXD_NAME,GPIO2H_SPI0_RXD);
+ rk29_mux_api_set(GPIO2C2_SPI0TXD_NAME,GPIO2H_SPI0_TXD);
+ rk29_mux_api_set(GPIO2C1_SPI0CSN0_NAME,GPIO2H_SPI0_CSN0);
+ rk29_mux_api_set(GPIO2C0_SPI0CLK_NAME,GPIO2H_SPI0_CLK);
+}
+
+void rk29_setgpio_suspend_board(void)
+{
+ gpio_set_request();
+ rk29_keygpio_suspend();
+ spi_gpio_suspend();
+ gpio_set_free();
+}
+
+void rk29_setgpio_resume_board(void)
+{
+ gpio_set_request();
+ rk29_keygpio_resume();
+ spi_gpio_resume();
+ gpio_set_free();
+}
+#endif
#if defined(CONFIG_RK29_GPS)
{
printk("%s \n", __FUNCTION__);
+ gpio_request(RK29_GPS_POWER_PIN, NULL);
gpio_direction_output(RK29_GPS_POWER_PIN, GPIO_LOW);
return 0;
* wm8994 codec
* author: qjb@rock-chips.com
*****************************************************************************************/
-//#if defined(CONFIG_MFD_WM8994)
-#if defined (CONFIG_REGULATOR_WM8994)
-static struct regulator_consumer_supply wm8994_ldo1_consumers[] = {
- {
- .supply = "DBVDD",
- },
- {
- .supply = "AVDD1",
- },
- {
- .supply = "CPVDD",
- },
- {
- .supply = "SPKVDD1",
- }
-};
-static struct regulator_consumer_supply wm8994_ldo2_consumers[] = {
- {
- .supply = "DCVDD",
- },
- {
- .supply = "AVDD2",
- },
- {
- .supply = "SPKVDD2",
- }
-};
-struct regulator_init_data regulator_init_data_ldo1 = {
- .constraints = {
- .name = "wm8994-ldo1",
- .min_uA = 00000,
- .max_uA = 18000,
- .always_on = true,
- .apply_uV = true,
- .valid_ops_mask = REGULATOR_CHANGE_STATUS | REGULATOR_CHANGE_CURRENT,
- },
- .num_consumer_supplies = ARRAY_SIZE(wm8994_ldo1_consumers),
- .consumer_supplies = wm8994_ldo1_consumers,
-};
-struct regulator_init_data regulator_init_data_ldo2 = {
- .constraints = {
- .name = "wm8994-ldo2",
- .min_uA = 00000,
- .max_uA = 18000,
- .always_on = true,
- .apply_uV = true,
- .valid_ops_mask = REGULATOR_CHANGE_STATUS | REGULATOR_CHANGE_CURRENT,
- },
- .num_consumer_supplies = ARRAY_SIZE(wm8994_ldo2_consumers),
- .consumer_supplies = wm8994_ldo2_consumers,
-};
-#endif
-struct wm8994_drc_cfg wm8994_drc_cfg_pdata = {
- .name = "wm8994_DRC",
- .regs = {0,0,0,0,0},
-};
-
-struct wm8994_retune_mobile_cfg wm8994_retune_mobile_cfg_pdata = {
- .name = "wm8994_EQ",
- .rate = 0,
- .regs = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,},
-};
-
struct wm8994_pdata wm8994_platdata = {
-#if defined (CONFIG_GPIO_WM8994)
- .gpio_base = WM8994_GPIO_EXPANDER_BASE,
- //Fill value to initialize the GPIO
- .gpio_defaults ={},
-#endif
- //enable=0 disable ldo
-#if defined (CONFIG_REGULATOR_WM8994)
- .ldo = {
- {
- .enable = 0,
- //RK29_PIN5_PA1
- .supply = NULL,
- .init_data = ®ulator_init_data_ldo1,
- },
- {
- .enable = 0,
- .supply = NULL,
- .init_data = ®ulator_init_data_ldo2,
- }
- },
-#endif
- //DRC 0--use default
- .num_drc_cfgs = 0,
- .drc_cfgs = &wm8994_drc_cfg_pdata,
- //EQ 0--use default
- .num_retune_mobile_cfgs = 0,
- .retune_mobile_cfgs = &wm8994_retune_mobile_cfg_pdata,
-
- .lineout1_diff = 1,
- .lineout2_diff = 1,
-
- .lineout1fb = 1,
- .lineout2fb = 1,
+
+ .BB_input_diff = 0,
+ .BB_class = NO_PCM_BB,
- .micbias1_lvl = 1,
- .micbias2_lvl = 1,
+ .no_earpiece = 0,
+ .sp_hp_same_channel = 0,
- .jd_scthr = 0,
- .jd_thr = 0,
-
- .PA_control =0,
+ .PA_control_pin = 0,
+ .Power_EN_Pin = RK29_PIN5_PA1,
.speaker_incall_vol = 0,
.speaker_incall_mic_vol = -9,
.earpiece_incall_vol = 0,
.headset_incall_vol = 6,
.headset_incall_mic_vol = -6,
- .headset_normal_vol = 6,
+ .headset_normal_vol = -6,
.BT_incall_vol = 0,
.BT_incall_mic_vol = 0,
- .recorder_vol = 50,
+ .recorder_vol = 30,
};
-//#endif
+
#ifdef CONFIG_RK_HEADSET_DET
#define HEADSET_GPIO RK29_PIN4_PD2
-struct rk2818_headset_data rk2818_headset_info = {
- .gpio = HEADSET_GPIO,
- .irq_type = IRQF_TRIGGER_RISING,//IRQF_TRIGGER_RISING -- ?????? IRQF_TRIGGER_FALLING -- ?½???
+struct rk_headset_pdata rk_headset_info = {
+ .Headset_gpio = RK29_PIN4_PD2,
.headset_in_type= HEADSET_IN_HIGH,
+ .Hook_gpio = RK29_PIN4_PD1,//Detection Headset--Must be set
+ .hook_key_code = KEY_MEDIA,
};
-struct platform_device rk28_device_headset = {
- .name = "rk2818_headsetdet",
+struct platform_device rk_device_headset = {
+ .name = "rk_headsetdet",
.id = 0,
.dev = {
- .platform_data = &rk2818_headset_info,
+ .platform_data = &rk_headset_info,
}
};
#endif
*****************************************************************************************/
static int rk29_i2c0_io_init(void)
{
+#ifdef CONFIG_RK29_I2C0_CONTROLLER
rk29_mux_api_set(GPIO2B7_I2C0SCL_NAME, GPIO2L_I2C0_SCL);
rk29_mux_api_set(GPIO2B6_I2C0SDA_NAME, GPIO2L_I2C0_SDA);
+#else
+ rk29_mux_api_set(GPIO2B7_I2C0SCL_NAME, GPIO2L_GPIO2B7);
+ rk29_mux_api_set(GPIO2B6_I2C0SDA_NAME, GPIO2L_GPIO2B6);
+#endif
return 0;
}
static int rk29_i2c1_io_init(void)
{
+#ifdef CONFIG_RK29_I2C1_CONTROLLER
rk29_mux_api_set(GPIO1A7_I2C1SCL_NAME, GPIO1L_I2C1_SCL);
rk29_mux_api_set(GPIO1A6_I2C1SDA_NAME, GPIO1L_I2C1_SDA);
+#else
+ rk29_mux_api_set(GPIO1A7_I2C1SCL_NAME, GPIO1L_GPIO1A7);
+ rk29_mux_api_set(GPIO1A6_I2C1SDA_NAME, GPIO1L_GPIO1A6);
+#endif
return 0;
}
static int rk29_i2c2_io_init(void)
{
+#ifdef CONFIG_RK29_I2C2_CONTROLLER
rk29_mux_api_set(GPIO5D4_I2C2SCL_NAME, GPIO5H_I2C2_SCL);
rk29_mux_api_set(GPIO5D3_I2C2SDA_NAME, GPIO5H_I2C2_SDA);
+#else
+ rk29_mux_api_set(GPIO5D4_I2C2SCL_NAME, GPIO5H_GPIO5D4);
+ rk29_mux_api_set(GPIO5D3_I2C2SDA_NAME, GPIO5H_GPIO5D3);
+#endif
return 0;
}
static int rk29_i2c3_io_init(void)
{
+#ifdef CONFIG_RK29_I2C3_CONTROLLER
rk29_mux_api_set(GPIO2B5_UART3RTSN_I2C3SCL_NAME, GPIO2L_I2C3_SCL);
rk29_mux_api_set(GPIO2B4_UART3CTSN_I2C3SDA_NAME, GPIO2L_I2C3_SDA);
+#else
+ rk29_mux_api_set(GPIO2B5_UART3RTSN_I2C3SCL_NAME, GPIO2L_GPIO2B5);
+ rk29_mux_api_set(GPIO2B4_UART3CTSN_I2C3SDA_NAME, GPIO2L_GPIO2B4);
+#endif
return 0;
}
-
+#ifdef CONFIG_RK29_I2C0_CONTROLLER
struct rk29_i2c_platform_data default_i2c0_data = {
.bus_num = 0,
.flags = 0,
.mode = I2C_MODE_IRQ,
.io_init = rk29_i2c0_io_init,
};
-
+#else
+struct i2c_gpio_platform_data default_i2c0_data = {
+ .sda_pin = RK29_PIN2_PB6,
+ .scl_pin = RK29_PIN2_PB7,
+ .udelay = 5, // clk = 500/udelay = 100Khz
+ .timeout = 100,//msecs_to_jiffies(200),
+ .bus_num = 0,
+ .io_init = rk29_i2c0_io_init,
+};
+#endif
+#ifdef CONFIG_RK29_I2C1_CONTROLLER
struct rk29_i2c_platform_data default_i2c1_data = {
.bus_num = 1,
.flags = 0,
.mode = I2C_MODE_IRQ,
.io_init = rk29_i2c1_io_init,
};
-
+#else
+struct i2c_gpio_platform_data default_i2c1_data = {
+ .sda_pin = RK29_PIN1_PA6,
+ .scl_pin = RK29_PIN1_PA7,
+ .udelay = 5, // clk = 500/udelay = 100Khz
+ .timeout = 100,//msecs_to_jiffies(200),
+ .bus_num = 1,
+ .io_init = rk29_i2c1_io_init,
+};
+#endif
+#ifdef CONFIG_RK29_I2C2_CONTROLLER
struct rk29_i2c_platform_data default_i2c2_data = {
.bus_num = 2,
.flags = 0,
.mode = I2C_MODE_IRQ,
.io_init = rk29_i2c2_io_init,
};
-
+#else
+struct i2c_gpio_platform_data default_i2c2_data = {
+ .sda_pin = RK29_PIN5_PD3,
+ .scl_pin = RK29_PIN5_PD4,
+ .udelay = 5, // clk = 500/udelay = 100Khz
+ .timeout = 100,//msecs_to_jiffies(200),
+ .bus_num = 2,
+ .io_init = rk29_i2c2_io_init,
+};
+#endif
+#ifdef CONFIG_RK29_I2C3_CONTROLLER
struct rk29_i2c_platform_data default_i2c3_data = {
.bus_num = 3,
.flags = 0,
.mode = I2C_MODE_IRQ,
.io_init = rk29_i2c3_io_init,
};
+#else
+struct i2c_gpio_platform_data default_i2c3_data = {
+ .sda_pin = RK29_PIN5_PB5,
+ .scl_pin = RK29_PIN5_PB4,
+ .udelay = 5, // clk = 500/udelay = 100Khz
+ .timeout = 100,//msecs_to_jiffies(200),
+ .bus_num = 3,
+ .io_init = rk29_i2c3_io_init,
+};
+#endif
+#if defined (CONFIG_ANX7150)
+struct hdmi_platform_data anx7150_data = {
+ //.io_init = anx7150_io_init,
+};
+#endif
#ifdef CONFIG_I2C0_RK29
static struct i2c_board_info __initdata board_i2c0_devices[] = {
#if defined (CONFIG_RK1000_CONTROL)
.addr = 0x39, //0x39, 0x3d
.flags = 0,
.irq = RK29_PIN2_PA3,
+ .platform_data = &anx7150_data,
},
#endif
#if defined (CONFIG_GS_L3G4200D)
.platform_data = &l3g4200d_info,
},
#endif
+#if defined (CONFIG_MPU_SENSORS_MPU3050)
+ {
+ .type = "mpu3050",
+ .addr = 0x68,
+ .flags = 0,
+ .irq = RK29_PIN4_PC4,
+ .platform_data = &mpu3050_data,
+ },
+#endif
};
#endif
.platform_data = >801_info,
},
#endif
+
+#if defined (CONFIG_TOUCHSCREEN_GT818_IIC)
+{
+ .type = "gt818_ts",
+ .addr = 0x5d,
+ .flags = 0,
+ .irq = RK29_PIN4_PD5,
+ .platform_data = >818_info,
+},
+#endif
+
+#if defined (CONFIG_TOUCHSCREEN_ILI2102_IIC)
+{
+ .type = "ili2102_ts",
+ .addr = 0x41,
+ .flags = I2C_M_NEED_DELAY,
+ .udelay = 600,
+ .irq = RK29_PIN4_PD5,
+ .platform_data = &ili2102_info,
+},
+#endif
+
#if defined (CONFIG_MFD_WM831X_I2C)
{
.type = "wm8310",
* camera devices
* author: ddl@rock-chips.com
*****************************************************************************************/
-#ifdef CONFIG_VIDEO_RK29
-#define SENSOR_NAME_0 RK29_CAM_SENSOR_NAME_OV5642 /* back camera sensor */
-#define SENSOR_IIC_ADDR_0 0x78
-#define SENSOR_IIC_ADAPTER_ID_0 1
-#define SENSOR_POWER_PIN_0 INVALID_GPIO
-#define SENSOR_RESET_PIN_0 INVALID_GPIO
-#define SENSOR_POWERDN_PIN_0 RK29_PIN6_PB7
-#define SENSOR_FALSH_PIN_0 INVALID_GPIO
-#define SENSOR_POWERACTIVE_LEVEL_0 RK29_CAM_POWERACTIVE_L
-#define SENSOR_RESETACTIVE_LEVEL_0 RK29_CAM_RESETACTIVE_L
-#define SENSOR_POWERDNACTIVE_LEVEL_0 RK29_CAM_POWERDNACTIVE_H
-#define SENSOR_FLASHACTIVE_LEVEL_0 RK29_CAM_FLASHACTIVE_L
-
-#define SENSOR_NAME_1 RK29_CAM_SENSOR_NAME_OV2659 /* front camera sensor */
-#define SENSOR_IIC_ADDR_1 0x60
-#define SENSOR_IIC_ADAPTER_ID_1 1
-#define SENSOR_POWER_PIN_1 INVALID_GPIO
-#define SENSOR_RESET_PIN_1 INVALID_GPIO
-#define SENSOR_POWERDN_PIN_1 RK29_PIN5_PD7
-#define SENSOR_FALSH_PIN_1 INVALID_GPIO
-#define SENSOR_POWERACTIVE_LEVEL_1 RK29_CAM_POWERACTIVE_L
-#define SENSOR_RESETACTIVE_LEVEL_1 RK29_CAM_RESETACTIVE_L
-#define SENSOR_POWERDNACTIVE_LEVEL_1 RK29_CAM_POWERDNACTIVE_H
-#define SENSOR_FLASHACTIVE_LEVEL_1 RK29_CAM_FLASHACTIVE_L
-
-static int rk29_sensor_io_init(void);
-static int rk29_sensor_io_deinit(int sensor);
-static int rk29_sensor_ioctrl(struct device *dev,enum rk29camera_ioctrl_cmd cmd,int on);
-
-static struct rk29camera_platform_data rk29_camera_platform_data = {
- .io_init = rk29_sensor_io_init,
- .io_deinit = rk29_sensor_io_deinit,
- .sensor_ioctrl = rk29_sensor_ioctrl,
- .gpio_res = {
- {
- .gpio_reset = SENSOR_RESET_PIN_0,
- .gpio_power = SENSOR_POWER_PIN_0,
- .gpio_powerdown = SENSOR_POWERDN_PIN_0,
- .gpio_flash = SENSOR_FALSH_PIN_0,
- .gpio_flag = (SENSOR_POWERACTIVE_LEVEL_0|SENSOR_RESETACTIVE_LEVEL_0|SENSOR_POWERDNACTIVE_LEVEL_0|SENSOR_FLASHACTIVE_LEVEL_0),
- .gpio_init = 0,
- .dev_name = SENSOR_NAME_0,
- }, {
- .gpio_reset = SENSOR_RESET_PIN_1,
- .gpio_power = SENSOR_POWER_PIN_1,
- .gpio_powerdown = SENSOR_POWERDN_PIN_1,
- .gpio_flash = SENSOR_FALSH_PIN_1,
- .gpio_flag = (SENSOR_POWERACTIVE_LEVEL_1|SENSOR_RESETACTIVE_LEVEL_1|SENSOR_POWERDNACTIVE_LEVEL_1|SENSOR_FLASHACTIVE_LEVEL_1),
- .gpio_init = 0,
- .dev_name = SENSOR_NAME_1,
- }
- },
- #ifdef CONFIG_VIDEO_RK29_WORK_IPP
- .meminfo = {
- .name = "camera_ipp_mem",
- .start = MEM_CAMIPP_BASE,
- .size = MEM_CAMIPP_SIZE,
- }
- #endif
-};
+#ifdef CONFIG_VIDEO_RK29
+#define CONFIG_SENSOR_POWER_IOCTL_USR 0
+#define CONFIG_SENSOR_RESET_IOCTL_USR 0
+#define CONFIG_SENSOR_POWERDOWN_IOCTL_USR 0
+#define CONFIG_SENSOR_FLASH_IOCTL_USR 0
-static int rk29_sensor_io_init(void)
+#if CONFIG_SENSOR_POWER_IOCTL_USR
+static int sensor_power_usr_cb (struct rk29camera_gpio_res *res,int on)
{
- int ret = 0, i;
- unsigned int camera_reset = INVALID_GPIO, camera_power = INVALID_GPIO;
- unsigned int camera_powerdown = INVALID_GPIO, camera_flash = INVALID_GPIO;
- unsigned int camera_ioflag;
-
- for (i=0; i<2; i++) {
- camera_reset = rk29_camera_platform_data.gpio_res[i].gpio_reset;
- camera_power = rk29_camera_platform_data.gpio_res[i].gpio_power;
- camera_powerdown = rk29_camera_platform_data.gpio_res[i].gpio_powerdown;
- camera_flash = rk29_camera_platform_data.gpio_res[i].gpio_flash;
- camera_ioflag = rk29_camera_platform_data.gpio_res[i].gpio_flag;
- rk29_camera_platform_data.gpio_res[i].gpio_init = 0;
-
- if (camera_power != INVALID_GPIO) {
- ret = gpio_request(camera_power, "camera power");
- if (ret)
- goto sensor_io_int_loop_end;
- rk29_camera_platform_data.gpio_res[i].gpio_init |= RK29_CAM_POWERACTIVE_MASK;
- gpio_set_value(camera_reset, (((~camera_ioflag)&RK29_CAM_POWERACTIVE_MASK)>>RK29_CAM_POWERACTIVE_BITPOS));
- gpio_direction_output(camera_power, (((~camera_ioflag)&RK29_CAM_POWERACTIVE_MASK)>>RK29_CAM_POWERACTIVE_BITPOS));
-
- //printk("\n%s....power pin(%d) init success(0x%x) \n",__FUNCTION__,camera_power,(((~camera_ioflag)&RK29_CAM_POWERACTIVE_MASK)>>RK29_CAM_POWERACTIVE_BITPOS));
-
- }
-
- if (camera_reset != INVALID_GPIO) {
- ret = gpio_request(camera_reset, "camera reset");
- if (ret)
- goto sensor_io_int_loop_end;
- rk29_camera_platform_data.gpio_res[i].gpio_init |= RK29_CAM_RESETACTIVE_MASK;
- gpio_set_value(camera_reset, ((camera_ioflag&RK29_CAM_RESETACTIVE_MASK)>>RK29_CAM_RESETACTIVE_BITPOS));
- gpio_direction_output(camera_reset, ((camera_ioflag&RK29_CAM_RESETACTIVE_MASK)>>RK29_CAM_RESETACTIVE_BITPOS));
-
- //printk("\n%s....reset pin(%d) init success(0x%x)\n",__FUNCTION__,camera_reset,((camera_ioflag&RK29_CAM_RESETACTIVE_MASK)>>RK29_CAM_RESETACTIVE_BITPOS));
-
- }
-
- if (camera_powerdown != INVALID_GPIO) {
- ret = gpio_request(camera_powerdown, "camera powerdown");
- if (ret)
- goto sensor_io_int_loop_end;
- rk29_camera_platform_data.gpio_res[i].gpio_init |= RK29_CAM_POWERDNACTIVE_MASK;
- gpio_set_value(camera_powerdown, ((camera_ioflag&RK29_CAM_POWERDNACTIVE_MASK)>>RK29_CAM_POWERDNACTIVE_BITPOS));
- gpio_direction_output(camera_powerdown, ((camera_ioflag&RK29_CAM_POWERDNACTIVE_MASK)>>RK29_CAM_POWERDNACTIVE_BITPOS));
-
- //printk("\n%s....powerdown pin(%d) init success(0x%x) \n",__FUNCTION__,camera_powerdown,((camera_ioflag&RK29_CAM_POWERDNACTIVE_BITPOS)>>RK29_CAM_POWERDNACTIVE_BITPOS));
-
- }
-
- if (camera_flash != INVALID_GPIO) {
- ret = gpio_request(camera_flash, "camera flash");
- if (ret)
- goto sensor_io_int_loop_end;
- rk29_camera_platform_data.gpio_res[i].gpio_init |= RK29_CAM_FLASHACTIVE_MASK;
- gpio_set_value(camera_flash, ((camera_ioflag&RK29_CAM_FLASHACTIVE_MASK)>>RK29_CAM_FLASHACTIVE_BITPOS));
- gpio_direction_output(camera_flash, ((camera_ioflag&RK29_CAM_FLASHACTIVE_MASK)>>RK29_CAM_FLASHACTIVE_BITPOS));
-
- //printk("\n%s....flash pin(%d) init success(0x%x) \n",__FUNCTION__,camera_flash,((camera_ioflag&RK29_CAM_FLASHACTIVE_MASK)>>RK29_CAM_FLASHACTIVE_BITPOS));
-
- }
- continue;
-sensor_io_int_loop_end:
- rk29_sensor_io_deinit(i);
- continue;
- }
-
- return 0;
+ #error "CONFIG_SENSOR_POWER_IOCTL_USR is 1, sensor_power_usr_cb function must be writed!!";
}
+#endif
-static int rk29_sensor_io_deinit(int sensor)
+#if CONFIG_SENSOR_RESET_IOCTL_USR
+static int sensor_reset_usr_cb (struct rk29camera_gpio_res *res,int on)
{
- unsigned int camera_reset = INVALID_GPIO, camera_power = INVALID_GPIO;
- unsigned int camera_powerdown = INVALID_GPIO, camera_flash = INVALID_GPIO;
-
- camera_reset = rk29_camera_platform_data.gpio_res[sensor].gpio_reset;
- camera_power = rk29_camera_platform_data.gpio_res[sensor].gpio_power;
- camera_powerdown = rk29_camera_platform_data.gpio_res[sensor].gpio_powerdown;
- camera_flash = rk29_camera_platform_data.gpio_res[sensor].gpio_flash;
-
- if (rk29_camera_platform_data.gpio_res[sensor].gpio_init & RK29_CAM_POWERACTIVE_MASK) {
- if (camera_power != INVALID_GPIO) {
- gpio_direction_input(camera_power);
- gpio_free(camera_power);
- }
- }
-
- if (rk29_camera_platform_data.gpio_res[sensor].gpio_init & RK29_CAM_RESETACTIVE_MASK) {
- if (camera_reset != INVALID_GPIO) {
- gpio_direction_input(camera_reset);
- gpio_free(camera_reset);
- }
- }
-
- if (rk29_camera_platform_data.gpio_res[sensor].gpio_init & RK29_CAM_POWERDNACTIVE_MASK) {
- if (camera_powerdown != INVALID_GPIO) {
- gpio_direction_input(camera_powerdown);
- gpio_free(camera_powerdown);
- }
- }
-
- if (rk29_camera_platform_data.gpio_res[sensor].gpio_init & RK29_CAM_FLASHACTIVE_MASK) {
- if (camera_flash != INVALID_GPIO) {
- gpio_direction_input(camera_flash);
- gpio_free(camera_flash);
- }
- }
-
- rk29_camera_platform_data.gpio_res[sensor].gpio_init = 0;
- return 0;
+ #error "CONFIG_SENSOR_RESET_IOCTL_USR is 1, sensor_reset_usr_cb function must be writed!!";
}
-static int rk29_sensor_ioctrl(struct device *dev,enum rk29camera_ioctrl_cmd cmd, int on)
-{
- unsigned int camera_power=INVALID_GPIO,camera_reset=INVALID_GPIO, camera_powerdown=INVALID_GPIO,camera_flash = INVALID_GPIO;
- unsigned int camera_ioflag,camera_io_init;
- int ret = RK29_CAM_IO_SUCCESS;
-
- if(rk29_camera_platform_data.gpio_res[0].dev_name && (strcmp(rk29_camera_platform_data.gpio_res[0].dev_name, dev_name(dev)) == 0)) {
- camera_power = rk29_camera_platform_data.gpio_res[0].gpio_power;
- camera_reset = rk29_camera_platform_data.gpio_res[0].gpio_reset;
- camera_powerdown = rk29_camera_platform_data.gpio_res[0].gpio_powerdown;
- camera_flash = rk29_camera_platform_data.gpio_res[0].gpio_flash;
- camera_ioflag = rk29_camera_platform_data.gpio_res[0].gpio_flag;
- camera_io_init = rk29_camera_platform_data.gpio_res[0].gpio_init;
- } else if (rk29_camera_platform_data.gpio_res[1].dev_name && (strcmp(rk29_camera_platform_data.gpio_res[1].dev_name, dev_name(dev)) == 0)) {
- camera_power = rk29_camera_platform_data.gpio_res[1].gpio_power;
- camera_reset = rk29_camera_platform_data.gpio_res[1].gpio_reset;
- camera_powerdown = rk29_camera_platform_data.gpio_res[1].gpio_powerdown;
- camera_flash = rk29_camera_platform_data.gpio_res[1].gpio_flash;
- camera_ioflag = rk29_camera_platform_data.gpio_res[1].gpio_flag;
- camera_io_init = rk29_camera_platform_data.gpio_res[1].gpio_init;
- }
-
- switch (cmd)
- {
- case Cam_Power:
- {
- if (camera_power != INVALID_GPIO) {
- if (camera_io_init & RK29_CAM_POWERACTIVE_MASK) {
- if (on) {
- gpio_set_value(camera_power, ((camera_ioflag&RK29_CAM_POWERACTIVE_MASK)>>RK29_CAM_POWERACTIVE_BITPOS));
- //printk("\n%s..%s..PowerPin=%d ..PinLevel = %x \n",__FUNCTION__,dev_name(dev), camera_power, ((camera_ioflag&RK29_CAM_POWERACTIVE_MASK)>>RK29_CAM_POWERACTIVE_BITPOS));
- msleep(10);
- } else {
- gpio_set_value(camera_power, (((~camera_ioflag)&RK29_CAM_POWERACTIVE_MASK)>>RK29_CAM_POWERACTIVE_BITPOS));
- //printk("\n%s..%s..PowerPin=%d ..PinLevel = %x \n",__FUNCTION__,dev_name(dev), camera_power, (((~camera_ioflag)&RK29_CAM_POWERACTIVE_MASK)>>RK29_CAM_POWERACTIVE_BITPOS));
- }
- } else {
- ret = RK29_CAM_EIO_REQUESTFAIL;
- printk("\n%s..%s..PowerPin=%d request failed!\n",__FUNCTION__,dev_name(dev),camera_reset);
- }
- } else {
- ret = RK29_CAM_EIO_INVALID;
- }
- break;
- }
- case Cam_Reset:
- {
- if (camera_reset != INVALID_GPIO) {
- if (camera_io_init & RK29_CAM_RESETACTIVE_MASK) {
- if (on) {
- gpio_set_value(camera_reset, ((camera_ioflag&RK29_CAM_RESETACTIVE_MASK)>>RK29_CAM_RESETACTIVE_BITPOS));
- //printk("\n%s..%s..ResetPin=%d ..PinLevel = %x \n",__FUNCTION__,dev_name(dev),camera_reset, ((camera_ioflag&RK29_CAM_RESETACTIVE_MASK)>>RK29_CAM_RESETACTIVE_BITPOS));
- } else {
- gpio_set_value(camera_reset,(((~camera_ioflag)&RK29_CAM_RESETACTIVE_MASK)>>RK29_CAM_RESETACTIVE_BITPOS));
- //printk("\n%s..%s..ResetPin= %d..PinLevel = %x \n",__FUNCTION__,dev_name(dev), camera_reset, (((~camera_ioflag)&RK29_CAM_RESETACTIVE_MASK)>>RK29_CAM_RESETACTIVE_BITPOS));
- }
- } else {
- ret = RK29_CAM_EIO_REQUESTFAIL;
- printk("\n%s..%s..ResetPin=%d request failed!\n",__FUNCTION__,dev_name(dev),camera_reset);
- }
- } else {
- ret = RK29_CAM_EIO_INVALID;
- }
- break;
- }
-
- case Cam_PowerDown:
- {
- if (camera_powerdown != INVALID_GPIO) {
- if (camera_io_init & RK29_CAM_POWERDNACTIVE_MASK) {
- if (on) {
- gpio_set_value(camera_powerdown, ((camera_ioflag&RK29_CAM_POWERDNACTIVE_MASK)>>RK29_CAM_POWERDNACTIVE_BITPOS));
- //printk("\n%s..%s..PowerDownPin=%d ..PinLevel = %x \n",__FUNCTION__,dev_name(dev),camera_powerdown, ((camera_ioflag&RK29_CAM_POWERDNACTIVE_MASK)>>RK29_CAM_POWERDNACTIVE_BITPOS));
- } else {
- gpio_set_value(camera_powerdown,(((~camera_ioflag)&RK29_CAM_POWERDNACTIVE_MASK)>>RK29_CAM_POWERDNACTIVE_BITPOS));
- //printk("\n%s..%s..PowerDownPin= %d..PinLevel = %x \n",__FUNCTION__,dev_name(dev), camera_powerdown, (((~camera_ioflag)&RK29_CAM_POWERDNACTIVE_MASK)>>RK29_CAM_POWERDNACTIVE_BITPOS));
- }
- } else {
- ret = RK29_CAM_EIO_REQUESTFAIL;
- printk("\n%s..%s..PowerDownPin=%d request failed!\n",__FUNCTION__,dev_name(dev),camera_powerdown);
- }
- } else {
- ret = RK29_CAM_EIO_INVALID;
- }
- break;
- }
-
- case Cam_Flash:
- {
- if (camera_flash != INVALID_GPIO) {
- if (camera_io_init & RK29_CAM_FLASHACTIVE_MASK) {
- switch (on)
- {
- case Flash_Off:
- {
- gpio_set_value(camera_flash,(((~camera_ioflag)&RK29_CAM_FLASHACTIVE_MASK)>>RK29_CAM_FLASHACTIVE_BITPOS));
- //printk("\n%s..%s..FlashPin= %d..PinLevel = %x \n",__FUNCTION__,dev_name(dev), camera_flash, (((~camera_ioflag)&RK29_CAM_FLASHACTIVE_MASK)>>RK29_CAM_FLASHACTIVE_BITPOS));
- break;
- }
-
- case Flash_On:
- {
- gpio_set_value(camera_flash, ((camera_ioflag&RK29_CAM_FLASHACTIVE_MASK)>>RK29_CAM_FLASHACTIVE_BITPOS));
- //printk("\n%s..%s..FlashPin=%d ..PinLevel = %x \n",__FUNCTION__,dev_name(dev),camera_flash, ((camera_ioflag&RK29_CAM_FLASHACTIVE_MASK)>>RK29_CAM_FLASHACTIVE_BITPOS));
- break;
- }
-
- case Flash_Torch:
- {
- gpio_set_value(camera_flash, ((camera_ioflag&RK29_CAM_FLASHACTIVE_MASK)>>RK29_CAM_FLASHACTIVE_BITPOS));
- //printk("\n%s..%s..FlashPin=%d ..PinLevel = %x \n",__FUNCTION__,dev_name(dev),camera_flash, ((camera_ioflag&RK29_CAM_FLASHACTIVE_MASK)>>RK29_CAM_FLASHACTIVE_BITPOS));
- break;
- }
-
- default:
- {
- printk("\n%s..%s..Flash command(%d) is invalidate \n",__FUNCTION__,dev_name(dev),on);
- break;
- }
- }
- } else {
- ret = RK29_CAM_EIO_REQUESTFAIL;
- printk("\n%s..%s..FlashPin=%d request failed!\n",__FUNCTION__,dev_name(dev),camera_flash);
- }
- } else {
- ret = RK29_CAM_EIO_INVALID;
- }
- break;
- }
+#endif
- default:
- {
- printk("%s cmd(0x%x) is unknown!\n",__FUNCTION__, cmd);
- break;
- }
- }
- return ret;
-}
-static int rk29_sensor_power(struct device *dev, int on)
+#if CONFIG_SENSOR_POWERDOWN_IOCTL_USR
+static int sensor_powerdown_usr_cb (struct rk29camera_gpio_res *res,int on)
{
- rk29_sensor_ioctrl(dev,Cam_Power,on);
- return 0;
+ #error "CONFIG_SENSOR_POWERDOWN_IOCTL_USR is 1, sensor_powerdown_usr_cb function must be writed!!";
}
-static int rk29_sensor_reset(struct device *dev)
-{
- rk29_sensor_ioctrl(dev,Cam_Reset,1);
- msleep(2);
- rk29_sensor_ioctrl(dev,Cam_Reset,0);
- return 0;
-}
-static int rk29_sensor_powerdown(struct device *dev, int on)
+#endif
+
+#if CONFIG_SENSOR_FLASH_IOCTL_USR
+static int sensor_flash_usr_cb (struct rk29camera_gpio_res *res,int on)
{
- return rk29_sensor_ioctrl(dev,Cam_PowerDown,on);
+ #error "CONFIG_SENSOR_FLASH_IOCTL_USR is 1, sensor_flash_usr_cb function must be writed!!";
}
-#if (SENSOR_IIC_ADDR_0 != 0x00)
-static struct i2c_board_info rk29_i2c_cam_info_0[] = {
- {
- I2C_BOARD_INFO(SENSOR_NAME_0, SENSOR_IIC_ADDR_0>>1)
- },
-};
-
-static struct soc_camera_link rk29_iclink_0 = {
- .bus_id = RK29_CAM_PLATFORM_DEV_ID,
- .power = rk29_sensor_power,
- .powerdown = rk29_sensor_powerdown,
- .board_info = &rk29_i2c_cam_info_0[0],
- .i2c_adapter_id = SENSOR_IIC_ADAPTER_ID_0,
- .module_name = SENSOR_NAME_0,
-};
-
-/*platform_device : soc-camera need */
-static struct platform_device rk29_soc_camera_pdrv_0 = {
- .name = "soc-camera-pdrv",
- .id = 0,
- .dev = {
- .init_name = SENSOR_NAME_0,
- .platform_data = &rk29_iclink_0,
- },
-};
#endif
-static struct i2c_board_info rk29_i2c_cam_info_1[] = {
- {
- I2C_BOARD_INFO(SENSOR_NAME_1, SENSOR_IIC_ADDR_1>>1)
- },
-};
-static struct soc_camera_link rk29_iclink_1 = {
- .bus_id = RK29_CAM_PLATFORM_DEV_ID,
- .power = rk29_sensor_power,
- .powerdown = rk29_sensor_powerdown,
- .board_info = &rk29_i2c_cam_info_1[0],
- .i2c_adapter_id = SENSOR_IIC_ADAPTER_ID_1,
- .module_name = SENSOR_NAME_1,
-};
-
-/*platform_device : soc-camera need */
-static struct platform_device rk29_soc_camera_pdrv_1 = {
- .name = "soc-camera-pdrv",
- .id = 1,
- .dev = {
- .init_name = SENSOR_NAME_1,
- .platform_data = &rk29_iclink_1,
- },
-};
+static struct rk29camera_platform_ioctl_cb sensor_ioctl_cb = {
+ #if CONFIG_SENSOR_POWER_IOCTL_USR
+ .sensor_power_cb = sensor_power_usr_cb,
+ #else
+ .sensor_power_cb = NULL,
+ #endif
+ #if CONFIG_SENSOR_RESET_IOCTL_USR
+ .sensor_reset_cb = sensor_reset_usr_cb,
+ #else
+ .sensor_reset_cb = NULL,
+ #endif
-static u64 rockchip_device_camera_dmamask = 0xffffffffUL;
-static struct resource rk29_camera_resource[] = {
- [0] = {
- .start = RK29_VIP_PHYS,
- .end = RK29_VIP_PHYS + RK29_VIP_SIZE - 1,
- .flags = IORESOURCE_MEM,
- },
- [1] = {
- .start = IRQ_VIP,
- .end = IRQ_VIP,
- .flags = IORESOURCE_IRQ,
- }
-};
+ #if CONFIG_SENSOR_POWERDOWN_IOCTL_USR
+ .sensor_powerdown_cb = sensor_powerdown_usr_cb,
+ #else
+ .sensor_powerdown_cb = NULL,
+ #endif
-/*platform_device : */
-static struct platform_device rk29_device_camera = {
- .name = RK29_CAM_DRV_NAME,
- .id = RK29_CAM_PLATFORM_DEV_ID, /* This is used to put cameras on this interface */
- .num_resources = ARRAY_SIZE(rk29_camera_resource),
- .resource = rk29_camera_resource,
- .dev = {
- .dma_mask = &rockchip_device_camera_dmamask,
- .coherent_dma_mask = 0xffffffffUL,
- .platform_data = &rk29_camera_platform_data,
- }
+ #if CONFIG_SENSOR_FLASH_IOCTL_USR
+ .sensor_flash_cb = sensor_flash_usr_cb,
+ #else
+ .sensor_flash_cb = NULL,
+ #endif
};
+#include "../../../drivers/media/video/rk29_camera.c"
#endif
+
/*****************************************************************************************
* backlight devices
* author: nzy@rock-chips.com
.bp_power_active_low = 0,
.bp_reset = RK29_PIN0_PA1,
.bp_reset_active_low = 1,
- .bp_statue = RK29_PIN0_PA3,//input high bp sleep;
- .ap_statue = RK29_PIN0_PA2,//output high ap sleep;
- .ap_bp_wakeup = RK29_PIN0_PA4, //output AP wake up BP used rising edge;
- //.bp_ap_wakeup = RK2818_PIN_PE0,//input BP wake up AP
+ .bp_statue = RK29_PIN0_PA2,//input high bp sleep;
+ .ap_statue = RK29_PIN0_PA4,//output high ap sleep;
+ .ap_bp_wakeup = RK29_PIN0_PA3, //output AP wake up BP used rising edge;
+ .bp_ap_wakeup = 0,//input BP wake up AP
};
struct platform_device rk2818_device_mtk23d = {
.name = "mtk23d",
rk29_mux_api_set(GPIO1D3_SDMMC0DATA1_NAME, GPIO1H_SDMMC0_DATA1);
rk29_mux_api_set(GPIO1D4_SDMMC0DATA2_NAME, GPIO1H_SDMMC0_DATA2);
rk29_mux_api_set(GPIO1D5_SDMMC0DATA3_NAME, GPIO1H_SDMMC0_DATA3);
+#ifdef CONFIG_SDMMC_RK29_OLD
rk29_mux_api_set(GPIO2A2_SDMMC0DETECTN_NAME, GPIO2L_GPIO2A2);
+#else
+ rk29_mux_api_set(GPIO2A2_SDMMC0DETECTN_NAME, GPIO2L_SDMMC0_DETECT_N);//Modifyed by xbw.
+#endif
rk29_mux_api_set(GPIO5D5_SDMMC0PWREN_NAME, GPIO5H_GPIO5D5); ///GPIO5H_SDMMC0_PWR_EN); ///GPIO5H_GPIO5D5);
gpio_request(RK29_PIN5_PD5,"sdmmc");
gpio_set_value(RK29_PIN5_PD5,GPIO_HIGH);
}
gpio_direction_output(RK29SDK_WIFI_BT_GPIO_POWER_N, GPIO_LOW);
- gpio_direction_output(RK29SDK_WIFI_GPIO_RESET_N, GPIO_HIGH);
- gpio_direction_output(RK29SDK_BT_GPIO_RESET_N, GPIO_HIGH);
+ gpio_direction_output(RK29SDK_WIFI_GPIO_RESET_N, GPIO_LOW);
+ gpio_direction_output(RK29SDK_BT_GPIO_RESET_N, GPIO_LOW);
pr_info("%s: init finished\n",__func__);
{
pr_info("%s: %d\n", __func__, on);
if (on){
- gpio_set_value(RK29SDK_WIFI_BT_GPIO_POWER_N, on);
+ gpio_set_value(RK29SDK_WIFI_BT_GPIO_POWER_N, GPIO_HIGH);
+ gpio_set_value(RK29SDK_WIFI_GPIO_RESET_N, GPIO_HIGH);
mdelay(100);
pr_info("wifi turn on power\n");
}else{
if (!rk29sdk_bt_power_state){
- gpio_set_value(RK29SDK_WIFI_BT_GPIO_POWER_N, on);
+ gpio_set_value(RK29SDK_WIFI_BT_GPIO_POWER_N, GPIO_LOW);
mdelay(100);
pr_info("wifi shut off power\n");
}else
{
pr_info("wifi shouldn't shut off power, bt is using it!\n");
}
+ gpio_set_value(RK29SDK_WIFI_GPIO_RESET_N, GPIO_LOW);
}
[1] = {
.name = "gpu_base",
.start = RK29_GPU_PHYS,
- .end = RK29_GPU_PHYS + RK29_GPU_SIZE,
+ .end = RK29_GPU_PHYS + RK29_GPU_SIZE - 1,
.flags = IORESOURCE_MEM,
},
[2] = {
.name = "gpu_mem",
.start = PMEM_GPU_BASE,
- .end = PMEM_GPU_BASE + PMEM_GPU_SIZE,
+ .end = PMEM_GPU_BASE + PMEM_GPU_SIZE - 1,
.flags = IORESOURCE_MEM,
},
};
};
#endif
+#ifdef CONFIG_USE_GPIO_GENERATE_WAVE
+static struct gpio_wave_platform_data gpio_wave_pdata = {
+ .gpio = RK29_PIN0_PA0,
+ .Htime = 2000,
+ .Ltime = 300,
+ .Dvalue = GPIO_HIGH,
+};
+static struct platform_device gpio_wave_device = {
+ .name = "gpio_wave",
+ .id = -1,
+ .dev = {
+ .platform_data = &gpio_wave_pdata,
+ },
+};
+#endif
+
static void __init rk29_board_iomux_init(void)
{
+ int err;
+
+#ifdef CONFIG_UART1_RK29
+ //disable uart1 pull down
+ rk29_mux_api_set(GPIO2A5_UART1SOUT_NAME, GPIO2L_GPIO2A5);
+ rk29_mux_api_set(GPIO2A4_UART1SIN_NAME, GPIO2L_GPIO2A4);
+
+ gpio_request(RK29_PIN2_PA5, NULL);
+ gpio_request(RK29_PIN2_PA4, NULL);
+
+ gpio_pull_updown(RK29_PIN2_PA5, PullDisable);
+ gpio_pull_updown(RK29_PIN2_PA4, PullDisable);
+
+ rk29_mux_api_set(GPIO2A5_UART1SOUT_NAME, GPIO2L_UART1_SOUT);
+ rk29_mux_api_set(GPIO2A4_UART1SIN_NAME, GPIO2L_UART1_SIN);
+
+ gpio_free(RK29_PIN2_PA5);
+ gpio_free(RK29_PIN2_PA4);
+#endif
#ifdef CONFIG_RK29_PWM_REGULATOR
rk29_mux_api_set(REGULATOR_PWM_MUX_NAME,REGULATOR_PWM_MUX_MODE);
#endif
+ rk29_mux_api_set(GPIO4C0_RMIICLKOUT_RMIICLKIN_NAME,GPIO4H_GPIO4C0);
+
+/****************************clock change********************************************/
+ err = gpio_request(RK29_PIN4_PC0, "clk27M_control");
+ if (err) {
+ gpio_free(RK29_PIN4_PC0);
+ printk("-------request RK29_PIN4_PC0 fail--------\n");
+ return -1;
+ }
+ //phy power down
+ gpio_direction_output(RK29_PIN4_PC0, GPIO_LOW);// 27M 32K
+ gpio_set_value(RK29_PIN4_PC0, GPIO_LOW);
+
+ rk29_mux_api_set(GPIO4C5_RMIICSRDVALID_MIIRXDVALID_NAME,GPIO4H_GPIO4C5);
+
+ err = gpio_request(RK29_PIN4_PC5, "clk24M_control");
+ if (err) {
+ gpio_free(RK29_PIN4_PC5);
+ printk("-------request RK29_PIN4_PC5 fail--------\n");
+ return -1;
+ }
+ //phy power down
+ gpio_direction_output(RK29_PIN4_PC5, GPIO_LOW);// control 24M
+ gpio_set_value(RK29_PIN4_PC5, GPIO_LOW);
+/*******************************************************************/
+
+
}
+// For phone,just a disk only, add by phc,20110816
+#ifdef CONFIG_USB_ANDROID
+struct usb_mass_storage_platform_data phone_mass_storage_pdata = {
+ .nluns = 1,
+ .vendor = "RockChip",
+ .product = "rk29 sdk",
+ .release = 0x0100,
+};
+
+//static
+struct platform_device phone_usb_mass_storage_device = {
+ .name = "usb_mass_storage",
+ .id = -1,
+ .dev = {
+ .platform_data = &phone_mass_storage_pdata,
+ },
+};
+#endif
+
+
static struct platform_device *devices[] __initdata = {
+
+#ifdef CONFIG_RK29_WATCHDOG
+ &rk29_device_wdt,
+#endif
+
#ifdef CONFIG_UART1_RK29
&rk29_device_uart1,
#endif
#ifdef CONFIG_KEYS_RK29
&rk29_device_keys,
#endif
+#ifdef CONFIG_USE_GPIO_GENERATE_WAVE
+ &gpio_wave_device,
+#endif
#ifdef CONFIG_SDMMC0_RK29
&rk29_device_sdmmc0,
#endif
#endif
#ifdef CONFIG_VIDEO_RK29
&rk29_device_camera, /* ddl@rock-chips.com : camera support */
- #if (SENSOR_IIC_ADDR_0 != 0x00)
+ #if (CONFIG_SENSOR_IIC_ADDR_0 != 0x00)
&rk29_soc_camera_pdrv_0,
#endif
&rk29_soc_camera_pdrv_1,
#endif
#ifdef CONFIG_USB_ANDROID
&android_usb_device,
- &usb_mass_storage_device,
+ &phone_usb_mass_storage_device,
#endif
#ifdef CONFIG_RK29_IPP
&rk29_device_ipp,
&rk29_v4l2_output_devce,
#endif
#ifdef CONFIG_RK_HEADSET_DET
- &rk28_device_headset,
+ &rk_device_headset,
#endif
#ifdef CONFIG_RK29_GPS
&rk29_device_gps,
#elif defined(CONFIG_TOUCHSCREEN_GT801_IIC)
.name = "virtualkeys.gt801-touchscreen",
#elif defined(CONFIG_TOUCHSCREEN_ILI2102_IIC)
- .name = "virtualkeys.ili2102-touchscreen",
+ .name = "virtualkeys.ili2102-touchscreen",
+#else
+ .name = "virtualkeys",
#endif
-
-
.mode = S_IRUGO,
},
.show = &rk29xx_virtual_keys_show,
}
#define POWER_ON_PIN RK29_PIN4_PA4
+
+static void rk29_pm_power_restart(void)
+{
+ printk("%s,line=%d\n",__FUNCTION__,__LINE__);
+ mdelay(2);
+#if defined(CONFIG_MFD_WM831X)
+ wm831x_device_restart(gWm831x);
+#endif
+
+}
+
static void rk29_pm_power_off(void)
{
printk(KERN_ERR "rk29_pm_power_off start...\n");
gpio_direction_output(POWER_ON_PIN, GPIO_LOW);
#if defined(CONFIG_MFD_WM831X)
- wm831x_device_shutdown(gWm831x);
+ if(wm831x_read_usb(gWm831x))
+ rk29_pm_power_restart(); //if charging then restart
+ else
+ wm831x_device_shutdown(gWm831x);//else shutdown
#endif
while (1);
}
+static struct cpufreq_frequency_table freq_table[] =
+{
+ { .index = 1200000, .frequency = 408000 },
+ { .index = 1200000, .frequency = 600000 },
+ { .index = 1200000, .frequency = 816000 },
+ { .index = 1350000, .frequency = 1008000 },
+ { .frequency = CPUFREQ_TABLE_END },
+};
+
static void __init machine_rk29_board_init(void)
{
rk29_board_iomux_init();
-
+
gpio_request(POWER_ON_PIN,"poweronpin");
gpio_set_value(POWER_ON_PIN, GPIO_HIGH);
gpio_direction_output(POWER_ON_PIN, GPIO_HIGH);
pm_power_off = rk29_pm_power_off;
+ //arm_pm_restart = rk29_pm_power_restart;
+
+ board_update_cpufreq_table(freq_table);
platform_add_devices(devices, ARRAY_SIZE(devices));
#ifdef CONFIG_I2C0_RK29
rk29sdk_init_wifi_mem();
#endif
+#if (defined(CONFIG_TOUCHSCREEN_XPT2046_SPI) && defined(CONFIG_TOUCHSCREEN_480X800)) \
+ || defined(CONFIG_TOUCHSCREEN_HX8520_IIC) || defined(CONFIG_TOUCHSCREEN_GT801_IIC)
rk29xx_virtual_keys_init();
+#endif
+
}
static void __init machine_rk29_fixup(struct machine_desc *desc, struct tag *tags,
{
mi->nr_banks = 1;
mi->bank[0].start = RK29_SDRAM_PHYS;
- mi->bank[0].node = PHYS_TO_NID(RK29_SDRAM_PHYS);
mi->bank[0].size = LINUX_SIZE;
+#if SDRAM_SIZE > SZ_512M
+ mi->nr_banks = 2;
+ mi->bank[1].start = RK29_SDRAM_PHYS + SZ_512M;
+ mi->bank[1].size = SDRAM_SIZE - SZ_512M;
+#endif
}
static void __init machine_rk29_mapio(void)
rk29_map_common_io();
rk29_setup_early_printk();
rk29_sram_init();
- rk29_clock_init(periph_pll_288mhz);
+ rk29_clock_init2(periph_pll_96mhz, codec_pll_300mhz, false);
rk29_iomux_init();
ddr_init(DDR_TYPE, DDR_FREQ);
}
MACHINE_START(RK29, "RK29board")
/* UART for LL DEBUG */
- .phys_io = RK29_UART1_PHYS,
+ .phys_io = RK29_UART1_PHYS & 0xfff00000,
.io_pg_offst = ((RK29_UART1_BASE) >> 18) & 0xfffc,
.boot_params = RK29_SDRAM_PHYS + 0x88000,
.fixup = machine_rk29_fixup,