#define PMEM_GPU_SIZE SZ_32M\r
#define PMEM_UI_SIZE SZ_16M\r
#define PMEM_VPU_SIZE SZ_32M\r
+#define PMEM_CAM_SIZE SZ_16M\r
\r
#define PMEM_GPU_BASE ((u32)RK29_SDRAM_PHYS + SDRAM_SIZE - PMEM_GPU_SIZE)\r
#define PMEM_UI_BASE (PMEM_GPU_BASE - PMEM_UI_SIZE)\r
#define PMEM_VPU_BASE (PMEM_UI_BASE - PMEM_VPU_SIZE)\r
-#define LINUX_SIZE (PMEM_VPU_BASE - RK29_SDRAM_PHYS)\r
+#define PMEM_CAM_BASE (PMEM_VPU_BASE - PMEM_CAM_SIZE)\r
+#define LINUX_SIZE (PMEM_CAM_BASE - RK29_SDRAM_PHYS)\r
\r
extern struct sys_timer rk29_timer;\r
\r
};\r
\r
\r
+static struct android_pmem_platform_data android_pmem_cam_pdata = {\r
+ .name = "pmem_cam",\r
+ .start = PMEM_CAM_BASE,\r
+ .size = PMEM_CAM_SIZE,\r
+ .no_allocator = 0,\r
+ .cached = 1,\r
+};\r
+\r
+static struct platform_device android_pmem_cam_device = {\r
+ .name = "android_pmem",\r
+ .id = 1,\r
+ .dev = {\r
+ .platform_data = &android_pmem_cam_pdata,\r
+ },\r
+};\r
+\r
+\r
static struct vpu_mem_platform_data vpu_mem_pdata = {\r
.name = "vpu_mem",\r
.start = PMEM_VPU_BASE,\r
* author: ddl@rock-chips.com\r
*****************************************************************************************/\r
#ifdef CONFIG_VIDEO_RK29\r
-#define SENSOR_NAME_0 RK29_CAM_SENSOR_NAME_OV2655 /* back camera sensor */\r
-#define SENSOR_IIC_ADDR_0 0x60\r
+#define SENSOR_NAME_0 RK29_CAM_SENSOR_NAME_OV5642 /* back camera sensor */\r
+#define SENSOR_IIC_ADDR_0 0x78\r
#define SENSOR_IIC_ADAPTER_ID_0 1\r
-#define SENSOR_POWER_PIN_0 INVALID_GPIO\r
-#define SENSOR_RESET_PIN_0 RK29_PIN0_PA2\r
+#define SENSOR_POWER_PIN_0 RK29_PIN5_PD7\r
+#define SENSOR_RESET_PIN_0 INVALID_GPIO\r
#define SENSOR_POWERACTIVE_LEVEL_0 RK29_CAM_POWERACTIVE_L\r
#define SENSOR_RESETACTIVE_LEVEL_0 RK29_CAM_RESETACTIVE_L\r
\r
#define SENSOR_NAME_1 RK29_CAM_SENSOR_NAME_OV2659 /* front camera sensor */\r
#define SENSOR_IIC_ADDR_1 0x60\r
#define SENSOR_IIC_ADAPTER_ID_1 1\r
-#define SENSOR_POWER_PIN_1 INVALID_GPIO\r
+#define SENSOR_POWER_PIN_1 RK29_PIN5_PD7\r
#define SENSOR_RESET_PIN_1 INVALID_GPIO\r
#define SENSOR_POWERACTIVE_LEVEL_1 RK29_CAM_POWERACTIVE_L\r
#define SENSOR_RESETACTIVE_LEVEL_1 RK29_CAM_RESETACTIVE_L\r
&rk29_device_camera, /* ddl@rock-chips.com : camera support */\r
&rk29_soc_camera_pdrv_0,\r
&rk29_soc_camera_pdrv_1,\r
+ &android_pmem_cam_device,\r
#endif\r
&android_pmem_device,\r
&rk29_vpu_mem_device,\r
rk29_gpio_init(rk29_gpiobankinit, MAX_BANK);\r
rk29_gpio_irq_setup();\r
}\r
-\r
+#define POWER_ON_PIN RK29_PIN4_PA4\r
static void __init machine_rk29_board_init(void)\r
{\r
rk29_board_iomux_init();\r
+\r
+ gpio_set_value(POWER_ON_PIN, 1);\r
+ gpio_direction_output(POWER_ON_PIN, 1);\r
+\r
platform_add_devices(devices, ARRAY_SIZE(devices));\r
#ifdef CONFIG_I2C0_RK29\r
i2c_register_board_info(default_i2c0_data.bus_num, board_i2c0_devices,\r
#define SENSOR_INIT_WIDTH 640 /* Sensor pixel size for sensor_init_data array */
#define SENSOR_INIT_HEIGHT 480
#define SENSOR_INIT_WINSEQADR sensor_vga
+#define SENSOR_INIT_PIXFMT V4L2_PIX_FMT_UYVY
#define CONFIG_SENSOR_WhiteBalance 1
#define CONFIG_SENSOR_Brightness 0
#define CONFIG_SENSOR_Mirror 0
#define CONFIG_SENSOR_Flip 0
-#define CONFIG_SENSOR_I2C_SPEED 100000 /* Hz */
+#define CONFIG_SENSOR_I2C_SPEED 400000 /* Hz */
#define CONFIG_SENSOR_TR 1
-#define CONFIG_SENSOR_DEBUG 0
+#define CONFIG_SENSOR_DEBUG 1
#define SENSOR_NAME_STRING(a) STR(CONS(SENSOR_NAME, a))
#define SENSOR_NAME_VARFUN(a) CONS(SENSOR_NAME, a)
};
#endif
+static struct reginfo sensor_ClrFmt_YUYV[]=
+{
+ {0x3400, 0x00},
+ {0x0000, 0x00}
+};
+
+static struct reginfo sensor_ClrFmt_UYVY[]=
+{
+ {0x3400, 0x02},
+ {0x0000, 0x00}
+};
+
#if CONFIG_SENSOR_WhiteBalance
static struct reginfo sensor_WhiteB_Auto[]=
{
unsigned char mirror; /* HFLIP */
unsigned char flip; /* VFLIP */
unsigned int winseqe_cur_addr;
+ unsigned int pixfmt;
} sensor_info_priv_t;
struct v4l2_subdev subdev;
struct i2c_client *client;
sensor_info_priv_t info_priv;
- unsigned int pixfmt;
int model; /* V4L2_IDENT_OV* codes from v4l2-chip-ident.h */
};
*val = buf[0];
return 0;
} else {
- SENSOR_TR("\n %s read reg failed, try to read again! reg:0x%x \n",SENSOR_NAME_STRING(),val);
+ SENSOR_TR("\n %s read reg failed, try to read again! reg:0x%x \n",SENSOR_NAME_STRING(),(unsigned int)val);
udelay(10);
}
}
icd->user_width = SENSOR_INIT_WIDTH;
icd->user_height = SENSOR_INIT_HEIGHT;
sensor->info_priv.winseqe_cur_addr = (int)SENSOR_INIT_WINSEQADR;
+ sensor->info_priv.pixfmt = SENSOR_INIT_PIXFMT;
/* sensor sensor information for initialization */
qctrl = soc_camera_find_qctrl(&sensor_ops, V4L2_CID_DO_WHITE_BALANCE);
if (icl->power) {
ret = icl->power(icd->pdev, 0);
if (ret < 0) {
- SENSOR_TR("\n %s suspend fail for turn on power!\n");
+ SENSOR_TR("\n %s suspend fail for turn on power!\n", SENSOR_NAME_STRING());
return -EINVAL;
}
}
if (icl->power) {
ret = icl->power(icd->pdev, 1);
if (ret < 0) {
- SENSOR_TR("\n %s resume fail for turn on power!\n");
+ SENSOR_TR("\n %s resume fail for turn on power!\n", SENSOR_NAME_STRING());
return -EINVAL;
}
}
pix->width = icd->user_width;
pix->height = icd->user_height;
- pix->pixelformat = sensor->pixfmt;
+ pix->pixelformat = sensor->info_priv.pixfmt;
pix->field = V4L2_FIELD_NONE;
pix->colorspace = V4L2_COLORSPACE_JPEG;
struct i2c_client *client = sd->priv;
struct sensor *sensor = to_sensor(client);
struct v4l2_pix_format *pix = &f->fmt.pix;
- struct reginfo *winseqe_set_addr;
+ struct reginfo *winseqe_set_addr=NULL;
int ret, set_w,set_h;
+ if (sensor->info_priv.pixfmt != pix->pixelformat) {
+ switch (pix->pixelformat)
+ {
+ case V4L2_PIX_FMT_YUYV:
+ {
+ winseqe_set_addr = sensor_ClrFmt_YUYV;
+ break;
+ }
+ case V4L2_PIX_FMT_UYVY:
+ {
+ winseqe_set_addr = sensor_ClrFmt_UYVY;
+ break;
+ }
+ default:
+ break;
+ }
+ if (winseqe_set_addr != NULL) {
+ sensor_write_array(client, winseqe_set_addr);
+ sensor->info_priv.pixfmt = pix->pixelformat;
+
+ SENSOR_DG("%s Pixelformat(0x%x) set success!\n", SENSOR_NAME_STRING(),pix->pixelformat);
+ } else {
+ SENSOR_TR("%s Pixelformat(0x%x) is invalidate!\n", SENSOR_NAME_STRING(),pix->pixelformat);
+ }
+ }
+
set_w = pix->width;
set_h = pix->height;
set_w = 1600;
set_h = 1200;
}
- else if (sensor_qvga[0].reg)
+ else
{
- winseqe_set_addr = sensor_qvga; /* ddl@rock-chips.com : Sensor output smallest size if isn't support app */
- set_w = 320;
- set_h = 240;
- }
- else
- {
+ winseqe_set_addr = SENSOR_INIT_WINSEQADR; /* ddl@rock-chips.com : Sensor output smallest size if isn't support app */
+ set_w = SENSOR_INIT_WIDTH;
+ set_h = SENSOR_INIT_HEIGHT;
+
SENSOR_TR("\n %s..%s Format is Invalidate. pix->width = %d.. pix->height = %d\n",SENSOR_NAME_STRING(),__FUNCTION__,pix->width,pix->height);
- return -EINVAL;
- }
+ }
if ((int)winseqe_set_addr != sensor->info_priv.winseqe_cur_addr)
{
/* Sensor Driver Configuration */
#define SENSOR_NAME ov2659
#define SENSOR_V4L2_IDENT V4L2_IDENT_OV2659
-#define SENSOR_ID 0x2659
+#define SENSOR_ID 0x2656
#define SENSOR_MIN_WIDTH 800
#define SENSOR_MIN_HEIGHT 600
#define SENSOR_MAX_WIDTH 1600
#define SENSOR_INIT_WIDTH 800 /* Sensor pixel size for sensor_init_data array */
#define SENSOR_INIT_HEIGHT 600
#define SENSOR_INIT_WINSEQADR sensor_svga
+#define SENSOR_INIT_PIXFMT V4L2_PIX_FMT_YUYV
#define CONFIG_SENSOR_WhiteBalance 1
#define CONFIG_SENSOR_Brightness 0
#define CONFIG_SENSOR_Mirror 0
#define CONFIG_SENSOR_Flip 0
-#define CONFIG_SENSOR_I2C_SPEED 100000 /* Hz */
+#define CONFIG_SENSOR_I2C_SPEED 400000 /* Hz */
#define CONFIG_SENSOR_TR 1
-#define CONFIG_SENSOR_DEBUG 0
+#define CONFIG_SENSOR_DEBUG 1
#define SENSOR_NAME_STRING(a) STR(CONS(SENSOR_NAME, a))
#define SENSOR_NAME_VARFUN(a) CONS(SENSOR_NAME, a)
};
#endif
+static struct reginfo sensor_ClrFmt_YUYV[]=
+{
+ {0x4300, 0x30},
+ {0x0000, 0x00}
+};
+
+static struct reginfo sensor_ClrFmt_UYVY[]=
+{
+ {0x4300, 0x32},
+ {0x0000, 0x00}
+};
+
#if CONFIG_SENSOR_WhiteBalance
static struct reginfo sensor_WhiteB_Auto[]=
{
unsigned char mirror; /* HFLIP */
unsigned char flip; /* VFLIP */
unsigned int winseqe_cur_addr;
+ unsigned int pixfmt;
} sensor_info_priv_t;
struct v4l2_subdev subdev;
struct i2c_client *client;
sensor_info_priv_t info_priv;
- unsigned int pixfmt;
int model; /* V4L2_IDENT_OV* codes from v4l2-chip-ident.h */
};
*val = buf[0];
return 0;
} else {
- SENSOR_TR("\n %s read reg failed, try to read again! reg:0x%x \n",SENSOR_NAME_STRING(),val);
+ SENSOR_TR("\n %s read reg failed, try to read again! reg:0x%x \n",SENSOR_NAME_STRING(),(unsigned int)val);
udelay(10);
}
}
icd->user_width = SENSOR_INIT_WIDTH;
icd->user_height = SENSOR_INIT_HEIGHT;
sensor->info_priv.winseqe_cur_addr = (int)SENSOR_INIT_WINSEQADR;
+ sensor->info_priv.pixfmt = SENSOR_INIT_PIXFMT;
/* sensor sensor information for initialization */
qctrl = soc_camera_find_qctrl(&sensor_ops, V4L2_CID_DO_WHITE_BALANCE);
if (icl->power) {
ret = icl->power(icd->pdev, 0);
if (ret < 0) {
- SENSOR_TR("\n %s suspend fail for turn on power!\n");
+ SENSOR_TR("\n %s suspend fail for turn on power!\n", SENSOR_NAME_STRING());
return -EINVAL;
}
}
if (icl->power) {
ret = icl->power(icd->pdev, 1);
if (ret < 0) {
- SENSOR_TR("\n %s resume fail for turn on power!\n");
+ SENSOR_TR("\n %s resume fail for turn on power!\n", SENSOR_NAME_STRING());
return -EINVAL;
}
}
pix->width = icd->user_width;
pix->height = icd->user_height;
- pix->pixelformat = sensor->pixfmt;
+ pix->pixelformat = sensor->info_priv.pixfmt;
pix->field = V4L2_FIELD_NONE;
pix->colorspace = V4L2_COLORSPACE_JPEG;
struct i2c_client *client = sd->priv;
struct sensor *sensor = to_sensor(client);
struct v4l2_pix_format *pix = &f->fmt.pix;
- struct reginfo *winseqe_set_addr;
+ struct reginfo *winseqe_set_addr=NULL;
int ret, set_w,set_h;
+ if (sensor->info_priv.pixfmt != pix->pixelformat) {
+ switch (pix->pixelformat)
+ {
+ case V4L2_PIX_FMT_YUYV:
+ {
+ winseqe_set_addr = sensor_ClrFmt_YUYV;
+ break;
+ }
+ case V4L2_PIX_FMT_UYVY:
+ {
+ winseqe_set_addr = sensor_ClrFmt_UYVY;
+ break;
+ }
+ default:
+ break;
+ }
+ if (winseqe_set_addr != NULL) {
+ sensor_write_array(client, winseqe_set_addr);
+ sensor->info_priv.pixfmt = pix->pixelformat;
+
+ SENSOR_DG("%s Pixelformat(0x%x) set success!\n", SENSOR_NAME_STRING(),pix->pixelformat);
+ } else {
+ SENSOR_TR("%s Pixelformat(0x%x) is invalidate!\n", SENSOR_NAME_STRING(),pix->pixelformat);
+ }
+ }
+
set_w = pix->width;
set_h = pix->height;
#define SENSOR_INIT_WIDTH 640 /* Sensor pixel size for sensor_init_data array */
#define SENSOR_INIT_HEIGHT 480
#define SENSOR_INIT_WINSEQADR sensor_vga
+#define SENSOR_INIT_PIXFMT V4L2_PIX_FMT_UYVY
#define CONFIG_SENSOR_WhiteBalance 1
#define CONFIG_SENSOR_Brightness 0
#define CONFIG_SENSOR_Mirror 0
#define CONFIG_SENSOR_Flip 0
-#define CONFIG_SENSOR_I2C_SPEED 100000 /* Hz */
+#define CONFIG_SENSOR_I2C_SPEED 400000 /* Hz */
#define CONFIG_SENSOR_TR 1
-#define CONFIG_SENSOR_DEBUG 0
+#define CONFIG_SENSOR_DEBUG 1
#define SENSOR_NAME_STRING(a) STR(CONS(SENSOR_NAME, a))
#define SENSOR_NAME_VARFUN(a) CONS(SENSOR_NAME, a)
};
#endif
+static struct reginfo sensor_ClrFmt_YUYV[]=
+{
+ {0x4300, 0x30},
+ {0x0000, 0x00}
+};
+
+static struct reginfo sensor_ClrFmt_UYVY[]=
+{
+ {0x4300, 0x32},
+ {0x0000, 0x00}
+};
+
+
#if CONFIG_SENSOR_WhiteBalance
static struct reginfo sensor_WhiteB_Auto[]=
{
unsigned char mirror; /* HFLIP */
unsigned char flip; /* VFLIP */
unsigned int winseqe_cur_addr;
+ unsigned int pixfmt;
unsigned int funmodule_state;
} sensor_info_priv_t;
struct v4l2_subdev subdev;
struct i2c_client *client;
sensor_info_priv_t info_priv;
- unsigned int pixfmt;
int model; /* V4L2_IDENT_OV* codes from v4l2-chip-ident.h */
};
icd->user_width = SENSOR_INIT_WIDTH;
icd->user_height = SENSOR_INIT_HEIGHT;
sensor->info_priv.winseqe_cur_addr = (int)SENSOR_INIT_WINSEQADR;
+ sensor->info_priv.pixfmt = SENSOR_INIT_PIXFMT;
/* sensor sensor information for initialization */
qctrl = soc_camera_find_qctrl(&sensor_ops, V4L2_CID_DO_WHITE_BALANCE);
pix->width = icd->user_width;
pix->height = icd->user_height;
- pix->pixelformat = sensor->pixfmt;
+ pix->pixelformat = sensor->info_priv.pixfmt;
pix->field = V4L2_FIELD_NONE;
pix->colorspace = V4L2_COLORSPACE_JPEG;
struct i2c_client *client = sd->priv;
struct sensor *sensor = to_sensor(client);
struct v4l2_pix_format *pix = &f->fmt.pix;
- struct reginfo *winseqe_set_addr;
+ struct reginfo *winseqe_set_addr=NULL;
int ret, set_w,set_h;
+ if (sensor->info_priv.pixfmt != pix->pixelformat) {
+ switch (pix->pixelformat)
+ {
+ case V4L2_PIX_FMT_YUYV:
+ {
+ winseqe_set_addr = sensor_ClrFmt_YUYV;
+ break;
+ }
+ case V4L2_PIX_FMT_UYVY:
+ {
+ winseqe_set_addr = sensor_ClrFmt_UYVY;
+ break;
+ }
+ default:
+ break;
+ }
+ if (winseqe_set_addr != NULL) {
+ sensor_write_array(client, winseqe_set_addr);
+ sensor->info_priv.pixfmt = pix->pixelformat;
+
+ SENSOR_DG("%s Pixelformat(0x%x) set success!\n", SENSOR_NAME_STRING(),pix->pixelformat);
+ } else {
+ SENSOR_TR("%s Pixelformat(0x%x) is invalidate!\n", SENSOR_NAME_STRING(),pix->pixelformat);
+ }
+ }
+
set_w = pix->width;
set_h = pix->height;
//Configure Macro
#define CONFIG_RK29CAMERA_TR 1
-#define CONFIG_RK29CAMERA_DEBUG 0
+#define CONFIG_RK29CAMERA_DEBUG 1
#if (CONFIG_RK29CAMERA_TR)
#define RK29CAMERA_TR(format, ...) printk(format, ## __VA_ARGS__)
#if (CONFIG_RK29CAMERA_DEBUG)
//write_grf_reg(GRF_SOC_CON0_Reg, read_grf_reg(GRF_SOC_CON0_Reg)|VIP_AHBMASTER); //VIP Config to AHB
write_grf_reg(GRF_SOC_CON0_Reg, read_grf_reg(GRF_SOC_CON0_Reg)&(~VIP_AHBMASTER)); //VIP Config to AXI
- write_grf_reg(GRF_OS_REG0, read_grf_reg(GRF_OS_REG0)&(~VIP_ACLK_DIV_HCLK_2)); //aclk:hclk = 1:1
- //write_grf_reg(GRF_OS_REG0, read_grf_reg(GRF_OS_REG0)|VIP_ACLK_DIV_HCLK_2); //aclk:hclk = 2:1
+ //write_grf_reg(GRF_OS_REG0, read_grf_reg(GRF_OS_REG0)&(~VIP_ACLK_DIV_HCLK_2)); //aclk:hclk = 1:1
+ write_grf_reg(GRF_OS_REG0, read_grf_reg(GRF_OS_REG0)|VIP_ACLK_DIV_HCLK_2); //aclk:hclk = 2:1
write_vip_reg(RK29_VIP_RESET, 0x76543210); /* ddl@rock-chips.com : vip software reset */
udelay(10);