#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_0 RK29_CAM_SENSOR_OV5642 /* back camera sensor 0 */
#define CONFIG_SENSOR_IIC_ADDR_0 0x78
#define CONFIG_SENSOR_IIC_ADAPTER_ID_0 1
#define CONFIG_SENSOR_ORIENTATION_0 90
#define CONFIG_SENSOR_FLASHACTIVE_LEVEL_0 RK29_CAM_FLASHACTIVE_L
#define CONFIG_SENSOR_QCIF_FPS_FIXED_0 15000
+#define CONFIG_SENSOR_240X160_FPS_FIXED_0 15000
#define CONFIG_SENSOR_QVGA_FPS_FIXED_0 15000
#define CONFIG_SENSOR_CIF_FPS_FIXED_0 15000
#define CONFIG_SENSOR_VGA_FPS_FIXED_0 15000
#define CONFIG_SENSOR_SVGA_FPS_FIXED_0 15000
#define CONFIG_SENSOR_720P_FPS_FIXED_0 30000
-#define CONFIG_SENSOR_1 RK29_CAM_SENSOR_OV2659 /* front camera sensor */
+#define CONFIG_SENSOR_01 RK29_CAM_SENSOR_OV5642 /* back camera sensor 1 */
+#define CONFIG_SENSOR_IIC_ADDR_01 0x00
+#define CONFIG_SENSOR_IIC_ADAPTER_ID_01 1
+#define CONFIG_SENSOR_ORIENTATION_01 90
+#define CONFIG_SENSOR_POWER_PIN_01 INVALID_GPIO
+#define CONFIG_SENSOR_RESET_PIN_01 INVALID_GPIO
+#define CONFIG_SENSOR_POWERDN_PIN_01 RK29_PIN6_PB7
+#define CONFIG_SENSOR_FALSH_PIN_01 INVALID_GPIO
+#define CONFIG_SENSOR_POWERACTIVE_LEVEL_01 RK29_CAM_POWERACTIVE_L
+#define CONFIG_SENSOR_RESETACTIVE_LEVEL_01 RK29_CAM_RESETACTIVE_L
+#define CONFIG_SENSOR_POWERDNACTIVE_LEVEL_01 RK29_CAM_POWERDNACTIVE_H
+#define CONFIG_SENSOR_FLASHACTIVE_LEVEL_01 RK29_CAM_FLASHACTIVE_L
+
+#define CONFIG_SENSOR_QCIF_FPS_FIXED_01 15000
+#define CONFIG_SENSOR_240X160_FPS_FIXED_01 15000
+#define CONFIG_SENSOR_QVGA_FPS_FIXED_01 15000
+#define CONFIG_SENSOR_CIF_FPS_FIXED_01 15000
+#define CONFIG_SENSOR_VGA_FPS_FIXED_01 15000
+#define CONFIG_SENSOR_480P_FPS_FIXED_01 15000
+#define CONFIG_SENSOR_SVGA_FPS_FIXED_01 15000
+#define CONFIG_SENSOR_720P_FPS_FIXED_01 30000
+
+#define CONFIG_SENSOR_02 RK29_CAM_SENSOR_OV5640 /* back camera sensor 2 */
+#define CONFIG_SENSOR_IIC_ADDR_02 0x00
+#define CONFIG_SENSOR_IIC_ADAPTER_ID_02 1
+#define CONFIG_SENSOR_ORIENTATION_02 90
+#define CONFIG_SENSOR_POWER_PIN_02 INVALID_GPIO
+#define CONFIG_SENSOR_RESET_PIN_02 INVALID_GPIO
+#define CONFIG_SENSOR_POWERDN_PIN_02 RK29_PIN6_PB7
+#define CONFIG_SENSOR_FALSH_PIN_02 INVALID_GPIO
+#define CONFIG_SENSOR_POWERACTIVE_LEVEL_02 RK29_CAM_POWERACTIVE_L
+#define CONFIG_SENSOR_RESETACTIVE_LEVEL_02 RK29_CAM_RESETACTIVE_L
+#define CONFIG_SENSOR_POWERDNACTIVE_LEVEL_02 RK29_CAM_POWERDNACTIVE_H
+#define CONFIG_SENSOR_FLASHACTIVE_LEVEL_02 RK29_CAM_FLASHACTIVE_L
+
+#define CONFIG_SENSOR_QCIF_FPS_FIXED_02 15000
+#define CONFIG_SENSOR_240X160_FPS_FIXED_02 15000
+#define CONFIG_SENSOR_QVGA_FPS_FIXED_02 15000
+#define CONFIG_SENSOR_CIF_FPS_FIXED_02 15000
+#define CONFIG_SENSOR_VGA_FPS_FIXED_02 15000
+#define CONFIG_SENSOR_480P_FPS_FIXED_02 15000
+#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 0x60
#define CONFIG_SENSOR_IIC_ADAPTER_ID_1 1
#define CONFIG_SENSOR_ORIENTATION_1 270
#define CONFIG_SENSOR_FLASHACTIVE_LEVEL_1 RK29_CAM_FLASHACTIVE_L
#define CONFIG_SENSOR_QCIF_FPS_FIXED_1 15000
+#define CONFIG_SENSOR_240X160_FPS_FIXED_1 15000
#define CONFIG_SENSOR_QVGA_FPS_FIXED_1 15000
#define CONFIG_SENSOR_CIF_FPS_FIXED_1 15000
#define CONFIG_SENSOR_VGA_FPS_FIXED_1 15000
#define CONFIG_SENSOR_SVGA_FPS_FIXED_1 15000
#define CONFIG_SENSOR_720P_FPS_FIXED_1 30000
+#define CONFIG_SENSOR_11 RK29_CAM_SENSOR_OV2659 /* front camera sensor 1 */
+#define CONFIG_SENSOR_IIC_ADDR_11 0x00
+#define CONFIG_SENSOR_IIC_ADAPTER_ID_11 1
+#define CONFIG_SENSOR_ORIENTATION_11 270
+#define CONFIG_SENSOR_POWER_PIN_11 INVALID_GPIO
+#define CONFIG_SENSOR_RESET_PIN_11 INVALID_GPIO
+#define CONFIG_SENSOR_POWERDN_PIN_11 RK29_PIN5_PD7
+#define CONFIG_SENSOR_FALSH_PIN_11 INVALID_GPIO
+#define CONFIG_SENSOR_POWERACTIVE_LEVEL_11 RK29_CAM_POWERACTIVE_L
+#define CONFIG_SENSOR_RESETACTIVE_LEVEL_11 RK29_CAM_RESETACTIVE_L
+#define CONFIG_SENSOR_POWERDNACTIVE_LEVEL_11 RK29_CAM_POWERDNACTIVE_H
+#define CONFIG_SENSOR_FLASHACTIVE_LEVEL_11 RK29_CAM_FLASHACTIVE_L
+
+#define CONFIG_SENSOR_QCIF_FPS_FIXED_11 15000
+#define CONFIG_SENSOR_240X160_FPS_FIXED_11 15000
+#define CONFIG_SENSOR_QVGA_FPS_FIXED_11 15000
+#define CONFIG_SENSOR_CIF_FPS_FIXED_11 15000
+#define CONFIG_SENSOR_VGA_FPS_FIXED_11 15000
+#define CONFIG_SENSOR_480P_FPS_FIXED_11 15000
+#define CONFIG_SENSOR_SVGA_FPS_FIXED_11 15000
+#define CONFIG_SENSOR_720P_FPS_FIXED_11 30000
+
+#define CONFIG_SENSOR_12 RK29_CAM_SENSOR_OV2655 /* front camera sensor 2 */
+#define CONFIG_SENSOR_IIC_ADDR_12 0x00
+#define CONFIG_SENSOR_IIC_ADAPTER_ID_12 1
+#define CONFIG_SENSOR_ORIENTATION_12 270
+#define CONFIG_SENSOR_POWER_PIN_12 INVALID_GPIO
+#define CONFIG_SENSOR_RESET_PIN_12 INVALID_GPIO
+#define CONFIG_SENSOR_POWERDN_PIN_12 RK29_PIN5_PD7
+#define CONFIG_SENSOR_FALSH_PIN_12 INVALID_GPIO
+#define CONFIG_SENSOR_POWERACTIVE_LEVEL_12 RK29_CAM_POWERACTIVE_L
+#define CONFIG_SENSOR_RESETACTIVE_LEVEL_12 RK29_CAM_RESETACTIVE_L
+#define CONFIG_SENSOR_POWERDNACTIVE_LEVEL_12 RK29_CAM_POWERDNACTIVE_H
+#define CONFIG_SENSOR_FLASHACTIVE_LEVEL_12 RK29_CAM_FLASHACTIVE_L
+
+#define CONFIG_SENSOR_QCIF_FPS_FIXED_12 15000
+#define CONFIG_SENSOR_240X160_FPS_FIXED_12 15000
+#define CONFIG_SENSOR_QVGA_FPS_FIXED_12 15000
+#define CONFIG_SENSOR_CIF_FPS_FIXED_12 15000
+#define CONFIG_SENSOR_VGA_FPS_FIXED_12 15000
+#define CONFIG_SENSOR_480P_FPS_FIXED_12 15000
+#define CONFIG_SENSOR_SVGA_FPS_FIXED_12 15000
+#define CONFIG_SENSOR_720P_FPS_FIXED_12 30000
+
+
#endif //#ifdef CONFIG_VIDEO_RK29
/*---------------- Camera Sensor Configuration Macro End------------------------*/
#include "../../../drivers/media/video/rk29_camera.c"
#if (CONFIG_SENSOR_IIC_ADDR_0 != 0x00)
&rk29_soc_camera_pdrv_0,
#endif
+ #if (CONFIG_SENSOR_IIC_ADDR_1 != 0x00)
&rk29_soc_camera_pdrv_1,
+ #endif
+ #ifdef CONFIG_SENSOR_01
+ #if (CONFIG_SENSOR_IIC_ADDR_01 != 0x00)
+ &rk29_soc_camera_pdrv_01,
+ #endif
+ #endif
+ #ifdef CONFIG_SENSOR_02
+ #if (CONFIG_SENSOR_IIC_ADDR_02 != 0x00)
+ &rk29_soc_camera_pdrv_02,
+ #endif
+ #endif
+ #ifdef CONFIG_SENSOR_11
+ #if (CONFIG_SENSOR_IIC_ADDR_11 != 0x00)
+ &rk29_soc_camera_pdrv_11,
+ #endif
+ #endif
+ #ifdef CONFIG_SENSOR_12
+ #if (CONFIG_SENSOR_IIC_ADDR_12 != 0x00)
+ &rk29_soc_camera_pdrv_12,
+ #endif
+ #endif
+
+ #if (PMEM_CAM_SIZE > 0)
&android_pmem_cam_device,
+ #endif
+
#endif
#if PMEM_SKYPE_SIZE > 0
&android_pmem_skype_device,
#endif
#define CONFIG_SENSOR_QCIF_FPS_FIXED_0 12504
+#define CONFIG_SENSOR_240X160_FPS_FIXED_0 12504
#define CONFIG_SENSOR_QVGA_FPS_FIXED_0 12504
#define CONFIG_SENSOR_CIF_FPS_FIXED_0 12504
#define CONFIG_SENSOR_VGA_FPS_FIXED_0 12504
#define CONFIG_SENSOR_FLASHACTIVE_LEVEL_1 RK29_CAM_FLASHACTIVE_L
#define CONFIG_SENSOR_QCIF_FPS_FIXED_1 12504
+#define CONFIG_SENSOR_240X160_FPS_FIXED_1 12504
#define CONFIG_SENSOR_QVGA_FPS_FIXED_1 12504
#define CONFIG_SENSOR_CIF_FPS_FIXED_1 12504
#define CONFIG_SENSOR_VGA_FPS_FIXED_1 12504
#if (CONFIG_SENSOR_IIC_ADDR_0 != 0x00)
&rk29_soc_camera_pdrv_0,
#endif
+ #if (CONFIG_SENSOR_IIC_ADDR_1 != 0x00)
&rk29_soc_camera_pdrv_1,
+ #endif
+ #ifdef CONFIG_SENSOR_01
+ #if (CONFIG_SENSOR_IIC_ADDR_01 != 0x00)
+ &rk29_soc_camera_pdrv_01,
+ #endif
+ #endif
+ #ifdef CONFIG_SENSOR_02
+ #if (CONFIG_SENSOR_IIC_ADDR_02 != 0x00)
+ &rk29_soc_camera_pdrv_02,
+ #endif
+ #endif
+ #ifdef CONFIG_SENSOR_11
+ #if (CONFIG_SENSOR_IIC_ADDR_11 != 0x00)
+ &rk29_soc_camera_pdrv_11,
+ #endif
+ #endif
+ #ifdef CONFIG_SENSOR_12
+ #if (CONFIG_SENSOR_IIC_ADDR_12 != 0x00)
+ &rk29_soc_camera_pdrv_12,
+ #endif
+ #endif
+
+ #if (PMEM_CAM_SIZE > 0)
&android_pmem_cam_device,
+ #endif
#endif
#if PMEM_SKYPE_SIZE > 0
&android_pmem_skype_device,
#define RK29_CAM_EIO_INVALID -1
#define RK29_CAM_EIO_REQUESTFAIL -2
+#define RK29_CAM_SUPPORT_NUMS 6
+
/*---------------- Camera Sensor Must Define Macro Begin ------------------------*/
#define RK29_CAM_SENSOR_OV7675 ov7675
#define RK29_CAM_SENSOR_OV9650 ov9650
int (*io_init)(void);
int (*io_deinit)(int sensor);
int (*sensor_ioctrl)(struct device *dev,enum rk29camera_ioctrl_cmd cmd,int on);
- struct rk29camera_gpio_res gpio_res[2];
+ struct rk29camera_gpio_res gpio_res[RK29_CAM_SUPPORT_NUMS];
struct rk29camera_mem_res meminfo;
- struct rk29camera_info info[2];
+ struct rk29camera_info info[RK29_CAM_SUPPORT_NUMS];
};
struct rk29camera_platform_ioctl_cb {
bool "Digital zoom with IPP off"
endchoice
+choice
+ prompt "RK29XX camera memory "
+ depends on VIDEO_RK29
+ default VIDEO_RK29_CAMMEM_PMEM
+ ---help---
+ where camera memory which is used for preview/raw/jpeg in android camera hal is alloced
+config VIDEO_RK29_CAMMEM_PMEM
+ bool "Camera memory from pmem"
+
+config VIDEO_RK29_CAMMEM_ION
+ bool "Camera memory from ion"
+endchoice
+
config VIDEO_MX2_HOSTSUPPORT
bool
struct i2c_client *client = v4l2_get_subdevdata(sd);
struct sensor *sensor = to_sensor(client);
const struct sensor_datafmt *fmt;
- int ret = 0;
+ int ret = 0,set_w,set_h;
fmt = sensor_find_datafmt(mf->code, sensor_colour_fmts,
ARRAY_SIZE(sensor_colour_fmts));
else if (mf->width < SENSOR_MIN_WIDTH)
mf->width = SENSOR_MIN_WIDTH;
+ set_w = mf->width;
+ set_h = mf->height;
+
+ if (((set_w <= 176) && (set_h <= 144)) && sensor_qcif[0].reg!=0xff)
+ {
+ set_w = 176;
+ set_h = 144;
+ }
+ else if (((set_w <= 320) && (set_h <= 240)) && sensor_qvga[0].reg!=0xff)
+ {
+ set_w = 320;
+ set_h = 240;
+ }
+ else if (((set_w <= 352) && (set_h<= 288)) && sensor_cif[0].reg!=0xff)
+ {
+ set_w = 352;
+ set_h = 288;
+ }
+ else if (((set_w <= 640) && (set_h <= 480)) && sensor_vga[0].reg!=0xff)
+ {
+ set_w = 640;
+ set_h = 480;
+ }
+ else if (((set_w <= 800) && (set_h <= 600)) && sensor_svga[0].reg!=0xff)
+ {
+ set_w = 800;
+ set_h = 600;
+ }
+ else if (((set_w <= 1280) && (set_h <= 720)) && sensor_720p[0].reg!=0xff)
+ {
+ set_w = 1280;
+ set_h = 720;
+ }
+ else if (((set_w <= 1280) && (set_h <= 1024)) && sensor_sxga[0].reg!=0xff)
+ {
+ set_w = 1280;
+ set_h = 1024;
+ }
+ else
+ {
+ set_w = SENSOR_INIT_WIDTH;
+ set_h = SENSOR_INIT_HEIGHT;
+ }
+
+ mf->width = set_w;
+ mf->height = set_h;
mf->colorspace = fmt->colorspace;
return ret;
{
sensor->sensor_io_request = (struct rk29camera_platform_data*)arg;
if (sensor->sensor_io_request != NULL) {
- if (sensor->sensor_io_request->gpio_res[0].dev_name &&
- (strcmp(sensor->sensor_io_request->gpio_res[0].dev_name, dev_name(icd->pdev)) == 0)) {
- sensor->sensor_gpio_res = (struct rk29camera_gpio_res*)&sensor->sensor_io_request->gpio_res[0];
- } else if (sensor->sensor_io_request->gpio_res[1].dev_name &&
- (strcmp(sensor->sensor_io_request->gpio_res[1].dev_name, dev_name(icd->pdev)) == 0)) {
- sensor->sensor_gpio_res = (struct rk29camera_gpio_res*)&sensor->sensor_io_request->gpio_res[1];
+ sensor->sensor_gpio_res = NULL;
+ for (i=0; i<RK29_CAM_SUPPORT_NUMS;i++) {
+ if (sensor->sensor_io_request->gpio_res[i].dev_name &&
+ (strcmp(sensor->sensor_io_request->gpio_res[i].dev_name, dev_name(icd->pdev)) == 0)) {
+ sensor->sensor_gpio_res = (struct rk29camera_gpio_res*)&sensor->sensor_io_request->gpio_res[i];
+ }
+ }
+ if (sensor->sensor_gpio_res == NULL) {
+ SENSOR_TR("%s %s obtain gpio resource failed when RK29_CAM_SUBDEV_IOREQUEST \n",SENSOR_NAME_STRING(),__FUNCTION__);
+ ret = -EINVAL;
+ goto sensor_ioctl_end;
}
} else {
SENSOR_TR("%s %s RK29_CAM_SUBDEV_IOREQUEST fail\n",SENSOR_NAME_STRING(),__FUNCTION__);
struct i2c_client *client = v4l2_get_subdevdata(sd);
struct sensor *sensor = to_sensor(client);
const struct sensor_datafmt *fmt;
- int ret = 0;
+ int ret = 0,set_w,set_h;
fmt = sensor_find_datafmt(mf->code, sensor_colour_fmts,
ARRAY_SIZE(sensor_colour_fmts));
else if (mf->width < SENSOR_MIN_WIDTH)
mf->width = SENSOR_MIN_WIDTH;
+ set_w = mf->width;
+ set_h = mf->height;
+
+ if (((set_w <= 176) && (set_h <= 144)) && sensor_qcif[0].reg)
+ {
+ set_w = 176;
+ set_h = 144;
+ }
+ else if (((set_w <= 320) && (set_h <= 240)) && sensor_qvga[0].reg)
+ {
+ set_w = 320;
+ set_h = 240;
+ }
+ else if (((set_w <= 352) && (set_h<= 288)) && sensor_cif[0].reg)
+ {
+ set_w = 352;
+ set_h = 288;
+ }
+ else if (((set_w <= 640) && (set_h <= 480)) && sensor_vga[0].reg)
+ {
+ set_w = 640;
+ set_h = 480;
+ }
+ else if (((set_w <= 800) && (set_h <= 600)) && sensor_svga[0].reg)
+ {
+ set_w = 800;
+ set_h = 600;
+ }
+ else if (((set_w <= 1280) && (set_h <= 1024)) && sensor_sxga[0].reg)
+ {
+ set_w = 1280;
+ set_h = 1024;
+ }
+ else
+ {
+ set_w = SENSOR_INIT_WIDTH;
+ set_h = SENSOR_INIT_HEIGHT;
+ }
+
+ mf->width = set_w;
+ mf->height = set_h;
+
mf->colorspace = fmt->colorspace;
return ret;
{
sensor->sensor_io_request = (struct rk29camera_platform_data*)arg;
if (sensor->sensor_io_request != NULL) {
- if (sensor->sensor_io_request->gpio_res[0].dev_name &&
- (strcmp(sensor->sensor_io_request->gpio_res[0].dev_name, dev_name(icd->pdev)) == 0)) {
- sensor->sensor_gpio_res = (struct rk29camera_gpio_res*)&sensor->sensor_io_request->gpio_res[0];
- } else if (sensor->sensor_io_request->gpio_res[1].dev_name &&
- (strcmp(sensor->sensor_io_request->gpio_res[1].dev_name, dev_name(icd->pdev)) == 0)) {
- sensor->sensor_gpio_res = (struct rk29camera_gpio_res*)&sensor->sensor_io_request->gpio_res[1];
+ sensor->sensor_gpio_res = NULL;
+ for (i=0; i<RK29_CAM_SUPPORT_NUMS;i++) {
+ if (sensor->sensor_io_request->gpio_res[i].dev_name &&
+ (strcmp(sensor->sensor_io_request->gpio_res[i].dev_name, dev_name(icd->pdev)) == 0)) {
+ sensor->sensor_gpio_res = (struct rk29camera_gpio_res*)&sensor->sensor_io_request->gpio_res[i];
+ }
+ }
+ if (sensor->sensor_gpio_res == NULL) {
+ SENSOR_TR("%s %s obtain gpio resource failed when RK29_CAM_SUBDEV_IOREQUEST \n",SENSOR_NAME_STRING(),__FUNCTION__);
+ ret = -EINVAL;
+ goto sensor_ioctl_end;
}
} else {
SENSOR_TR("%s %s RK29_CAM_SUBDEV_IOREQUEST fail\n",SENSOR_NAME_STRING(),__FUNCTION__);
struct i2c_client *client = v4l2_get_subdevdata(sd);
struct sensor *sensor = to_sensor(client);
const struct sensor_datafmt *fmt;
- int ret = 0;
+ int ret = 0,set_w,set_h;
fmt = sensor_find_datafmt(mf->code, sensor_colour_fmts,
ARRAY_SIZE(sensor_colour_fmts));
else if (mf->width < SENSOR_MIN_WIDTH)
mf->width = SENSOR_MIN_WIDTH;
+ set_w = mf->width;
+ set_h = mf->height;
+
+ if (((set_w <= 176) && (set_h <= 144)) && sensor_qcif[0].reg)
+ {
+ set_w = 176;
+ set_h = 144;
+ }
+ else if (((set_w <= 320) && (set_h <= 240)) && sensor_qvga[0].reg)
+ {
+ set_w = 320;
+ set_h = 240;
+ }
+ else if (((set_w <= 352) && (set_h<= 288)) && sensor_cif[0].reg)
+ {
+ set_w = 352;
+ set_h = 288;
+ }
+ else if (((set_w <= 640) && (set_h <= 480)) && sensor_vga[0].reg)
+ {
+ set_w = 640;
+ set_h = 480;
+ }
+
+ else
+ {
+ set_w = SENSOR_INIT_WIDTH;
+ set_h = SENSOR_INIT_HEIGHT;
+ }
+ mf->width = set_w;
+ mf->height = set_h;
mf->colorspace = fmt->colorspace;
return ret;
{
sensor->sensor_io_request = (struct rk29camera_platform_data*)arg;
if (sensor->sensor_io_request != NULL) {
- if (sensor->sensor_io_request->gpio_res[0].dev_name &&
- (strcmp(sensor->sensor_io_request->gpio_res[0].dev_name, dev_name(icd->pdev)) == 0)) {
- sensor->sensor_gpio_res = (struct rk29camera_gpio_res*)&sensor->sensor_io_request->gpio_res[0];
- } else if (sensor->sensor_io_request->gpio_res[1].dev_name &&
- (strcmp(sensor->sensor_io_request->gpio_res[1].dev_name, dev_name(icd->pdev)) == 0)) {
- sensor->sensor_gpio_res = (struct rk29camera_gpio_res*)&sensor->sensor_io_request->gpio_res[1];
+ sensor->sensor_gpio_res = NULL;
+ for (i=0; i<RK29_CAM_SUPPORT_NUMS;i++) {
+ if (sensor->sensor_io_request->gpio_res[i].dev_name &&
+ (strcmp(sensor->sensor_io_request->gpio_res[i].dev_name, dev_name(icd->pdev)) == 0)) {
+ sensor->sensor_gpio_res = (struct rk29camera_gpio_res*)&sensor->sensor_io_request->gpio_res[i];
+ }
+ }
+ if (sensor->sensor_gpio_res == NULL) {
+ SENSOR_TR("%s %s obtain gpio resource failed when RK29_CAM_SUBDEV_IOREQUEST \n",SENSOR_NAME_STRING(),__FUNCTION__);
+ ret = -EINVAL;
+ goto sensor_ioctl_end;
}
} else {
SENSOR_TR("%s %s RK29_CAM_SUBDEV_IOREQUEST fail\n",SENSOR_NAME_STRING(),__FUNCTION__);
struct i2c_client *client = v4l2_get_subdevdata(sd);
struct sensor *sensor = to_sensor(client);
const struct sensor_datafmt *fmt;
- int ret = 0;
+ int ret = 0,set_w,set_h;
fmt = sensor_find_datafmt(mf->code, sensor_colour_fmts,
ARRAY_SIZE(sensor_colour_fmts));
else if (mf->width < SENSOR_MIN_WIDTH)
mf->width = SENSOR_MIN_WIDTH;
+ set_w = mf->width;
+ set_h = mf->height;
+
+ if (((set_w <= 176) && (set_h <= 144)) && sensor_qcif[0].reg)
+ {
+ set_w = 176;
+ set_h = 144;
+ }
+ else if (((set_w <= 320) && (set_h <= 240)) && sensor_qvga[0].reg)
+ {
+ set_w = 320;
+ set_h = 240;
+ }
+ else if (((set_w <= 352) && (set_h<= 288)) && sensor_cif[0].reg)
+ {
+ set_w = 352;
+ set_h = 288;
+ }
+ else if (((set_w <= 640) && (set_h <= 480)) && sensor_vga[0].reg)
+ {
+ set_w = 640;
+ set_h = 480;
+ }
+ else if (((set_w <= 800) && (set_h <= 600)) && sensor_svga[0].reg)
+ {
+ set_w = 800-32;
+ set_h = 600;
+ }
+ else if (((set_w <= 1024) && (set_h <= 768)) && sensor_xga[0].reg)
+ {
+ set_w = 1024;
+ set_h = 768;
+ }
+ else if (((set_w <= 1280) && (set_h <= 1024)) && sensor_sxga[0].reg)
+ {
+ set_w = 1280;
+ set_h = 1024;
+ }
+ else if (((set_w <= 1600) && (set_h <= 1200)) && sensor_uxga[0].reg)
+ {
+ set_w = 1600-32;
+ set_h = 1200;
+ }
+ else
+ {
+ set_w = SENSOR_INIT_WIDTH;
+ set_h = SENSOR_INIT_HEIGHT;
+ }
+ mf->width = set_w;
+ mf->height = set_h;
mf->colorspace = fmt->colorspace;
return ret;
{
sensor->sensor_io_request = (struct rk29camera_platform_data*)arg;
if (sensor->sensor_io_request != NULL) {
- if (sensor->sensor_io_request->gpio_res[0].dev_name &&
- (strcmp(sensor->sensor_io_request->gpio_res[0].dev_name, dev_name(icd->pdev)) == 0)) {
- sensor->sensor_gpio_res = (struct rk29camera_gpio_res*)&sensor->sensor_io_request->gpio_res[0];
- } else if (sensor->sensor_io_request->gpio_res[1].dev_name &&
- (strcmp(sensor->sensor_io_request->gpio_res[1].dev_name, dev_name(icd->pdev)) == 0)) {
- sensor->sensor_gpio_res = (struct rk29camera_gpio_res*)&sensor->sensor_io_request->gpio_res[1];
+ sensor->sensor_gpio_res = NULL;
+ for (i=0; i<RK29_CAM_SUPPORT_NUMS;i++) {
+ if (sensor->sensor_io_request->gpio_res[i].dev_name &&
+ (strcmp(sensor->sensor_io_request->gpio_res[i].dev_name, dev_name(icd->pdev)) == 0)) {
+ sensor->sensor_gpio_res = (struct rk29camera_gpio_res*)&sensor->sensor_io_request->gpio_res[i];
+ }
+ }
+ if (sensor->sensor_gpio_res == NULL) {
+ SENSOR_TR("%s %s obtain gpio resource failed when RK29_CAM_SUBDEV_IOREQUEST \n",SENSOR_NAME_STRING(),__FUNCTION__);
+ ret = -EINVAL;
+ goto sensor_ioctl_end;
}
} else {
SENSOR_TR("%s %s RK29_CAM_SUBDEV_IOREQUEST fail\n",SENSOR_NAME_STRING(),__FUNCTION__);
struct i2c_client *client = v4l2_get_subdevdata(sd);
struct sensor *sensor = to_sensor(client);
const struct sensor_datafmt *fmt;
- int ret = 0;
+ int ret = 0,set_w,set_h;
fmt = sensor_find_datafmt(mf->code, sensor_colour_fmts,
ARRAY_SIZE(sensor_colour_fmts));
else if (mf->width < SENSOR_MIN_WIDTH)
mf->width = SENSOR_MIN_WIDTH;
+ set_w = mf->width;
+ set_h = mf->height;
+
+ if (((set_w <= 176) && (set_h <= 144)) && sensor_qcif[0].reg)
+ {
+ set_w = 176;
+ set_h = 144;
+ }
+ else if (((set_w <= 320) && (set_h <= 240)) && sensor_qvga[0].reg)
+ {
+ set_w = 320;
+ set_h = 240;
+ }
+ else if (((set_w <= 352) && (set_h<= 288)) && sensor_cif[0].reg)
+ {
+ set_w = 352;
+ set_h = 288;
+ }
+ else if (((set_w <= 640) && (set_h <= 480)) && sensor_vga[0].reg)
+ {
+ set_w = 640;
+ set_h = 480;
+ }
+ else if (((set_w <= 800) && (set_h <= 600)) && sensor_svga[0].reg)
+ {
+ set_w = 800;
+ set_h = 600;
+ }
+ else if (((set_w <= 1280) && (set_h <= 1024)) && sensor_sxga[0].reg)
+ {
+ set_w = 1280;
+ set_h = 1024;
+ }
+ else if (((set_w <= 1600) && (set_h <= 1200)) && sensor_uxga[0].reg)
+ {
+ set_w = 1600;
+ set_h = 1200;
+ }
+ else
+ {
+ set_w = SENSOR_INIT_WIDTH;
+ set_h = SENSOR_INIT_HEIGHT;
+ }
+
+ mf->width = set_w;
+ mf->height = set_h;
mf->colorspace = fmt->colorspace;
return ret;
{
sensor->sensor_io_request = (struct rk29camera_platform_data*)arg;
if (sensor->sensor_io_request != NULL) {
- if (sensor->sensor_io_request->gpio_res[0].dev_name &&
- (strcmp(sensor->sensor_io_request->gpio_res[0].dev_name, dev_name(icd->pdev)) == 0)) {
- sensor->sensor_gpio_res = (struct rk29camera_gpio_res*)&sensor->sensor_io_request->gpio_res[0];
- } else if (sensor->sensor_io_request->gpio_res[1].dev_name &&
- (strcmp(sensor->sensor_io_request->gpio_res[1].dev_name, dev_name(icd->pdev)) == 0)) {
- sensor->sensor_gpio_res = (struct rk29camera_gpio_res*)&sensor->sensor_io_request->gpio_res[1];
+ sensor->sensor_gpio_res = NULL;
+ for (i=0; i<RK29_CAM_SUPPORT_NUMS;i++) {
+ if (sensor->sensor_io_request->gpio_res[i].dev_name &&
+ (strcmp(sensor->sensor_io_request->gpio_res[i].dev_name, dev_name(icd->pdev)) == 0)) {
+ sensor->sensor_gpio_res = (struct rk29camera_gpio_res*)&sensor->sensor_io_request->gpio_res[i];
+ }
+ }
+ if (sensor->sensor_gpio_res == NULL) {
+ SENSOR_TR("%s %s obtain gpio resource failed when RK29_CAM_SUBDEV_IOREQUEST \n",SENSOR_NAME_STRING(),__FUNCTION__);
+ ret = -EINVAL;
+ goto sensor_ioctl_end;
}
} else {
SENSOR_TR("%s %s RK29_CAM_SUBDEV_IOREQUEST fail\n",SENSOR_NAME_STRING(),__FUNCTION__);
struct i2c_client *client = v4l2_get_subdevdata(sd);
struct sensor *sensor = to_sensor(client);
const struct sensor_datafmt *fmt;
- int ret = 0;
+ int ret = 0,set_w,set_h;
fmt = sensor_find_datafmt(mf->code, sensor_colour_fmts,
ARRAY_SIZE(sensor_colour_fmts));
else if (mf->width < SENSOR_MIN_WIDTH)
mf->width = SENSOR_MIN_WIDTH;
+ set_w = mf->width;
+ set_h = mf->height;
+ if (((set_w <= 176) && (set_h <= 144)) && (sensor_qcif[0].reg!=SEQUENCE_END))
+ {
+ set_w = 176;
+ set_h = 144;
+ }
+ else if (((set_w <= 320) && (set_h <= 240)) && (sensor_qvga[0].reg!=SEQUENCE_END))
+ {
+ set_w = 320;
+ set_h = 240;
+ }
+ else if (((set_w <= 352) && (set_h<= 288)) && (sensor_cif[0].reg!=SEQUENCE_END))
+ {
+ set_w = 352;
+ set_h = 288;
+ }
+ else if (((set_w <= 640) && (set_h <= 480)) && (sensor_vga[0].reg!=SEQUENCE_END))
+ {
+ set_w = 640;
+ set_h = 480;
+ }
+ else if (((set_w <= 800) && (set_h <= 600)) && (sensor_svga[0].reg!=SEQUENCE_END))
+ {
+ set_w = 800;
+ set_h = 600;
+ }
+ else if (((set_w <= 1024) && (set_h <= 768)) && (sensor_xga[0].reg!=SEQUENCE_END))
+ {
+ set_w = 1024;
+ set_h = 768;
+ }
+ else if (((set_w <= 1280) && (set_h <= 720)) && (sensor_720p[0].reg!=SEQUENCE_END))
+ {
+ set_w = 1280;
+ set_h = 720;
+ }
+ else if (((set_w <= 1280) && (set_h <= 1024)) && (sensor_sxga[0].reg!=SEQUENCE_END))
+ {
+ set_w = 1280;
+ set_h = 1024;
+ }
+ else if (((set_w <= 1600) && (set_h <= 1200)) && (sensor_uxga[0].reg!=SEQUENCE_END))
+ {
+ set_w = 1600;
+ set_h = 1200;
+ }
+ else if (((set_w <= 1920) && (set_h <= 1080)) && (sensor_1080p[0].reg!=SEQUENCE_END))
+ {
+ set_w = 1920;
+ set_h = 1080;
+ }
+ else if (((set_w <= 2048) && (set_h <= 1536)) && (sensor_qxga[0].reg!=SEQUENCE_END))
+ {
+ set_w = 2048;
+ set_h = 1536;
+ }
+ else if (((set_w <= 2592) && (set_h <= 1944)) && (sensor_qsxga[0].reg!=SEQUENCE_END))
+ {
+ set_w = 2592;
+ set_h = 1944;
+ }
+
+ mf->width = set_w;
+ mf->height = set_h;
+
mf->colorspace = fmt->colorspace;
return ret;
}
case RK29_CAM_SUBDEV_IOREQUEST:
{
- sensor->sensor_io_request = (struct rk29camera_platform_data*)arg;
+ sensor->sensor_io_request = (struct rk29camera_platform_data*)arg;
if (sensor->sensor_io_request != NULL) {
- if (sensor->sensor_io_request->gpio_res[0].dev_name &&
- (strcmp(sensor->sensor_io_request->gpio_res[0].dev_name, dev_name(icd->pdev)) == 0)) {
- sensor->sensor_gpio_res = (struct rk29camera_gpio_res*)&sensor->sensor_io_request->gpio_res[0];
- } else if (sensor->sensor_io_request->gpio_res[1].dev_name &&
- (strcmp(sensor->sensor_io_request->gpio_res[1].dev_name, dev_name(icd->pdev)) == 0)) {
- sensor->sensor_gpio_res = (struct rk29camera_gpio_res*)&sensor->sensor_io_request->gpio_res[1];
+ sensor->sensor_gpio_res = NULL;
+ for (i=0; i<RK29_CAM_SUPPORT_NUMS;i++) {
+ if (sensor->sensor_io_request->gpio_res[i].dev_name &&
+ (strcmp(sensor->sensor_io_request->gpio_res[i].dev_name, dev_name(icd->pdev)) == 0)) {
+ sensor->sensor_gpio_res = (struct rk29camera_gpio_res*)&sensor->sensor_io_request->gpio_res[i];
+ }
+ }
+ if (sensor->sensor_gpio_res == NULL) {
+ SENSOR_TR("%s %s obtain gpio resource failed when RK29_CAM_SUBDEV_IOREQUEST \n",SENSOR_NAME_STRING(),__FUNCTION__);
+ ret = -EINVAL;
+ goto sensor_ioctl_end;
}
} else {
SENSOR_TR("%s %s RK29_CAM_SUBDEV_IOREQUEST fail\n",SENSOR_NAME_STRING(),__FUNCTION__);
{
sensor->sensor_io_request = (struct rk29camera_platform_data*)arg;
if (sensor->sensor_io_request != NULL) {
- if (sensor->sensor_io_request->gpio_res[0].dev_name &&
- (strcmp(sensor->sensor_io_request->gpio_res[0].dev_name, dev_name(icd->pdev)) == 0)) {
- sensor->sensor_gpio_res = (struct rk29camera_gpio_res*)&sensor->sensor_io_request->gpio_res[0];
- } else if (sensor->sensor_io_request->gpio_res[1].dev_name &&
- (strcmp(sensor->sensor_io_request->gpio_res[1].dev_name, dev_name(icd->pdev)) == 0)) {
- sensor->sensor_gpio_res = (struct rk29camera_gpio_res*)&sensor->sensor_io_request->gpio_res[1];
+ sensor->sensor_gpio_res = NULL;
+ for (i=0; i<RK29_CAM_SUPPORT_NUMS;i++) {
+ if (sensor->sensor_io_request->gpio_res[i].dev_name &&
+ (strcmp(sensor->sensor_io_request->gpio_res[i].dev_name, dev_name(icd->pdev)) == 0)) {
+ sensor->sensor_gpio_res = (struct rk29camera_gpio_res*)&sensor->sensor_io_request->gpio_res[i];
+ }
+ }
+ if (sensor->sensor_gpio_res == NULL) {
+ SENSOR_TR("%s %s obtain gpio resource failed when RK29_CAM_SUBDEV_IOREQUEST \n",SENSOR_NAME_STRING(),__FUNCTION__);
+ ret = -EINVAL;
+ goto sensor_ioctl_end;
}
} else {
SENSOR_TR("%s %s RK29_CAM_SUBDEV_IOREQUEST fail\n",SENSOR_NAME_STRING(),__FUNCTION__);
mf->width = SENSOR_MAX_WIDTH;
else if (mf->width < SENSOR_MIN_WIDTH)
mf->width = SENSOR_MIN_WIDTH;
-
+ if (sensor_fmt_catch(mf->width, mf->height, &mf->width, &mf->height) == NULL) {
+ mf->width = 0;
+ mf->height = 0;
+ }
mf->colorspace = fmt->colorspace;
return ret;
{
sensor->sensor_io_request = (struct rk29camera_platform_data*)arg;
if (sensor->sensor_io_request != NULL) {
- if (sensor->sensor_io_request->gpio_res[0].dev_name &&
- (strcmp(sensor->sensor_io_request->gpio_res[0].dev_name, dev_name(icd->pdev)) == 0)) {
- sensor->sensor_gpio_res = (struct rk29camera_gpio_res*)&sensor->sensor_io_request->gpio_res[0];
- } else if (sensor->sensor_io_request->gpio_res[1].dev_name &&
- (strcmp(sensor->sensor_io_request->gpio_res[1].dev_name, dev_name(icd->pdev)) == 0)) {
- sensor->sensor_gpio_res = (struct rk29camera_gpio_res*)&sensor->sensor_io_request->gpio_res[1];
+ sensor->sensor_gpio_res = NULL;
+ for (i=0; i<RK29_CAM_SUPPORT_NUMS;i++) {
+ if (sensor->sensor_io_request->gpio_res[i].dev_name &&
+ (strcmp(sensor->sensor_io_request->gpio_res[i].dev_name, dev_name(icd->pdev)) == 0)) {
+ sensor->sensor_gpio_res = (struct rk29camera_gpio_res*)&sensor->sensor_io_request->gpio_res[i];
+ }
+ }
+ if (sensor->sensor_gpio_res == NULL) {
+ SENSOR_TR("%s %s obtain gpio resource failed when RK29_CAM_SUBDEV_IOREQUEST \n",SENSOR_NAME_STRING(),__FUNCTION__);
+ ret = -EINVAL;
+ goto sensor_ioctl_end;
}
} else {
SENSOR_TR("%s %s RK29_CAM_SUBDEV_IOREQUEST fail\n",SENSOR_NAME_STRING(),__FUNCTION__);
{
sensor->sensor_io_request = (struct rk29camera_platform_data*)arg;
if (sensor->sensor_io_request != NULL) {
- if (sensor->sensor_io_request->gpio_res[0].dev_name &&
- (strcmp(sensor->sensor_io_request->gpio_res[0].dev_name, dev_name(icd->pdev)) == 0)) {
- sensor->sensor_gpio_res = (struct rk29camera_gpio_res*)&sensor->sensor_io_request->gpio_res[0];
- } else if (sensor->sensor_io_request->gpio_res[1].dev_name &&
- (strcmp(sensor->sensor_io_request->gpio_res[1].dev_name, dev_name(icd->pdev)) == 0)) {
- sensor->sensor_gpio_res = (struct rk29camera_gpio_res*)&sensor->sensor_io_request->gpio_res[1];
+ sensor->sensor_gpio_res = NULL;
+ for (i=0; i<RK29_CAM_SUPPORT_NUMS;i++) {
+ if (sensor->sensor_io_request->gpio_res[i].dev_name &&
+ (strcmp(sensor->sensor_io_request->gpio_res[i].dev_name, dev_name(icd->pdev)) == 0)) {
+ sensor->sensor_gpio_res = (struct rk29camera_gpio_res*)&sensor->sensor_io_request->gpio_res[i];
+ }
+ }
+ if (sensor->sensor_gpio_res == NULL) {
+ SENSOR_TR("%s %s obtain gpio resource failed when RK29_CAM_SUBDEV_IOREQUEST \n",SENSOR_NAME_STRING(),__FUNCTION__);
+ ret = -EINVAL;
+ goto sensor_ioctl_end;
}
} else {
SENSOR_TR("%s %s RK29_CAM_SUBDEV_IOREQUEST fail\n",SENSOR_NAME_STRING(),__FUNCTION__);
struct i2c_client *client = v4l2_get_subdevdata(sd);\r
struct sensor *sensor = to_sensor(client);
const struct sensor_datafmt *fmt;
- int ret = 0;
+ int ret = 0,set_w,set_h;\r
fmt = sensor_find_datafmt(mf->code, sensor_colour_fmts,
ARRAY_SIZE(sensor_colour_fmts));
mf->width = SENSOR_MAX_WIDTH;
else if (mf->width < SENSOR_MIN_WIDTH)
mf->width = SENSOR_MIN_WIDTH;
+\r
+ set_w = mf->width;
+ set_h = mf->height;
+
+ if (((set_w <= 176) && (set_h <= 144)) && sensor_qcif[0].reg)
+ {
+ set_w = 176;\r
+ set_h = 144;
+ }
+ else if (((set_w <= 320) && (set_h <= 240)) && sensor_qvga[0].reg)
+ {
+ set_w = 320;\r
+ set_h = 240;
+ }
+ else if (((set_w <= 352) && (set_h<= 288)) && sensor_cif[0].reg)
+ {
+ set_w = 352;\r
+ set_h = 288;
+ }
+ else if (((set_w <= 640) && (set_h <= 480)) && sensor_vga[0].reg)
+ {
+ set_w = 640;\r
+ set_h = 480;
+ }
+ else if (((set_w <= 800) && (set_h <= 600)) && sensor_svga[0].reg)
+ {
+ set_w = 800;\r
+ set_h = 600;
+ }
+ else if (((set_w <= 1024) && (set_h <= 768)) && sensor_xga[0].reg)
+ {
+ set_w = 1024;\r
+ set_h = 768;
+ }
+ else if (((set_w <= 1280) && (set_h <= 1024)) && sensor_sxga[0].reg)
+ {
+ set_w = 1280;\r
+ set_h = 1024;
+ }
+ else if (((set_w <= 1600) && (set_h <= 1200)) && sensor_uxga[0].reg)
+ {
+ set_w = 1600;\r
+ set_h = 1200;
+ }
+ else
+ {
+ set_w = SENSOR_INIT_WIDTH;\r
+ set_h = SENSOR_INIT_HEIGHT;
+ }\r
+ mf->width = set_w;
+ mf->height = set_h;\r
+\r
mf->colorspace = fmt->colorspace;
return ret;
case RK29_CAM_SUBDEV_IOREQUEST:
{
- sensor->sensor_io_request = (struct rk29camera_platform_data*)arg;
+ sensor->sensor_io_request = (struct rk29camera_platform_data*)arg; \r
if (sensor->sensor_io_request != NULL) {
- if (sensor->sensor_io_request->gpio_res[0].dev_name &&
- (strcmp(sensor->sensor_io_request->gpio_res[0].dev_name, dev_name(icd->pdev)) == 0)) {
- sensor->sensor_gpio_res = (struct rk29camera_gpio_res*)&sensor->sensor_io_request->gpio_res[0];
- } else if (sensor->sensor_io_request->gpio_res[1].dev_name &&
- (strcmp(sensor->sensor_io_request->gpio_res[1].dev_name, dev_name(icd->pdev)) == 0)) {
- sensor->sensor_gpio_res = (struct rk29camera_gpio_res*)&sensor->sensor_io_request->gpio_res[1];
+ sensor->sensor_gpio_res = NULL;
+ for (i=0; i<RK29_CAM_SUPPORT_NUMS;i++) {
+ if (sensor->sensor_io_request->gpio_res[i].dev_name &&
+ (strcmp(sensor->sensor_io_request->gpio_res[i].dev_name, dev_name(icd->pdev)) == 0)) {
+ sensor->sensor_gpio_res = (struct rk29camera_gpio_res*)&sensor->sensor_io_request->gpio_res[i];
+ }
+ }
+ if (sensor->sensor_gpio_res == NULL) {
+ SENSOR_TR("%s %s obtain gpio resource failed when RK29_CAM_SUBDEV_IOREQUEST \n",SENSOR_NAME_STRING(),__FUNCTION__);
+ ret = -EINVAL;
+ goto sensor_ioctl_end;
}
} else {
SENSOR_TR("%s %s RK29_CAM_SUBDEV_IOREQUEST fail\n",SENSOR_NAME_STRING(),__FUNCTION__);
ret = -EINVAL;
goto sensor_ioctl_end;
- }
+ }\r
/* ddl@rock-chips.com : if gpio_flash havn't been set in board-xxx.c, sensor driver must notify is not support flash control
for this project */
#if CONFIG_SENSOR_Flash
struct i2c_client *client = v4l2_get_subdevdata(sd);
struct sensor *sensor = to_sensor(client);
const struct sensor_datafmt *fmt;
- int ret = 0;
+ int ret = 0,set_w,set_h;
fmt = sensor_find_datafmt(mf->code, sensor_colour_fmts,
ARRAY_SIZE(sensor_colour_fmts));
else if (mf->width < SENSOR_MIN_WIDTH)
mf->width = SENSOR_MIN_WIDTH;
+ set_w = mf->width;
+ set_h = mf->height;
+
+ if (((set_w <= 176) && (set_h <= 144)) && sensor_qcif[0].reg)
+ {
+ set_w = 176;
+ set_h = 144;
+ }
+ else if (((set_w <= 320) && (set_h <= 240)) && sensor_qvga[0].reg)
+ {
+ set_w = 320;
+ set_h = 240;
+ }
+ else if (((set_w <= 352) && (set_h<= 288)) && sensor_cif[0].reg)
+ {
+ set_w = 352;
+ set_h = 288;
+ }
+ else if (((set_w <= 640) && (set_h <= 480)) && sensor_vga[0].reg)
+ {
+ set_w = 640;
+ set_h = 480;
+ }
+ else if (((set_w <= 800) && (set_h <= 600)) && sensor_svga[0].reg)
+ {
+ set_w = 800;
+ set_h = 600;
+ }
+ else if (((set_w <= 1024) && (set_h <= 768)) && sensor_xga[0].reg)
+ {
+ set_w = 1024;
+ set_h = 768;
+ }
+ else if (((set_w <= 1280) && (set_h <= 1024)) && sensor_sxga[0].reg)
+ {
+ set_w = 1280;
+ set_h = 1024;
+ }
+ else if (((set_w <= 1600) && (set_h <= 1200)) && sensor_uxga[0].reg)
+ {
+ set_w = 1600;
+ set_h = 1200;
+ }
+
+ mf->width = set_w;
+ mf->height = set_h;
mf->colorspace = fmt->colorspace;
return ret;
case RK29_CAM_SUBDEV_IOREQUEST:
{
- sensor->sensor_io_request = (struct rk29camera_platform_data*)arg;
+ sensor->sensor_io_request = (struct rk29camera_platform_data*)arg;
if (sensor->sensor_io_request != NULL) {
- if (sensor->sensor_io_request->gpio_res[0].dev_name &&
- (strcmp(sensor->sensor_io_request->gpio_res[0].dev_name, dev_name(icd->pdev)) == 0)) {
- sensor->sensor_gpio_res = (struct rk29camera_gpio_res*)&sensor->sensor_io_request->gpio_res[0];
- } else if (sensor->sensor_io_request->gpio_res[1].dev_name &&
- (strcmp(sensor->sensor_io_request->gpio_res[1].dev_name, dev_name(icd->pdev)) == 0)) {
- sensor->sensor_gpio_res = (struct rk29camera_gpio_res*)&sensor->sensor_io_request->gpio_res[1];
+ sensor->sensor_gpio_res = NULL;
+ for (i=0; i<RK29_CAM_SUPPORT_NUMS;i++) {
+ if (sensor->sensor_io_request->gpio_res[i].dev_name &&
+ (strcmp(sensor->sensor_io_request->gpio_res[i].dev_name, dev_name(icd->pdev)) == 0)) {
+ sensor->sensor_gpio_res = (struct rk29camera_gpio_res*)&sensor->sensor_io_request->gpio_res[i];
+ }
+ }
+ if (sensor->sensor_gpio_res == NULL) {
+ SENSOR_TR("%s %s obtain gpio resource failed when RK29_CAM_SUBDEV_IOREQUEST \n",SENSOR_NAME_STRING(),__FUNCTION__);
+ ret = -EINVAL;
+ goto sensor_ioctl_end;
}
} else {
SENSOR_TR("%s %s RK29_CAM_SUBDEV_IOREQUEST fail\n",SENSOR_NAME_STRING(),__FUNCTION__);
struct i2c_client *client = v4l2_get_subdevdata(sd);
struct sensor *sensor = to_sensor(client);
const struct sensor_datafmt *fmt;
- int ret = 0;
+ int ret = 0,set_w,set_h;
fmt = sensor_find_datafmt(mf->code, sensor_colour_fmts,
ARRAY_SIZE(sensor_colour_fmts));
else if (mf->width < SENSOR_MIN_WIDTH)
mf->width = SENSOR_MIN_WIDTH;
+ set_w = mf->width;
+ set_h = mf->height;
+
+ if (((set_w <= 176) && (set_h <= 144)) && sensor_qcif[0].reg)
+ {
+ set_w = 176;
+ set_h = 144;
+ }
+ else if (((set_w <= 320) && (set_h <= 240)) && sensor_qvga[0].reg)
+ {
+ set_w = 320;
+ set_h = 240;
+ }
+ else if (((set_w <= 352) && (set_h<= 288)) && sensor_cif[0].reg)
+ {
+ set_w = 352;
+ set_h = 288;
+ }
+ else if (((set_w <= 640) && (set_h <= 480)) && sensor_vga[0].reg)
+ {
+ set_w = 640;
+ set_h = 480;
+ }
+ else if (((set_w <= 800) && (set_h <= 600)) && sensor_svga[0].reg)
+ {
+ set_w = 800;
+ set_h = 600;
+ }
+ else if (((set_w <= 1280) && (set_h <= 720)) && sensor_720p[0].reg)
+ {
+ set_w = 1280;
+ set_h = 720;
+ }
+ else if (((set_w <= 1024) && (set_h <= 768)) && sensor_xga[0].reg)
+ {
+ set_w = 1024;
+ set_h = 768;
+ }
+ else if (((set_w <= 1280) && (set_h <= 1024)) && sensor_sxga[0].reg)
+ {
+ set_w = 1280;
+ set_h = 1024;
+ }
+ else if (((set_w <= 1600) && (set_h <= 1200)) && sensor_uxga[0].reg)
+ {
+ set_w = 1600;
+ set_h = 1200;
+ }
+ else
+ { /* ddl@rock-chips.com : Sensor output smallest size if isn't support app */
+ set_w = SENSOR_INIT_WIDTH;
+ set_h = SENSOR_INIT_HEIGHT;
+ }
+
+ mf->width = set_w;
+ mf->height = set_h;
mf->colorspace = fmt->colorspace;
return ret;
{
sensor->sensor_io_request = (struct rk29camera_platform_data*)arg;
if (sensor->sensor_io_request != NULL) {
- if (sensor->sensor_io_request->gpio_res[0].dev_name &&
- (strcmp(sensor->sensor_io_request->gpio_res[0].dev_name, dev_name(icd->pdev)) == 0)) {
- sensor->sensor_gpio_res = (struct rk29camera_gpio_res*)&sensor->sensor_io_request->gpio_res[0];
- } else if (sensor->sensor_io_request->gpio_res[1].dev_name &&
- (strcmp(sensor->sensor_io_request->gpio_res[1].dev_name, dev_name(icd->pdev)) == 0)) {
- sensor->sensor_gpio_res = (struct rk29camera_gpio_res*)&sensor->sensor_io_request->gpio_res[1];
+ sensor->sensor_gpio_res = NULL;
+ for (i=0; i<RK29_CAM_SUPPORT_NUMS;i++) {
+ if (sensor->sensor_io_request->gpio_res[i].dev_name &&
+ (strcmp(sensor->sensor_io_request->gpio_res[i].dev_name, dev_name(icd->pdev)) == 0)) {
+ sensor->sensor_gpio_res = (struct rk29camera_gpio_res*)&sensor->sensor_io_request->gpio_res[i];
+ }
+ }
+ if (sensor->sensor_gpio_res == NULL) {
+ SENSOR_TR("%s %s obtain gpio resource failed when RK29_CAM_SUBDEV_IOREQUEST \n",SENSOR_NAME_STRING(),__FUNCTION__);
+ ret = -EINVAL;
+ goto sensor_ioctl_end;
}
} else {
SENSOR_TR("%s %s RK29_CAM_SUBDEV_IOREQUEST fail\n",SENSOR_NAME_STRING(),__FUNCTION__);
}
case RK29_CAM_SUBDEV_IOREQUEST:
{
- sensor->sensor_io_request = (struct rk29camera_platform_data*)arg;
+ sensor->sensor_io_request = (struct rk29camera_platform_data*)arg;
if (sensor->sensor_io_request != NULL) {
- if (sensor->sensor_io_request->gpio_res[0].dev_name &&
- (strcmp(sensor->sensor_io_request->gpio_res[0].dev_name, dev_name(icd->pdev)) == 0)) {
- sensor->sensor_gpio_res = (struct rk29camera_gpio_res*)&sensor->sensor_io_request->gpio_res[0];
- } else if (sensor->sensor_io_request->gpio_res[1].dev_name &&
- (strcmp(sensor->sensor_io_request->gpio_res[1].dev_name, dev_name(icd->pdev)) == 0)) {
- sensor->sensor_gpio_res = (struct rk29camera_gpio_res*)&sensor->sensor_io_request->gpio_res[1];
+ sensor->sensor_gpio_res = NULL;
+ for (i=0; i<RK29_CAM_SUPPORT_NUMS;i++) {
+ if (sensor->sensor_io_request->gpio_res[i].dev_name &&
+ (strcmp(sensor->sensor_io_request->gpio_res[i].dev_name, dev_name(icd->pdev)) == 0)) {
+ sensor->sensor_gpio_res = (struct rk29camera_gpio_res*)&sensor->sensor_io_request->gpio_res[i];
+ }
+ }
+ if (sensor->sensor_gpio_res == NULL) {
+ SENSOR_TR("%s %s obtain gpio resource failed when RK29_CAM_SUBDEV_IOREQUEST \n",SENSOR_NAME_STRING(),__FUNCTION__);
+ ret = -EINVAL;
+ goto sensor_ioctl_end;
}
} else {
SENSOR_TR("%s %s RK29_CAM_SUBDEV_IOREQUEST fail\n",SENSOR_NAME_STRING(),__FUNCTION__);
struct i2c_client *client = v4l2_get_subdevdata(sd);
struct sensor *sensor = to_sensor(client);
const struct sensor_datafmt *fmt;
- int ret = 0;
+ int ret = 0,set_w,set_h;
fmt = sensor_find_datafmt(mf->code, sensor_colour_fmts,
ARRAY_SIZE(sensor_colour_fmts));
else if (mf->width < SENSOR_MIN_WIDTH)
mf->width = SENSOR_MIN_WIDTH;
+ set_w = mf->width;
+ set_h = mf->height;
+
+ if (((set_w <= 176) && (set_h <= 144)) && sensor_qcif[0].reg)
+ {
+ set_w = 176;
+ set_h = 144;
+ }
+ else if (((set_w <= 320) && (set_h <= 240)) && sensor_qvga[0].reg)
+ {
+ set_w = 320;
+ set_h = 240;
+ }
+ else if (((set_w <= 352) && (set_h<= 288)) && sensor_cif[0].reg)
+ {
+ set_w = 352;
+ set_h = 288;
+ }
+ else if (((set_w <= 640) && (set_h <= 480)) && sensor_vga[0].reg)
+ {
+ set_w = 640;
+ set_h = 480;
+ }
+ else if (((set_w <= 800) && (set_h <= 600)) && sensor_svga[0].reg)
+ {
+ set_w = 800;
+ set_h = 600;
+ }
+ else if (((set_w <= 1024) && (set_h <= 768)) && sensor_xga[0].reg)
+ {
+ set_w = 1024;
+ set_h = 768;
+ }
+ else if (((set_w <= 1280) && (set_h <= 720)) && sensor_720p[0].reg)
+ {
+ set_w = 1280;
+ set_h = 720;
+ }
+ else if (((set_w <= 1280) && (set_h <= 1024)) && sensor_sxga[0].reg)
+ {
+ set_w = 1280;
+ set_h = 1024;
+ }
+ else if (((set_w <= 1600) && (set_h <= 1200)) && sensor_uxga[0].reg)
+ {
+ set_w = 1600;
+ set_h = 1200;
+ }
+ else if (((set_w <= 1920) && (set_h <= 1080)) && sensor_1080p[0].reg)
+ {
+ set_w = 1920;
+ set_h = 1080;
+ }
+ else if (((set_w <= 2048) && (set_h <= 1536)) && sensor_qxga[0].reg)
+ {
+ set_w = 2048;
+ set_h = 1536;
+ }
+ else if (((set_w <= 2592) && (set_h <= 1944)) && sensor_qsxga[0].reg)
+ {
+ set_w = 2592;
+ set_h = 1944;
+ }
+ else
+ {
+ set_w = SENSOR_INIT_WIDTH;
+ set_h = SENSOR_INIT_HEIGHT;
+ }
+
+ mf->width = set_w;
+ mf->height = set_h;
+
mf->colorspace = fmt->colorspace;
return ret;
break;
}
case RK29_CAM_SUBDEV_IOREQUEST:
- {
- sensor->sensor_io_request = (struct rk29camera_platform_data*)arg;
-
+ {
+ sensor->sensor_io_request = (struct rk29camera_platform_data*)arg;
if (sensor->sensor_io_request != NULL) {
- if (sensor->sensor_io_request->gpio_res[0].dev_name &&
- (strcmp(sensor->sensor_io_request->gpio_res[0].dev_name, dev_name(icd->pdev)) == 0)) {
- sensor->sensor_gpio_res = (struct rk29camera_gpio_res*)&sensor->sensor_io_request->gpio_res[0];
- } else if (sensor->sensor_io_request->gpio_res[1].dev_name &&
- (strcmp(sensor->sensor_io_request->gpio_res[1].dev_name, dev_name(icd->pdev)) == 0)) {
- sensor->sensor_gpio_res = (struct rk29camera_gpio_res*)&sensor->sensor_io_request->gpio_res[1];
+ sensor->sensor_gpio_res = NULL;
+ for (i=0; i<RK29_CAM_SUPPORT_NUMS;i++) {
+ if (sensor->sensor_io_request->gpio_res[i].dev_name &&
+ (strcmp(sensor->sensor_io_request->gpio_res[i].dev_name, dev_name(icd->pdev)) == 0)) {
+ sensor->sensor_gpio_res = (struct rk29camera_gpio_res*)&sensor->sensor_io_request->gpio_res[i];
+ }
+ }
+ if (sensor->sensor_gpio_res == NULL) {
+ SENSOR_TR("%s %s obtain gpio resource failed when RK29_CAM_SUBDEV_IOREQUEST \n",SENSOR_NAME_STRING(),__FUNCTION__);
+ ret = -EINVAL;
+ goto sensor_ioctl_end;
}
} else {
SENSOR_TR("%s %s RK29_CAM_SUBDEV_IOREQUEST fail\n",SENSOR_NAME_STRING(),__FUNCTION__);
struct i2c_client *client = v4l2_get_subdevdata(sd);
struct sensor *sensor = to_sensor(client);
const struct sensor_datafmt *fmt;
- int ret = 0;
+ int ret = 0,set_w,set_h;
fmt = sensor_find_datafmt(mf->code, sensor_colour_fmts,
ARRAY_SIZE(sensor_colour_fmts));
mf->width = SENSOR_MAX_WIDTH;
else if (mf->width < SENSOR_MIN_WIDTH)
mf->width = SENSOR_MIN_WIDTH;
+
+ set_w = mf->width;
+ set_h = mf->height;
+ if (((set_w <= 176) && (set_h <= 144)) && sensor_qcif[0].reg)
+ {
+ set_w = 176;
+ set_h = 144;
+ }
+ else if (((set_w <= 320) && (set_h <= 240)) && sensor_qvga[0].reg)
+ {
+ set_w = 320;
+ set_h = 240;
+ }
+ else if (((set_w <= 352) && (set_h<= 288)) && sensor_cif[0].reg)
+ {
+ set_w = 352;
+ set_h = 288;
+ }
+ else if (((set_w <= 640) && (set_h <= 480)) && sensor_vga[0].reg)
+ {
+ set_w = 640;
+ set_h = 480;
+ }
+ else if (((set_w <= 800) && (set_h <= 600)) && sensor_svga[0].reg)
+ {
+ set_w = 800;
+ set_h = 600;
+ }
+ else if (((set_w <= 1280) && (set_h <= 1024)) && sensor_sxga[0].reg)
+ {
+ set_w = 1280;
+ set_h = 1024;
+ }
+ else
+ {
+ set_w = SENSOR_INIT_WIDTH;
+ set_h = SENSOR_INIT_HEIGHT;
+ }
+
+ mf->width = set_w;
+ mf->height = set_h;
mf->colorspace = fmt->colorspace;
return ret;
{
sensor->sensor_io_request = (struct rk29camera_platform_data*)arg;
if (sensor->sensor_io_request != NULL) {
- if (sensor->sensor_io_request->gpio_res[0].dev_name &&
- (strcmp(sensor->sensor_io_request->gpio_res[0].dev_name, dev_name(icd->pdev)) == 0)) {
- sensor->sensor_gpio_res = (struct rk29camera_gpio_res*)&sensor->sensor_io_request->gpio_res[0];
- } else if (sensor->sensor_io_request->gpio_res[1].dev_name &&
- (strcmp(sensor->sensor_io_request->gpio_res[1].dev_name, dev_name(icd->pdev)) == 0)) {
- sensor->sensor_gpio_res = (struct rk29camera_gpio_res*)&sensor->sensor_io_request->gpio_res[1];
+ sensor->sensor_gpio_res = NULL;
+ for (i=0; i<RK29_CAM_SUPPORT_NUMS;i++) {
+ if (sensor->sensor_io_request->gpio_res[i].dev_name &&
+ (strcmp(sensor->sensor_io_request->gpio_res[i].dev_name, dev_name(icd->pdev)) == 0)) {
+ sensor->sensor_gpio_res = (struct rk29camera_gpio_res*)&sensor->sensor_io_request->gpio_res[i];
+ }
+ }
+ if (sensor->sensor_gpio_res == NULL) {
+ SENSOR_TR("%s %s obtain gpio resource failed when RK29_CAM_SUBDEV_IOREQUEST \n",SENSOR_NAME_STRING(),__FUNCTION__);
+ ret = -EINVAL;
+ goto sensor_ioctl_end;
}
} else {
SENSOR_TR("%s %s RK29_CAM_SUBDEV_IOREQUEST fail\n",SENSOR_NAME_STRING(),__FUNCTION__);
#define PMEM_CAM_NECESSARY 0x1200000\r
#define PMEM_CAMIPP_NECESSARY 0x800000\r
#endif\r
+\r
+#if CONFIG_VIDEO_RK29_CAMMEM_ION\r
+#undef PMEM_CAM_NECESSARY\r
+#define PMEM_CAM_NECESSARY 0x00000000\r
+#endif\r
+\r
/*---------------- Camera Sensor Fixed Macro End ------------------------*/\r
#else //#ifdef CONFIG_VIDEO_RK29 \r
#define PMEM_CAM_NECESSARY 0x00000000\r
*****************************************************************************************/\r
#ifdef CONFIG_VIDEO_RK29 \r
static int camera_debug;\r
-module_param(camera_debug, int, S_IRUGO|S_IWUSR);\r
+module_param(camera_debug, int, S_IRUGO|S_IWUSR|S_IWGRP);\r
\r
#define ddprintk(level, fmt, arg...) do { \\r
if (camera_debug >= level) \\r
\r
#define dprintk(format, ...) ddprintk(1, format, ## __VA_ARGS__) \r
\r
-#define SENSOR_NAME_0 STR(CONFIG_SENSOR_0) /* back camera sensor */\r
-#define SENSOR_NAME_1 STR(CONFIG_SENSOR_1) /* front camera sensor */\r
+#define SENSOR_NAME_0 STR(CONFIG_SENSOR_0) /* back camera sensor 0 */\r
#define SENSOR_DEVICE_NAME_0 STR(CONS(CONFIG_SENSOR_0, _back))\r
+#ifdef CONFIG_SENSOR_01\r
+#define SENSOR_NAME_01 STR(CONFIG_SENSOR_01) /* back camera sensor 1 */\r
+#define SENSOR_DEVICE_NAME_01 STR(CONS(CONFIG_SENSOR_01, _back_1))\r
+#endif\r
+#ifdef CONFIG_SENSOR_02\r
+#define SENSOR_NAME_02 STR(CONFIG_SENSOR_02) /* back camera sensor 2 */\r
+#define SENSOR_DEVICE_NAME_02 STR(CONS(CONFIG_SENSOR_02, _back_2))\r
+#endif\r
+#define SENSOR_NAME_1 STR(CONFIG_SENSOR_1) /* front camera sensor 0 */\r
#define SENSOR_DEVICE_NAME_1 STR(CONS(CONFIG_SENSOR_1, _front))\r
+#ifdef CONFIG_SENSOR_11\r
+#define SENSOR_NAME_11 STR(CONFIG_SENSOR_11) /* front camera sensor 1 */\r
+#define SENSOR_DEVICE_NAME_11 STR(CONS(CONFIG_SENSOR_11, _front_1))\r
+#endif\r
+#ifdef CONFIG_SENSOR_12\r
+#define SENSOR_NAME_12 STR(CONFIG_SENSOR_12) /* front camera sensor 2 */\r
+#define SENSOR_DEVICE_NAME_12 STR(CONS(CONFIG_SENSOR_12, _front_2))\r
+#endif\r
+\r
\r
static int rk29_sensor_io_init(void);\r
static int rk29_sensor_io_deinit(int sensor);\r
.gpio_flash = CONFIG_SENSOR_FALSH_PIN_0,\r
.gpio_flag = (CONFIG_SENSOR_POWERACTIVE_LEVEL_0|CONFIG_SENSOR_RESETACTIVE_LEVEL_0|CONFIG_SENSOR_POWERDNACTIVE_LEVEL_0|CONFIG_SENSOR_FLASHACTIVE_LEVEL_0),\r
.gpio_init = 0, \r
- .dev_name = SENSOR_DEVICE_NAME_0,\r
+ .dev_name = SENSOR_DEVICE_NAME_0, \r
+ }, {\r
+ #ifdef CONFIG_SENSOR_01\r
+ .gpio_reset = CONFIG_SENSOR_RESET_PIN_01,\r
+ .gpio_power = CONFIG_SENSOR_POWER_PIN_01,\r
+ .gpio_powerdown = CONFIG_SENSOR_POWERDN_PIN_01,\r
+ .gpio_flash = CONFIG_SENSOR_FALSH_PIN_01,\r
+ .gpio_flag = (CONFIG_SENSOR_POWERACTIVE_LEVEL_01|CONFIG_SENSOR_RESETACTIVE_LEVEL_01|CONFIG_SENSOR_POWERDNACTIVE_LEVEL_01|CONFIG_SENSOR_FLASHACTIVE_LEVEL_01),\r
+ .gpio_init = 0, \r
+ .dev_name = SENSOR_DEVICE_NAME_01,\r
+ #else\r
+ .gpio_reset = INVALID_GPIO,\r
+ .gpio_power = INVALID_GPIO,\r
+ .gpio_powerdown = INVALID_GPIO,\r
+ .gpio_flash = INVALID_GPIO,\r
+ .gpio_flag = 0,\r
+ .gpio_init = 0, \r
+ .dev_name = NULL,\r
+ #endif\r
+ }, {\r
+ #ifdef CONFIG_SENSOR_02\r
+ .gpio_reset = CONFIG_SENSOR_RESET_PIN_02,\r
+ .gpio_power = CONFIG_SENSOR_POWER_PIN_02,\r
+ .gpio_powerdown = CONFIG_SENSOR_POWERDN_PIN_02,\r
+ .gpio_flash = CONFIG_SENSOR_FALSH_PIN_02,\r
+ .gpio_flag = (CONFIG_SENSOR_POWERACTIVE_LEVEL_02|CONFIG_SENSOR_RESETACTIVE_LEVEL_02|CONFIG_SENSOR_POWERDNACTIVE_LEVEL_02|CONFIG_SENSOR_FLASHACTIVE_LEVEL_02),\r
+ .gpio_init = 0, \r
+ .dev_name = SENSOR_DEVICE_NAME_02, \r
+ #else\r
+ .gpio_reset = INVALID_GPIO,\r
+ .gpio_power = INVALID_GPIO,\r
+ .gpio_powerdown = INVALID_GPIO,\r
+ .gpio_flash = INVALID_GPIO,\r
+ .gpio_flag = 0,\r
+ .gpio_init = 0, \r
+ .dev_name = NULL,\r
+ #endif\r
}, {\r
.gpio_reset = CONFIG_SENSOR_RESET_PIN_1,\r
.gpio_power = CONFIG_SENSOR_POWER_PIN_1,\r
.gpio_flag = (CONFIG_SENSOR_POWERACTIVE_LEVEL_1|CONFIG_SENSOR_RESETACTIVE_LEVEL_1|CONFIG_SENSOR_POWERDNACTIVE_LEVEL_1|CONFIG_SENSOR_FLASHACTIVE_LEVEL_1),\r
.gpio_init = 0,\r
.dev_name = SENSOR_DEVICE_NAME_1,\r
+ },{\r
+ #ifdef CONFIG_SENSOR_11\r
+ .gpio_reset = CONFIG_SENSOR_RESET_PIN_11,\r
+ .gpio_power = CONFIG_SENSOR_POWER_PIN_11,\r
+ .gpio_powerdown = CONFIG_SENSOR_POWERDN_PIN_11,\r
+ .gpio_flash = CONFIG_SENSOR_FALSH_PIN_11,\r
+ .gpio_flag = (CONFIG_SENSOR_POWERACTIVE_LEVEL_11|CONFIG_SENSOR_RESETACTIVE_LEVEL_11|CONFIG_SENSOR_POWERDNACTIVE_LEVEL_11|CONFIG_SENSOR_FLASHACTIVE_LEVEL_11),\r
+ .gpio_init = 0,\r
+ .dev_name = SENSOR_DEVICE_NAME_11,\r
+ #else\r
+ .gpio_reset = INVALID_GPIO,\r
+ .gpio_power = INVALID_GPIO,\r
+ .gpio_powerdown = INVALID_GPIO,\r
+ .gpio_flash = INVALID_GPIO,\r
+ .gpio_flag = 0,\r
+ .gpio_init = 0, \r
+ .dev_name = NULL,\r
+ #endif \r
+ }, {\r
+ #ifdef CONFIG_SENSOR_12\r
+ .gpio_reset = CONFIG_SENSOR_RESET_PIN_12,\r
+ .gpio_power = CONFIG_SENSOR_POWER_PIN_12,\r
+ .gpio_powerdown = CONFIG_SENSOR_POWERDN_PIN_12,\r
+ .gpio_flash = CONFIG_SENSOR_FALSH_PIN_12,\r
+ .gpio_flag = (CONFIG_SENSOR_POWERACTIVE_LEVEL_12|CONFIG_SENSOR_RESETACTIVE_LEVEL_12|CONFIG_SENSOR_POWERDNACTIVE_LEVEL_12|CONFIG_SENSOR_FLASHACTIVE_LEVEL_12),\r
+ .gpio_init = 0,\r
+ .dev_name = SENSOR_DEVICE_NAME_12,\r
+ #else\r
+ .gpio_reset = INVALID_GPIO,\r
+ .gpio_power = INVALID_GPIO,\r
+ .gpio_powerdown = INVALID_GPIO,\r
+ .gpio_flash = INVALID_GPIO,\r
+ .gpio_flag = 0,\r
+ .gpio_init = 0, \r
+ .dev_name = NULL,\r
+ #endif\r
}\r
},\r
#ifdef CONFIG_VIDEO_RK29_WORK_IPP\r
.info = {\r
{\r
.dev_name = SENSOR_DEVICE_NAME_0,\r
- .orientation = CONFIG_SENSOR_ORIENTATION_0, \r
+ .orientation = CONFIG_SENSOR_ORIENTATION_0, \r
+ #ifdef CONFIG_SENSOR_01\r
+ },{\r
+ .dev_name = SENSOR_DEVICE_NAME_01,\r
+ .orientation = CONFIG_SENSOR_ORIENTATION_01, \r
+ #else\r
+ },{\r
+ .dev_name = NULL,\r
+ .orientation = 0x00, \r
+ #endif\r
+ #ifdef CONFIG_SENSOR_02\r
},{\r
+ .dev_name = SENSOR_DEVICE_NAME_02,\r
+ .orientation = CONFIG_SENSOR_ORIENTATION_02, \r
+ #else\r
+ },{\r
+ .dev_name = NULL,\r
+ .orientation = 0x00, \r
+ #endif\r
+ },{\r
.dev_name = SENSOR_DEVICE_NAME_1,\r
.orientation = CONFIG_SENSOR_ORIENTATION_1,\r
- }\r
+ #ifdef CONFIG_SENSOR_11 \r
+ },{\r
+ .dev_name = SENSOR_DEVICE_NAME_11,\r
+ .orientation = CONFIG_SENSOR_ORIENTATION_11, \r
+ #else\r
+ },{\r
+ .dev_name = NULL,\r
+ .orientation = 0x00, \r
+ #endif\r
+ #ifdef CONFIG_SENSOR_12\r
+ },{\r
+ .dev_name = SENSOR_DEVICE_NAME_12,\r
+ .orientation = CONFIG_SENSOR_ORIENTATION_12, \r
+ #else\r
+ },{\r
+ .dev_name = NULL,\r
+ .orientation = 0x00, \r
+ #endif\r
+ }\r
}\r
};\r
\r
int ret = 0;\r
\r
if (camera_power != INVALID_GPIO) {\r
- if (camera_io_init & RK29_CAM_POWERACTIVE_MASK) {\r
+ if (camera_io_init & RK29_CAM_POWERACTIVE_MASK) {\r
if (on) {\r
gpio_set_value(camera_power, ((camera_ioflag&RK29_CAM_POWERACTIVE_MASK)>>RK29_CAM_POWERACTIVE_BITPOS));\r
dprintk("%s..%s..PowerPin=%d ..PinLevel = %x \n",__FUNCTION__,res->dev_name, camera_power, ((camera_ioflag&RK29_CAM_POWERACTIVE_MASK)>>RK29_CAM_POWERACTIVE_BITPOS));\r
return ret;\r
}\r
\r
-\r
+static void rk29_sensor_fps_get(int idx, unsigned int *val, int w, int h)\r
+{\r
+ switch (idx)\r
+ {\r
+ case 0:\r
+ {\r
+ if ((w==176) && (h==144)) {\r
+ *val = CONFIG_SENSOR_QCIF_FPS_FIXED_0;\r
+ #ifdef CONFIG_SENSOR_240X160_FPS_FIXED_0\r
+ } else if ((w==240) && (h==160)) {\r
+ *val = CONFIG_SENSOR_240X160_FPS_FIXED_0;\r
+ #endif\r
+ } else if ((w==320) && (h==240)) {\r
+ *val = CONFIG_SENSOR_QVGA_FPS_FIXED_0;\r
+ } else if ((w==352) && (h==288)) {\r
+ *val = CONFIG_SENSOR_CIF_FPS_FIXED_0;\r
+ } else if ((w==640) && (h==480)) {\r
+ *val = CONFIG_SENSOR_VGA_FPS_FIXED_0;\r
+ } else if ((w==720) && (h==480)) {\r
+ *val = CONFIG_SENSOR_480P_FPS_FIXED_0;\r
+ } else if ((w==1280) && (h==720)) {\r
+ *val = CONFIG_SENSOR_720P_FPS_FIXED_0;\r
+ }\r
+ break;\r
+ }\r
+ #ifdef CONFIG_SENSOR_01\r
+ case 1:\r
+ {\r
+ if ((w==176) && (h==144)) {\r
+ *val = CONFIG_SENSOR_QCIF_FPS_FIXED_01;\r
+ #ifdef CONFIG_SENSOR_240X160_FPS_FIXED_01\r
+ } else if ((w==240) && (h==160)) {\r
+ *val = CONFIG_SENSOR_240X160_FPS_FIXED_01;\r
+ #endif\r
+ } else if ((w==320) && (h==240)) {\r
+ *val = CONFIG_SENSOR_QVGA_FPS_FIXED_01;\r
+ } else if ((w==352) && (h==288)) {\r
+ *val = CONFIG_SENSOR_CIF_FPS_FIXED_01;\r
+ } else if ((w==640) && (h==480)) {\r
+ *val = CONFIG_SENSOR_VGA_FPS_FIXED_01;\r
+ } else if ((w==720) && (h==480)) {\r
+ *val = CONFIG_SENSOR_480P_FPS_FIXED_01;\r
+ } else if ((w==1280) && (h==720)) {\r
+ *val = CONFIG_SENSOR_720P_FPS_FIXED_01;\r
+ }\r
+ break;\r
+ }\r
+ #endif\r
+ #ifdef CONFIG_SENSOR_02\r
+ case 2:\r
+ {\r
+ if ((w==176) && (h==144)) {\r
+ *val = CONFIG_SENSOR_QCIF_FPS_FIXED_02;\r
+ #ifdef CONFIG_SENSOR_240X160_FPS_FIXED_02\r
+ } else if ((w==240) && (h==160)) {\r
+ *val = CONFIG_SENSOR_240X160_FPS_FIXED_02;\r
+ #endif\r
+ } else if ((w==320) && (h==240)) {\r
+ *val = CONFIG_SENSOR_QVGA_FPS_FIXED_02;\r
+ } else if ((w==352) && (h==288)) {\r
+ *val = CONFIG_SENSOR_CIF_FPS_FIXED_02;\r
+ } else if ((w==640) && (h==480)) {\r
+ *val = CONFIG_SENSOR_VGA_FPS_FIXED_02;\r
+ } else if ((w==720) && (h==480)) {\r
+ *val = CONFIG_SENSOR_480P_FPS_FIXED_02;\r
+ } else if ((w==1280) && (h==720)) {\r
+ *val = CONFIG_SENSOR_720P_FPS_FIXED_02;\r
+ }\r
+ break;\r
+ }\r
+ #endif\r
+ \r
+ case 3:\r
+ {\r
+ if ((w==176) && (h==144)) {\r
+ *val = CONFIG_SENSOR_QCIF_FPS_FIXED_1;\r
+ #ifdef CONFIG_SENSOR_240X160_FPS_FIXED_1\r
+ } else if ((w==240) && (h==160)) {\r
+ *val = CONFIG_SENSOR_240X160_FPS_FIXED_1;\r
+ #endif\r
+ } else if ((w==320) && (h==240)) {\r
+ *val = CONFIG_SENSOR_QVGA_FPS_FIXED_1;\r
+ } else if ((w==352) && (h==288)) {\r
+ *val = CONFIG_SENSOR_CIF_FPS_FIXED_1;\r
+ } else if ((w==640) && (h==480)) {\r
+ *val = CONFIG_SENSOR_VGA_FPS_FIXED_1;\r
+ } else if ((w==720) && (h==480)) {\r
+ *val = CONFIG_SENSOR_480P_FPS_FIXED_1;\r
+ } else if ((w==1280) && (h==720)) {\r
+ *val = CONFIG_SENSOR_720P_FPS_FIXED_1;\r
+ }\r
+ break;\r
+ }\r
+ #ifdef CONFIG_SENSOR_11\r
+ case 4:\r
+ {\r
+ if ((w==176) && (h==144)) {\r
+ *val = CONFIG_SENSOR_QCIF_FPS_FIXED_11;\r
+ #ifdef CONFIG_SENSOR_240X160_FPS_FIXED_11\r
+ } else if ((w==240) && (h==160)) {\r
+ *val = CONFIG_SENSOR_240X160_FPS_FIXED_11;\r
+ #endif\r
+ } else if ((w==320) && (h==240)) {\r
+ *val = CONFIG_SENSOR_QVGA_FPS_FIXED_11;\r
+ } else if ((w==352) && (h==288)) {\r
+ *val = CONFIG_SENSOR_CIF_FPS_FIXED_11;\r
+ } else if ((w==640) && (h==480)) {\r
+ *val = CONFIG_SENSOR_VGA_FPS_FIXED_11;\r
+ } else if ((w==720) && (h==480)) {\r
+ *val = CONFIG_SENSOR_480P_FPS_FIXED_11;\r
+ } else if ((w==1280) && (h==720)) {\r
+ *val = CONFIG_SENSOR_720P_FPS_FIXED_11;\r
+ }\r
+ break;\r
+ }\r
+ #endif\r
+ #ifdef CONFIG_SENSOR_12\r
+ case 5:\r
+ {\r
+ if ((w==176) && (h==144)) {\r
+ *val = CONFIG_SENSOR_QCIF_FPS_FIXED_12;\r
+ #ifdef CONFIG_SENSOR_240X160_FPS_FIXED_12\r
+ } else if ((w==240) && (h==160)) {\r
+ *val = CONFIG_SENSOR_240X160_FPS_FIXED_12;\r
+ #endif\r
+ } else if ((w==320) && (h==240)) {\r
+ *val = CONFIG_SENSOR_QVGA_FPS_FIXED_12;\r
+ } else if ((w==352) && (h==288)) {\r
+ *val = CONFIG_SENSOR_CIF_FPS_FIXED_12;\r
+ } else if ((w==640) && (h==480)) {\r
+ *val = CONFIG_SENSOR_VGA_FPS_FIXED_12;\r
+ } else if ((w==720) && (h==480)) {\r
+ *val = CONFIG_SENSOR_480P_FPS_FIXED_12;\r
+ } else if ((w==1280) && (h==720)) {\r
+ *val = CONFIG_SENSOR_720P_FPS_FIXED_12;\r
+ }\r
+ break;\r
+ }\r
+ #endif\r
+ default:\r
+ printk(KERN_ERR"rk29_cam_io: sensor-%d have not been define in board file!",idx);\r
+ }\r
+}\r
static int rk29_sensor_io_init(void)\r
{\r
int ret = 0, i,j;\r
if (sensor_ioctl_cb.sensor_flash_cb == NULL)\r
sensor_ioctl_cb.sensor_flash_cb = sensor_flash_default_cb;\r
\r
- for (i=0; i<2; i++) {\r
+ for (i=0; i<RK29_CAM_SUPPORT_NUMS; i++) {\r
+ if (rk29_camera_platform_data.gpio_res[i].dev_name == NULL)\r
+ continue;\r
+ \r
camera_reset = rk29_camera_platform_data.gpio_res[i].gpio_reset;\r
camera_power = rk29_camera_platform_data.gpio_res[i].gpio_power;\r
camera_powerdown = rk29_camera_platform_data.gpio_res[i].gpio_powerdown;\r
printk("%s..%s..power pin(%d) init failed\n",__FUNCTION__,rk29_camera_platform_data.gpio_res[i].dev_name,camera_power);\r
goto sensor_io_int_loop_end;\r
} else {\r
- if (camera_power != rk29_camera_platform_data.gpio_res[0].gpio_power) {\r
+ for (j=0; j<i; j++) {\r
+ if (camera_power == rk29_camera_platform_data.gpio_res[j].gpio_power)\r
+ break;\r
+ }\r
+ if (i==j) {\r
printk("%s..%s..power pin(%d) init failed\n",__FUNCTION__,rk29_camera_platform_data.gpio_res[i].dev_name,camera_power);\r
goto sensor_io_int_loop_end;\r
}\r
if (camera_reset != INVALID_GPIO) {\r
ret = gpio_request(camera_reset, "camera reset");\r
if (ret) {\r
- printk("%s..%s..reset pin(%d) init failed\n",__FUNCTION__,rk29_camera_platform_data.gpio_res[i].dev_name,camera_reset);\r
- goto sensor_io_int_loop_end;\r
+ if (i==1) {\r
+ if ((camera_reset == rk29_camera_platform_data.gpio_res[0].gpio_reset) \r
+ || (camera_reset == rk29_camera_platform_data.gpio_res[2].gpio_reset)) {\r
+ ret = 0;\r
+ }\r
+ }\r
+ if (i==2) {\r
+ if ((camera_reset == rk29_camera_platform_data.gpio_res[0].gpio_reset) \r
+ || (camera_reset == rk29_camera_platform_data.gpio_res[1].gpio_reset)) {\r
+ ret = 0;\r
+ }\r
+ }\r
+ if (i==4) {\r
+ if ((camera_reset == rk29_camera_platform_data.gpio_res[3].gpio_reset) \r
+ || (camera_reset == rk29_camera_platform_data.gpio_res[5].gpio_reset)) {\r
+ ret = 0;\r
+ }\r
+ }\r
+ if (i==5) {\r
+ if ((camera_reset == rk29_camera_platform_data.gpio_res[3].gpio_reset) \r
+ || (camera_reset == rk29_camera_platform_data.gpio_res[4].gpio_reset)) {\r
+ ret = 0;\r
+ }\r
+ }\r
+ if (ret) {\r
+ printk("%s..%s..reset pin(%d) init failed\n",__FUNCTION__,rk29_camera_platform_data.gpio_res[i].dev_name,camera_reset);\r
+ goto sensor_io_int_loop_end;\r
+ }\r
}\r
\r
if (rk29_sensor_iomux(camera_reset) < 0) {\r
if (camera_powerdown != INVALID_GPIO) {\r
ret = gpio_request(camera_powerdown, "camera powerdown");\r
if (ret) {\r
- printk("%s..%s..powerdown pin(%d) init failed\n",__FUNCTION__,rk29_camera_platform_data.gpio_res[i].dev_name,camera_powerdown);\r
- goto sensor_io_int_loop_end;\r
+ if (i==1) {\r
+ if ((camera_powerdown == rk29_camera_platform_data.gpio_res[0].gpio_powerdown) \r
+ || (camera_powerdown == rk29_camera_platform_data.gpio_res[2].gpio_powerdown)) {\r
+ ret = 0;\r
+ }\r
+ }\r
+ if (i==2) {\r
+ if ((camera_powerdown == rk29_camera_platform_data.gpio_res[0].gpio_powerdown) \r
+ || (camera_powerdown == rk29_camera_platform_data.gpio_res[1].gpio_powerdown)) {\r
+ ret = 0;\r
+ }\r
+ }\r
+ if (i==4) {\r
+ if ((camera_powerdown == rk29_camera_platform_data.gpio_res[3].gpio_powerdown) \r
+ || (camera_powerdown == rk29_camera_platform_data.gpio_res[5].gpio_powerdown)) {\r
+ ret = 0;\r
+ }\r
+ }\r
+ if (i==5) {\r
+ if ((camera_powerdown == rk29_camera_platform_data.gpio_res[3].gpio_powerdown) \r
+ || (camera_powerdown == rk29_camera_platform_data.gpio_res[4].gpio_powerdown)) {\r
+ ret = 0;\r
+ }\r
+ }\r
+ if (ret) {\r
+ printk("%s..%s..powerdown pin(%d) init failed\n",__FUNCTION__,rk29_camera_platform_data.gpio_res[i].dev_name,camera_powerdown);\r
+ goto sensor_io_int_loop_end;\r
+ }\r
}\r
\r
if (rk29_sensor_iomux(camera_powerdown) < 0) {\r
if (camera_flash != INVALID_GPIO) {\r
ret = gpio_request(camera_flash, "camera flash");\r
if (ret) {\r
- printk("%s..%s..flash pin(%d) init failed\n",__FUNCTION__,rk29_camera_platform_data.gpio_res[i].dev_name,camera_flash);\r
- goto sensor_io_int_loop_end;\r
+ if (i==1) {\r
+ if ((camera_flash == rk29_camera_platform_data.gpio_res[0].gpio_flash) \r
+ || (camera_flash == rk29_camera_platform_data.gpio_res[2].gpio_flash)) {\r
+ ret = 0;\r
+ }\r
+ }\r
+ if (i==2) {\r
+ if ((camera_flash == rk29_camera_platform_data.gpio_res[0].gpio_flash) \r
+ || (camera_flash == rk29_camera_platform_data.gpio_res[1].gpio_flash)) {\r
+ ret = 0;\r
+ }\r
+ }\r
+ if (i==4) {\r
+ if ((camera_flash == rk29_camera_platform_data.gpio_res[3].gpio_flash) \r
+ || (camera_flash == rk29_camera_platform_data.gpio_res[5].gpio_flash)) {\r
+ ret = 0;\r
+ }\r
+ }\r
+ if (i==5) {\r
+ if ((camera_flash == rk29_camera_platform_data.gpio_res[3].gpio_flash) \r
+ || (camera_flash == rk29_camera_platform_data.gpio_res[4].gpio_flash)) {\r
+ ret = 0;\r
+ }\r
+ }\r
+ if (ret) {\r
+ printk("%s..%s..flash pin(%d) init failed\n",__FUNCTION__,rk29_camera_platform_data.gpio_res[i].dev_name,camera_flash);\r
+ goto sensor_io_int_loop_end;\r
+ }\r
}\r
\r
if (rk29_sensor_iomux(camera_flash) < 0) {\r
\r
for (j=0; j<10; j++) {\r
memset(&rk29_camera_platform_data.info[i].fival[j],0x00,sizeof(struct v4l2_frmivalenum));\r
- }\r
- j=0;\r
- if (strstr(rk29_camera_platform_data.info[i].dev_name,"_back")) {\r
- \r
- #if CONFIG_SENSOR_QCIF_FPS_FIXED_0\r
- rk29_camera_platform_data.info[i].fival[j].discrete.denominator = CONFIG_SENSOR_QCIF_FPS_FIXED_0;\r
- rk29_camera_platform_data.info[i].fival[j].discrete.numerator= 1000;\r
- rk29_camera_platform_data.info[i].fival[j].index = 0;\r
- rk29_camera_platform_data.info[i].fival[j].pixel_format = V4L2_PIX_FMT_NV12;\r
- rk29_camera_platform_data.info[i].fival[j].width = 176;\r
- rk29_camera_platform_data.info[i].fival[j].height = 144;\r
- rk29_camera_platform_data.info[i].fival[j].type = V4L2_FRMIVAL_TYPE_DISCRETE;\r
- j++;\r
- #endif\r
-\r
- #if CONFIG_SENSOR_QVGA_FPS_FIXED_0\r
- rk29_camera_platform_data.info[i].fival[j].discrete.denominator = CONFIG_SENSOR_QVGA_FPS_FIXED_0;\r
- rk29_camera_platform_data.info[i].fival[j].discrete.numerator= 1000;\r
- rk29_camera_platform_data.info[i].fival[j].index = 0;\r
- rk29_camera_platform_data.info[i].fival[j].pixel_format = V4L2_PIX_FMT_NV12;\r
- rk29_camera_platform_data.info[i].fival[j].width = 320;\r
- rk29_camera_platform_data.info[i].fival[j].height = 240;\r
- rk29_camera_platform_data.info[i].fival[j].type = V4L2_FRMIVAL_TYPE_DISCRETE;\r
- j++;\r
- #endif\r
-\r
- #if CONFIG_SENSOR_CIF_FPS_FIXED_0\r
- rk29_camera_platform_data.info[i].fival[j].discrete.denominator = CONFIG_SENSOR_CIF_FPS_FIXED_0;\r
- rk29_camera_platform_data.info[i].fival[j].discrete.numerator= 1000;\r
- rk29_camera_platform_data.info[i].fival[j].index = 0;\r
- rk29_camera_platform_data.info[i].fival[j].pixel_format = V4L2_PIX_FMT_NV12;\r
- rk29_camera_platform_data.info[i].fival[j].width = 352;\r
- rk29_camera_platform_data.info[i].fival[j].height = 288;\r
- rk29_camera_platform_data.info[i].fival[j].type = V4L2_FRMIVAL_TYPE_DISCRETE;\r
- j++;\r
- #endif\r
-\r
- #if CONFIG_SENSOR_VGA_FPS_FIXED_0\r
- rk29_camera_platform_data.info[i].fival[j].discrete.denominator = CONFIG_SENSOR_VGA_FPS_FIXED_0;\r
- rk29_camera_platform_data.info[i].fival[j].discrete.numerator= 1000;\r
- rk29_camera_platform_data.info[i].fival[j].index = 0;\r
- rk29_camera_platform_data.info[i].fival[j].pixel_format = V4L2_PIX_FMT_NV12;\r
- rk29_camera_platform_data.info[i].fival[j].width = 640;\r
- rk29_camera_platform_data.info[i].fival[j].height = 480;\r
- rk29_camera_platform_data.info[i].fival[j].type = V4L2_FRMIVAL_TYPE_DISCRETE;\r
- j++;\r
- #endif\r
-\r
- #if CONFIG_SENSOR_480P_FPS_FIXED_0\r
- rk29_camera_platform_data.info[i].fival[j].discrete.denominator = CONFIG_SENSOR_480P_FPS_FIXED_0;\r
- rk29_camera_platform_data.info[i].fival[j].discrete.numerator= 1000;\r
- rk29_camera_platform_data.info[i].fival[j].index = 0;\r
- rk29_camera_platform_data.info[i].fival[j].pixel_format = V4L2_PIX_FMT_NV12;\r
- rk29_camera_platform_data.info[i].fival[j].width = 720;\r
- rk29_camera_platform_data.info[i].fival[j].height = 480;\r
- rk29_camera_platform_data.info[i].fival[j].type = V4L2_FRMIVAL_TYPE_DISCRETE;\r
- j++;\r
- #endif \r
-\r
- #if CONFIG_SENSOR_SVGA_FPS_FIXED_0\r
- rk29_camera_platform_data.info[i].fival[j].discrete.denominator = CONFIG_SENSOR_SVGA_FPS_FIXED_0;\r
- rk29_camera_platform_data.info[i].fival[j].discrete.numerator= 1000;\r
- rk29_camera_platform_data.info[i].fival[j].index = 0;\r
- rk29_camera_platform_data.info[i].fival[j].pixel_format = V4L2_PIX_FMT_NV12;\r
- rk29_camera_platform_data.info[i].fival[j].width = 800;\r
- rk29_camera_platform_data.info[i].fival[j].height = 600;\r
- rk29_camera_platform_data.info[i].fival[j].type = V4L2_FRMIVAL_TYPE_DISCRETE;\r
- j++;\r
- #endif\r
\r
- #if CONFIG_SENSOR_720P_FPS_FIXED_0\r
- rk29_camera_platform_data.info[i].fival[j].discrete.denominator = CONFIG_SENSOR_720P_FPS_FIXED_0;\r
- rk29_camera_platform_data.info[i].fival[j].discrete.numerator= 1000;\r
- rk29_camera_platform_data.info[i].fival[j].index = 0;\r
- rk29_camera_platform_data.info[i].fival[j].pixel_format = V4L2_PIX_FMT_NV12;\r
- rk29_camera_platform_data.info[i].fival[j].width = 1280;\r
- rk29_camera_platform_data.info[i].fival[j].height = 720;\r
- rk29_camera_platform_data.info[i].fival[j].type = V4L2_FRMIVAL_TYPE_DISCRETE;\r
- j++;\r
- #endif\r
-\r
- } else {\r
- #if CONFIG_SENSOR_QCIF_FPS_FIXED_1\r
- rk29_camera_platform_data.info[i].fival[j].discrete.denominator = CONFIG_SENSOR_QCIF_FPS_FIXED_1;\r
- rk29_camera_platform_data.info[i].fival[j].discrete.numerator= 1000;\r
- rk29_camera_platform_data.info[i].fival[j].index = 0;\r
- rk29_camera_platform_data.info[i].fival[j].pixel_format = V4L2_PIX_FMT_NV12;\r
- rk29_camera_platform_data.info[i].fival[j].width = 176;\r
- rk29_camera_platform_data.info[i].fival[j].height = 144;\r
- rk29_camera_platform_data.info[i].fival[j].type = V4L2_FRMIVAL_TYPE_DISCRETE;\r
- j++;\r
- #endif\r
-\r
- #if CONFIG_SENSOR_QVGA_FPS_FIXED_1\r
- rk29_camera_platform_data.info[i].fival[j].discrete.denominator = CONFIG_SENSOR_QVGA_FPS_FIXED_1;\r
- rk29_camera_platform_data.info[i].fival[j].discrete.numerator= 1000;\r
- rk29_camera_platform_data.info[i].fival[j].index = 0;\r
- rk29_camera_platform_data.info[i].fival[j].pixel_format = V4L2_PIX_FMT_NV12;\r
- rk29_camera_platform_data.info[i].fival[j].width = 320;\r
- rk29_camera_platform_data.info[i].fival[j].height = 240;\r
- rk29_camera_platform_data.info[i].fival[j].type = V4L2_FRMIVAL_TYPE_DISCRETE;\r
- j++;\r
- #endif\r
-\r
- #if CONFIG_SENSOR_CIF_FPS_FIXED_1\r
- rk29_camera_platform_data.info[i].fival[j].discrete.denominator = CONFIG_SENSOR_CIF_FPS_FIXED_1;\r
- rk29_camera_platform_data.info[i].fival[j].discrete.numerator= 1000;\r
- rk29_camera_platform_data.info[i].fival[j].index = 0;\r
- rk29_camera_platform_data.info[i].fival[j].pixel_format = V4L2_PIX_FMT_NV12;\r
- rk29_camera_platform_data.info[i].fival[j].width = 352;\r
- rk29_camera_platform_data.info[i].fival[j].height = 288;\r
- rk29_camera_platform_data.info[i].fival[j].type = V4L2_FRMIVAL_TYPE_DISCRETE;\r
- j++;\r
- #endif\r
-\r
- #if CONFIG_SENSOR_VGA_FPS_FIXED_1\r
- rk29_camera_platform_data.info[i].fival[j].discrete.denominator = CONFIG_SENSOR_VGA_FPS_FIXED_1;\r
- rk29_camera_platform_data.info[i].fival[j].discrete.numerator= 1000;\r
- rk29_camera_platform_data.info[i].fival[j].index = 0;\r
- rk29_camera_platform_data.info[i].fival[j].pixel_format = V4L2_PIX_FMT_NV12;\r
- rk29_camera_platform_data.info[i].fival[j].width = 640;\r
- rk29_camera_platform_data.info[i].fival[j].height = 480;\r
- rk29_camera_platform_data.info[i].fival[j].type = V4L2_FRMIVAL_TYPE_DISCRETE;\r
- j++;\r
- #endif\r
-\r
- #if CONFIG_SENSOR_480P_FPS_FIXED_1\r
- rk29_camera_platform_data.info[i].fival[j].discrete.denominator = CONFIG_SENSOR_480P_FPS_FIXED_1;\r
- rk29_camera_platform_data.info[i].fival[j].discrete.numerator= 1000;\r
- rk29_camera_platform_data.info[i].fival[j].index = 0;\r
- rk29_camera_platform_data.info[i].fival[j].pixel_format = V4L2_PIX_FMT_NV12;\r
- rk29_camera_platform_data.info[i].fival[j].width = 720;\r
- rk29_camera_platform_data.info[i].fival[j].height = 480;\r
- rk29_camera_platform_data.info[i].fival[j].type = V4L2_FRMIVAL_TYPE_DISCRETE;\r
- j++;\r
- #endif \r
-\r
- #if CONFIG_SENSOR_SVGA_FPS_FIXED_1\r
- rk29_camera_platform_data.info[i].fival[j].discrete.denominator = CONFIG_SENSOR_SVGA_FPS_FIXED_1;\r
- rk29_camera_platform_data.info[i].fival[j].discrete.numerator= 1000;\r
- rk29_camera_platform_data.info[i].fival[j].index = 0;\r
- rk29_camera_platform_data.info[i].fival[j].pixel_format = V4L2_PIX_FMT_NV12;\r
- rk29_camera_platform_data.info[i].fival[j].width = 800;\r
- rk29_camera_platform_data.info[i].fival[j].height = 600;\r
- rk29_camera_platform_data.info[i].fival[j].type = V4L2_FRMIVAL_TYPE_DISCRETE;\r
- j++;\r
- #endif\r
-\r
- #if CONFIG_SENSOR_720P_FPS_FIXED_1\r
- rk29_camera_platform_data.info[i].fival[j].discrete.denominator = CONFIG_SENSOR_720P_FPS_FIXED_1;\r
- rk29_camera_platform_data.info[i].fival[j].discrete.numerator= 1000;\r
- rk29_camera_platform_data.info[i].fival[j].index = 0;\r
- rk29_camera_platform_data.info[i].fival[j].pixel_format = V4L2_PIX_FMT_NV12;\r
- rk29_camera_platform_data.info[i].fival[j].width = 1280;\r
- rk29_camera_platform_data.info[i].fival[j].height = 720;\r
- rk29_camera_platform_data.info[i].fival[j].type = V4L2_FRMIVAL_TYPE_DISCRETE;\r
- j++;\r
- #endif\r
+ if (j==0) {\r
+ rk29_camera_platform_data.info[i].fival[j].width = 176;\r
+ rk29_camera_platform_data.info[i].fival[j].height = 144;\r
+ } else if (j==1) {\r
+ rk29_camera_platform_data.info[i].fival[j].width = 320;\r
+ rk29_camera_platform_data.info[i].fival[j].height = 240;\r
+ } else if (j==2) {\r
+ rk29_camera_platform_data.info[i].fival[j].width = 352;\r
+ rk29_camera_platform_data.info[i].fival[j].height = 288;\r
+ } else if (j==3) {\r
+ rk29_camera_platform_data.info[i].fival[j].width = 640;\r
+ rk29_camera_platform_data.info[i].fival[j].height = 480;\r
+ } else if (j==4) {\r
+ rk29_camera_platform_data.info[i].fival[j].width = 720;\r
+ rk29_camera_platform_data.info[i].fival[j].height = 480;\r
+ } else if (j==5) {\r
+ rk29_camera_platform_data.info[i].fival[j].width = 1280;\r
+ rk29_camera_platform_data.info[i].fival[j].height = 720;\r
+ } else if (j==6) {\r
+ rk29_camera_platform_data.info[i].fival[j].width = 240;\r
+ rk29_camera_platform_data.info[i].fival[j].height = 160;\r
+ }\r
+ if (rk29_camera_platform_data.info[i].fival[j].width && rk29_camera_platform_data.info[i].fival[j].height) {\r
+ rk29_sensor_fps_get(i,&rk29_camera_platform_data.info[i].fival[j].discrete.denominator,\r
+ rk29_camera_platform_data.info[i].fival[j].width,rk29_camera_platform_data.info[i].fival[j].height);\r
+ rk29_camera_platform_data.info[i].fival[j].discrete.numerator= 1000;\r
+ rk29_camera_platform_data.info[i].fival[j].index = 0;\r
+ rk29_camera_platform_data.info[i].fival[j].pixel_format = V4L2_PIX_FMT_NV12;\r
+ rk29_camera_platform_data.info[i].fival[j].type = V4L2_FRMIVAL_TYPE_DISCRETE;\r
+ }\r
}\r
\r
continue;\r
static int rk29_sensor_ioctrl(struct device *dev,enum rk29camera_ioctrl_cmd cmd, int on)\r
{\r
struct rk29camera_gpio_res *res = NULL; \r
- int ret = RK29_CAM_IO_SUCCESS;\r
+ int ret = RK29_CAM_IO_SUCCESS,i;\r
\r
- if(rk29_camera_platform_data.gpio_res[0].dev_name && (strcmp(rk29_camera_platform_data.gpio_res[0].dev_name, dev_name(dev)) == 0)) {\r
- res = (struct rk29camera_gpio_res *)&rk29_camera_platform_data.gpio_res[0];\r
- } 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)) {\r
- res = (struct rk29camera_gpio_res *)&rk29_camera_platform_data.gpio_res[1];\r
- } else {\r
+ for (i=0; i<RK29_CAM_SUPPORT_NUMS; i++) {\r
+ if(rk29_camera_platform_data.gpio_res[i].dev_name && (strcmp(rk29_camera_platform_data.gpio_res[i].dev_name, dev_name(dev)) == 0)) {\r
+ res = (struct rk29camera_gpio_res *)&rk29_camera_platform_data.gpio_res[i];\r
+ } \r
+ }\r
+ if (res == NULL) {\r
printk(KERN_ERR "%s is not regisiterd in rk29_camera_platform_data!!\n",dev_name(dev));\r
ret = RK29_CAM_EIO_INVALID;\r
goto rk29_sensor_ioctrl_end;\r
rk29_sensor_ioctrl_end:\r
return ret;\r
}\r
+\r
+static int rk29_sensor_powerdown(struct device *dev, int on)\r
+{\r
+ return rk29_sensor_ioctrl(dev,Cam_PowerDown,on);\r
+}\r
static int rk29_sensor_power(struct device *dev, int on)\r
{\r
- rk29_sensor_ioctrl(dev,Cam_Power,on);\r
+ if (!on) /* ddl@rock-chips.com : Ensure sensor enter standby or power off */\r
+ rk29_sensor_powerdown(dev,1);\r
+ rk29_sensor_ioctrl(dev,Cam_Power,on); \r
return 0;\r
}\r
-#if (CONFIG_SENSOR_RESET_PIN_0 != INVALID_GPIO) || (CONFIG_SENSOR_RESET_PIN_1 != INVALID_GPIO)\r
static int rk29_sensor_reset(struct device *dev)\r
{\r
rk29_sensor_ioctrl(dev,Cam_Reset,1);\r
rk29_sensor_ioctrl(dev,Cam_Reset,0);\r
return 0;\r
}\r
-#endif\r
-static int rk29_sensor_powerdown(struct device *dev, int on)\r
-{\r
- return rk29_sensor_ioctrl(dev,Cam_PowerDown,on);\r
-}\r
+\r
#if (CONFIG_SENSOR_IIC_ADDR_0 != 0x00)\r
static struct i2c_board_info rk29_i2c_cam_info_0[] = {\r
{\r
},\r
};\r
#endif\r
+#ifdef CONFIG_SENSOR_01\r
+#if (CONFIG_SENSOR_IIC_ADDR_01 != 0x00)\r
+static struct i2c_board_info rk29_i2c_cam_info_01[] = {\r
+ {\r
+ I2C_BOARD_INFO(SENSOR_NAME_01, CONFIG_SENSOR_IIC_ADDR_01>>1)\r
+ },\r
+};\r
+\r
+static struct soc_camera_link rk29_iclink_01 = {\r
+ .bus_id = RK29_CAM_PLATFORM_DEV_ID,\r
+ .power = rk29_sensor_power,\r
+#if (CONFIG_SENSOR_RESET_PIN_01 != INVALID_GPIO)\r
+ .reset = rk29_sensor_reset,\r
+#endif \r
+ .powerdown = rk29_sensor_powerdown,\r
+ .board_info = &rk29_i2c_cam_info_01[0],\r
+ .i2c_adapter_id = CONFIG_SENSOR_IIC_ADAPTER_ID_01,\r
+ .module_name = SENSOR_NAME_01,\r
+};\r
+\r
+/*platform_device : soc-camera need */\r
+static struct platform_device rk29_soc_camera_pdrv_01 = {\r
+ .name = "soc-camera-pdrv",\r
+ .id = 8,\r
+ .dev = {\r
+ .init_name = SENSOR_DEVICE_NAME_01,\r
+ .platform_data = &rk29_iclink_01,\r
+ },\r
+};\r
+#endif\r
+#endif\r
+#ifdef CONFIG_SENSOR_02\r
+#if (CONFIG_SENSOR_IIC_ADDR_02 != 0x00)\r
+static struct i2c_board_info rk29_i2c_cam_info_02[] = {\r
+ {\r
+ I2C_BOARD_INFO(SENSOR_NAME_02, CONFIG_SENSOR_IIC_ADDR_02>>1)\r
+ },\r
+};\r
+\r
+static struct soc_camera_link rk29_iclink_02 = {\r
+ .bus_id = RK29_CAM_PLATFORM_DEV_ID,\r
+ .power = rk29_sensor_power,\r
+#if (CONFIG_SENSOR_RESET_PIN_02 != INVALID_GPIO)\r
+ .reset = rk29_sensor_reset,\r
+#endif \r
+ .powerdown = rk29_sensor_powerdown,\r
+ .board_info = &rk29_i2c_cam_info_02[0],\r
+ .i2c_adapter_id = CONFIG_SENSOR_IIC_ADAPTER_ID_02,\r
+ .module_name = SENSOR_NAME_02,\r
+};\r
+\r
+/*platform_device : soc-camera need */\r
+static struct platform_device rk29_soc_camera_pdrv_02 = {\r
+ .name = "soc-camera-pdrv",\r
+ .id = 3,\r
+ .dev = {\r
+ .init_name = SENSOR_DEVICE_NAME_02,\r
+ .platform_data = &rk29_iclink_02,\r
+ },\r
+};\r
+#endif\r
+#endif\r
+#ifdef CONFIG_SENSOR_11\r
+#if (CONFIG_SENSOR_IIC_ADDR_11 != 0x00)\r
+static struct i2c_board_info rk29_i2c_cam_info_11[] = {\r
+ {\r
+ I2C_BOARD_INFO(SENSOR_NAME_11, CONFIG_SENSOR_IIC_ADDR_11>>1)\r
+ },\r
+};\r
+\r
+static struct soc_camera_link rk29_iclink_11 = {\r
+ .bus_id = RK29_CAM_PLATFORM_DEV_ID,\r
+ .power = rk29_sensor_power,\r
+#if (CONFIG_SENSOR_RESET_PIN_11 != INVALID_GPIO)\r
+ .reset = rk29_sensor_reset,\r
+#endif \r
+ .powerdown = rk29_sensor_powerdown,\r
+ .board_info = &rk29_i2c_cam_info_11[0],\r
+ .i2c_adapter_id = CONFIG_SENSOR_IIC_ADAPTER_ID_11,\r
+ .module_name = SENSOR_NAME_11,\r
+};\r
+\r
+/*platform_device : soc-camera need */\r
+static struct platform_device rk29_soc_camera_pdrv_11 = {\r
+ .name = "soc-camera-pdrv",\r
+ .id = 4,\r
+ .dev = {\r
+ .init_name = SENSOR_DEVICE_NAME_11,\r
+ .platform_data = &rk29_iclink_11,\r
+ },\r
+};\r
+#endif\r
+#endif\r
+#ifdef CONFIG_SENSOR_12\r
+#if (CONFIG_SENSOR_IIC_ADDR_12 != 0x00)\r
+static struct i2c_board_info rk29_i2c_cam_info_12[] = {\r
+ {\r
+ I2C_BOARD_INFO(SENSOR_NAME_12, CONFIG_SENSOR_IIC_ADDR_12>>1)\r
+ },\r
+};\r
+\r
+static struct soc_camera_link rk29_iclink_12 = {\r
+ .bus_id = RK29_CAM_PLATFORM_DEV_ID,\r
+ .power = rk29_sensor_power,\r
+#if (CONFIG_SENSOR_RESET_PIN_12 != INVALID_GPIO)\r
+ .reset = rk29_sensor_reset,\r
+#endif \r
+ .powerdown = rk29_sensor_powerdown,\r
+ .board_info = &rk29_i2c_cam_info_12[0],\r
+ .i2c_adapter_id = CONFIG_SENSOR_IIC_ADAPTER_ID_12,\r
+ .module_name = SENSOR_NAME_12,\r
+};\r
+\r
+/*platform_device : soc-camera need */\r
+static struct platform_device rk29_soc_camera_pdrv_12 = {\r
+ .name = "soc-camera-pdrv",\r
+ .id = 5,\r
+ .dev = {\r
+ .init_name = SENSOR_DEVICE_NAME_12,\r
+ .platform_data = &rk29_iclink_12,\r
+ },\r
+};\r
+#endif\r
+#endif\r
\r
static u64 rockchip_device_camera_dmamask = 0xffffffffUL;\r
static struct resource rk29_camera_resource[] = {\r
.platform_data = &rk29_camera_platform_data,\r
}\r
};\r
-\r
+#if (PMEM_CAM_SIZE > 0)\r
static struct android_pmem_platform_data android_pmem_cam_pdata = {\r
.name = "pmem_cam",\r
.start = PMEM_CAM_BASE,\r
.platform_data = &android_pmem_cam_pdata,\r
},\r
};\r
-\r
+#endif\r
#endif\r
\r
#endif //#ifdef CONFIG_VIDEO_RK29\r
static int debug;
-module_param(debug, int, S_IRUGO|S_IWUSR);
+module_param(debug, int, S_IRUGO|S_IWUSR|S_IWGRP);
#define dprintk(level, fmt, arg...) do { \
if (debug >= level) \
*v0.x.4 : this driver support digital zoom;
*v0.x.5 : this driver support test framerate and query framerate from board file configuration;
*v0.x.6 : this driver improve test framerate method;
+*v0.x.7 : this driver product resolution by IPP crop and scale, which user request but sensor can't support;
+* note: this version is only provide yifang client, which is not official version;
+*v0.x.8 : this driver and rk29_camera.c support upto 3 back-sensors and upto 3 front-sensors;
*/
-#define RK29_CAM_VERSION_CODE KERNEL_VERSION(0, 1, 6)
+#define RK29_CAM_VERSION_CODE KERNEL_VERSION(0, 1, 8)
/* limit to rk29 hardware capabilities */
#define RK29_CAM_BUS_PARAM (SOCAM_MASTER |\
struct rk29_camera_dev *pcdev = ici->priv;
int bytes_per_line = soc_mbus_bytes_per_line(icd->user_width,
icd->current_fmt->host_fmt);
+ int bytes_per_line_host = soc_mbus_bytes_per_line(pcdev->host_width,
+ icd->current_fmt->host_fmt);
dev_dbg(&icd->dev, "count=%d, size=%d\n", *count, *size);
/* planar capture requires Y, U and V buffers to be page aligned */
*size = PAGE_ALIGN(bytes_per_line*icd->user_height); /* Y pages UV pages, yuv422*/
- pcdev->vipmem_bsize = PAGE_ALIGN(bytes_per_line * pcdev->host_height);
+ pcdev->vipmem_bsize = PAGE_ALIGN(bytes_per_line_host * pcdev->host_height);
if (CAM_WORKQUEUE_IS_EN()) {
goto ebusy;
}
- dev_info(&icd->dev, "RK29 Camera driver attached to camera%d(%s)\n",
- icd->devnum,dev_name(icd->pdev));
-
+ RK29CAMERA_DG("RK29 Camera driver attached to %s\n",dev_name(icd->pdev));
+
pcdev->frame_inval = RK29_CAM_FRAME_INVAL_INIT;
pcdev->active = NULL;
pcdev->icd = NULL;
mutex_lock(&camera_lock);
BUG_ON(icd != pcdev->icd);
- dev_info(&icd->dev, "RK29 Camera driver detached from camera%d(%s)\n",
- icd->devnum,dev_name(icd->pdev));
+ RK29CAMERA_DG("RK29 Camera driver detached from %s\n",dev_name(icd->pdev));
/* ddl@rock-chips.com: Application will call VIDIOC_STREAMOFF before close device, but
stream may be turn on again before close device, if suspend and resume happened. */
ret = -EINVAL;
goto RK29_CAMERA_SET_FMT_END;
}
- mf.width = usr_w;
- mf.height = usr_h;
}
#endif
icd->sense = NULL;
if (!ret) {
- rect.left = 0;
- rect.top = 0;
- rect.width = mf.width;
- rect.height = mf.height;
+
+ if (mf.width*usr_h == mf.height*usr_w) {
+ rect.width = mf.width;
+ rect.height = mf.height;
+ } else {
+ int ratio;
+ if (usr_w > usr_h) {
+ if (mf.width > usr_w) {
+ ratio = mf.width*10/usr_w;
+ rect.width = usr_w*ratio/10;
+ rect.height = usr_h*ratio/10;
+ } else {
+ ratio = usr_w*10/mf.width + 1;
+ rect.width = usr_w*10/ratio;
+ rect.height = usr_h*10/ratio;
+ }
+ } else {
+ if (mf.height > usr_h) {
+ ratio = mf.height*10/usr_h;
+ rect.width = usr_w*ratio/10;
+ rect.height = usr_h*ratio/10;
+ } else {
+ ratio = usr_h*10/mf.height + 1;
+ rect.width = usr_w*10/ratio;
+ rect.height = usr_h*10/ratio;
+ }
+ }
+ }
+
+ rect.left = (mf.width - rect.width)/2;
+ rect.top = (mf.height - rect.height)/2;
down(&pcdev->zoominfo.sem);
pcdev->zoominfo.a.c.width = rect.width*100/pcdev->zoominfo.zoom_rate;
pcdev->zoominfo.a.c.width &= ~0x03;
pcdev->zoominfo.a.c.height = rect.height*100/pcdev->zoominfo.zoom_rate;
pcdev->zoominfo.a.c.height &= ~0x03;
- pcdev->zoominfo.a.c.left = ((rect.width - pcdev->zoominfo.a.c.width)>>1)&(~0x01);
- pcdev->zoominfo.a.c.top = ((rect.height - pcdev->zoominfo.a.c.height)>>1)&(~0x01);
+ pcdev->zoominfo.a.c.left = ((rect.width - pcdev->zoominfo.a.c.width)/2 + rect.left)&(~0x01);
+ pcdev->zoominfo.a.c.top = ((rect.height - pcdev->zoominfo.a.c.height)/2 + rect.top)&(~0x01);
up(&pcdev->zoominfo.sem);
/* ddl@rock-chips.com: IPP work limit check */
}
}
- RK29CAMERA_DG("%s..%s icd width:%d host width:%d (zoom: %dx%d@(%d,%d)->%dx%d)\n",__FUNCTION__,xlate->host_fmt->name,
- rect.width, pix->width, pcdev->zoominfo.a.c.width,pcdev->zoominfo.a.c.height, pcdev->zoominfo.a.c.left,pcdev->zoominfo.a.c.top,
+ /* ddl@rock-chips.com: Crop is doing by IPP, not by VIP in rk2918 */
+ rect.left = 0;
+ rect.top = 0;
+ rect.width = mf.width;
+ rect.height = mf.height;
+
+ RK29CAMERA_DG("%s..%s Sensor output:%dx%d VIP output:%dx%d (zoom: %dx%d@(%d,%d)->%dx%d)\n",__FUNCTION__,xlate->host_fmt->name,
+ mf.width, mf.height,rect.width,rect.height, pcdev->zoominfo.a.c.width,pcdev->zoominfo.a.c.height, pcdev->zoominfo.a.c.left,pcdev->zoominfo.a.c.top,
pix->width, pix->height);
+
+
rk29_camera_setup_format(icd, pix->pixelformat, mf.code, &rect);
if (CAM_IPPWORK_IS_EN()) {
pcdev->icd_width = icd_width;
pcdev->icd_height = icd_height;
- pix->width = mf.width;
- pix->height = mf.height;
+ pix->width = usr_w;
+ pix->height = usr_h;
pix->field = mf.field;
pix->colorspace = mf.colorspace;
icd->current_fmt = xlate;
if (stream_on & ENABLE_CAPTURE)
write_vip_reg(RK29_VIP_CTRL, (read_vip_reg(RK29_VIP_CTRL) | ENABLE_CAPTURE));
if (ret)
- RK29CAMERA_TR("\n%s..%d.. ret = %d \n",__FUNCTION__,__LINE__, ret);
+ RK29CAMERA_TR("\n%s: Driver isn't support %dx%d resolution which user request!\n",__FUNCTION__,usr_w,usr_h);
return ret;
}
static bool rk29_camera_fmt_capturechk(struct v4l2_format *f)
bool is_capture = rk29_camera_fmt_capturechk(f);
bool vipmem_is_overflow = false;
struct v4l2_mbus_framefmt mf;
-
+ int bytes_per_line_host;
+
usr_w = pix->width;
usr_h = pix->height;
RK29CAMERA_DG("%s enter width:%d height:%d\n",__FUNCTION__,usr_w,usr_h);
goto RK29_CAMERA_TRY_FMT_END;
RK29CAMERA_DG("%s mf.width:%d mf.height:%d\n",__FUNCTION__,mf.width,mf.height);
#ifdef CONFIG_VIDEO_RK29_WORK_IPP
- if ((mf.width > usr_w) && (mf.height > usr_h)) {
+ if ((mf.width != usr_w) || (mf.height != usr_h)) {
+ bytes_per_line_host = soc_mbus_bytes_per_line(mf.width,icd->current_fmt->host_fmt);
if (is_capture) {
- vipmem_is_overflow = (PAGE_ALIGN(pix->bytesperline*pix->height) > pcdev->vipmem_size);
+ vipmem_is_overflow = (PAGE_ALIGN(bytes_per_line_host*mf.height) > pcdev->vipmem_size);
} else {
/* Assume preview buffer minimum is 4 */
- vipmem_is_overflow = (PAGE_ALIGN(pix->bytesperline*pix->height)*4 > pcdev->vipmem_size);
- }
+ vipmem_is_overflow = (PAGE_ALIGN(bytes_per_line_host*mf.height)*4 > pcdev->vipmem_size);
+ }
if (vipmem_is_overflow == false) {
pix->width = usr_w;
pix->height = usr_h;
pix->width = mf.width;
pix->height = mf.height;
}
- } else if ((mf.width < usr_w) && (mf.height < usr_h)) {
- if (((usr_w>>1) < mf.width) && ((usr_h>>1) < mf.height)) {
- if (is_capture) {
- vipmem_is_overflow = (PAGE_ALIGN(pix->bytesperline*pix->height) > pcdev->vipmem_size);
- } else {
- vipmem_is_overflow = (PAGE_ALIGN(pix->bytesperline*pix->height)*4 > pcdev->vipmem_size);
- }
- if (vipmem_is_overflow == false) {
- pix->width = usr_w;
- pix->height = usr_h;
- } else {
- RK29CAMERA_TR("vipmem for IPP is overflow, This resolution(%dx%d -> %dx%d) is invalidate!\n",mf.width,mf.height,usr_w,usr_h);
+
+ if ((mf.width < usr_w) || (mf.height < usr_h)) {
+ if (((usr_w>>1) > mf.width) || ((usr_h>>1) > mf.height)) {
+ RK29CAMERA_TR("The aspect ratio(%dx%d/%dx%d) is bigger than 2 !\n",mf.width,mf.height,usr_w,usr_h);
pix->width = mf.width;
pix->height = mf.height;
- }
- } else {
- RK29CAMERA_TR("The aspect ratio(%dx%d/%dx%d) is bigger than 2 !\n",mf.width,mf.height,usr_w,usr_h);
- pix->width = mf.width;
- pix->height = mf.height;
- }
+ }
+ }
}
#else
pix->width = mf.width;
pix->colorspace = mf.colorspace;
switch (mf.field) {
- case V4L2_FIELD_ANY:
- case V4L2_FIELD_NONE:
- pix->field = V4L2_FIELD_NONE;
- break;
- default:
- /* TODO: support interlaced at least in pass-through mode */
- dev_err(icd->dev.parent, "Field type %d unsupported.\n",
- mf.field);
- goto RK29_CAMERA_TRY_FMT_END;
+ case V4L2_FIELD_ANY:
+ case V4L2_FIELD_NONE:
+ pix->field = V4L2_FIELD_NONE;
+ break;
+ default:
+ /* TODO: support interlaced at least in pass-through mode */
+ dev_err(icd->dev.parent, "Field type %d unsupported.\n",
+ mf.field);
+ goto RK29_CAMERA_TRY_FMT_END;
}
RK29_CAMERA_TRY_FMT_END:
{
struct rk29_camera_dev *pcdev = ici->priv;
char orientation[5];
+ int i;
- strlcpy(cap->card, dev_name(pcdev->icd->pdev), sizeof(cap->card));
- if (strcmp(dev_name(pcdev->icd->pdev), pcdev->pdata->info[0].dev_name) == 0) {
- sprintf(orientation,"-%d",pcdev->pdata->info[0].orientation);
+ strlcpy(cap->card, dev_name(pcdev->icd->pdev), sizeof(cap->card));
+
+ memset(orientation,0x00,sizeof(orientation));
+ for (i=0; i<RK29_CAM_SUPPORT_NUMS;i++) {
+ if ((pcdev->pdata->info[i].dev_name!=NULL) && (strcmp(dev_name(pcdev->icd->pdev), pcdev->pdata->info[i].dev_name) == 0)) {
+ sprintf(orientation,"-%d",pcdev->pdata->info[i].orientation);
+ }
+ }
+
+ if (orientation[0] != '-') {
+ RK29CAMERA_TR("%s: %s is not registered in rk29_camera_platform_data, orientation apply default value",__FUNCTION__,dev_name(pcdev->icd->pdev));
+ if (strstr(dev_name(pcdev->icd->pdev),"front"))
+ strcat(cap->card,"-270");
+ else
+ strcat(cap->card,"-90");
} else {
- sprintf(orientation,"-%d",pcdev->pdata->info[1].orientation);
+ strcat(cap->card,orientation);
}
- strcat(cap->card,orientation);
+
cap->version = RK29_CAM_VERSION_CODE;
cap->capabilities = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_STREAMING;
struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent);
struct rk29_camera_dev *pcdev = ici->priv;
struct rk29_camera_frmivalenum *fival_list = NULL;
- struct v4l2_frmivalenum *fival_head;
+ struct v4l2_frmivalenum *fival_head=NULL;
int i,ret = 0,index;
index = fival->index & 0x00ffffff;
RK29CAMERA_TR("%s: fival_list is NULL\n",__FUNCTION__);
ret = -EINVAL;
}
- } else {
- if (strcmp(dev_name(pcdev->icd->pdev),pcdev->pdata->info[0].dev_name) == 0) {
- fival_head = pcdev->pdata->info[0].fival;
- } else {
- fival_head = pcdev->pdata->info[1].fival;
+ } else {
+
+ for (i=0; i<RK29_CAM_SUPPORT_NUMS; i++) {
+ if (pcdev->pdata->info[i].dev_name && (strcmp(dev_name(pcdev->icd->pdev),pcdev->pdata->info[i].dev_name) == 0)) {
+ fival_head = pcdev->pdata->info[i].fival;
+ }
}
+
+ if (fival_head == NULL) {
+ RK29CAMERA_TR("%s: %s is not registered in rk29_camera_platform_data!!",__FUNCTION__,dev_name(pcdev->icd->pdev));
+ ret = -EINVAL;
+ goto rk29_camera_enum_frameintervals_end;
+ }
+
i = 0;
while (fival_head->width && fival_head->height) {
if ((fival->pixel_format == fival_head->pixel_format)
if ((i == index) && (fival->height == fival_head->height) && (fival->width == fival_head->width)) {
memcpy(fival, fival_head, sizeof(struct v4l2_frmivalenum));
- RK29CAMERA_DG("%s %dx%d@%c%c%c%c framerate : %d/%d\n", dev_name(&rk29_camdev_info_ptr->icd->dev),
+ RK29CAMERA_DG("%s %dx%d@%c%c%c%c framerate : %d/%d\n", dev_name(rk29_camdev_info_ptr->icd->pdev),
fival->width, fival->height,
fival->pixel_format & 0xFF, (fival->pixel_format >> 8) & 0xFF,
(fival->pixel_format >> 16) & 0xFF, (fival->pixel_format >> 24),
fival->discrete.denominator,fival->discrete.numerator);
} else {
if (index == 0)
- RK29CAMERA_TR("%s have not catch %d%d@%c%c%c%c index(%d) framerate\n",dev_name(&rk29_camdev_info_ptr->icd->dev),
+ RK29CAMERA_TR("%s have not catch %d%d@%c%c%c%c index(%d) framerate\n",dev_name(rk29_camdev_info_ptr->icd->pdev),
fival->width,fival->height,
fival->pixel_format & 0xFF, (fival->pixel_format >> 8) & 0xFF,
(fival->pixel_format >> 16) & 0xFF, (fival->pixel_format >> 24),
index);
else
- RK29CAMERA_DG("%s have not catch %d%d@%c%c%c%c index(%d) framerate\n",dev_name(&rk29_camdev_info_ptr->icd->dev),
+ RK29CAMERA_DG("%s have not catch %d%d@%c%c%c%c index(%d) framerate\n",dev_name(rk29_camdev_info_ptr->icd->pdev),
fival->width,fival->height,
fival->pixel_format & 0xFF, (fival->pixel_format >> 8) & 0xFF,
(fival->pixel_format >> 16) & 0xFF, (fival->pixel_format >> 24),
ret = -EINVAL;
}
}
-
+rk29_camera_enum_frameintervals_end:
return ret;
}
int irq,i;
int err = 0;
- RK29CAMERA_DG("%s..%s..%d \n",__FUNCTION__,__FILE__,__LINE__);
+ RK29CAMERA_TR("RK29 Camera driver version: v%d.%d.%d\n",(RK29_CAM_VERSION_CODE&0xff0000)>>16,
+ (RK29_CAM_VERSION_CODE&0xff00)>>8,RK29_CAM_VERSION_CODE&0xff);
+
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
irq = platform_get_irq(pdev, 0);
if (!res || irq < 0) {
struct i2c_client *client = v4l2_get_subdevdata(sd);\r
struct sensor *sensor = to_sensor(client);
const struct sensor_datafmt *fmt;
- int ret = 0;
+ int ret = 0,set_w,set_h;\r
fmt = sensor_find_datafmt(mf->code, sensor_colour_fmts,
ARRAY_SIZE(sensor_colour_fmts));
mf->width = SENSOR_MAX_WIDTH;
else if (mf->width < SENSOR_MIN_WIDTH)
mf->width = SENSOR_MIN_WIDTH;
-
+\r
+ set_w = mf->width;
+ set_h = mf->height;
+\r
+ if (((set_w <= 176) && (set_h <= 144)) &&( sensor_qcif[0].reg!=0xff))\r
+ {\r
+ set_w = 176;\r
+ set_h = 144;\r
+ }\r
+ else if (((set_w <= 320) && (set_h <= 240)) && (sensor_qvga[0].reg!=0xff))\r
+ {\r
+ set_w = 320;\r
+ set_h = 240;\r
+ }\r
+ else if (((set_w <= 352) && (set_h<= 288)) && (sensor_cif[0].reg!=0xff))\r
+ {\r
+ set_w = 352;\r
+ set_h = 288;\r
+ }\r
+ else if (((set_w <= 640) && (set_h <= 480)) &&( sensor_vga[0].reg!=0xff))\r
+ {\r
+ set_w =640;\r
+ set_h = 480;\r
+ }\r
+ else if (((set_w <= 800) && (set_h <= 600)) && (sensor_svga[0].reg!=0xff))\r
+ {\r
+ set_w = 800;\r
+ set_h = 600;\r
+ }\r
+ else if (((set_w <= 1024) && (set_h <= 768)) &&( sensor_xga[0].reg!=0xff))\r
+ {\r
+ set_w = 1024;\r
+ set_h = 768;\r
+ }\r
+ else if (((set_w <= 1280) && (set_h <= 1024)) && (sensor_sxga[0].reg!=0xff))\r
+ {\r
+ set_w = 1280;\r
+ set_h = 1024;\r
+ }\r
+ else if (((set_w <= 1600) && (set_h <= 1200)) && (sensor_uxga[0].reg!=0xff))\r
+ {\r
+ set_w = 1600;\r
+ set_h = 1200;\r
+ }\r
+ else\r
+ {\r
+ set_w = SENSOR_INIT_WIDTH;\r
+ set_h = SENSOR_INIT_HEIGHT; \r
+ }\r
+ mf->width = set_w;
+ mf->height = set_h; \r
mf->colorspace = fmt->colorspace;
return ret;
case RK29_CAM_SUBDEV_IOREQUEST:\r
{\r
sensor->sensor_io_request = (struct rk29camera_platform_data*)arg; \r
- if (sensor->sensor_io_request != NULL) { \r
- if (sensor->sensor_io_request->gpio_res[0].dev_name && \r
- (strcmp(sensor->sensor_io_request->gpio_res[0].dev_name, dev_name(icd->pdev)) == 0)) {\r
- sensor->sensor_gpio_res = (struct rk29camera_gpio_res*)&sensor->sensor_io_request->gpio_res[0];\r
- } else if (sensor->sensor_io_request->gpio_res[1].dev_name && \r
- (strcmp(sensor->sensor_io_request->gpio_res[1].dev_name, dev_name(icd->pdev)) == 0)) {\r
- sensor->sensor_gpio_res = (struct rk29camera_gpio_res*)&sensor->sensor_io_request->gpio_res[1];\r
- }\r
- } else {\r
- SENSOR_TR("%s %s RK29_CAM_SUBDEV_IOREQUEST fail\n",SENSOR_NAME_STRING(),__FUNCTION__);\r
- ret = -EINVAL;\r
- goto sensor_ioctl_end;\r
+ if (sensor->sensor_io_request != NULL) {
+ sensor->sensor_gpio_res = NULL;
+ for (i=0; i<RK29_CAM_SUPPORT_NUMS;i++) {
+ if (sensor->sensor_io_request->gpio_res[i].dev_name &&
+ (strcmp(sensor->sensor_io_request->gpio_res[i].dev_name, dev_name(icd->pdev)) == 0)) {
+ sensor->sensor_gpio_res = (struct rk29camera_gpio_res*)&sensor->sensor_io_request->gpio_res[i];
+ }
+ }
+ if (sensor->sensor_gpio_res == NULL) {
+ SENSOR_TR("%s %s obtain gpio resource failed when RK29_CAM_SUBDEV_IOREQUEST \n",SENSOR_NAME_STRING(),__FUNCTION__);
+ ret = -EINVAL;
+ goto sensor_ioctl_end;
+ }
+ } else {
+ SENSOR_TR("%s %s RK29_CAM_SUBDEV_IOREQUEST fail\n",SENSOR_NAME_STRING(),__FUNCTION__);
+ ret = -EINVAL;
+ goto sensor_ioctl_end;
}\r
/* ddl@rock-chips.com : if gpio_flash havn't been set in board-xxx.c, sensor driver must notify is not support flash control \r
for this project */\r
\r
MODULE_DESCRIPTION(SENSOR_NAME_STRING(Camera sensor driver));\r
MODULE_AUTHOR("ddl <kernel@rock-chips>");\r
-MODULE_LICENSE("GPL");
\ No newline at end of file
+MODULE_LICENSE("GPL");\r
struct i2c_client *client = v4l2_get_subdevdata(sd);
struct sensor *sensor = to_sensor(client);
const struct sensor_datafmt *fmt;
- int ret = 0;
+ int ret = 0,set_w,set_h;
fmt = sensor_find_datafmt(mf->code, sensor_colour_fmts,
ARRAY_SIZE(sensor_colour_fmts));
mf->width = SENSOR_MAX_WIDTH;
else if (mf->width < SENSOR_MIN_WIDTH)
mf->width = SENSOR_MIN_WIDTH;
+
+ set_w = mf->width;
+ set_h = mf->height;
+ if (((set_w <= 176) && (set_h <= 144)) && sensor_qcif[0].reg)
+ {
+ set_w = 176;
+ set_h = 144;
+ }
+ else if (((set_w <= 320) && (set_h <= 240)) && sensor_qvga[0].reg)
+ {
+ set_w = 320;
+ set_h = 240;
+ }
+ else if (((set_w <= 352) && (set_h<= 288)) && sensor_cif[0].reg)
+ {
+ set_w = 352;
+ set_h = 288;
+ }
+ else if (((set_w <= 640) && (set_h <= 480)) && sensor_vga[0].reg)
+ {
+ set_w = 640;
+ set_h = 480;
+ }
+ else
+ {
+ set_w = SENSOR_INIT_WIDTH;
+ set_h = SENSOR_INIT_HEIGHT;
+ }
+ mf->width = set_w;
+ mf->height = set_h;
mf->colorspace = fmt->colorspace;
return ret;
{
sensor->sensor_io_request = (struct rk29camera_platform_data*)arg;
if (sensor->sensor_io_request != NULL) {
- if (sensor->sensor_io_request->gpio_res[0].dev_name &&
- (strcmp(sensor->sensor_io_request->gpio_res[0].dev_name, dev_name(icd->pdev)) == 0)) {
- sensor->sensor_gpio_res = (struct rk29camera_gpio_res*)&sensor->sensor_io_request->gpio_res[0];
- } else if (sensor->sensor_io_request->gpio_res[1].dev_name &&
- (strcmp(sensor->sensor_io_request->gpio_res[1].dev_name, dev_name(icd->pdev)) == 0)) {
- sensor->sensor_gpio_res = (struct rk29camera_gpio_res*)&sensor->sensor_io_request->gpio_res[1];
+ sensor->sensor_gpio_res = NULL;
+ for (i=0; i<RK29_CAM_SUPPORT_NUMS;i++) {
+ if (sensor->sensor_io_request->gpio_res[i].dev_name &&
+ (strcmp(sensor->sensor_io_request->gpio_res[i].dev_name, dev_name(icd->pdev)) == 0)) {
+ sensor->sensor_gpio_res = (struct rk29camera_gpio_res*)&sensor->sensor_io_request->gpio_res[i];
+ }
+ }
+ if (sensor->sensor_gpio_res == NULL) {
+ SENSOR_TR("%s %s obtain gpio resource failed when RK29_CAM_SUBDEV_IOREQUEST \n",SENSOR_NAME_STRING(),__FUNCTION__);
+ ret = -EINVAL;
+ goto sensor_ioctl_end;
}
} else {
SENSOR_TR("%s %s RK29_CAM_SUBDEV_IOREQUEST fail\n",SENSOR_NAME_STRING(),__FUNCTION__);
if (icd->iface == ici->nr) {
int ret;
icd->dev.parent = ici->v4l2_dev.dev;
- dev_set_name(&icd->dev, "%u-%u", icd->iface,
- icd->devnum);
+ dev_set_name(&icd->dev, "%u-%u-%s", icd->iface,
+ icd->devnum,dev_name(icd->pdev));
ret = device_register(&icd->dev);
if (ret < 0) {
icd->dev.parent = NULL;
struct v4l2_mbus_framefmt mf;
int ret;
- dev_info(dev, "Probing %s\n", dev_name(dev));
-
ret = regulator_bulk_get(icd->pdev, icl->num_regulators,
icl->regulators);
if (ret < 0)
soc_camera_power_set(icd, icl, 0);
mutex_unlock(&icd->video_lock);
-
+ dev_info(dev, "Probe %s success\n", dev_name(icd->pdev));
return 0;
evidstart:
epower:
regulator_bulk_free(icl->num_regulators, icl->regulators);
ereg:
+ dev_err(dev, "Probe %s failed\n", dev_name(icd->pdev));
return ret;
}