rk312x:cif: 1. soft reset cif before setting cif registers
authorzyc <zyc@rock-chips.com>
Thu, 14 Aug 2014 09:09:33 +0000 (17:09 +0800)
committerzyc <zyc@rock-chips.com>
Thu, 14 Aug 2014 09:09:33 +0000 (17:09 +0800)
                2. raise cif qos the same as lcdc
                3. add 3A controls in soc camera framework

16 files changed:
arch/arm/boot/dts/rk312x-cif-sensor.dtsi
arch/arm/boot/dts/rk312x-sdk.dtsi
arch/arm/boot/dts/rk312x.dtsi
arch/arm/mach-rockchip/Makefile
arch/arm/mach-rockchip/board-rk30-sdk-camera.c [deleted file]
arch/arm/mach-rockchip/rk_camera.c
arch/arm/mach-rockchip/rk_camera.h
arch/arm/mach-rockchip/rk_camera_sensor_info.h
drivers/media/platform/soc_camera/soc_camera.c
drivers/media/v4l2-core/videobuf-core.c
drivers/media/video/generic_sensor.c
drivers/media/video/generic_sensor.h
drivers/media/video/rk30_camera.c
drivers/media/video/rk30_camera_oneframe.c
include/media/soc_camera.h
include/uapi/linux/v4l2-controls.h

index 613edfaba9c32b56ff8b0f63f408fd8233c993b8..810ddc97ad7dc73e9396f189fa1c5b5e423c6d0a 100644 (file)
@@ -4,9 +4,16 @@
 /{
        cif_sensor: cif_sensor{
                        compatible = "rockchip,sensor";
+                       CONFIG_SENSOR_POWER_IOCTL_USR           = <1>;
+                       CONFIG_SENSOR_RESET_IOCTL_USR           = <0>;
+                       CONFIG_SENSOR_POWERDOWN_IOCTL_USR       = <0>;
+                       CONFIG_SENSOR_FLASH_IOCTL_USR           = <0>;
+                       CONFIG_SENSOR_AF_IOCTL_USR                      = <0>;
+
                ov2659{
                        is_front = <1>; 
                        rockchip,powerdown = <&gpio3 GPIO_D7 GPIO_ACTIVE_HIGH>;
+                       #rockchip,power = <>;
                        mir = <0>;
                        flash_attach = <0>;
                        resolution = <ov2659_FULL_RESOLUTION>;
index ce073c1c1238a64ca838cfcc9ae0cf6fcaa4cff2..faf62d4e75fbe9f4db3dffe1573046d3a92d40d1 100755 (executable)
 
                rk818_ldo4_reg:regulator@7 {
                        regulator-name= "rk818_ldo4";
-                       regulator-min-microvolt = <2500000>;
-                       regulator-max-microvolt = <2500000>;
+                       regulator-min-microvolt = <2800000>;
+                       regulator-max-microvolt = <2800000>;
                        regulator-initial-state = <3>;
                        regulator-state-mem {
                                regulator-state-enabled;
index ae44563a49d4f0a5ab94434a91530f56ed012b72..9165d9aa2b9bec8851e35710e0121caf0f74ccc0 100755 (executable)
                        };
                        vip {
                                reg = <0x1012f200 0x20>;
+                               rockchip,priority = <3 3>;
                        };
                };
 
             compatible = "rockchip,cif";
             reg = <0x1010a000 0x2000>;
             interrupts = <GIC_SPI 8 IRQ_TYPE_LEVEL_HIGH>;
-            clocks = <&clk_gates3 3>,<&clk_gates6 5>,<&clk_gates6 4>,<&clk_cif0_in>,<&clk_cif_out>;
+            clocks = <&pd_vip>,<&clk_gates6 5>,<&clk_gates6 4>,<&clk_cif0_in>,<&clk_cif_out>;
             clock-names = "pd_cif0", "aclk_cif0","hclk_cif0","cif0_in","cif0_out";
             status = "okay";
             };
index 25417fcb20ecbaade94e3058c54a511f7654c232..a708831d2f4bb6b57d101852376d1fbcc3d92a62 100755 (executable)
@@ -21,4 +21,4 @@ obj-$(CONFIG_BLOCK_RKNAND) += rknandbase.o
 obj-$(CONFIG_DDR_TEST) += ddr_test.o
 obj-$(CONFIG_RK_PM_TESTS) += rk_pm_tests/
 obj-$(CONFIG_RK_FT_TEST) += rk_pm_tests/ft/
-obj-$(CONFIG_ROCK_CHIP_SOC_CAMERA) += board-rk30-sdk-camera.o
+obj-$(CONFIG_ROCK_CHIP_SOC_CAMERA) += rk_camera.o
diff --git a/arch/arm/mach-rockchip/board-rk30-sdk-camera.c b/arch/arm/mach-rockchip/board-rk30-sdk-camera.c
deleted file mode 100644 (file)
index c2112ec..0000000
+++ /dev/null
@@ -1,104 +0,0 @@
-#include "rk_camera.h"
-#include <linux/regulator/consumer.h>
-#include <linux/regulator/driver.h>
-#include <linux/regulator/machine.h>
-#include <linux/delay.h>
-//*****************yzm***************
-static struct rkcamera_platform_data *new_camera_head; 
-   
-#define PMEM_CAM_SIZE PMEM_CAM_NECESSARY 
-/*****************************************************************************************
- * camera  devices
- * author: ddl@rock-chips.com
- *****************************************************************************************/
-#define CONFIG_SENSOR_POWER_IOCTL_USR     1 //define this refer to your board layout
-#define CONFIG_SENSOR_RESET_IOCTL_USR     0
-#define CONFIG_SENSOR_POWERDOWN_IOCTL_USR         0
-#define CONFIG_SENSOR_FLASH_IOCTL_USR     0
-#define CONFIG_SENSOR_AF_IOCTL_USR        0
-
-#if CONFIG_SENSOR_POWER_IOCTL_USR
-
-static int sensor_power_usr_cb (struct rk29camera_gpio_res *res,int on)
-{
-       //#error "CONFIG_SENSOR_POWER_IOCTL_USR is 1, sensor_power_usr_cb function must be writed!!";
-       return 0;
-}
-#endif
-
-#if CONFIG_SENSOR_RESET_IOCTL_USR
-static int sensor_reset_usr_cb (struct rk29camera_gpio_res *res,int on)
-{
-
-printk(KERN_EMERG "/$$$$$$$$$$$$$$$$$$$$$$//n Here I am: %s:%i-------%s()/n", __FILE__, __LINE__,__FUNCTION__);
-
-       #error "CONFIG_SENSOR_RESET_IOCTL_USR is 1, sensor_reset_usr_cb function must be writed!!";
-}
-#endif
-
-#if CONFIG_SENSOR_POWERDOWN_IOCTL_USR
-static int sensor_powerdown_usr_cb (struct rk29camera_gpio_res *res,int on)
-{
-
-printk(KERN_EMERG "/$$$$$$$$$$$$$$$$$$$$$$//n Here I am: %s:%i-------%s()/n", __FILE__, __LINE__,__FUNCTION__);
-
-       #error "CONFIG_SENSOR_POWERDOWN_IOCTL_USR is 1, sensor_powerdown_usr_cb function must be writed!!";
-}
-#endif
-
-#if CONFIG_SENSOR_FLASH_IOCTL_USR
-static int sensor_flash_usr_cb (struct rk29camera_gpio_res *res,int on)
-{
-
-printk(KERN_EMERG "/$$$$$$$$$$$$$$$$$$$$$$//n Here I am: %s:%i-------%s()/n", __FILE__, __LINE__,__FUNCTION__);
-
-       #error "CONFIG_SENSOR_FLASH_IOCTL_USR is 1, sensor_flash_usr_cb function must be writed!!";
-}
-#endif
-
-#if CONFIG_SENSOR_AF_IOCTL_USR
-static int sensor_af_usr_cb (struct rk29camera_gpio_res *res,int on)
-{
-
-printk(KERN_EMERG "/$$$$$$$$$$$$$$$$$$$$$$//n Here I am: %s:%i-------%s()/n", __FILE__, __LINE__,__FUNCTION__);
-
-       #error "CONFIG_SENSOR_AF_IOCTL_USR is 1, sensor_af_usr_cb function must be writed!!";
-}
-
-#endif
-
-static struct rk29camera_platform_ioctl_cb     sensor_ioctl_cb = {
-       #if CONFIG_SENSOR_POWER_IOCTL_USR
-       .sensor_power_cb = sensor_power_usr_cb,
-       #else
-       .sensor_power_cb = NULL,
-       #endif
-
-       #if CONFIG_SENSOR_RESET_IOCTL_USR
-       .sensor_reset_cb = sensor_reset_usr_cb,
-       #else
-       .sensor_reset_cb = NULL,
-       #endif
-
-       #if CONFIG_SENSOR_POWERDOWN_IOCTL_USR
-       .sensor_powerdown_cb = sensor_powerdown_usr_cb,
-       #else
-       .sensor_powerdown_cb = NULL,
-       #endif
-
-       #if CONFIG_SENSOR_FLASH_IOCTL_USR
-       .sensor_flash_cb = sensor_flash_usr_cb,
-       #else
-       .sensor_flash_cb = NULL,
-       #endif
-
-       #if CONFIG_SENSOR_AF_IOCTL_USR
-       .sensor_af_cb = sensor_af_usr_cb,       
-       #else
-       .sensor_af_cb = NULL,
-       #endif
-};
-
-#include "../../../drivers/media/video/rk30_camera.c"
-
-
index 8a5e4dcb92a3d5b72405fd4a9de6b45c007dd13e..7d8db65d313accc1380ff5f2eb1a04575d592e43 100644 (file)
@@ -1,10 +1,11 @@
 #include "rk_camera.h"\r
+#include "rk30_camera.h"\r
 #include <linux/gpio.h>\r
 #include <linux/delay.h>\r
 #include <linux/version.h>\r
 #include <linux/moduleparam.h>\r
 #include <linux/of_gpio.h>\r
-//**********yzm***********//\r
+/**********yzm***********/\r
 #include <linux/of.h>\r
 #include <linux/of_irq.h>\r
 #include <linux/kernel.h>\r
 #include <linux/of_platform.h>\r
 #include <linux/of_fdt.h>\r
 #include <linux/module.h>\r
-//**********yzm***********//\r
+/**********yzm***********/\r
 \r
-#define PMEM_CAM_NECESSARY      0x00000000    //yzm\r
+//#define PMEM_CAM_NECESSARY    0x00000000    /*yzm*/\r
 \r
-static int camio_version = KERNEL_VERSION(0,1,9);//yzm camio_version\r
+static int camio_version = KERNEL_VERSION(0,1,9);/*yzm camio_version*/ \r
 module_param(camio_version, int, S_IRUGO);\r
 \r
-static int camera_debug = 0;//yzm camera_debug\r
+static int camera_debug = 0;/*yzm*/ \r
 module_param(camera_debug, int, S_IRUGO|S_IWUSR);    \r
 \r
 #undef  CAMMODULE_NAME\r
@@ -38,9 +39,17 @@ static int rk_sensor_io_deinit(int sensor);
 static int rk_sensor_ioctrl(struct device *dev,enum rk29camera_ioctrl_cmd cmd, int on);\r
 static int rk_sensor_power(struct device *dev, int on);\r
 static int rk_sensor_register(void);\r
-//static int rk_sensor_reset(struct device *dev);\r
+/*static int rk_sensor_reset(struct device *dev);*/\r
+\r
+static int rk_dts_sensor_probe(struct platform_device *pdev);\r
+static int rk_dts_sensor_remove(struct platform_device *pdev);\r
+static int rk_dts_cif_probe(struct platform_device *pdev);\r
+static int rk_dts_cif_remove(struct platform_device *pdev);\r
+\r
 static int rk_sensor_powerdown(struct device *dev, int on);\r
 \r
+static struct rkcamera_platform_data *new_camera_head; \r
+\r
 static struct rk29camera_platform_data rk_camera_platform_data = {\r
     .io_init = rk_sensor_io_init,\r
     .io_deinit = rk_sensor_io_deinit,\r
@@ -49,6 +58,14 @@ static struct rk29camera_platform_data rk_camera_platform_data = {
 \r
 };\r
 \r
+struct rk29camera_platform_ioctl_cb    sensor_ioctl_cb = {\r
+       .sensor_power_cb = NULL,\r
+       .sensor_reset_cb = NULL,\r
+       .sensor_powerdown_cb = NULL,\r
+       .sensor_flash_cb = NULL,\r
+       .sensor_af_cb = NULL,\r
+};\r
+\r
 \r
 static u64 rockchip_device_camera_dmamask = 0xffffffffUL;\r
 #if RK_SUPPORT_CIF0\r
@@ -61,9 +78,9 @@ static struct resource rk_camera_resource_host_1[2] = {};
 #if RK_SUPPORT_CIF0\r
  struct platform_device rk_device_camera_host_0 = {\r
        .name             = RK29_CAM_DRV_NAME,\r
-       .id       = RK_CAM_PLATFORM_DEV_ID_0,                           // This is used to put cameras on this interface \r
+       .id       = RK_CAM_PLATFORM_DEV_ID_0,                           /* This is used to put cameras on this interface*/ \r
        .num_resources= 2,\r
-       .resource         = rk_camera_resource_host_0,//yzm\r
+       .resource         = rk_camera_resource_host_0,/*yzm*/\r
        .dev                    = {\r
                .dma_mask = &rockchip_device_camera_dmamask,\r
                .coherent_dma_mask = 0xffffffffUL,\r
@@ -75,9 +92,9 @@ static struct resource rk_camera_resource_host_1[2] = {};
 #if RK_SUPPORT_CIF1\r
  struct platform_device rk_device_camera_host_1 = {\r
        .name             = RK29_CAM_DRV_NAME,\r
-       .id       = RK_CAM_PLATFORM_DEV_ID_1,                           // This is used to put cameras on this interface \r
+       .id       = RK_CAM_PLATFORM_DEV_ID_1,                           /* This is used to put cameras on this interface */\r
        .num_resources    = ARRAY_SIZE(rk_camera_resource_host_1),\r
-       .resource         = rk_camera_resource_host_1,//yzm\r
+       .resource         = rk_camera_resource_host_1,/*yzm*/\r
        .dev                    = {\r
                .dma_mask = &rockchip_device_camera_dmamask,\r
                .coherent_dma_mask = 0xffffffffUL,\r
@@ -120,7 +137,6 @@ static struct platform_driver rk_sensor_driver =
     .remove            = rk_dts_sensor_remove,\r
 };\r
 \r
-//************yzm***************\r
 \r
 static int rk_dts_sensor_remove(struct platform_device *pdev)\r
 {\r
@@ -133,11 +149,12 @@ static int        rk_dts_sensor_probe(struct platform_device *pdev)
        struct device *dev = &pdev->dev;\r
        struct rkcamera_platform_data *new_camera_list;\r
        \r
+\r
        debug_printk( "/$$$$$$$$$$$$$$$$$$$$$$//n Here I am: %s:%i-------%s()/n", __FILE__, __LINE__,__FUNCTION__);\r
+       \r
        np = dev->of_node;\r
        if (!np)\r
                return -ENODEV;\r
-       \r
        for_each_child_of_node(np, cp) {\r
                u32 flash_attach,mir,i2c_rata,i2c_chl,i2c_add,cif_chl,mclk_rate,is_front;\r
                u32 resolution,pwdn_info,powerup_sequence;\r
@@ -207,9 +224,9 @@ static int  rk_dts_sensor_probe(struct platform_device *pdev)
 \r
                strcpy(new_camera->dev.i2c_cam_info.type, cp->name);\r
                new_camera->dev.i2c_cam_info.addr = i2c_add>>1;\r
-               new_camera->dev.desc_info.host_desc.bus_id = RK29_CAM_PLATFORM_DEV_ID+cif_chl;//yzm\r
-               new_camera->dev.desc_info.host_desc.i2c_adapter_id = i2c_chl;//yzm\r
-               new_camera->dev.desc_info.host_desc.module_name = cp->name;//const\r
+               new_camera->dev.desc_info.host_desc.bus_id = RK29_CAM_PLATFORM_DEV_ID+cif_chl;/*yzm*/\r
+               new_camera->dev.desc_info.host_desc.i2c_adapter_id = i2c_chl;/*yzm*/\r
+               new_camera->dev.desc_info.host_desc.module_name = cp->name;/*const*/\r
                new_camera->dev.device_info.name = "soc-camera-pdrv";\r
                if(is_front)\r
                        sprintf(new_camera->dev_name,"%s_%s",cp->name,"front");\r
@@ -232,10 +249,6 @@ static int rk_dts_sensor_probe(struct platform_device *pdev)
                new_camera->mclk_rate = mclk_rate;\r
                new_camera->of_node = cp;\r
                        \r
-               //      device = container_of(&(new_camera[sensor_num].dev.desc_info),rk_camera_device_register_info_t,desc_info);\r
-               //      debug_printk( "sensor num %d ,desc_info point %p +++++++\n",sensor_num,&(new_camera.dev.desc_info));\r
-               //      debug_printk( "sensor num %d ,dev %p +++++++\n",sensor_num,&(new_camera.dev));\r
-               //      debug_printk( "sensor num %d ,device point %p +++++++\n",sensor_num,device);\r
                    debug_printk( "******************* /n power = %x\n", power);\r
                        debug_printk( "******************* /n powerdown = %x\n", powerdown);\r
                        debug_printk( "******************* /n i2c_add = %x\n", new_camera->dev.i2c_cam_info.addr << 1);\r
@@ -253,7 +266,7 @@ static int rk_dts_cif_remove(struct platform_device *pdev)
         return 0;\r
 }\r
        \r
-static int rk_dts_cif_probe(struct platform_device *pdev) //yzm\r
+static int rk_dts_cif_probe(struct platform_device *pdev) /*yzm*/\r
 {\r
        int irq,err;\r
        struct device *dev = &pdev->dev;\r
@@ -268,7 +281,7 @@ static int rk_dts_cif_probe(struct platform_device *pdev) //yzm
                return -ENODEV;\r
        }\r
        rk_camera_resource_host_0[0].flags = IORESOURCE_MEM;\r
-       //map irqs\r
+       /*map irqs*/\r
        irq = irq_of_parse_and_map(dev->of_node, 0);\r
        if (irq < 0) {\r
                printk(KERN_EMERG "Get irq resource from %s platform device failed!",pdev->name);\r
@@ -277,8 +290,6 @@ static int rk_dts_cif_probe(struct platform_device *pdev) //yzm
        rk_camera_resource_host_0[1].start = irq;\r
        rk_camera_resource_host_0[1].end   = irq;\r
        rk_camera_resource_host_0[1].flags = IORESOURCE_IRQ;\r
-       //debug_printk( "/$$$$$$$$$$$$$$$$$$$$$$//n res = [%x--%x] \n",rk_camera_resource_host_0[0].start , rk_camera_resource_host_0[0].end);\r
-       //debug_printk( "/$$$$$$$$$$$$$$$$$$$$$$//n irq_num = %d\n",irq);\r
        return 0;\r
 }\r
        \r
@@ -292,7 +303,8 @@ static int rk_cif_sensor_init(void)
 \r
        return 0;\r
 }\r
-       \r
+\r
+/************yzm**************end*/\r
 \r
 static int sensor_power_default_cb (struct rk29camera_gpio_res *res, int on)\r
 {\r
@@ -307,12 +319,12 @@ debug_printk( "/$$$$$$$$$$$$$$$$$$$$$$//n Here I am: %s:%i-------%s()\n", __FILE
     if (camera_power != INVALID_GPIO)  {\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
+               /*gpio_set_value(camera_power, ((camera_ioflag&RK29_CAM_POWERACTIVE_MASK)>>RK29_CAM_POWERACTIVE_BITPOS));*/\r
                                gpio_direction_output(camera_power,1);\r
                                dprintk("%s PowerPin=%d ..PinLevel = %x",res->dev_name, camera_power, ((camera_ioflag&RK29_CAM_POWERACTIVE_MASK)>>RK29_CAM_POWERACTIVE_BITPOS));\r
                        msleep(10);\r
                } else {\r
-                       //gpio_set_value(camera_power, (((~camera_ioflag)&RK29_CAM_POWERACTIVE_MASK)>>RK29_CAM_POWERACTIVE_BITPOS));\r
+                       /*gpio_set_value(camera_power, (((~camera_ioflag)&RK29_CAM_POWERACTIVE_MASK)>>RK29_CAM_POWERACTIVE_BITPOS));*/\r
                                gpio_direction_output(camera_power,0);\r
                                dprintk("%s PowerPin=%d ..PinLevel = %x",res->dev_name, camera_power, (((~camera_ioflag)&RK29_CAM_POWERACTIVE_MASK)>>RK29_CAM_POWERACTIVE_BITPOS));\r
                }\r
@@ -453,171 +465,6 @@ debug_printk( "/$$$$$$$$$$$$$$$$$$$$$$//n Here I am: %s:%i-------%s()/n", __FILE
        return ret;\r
 }\r
 \r
-/*\r
-static void rk29_sensor_fps_get(int idx, unsigned int *val, int w, int h)\r
-{\r
-\r
-debug_printk( "/$$$$$$$$$$$$$$$$$$$$$$//n Here I am: %s:%i-------%s()/n", __FILE__, __LINE__,__FUNCTION__);\r
-\r
-\r
-    switch (idx)\r
-    {\r
-        #ifdef CONFIG_SENSOR_0\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==800) && (h==600)) {\r
-                *val = CONFIG_SENSOR_SVGA_FPS_FIXED_0;\r
-            } else if ((w==1280) && (h==720)) {\r
-                *val = CONFIG_SENSOR_720P_FPS_FIXED_0;\r
-            }\r
-            break;\r
-        }\r
-        #endif\r
-        #ifdef CONFIG_SENSOR_1\r
-        case 1:\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==800) && (h==600)) {\r
-                *val = CONFIG_SENSOR_SVGA_FPS_FIXED_1;\r
-            } else if ((w==1280) && (h==720)) {\r
-                *val = CONFIG_SENSOR_720P_FPS_FIXED_1;\r
-            }\r
-            break;\r
-        }\r
-        #endif\r
-        #ifdef CONFIG_SENSOR_01\r
-        case 2:\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==800) && (h==600)) {\r
-                *val = CONFIG_SENSOR_SVGA_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 3:\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==800) && (h==600)) {\r
-                *val = CONFIG_SENSOR_SVGA_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
-        #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==800) && (h==600)) {\r
-                *val = CONFIG_SENSOR_SVGA_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==800) && (h==600)) {\r
-                *val = CONFIG_SENSOR_SVGA_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
-            eprintk(" sensor-%d have not been define in board file!",idx);\r
-    }\r
-}\r
-*/\r
 static int _rk_sensor_io_init_(struct rk29camera_gpio_res *gpio_res,struct device_node *of_node)\r
 {\r
     int ret = 0;\r
@@ -628,8 +475,7 @@ static int _rk_sensor_io_init_(struct rk29camera_gpio_res *gpio_res,struct devic
     bool io_requested_in_camera;\r
        enum of_gpio_flags flags;\r
        \r
-       struct rkcamera_platform_data *new_camera;//yzm\r
-       //struct device_node *parent_node;\r
+       struct rkcamera_platform_data *new_camera;/*yzm*/\r
        debug_printk( "/$$$$$$$$$$$$$$$$$$$$$$//n Here I am: %s:%i-------%s()\n", __FILE__, __LINE__,__FUNCTION__);\r
 \r
 \r
@@ -644,14 +490,12 @@ static int _rk_sensor_io_init_(struct rk29camera_gpio_res *gpio_res,struct devic
     if (camera_power != INVALID_GPIO) {\r
                debug_printk( "/$$$$$$$$$$$$$$$$$$$$$$/ camera_power  = %x\n", camera_power );\r
 \r
-               camera_power = of_get_named_gpio_flags(of_node,"rockchip,power",0,&flags);//yzm\r
-               gpio_res->gpio_power = camera_power;//yzm,½«ioµÄÍêÕûÐÅÏ¢´«»ØÈ¥¡£\r
+               camera_power = of_get_named_gpio_flags(of_node,"rockchip,power",0,&flags);/*yzm*/\r
+               gpio_res->gpio_power = camera_power;/*yzm information back to the IO*/\r
 \r
-               \r
-               //dev->of_node = parent_node;//½«dev->of_node»¹Ô­\r
                debug_printk( "/$$$$$$$$$$$$$$$$$$$$$$/ camera_power  = %x\n", camera_power );  \r
 \r
-               ret = gpio_request(camera_power, "camera power");    //ÉêÇëÃûΪ"camera power"µÄio¹Ü½Å\r
+               ret = gpio_request(camera_power, "camera power"); \r
         if (ret) {\r
                        \r
             io_requested_in_camera = false;\r
@@ -735,8 +579,8 @@ static int _rk_sensor_io_init_(struct rk29camera_gpio_res *gpio_res,struct devic
        if (camera_powerdown != INVALID_GPIO) {\r
                debug_printk( "/$$$$$$$$$$$$$$$$$$$$$$/ camera_powerdown  = %x\n", camera_powerdown );\r
 \r
-               camera_powerdown = of_get_named_gpio_flags(of_node,"rockchip,powerdown",0,&flags);//yzm\r
-               gpio_res->gpio_powerdown = camera_powerdown;//yzm,½«ioµÄÍêÕûÐÅÏ¢´«»ØÈ¥¡£\r
+               camera_powerdown = of_get_named_gpio_flags(of_node,"rockchip,powerdown",0,&flags);/*yzm*/\r
+               gpio_res->gpio_powerdown = camera_powerdown;/*yzm information back to the IO*/\r
 \r
                debug_printk( "/$$$$$$$$$$$$$$$$$$$$$$/ camera_powerdown  = %x\n", camera_powerdown );  \r
                ret = gpio_request(camera_powerdown, "camera powerdown");\r
@@ -914,7 +758,7 @@ debug_printk( "/$$$$$$$$$$$$$$$$$$$$$$//n Here I am: %s:%i-------%s()/n", __FILE
        }\r
        if (gpio_res->gpio_init & RK29_CAM_AFACTIVE_MASK) {\r
            if (camera_af != INVALID_GPIO)  {\r
-              // gpio_direction_input(camera_af);\r
+              /* gpio_direction_input(camera_af);*/\r
                gpio_free(camera_af);\r
            }\r
        }       \r
@@ -979,10 +823,9 @@ static int rk_sensor_ioctrl(struct device *dev,enum rk29camera_ioctrl_cmd cmd, i
     struct rkcamera_platform_data *new_cam_dev = NULL;\r
        struct rk29camera_platform_data* plat_data = &rk_camera_platform_data;\r
     int ret = RK29_CAM_IO_SUCCESS,i = 0;\r
-    //struct soc_camera_link *dev_icl = NULL;//yzm\r
-       struct soc_camera_desc *dev_icl = NULL;//yzm\r
+       struct soc_camera_desc *dev_icl = NULL;/*yzm*/\r
        struct rkcamera_platform_data *new_camera;\r
-debug_printk( "/$$$$$$$$$$$$$$$$$$$$$$//n Here I am: %s:%i-------%s()/n", __FILE__, __LINE__,__FUNCTION__);\r
+       debug_printk( "/$$$$$$$$$$$$$$$$$$$$$$//n Here I am: %s:%i-------%s()/n", __FILE__, __LINE__,__FUNCTION__);\r
 \r
     if (res == NULL) {\r
                new_camera = new_camera_head;\r
@@ -991,8 +834,7 @@ debug_printk( "/$$$$$$$$$$$$$$$$$$$$$$//n Here I am: %s:%i-------%s()/n", __FILE
             if (strcmp(new_camera->dev_name, dev_name(dev)) == 0) {\r
                 res = (struct rk29camera_gpio_res *)&new_camera->io; \r
                 new_cam_dev = &new_camera[i];\r
-                //dev_icl = &new_camera[i].dev.link_info;\r
-                                dev_icl = &new_camera->dev.desc_info;//yzm\r
+                                dev_icl = &new_camera->dev.desc_info;/*yzm*/\r
                 break;\r
             }\r
             new_camera = new_camera->next_camera;;\r
@@ -1069,8 +911,7 @@ debug_printk( "/$$$$$$$$$$$$$$$$$$$$$$//n Here I am: %s:%i-------%s()/n", __FILE
         case Cam_Mclk:\r
         {\r
             if (plat_data->sensor_mclk && dev_icl) {\r
-                //plat_data->sensor_mclk(dev_icl->bus_id,(on!=0)?1:0,on);\r
-                               plat_data->sensor_mclk(dev_icl->host_desc.bus_id,(on!=0)?1:0,on);//yzm\r
+                               plat_data->sensor_mclk(dev_icl->host_desc.bus_id,(on!=0)?1:0,on);/*yzm*/\r
             } else { \r
                 eprintk( "%s(%d): sensor_mclk(%p) or dev_icl(%p) is NULL",\r
                     __FUNCTION__,__LINE__,plat_data->sensor_mclk,dev_icl);\r
@@ -1168,7 +1009,7 @@ debug_printk( "/$$$$$$$$$$$$$$$$$$$$$$//n Here I am: %s:%i-------%s()\n", __FILE
     return ret;\r
 }\r
 \r
-static int rk_sensor_power(struct device *dev, int on)   //icd->pdev\r
+static int rk_sensor_power(struct device *dev, int on)   /*icd->pdev*/\r
 {\r
     int powerup_sequence,mclk_rate;\r
     \r
@@ -1180,37 +1021,35 @@ static int rk_sensor_power(struct device *dev, int on)   //icd->pdev
 \r
 debug_printk( "/$$$$$$$$$$$$$$$$$$$$$$//n Here I am: %s:%i-------%s()\n", __FILE__, __LINE__,__FUNCTION__);\r
 \r
-    new_camera = plat_data->register_dev_new;    //new_camera[]\r
+    new_camera = plat_data->register_dev_new;    /*new_camera[]*/\r
     \r
-       while (new_camera != NULL) {//yzm\r
-    //while (strstr(new_camera->dev_name,"end")==NULL) {\r
+       while (new_camera != NULL) {\r
 \r
-        if (new_camera->io.gpio_powerdown != INVALID_GPIO) {           //true\r
+        if (new_camera->io.gpio_powerdown != INVALID_GPIO) {           \r
             gpio_direction_output(new_camera->io.gpio_powerdown,\r
                 ((new_camera->io.gpio_flag&RK29_CAM_POWERDNACTIVE_MASK)>>RK29_CAM_POWERDNACTIVE_BITPOS));            \r
         }\r
 \r
-               debug_printk( "new_camera->dev_name= %s \n", new_camera->dev_name);     //yzm\r
-               debug_printk( "dev_name(dev)= %s \n", dev_name(dev));    //yzm\r
+               debug_printk( "new_camera->dev_name= %s \n", new_camera->dev_name);     /*yzm*/\r
+               debug_printk( "dev_name(dev)= %s \n", dev_name(dev));    /*yzm*/\r
                \r
-        if (strcmp(new_camera->dev_name,dev_name(dev))) {              //µ±²»ÊÇ´ò¿ªµÄsensorʱΪTRUE\r
-                       debug_printk( "/$$$$$$$$$$$$$$$$$$$$$$//n Here I am: %s:%i\n", __FILE__, __LINE__);//yzm\r
+        if (strcmp(new_camera->dev_name,dev_name(dev))) {              \r
+                       debug_printk( "/$$$$$$$$$$$$$$$$$$$$$$//n Here I am: %s:%i\n", __FILE__, __LINE__);\r
             if (sensor_ioctl_cb.sensor_powerdown_cb && on)\r
                {\r
-                       debug_printk( "/$$$$$$$$$$$$$$$$$$$$$$//n Here I am: %s:%i\n", __FILE__, __LINE__);//yzm\r
+                       debug_printk( "/$$$$$$$$$$$$$$$$$$$$$$//n Here I am: %s:%i\n", __FILE__, __LINE__);\r
                        sensor_ioctl_cb.sensor_powerdown_cb(&new_camera->io,1);\r
                }\r
         } else {\r
             new_device = new_camera;\r
             dev_io = &new_camera->io;\r
-            debug_printk( "/$$$$$$$$$$$$$$$$$$$$$$//n Here I am: %s:%i\n", __FILE__, __LINE__);//yzm\r
+            debug_printk( "/$$$$$$$$$$$$$$$$$$$$$$//n Here I am: %s:%i\n", __FILE__, __LINE__);/*yzm*/\r
             if (!Sensor_Support_DirectResume(new_camera->pwdn_info))\r
                 real_pwroff = true;                    \r
             else\r
                 real_pwroff = false;\r
         }\r
-        //new_camera++;\r
-        new_camera = new_camera->next_camera;//yzm\r
+        new_camera = new_camera->next_camera;\r
     }\r
 \r
     if (new_device != NULL) {\r
@@ -1225,23 +1064,21 @@ debug_printk( "/$$$$$$$$$$$$$$$$$$$$$$//n Here I am: %s:%i-------%s()\n", __FILE
     }\r
         \r
     if (on) {\r
-               debug_printk( "/$$$$$$$$$$$$$$$$$$$$$$//n Here I am: %s:%i\n", __FILE__, __LINE__);//yzm\r
+               debug_printk( "/$$$$$$$$$$$$$$$$$$$$$$//n Here I am: %s:%i\n", __FILE__, __LINE__);\r
         rk_sensor_pwrseq(dev, powerup_sequence, on,mclk_rate);  \r
     } else {\r
         if (real_pwroff) {\r
             if (rk_sensor_pwrseq(dev, powerup_sequence, on,mclk_rate)<0)    /* ddl@rock-chips.com: v0.1.5 */\r
                 goto PowerDown;\r
             \r
-            /*ddl@rock-chips.com: all power down switch to Hi-Z after power off*/  //¸ß×è̬\r
+            /*ddl@rock-chips.com: all power down switch to Hi-Z after power off*/\r
             new_camera = plat_data->register_dev_new;\r
-                       while (new_camera != NULL) {//yzm\r
-            //while (strstr(new_camera->dev_name,"end")==NULL) {\r
+                       while (new_camera != NULL) {\r
                 if (new_camera->io.gpio_powerdown != INVALID_GPIO) {\r
                     gpio_direction_input(new_camera->io.gpio_powerdown);            \r
                 }\r
                 new_camera->pwdn_info |= 0x01;\r
-                //new_camera++;\r
-                new_camera = new_camera->next_camera;//yzm\r
+                new_camera = new_camera->next_camera;\r
             }\r
         } else {  \r
 PowerDown:\r
@@ -1287,7 +1124,7 @@ debug_printk( "/$$$$$$$$$$$$$$$$$$$$$$//n Here I am: %s:%i-------%s()\n", __FILE
 \r
        new_camera = new_camera_head;\r
        \r
-       while (new_camera != NULL) {//yzm       \r
+       while (new_camera != NULL) {    \r
         if (new_camera->dev.i2c_cam_info.addr == INVALID_VALUE) {\r
             WARN(1, \r
                 KERN_ERR "%s(%d): new_camera[%d] i2c addr is invalidate!",\r
@@ -1295,9 +1132,9 @@ debug_printk( "/$$$$$$$$$$$$$$$$$$$$$$//n Here I am: %s:%i-------%s()\n", __FILE
             continue;\r
         }\r
         sprintf(new_camera->dev_name,"%s_%d",new_camera->dev.device_info.dev.init_name,i+3);\r
-        new_camera->dev.device_info.dev.init_name =(const char*)&new_camera->dev_name[0];//ת»»³ÉÖ¸Õë\r
+        new_camera->dev.device_info.dev.init_name =(const char*)&new_camera->dev_name[0];\r
         new_camera->io.dev_name =(const char*)&new_camera->dev_name[0];\r
-        if (new_camera->orientation == INVALID_VALUE) {        //¹ØÓÚÇ°ºó·½Ïò\r
+        if (new_camera->orientation == INVALID_VALUE) {\r
             if (strstr(new_camera->dev_name,"back")) {                    \r
                 new_camera->orientation = 90;\r
             } else {\r
@@ -1311,22 +1148,23 @@ debug_printk( "/$$$$$$$$$$$$$$$$$$$$$$//n Here I am: %s:%i-------%s()\n", __FILE
         if ((new_camera->fov_v <= 0) || (new_camera->fov_v>360))\r
             new_camera->fov_v = 100;        \r
 \r
-               new_camera->dev.desc_info.subdev_desc.power = rk_sensor_power;//yzm\r
-               new_camera->dev.desc_info.subdev_desc.powerdown = rk_sensor_powerdown;//yzm\r
-               new_camera->dev.desc_info.host_desc.board_info =&new_camera->dev.i2c_cam_info; //yzm\r
+               new_camera->dev.desc_info.subdev_desc.power = rk_sensor_power;\r
+               new_camera->dev.desc_info.subdev_desc.powerdown = rk_sensor_powerdown;\r
+               new_camera->dev.desc_info.host_desc.board_info =&new_camera->dev.i2c_cam_info; \r
 \r
-        new_camera->dev.device_info.id = i+6;//?? platform_device.id\r
-               new_camera->dev.device_info.dev.platform_data = &new_camera->dev.desc_info;//yzm\r
+        new_camera->dev.device_info.id = i+6;\r
+               new_camera->dev.device_info.dev.platform_data = &new_camera->dev.desc_info;\r
                debug_printk("platform_data(desc_info) %p +++++++++++++\n",new_camera->dev.device_info.dev.platform_data);\r
-               new_camera->dev.desc_info.subdev_desc.drv_priv = &rk_camera_platform_data;//yzm\r
+               new_camera->dev.desc_info.subdev_desc.drv_priv = &rk_camera_platform_data;\r
 \r
         platform_device_register(&(new_camera->dev.device_info));\r
-debug_printk( "/$$$$$$$$$$$$$$$$$$$$$$//n Here I am: %s:%i-------%s()\n", __FILE__, __LINE__,__FUNCTION__);  \r
-debug_printk("new_camera = %p +++++++++++++\n",new_camera);\r
-debug_printk("new_camera->next_camera = %p +++++++++++++\n",new_camera->next_camera);\r
+               debug_printk( "/$$$$$$$$$$$$$$$$$$$$$$//n Here I am: %s:%i-------%s()\n", __FILE__, __LINE__,__FUNCTION__);  \r
+               debug_printk("new_camera = %p +++++++++++++\n",new_camera);\r
+               debug_printk("new_camera->next_camera = %p +++++++++++++\n",new_camera->next_camera);\r
 \r
         new_camera = new_camera->next_camera;\r
     }\r
        \r
                return 0;\r
 }\r
+#include "../../../drivers/media/video/rk30_camera.c"\r
index c2ed4d44f00451c1d682c9e28eeee670e9c7572e..1e66d09a59e9fa189e613a9cc98ee7227611081f 100644 (file)
@@ -67,7 +67,7 @@
 #define RK29_CAM_SENSOR_OV2655 ov2655
 #define RK29_CAM_SENSOR_OV2659 ov2659
 
-#define RK29_CAM_SENSOR_OV2660 ov2660 //yzm
+#define RK29_CAM_SENSOR_OV2660 ov2660 /*yzm*/
 
 #define RK29_CAM_SENSOR_OV7690 ov7690
 #define RK29_CAM_SENSOR_OV3640 ov3640
 #define RK29_CAM_SENSOR_NAME_OV2655 "ov2655"
 #define RK29_CAM_SENSOR_NAME_OV2659 "ov2659"
 
-#define RK29_CAM_SENSOR_NAME_OV2660 "ov2660"  //yzm
+#define RK29_CAM_SENSOR_NAME_OV2660 "ov2660"  /*yzm*/
 
 
 #define RK29_CAM_SENSOR_NAME_OV7690 "ov7690"
 #define ov2655_I2C_ADDR             0x60
 #define ov2659_I2C_ADDR             0x60
 
-#define ov2660_I2C_ADDR             0x60   //yzm
+#define ov2660_I2C_ADDR             0x60   /*yzm*/
 
 #define ov7690_I2C_ADDR             0x42
 #define ov3640_I2C_ADDR             0x78
 #define ov2655_PWRDN_ACTIVE             0x01
 #define ov2659_PWRDN_ACTIVE             0x01
 
-#define ov2660_PWRDN_ACTIVE             0x01  //yzm
+#define ov2660_PWRDN_ACTIVE             0x01  /*yzm*/
 
 #define ov7690_PWRDN_ACTIVE             0x01
 #define ov3640_PWRDN_ACTIVE             0x01
@@ -565,7 +565,7 @@ typedef struct rk_sensor_user_init_data{
 
 typedef struct rk_camera_device_register_info {
     struct i2c_board_info i2c_cam_info;
-       struct soc_camera_desc desc_info;//yzm
+       struct soc_camera_desc desc_info;/*yzm*/
     struct platform_device device_info;
 }rk_camera_device_register_info_t;
 
@@ -601,7 +601,7 @@ struct rkcamera_platform_data {
     int fov_h;           /* fied of view horizontal */
     int fov_v;           /* fied of view vertical */
        struct device_node *of_node;
-       struct rkcamera_platform_data *next_camera;//yzm
+       struct rkcamera_platform_data *next_camera;/*yzm*/
                       
 };
 
@@ -614,7 +614,7 @@ struct rk29camera_platform_data {
     int (*sensor_mclk)(int cif_idx, int on, int clk_rate);
     
     struct rkcamera_platform_data *register_dev_new;  //sensor
-       struct device *cif_dev;//yzm  host
+       struct device *cif_dev;/*yzm host*/  
 };
 
 struct rk29camera_platform_ioctl_cb {
index 475f2c3bdad93a2731e13fcd8c67157b36b1fc8c..70f96bd5ddc9ecf6570fb35d6bf5f072f5bd62ee 100644 (file)
@@ -9,7 +9,7 @@
 #define RK29_CAM_SENSOR_OV2655 ov2655
 #define RK29_CAM_SENSOR_OV2659 ov2659
 
-#define RK29_CAM_SENSOR_OV2660 ov2660 //yzm
+#define RK29_CAM_SENSOR_OV2660 ov2660 /*yzm*/
 
 #define RK29_CAM_SENSOR_OV7690 ov7690
 #define RK29_CAM_SENSOR_OV3640 ov3640
@@ -57,7 +57,7 @@
 #define RK29_CAM_SENSOR_NAME_OV2655 "ov2655"
 #define RK29_CAM_SENSOR_NAME_OV2659 "ov2659"
 
-#define RK29_CAM_SENSOR_NAME_OV2660 "ov2660"  //yzm
+#define RK29_CAM_SENSOR_NAME_OV2660 "ov2660"  /*yzm*/
 
 
 #define RK29_CAM_SENSOR_NAME_OV7690 "ov7690"
 #define ov2655_I2C_ADDR             0x60
 #define ov2659_I2C_ADDR             0x60
 
-#define ov2660_I2C_ADDR             0x60   //yzm
+#define ov2660_I2C_ADDR             0x60   /*yzm*/
 
 #define ov7690_I2C_ADDR             0x42
 #define ov3640_I2C_ADDR             0x78
 #define ov2655_PWRDN_ACTIVE             0x01
 #define ov2659_PWRDN_ACTIVE             0x01
 
-#define ov2660_PWRDN_ACTIVE             0x01  //yzm
+#define ov2660_PWRDN_ACTIVE             0x01  /*yzm*/
 
 #define ov7690_PWRDN_ACTIVE             0x01
 #define ov3640_PWRDN_ACTIVE             0x01
index 4576be93d2b7166696f0436cc35743bf467c4aa2..e71b892054ef2a0daa0ccfd01eb519a5a513978c 100644 (file)
@@ -502,7 +502,7 @@ static int soc_camera_set_fmt(struct soc_camera_device *icd,
                icd->user_width, icd->user_height);
 
        /* set physical bus parameters */
-       return ici->ops->set_bus_param(icd, pix->pixelformat);//yzm
+       return ici->ops->set_bus_param(icd, pix->pixelformat);/*yzm*/
 }
 
 static int soc_camera_open(struct file *file)
@@ -775,7 +775,29 @@ static int soc_camera_s_fmt_vid_cap(struct file *file, void *priv,
 
        return ret;
 }
+/**************yzm*************/
+/* ddl@rock-chips.com : Add ioctrl - VIDIOC_ENUM_FRAMEINTERVALS for soc-camera */
+static int soc_camera_enum_frameintervals (struct file *file, void  *priv,
+                                          struct v4l2_frmivalenum *fival)
+{
+    struct soc_camera_device *icd = file->private_data;
+    struct soc_camera_host *ici = to_soc_camera_host(icd->parent);
+    struct v4l2_subdev *sd = soc_camera_to_subdev(icd);
+    int ret;
+    
+       WARN_ON(priv != file->private_data);
 
+    ret = v4l2_subdev_call(sd, video, enum_frameintervals, fival);
+    if (ret == -ENOIOCTLCMD) {
+        if (ici->ops->enum_frameinervals)
+           ret = ici->ops->enum_frameinervals(icd, fival); 
+        else 
+           ret = -ENOIOCTLCMD;
+    }
+
+    return ret;
+}
+/************yzm**************end*/
 static int soc_camera_enum_fmt_vid_cap(struct file *file, void  *priv,
                                       struct v4l2_fmtdesc *f)
 {
@@ -852,8 +874,11 @@ static int soc_camera_streamon(struct file *file, void *priv,
        else
                ret = vb2_streamon(&icd->vb2_vidq, i);
 
-       if (!ret)
-               v4l2_subdev_call(sd, video, s_stream, 1);
+       if (!ret){
+                       v4l2_subdev_call(sd, video, s_stream, 1);
+               if (ici->ops->s_stream)
+                       ici->ops->s_stream(icd, 1);                             /* ddl@rock-chips.com : Add stream control for host */
+               }
 
        return ret;
 }
@@ -873,6 +898,10 @@ static int soc_camera_streamoff(struct file *file, void *priv,
        if (icd->streamer != file)
                return -EBUSY;
 
+    /* ddl@rock-chips.com: v0.1.1 */
+    v4l2_subdev_call(sd, video, s_stream, 0);
+    if (ici->ops->s_stream)
+               ici->ops->s_stream(icd, 0);                             /* ddl@rock-chips.com : Add stream control for host */
        /*
         * This calls buf_release from host driver's videobuf_queue_ops for all
         * remaining buffers. When the last buffer is freed, stop capture
@@ -886,6 +915,169 @@ static int soc_camera_streamoff(struct file *file, void *priv,
 
        return 0;
 }
+/*************yzm*************/
+static int soc_camera_queryctrl(struct file *file, void *priv,
+                                  struct v4l2_queryctrl *qc)
+{
+       struct soc_camera_device *icd = file->private_data;
+       struct soc_camera_host *ici = to_soc_camera_host(icd->parent);
+       int i;
+       //printk( "/___________//n Here I am: %s:%i-------%s()\n", __FILE__, __LINE__,__FUNCTION__); 
+
+       WARN_ON(priv != file->private_data);
+
+       //printk("icd->ops->num_controls = %d ~~~~~~~~~~~~\n",icd->ops->num_controls);//yzm
+       //printk("ici->ops->num_controls = %d ~~~~~~~~~~~~\n",ici->ops->num_controls);//yzm
+
+       if (!qc->id)
+       return -EINVAL;
+   
+       /* first device controls */
+       //if device support digital zoom ,first use it to do zoom,zyc
+       for (i = 0; i < icd->ops->num_controls; i++)
+               if (qc->id == icd->ops->controls[i].id) {
+                  memcpy(qc, &(icd->ops->controls[i]),
+                  sizeof(*qc));
+                  return 0;
+                }
+   
+          /* then check host controls */
+       for (i = 0; i < ici->ops->num_controls; i++)
+               if (qc->id == ici->ops->controls[i].id) {
+                  memcpy(qc, &(ici->ops->controls[i]),
+                  sizeof(*qc));
+                  return 0;
+                }
+       //printk( "/___________//n Here I am: %s:%i-------%s()\n", __FILE__, __LINE__,__FUNCTION__); 
+       return -EINVAL;
+}
+
+/* ddl@rock-chips.com : Add ioctrl -VIDIOC_QUERYMENU */
+static int soc_camera_querymenu(struct file *file, void *priv,
+                                          struct v4l2_querymenu *qm)
+{
+       struct soc_camera_device *icd = file->private_data;
+       struct v4l2_queryctrl qctrl;
+       int i,j;
+   
+       qctrl.id = qm->id;
+
+       if (soc_camera_queryctrl(file,priv, &qctrl) == 0) {
+               for (i = 0; i < icd->ops->num_menus; i++) {
+                       if (qm->id == icd->ops->menus[i].id) {
+                          for (j=0; j<=(qctrl.maximum - qctrl.minimum); j++) {
+   
+                                  if (qm->index == icd->ops->menus[i].index) {
+                                          snprintf(qm->name, sizeof(qm->name), icd->ops->menus[i].name);
+                                          qm->reserved = 0;
+
+                                               return 0;
+                                       } else {
+                                                  i++;
+                                                  if ( i >= icd->ops->num_menus)
+                                                          return -EINVAL;
+                                  }
+                          }
+                  }
+          }
+   }
+   
+   return -EINVAL;
+}
+
+static int soc_camera_g_ctrl(struct file *file, void *priv,
+                                       struct v4l2_control *ctrl)
+{
+       struct soc_camera_device *icd = file->private_data;
+       struct soc_camera_host *ici = to_soc_camera_host(icd->parent);
+       struct v4l2_subdev *sd = soc_camera_to_subdev(icd);
+       int ret;
+   
+       WARN_ON(priv != file->private_data);
+   
+       if (ici->ops->get_ctrl) {
+               ret = ici->ops->get_ctrl(icd, ctrl);
+               if (ret != -ENOIOCTLCMD)
+                       return ret;
+       }
+   
+       return v4l2_subdev_call(sd, core, g_ctrl, ctrl);
+}
+
+static int soc_camera_s_ctrl(struct file *file, void *priv,
+                                       struct v4l2_control *ctrl)
+{
+       struct soc_camera_device *icd = file->private_data;
+       struct soc_camera_host *ici = to_soc_camera_host(icd->parent);
+       struct v4l2_subdev *sd = soc_camera_to_subdev(icd);
+       int ret;
+   
+       WARN_ON(priv != file->private_data);
+   
+       if (ici->ops->set_ctrl) {
+               ret = ici->ops->set_ctrl(icd, ctrl);
+               if (ret != -ENOIOCTLCMD)
+               return ret;
+       }
+   
+       return v4l2_subdev_call(sd, core, s_ctrl, ctrl);
+}
+
+   /* ddl@rock-chips.com : Add ioctrl -VIDIOC_XXX_ext_ctrl for soc-camera */
+static int soc_camera_try_ext_ctrl(struct file *file, void *priv,
+                                                          struct v4l2_ext_controls *ctrl)
+{
+       struct soc_camera_device *icd = file->private_data;
+       const struct v4l2_queryctrl *qctrl;
+       int i;
+  
+         WARN_ON(priv != file->private_data);
+  
+       if (ctrl->ctrl_class != V4L2_CTRL_CLASS_CAMERA)
+               return -EINVAL;
+  
+       for (i=0; i<ctrl->count; i++) {
+               qctrl = soc_camera_find_qctrl(icd->ops, ctrl->controls[i].id);
+               if (!qctrl)
+                       return -EINVAL;
+  
+               if ((ctrl->controls[i].value < qctrl->minimum) ||(ctrl->controls[i].value > qctrl->minimum))
+                       return -ERANGE;
+       }
+  
+       return 0;
+}
+
+  /* ddl@rock-chips.com : Add ioctrl -VIDIOC_XXX_ext_ctrl for soc-camera */
+static int soc_camera_g_ext_ctrl(struct file *file, void *priv,
+                                                         struct v4l2_ext_controls *ctrl)
+{
+        struct soc_camera_device *icd = file->private_data;
+        struct v4l2_subdev *sd = soc_camera_to_subdev(icd);
+        WARN_ON(priv != file->private_data);
+        if (ctrl->ctrl_class != V4L2_CTRL_CLASS_CAMERA)
+                return -EINVAL;
+        return v4l2_subdev_call(sd, core, g_ext_ctrls, ctrl);
+}
+
+ /* ddl@rock-chips.com : Add ioctrl -VIDIOC_XXX_ext_ctrl for soc-camera */
+static int soc_camera_s_ext_ctrl(struct file *file, void *priv,
+                             struct v4l2_ext_controls *ctrl)
+{
+    struct soc_camera_device *icd = file->private_data;
+    struct v4l2_subdev *sd = soc_camera_to_subdev(icd);
+
+    WARN_ON(priv != file->private_data);
+
+    if (ctrl->ctrl_class != V4L2_CTRL_CLASS_CAMERA)
+        return -EINVAL;
+
+    return v4l2_subdev_call(sd, core, s_ext_ctrls, ctrl);
+}
+ /*************yzm*************end*/
 
 static int soc_camera_cropcap(struct file *file, void *fh,
                              struct v4l2_cropcap *a)
@@ -1180,7 +1372,7 @@ static int soc_camera_probe(struct soc_camera_device *icd)
        ret = video_dev_create(icd);
        if (ret < 0)
                goto evdc;
-       ssdd->socdev = icd;//yzm
+       ssdd->socdev = icd;/*yzm*/
        /* Non-i2c cameras, e.g., soc_camera_platform, have no board_info */
        if (shd->board_info) {
                ret = soc_camera_init_i2c(icd, sdesc);
@@ -1268,7 +1460,7 @@ eadddev:
 evdc:
        mutex_lock(&ici->host_lock);
        ici->ops->remove(icd);
-       soc_camera_power_off(icd->pdev,ssdd);//yzm
+       soc_camera_power_off(icd->pdev,ssdd);/*yzm*/
        mutex_unlock(&ici->host_lock);
 eadd:
        v4l2_ctrl_handler_free(&icd->ctrl_handler);
@@ -1493,6 +1685,16 @@ static const struct v4l2_ioctl_ops soc_camera_ioctl_ops = {
        .vidioc_prepare_buf      = soc_camera_prepare_buf,
        .vidioc_streamon         = soc_camera_streamon,
        .vidioc_streamoff        = soc_camera_streamoff,
+       /**************yzm***************/
+       .vidioc_queryctrl        = soc_camera_queryctrl,
+        .vidioc_querymenu       = soc_camera_querymenu,     /* ddl@rock-chips.com:   Add ioctrl - vidioc_querymenu for soc-camera */
+       .vidioc_g_ctrl           = soc_camera_g_ctrl,
+       .vidioc_s_ctrl           = soc_camera_s_ctrl,
+       .vidioc_g_ext_ctrls    = soc_camera_g_ext_ctrl,   /* ddl@rock-chips.com:   Add ioctrl - vidioc_g_ext_ctrls for soc-camera */
+       .vidioc_s_ext_ctrls    = soc_camera_s_ext_ctrl,   /* ddl@rock-chips.com:   Add ioctrl - vidioc_s_ext_ctrls for soc-camera */
+       .vidioc_try_ext_ctrls    = soc_camera_try_ext_ctrl,/* ddl@rock-chips.com:   Add ioctrl - vidioc_try_ext_ctrls for soc-camera */
+    .vidioc_enum_frameintervals = soc_camera_enum_frameintervals,/* ddl@rock-chips.com:   Add ioctrl - VIDIOC_ENUM_FRAMEINTERVALS for soc-camera */
+       /**************yzm***************end*/
        .vidioc_cropcap          = soc_camera_cropcap,
        .vidioc_g_crop           = soc_camera_g_crop,
        .vidioc_s_crop           = soc_camera_s_crop,
@@ -1523,7 +1725,7 @@ static int video_dev_create(struct soc_camera_device *icd)
        vdev->ioctl_ops         = &soc_camera_ioctl_ops;
        vdev->release           = video_device_release;
        vdev->tvnorms           = V4L2_STD_UNKNOWN;
-       vdev->ctrl_handler      = &icd->ctrl_handler;
+       vdev->ctrl_handler      = NULL;//&icd->ctrl_handler;   /**************yzm***************/
        vdev->lock              = &ici->host_lock;
 
        icd->vdev = vdev;
index fb5ee5dd8fe933cbdd371aeecf41a3047d2e0e39..1583e97735a4902bcbbac497c40a877182db128e 100644 (file)
@@ -530,10 +530,8 @@ int videobuf_qbuf(struct videobuf_queue *q, struct v4l2_buffer *b)
        int retval;
 
        MAGIC_CHECK(q->int_ops->magic, MAGIC_QTYPE_OPS);
-
        if (b->memory == V4L2_MEMORY_MMAP)
                down_read(&current->mm->mmap_sem);
-
        videobuf_queue_lock(q);
        retval = -EBUSY;
        if (q->reading) {
@@ -599,12 +597,12 @@ int videobuf_qbuf(struct videobuf_queue *q, struct v4l2_buffer *b)
 
        dprintk(1, "qbuf: requesting next field\n");
        field = videobuf_next_field(q);
+       
        retval = q->ops->buf_prepare(q, buf, field);
        if (0 != retval) {
                dprintk(1, "qbuf: buffer_prepare returned %d\n", retval);
                goto done;
        }
-
        list_add_tail(&buf->stream, &q->stream);
        if (q->streaming) {
                spin_lock_irqsave(q->irqlock, flags);
@@ -617,10 +615,8 @@ int videobuf_qbuf(struct videobuf_queue *q, struct v4l2_buffer *b)
 
 done:
        videobuf_queue_unlock(q);
-
        if (b->memory == V4L2_MEMORY_MMAP)
                up_read(&current->mm->mmap_sem);
-
        return retval;
 }
 EXPORT_SYMBOL_GPL(videobuf_qbuf);
@@ -629,6 +625,7 @@ EXPORT_SYMBOL_GPL(videobuf_qbuf);
 static int stream_next_buffer_check_queue(struct videobuf_queue *q, int noblock)
 {
        int retval;
+    bool is_ext_locked;
 
 checks:
        if (!q->streaming) {
@@ -645,16 +642,27 @@ checks:
                } else {
                        dprintk(2, "next_buffer: waiting on buffer\n");
 
-                       /* Drop lock to avoid deadlock with qbuf */
-                       videobuf_queue_unlock(q);
-
+                       /* Drop lock to avoid deadlock with qbuf */            
+            videobuf_queue_unlock(q);
+            /*ddl@rock-chips.com */
+            is_ext_locked = q->ext_lock && mutex_is_locked(q->ext_lock);
+
+               /* Release vdev lock to prevent this wait from blocking outside access to
+                  the device. */
+               if (is_ext_locked)
+                       mutex_unlock(q->ext_lock);
+            
+            
                        /* Checking list_empty and streaming is safe without
                         * locks because we goto checks to validate while
                         * holding locks before proceeding */
                        retval = wait_event_interruptible(q->wait,
                                !list_empty(&q->stream) || !q->streaming);
-                       videobuf_queue_lock(q);
 
+            videobuf_queue_lock(q);
+            /*ddl@rock-chips.com */
+            if (is_ext_locked)
+                       mutex_lock(q->ext_lock);
                        if (retval)
                                goto done;
 
index c4613b272b366f857040adf0812b08296bd32924..6866e39e4e7228c0c09bbd1e7bf6ba6e1fcd606a 100755 (executable)
@@ -730,7 +730,7 @@ int generic_sensor_ioctrl(struct soc_camera_device *icd,enum rk29sensor_power_cm
 {
        //struct soc_camera_link *icl = to_soc_camera_link(icd);
        struct soc_camera_desc *desc = to_soc_camera_desc(icd);
-    struct rk29camera_platform_data *pdata = desc->subdev_desc.drv_priv;//yzm
+    struct rk29camera_platform_data *pdata = desc->subdev_desc.drv_priv;/*yzm*/
     struct i2c_client *client = to_i2c_client(to_soc_camera_control(icd));
     struct generic_sensor *sensor = to_generic_sensor(client);
        int ret = 0;
@@ -741,8 +741,8 @@ int generic_sensor_ioctrl(struct soc_camera_device *icd,enum rk29sensor_power_cm
         case Sensor_Power:
         {
                        //if (icl->power) {
-                       if(desc->subdev_desc.power) {//yzm
-                               ret = desc->subdev_desc.power(icd->pdev, on);//yzm
+                       if(desc->subdev_desc.power) {/*yzm*/
+                               ret = desc->subdev_desc.power(icd->pdev, on);/*yzm*/
                        } else {
                            SENSOR_TR("haven't power callback");
                 ret = -EINVAL;
@@ -752,8 +752,8 @@ int generic_sensor_ioctrl(struct soc_camera_device *icd,enum rk29sensor_power_cm
                case Sensor_PowerDown:
                {
                        //if (icl->powerdown) {
-                       if(desc->subdev_desc.powerdown) {//yzm
-                               ret = desc->subdev_desc.powerdown(icd->pdev, on);//yzm
+                       if(desc->subdev_desc.powerdown) {/*yzm*/
+                               ret = desc->subdev_desc.powerdown(icd->pdev, on);/*yzm*/
                        } else {
                            SENSOR_TR("haven't power down callback");
                 ret = -EINVAL;
@@ -800,8 +800,8 @@ int generic_sensor_init(struct v4l2_subdev *sd, u32 val)
        int array_index = 0;
        int num = sensor->info_priv.num_series;    
     //struct soc_camera_link *icl = to_soc_camera_link(icd);
-       struct soc_camera_desc *desc = to_soc_camera_desc(icd);//yzm
-    struct rk29camera_platform_data *pdata = desc->subdev_desc.drv_priv;//yzm
+       struct soc_camera_desc *desc = to_soc_camera_desc(icd);/*yzm*/
+    struct rk29camera_platform_data *pdata = desc->subdev_desc.drv_priv;/*yzm*/
     struct rkcamera_platform_data *sensor_device=NULL,*new_camera;
 
     new_camera = pdata->register_dev_new;
@@ -885,14 +885,14 @@ sensor_INIT_ERR:
 unsigned long generic_sensor_query_bus_param(struct soc_camera_device *icd)
 {
        //struct soc_camera_link *icl = to_soc_camera_link(icd);
-       struct soc_camera_desc *desc = to_soc_camera_desc(icd);//yzm
+       struct soc_camera_desc *desc = to_soc_camera_desc(icd);/*yzm*/
        struct i2c_client *client = to_i2c_client(to_soc_camera_control(icd));
        struct generic_sensor *sensor = to_generic_sensor(client);
        /**************yzm************/
        struct v4l2_mbus_config cfg;    
        debug_printk( "/$$$$$$$$$$$$$$$$$$$$$$//n Here I am: %s:%i-------%s()\n", __FILE__, __LINE__,__FUNCTION__);
        cfg.flags = sensor->info_priv.bus_parameter;
-       return soc_camera_apply_board_flags(&(desc->subdev_desc), &cfg);//yzm
+       return soc_camera_apply_board_flags(&(desc->subdev_desc), &cfg);/*yzm*/
        /**************yzm*************/
 }
 
index c26ba667bc8a030ad7e924affa71380517ffe341..12024982cb8c35bdfdb0a4497eb17dbaceced2b1 100755 (executable)
@@ -13,7 +13,7 @@
 #include <media/soc_camera.h>\r
 #include <linux/vmalloc.h>\r
 #include <linux/module.h>\r
-#include "../../../arch/arm/mach-rockchip/rk30_camera.h"//yzm\r
+#include "../../../arch/arm/mach-rockchip/rk30_camera.h"/*yzm*/\r
 #include <linux/kernel.h>\r
 /* Camera Sensor driver */\r
 \r
@@ -297,7 +297,7 @@ extern int generic_sensor_s_ext_control(struct soc_camera_device *icd, struct v4
 extern int generic_sensor_g_ext_controls(struct v4l2_subdev *sd, struct v4l2_ext_controls *ext_ctrl);\r
 extern int generic_sensor_s_ext_controls(struct v4l2_subdev *sd, struct v4l2_ext_controls *ext_ctrl);\r
 extern long generic_sensor_ioctl(struct v4l2_subdev *sd, unsigned int cmd, void *arg);\r
-extern int generic_sensor_s_power(struct v4l2_subdev *sd, int on);//yzm\r
+extern int generic_sensor_s_power(struct v4l2_subdev *sd, int on);/*yzm*/\r
 extern int generic_sensor_enum_fmt(struct v4l2_subdev *sd, unsigned int index,enum v4l2_mbus_pixelcode *code);\r
 extern int generic_sensor_s_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *mf);\r
 extern int generic_sensor_g_chip_ident(struct v4l2_subdev *sd, struct v4l2_dbg_chip_ident *id);\r
index 1991b499cc2837d20000d8ddc9dbcedd449d0a74..1747d3331748b92844d377872cddaffd2cf3f955 100755 (executable)
@@ -1,12 +1,11 @@
-   
 #include <media/soc_camera.h>
 #include <media/camsys_head.h>
 #include <linux/android_pmem.h>
 #include <linux/i2c.h>
 #include <linux/of.h>
 #include <linux/of_irq.h>
-#include "../../../arch/arm/mach-rockchip/rk30_camera.h"//yzm
-#include "../../../arch/arm/mach-rockchip/rk_camera.h"//yzm
+#include "../../../arch/arm/mach-rockchip/rk30_camera.h"/*yzm*/
+#include "../../../arch/arm/mach-rockchip/rk_camera.h"/*yzm*/
 //**********yzm***********//
 #include <linux/kernel.h>
 #include <linux/of_address.h>
 #include <linux/of_fdt.h>
 #include <linux/module.h>
 
-static int rk_dts_sensor_probe(struct platform_device *pdev);
-static int rk_dts_sensor_remove(struct platform_device *pdev);
-static int rk_dts_cif_probe(struct platform_device *pdev);
-static int rk_dts_cif_remove(struct platform_device *pdev);
-
-#include "../../../arch/arm/mach-rockchip/rk_camera.c"//yzm
-
-
 static int rk_register_camera_devices(void)
 {
     int i;
     int host_registered_0,host_registered_1;
-    struct rkcamera_platform_data *new_camera;    //¶¨ÒåµÄÊÇÒ»¸ösensor½á¹¹Ìå
+    struct rkcamera_platform_data *new_camera;    
 
        //printk(KERN_EMERG "/$$$$$$$$$$$$$$$$$$$$$$//n Here I am: %s:%i-------%s()\n", __FILE__, __LINE__,__FUNCTION__);
 
@@ -41,9 +32,9 @@ static int rk_register_camera_devices(void)
 
     if (new_camera != NULL) {
         while (new_camera != NULL) {
-                       if (new_camera->dev.desc_info.host_desc.bus_id == RK_CAM_PLATFORM_DEV_ID_1) {//yzm
+                       if (new_camera->dev.desc_info.host_desc.bus_id == RK_CAM_PLATFORM_DEV_ID_1) {/*yzm*/
                 host_registered_1 = 1;
-                       } else if (new_camera->dev.desc_info.host_desc.bus_id == RK_CAM_PLATFORM_DEV_ID_0) {//yzm
+                       } else if (new_camera->dev.desc_info.host_desc.bus_id == RK_CAM_PLATFORM_DEV_ID_0) {/*yzm*/
                 host_registered_0 = 1;
             }
                        
@@ -53,25 +44,22 @@ static int rk_register_camera_devices(void)
 
     #if RK_SUPPORT_CIF0
     if (host_registered_0) {
-        platform_device_register(&rk_device_camera_host_0);//host_0 ÉÏÓÐsensor
+        platform_device_register(&rk_device_camera_host_0);//host_0 has sensor
     }   //host_device_register
     #endif
        
     #if RK_SUPPORT_CIF1
     if (host_registered_1) {
-        platform_device_register(&rk_device_camera_host_1);//host_1ÉÏÓÐsensor
+        platform_device_register(&rk_device_camera_host_1);//host_1 has sensor
     }  //host_device_register
     #endif
 
 
     if (rk_camera_platform_data.sensor_register)      
-       (rk_camera_platform_data.sensor_register)();   //µ÷ÓÃrk_sensor_register()
+       (rk_camera_platform_data.sensor_register)();   //call rk_sensor_register()
 
- #if PMEM_CAM_NECESSARY
-    platform_device_register(&android_pmem_cam_device);//???
- #endif
        return 0;
 }
 
 
-module_init(rk_register_camera_devices);//yzm
+module_init(rk_register_camera_devices);/*yzm*/
index e587777f606ac3a093ce046ecdedbec46ba235a5..d378dc4b01507ff2c77a17dc2a189a56c962500d 100755 (executable)
@@ -25,7 +25,6 @@
 #include <linux/videodev2.h>
 #include <linux/kthread.h>
 
-//#include <mach/iomux.h>//yzm  
 #include <media/v4l2-common.h>
 #include <media/v4l2-dev.h>
 #include <media/videobuf-dma-contig.h>
@@ -35,7 +34,8 @@
 #include <linux/rockchip/iomap.h>
 
 #include "../../video/rockchip/rga/rga.h"
-#include "../../../arch/arm/mach-rockchip/rk30_camera.h"//yzm
+#include "../../../arch/arm/mach-rockchip/rk30_camera.h"/*yzm*/
+#include <linux/rockchip/cru.h>
 
 /*******yzm*********
 
@@ -75,9 +75,9 @@ module_param(debug, int, S_IRUGO|S_IWUSR);
 #define RKCAMERA_DG2(format, ...) dprintk(2, format, ## __VA_ARGS__)
 #define debug_printk(format, ...) dprintk(3, format, ## __VA_ARGS__)
 
-#define RK30_CRU_BASE 0x00 //yzm
+#define RK30_CRU_BASE 0x00 /*yzm*/
 
-// CIF Reg Offset
+/* CIF Reg Offset*/
 #define  CIF_CIF_CTRL                       0x00
 #define  CIF_CIF_INTEN                      0x04
 #define  CIF_CIF_INTSTAT                    0x08
@@ -106,8 +106,8 @@ module_param(debug, int, S_IRUGO|S_IWUSR);
 #define         CIF_CIF_LAST_LINE                  0x68
 #define         CIF_CIF_LAST_PIX                   0x6c
 
-//The key register bit descrition
-// CIF_CTRL Reg , ignore SCM,WBC,ISP,
+/*The key register bit descrition*/
+/* CIF_CTRL Reg , ignore SCM,WBC,ISP,*/
 #define  DISABLE_CAPTURE              (0x00<<0)
 #define  ENABLE_CAPTURE               (0x01<<0)
 #define  MODE_ONEFRAME                (0x00<<1)
@@ -115,12 +115,12 @@ module_param(debug, int, S_IRUGO|S_IWUSR);
 #define  MODE_LINELOOP                (0x02<<1)
 #define  AXI_BURST_16                 (0x0F << 12)
 
-//CIF_CIF_INTEN
+/*CIF_CIF_INTEN*/
 #define  FRAME_END_EN                  (0x01<<1)
 #define  BUS_ERR_EN                            (0x01<<6)
 #define  SCL_ERR_EN                            (0x01<<7)
 
-//CIF_CIF_FOR
+/*CIF_CIF_FOR*/
 #define  VSY_HIGH_ACTIVE                   (0x01<<0)
 #define  VSY_LOW_ACTIVE                    (0x00<<0)
 #define  HSY_LOW_ACTIVE                               (0x01<<1)
@@ -153,7 +153,7 @@ module_param(debug, int, S_IRUGO|S_IWUSR);
 #define  UV_STORAGE_ORDER_UVUV             (0x00<<19)
 #define  UV_STORAGE_ORDER_VUVU             (0x01<<19)
 
-//CIF_CIF_SCL_CTRL
+/*CIF_CIF_SCL_CTRL*/
 #define ENABLE_SCL_DOWN                    (0x01<<0)           
 #define DISABLE_SCL_DOWN                   (0x00<<0)
 #define ENABLE_SCL_UP                      (0x01<<1)           
@@ -179,8 +179,8 @@ module_param(debug, int, S_IRUGO|S_IWUSR);
 #define mask_cif_reg(addr, msk, val)    write_cif_reg(addr, (val)|((~(msk))&read_cif_reg(addr)))
 
 /*********yzm***********/
-//#if defined(CONFIG_ARCH_RK30) || defined(CONFIG_ARCH_RK3188)
-//CRU,PIXCLOCK
+/*#if defined(CONFIG_ARCH_RK30) || defined(CONFIG_ARCH_RK3188)*/
+/*CRU,PIXCLOCK*/
 #define CRU_PCLK_REG30                     0xbc
 #define ENANABLE_INVERT_PCLK_CIF0          ((0x1<<24)|(0x1<<8))
 #define DISABLE_INVERT_PCLK_CIF0           ((0x1<<24)|(0x0<<8))
@@ -196,10 +196,10 @@ module_param(debug, int, S_IRUGO|S_IWUSR);
 #define write_cru_reg(addr, val)            __raw_writel(val, addr+RK30_CRU_BASE)
 #define read_cru_reg(addr)                  __raw_readl(addr+RK30_CRU_BASE)
 #define mask_cru_reg(addr, msk, val)        write_cru_reg(addr,(val)|((~(msk))&read_cru_reg(addr)))
-//#endif    //yzm  end
+/*#endif    yzm*/  
 
 #if defined(CONFIG_ARCH_RK3026)
-//CRU,PIXCLOCK
+/*CRU,PIXCLOCK*/
 #define CRU_PCLK_REG30                     0xbc
 #define ENANABLE_INVERT_PCLK_CIF0          ((0x1<<23)|(0x1<<7))
 #define DISABLE_INVERT_PCLK_CIF0           ((0x1<<23)|(0x0<<7))
@@ -219,14 +219,14 @@ module_param(debug, int, S_IRUGO|S_IWUSR);
 
 
 #if defined(CONFIG_ARCH_RK3066B) || defined(CONFIG_ARCH_RK3188)
-//GRF_IO_CON3                        0x100
+/*GRF_IO_CON3                        0x100*/
 #define CIF_DRIVER_STRENGTH_2MA            (0x00 << 12)
 #define CIF_DRIVER_STRENGTH_4MA            (0x01 << 12)
 #define CIF_DRIVER_STRENGTH_8MA            (0x02 << 12)
 #define CIF_DRIVER_STRENGTH_12MA           (0x03 << 12)
 #define CIF_DRIVER_STRENGTH_MASK           (0x03 << 28)
 
-//GRF_IO_CON4                        0x104
+/*GRF_IO_CON4                        0x104*/
 #define CIF_CLKOUT_AMP_3V3                 (0x00 << 10)
 #define CIF_CLKOUT_AMP_1V8                 (0x01 << 10)
 #define CIF_CLKOUT_AMP_MASK                (0x01 << 26)
@@ -240,10 +240,10 @@ module_param(debug, int, S_IRUGO|S_IWUSR);
 #define mask_grf_reg(addr, msk, val)   
 #endif
 
-#define CAM_WORKQUEUE_IS_EN()  (false)//(true)
-#define CAM_IPPWORK_IS_EN()     (false)//((pcdev->zoominfo.a.c.width != pcdev->icd->user_width) || (pcdev->zoominfo.a.c.height != pcdev->icd->user_height))
+#define CAM_WORKQUEUE_IS_EN()  (false)/*(true)*/
+#define CAM_IPPWORK_IS_EN()     (false)/*((pcdev->zoominfo.a.c.width != pcdev->icd->user_width) || (pcdev->zoominfo.a.c.height != pcdev->icd->user_height))*/
 
-#define IS_CIF0()              (true)//(pcdev->hostid == RK_CAM_PLATFORM_DEV_ID_0)
+#define IS_CIF0()              (true)/*(pcdev->hostid == RK_CAM_PLATFORM_DEV_ID_0)*/
 #if (CONFIG_CAMERA_SCALE_CROP_MACHINE == RK_CAM_SCALE_CROP_IPP)
 #define CROP_ALIGN_BYTES (0x03)
 #define CIF_DO_CROP 0
@@ -310,7 +310,7 @@ struct rk_camera_reg
        unsigned int cifFmt;
     unsigned int cifVirWidth;
     unsigned int cifScale;
-//     unsigned int VipCrm;
+/*     unsigned int VipCrm;*/
        enum rk_camera_reg_state Inval;
 };
 struct rk_camera_work
@@ -354,13 +354,13 @@ struct rk_camera_timer{
 };
 struct rk_cif_clk 
 {
-    //************must modify start************/
+    /************must modify start************/
        struct clk *pd_cif;
        struct clk *aclk_cif;
     struct clk *hclk_cif;
     struct clk *cif_clk_in;
     struct clk *cif_clk_out;
-       //************must modify end************/
+       /************must modify end************/
 
     spinlock_t lock;
     bool on;
@@ -399,7 +399,7 @@ struct rk_camera_dev
     unsigned int last_fps;
     unsigned long frame_interval;
     unsigned int pixfmt;
-    //for ipp  
+    /*for ipp  */
     unsigned int vipmem_phybase;
     void __iomem *vipmem_virbase;
     unsigned int vipmem_size;
@@ -410,7 +410,7 @@ struct rk_camera_dev
 #endif    
     int host_width;
     int host_height;
-    int host_left;  //sensor output size ?
+    int host_left;  /*sensor output size ?*/
     int host_top;
     int hostid;
     int icd_width;
@@ -467,30 +467,26 @@ static const char *rk_cam_driver_description = "RK_Camera";
 
 static int rk_camera_s_stream(struct soc_camera_device *icd, int enable);
 static void rk_camera_capture_process(struct work_struct *work);
-//static int rk_camera_scale_crop_arm(struct work_struct *work);
+/*static int rk_camera_scale_crop_arm(struct work_struct *work);*/
+
+static inline void rk3128_cru_set_soft_reset(u32 idx, bool on)
+{
+       void __iomem *reg = RK_CRU_VIRT + RK312X_CRU_SOFTRSTS_CON(6);
+       u32 val = on ? 0x10001U << 14 : 0x10000U << 14;
+       writel_relaxed(val, reg);
+       dsb();
+}
 
 static void rk_camera_cif_reset(struct rk_camera_dev *pcdev, int only_rst)
 {
-/*************yzm**************
     int ctrl_reg,inten_reg,crop_reg,set_size_reg,for_reg,vir_line_width_reg,scl_reg,y_reg,uv_reg;
-    enum rk3288_cru_soft_reset cif_reset_index = SOFT_RST_CIF0;
 
 debug_printk( "/$$$$$$$$$$$$$$$$$$$$$$//n Here I am: %s:%i-------%s()/n", __FILE__, __LINE__,__FUNCTION__);
 
-
-    if (IS_CIF0() == false) { 
-#if RK_SUPPORT_CIF1
-        cif_reset_index = SOFT_RST_CIF1;
-#else
-        RKCAMERA_TR("%s: CIF1 is invalidate\n",__FUNCTION__);
-        BUG();
-#endif
-    }
-
     if (only_rst == true) {
-        rk3288_cru_set_soft_reset(cif_reset_index, true);
+        rk3128_cru_set_soft_reset(0, true);
         udelay(5);
-        rk3288_cru_set_soft_reset(cif_reset_index, false);
+        rk3128_cru_set_soft_reset(0, false);
     } else {
         ctrl_reg = read_cif_reg(pcdev->base,CIF_CIF_CTRL);
         if (ctrl_reg & ENABLE_CAPTURE) {
@@ -505,9 +501,9 @@ debug_printk( "/$$$$$$$$$$$$$$$$$$$$$$//n Here I am: %s:%i-------%s()/n", __FILE
        y_reg = read_cif_reg(pcdev->base, CIF_CIF_FRM0_ADDR_Y);
        uv_reg = read_cif_reg(pcdev->base, CIF_CIF_FRM0_ADDR_UV);
        
-       rk3288_cru_set_soft_reset(cif_reset_index, true);
+       rk3128_cru_set_soft_reset(0, true);
        udelay(5);
-       rk3288_cru_set_soft_reset(cif_reset_index, false); 
+       rk3128_cru_set_soft_reset(0, false); 
 
         write_cif_reg(pcdev->base,CIF_CIF_CTRL, ctrl_reg&~ENABLE_CAPTURE);
            write_cif_reg(pcdev->base,CIF_CIF_INTEN, inten_reg);
@@ -516,10 +512,9 @@ debug_printk( "/$$$$$$$$$$$$$$$$$$$$$$//n Here I am: %s:%i-------%s()/n", __FILE
            write_cif_reg(pcdev->base,CIF_CIF_FOR, for_reg);
            write_cif_reg(pcdev->base,CIF_CIF_VIR_LINE_WIDTH,vir_line_width_reg);
            write_cif_reg(pcdev->base,CIF_CIF_SCL_CTRL,scl_reg);
-           write_cif_reg(pcdev->base,CIF_CIF_FRM0_ADDR_Y,y_reg);      / *ddl@rock-chips.com v0.3.0x13
+           write_cif_reg(pcdev->base,CIF_CIF_FRM0_ADDR_Y,y_reg);      /*ddl@rock-chips.com v0.3.0x13 */
            write_cif_reg(pcdev->base,CIF_CIF_FRM0_ADDR_UV,uv_reg);
     }
- *///***********yzm*************end
     return;
 }
 
@@ -531,8 +526,7 @@ static int rk_videobuf_setup(struct videobuf_queue *vq, unsigned int *count,
                                unsigned int *size)
 {
     struct soc_camera_device *icd = vq->priv_data;
-       //struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent);
-       struct soc_camera_host *ici = to_soc_camera_host(icd->parent);//yzm
+       struct soc_camera_host *ici = to_soc_camera_host(icd->parent);/*yzm*/
     struct rk_camera_dev *pcdev = ici->priv;
        unsigned int i;
     struct rk_camera_work *wk;
@@ -555,7 +549,7 @@ debug_printk( "/$$$$$$$$$$$$$$$$$$$$$$//n Here I am: %s:%i-------%s()/n", __FILE
        else
                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);//yzm
+   /* dev_dbg(&icd->dev, "count=%d, size=%d\n", *count, *size);*/ /*yzm*/
 
        if (bytes_per_line_host < 0)
                return bytes_per_line_host;
@@ -624,7 +618,7 @@ static void rk_videobuf_free(struct videobuf_queue *vq, struct rk_camera_buffer
 debug_printk( "/$$$$$$$$$$$$$$$$$$$$$$//n Here I am: %s:%i-------%s()\n", __FILE__, __LINE__,__FUNCTION__);
 
 
-    dev_dbg(icd->control, "%s (vb=0x%p) 0x%08lx %zd\n", __func__,//yzm
+    dev_dbg(icd->control, "%s (vb=0x%p) 0x%08lx %zd\n", __func__,/*yzm*/
             &buf->vb, buf->vb.baddr, buf->vb.bsize);
 
        /* ddl@rock-chips.com: buf_release called soc_camera_streamoff and soc_camera_close*/
@@ -639,7 +633,7 @@ debug_printk( "/$$$$$$$$$$$$$$$$$$$$$$//n Here I am: %s:%i-------%s()\n", __FILE
         */
        videobuf_waiton(vq, &buf->vb, 0, 0);
     videobuf_dma_contig_free(vq, &buf->vb);
-    //dev_dbg(&icd->dev, "%s freed\n", __func__);//yzm
+    /*dev_dbg(&icd->dev, "%s freed\n", __func__);*/ /*yzm*/
     buf->vb.state = VIDEOBUF_NEEDS_INIT;
        return;
 }
@@ -652,15 +646,14 @@ static int rk_videobuf_prepare(struct videobuf_queue *vq, struct videobuf_buffer
                                                icd->current_fmt->host_fmt);
 
 debug_printk( "/$$$$$$$$$$$$$$$$$$$$$$//n Here I am: %s:%i-------%s()\n", __FILE__, __LINE__,__FUNCTION__);
-       //dump_stack();
        
        if ((bytes_per_line < 0) || (vb->boff == 0))
                return -EINVAL;
 
     buf = container_of(vb, struct rk_camera_buffer, vb);
 
-    //dev_dbg(&icd->dev, "%s (vb=0x%p) 0x%08lx %zd\n", __func__,//yzm
-      //      vb, vb->baddr, vb->bsize);//yzm
+    /*dev_dbg(&icd->dev, "%s (vb=0x%p) 0x%08lx %zd\n", __func__,*/ /*yzm*/
+      /*      vb, vb->baddr, vb->bsize);*/ /*yzm*/
     
     /* Added list head initialization on alloc */
     WARN_ON(!list_empty(&vb->queue));    
@@ -735,8 +728,7 @@ static void rk_videobuf_queue(struct videobuf_queue *vq,
                                 struct videobuf_buffer *vb)
 {
     struct soc_camera_device *icd = vq->priv_data;
-    //struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent);
-       struct soc_camera_host *ici = to_soc_camera_host(icd->parent);//yzm
+       struct soc_camera_host *ici = to_soc_camera_host(icd->parent);/*yzm*/
     struct rk_camera_dev *pcdev = ici->priv;
 #if CAMERA_VIDEOBUF_ARM_ACCESS    
     struct rk29_camera_vbinfo *vb_info;
@@ -745,8 +737,8 @@ static void rk_videobuf_queue(struct videobuf_queue *vq,
 
 debug_printk( "/$$$$$$$$$$$$$$$$$$$$$$//n Here I am: %s:%i-------%s()\n", __FILE__, __LINE__,__FUNCTION__);
 
-    //dev_dbg(&icd->dev, "%s (vb=0x%p) 0x%08lx %zd\n", __func__,//yzm
-      //      vb, vb->baddr, vb->bsize);//yzm
+    /*dev_dbg(&icd->dev, "%s (vb=0x%p) 0x%08lx %zd\n", __func__, 
+            vb, vb->baddr, vb->bsize); */ /*yzm*/
 
     vb->state = VIDEOBUF_QUEUED;
        if (list_empty(&pcdev->capture)) {
@@ -800,7 +792,7 @@ debug_printk( "/$$$$$$$$$$$$$$$$$$$$$$//n Here I am: %s:%i-------%s()/n", __FILE
        switch (pixfmt)
        {
                case V4L2_PIX_FMT_YUV420:
-               case V4L2_PIX_FMT_UYVY: // yuv 422, but sensor has defined this format(in fact ,should be defined yuv 420), treat this as yuv 420.
+               case V4L2_PIX_FMT_UYVY: /* yuv 422, but sensor has defined this format(in fact ,should be defined yuv 420), treat this as yuv 420.*/
                case V4L2_PIX_FMT_YUYV: 
                        {
                                *ippfmt = RK_FORMAT_YCbCr_420_SP;
@@ -884,7 +876,7 @@ static void rk_camera_capture_process(struct work_struct *work)
     struct rk_camera_work *camera_work = container_of(work, struct rk_camera_work, work);    
     struct videobuf_buffer *vb = camera_work->vb;    
     struct rk_camera_dev *pcdev = camera_work->pcdev;    
-    //enum v4l2_mbus_pixelcode icd_code = pcdev->icd->current_fmt->code;    
+    /*enum v4l2_mbus_pixelcode icd_code = pcdev->icd->current_fmt->code;    */
     unsigned long flags = 0;    
     int err = 0;    
 
@@ -1003,7 +995,7 @@ static inline irqreturn_t rk_camera_dmairq(int irq, void *data)
        struct timeval tv;
     unsigned long reg_cifctrl;
 
-debug_printk( "/$$$$$$$$$$$$$$$$$$$$$$//n Here I am: %s:%i-------%s()/n", __FILE__, __LINE__,__FUNCTION__);
+debug_printk( "/$$$$$$$$$$$$$$$$$$$$$$//n Here I am: %s:%i-------%s()\n", __FILE__, __LINE__,__FUNCTION__);
 
 
     reg_cifctrl = read_cif_reg(pcdev->base,CIF_CIF_CTRL);
@@ -1090,7 +1082,6 @@ static irqreturn_t rk_camera_irq(int irq, void *data)
     struct rk_camera_dev *pcdev = data;
     unsigned long reg_intstat;
 
-debug_printk( "/$$$$$$$$$$$$$$$$$$$$$$//n Here I am: %s:%i-------%s()\n", __FILE__, __LINE__,__FUNCTION__);
 
 
     spin_lock(&pcdev->lock);
@@ -1101,7 +1092,7 @@ debug_printk( "/$$$$$$$$$$$$$$$$$$$$$$//n Here I am: %s:%i-------%s()\n", __FILE
     }
 
     reg_intstat = read_cif_reg(pcdev->base,CIF_CIF_INTSTAT);
-
+       debug_printk( "/$$$$$$$$$$$$$$$$$$$$$$//n Here I am: %s:%i-------%s() ,reg_intstat 0x%lx\n", __FILE__, __LINE__,__FUNCTION__,reg_intstat);
     if (reg_intstat & 0x0200)
         rk_camera_cifirq(irq,data);
 
@@ -1119,8 +1110,7 @@ static void rk_videobuf_release(struct videobuf_queue *vq,
 {
     struct rk_camera_buffer *buf = container_of(vb, struct rk_camera_buffer, vb);
     struct soc_camera_device *icd = vq->priv_data;
-    //struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent);
-       struct soc_camera_host *ici = to_soc_camera_host(icd->parent);//yzm
+       struct soc_camera_host *ici = to_soc_camera_host(icd->parent);/*yzm*/
     struct rk_camera_dev *pcdev = ici->priv;
 #if CAMERA_VIDEOBUF_ARM_ACCESS    
     struct rk29_camera_vbinfo *vb_info =NULL;
@@ -1180,8 +1170,7 @@ static struct videobuf_queue_ops rk_videobuf_ops =
 static void rk_camera_init_videobuf(struct videobuf_queue *q,
                                       struct soc_camera_device *icd)
 {
-    //struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent);
-       struct soc_camera_host *ici = to_soc_camera_host(icd->parent);//yzm
+       struct soc_camera_host *ici = to_soc_camera_host(icd->parent);/*yzm*/
     struct rk_camera_dev *pcdev = ici->priv;
 
 debug_printk( "/$$$$$$$$$$$$$$$$$$$$$$//n Here I am: %s:%i-------%s()/n", __FILE__, __LINE__,__FUNCTION__);
@@ -1195,7 +1184,7 @@ debug_printk( "/$$$$$$$$$$$$$$$$$$$$$$//n Here I am: %s:%i-------%s()/n", __FILE
                                    V4L2_BUF_TYPE_VIDEO_CAPTURE,
                                    V4L2_FIELD_NONE,
                                    sizeof(struct rk_camera_buffer),
-                                   icd,&icd->video_lock);
+                                   icd,&(ici->host_lock) );
 }
 
 static int rk_camera_mclk_ctrl(int cif_idx, int on, int clk_rate)
@@ -1224,7 +1213,7 @@ debug_printk( "/$$$$$$$$$$$$$$$$$$$$$$//n Here I am: %s:%i-------%s()\n", __FILE
    
     spin_lock(&clk->lock);
     if (on && !clk->on) {        
-        clk_prepare_enable(clk->pd_cif);    //yzm
+        clk_prepare_enable(clk->pd_cif);    /*yzm*/
         clk_prepare_enable(clk->aclk_cif);
        clk_prepare_enable(clk->hclk_cif);
        clk_prepare_enable(clk->cif_clk_in);
@@ -1270,7 +1259,7 @@ static int rk_camera_activate(struct rk_camera_dev *pcdev, struct soc_camera_dev
 debug_printk( "/$$$$$$$$$$$$$$$$$$$$$$//n Here I am: %s:%i-------%s()\n", __FILE__, __LINE__,__FUNCTION__);
 
     write_cif_reg(pcdev->base,CIF_CIF_CTRL,AXI_BURST_16|MODE_ONEFRAME|DISABLE_CAPTURE);   /* ddl@rock-chips.com : vip ahb burst 16 */
-    write_cif_reg(pcdev->base,CIF_CIF_INTEN, 0x01);    //capture complete interrupt enable
+    //write_cif_reg(pcdev->base,CIF_CIF_INTEN, 0x01);    //capture complete interrupt enable
     return 0;
 }
 
@@ -1289,9 +1278,8 @@ debug_printk( "/$$$$$$$$$$$$$$$$$$$$$$//n Here I am: %s:%i-------%s()\n", __FILE
  * there can be only one camera on RK28 quick capture interface */
 static int rk_camera_add_device(struct soc_camera_device *icd)
 {
-   // struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent);
-       struct soc_camera_host *ici = to_soc_camera_host(icd->parent);//yzm
-    struct rk_camera_dev *pcdev = ici->priv;    //ÔÚrk_camra_probÖгõʼ»¯
+       struct soc_camera_host *ici = to_soc_camera_host(icd->parent);/*yzm*/
+    struct rk_camera_dev *pcdev = ici->priv;    /*Initialize in rk_camra_prob*/
     struct device *control = to_soc_camera_control(icd);
     struct v4l2_subdev *sd;
     int ret,i,icd_catch;
@@ -1328,7 +1316,7 @@ debug_printk( "/$$$$$$$$$$$$$$$$$$$$$$//n Here I am: %s:%i-------%s()\n", __FILE
     if (ret)
         goto ebusy;
     /* ddl@rock-chips.com : v4l2_subdev is not created when ici->ops->add called in soc_camera_probe  */
-    if (control) {             //openʱTRUE£¬ ÄÚºËÆô¶¯¼ÓÔØʱFALSE
+    if (control) {             //TRUE in open ,FALSE in kernel start
         sd = dev_get_drvdata(control);
                v4l2_subdev_call(sd, core, ioctl, RK29_CAM_SUBDEV_IOREQUEST,(void*)pcdev->pdata);
         #if 0
@@ -1336,9 +1324,9 @@ debug_printk( "/$$$$$$$$$$$$$$$$$$$$$$//n Here I am: %s:%i-------%s()\n", __FILE
         if (ret)
             goto ebusy;
         #endif
-               //µ÷ÓÃgeneric_sensor_ioctl
+               /* call generic_sensor_ioctl*/
         v4l2_subdev_call(sd, core, ioctl, RK29_CAM_SUBDEV_CB_REGISTER,(void*)(&pcdev->icd_cb));
-               //µ÷ÓÃgeneric_sensor_cropcap
+               /* call generic_sensor_cropcap*/
         if (v4l2_subdev_call(sd, video, cropcap, &cropcap) == 0) {
             memcpy(&pcdev->cropinfo.bounds ,&cropcap.bounds,sizeof(struct v4l2_rect));
         } else {
@@ -1388,10 +1376,9 @@ ebusy:
 }
 static void rk_camera_remove_device(struct soc_camera_device *icd)
 {
-    //struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent);
-       struct soc_camera_host *ici = to_soc_camera_host(icd->parent);//yzm
+       struct soc_camera_host *ici = to_soc_camera_host(icd->parent);/*yzm*/
     struct rk_camera_dev *pcdev = ici->priv;
-//     struct v4l2_subdev *sd = soc_camera_to_subdev(icd);
+       /*struct v4l2_subdev *sd = soc_camera_to_subdev(icd);*/
 #if CAMERA_VIDEOBUF_ARM_ACCESS    
     struct rk29_camera_vbinfo *vb_info;
     unsigned int i;
@@ -1407,13 +1394,13 @@ debug_printk( "/$$$$$$$$$$$$$$$$$$$$$$//n Here I am: %s:%i-------%s()\n", __FILE
     
     /* 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. */
-       //if (read_cif_reg(pcdev->base,CIF_CIF_CTRL) & ENABLE_CAPTURE) {
+       /*if (read_cif_reg(pcdev->base,CIF_CIF_CTRL) & ENABLE_CAPTURE) {*/
        if ((atomic_read(&pcdev->stop_cif) == false) && pcdev->fps_timer.istarted) {       /* ddl@rock-chips.com: v0.3.0x15*/
                rk_camera_s_stream(icd,0);
        } 
-       //½«DEACTIVATE Òƶ¯µ½generic_sensor_s_powerÖÐ
-    //v4l2_subdev_call(sd, core, ioctl, RK29_CAM_SUBDEV_DEACTIVATE,NULL);//yzm
-    //if stream off is not been executed,timer is running.
+       /* move DEACTIVATE into generic_sensor_s_power*/
+    /* v4l2_subdev_call(sd, core, ioctl, RK29_CAM_SUBDEV_DEACTIVATE,NULL);*/ /*yzm*/
+    /* if stream off is not been executed,timer is running.*/
     if(pcdev->fps_timer.istarted){
          hrtimer_cancel(&pcdev->fps_timer.timer);
          pcdev->fps_timer.istarted = false;
@@ -1460,11 +1447,11 @@ debug_printk( "/$$$$$$$$$$$$$$$$$$$$$$//n Here I am: %s:%i-------%s()\n", __FILE
 static int rk_camera_set_bus_param(struct soc_camera_device *icd, __u32 pixfmt)
 {
     unsigned long bus_flags, camera_flags, common_flags = 0;
-    //unsigned int cif_for = 0;
+    /*unsigned int cif_for = 0;*/
        const struct soc_mbus_pixelfmt *fmt;
        int ret = 0;
-       //struct soc_camera_host *ici = to_soc_camera_host(icd->parent);//yzm
-       //struct rk_camera_dev *pcdev = ici->priv;
+       /*struct soc_camera_host *ici = to_soc_camera_host(icd->parent);*/ /*yzm*/
+       /*struct rk_camera_dev *pcdev = ici->priv;*/
 
 
 debug_printk( "/$$$$$$$$$$$$$$$$$$$$$$//n Here I am: %s:%i-------%s()/n", __FILE__, __LINE__,__FUNCTION__);
@@ -1504,7 +1491,8 @@ debug_printk( "/$$$$$$$$$$$$$$$$$$$$$$//n Here I am: %s:%i-------%s()\n", __FILE
         ret = -EINVAL;
         goto RK_CAMERA_SET_BUS_PARAM_END;
     }
-*///***************yzm************end
+*/
+/***************yzm************end*/
     ret = icd->ops->set_bus_param(icd, common_flags);
     if (ret < 0)
         goto RK_CAMERA_SET_BUS_PARAM_END;
@@ -1548,8 +1536,8 @@ RK_CAMERA_SET_BUS_PARAM_END:
 
 static int rk_camera_try_bus_param(struct soc_camera_device *icd, __u32 pixfmt)
 {
-//    unsigned long bus_flags, camera_flags;
-//    int ret;
+/*    unsigned long bus_flags, camera_flags;*/
+/*    int ret;*/
 
 debug_printk( "/$$$$$$$$$$$$$$$$$$$$$$//n Here I am: %s:%i-------%s()\n", __FILE__, __LINE__,__FUNCTION__);
 /**********yzm***********
@@ -1616,8 +1604,7 @@ static const struct soc_mbus_pixelfmt rk_camera_formats[] = {
 
 static void rk_camera_setup_format(struct soc_camera_device *icd, __u32 host_pixfmt, enum v4l2_mbus_pixelcode icd_code, struct v4l2_rect *rect)
 {
-       //struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent);
-       struct soc_camera_host *ici = to_soc_camera_host(icd->parent);//yzm
+       struct soc_camera_host *ici = to_soc_camera_host(icd->parent);/*yzm*/
     struct rk_camera_dev *pcdev = ici->priv;
     unsigned int cif_fs = 0,cif_crop = 0;
     unsigned int cif_fmt_val = read_cif_reg(pcdev->base,CIF_CIF_FOR) | INPUT_MODE_YUV|YUV_INPUT_422|INPUT_420_ORDER_EVEN|OUTPUT_420_ORDER_EVEN;
@@ -1689,7 +1676,7 @@ debug_printk( "/$$$$$$$$$$$$$$$$$$$$$$//n Here I am: %s:%i-------%s()/n", __FILE
     rk_camera_cif_reset(pcdev,true);
     
     write_cif_reg(pcdev->base,CIF_CIF_CTRL,AXI_BURST_16|MODE_ONEFRAME|DISABLE_CAPTURE);   /* ddl@rock-chips.com : vip ahb burst 16 */
-    write_cif_reg(pcdev->base,CIF_CIF_INTEN, 0x01|0x200);    //capture complete interrupt enable
+    //write_cif_reg(pcdev->base,CIF_CIF_INTEN, 0x01|0x200);    /*capture complete interrupt enable*/
 
     write_cif_reg(pcdev->base,CIF_CIF_FOR,cif_fmt_val);         /* ddl@rock-chips.com: VIP capture mode and capture format must be set before FS register set */
 
@@ -1697,7 +1684,7 @@ debug_printk( "/$$$$$$$$$$$$$$$$$$$$$$//n Here I am: %s:%i-------%s()/n", __FILE
     if((read_cif_reg(pcdev->base,CIF_CIF_CTRL) & MODE_PINGPONG)
                ||(read_cif_reg(pcdev->base,CIF_CIF_CTRL) & MODE_LINELOOP)) {
            BUG();      
-    } else{ // this is one frame mode
+    } else{ /* this is one frame mode*/
            cif_crop = (rect->left+ (rect->top<<16));
            cif_fs      = ((rect->width ) + (rect->height<<16));
        }
@@ -1707,7 +1694,7 @@ debug_printk( "/$$$$$$$$$$$$$$$$$$$$$$//n Here I am: %s:%i-------%s()/n", __FILE
        write_cif_reg(pcdev->base,CIF_CIF_VIR_LINE_WIDTH, rect->width);
        write_cif_reg(pcdev->base,CIF_CIF_FRAME_STATUS,  0x00000003);
 
-    //MUST bypass scale 
+    /*MUST bypass scale */
        write_cif_reg(pcdev->base,CIF_CIF_SCL_CTRL,0x10);
     RKCAMERA_DG1("CIF_CIF_CROP:0x%x  CIF_CIF_FS:0x%x  CIF_CIF_FOR:0x%x\n",cif_crop,cif_fs,cif_fmt_val);
        return;
@@ -1717,8 +1704,7 @@ static int rk_camera_get_formats(struct soc_camera_device *icd, unsigned int idx
                                  struct soc_camera_format_xlate *xlate)
 {
     struct v4l2_subdev *sd = soc_camera_to_subdev(icd);
-    //struct device *dev = icd->dev.parent;
-       struct device *dev = icd->parent;//yzm
+       struct device *dev = icd->parent;/*yzm*/
     int formats = 0, ret;
        enum v4l2_mbus_pixelcode code;
        const struct soc_mbus_pixelfmt *fmt;
@@ -1726,7 +1712,7 @@ static int rk_camera_get_formats(struct soc_camera_device *icd, unsigned int idx
 debug_printk( "/$$$$$$$$$$$$$$$$$$$$$$//n Here I am: %s:%i-------%s()/n", __FILE__, __LINE__,__FUNCTION__);
 
 
-       ret = v4l2_subdev_call(sd, video, enum_mbus_fmt, idx, &code);  //µ÷ÓÃgeneric_sensor_enum_fmt()
+       ret = v4l2_subdev_call(sd, video, enum_mbus_fmt, idx, &code);  /*call generic_sensor_enum_fmt()*/
        if (ret < 0)
                /* No more formats */
                return 0;
@@ -1836,8 +1822,7 @@ end:
 }
 static int rk_camera_get_crop(struct soc_camera_device *icd,struct v4l2_crop *crop)
 {
-    //struct soc_camera_host *ici =to_soc_camera_host(icd->dev.parent);
-       struct soc_camera_host *ici = to_soc_camera_host(icd->parent);//yzm
+       struct soc_camera_host *ici = to_soc_camera_host(icd->parent);/*yzm*/
     struct rk_camera_dev *pcdev = ici->priv;
 
 debug_printk( "/$$$$$$$$$$$$$$$$$$$$$$//n Here I am: %s:%i-------%s()/n", __FILE__, __LINE__,__FUNCTION__);
@@ -1852,7 +1837,7 @@ debug_printk( "/$$$$$$$$$$$$$$$$$$$$$$//n Here I am: %s:%i-------%s()/n", __FILE
 static int rk_camera_set_crop(struct soc_camera_device *icd,
                               const struct v4l2_crop *crop)
 {
-       struct soc_camera_host *ici = to_soc_camera_host(icd->parent);//yzm
+       struct soc_camera_host *ici = to_soc_camera_host(icd->parent);/*yzm*/
     struct rk_camera_dev *pcdev = ici->priv;
 
 debug_printk( "/$$$$$$$$$$$$$$$$$$$$$$//n Here I am: %s:%i-------%s()/n", __FILE__, __LINE__,__FUNCTION__);
@@ -1895,12 +1880,10 @@ debug_printk( "/$$$$$$$$$$$$$$$$$$$$$$//n Here I am: %s:%i-------%s()/n", __FILE
 static int rk_camera_set_fmt(struct soc_camera_device *icd,
                              struct v4l2_format *f)
 {
-    //struct device *dev = icd->dev.parent;
-       struct device *dev = icd->parent;//yzm
+       struct device *dev = icd->parent;/*yzm*/
     struct v4l2_subdev *sd = soc_camera_to_subdev(icd);
     const struct soc_camera_format_xlate *xlate = NULL;
-       //struct soc_camera_host *ici =to_soc_camera_host(icd->dev.parent);
-       struct soc_camera_host *ici = to_soc_camera_host(icd->parent);//yzm
+       struct soc_camera_host *ici = to_soc_camera_host(icd->parent);/*yzm*/
     struct rk_camera_dev *pcdev = ici->priv;
     struct v4l2_pix_format *pix = &f->fmt.pix;
     struct v4l2_mbus_framefmt mf;
@@ -1925,9 +1908,9 @@ debug_printk( "/$$$$$$$$$$$$$$$$$$$$$$//n Here I am: %s:%i-------%s()/n", __FILE
     
     /* ddl@rock-chips.com: sensor init code transmit in here after open */
     if (pcdev->icd_init == 0) {
-        v4l2_subdev_call(sd,core, init, 0);  //µ÷ÓÃgeneric_sensor_init()
+        v4l2_subdev_call(sd,core, init, 0);  /*call generic_sensor_init()*/
         pcdev->icd_init = 1;
-        return 0;                                                      //Ö±½ÓÍ˳ö!!!!!!!
+        return 0;                                                      /*directly return !!!!!!*/
     }
     stream_on = read_cif_reg(pcdev->base,CIF_CIF_CTRL);
     if (stream_on & ENABLE_CAPTURE)
@@ -1941,7 +1924,7 @@ debug_printk( "/$$$$$$$$$$$$$$$$$$$$$$//n Here I am: %s:%i-------%s()/n", __FILE
     mf.reserved[0] = pix->priv;              /* ddl@rock-chips.com : v0.3.3 */
     mf.reserved[1] = 0;
 
-    ret = v4l2_subdev_call(sd, video, s_mbus_fmt, &mf);  //generic_sensor_s_fmt
+    ret = v4l2_subdev_call(sd, video, s_mbus_fmt, &mf);  /*generic_sensor_s_fmt*/
     if (mf.code != xlate->code)
                return -EINVAL;                 
 
@@ -1970,10 +1953,10 @@ debug_printk( "/$$$$$$$$$$$$$$$$$$$$$$//n Here I am: %s:%i-------%s()/n", __FILE
     sensor_w = mf.width;
     sensor_h = mf.height;
 
-    ratio = ((mf.width*mf.reserved[1])/100)&(~0x03);      // 4 align
+    ratio = ((mf.width*mf.reserved[1])/100)&(~0x03);      /* 4 align*/
     mf.width -= ratio;
 
-    ratio = ((ratio*mf.height/mf.width)+1)&(~0x01);       // 2 align
+    ratio = ((ratio*mf.height/mf.width)+1)&(~0x01);       /* 2 align*/
     mf.height -= ratio;
 
        if ((mf.width != usr_w) || (mf.height != usr_h)) {
@@ -1992,7 +1975,7 @@ debug_printk( "/$$$$$$$$$$$$$$$$$$$$$$//n Here I am: %s:%i-------%s()/n", __FILE
                spin_lock(&pcdev->cropinfo.lock);
                if (((mf.width*10/mf.height) != (usr_w*10/usr_h))) {  
             if ((pcdev->cropinfo.c.width == 0)&&(pcdev->cropinfo.c.height == 0)) {        
-                //Scale + Crop center is for keep aspect ratio unchange
+                /*Scale + Crop center is for keep aspect ratio unchange*/
                 ratio = ((mf.width*10/usr_w) >= (mf.height*10/usr_h))?(mf.height*10/usr_h):(mf.width*10/usr_w);
                 pcdev->host_width = ratio*usr_w/10;
                 pcdev->host_height = ratio*usr_h/10;
@@ -2002,7 +1985,7 @@ debug_printk( "/$$$$$$$$$$$$$$$$$$$$$$//n Here I am: %s:%i-------%s()/n", __FILE
                 pcdev->host_left = ((sensor_w-pcdev->host_width )>>1);
                 pcdev->host_top = ((sensor_h-pcdev->host_height)>>1);
             } else {    
-                //Scale + crop(user define)
+                /*Scale + crop(user define)*/
                 pcdev->host_width = pcdev->cropinfo.c.width*mf.width/pcdev->cropinfo.bounds.width;
                 pcdev->host_height = pcdev->cropinfo.c.height*mf.height/pcdev->cropinfo.bounds.height;
                 pcdev->host_left = (pcdev->cropinfo.c.left*mf.width/pcdev->cropinfo.bounds.width);
@@ -2013,13 +1996,13 @@ debug_printk( "/$$$$$$$$$$$$$$$$$$$$$$//n Here I am: %s:%i-------%s()/n", __FILE
             pcdev->host_top &= (~0x01);
         } else { 
             if ((pcdev->cropinfo.c.width == 0)&&(pcdev->cropinfo.c.height == 0)) {
-                //Crop Center for cif can work , then scale
+                /*Crop Center for cif can work , then scale*/
                 pcdev->host_width = mf.width;
                 pcdev->host_height = mf.height;
                 pcdev->host_left = ((sensor_w - mf.width)>>1)&(~0x01);
                 pcdev->host_top = ((sensor_h - mf.height)>>1)&(~0x01);
             } else {
-                //Crop center for cif can work + crop(user define), then scale 
+                /*Crop center for cif can work + crop(user define), then scale */
                 pcdev->host_width = pcdev->cropinfo.c.width*mf.width/pcdev->cropinfo.bounds.width;
                 pcdev->host_height = pcdev->cropinfo.c.height*mf.height/pcdev->cropinfo.bounds.height;
                 pcdev->host_left = (pcdev->cropinfo.c.left*mf.width/pcdev->cropinfo.bounds.width)+((sensor_w - mf.width)>>1);
@@ -2054,7 +2037,7 @@ debug_printk( "/$$$$$$$$$$$$$$$$$$$$$$//n Here I am: %s:%i-------%s()/n", __FILE
        rect.top = pcdev->host_top;
         
         down(&pcdev->zoominfo.sem);
-#if CIF_DO_CROP   // this crop is only for digital zoom
+#if CIF_DO_CROP   /* this crop is only for digital zoom*/
         pcdev->zoominfo.a.c.left = 0;
         pcdev->zoominfo.a.c.top = 0;
         pcdev->zoominfo.a.c.width = pcdev->host_width*100/pcdev->zoominfo.zoom_rate;
@@ -2063,7 +2046,7 @@ debug_printk( "/$$$$$$$$$$$$$$$$$$$$$$//n Here I am: %s:%i-------%s()/n", __FILE
         pcdev->zoominfo.a.c.height &= ~CROP_ALIGN_BYTES;
         pcdev->zoominfo.vir_width = pcdev->zoominfo.a.c.width;
         pcdev->zoominfo.vir_height = pcdev->zoominfo.a.c.height;
-        //recalculate the CIF width & height
+        /*recalculate the CIF width & height*/
         rect.width = pcdev->zoominfo.a.c.width ;
         rect.height = pcdev->zoominfo.a.c.height;
         rect.left = ((((pcdev->host_width - pcdev->zoominfo.a.c.width)>>1))+pcdev->host_left)&(~0x01);
@@ -2073,7 +2056,7 @@ debug_printk( "/$$$$$$$$$$$$$$$$$$$$$$//n Here I am: %s:%i-------%s()/n", __FILE
         pcdev->zoominfo.a.c.width &= ~CROP_ALIGN_BYTES;
         pcdev->zoominfo.a.c.height = pcdev->host_height*100/pcdev->zoominfo.zoom_rate;
         pcdev->zoominfo.a.c.height &= ~CROP_ALIGN_BYTES;
-        //now digital zoom use ipp to do crop and scale
+        /*now digital zoom use ipp to do crop and scale*/
         if(pcdev->zoominfo.zoom_rate != 100){
             pcdev->zoominfo.a.c.left = ((pcdev->host_width - pcdev->zoominfo.a.c.width)>>1)&(~0x01);
             pcdev->zoominfo.a.c.top = ((pcdev->host_height - pcdev->zoominfo.a.c.height)>>1)&(~0x01);
@@ -2136,15 +2119,14 @@ RK_CAMERA_SET_FMT_END:
 static int rk_camera_try_fmt(struct soc_camera_device *icd,
                                    struct v4l2_format *f)
 {
-    //struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent);
-       struct soc_camera_host *ici = to_soc_camera_host(icd->parent);//yzm
+       struct soc_camera_host *ici = to_soc_camera_host(icd->parent);/*yzm*/
        struct rk_camera_dev *pcdev = ici->priv;
     struct v4l2_subdev *sd = soc_camera_to_subdev(icd);
     const struct soc_camera_format_xlate *xlate;
     struct v4l2_pix_format *pix = &f->fmt.pix;
     __u32 pixfmt = pix->pixelformat;
     int ret,usr_w,usr_h,i;
-       bool is_capture = rk_camera_fmt_capturechk(f);  //¼ì²âfÊÇ·ñ·ûºÏÒÑÉ趨µÄ·Ö±æÂÊ
+       bool is_capture = rk_camera_fmt_capturechk(f);  /* testing f is in line with the already set*/
        bool vipmem_is_overflow = false;
     struct v4l2_mbus_framefmt mf;
     int bytes_per_line_host;
@@ -2154,10 +2136,10 @@ static int rk_camera_try_fmt(struct soc_camera_device *icd,
     
 debug_printk( "/$$$$$$$$$$$$$$$$$$$$$$//n Here I am: %s:%i-------%s()\n", __FILE__, __LINE__,__FUNCTION__);
 
-    xlate = soc_camera_xlate_by_fourcc(icd, pixfmt);  //¼ì²âÏñËظñʽ
+    xlate = soc_camera_xlate_by_fourcc(icd, pixfmt);  
     if (!xlate) {
-        //dev_err(icd->dev.parent, "Format (%c%c%c%c) not found\n", pixfmt & 0xFF, (pixfmt >> 8) & 0xFF,
-               dev_err(icd->parent, "Format (%c%c%c%c) not found\n", pixfmt & 0xFF, (pixfmt >> 8) & 0xFF,//yzm
+        /*dev_err(icd->dev.parent, "Format (%c%c%c%c) not found\n", pixfmt & 0xFF, (pixfmt >> 8) & 0xFF,*/
+               dev_err(icd->parent, "Format (%c%c%c%c) not found\n", pixfmt & 0xFF, (pixfmt >> 8) & 0xFF,/*yzm*/
                        (pixfmt >> 16) & 0xFF, (pixfmt >> 24) & 0xFF);
         ret = -EINVAL;
         RKCAMERA_TR("%s(version:%c%c%c) support format:\n",rk_cam_driver_description,(RK_CAM_VERSION_CODE&0xff0000)>>16,
@@ -2190,12 +2172,12 @@ debug_printk( "/$$$$$$$$$$$$$$$$$$$$$$//n Here I am: %s:%i-------%s()\n", __FILE
     if ((usr_w == 10000) && (usr_h == 10000)) {
         mf.reserved[6] = 0xfefe5a5a;
     }
-       //µ÷ÓÃgeneric_sensor_try_fmt()
+       /* call generic_sensor_try_fmt()*/
        ret = v4l2_subdev_call(sd, video, try_mbus_fmt, &mf);
        if (ret < 0)
                goto RK_CAMERA_TRY_FMT_END;
     
-       //query resolution.
+       /*query resolution.*/
        if((usr_w == 10000) && (usr_h == 10000)) {
                pix->width = mf.width;
         pix->height = mf.height;
@@ -2242,8 +2224,7 @@ debug_printk( "/$$$$$$$$$$$$$$$$$$$$$$//n Here I am: %s:%i-------%s()\n", __FILE
                break;
        default:
                /* TODO: support interlaced at least in pass-through mode */
-               //dev_err(icd->dev.parent, "Field type %d unsupported.\n",
-               dev_err(icd->parent, "Field type %d unsupported.\n",//yzm
+               dev_err(icd->parent, "Field type %d unsupported.\n",
                        mf.field);
                goto RK_CAMERA_TRY_FMT_END;
        }
@@ -2300,8 +2281,6 @@ debug_printk( "/$$$$$$$$$$$$$$$$$$$$$$//n Here I am: %s:%i-------%s()/n", __FILE
 *           10          5           1            3              3                3         + 5 < 32           
 */
 
-//»ñÈ¡É豸µÄcapabilities£¬¿´¿´É豸¾ßÌåÓÐʲô¹¦ÄÜ
-//±ÈÈçÊÇ·ñ¾ßÓÐÊÓƵÊäÈë,»òÕßÒôƵÊäÈëÊä³öµÈ¡£
 static int rk_camera_querycap(struct soc_camera_host *ici,
                                 struct v4l2_capability *cap)
 {
@@ -2319,7 +2298,6 @@ debug_printk( "/$$$$$$$$$$$$$$$$$$$$$$//n Here I am: %s:%i-------%s()\n", __FILE
 
     i=0;
     new_camera = pcdev->pdata->register_dev_new;
-    //while (strstr(new_camera->dev_name,"end")==NULL) {
     while(new_camera != NULL){
         if (strcmp(dev_name(pcdev->icd->pdev), new_camera->dev_name) == 0) {
             sprintf(orientation,"-%d",new_camera->orientation);
@@ -2347,8 +2325,7 @@ debug_printk( "/$$$$$$$$$$$$$$$$$$$$$$//n Here I am: %s:%i-------%s()\n", __FILE
 }
 static int rk_camera_suspend(struct soc_camera_device *icd, pm_message_t state)
 {
-    //struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent);
-       struct soc_camera_host *ici = to_soc_camera_host(icd->parent);//yzm
+       struct soc_camera_host *ici = to_soc_camera_host(icd->parent);/*yzm*/
     struct rk_camera_dev *pcdev = ici->priv;
        struct v4l2_subdev *sd;
     int ret = 0;
@@ -2384,8 +2361,7 @@ debug_printk( "/$$$$$$$$$$$$$$$$$$$$$$//n Here I am: %s:%i-------%s()/n", __FILE
 
 static int rk_camera_resume(struct soc_camera_device *icd)
 {
-    //struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent);
-       struct soc_camera_host *ici = to_soc_camera_host(icd->parent);//yzm
+       struct soc_camera_host *ici = to_soc_camera_host(icd->parent);/*yzm*/
     struct rk_camera_dev *pcdev = ici->priv;
        struct v4l2_subdev *sd;
     int ret = 0;
@@ -2431,20 +2407,20 @@ static void rk_camera_reinit_work(struct work_struct *work)
     struct v4l2_subdev *sd;
        struct rk_camera_work *camera_work = container_of(work, struct rk_camera_work, work);
        struct rk_camera_dev *pcdev = camera_work->pcdev;
-    //struct soc_camera_link *tmp_soc_cam_link;
+    /*struct soc_camera_link *tmp_soc_cam_link;*/
     struct v4l2_mbus_framefmt mf;
     int index = 0;
        unsigned long flags = 0;
     int ctrl;
 
 debug_printk( "/$$$$$$$$$$$$$$$$$$$$$$//n Here I am: %s:%i-------%s()/n", __FILE__, __LINE__,__FUNCTION__);
-
+       return;
        
     if(pcdev->icd == NULL)
         return;
     sd = soc_camera_to_subdev(pcdev->icd);
-    //tmp_soc_cam_desc = to_soc_camera_link(pcdev->icd);//yzm
-       //dump regs
+    /*tmp_soc_cam_desc = to_soc_camera_link(pcdev->icd);*/ /*yzm*/
+       /*dump regs*/
        {
                RKCAMERA_TR("CIF_CIF_CTRL = 0x%lx\n",read_cif_reg(pcdev->base,CIF_CIF_CTRL));
                RKCAMERA_TR("CIF_CIF_INTEN = 0x%lx\n",read_cif_reg(pcdev->base,CIF_CIF_INTEN));
@@ -2526,9 +2502,9 @@ static enum hrtimer_restart rk_camera_fps_func(struct hrtimer *timer)
        struct rk_camera_timer *fps_timer = container_of(timer, struct rk_camera_timer, timer);
        struct rk_camera_dev *pcdev = fps_timer->pcdev;
     int rec_flag,i;
-   // static unsigned int last_fps = 0;
-    //struct soc_camera_link *tmp_soc_cam_link;//yzm
-    //tmp_soc_cam_link = to_soc_camera_link(pcdev->icd);//yzm
+       /*static unsigned int last_fps = 0;*/
+       /*struct soc_camera_link *tmp_soc_cam_link;*/ /*yzm*/
+       /*tmp_soc_cam_link = to_soc_camera_link(pcdev->icd);*/ /*yzm*/
 
 debug_printk( "/$$$$$$$$$$$$$$$$$$$$$$//n Here I am: %s:%i-------%s()/n", __FILE__, __LINE__,__FUNCTION__);
 
@@ -2537,7 +2513,7 @@ debug_printk( "/$$$$$$$$$$$$$$$$$$$$$$//n Here I am: %s:%i-------%s()/n", __FILE
                RKCAMERA_TR("Camera host haven't recevie data from sensor,last fps = %d,pcdev->fps = %d,cif_irq: %ld,dma_irq: %ld!\n",
                            pcdev->last_fps,pcdev->fps,pcdev->irqinfo.cifirq_idx, pcdev->irqinfo.dmairq_idx);
                pcdev->camera_reinit_work.pcdev = pcdev;
-               //INIT_WORK(&(pcdev->camera_reinit_work.work), rk_camera_reinit_work);
+               /*INIT_WORK(&(pcdev->camera_reinit_work.work), rk_camera_reinit_work);*/
         pcdev->reinit_times++;
                queue_work(pcdev->camera_wq,&(pcdev->camera_reinit_work.work));
        } else if(!pcdev->timer_get_fps) {
@@ -2552,7 +2528,7 @@ debug_printk( "/$$$$$$$$$$$$$$$$$$$$$$//n Here I am: %s:%i-------%s()/n", __FILE
         fival_pre = fival_nxt;
         while (fival_nxt != NULL) {
 
-            RKCAMERA_DG1("%s %c%c%c%c %dx%d framerate : %d/%d\n", dev_name(pcdev->icd->control), //yzm
+            RKCAMERA_DG1("%s %c%c%c%c %dx%d framerate : %d/%d\n", dev_name(pcdev->icd->control), /*yzm*/
                 fival_nxt->fival.pixel_format & 0xFF, (fival_nxt->fival.pixel_format >> 8) & 0xFF,
                            (fival_nxt->fival.pixel_format >> 16) & 0xFF, (fival_nxt->fival.pixel_format >> 24),
                            fival_nxt->fival.width, fival_nxt->fival.height, fival_nxt->fival.discrete.denominator,
@@ -2606,7 +2582,7 @@ debug_printk( "/$$$$$$$$$$$$$$$$$$$$$$//n Here I am: %s:%i-------%s()/n", __FILE
     pcdev->last_fps = pcdev->fps ;
     pcdev->fps_timer.timer.node.expires= ktime_add_us(pcdev->fps_timer.timer.node.expires, ktime_to_us(ktime_set(3, 0)));
     pcdev->fps_timer.timer._softexpires= ktime_add_us(pcdev->fps_timer.timer._softexpires, ktime_to_us(ktime_set(3, 0)));
-    //return HRTIMER_NORESTART;
+    /*return HRTIMER_NORESTART;*/
     if(pcdev->reinit_times >=2)
         return HRTIMER_NORESTART;
     else
@@ -2614,14 +2590,13 @@ debug_printk( "/$$$$$$$$$$$$$$$$$$$$$$//n Here I am: %s:%i-------%s()/n", __FILE
 }
 static int rk_camera_s_stream(struct soc_camera_device *icd, int enable)
 {
-       //struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent);
-       struct soc_camera_host *ici = to_soc_camera_host(icd->parent);//yzm
+       struct soc_camera_host *ici = to_soc_camera_host(icd->parent);/*yzm*/
     struct rk_camera_dev *pcdev = ici->priv;
     int cif_ctrl_val;
        int ret;
        unsigned long flags;
 
-debug_printk( "/$$$$$$$$$$$$$$$$$$$$$$//n Here I am: %s:%i-------%s()/n", __FILE__, __LINE__,__FUNCTION__);    
+       debug_printk( "/$$$$$$$$$$$$$$$$$$$$$$//n Here I am: %s:%i-------%s()/n", __FILE__, __LINE__,__FUNCTION__);     
 
        WARN_ON(pcdev->icd != icd);
 
@@ -2641,15 +2616,16 @@ debug_printk( "/$$$$$$$$$$$$$$$$$$$$$$//n Here I am: %s:%i-------%s()/n", __FILE
         pcdev->irqinfo.cifirq_normal_idx = 0;
         pcdev->irqinfo.cifirq_abnormal_idx = 0;
         pcdev->irqinfo.dmairq_idx = 0;
-        
+               
+               write_cif_reg(pcdev->base,CIF_CIF_INTEN, 0x01|0x200);    /*capture complete interrupt enable*/
                cif_ctrl_val |= ENABLE_CAPTURE;
         write_cif_reg(pcdev->base,CIF_CIF_CTRL, cif_ctrl_val);
         spin_unlock_irqrestore(&pcdev->lock,flags);
-        
+        printk("%s:stream enable CIF_CIF_CTRL 0x%lx",__func__,read_cif_reg(pcdev->base,CIF_CIF_CTRL));
                hrtimer_start(&(pcdev->fps_timer.timer),ktime_set(3, 0),HRTIMER_MODE_REL);
         pcdev->fps_timer.istarted = true;
        } else {
-           //cancel timer before stop cif
+           /*cancel timer before stop cif*/
                ret = hrtimer_cancel(&pcdev->fps_timer.timer);
         pcdev->fps_timer.istarted = false;
         flush_work(&(pcdev->camera_reinit_work.work));
@@ -2658,10 +2634,11 @@ debug_printk( "/$$$$$$$$$$$$$$$$$$$$$$//n Here I am: %s:%i-------%s()/n", __FILE
                spin_lock_irqsave(&pcdev->lock, flags);
        write_cif_reg(pcdev->base,CIF_CIF_CTRL, cif_ctrl_val);
         atomic_set(&pcdev->stop_cif,true);
+               write_cif_reg(pcdev->base,CIF_CIF_INTEN, 0x0); 
        spin_unlock_irqrestore(&pcdev->lock, flags);
                flush_workqueue((pcdev->camera_wq));
        }
-    //must be reinit,or will be somthing wrong in irq process.
+    /*must be reinit,or will be somthing wrong in irq process.*/
     if(enable == false) {
         pcdev->active = NULL;
         INIT_LIST_HEAD(&pcdev->capture);
@@ -2671,8 +2648,7 @@ debug_printk( "/$$$$$$$$$$$$$$$$$$$$$$//n Here I am: %s:%i-------%s()/n", __FILE
 }
 int rk_camera_enum_frameintervals(struct soc_camera_device *icd, struct v4l2_frmivalenum *fival)
 {
-    //struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent);
-       struct soc_camera_host *ici = to_soc_camera_host(icd->parent);//yzm
+       struct soc_camera_host *ici = to_soc_camera_host(icd->parent);/*yzm*/
     struct rk_camera_dev *pcdev = ici->priv;
     struct v4l2_subdev *sd = soc_camera_to_subdev(icd);
     struct rk_camera_frmivalenum *fival_list = NULL;
@@ -2806,7 +2782,7 @@ static int rk_camera_set_digit_zoom(struct soc_camera_device *icd,
                                                                const struct v4l2_queryctrl *qctrl, int zoom_rate)
 {
        struct v4l2_crop a;
-       struct soc_camera_host *ici = to_soc_camera_host(icd->parent);//yzm
+       struct soc_camera_host *ici = to_soc_camera_host(icd->parent);/*yzm*/
        struct rk_camera_dev *pcdev = ici->priv;
 
 debug_printk( "/$$$$$$$$$$$$$$$$$$$$$$//n Here I am: %s:%i-------%s()/n", __FILE__, __LINE__,__FUNCTION__);
@@ -2816,11 +2792,11 @@ debug_printk( "/$$$$$$$$$$$$$$$$$$$$$$//n Here I am: %s:%i-------%s()/n", __FILE
        unsigned long tmp_cifctrl; 
 #endif 
 
-       //change the crop and scale parameters
+       /*change the crop and scale parameters*/
        
 #if CIF_DO_CROP
     a.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
-    //a.c.width = pcdev->host_width*100/zoom_rate;
+    /*a.c.width = pcdev->host_width*100/zoom_rate;*/
     a.c.width = pcdev->host_width*100/zoom_rate;
     a.c.width &= ~CROP_ALIGN_BYTES;    
     a.c.height = pcdev->host_height*100/zoom_rate;
@@ -2886,7 +2862,7 @@ static inline struct v4l2_queryctrl const *rk_camera_soc_camera_find_qctrl(
        for (i = 0; i < ops->num_controls; i++)
                if (ops->controls[i].id == id)
                        return &ops->controls[i];
-*///**************yzm********
+**************yzm*********/
        return NULL;
 }
 
@@ -2894,8 +2870,7 @@ static inline struct v4l2_queryctrl const *rk_camera_soc_camera_find_qctrl(
 static int rk_camera_set_ctrl(struct soc_camera_device *icd,
                                                                struct v4l2_control *sctrl)
 {
-       //struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent);
-       struct soc_camera_host *ici = to_soc_camera_host(icd->parent);//yzm
+       struct soc_camera_host *ici = to_soc_camera_host(icd->parent);/*yzm*/
        const struct v4l2_queryctrl *qctrl;
     struct rk_camera_dev *pcdev = ici->priv;
 
@@ -2940,7 +2915,7 @@ static struct soc_camera_host_ops rk_soc_camera_host_ops =
     .remove            = rk_camera_remove_device,
     .suspend   = rk_camera_suspend,
     .resume            = rk_camera_resume,
-    //.enum_frameinervals = rk_camera_enum_frameintervals,
+    .enum_frameinervals = rk_camera_enum_frameintervals,
     .cropcap    = rk_camera_cropcap,
     .set_crop  = rk_camera_set_crop,
     .get_crop   = rk_camera_get_crop,
@@ -2971,10 +2946,10 @@ static int rk_camera_cif_iomux(struct device *dev)
 debug_printk( "/$$$$$$$$$$$$$$$$$$$$$$//n Here I am: %s:%i-------%s()\n", __FILE__, __LINE__,__FUNCTION__);
     strcpy(state_str,"cif_pin_jpe");
 
-       __raw_writel(((1<<1)|(1<<(1+16))),RK_GRF_VIRT+0x0380);
+       /*__raw_writel(((1<<1)|(1<<(1+16))),RK_GRF_VIRT+0x0380);*/
 
 
-    //mux CIF0_CLKOUT
+    /*mux CIF0_CLKOUT*/
 
     pinctrl = devm_pinctrl_get(dev);
     if (IS_ERR(pinctrl)) {
@@ -3001,7 +2976,7 @@ debug_printk( "/$$$$$$$$$$$$$$$$$$$$$$//n Here I am: %s:%i-------%s()\n", __FILE
             
 }
 /***********yzm***********/
-static int rk_camera_probe(struct platform_device *pdev)  //host probe
+static int rk_camera_probe(struct platform_device *pdev)
 {
     struct rk_camera_dev *pcdev;
     struct resource *res;
@@ -3009,7 +2984,7 @@ static int rk_camera_probe(struct platform_device *pdev)  //host probe
     int irq,i;
     int err = 0;
     struct rk_cif_clk *clk=NULL;
-       struct device *dev_cif = ((struct rk29camera_platform_data*)pdev->dev.platform_data)->cif_dev;//yzm
+       struct device *dev_cif = ((struct rk29camera_platform_data*)pdev->dev.platform_data)->cif_dev;/*yzm*/
 debug_printk( "/$$$$$$$$$$$$$$$$$$$$$$//n Here I am: %s:%i-------%s()\n", __FILE__, __LINE__,__FUNCTION__);
 
        RKCAMERA_TR("%s version: v%d.%d.%d  Zoom by %s",RK29_CAM_DRV_NAME,(RK_CAM_VERSION_CODE&0xff0000)>>16,
@@ -3029,10 +3004,10 @@ debug_printk( "/$$$$$$$$$$$$$$$$$$$$$$//n Here I am: %s:%i-------%s()\n", __FILE
     res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
     irq = platform_get_irq(pdev, 0);
 
-//     irq = irq_of_parse_and_map(dev_cif->of_node, 0);
-//debug_printk( "/$$$$$$$$$$$$$$$$$$$$$$//n res = [%x--%x] \n",res->start , res->end);
-//debug_printk( "/$$$$$$$$$$$$$$$$$$$$$$//n irq_num = %d\n", irq);
-
+       /*      irq = irq_of_parse_and_map(dev_cif->of_node, 0);
+       debug_printk( "/$$$$$$$$$$$$$$$$$$$$$$//n res = [%x--%x] \n",res->start , res->end);
+       debug_printk( "/$$$$$$$$$$$$$$$$$$$$$$//n irq_num = %d\n", irq);
+       */
     if (!res || irq < 0) {
         err = -ENODEV;
         goto exit;
@@ -3045,15 +3020,15 @@ debug_printk( "/$$$$$$$$$$$$$$$$$$$$$$//n Here I am: %s:%i-------%s()\n", __FILE
     }
 
     pcdev->zoominfo.zoom_rate = 100;
-    pcdev->hostid = pdev->id;        //»ñÈ¡hostµÄid
+    pcdev->hostid = pdev->id;        /* get host id*/
     #ifdef CONFIG_SOC_RK3028
     pcdev->chip_id = rk3028_version_val();
     #else
     pcdev->chip_id = -1;
     #endif
 
-//***********yzm***********    
-    if (IS_CIF0()) {
+       /***********yzm***********/
+       if (IS_CIF0()) {
                debug_printk( "/$$$$$$$$$$$$$$$$$$$$$$/is_cif0\n");
         clk = &cif_clk[0];
         cif_clk[0].pd_cif = devm_clk_get(dev_cif, "pd_cif0");
@@ -3063,29 +3038,29 @@ debug_printk( "/$$$$$$$$$$$$$$$$$$$$$$//n Here I am: %s:%i-------%s()\n", __FILE
         cif_clk[0].cif_clk_out = devm_clk_get(dev_cif, "cif0_out");
         spin_lock_init(&cif_clk[0].lock);
         cif_clk[0].on = false;
-        rk_camera_cif_iomux(dev_cif);//yzm
+        rk_camera_cif_iomux(dev_cif);/*yzm*/
     } else {
-        clk = &cif_clk[1];
-        cif_clk[1].pd_cif = devm_clk_get(dev_cif, "pd_cif0");//Ä¿Ç°Ö»¶¨ÒåÁËcif0 yzm
+       clk = &cif_clk[1];
+        cif_clk[1].pd_cif = devm_clk_get(dev_cif, "pd_cif0");/*cif0  only yzm*/
         cif_clk[1].aclk_cif = devm_clk_get(dev_cif, "aclk_cif0");
         cif_clk[1].hclk_cif = devm_clk_get(dev_cif, "hclk_cif0");
         cif_clk[1].cif_clk_in = devm_clk_get(dev_cif, "cif0_in");
         cif_clk[1].cif_clk_out = devm_clk_get(dev_cif, "cif0_out");
         spin_lock_init(&cif_clk[1].lock);
         cif_clk[1].on = false;
-        rk_camera_cif_iomux(dev_cif);//yzm
+        rk_camera_cif_iomux(dev_cif);/*yzm*/
     }
 
-debug_printk( "/$$$$$$$$$$$$$$$$$$$$$$//n Here I am: %s:%i-------%s()\n", __FILE__, __LINE__,__FUNCTION__);
+       debug_printk( "/$$$$$$$$$$$$$$$$$$$$$$//n Here I am: %s:%i-------%s()\n", __FILE__, __LINE__,__FUNCTION__);
 
-//***********yzm**********end    
+       /***********yzm**********/
     dev_set_drvdata(&pdev->dev, pcdev);
     pcdev->res = res;
     pcdev->pdata = pdev->dev.platform_data;             /* ddl@rock-chips.com : Request IO in init function */
-                       //     = rk_camera_platform_data ÄǸö´ó½á¹¹Ìåyzm
+                                       /*= rk_camera_platform_data */
        if (pcdev->pdata && pcdev->pdata->io_init) {
                
-        pcdev->pdata->io_init();//yzm µ÷ÓÃrk_sensor_io_init()
+        pcdev->pdata->io_init();/* call rk_sensor_io_init()*/
 
         if (pcdev->pdata->sensor_mclk == NULL)
             pcdev->pdata->sensor_mclk = rk_camera_mclk_ctrl;
@@ -3151,10 +3126,10 @@ debug_printk( "/$$$$$$$$$$$$$$$$$$$$$$//n Here I am: %s:%i-------%s()\n", __FILE
     }
     pcdev->soc_host.drv_name   = RK29_CAM_DRV_NAME;
     pcdev->soc_host.ops                = &rk_soc_camera_host_ops;
-    pcdev->soc_host.priv               = pcdev;        //Ö¸Ïò×Ô¼º£¬ÔÚrk_camera_add_deviceÖÐÓе÷ÓÃ
+    pcdev->soc_host.priv               = pcdev;        /*to itself,csll in rk_camera_add_device*/
     pcdev->soc_host.v4l2_dev.dev       = &pdev->dev;
     pcdev->soc_host.nr         = pdev->id;
-debug_printk("/$$$$$$$$$$$$$$$$$$$$$$/next soc_camera_host_register\n");
+       debug_printk("/$$$$$$$$$$$$$$$$$$$$$$/next soc_camera_host_register\n");
     err = soc_camera_host_register(&pcdev->soc_host);
 
 
@@ -3226,7 +3201,7 @@ static int __exit rk_camera_remove(struct platform_device *pdev)
     struct rk_camera_frmivalenum *fival_list,*fival_nxt;
     int i;
 
-debug_printk( "/$$$$$$$$$$$$$$$$$$$$$$//n Here I am: %s:%i-------%s()/n", __FILE__, __LINE__,__FUNCTION__);
+       debug_printk( "/$$$$$$$$$$$$$$$$$$$$$$//n Here I am: %s:%i-------%s()/n", __FILE__, __LINE__,__FUNCTION__);
 
        
     free_irq(pcdev->irqinfo.irq, pcdev);
@@ -3266,7 +3241,7 @@ debug_printk( "/$$$$$$$$$$$$$$$$$$$$$$//n Here I am: %s:%i-------%s()/n", __FILE
 static struct platform_driver rk_camera_driver =
 {
     .driver    = {
-        .name  = RK29_CAM_DRV_NAME,       //host       
+        .name  = RK29_CAM_DRV_NAME,       /*host */      
     },
     .probe             = rk_camera_probe,
     .remove            = (rk_camera_remove),
@@ -3298,10 +3273,10 @@ debug_printk( "/$$$$$$$$$$$$$$$$$$$$$$//n Here I am: %s:%i-------%s()/n", __FILE
     platform_driver_unregister(&rk_camera_driver);
 }
 
-device_initcall_sync(rk_camera_init); //module_init();
+device_initcall_sync(rk_camera_init);
 module_exit(rk_camera_exit);
 
 MODULE_DESCRIPTION("RKSoc Camera Host driver");
 MODULE_AUTHOR("ddl <ddl@rock-chips>");
 MODULE_LICENSE("GPL");
-//#endif//yzm
+//#endif/*yzm*/
index 8427b781e8ef2d07f868cdc1f779b84cc5158bba..190075daeb46ac8cec971caa42d496b852955ec5 100644 (file)
@@ -40,8 +40,8 @@ struct soc_camera_device {
        unsigned char devnum;           /* Device number per host */
        struct soc_camera_sense *sense; /* See comment in struct definition */
 
-       struct soc_camera_ops *ops;//yzm
-       struct mutex video_lock;//yzm
+       struct soc_camera_ops *ops;/*yzm*/
+       struct mutex video_lock;/*yzm*/
 
        struct video_device *vdev;
        struct v4l2_ctrl_handler ctrl_handler;
@@ -80,7 +80,7 @@ struct soc_camera_host_ops {
        /****************yzm**************/
        int (*suspend)(struct soc_camera_device *, pm_message_t);
        int (*resume)(struct soc_camera_device *);
-       //int (*enum_frameinervals)(struct soc_camera_device *, struct v4l2_frmivalenum);
+    int (*enum_frameinervals)(struct soc_camera_device *, struct v4l2_frmivalenum *);/* ddl@rock-chips.com :Add ioctrl - VIDIOC_ENUM_FRAMEINTERVALS for soc-camera */
        int (*get_ctrl)(struct soc_camera_device *, struct v4l2_control *);
        int (*set_ctrl)(struct soc_camera_device *, struct v4l2_control *);
        int (*s_stream)(struct soc_camera_device *, int enable);
@@ -115,7 +115,7 @@ struct soc_camera_host_ops {
                              struct soc_camera_device *);
        int (*reqbufs)(struct soc_camera_device *, struct v4l2_requestbuffers *);
        int (*querycap)(struct soc_camera_host *, struct v4l2_capability *);
-       int (*set_bus_param)(struct soc_camera_device *, __u32);//yzm
+       int (*set_bus_param)(struct soc_camera_device *, __u32);/*yzm*/
        int (*get_parm)(struct soc_camera_device *, struct v4l2_streamparm *);
        int (*set_parm)(struct soc_camera_device *, struct v4l2_streamparm *);
        int (*enum_framesizes)(struct soc_camera_device *, struct v4l2_frmsizeenum *);
@@ -138,7 +138,7 @@ struct soc_camera_subdev_desc {
        /* sensor driver private platform data */
        void *drv_priv;
 
-       struct soc_camera_device *socdev;//yzm
+       struct soc_camera_device *socdev;/*yzm*/
        
        /* Optional regulators that have to be managed on power on/off events */
        struct regulator_bulk_data *regulators;
@@ -148,7 +148,7 @@ struct soc_camera_subdev_desc {
        int (*power)(struct device *, int);
        int (*reset)(struct device *);
 
-       int (*powerdown)(struct device *, int);//yzm
+       int (*powerdown)(struct device *, int);/*yzm*/
        /*
         * some platforms may support different data widths than the sensors
         * native ones due to different data line routing. Let the board code
@@ -195,7 +195,7 @@ struct soc_camera_link {
        unsigned long flags;
 
        void *priv;
-       void *priv_usr;         //yzm@rock-chips.com
+       void *priv_usr;         /*yzm*/
        /* Optional regulators that have to be managed on power on/off events */
        struct regulator_bulk_data *regulators;
        int num_regulators;
@@ -203,7 +203,7 @@ struct soc_camera_link {
        /* Optional callbacks to power on or off and reset the sensor */
        int (*power)(struct device *, int);
        int (*reset)(struct device *);
-       int (*powerdown)(struct device *,int);          //yzm@rock-chips.com
+       int (*powerdown)(struct device *,int);          /*yzm*/
        /*
         * some platforms may support different data widths than the sensors
         * native ones due to different data line routing. Let the board code
@@ -319,6 +319,19 @@ struct soc_camera_sense {
        unsigned long pixel_clock_max;
        unsigned long pixel_clock;
 };
+/***************yzm****************/
+static inline struct v4l2_queryctrl const *soc_camera_find_qctrl(
+       struct soc_camera_ops *ops, int id)
+{
+       int i;
+
+       for (i = 0; i < ops->num_controls; i++)
+               if (ops->controls[i].id == id)
+                       return &ops->controls[i];
+
+       return NULL;
+}
+/***************yzm****************rnd*/
 
 #define SOCAM_DATAWIDTH(x)     BIT((x) - 1)
 #define SOCAM_DATAWIDTH_4      SOCAM_DATAWIDTH(4)
index 67f17a1052d00da2fb7e400fd9bb37792aa03257..83ea2656a6c6775c0a1e02cc917e9252231e5fae 100644 (file)
@@ -618,12 +618,25 @@ enum  v4l2_exposure_auto_type {
 #define V4L2_CID_FOCUS_RELATIVE                        (V4L2_CID_CAMERA_CLASS_BASE+11)
 #define V4L2_CID_FOCUS_AUTO                    (V4L2_CID_CAMERA_CLASS_BASE+12)
 
-#define V4L2_CID_FOCUS_CONTINUOUS   (V4L2_CID_CAMERA_CLASS_BASE+4)//yzm
-#define V4L2_CID_FLASH              (V4L2_CID_CAMERA_CLASS_BASE+3)//yzm
-#define V4L2_CID_EFFECT             (V4L2_CID_CAMERA_CLASS_BASE+2)//yzm
-#define V4L2_CID_SCENE              (V4L2_CID_CAMERA_CLASS_BASE+1)//yzm
-#define V4L2_CID_FOCUSZONE          (V4L2_CID_CAMERA_CLASS_BASE+5)//yzm
-#define V4L2_CID_FACEDETECT         (V4L2_CID_CAMERA_CLASS_BASE+6)//yzm
+/**************yzm**************/
+/* ddl@rock-chips.com : Add ioctrl -  V4L2_CID_SCENE for camera scene control */
+#define V4L2_CID_CAMERA_CLASS_BASE_ROCK                (V4L2_CID_CAMERA_CLASS_BASE + 30)
+#define V4L2_CID_SCENE                         (V4L2_CID_CAMERA_CLASS_BASE_ROCK+1)
+#define V4L2_CID_EFFECT                                (V4L2_CID_CAMERA_CLASS_BASE_ROCK+2)
+#define V4L2_CID_FLASH                         (V4L2_CID_CAMERA_CLASS_BASE_ROCK+3)
+#define V4L2_CID_FOCUS_CONTINUOUS              (V4L2_CID_CAMERA_CLASS_BASE_ROCK+4)
+#define V4L2_CID_FOCUSZONE       (V4L2_CID_CAMERA_CLASS_BASE_ROCK+5)
+#define V4L2_CID_FACEDETECT (V4L2_CID_CAMERA_CLASS_BASE_ROCK+6)
+#define V4L2_CID_HDR        (V4L2_CID_CAMERA_CLASS_BASE_ROCK+7) 
+#define V4L2_CID_ISO                           (V4L2_CID_CAMERA_CLASS_BASE_ROCK + 8)
+#define V4L2_CID_ANTIBANDING           (V4L2_CID_CAMERA_CLASS_BASE_ROCK + 9)
+#define V4L2_CID_WHITEBALANCE_LOCK     (V4L2_CID_CAMERA_CLASS_BASE_ROCK + 10)
+#define V4L2_CID_EXPOSURE_LOCK         (V4L2_CID_CAMERA_CLASS_BASE_ROCK + 11)
+#define V4L2_CID_METERING_AREAS                (V4L2_CID_CAMERA_CLASS_BASE_ROCK + 12)
+#define V4L2_CID_WDR                           (V4L2_CID_CAMERA_CLASS_BASE_ROCK + 13)
+#define V4L2_CID_EDGE                          (V4L2_CID_CAMERA_CLASS_BASE_ROCK + 14)
+#define V4L2_CID_JPEG_EXIF                     (V4L2_CID_CAMERA_CLASS_BASE_ROCK + 15)
+/***************yzm***************/
 
 #define V4L2_CID_ZOOM_ABSOLUTE                 (V4L2_CID_CAMERA_CLASS_BASE+13)
 #define V4L2_CID_ZOOM_RELATIVE                 (V4L2_CID_CAMERA_CLASS_BASE+14)