camera: cif:v0.3.3, generic_sensor:v0.1.5
authorddl <ddl@rock-chips.com>
Wed, 15 May 2013 03:10:14 +0000 (11:10 +0800)
committerddl <ddl@rock-chips.com>
Wed, 15 May 2013 03:10:14 +0000 (11:10 +0800)
arch/arm/plat-rk/rk_camera.c
drivers/media/video/generic_sensor.c
drivers/media/video/generic_sensor.h
drivers/media/video/rk30_camera_oneframe.c

index e47448392870deb4d5f921bc41fdf56ac819afc3..4db26e754dff566887422b7a363709263e696b59 100755 (executable)
@@ -277,10 +277,10 @@ module_param(camera_debug, int, S_IRUGO|S_IWUSR);
 \r
 #define ddprintk(level, fmt, arg...) do {                      \\r
        if (camera_debug >= level)                                      \\r
-           printk(KERN_WARNING"%s(%d):" fmt , CAMMODULE_NAME,__LINE__,## arg); } while (0)\r
+           printk(KERN_WARNING"%s(%d):" fmt"\n", CAMMODULE_NAME,__LINE__,## arg); } while (0)\r
 \r
 #define dprintk(format, ...) ddprintk(1, format, ## __VA_ARGS__)  \r
-#define eprintk(format, ...) printk(KERN_ERR "%s(%d):" format,CAMMODULE_NAME,__LINE__,## __VA_ARGS__)  \r
+#define eprintk(format, ...) printk(KERN_ERR "%s(%d):" format"\n",CAMMODULE_NAME,__LINE__,## __VA_ARGS__)  \r
 \r
 #define SENSOR_NAME_0 STR(CONFIG_SENSOR_0)                     /* back camera sensor 0 */\r
 #define SENSOR_NAME_1 STR(CONFIG_SENSOR_1)                     /* front camera sensor 0 */\r
@@ -724,15 +724,15 @@ static int sensor_power_default_cb (struct rk29camera_gpio_res *res, int on)
                if (camera_io_init & RK29_CAM_POWERACTIVE_MASK) {\r
             if (on) {\r
                gpio_set_value(camera_power, ((camera_ioflag&RK29_CAM_POWERACTIVE_MASK)>>RK29_CAM_POWERACTIVE_BITPOS));\r
-                       dprintk("%s PowerPin=%d ..PinLevel = %x   \n",res->dev_name, camera_power, ((camera_ioflag&RK29_CAM_POWERACTIVE_MASK)>>RK29_CAM_POWERACTIVE_BITPOS));\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
-                       dprintk("%s PowerPin=%d ..PinLevel = %x   \n",res->dev_name, camera_power, (((~camera_ioflag)&RK29_CAM_POWERACTIVE_MASK)>>RK29_CAM_POWERACTIVE_BITPOS));\r
+                       dprintk("%s PowerPin=%d ..PinLevel = %x",res->dev_name, camera_power, (((~camera_ioflag)&RK29_CAM_POWERACTIVE_MASK)>>RK29_CAM_POWERACTIVE_BITPOS));\r
                }\r
                } else {\r
                        ret = RK29_CAM_EIO_REQUESTFAIL;\r
-                       eprintk("%s PowerPin=%d request failed!\n", res->dev_name,camera_power);\r
+                       eprintk("%s PowerPin=%d request failed!", res->dev_name,camera_power);\r
            }        \r
     } else {\r
                ret = RK29_CAM_EIO_INVALID;\r
@@ -752,14 +752,14 @@ static int sensor_reset_default_cb (struct rk29camera_gpio_res *res, int on)
                if (camera_io_init & RK29_CAM_RESETACTIVE_MASK) {\r
                        if (on) {\r
                        gpio_set_value(camera_reset, ((camera_ioflag&RK29_CAM_RESETACTIVE_MASK)>>RK29_CAM_RESETACTIVE_BITPOS));\r
-                       dprintk("%s ResetPin=%d ..PinLevel = %x \n",res->dev_name,camera_reset, ((camera_ioflag&RK29_CAM_RESETACTIVE_MASK)>>RK29_CAM_RESETACTIVE_BITPOS));\r
+                       dprintk("%s ResetPin=%d ..PinLevel = %x",res->dev_name,camera_reset, ((camera_ioflag&RK29_CAM_RESETACTIVE_MASK)>>RK29_CAM_RESETACTIVE_BITPOS));\r
                        } else {\r
                                gpio_set_value(camera_reset,(((~camera_ioflag)&RK29_CAM_RESETACTIVE_MASK)>>RK29_CAM_RESETACTIVE_BITPOS));\r
-                       dprintk("%s ResetPin= %d..PinLevel = %x   \n",res->dev_name, camera_reset, (((~camera_ioflag)&RK29_CAM_RESETACTIVE_MASK)>>RK29_CAM_RESETACTIVE_BITPOS));\r
+                       dprintk("%s ResetPin= %d..PinLevel = %x",res->dev_name, camera_reset, (((~camera_ioflag)&RK29_CAM_RESETACTIVE_MASK)>>RK29_CAM_RESETACTIVE_BITPOS));\r
                }\r
                } else {\r
                        ret = RK29_CAM_EIO_REQUESTFAIL;\r
-                       eprintk("%s ResetPin=%d request failed!\n", res->dev_name,camera_reset);\r
+                       eprintk("%s ResetPin=%d request failed!", res->dev_name,camera_reset);\r
                }\r
     } else {\r
                ret = RK29_CAM_EIO_INVALID;\r
@@ -779,14 +779,14 @@ static int sensor_powerdown_default_cb (struct rk29camera_gpio_res *res, int on)
                if (camera_io_init & RK29_CAM_POWERDNACTIVE_MASK) {\r
                        if (on) {\r
                        gpio_set_value(camera_powerdown, ((camera_ioflag&RK29_CAM_POWERDNACTIVE_MASK)>>RK29_CAM_POWERDNACTIVE_BITPOS));\r
-                       dprintk("%s PowerDownPin=%d ..PinLevel = %x \n" ,res->dev_name,camera_powerdown, ((camera_ioflag&RK29_CAM_POWERDNACTIVE_MASK)>>RK29_CAM_POWERDNACTIVE_BITPOS));\r
+                       dprintk("%s PowerDownPin=%d ..PinLevel = %x" ,res->dev_name,camera_powerdown, ((camera_ioflag&RK29_CAM_POWERDNACTIVE_MASK)>>RK29_CAM_POWERDNACTIVE_BITPOS));\r
                        } else {\r
                                gpio_set_value(camera_powerdown,(((~camera_ioflag)&RK29_CAM_POWERDNACTIVE_MASK)>>RK29_CAM_POWERDNACTIVE_BITPOS));\r
-                       dprintk("%s PowerDownPin= %d..PinLevel = %x   \n" ,res->dev_name, camera_powerdown, (((~camera_ioflag)&RK29_CAM_POWERDNACTIVE_MASK)>>RK29_CAM_POWERDNACTIVE_BITPOS));\r
+                       dprintk("%s PowerDownPin= %d..PinLevel = %x" ,res->dev_name, camera_powerdown, (((~camera_ioflag)&RK29_CAM_POWERDNACTIVE_MASK)>>RK29_CAM_POWERDNACTIVE_BITPOS));\r
                }\r
                } else {\r
                        ret = RK29_CAM_EIO_REQUESTFAIL;\r
-                       dprintk("%s PowerDownPin=%d request failed!\n", res->dev_name,camera_powerdown);\r
+                       dprintk("%s PowerDownPin=%d request failed!", res->dev_name,camera_powerdown);\r
                }\r
     } else {\r
                ret = RK29_CAM_EIO_INVALID;\r
@@ -809,33 +809,33 @@ static int sensor_flash_default_cb (struct rk29camera_gpio_res *res, int on)
                 case Flash_Off:\r
                 {\r
                     gpio_set_value(camera_flash,(((~camera_ioflag)&RK29_CAM_FLASHACTIVE_MASK)>>RK29_CAM_FLASHACTIVE_BITPOS));\r
-                           dprintk("%s FlashPin= %d..PinLevel = %x   \n", res->dev_name, camera_flash, (((~camera_ioflag)&RK29_CAM_FLASHACTIVE_MASK)>>RK29_CAM_FLASHACTIVE_BITPOS)); \r
+                           dprintk("%s FlashPin= %d..PinLevel = %x", res->dev_name, camera_flash, (((~camera_ioflag)&RK29_CAM_FLASHACTIVE_MASK)>>RK29_CAM_FLASHACTIVE_BITPOS)); \r
                            break;\r
                 }\r
 \r
                 case Flash_On:\r
                 {\r
                     gpio_set_value(camera_flash, ((camera_ioflag&RK29_CAM_FLASHACTIVE_MASK)>>RK29_CAM_FLASHACTIVE_BITPOS));\r
-                           dprintk("%s FlashPin=%d ..PinLevel = %x \n", res->dev_name,camera_flash, ((camera_ioflag&RK29_CAM_FLASHACTIVE_MASK)>>RK29_CAM_FLASHACTIVE_BITPOS));\r
+                           dprintk("%s FlashPin=%d ..PinLevel = %x", res->dev_name,camera_flash, ((camera_ioflag&RK29_CAM_FLASHACTIVE_MASK)>>RK29_CAM_FLASHACTIVE_BITPOS));\r
                            break;\r
                 }\r
 \r
                 case Flash_Torch:\r
                 {\r
                     gpio_set_value(camera_flash, ((camera_ioflag&RK29_CAM_FLASHACTIVE_MASK)>>RK29_CAM_FLASHACTIVE_BITPOS));\r
-                           dprintk("%s FlashPin=%d ..PinLevel = %x \n", res->dev_name,camera_flash, ((camera_ioflag&RK29_CAM_FLASHACTIVE_MASK)>>RK29_CAM_FLASHACTIVE_BITPOS));\r
+                           dprintk("%s FlashPin=%d ..PinLevel = %x", res->dev_name,camera_flash, ((camera_ioflag&RK29_CAM_FLASHACTIVE_MASK)>>RK29_CAM_FLASHACTIVE_BITPOS));\r
                            break;\r
                 }\r
 \r
                 default:\r
                 {\r
-                    eprintk("%s Flash command(%d) is invalidate \n", res->dev_name,on);\r
+                    eprintk("%s Flash command(%d) is invalidate", res->dev_name,on);\r
                     break;\r
                 }\r
             }\r
                } else {\r
                        ret = RK29_CAM_EIO_REQUESTFAIL;\r
-                       eprintk("%s FlashPin=%d request failed!\n", res->dev_name,camera_flash);\r
+                       eprintk("%s FlashPin=%d request failed!", res->dev_name,camera_flash);\r
                }\r
     } else {\r
                ret = RK29_CAM_EIO_INVALID;\r
@@ -1051,7 +1051,7 @@ static int _rk_sensor_io_init_(struct rk29camera_gpio_res *gpio_res)
 \r
         if (rk_camera_platform_data.iomux(camera_power) < 0) {\r
             ret = -1;\r
-            eprintk("%s power pin(%d) iomux init failed\n",gpio_res->dev_name,camera_power);\r
+            eprintk("%s power pin(%d) iomux init failed",gpio_res->dev_name,camera_power);\r
             goto _rk_sensor_io_init_end_;\r
         }\r
         \r
@@ -1059,7 +1059,7 @@ static int _rk_sensor_io_init_(struct rk29camera_gpio_res *gpio_res)
         gpio_set_value(camera_reset, (((~camera_ioflag)&RK29_CAM_POWERACTIVE_MASK)>>RK29_CAM_POWERACTIVE_BITPOS));\r
         gpio_direction_output(camera_power, (((~camera_ioflag)&RK29_CAM_POWERACTIVE_MASK)>>RK29_CAM_POWERACTIVE_BITPOS));\r
 \r
-               dprintk("%s power pin(%d) init success(0x%x)  \n" ,gpio_res->dev_name,camera_power,(((~camera_ioflag)&RK29_CAM_POWERACTIVE_MASK)>>RK29_CAM_POWERACTIVE_BITPOS));\r
+               dprintk("%s power pin(%d) init success(0x%x)" ,gpio_res->dev_name,camera_power,(((~camera_ioflag)&RK29_CAM_POWERACTIVE_MASK)>>RK29_CAM_POWERACTIVE_BITPOS));\r
 \r
     }\r
 \r
@@ -1088,7 +1088,7 @@ static int _rk_sensor_io_init_(struct rk29camera_gpio_res *gpio_res)
             }\r
             \r
             if (io_requested_in_camera==false) {\r
-                eprintk("%s reset pin(%d) init failed\n" ,gpio_res->dev_name,camera_reset);\r
+                eprintk("%s reset pin(%d) init failed" ,gpio_res->dev_name,camera_reset);\r
                 goto _rk_sensor_io_init_end_;\r
             } else {\r
                 ret =0;\r
@@ -1097,7 +1097,7 @@ static int _rk_sensor_io_init_(struct rk29camera_gpio_res *gpio_res)
 \r
         if (rk_camera_platform_data.iomux(camera_reset) < 0) {\r
             ret = -1;\r
-            eprintk("%s reset pin(%d) iomux init failed\n", gpio_res->dev_name,camera_reset);\r
+            eprintk("%s reset pin(%d) iomux init failed", gpio_res->dev_name,camera_reset);\r
             goto _rk_sensor_io_init_end_;\r
         }\r
         \r
@@ -1105,7 +1105,7 @@ static int _rk_sensor_io_init_(struct rk29camera_gpio_res *gpio_res)
         gpio_set_value(camera_reset, ((camera_ioflag&RK29_CAM_RESETACTIVE_MASK)>>RK29_CAM_RESETACTIVE_BITPOS));\r
         gpio_direction_output(camera_reset, ((camera_ioflag&RK29_CAM_RESETACTIVE_MASK)>>RK29_CAM_RESETACTIVE_BITPOS));\r
 \r
-               dprintk("%s reset pin(%d) init success(0x%x)\n" ,gpio_res->dev_name,camera_reset,((camera_ioflag&RK29_CAM_RESETACTIVE_MASK)>>RK29_CAM_RESETACTIVE_BITPOS));\r
+               dprintk("%s reset pin(%d) init success(0x%x)" ,gpio_res->dev_name,camera_reset,((camera_ioflag&RK29_CAM_RESETACTIVE_MASK)>>RK29_CAM_RESETACTIVE_BITPOS));\r
 \r
     }\r
 \r
@@ -1134,7 +1134,7 @@ static int _rk_sensor_io_init_(struct rk29camera_gpio_res *gpio_res)
             }\r
             \r
             if (io_requested_in_camera==false) {\r
-                eprintk("%s powerdown pin(%d) init failed\n",gpio_res->dev_name,camera_powerdown);\r
+                eprintk("%s powerdown pin(%d) init failed",gpio_res->dev_name,camera_powerdown);\r
                 goto _rk_sensor_io_init_end_;\r
             } else {\r
                 ret =0;\r
@@ -1143,7 +1143,7 @@ static int _rk_sensor_io_init_(struct rk29camera_gpio_res *gpio_res)
 \r
         if (rk_camera_platform_data.iomux(camera_powerdown) < 0) {\r
             ret = -1;\r
-            eprintk("%s powerdown pin(%d) iomux init failed\n",gpio_res->dev_name,camera_powerdown);\r
+            eprintk("%s powerdown pin(%d) iomux init failed",gpio_res->dev_name,camera_powerdown);\r
             goto _rk_sensor_io_init_end_;\r
         }\r
         \r
@@ -1151,7 +1151,7 @@ static int _rk_sensor_io_init_(struct rk29camera_gpio_res *gpio_res)
         gpio_set_value(camera_powerdown, ((camera_ioflag&RK29_CAM_POWERDNACTIVE_MASK)>>RK29_CAM_POWERDNACTIVE_BITPOS));\r
         gpio_direction_output(camera_powerdown, ((camera_ioflag&RK29_CAM_POWERDNACTIVE_MASK)>>RK29_CAM_POWERDNACTIVE_BITPOS));\r
 \r
-               dprintk("%s powerdown pin(%d) init success(0x%x) \n" ,gpio_res->dev_name,camera_powerdown,((camera_ioflag&RK29_CAM_POWERDNACTIVE_BITPOS)>>RK29_CAM_POWERDNACTIVE_BITPOS));\r
+               dprintk("%s powerdown pin(%d) init success(0x%x)" ,gpio_res->dev_name,camera_powerdown,((camera_ioflag&RK29_CAM_POWERDNACTIVE_BITPOS)>>RK29_CAM_POWERDNACTIVE_BITPOS));\r
 \r
     }\r
 \r
@@ -1181,7 +1181,7 @@ static int _rk_sensor_io_init_(struct rk29camera_gpio_res *gpio_res)
             \r
             ret = 0;        //ddl@rock-chips.com : flash is only a function, sensor is also run;\r
             if (io_requested_in_camera==false) {\r
-                eprintk("%s flash pin(%d) init failed\n",gpio_res->dev_name,camera_flash);\r
+                eprintk("%s flash pin(%d) init failed",gpio_res->dev_name,camera_flash);\r
                 goto _rk_sensor_io_init_end_;\r
             }\r
         }\r
@@ -1194,7 +1194,7 @@ static int _rk_sensor_io_init_(struct rk29camera_gpio_res *gpio_res)
         gpio_set_value(camera_flash, ((~camera_ioflag&RK29_CAM_FLASHACTIVE_MASK)>>RK29_CAM_FLASHACTIVE_BITPOS));    /* falsh off */\r
         gpio_direction_output(camera_flash, ((~camera_ioflag&RK29_CAM_FLASHACTIVE_MASK)>>RK29_CAM_FLASHACTIVE_BITPOS));\r
 \r
-               dprintk("%s flash pin(%d) init success(0x%x) \n",gpio_res->dev_name, camera_flash,((camera_ioflag&RK29_CAM_FLASHACTIVE_MASK)>>RK29_CAM_FLASHACTIVE_BITPOS));\r
+               dprintk("%s flash pin(%d) init success(0x%x)",gpio_res->dev_name, camera_flash,((camera_ioflag&RK29_CAM_FLASHACTIVE_MASK)>>RK29_CAM_FLASHACTIVE_BITPOS));\r
 \r
     }  \r
 _rk_sensor_io_init_end_:\r
@@ -1377,7 +1377,7 @@ static int rk_sensor_ioctrl(struct device *dev,enum rk29camera_ioctrl_cmd cmd, i
     }\r
     \r
     if (res == NULL) {\r
-        eprintk("%s is not regisiterd in rk29_camera_platform_data!!\n",dev_name(dev));\r
+        eprintk("%s is not regisiterd in rk29_camera_platform_data!!",dev_name(dev));\r
         ret = RK29_CAM_EIO_INVALID;\r
         goto rk_sensor_ioctrl_end;\r
     }\r
@@ -1434,7 +1434,7 @@ static int rk_sensor_ioctrl(struct device *dev,enum rk29camera_ioctrl_cmd cmd, i
             if (plat_data->sensor_mclk && dev_icl) {\r
                 plat_data->sensor_mclk(dev_icl->bus_id,(on!=0)?1:0,on);\r
             } else { \r
-                eprintk( "%s(%d): sensor_mclk(%p) or dev_icl(%p) is NULL\n",\r
+                eprintk( "%s(%d): sensor_mclk(%p) or dev_icl(%p) is NULL",\r
                     __FUNCTION__,__LINE__,plat_data->sensor_mclk,dev_icl);\r
             }\r
             break;\r
@@ -1442,7 +1442,7 @@ static int rk_sensor_ioctrl(struct device *dev,enum rk29camera_ioctrl_cmd cmd, i
         \r
                default:\r
                {\r
-                       eprintk("%s cmd(0x%x) is unknown!\n",__FUNCTION__, cmd);\r
+                       eprintk("%s cmd(0x%x) is unknown!",__FUNCTION__, cmd);\r
                        break;\r
                }\r
        }\r
@@ -1471,10 +1471,10 @@ static int rk_sensor_pwrseq(struct device *dev,int powerup_sequence, int on, int
             {  \r
                 ret = rk_sensor_ioctrl(dev,Cam_Power, on);\r
                 if (ret<0) {\r
-                    eprintk("SENSOR_PWRSEQ_PWR failed\n");\r
+                    eprintk("SENSOR_PWRSEQ_PWR failed");\r
                 } else { \r
                     msleep(10);\r
-                    dprintk("SensorPwrSeq-power: %d\n",on);\r
+                    dprintk("SensorPwrSeq-power: %d",on);\r
                 }\r
                 break;\r
             }\r
@@ -1485,9 +1485,9 @@ static int rk_sensor_pwrseq(struct device *dev,int powerup_sequence, int on, int
                 msleep(2);\r
                 ret |= rk_sensor_ioctrl(dev,Cam_Reset, 0); \r
                 if (ret<0) {\r
-                    eprintk("SENSOR_PWRSEQ_HWRST failed\n");\r
+                    eprintk("SENSOR_PWRSEQ_HWRST failed");\r
                 } else {\r
-                    dprintk("SensorPwrSeq-reset: %d\n",on);\r
+                    dprintk("SensorPwrSeq-reset: %d",on);\r
                 }\r
                 break;\r
             }\r
@@ -1496,9 +1496,9 @@ static int rk_sensor_pwrseq(struct device *dev,int powerup_sequence, int on, int
             {     \r
                 ret = rk_sensor_ioctrl(dev,Cam_PowerDown, !on);\r
                 if (ret<0) {\r
-                    eprintk("SENSOR_PWRSEQ_PWRDN failed\n");\r
+                    eprintk("SENSOR_PWRSEQ_PWRDN failed");\r
                 } else {\r
-                    dprintk("SensorPwrSeq-power down: %d \n",!on);\r
+                    dprintk("SensorPwrSeq-power down: %d",!on);\r
                 }\r
                 break;\r
             }\r
@@ -1507,9 +1507,9 @@ static int rk_sensor_pwrseq(struct device *dev,int powerup_sequence, int on, int
             {\r
                 ret = rk_sensor_ioctrl(dev,Cam_Mclk, (on?mclk_rate:on));\r
                 if (ret<0) {\r
-                    eprintk("SENSOR_PWRSEQ_CLKIN failed\n");\r
+                    eprintk("SENSOR_PWRSEQ_CLKIN failed");\r
                 } else {\r
-                    dprintk("SensorPwrSeq-clock: %d\n",on);\r
+                    dprintk("SensorPwrSeq-clock: %d",on);\r
                 }\r
                 break;\r
             }\r
@@ -1700,7 +1700,7 @@ int camera_set_platform_param(int id, int i2c, int gpio)
 int rk_sensor_register(void)\r
 {\r
     int i;\r
-\r
+    \r
     i = 0;\r
     while (strstr(new_camera[i].dev.device_info.dev.init_name,"end")==NULL) {\r
 \r
index 832e561541c46308bc08a4a580ded7485a909ed0..a8640fbebf3e8fce6398f9048fb720e6d5831546 100755 (executable)
 *        add WqCmd_af_continues_pause;\r
 *v0.1.3:\r
 *        add support flash control;\r
+*\r
+*v0.1.5:\r
+*        fix use v4l2_mbus_framefmt.reserved array overflow in generic_sensor_s_fmt;        \r
 */\r
-static int version = KERNEL_VERSION(0,1,3);\r
+static int version = KERNEL_VERSION(0,1,5);\r
 module_param(version, int, S_IRUGO);\r
 \r
 \r
@@ -156,7 +159,7 @@ write_end:
 /* sensor register write buffer */\r
 int generic_sensor_writebuf(struct i2c_client *client, char *buf, int buf_size)\r
 {\r
-       int err=0,cnt = 0,i;\r
+       int err=0,cnt = 0;\r
        struct i2c_msg msg[1];\r
     struct generic_sensor *sensor = to_generic_sensor(client);\r
             \r
@@ -852,7 +855,7 @@ int generic_sensor_s_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *mf)
     struct generic_sensor *sensor = to_generic_sensor(client);\r
     struct rk_sensor_sequence *winseqe_set_addr=NULL;\r
     struct sensor_v4l2ctrl_info_s *v4l2ctrl_info;\r
-    bool is_capture=(mf->reserved[7]==0xfefe5a5a)?true:false;\r
+    bool is_capture=(mf->reserved[6]==0xfefe5a5a)?true:false;    /* ddl@rock-chips.com : v0.1.5 */ \r
     int ret=0;\r
 \r
     fmt =generic_sensor_find_datafmt(mf->code, sensor->info_priv.datafmt,\r
index e4277e9e83a2a3df5f25baf5eb0b16250f2d5e87..31526d072a9c52d51b7c0fdce9acc047ca5a9c66 100755 (executable)
@@ -493,8 +493,7 @@ static inline int sensor_v4l2ctrl_default_cb(struct soc_camera_device *icd, stru
 static inline int sensor_v4l2ctrl_flash_cb(struct soc_camera_device *icd, struct sensor_v4l2ctrl_info_s *ctrl_info, \r
                                                      struct v4l2_ext_control *ext_ctrl)\r
 {\r
-    struct i2c_client *client = to_i2c_client(to_soc_camera_control(icd));   \r
-    struct generic_sensor *sensor = to_generic_sensor(client);\r
+    struct i2c_client *client = to_i2c_client(to_soc_camera_control(icd));\r
     int value = ext_ctrl->value;\r
 \r
     if ((value < ctrl_info->qctrl->minimum) || (value > ctrl_info->qctrl->maximum)) {\r
index 99f276cfa5e3c45c3de11ca07fc36c03103c0172..cd1ac2be2fca31207c0ff2e2dbe37dc427e5aa09 100755 (executable)
@@ -296,9 +296,12 @@ module_param(debug, int, S_IRUGO|S_IWUSR);
 *
 *v0.3.1 :
 *         1. compatible with generic_sensor;
-
+*
+*v0.3.3 :
+*         1. fix use v4l2_mbus_framefmt.reserved array overflow in generic_sensor_s_fmt;        
 */
-#define RK_CAM_VERSION_CODE KERNEL_VERSION(0, 3, 0x01)
+
+#define RK_CAM_VERSION_CODE KERNEL_VERSION(0, 3, 0x03)
 static int version = RK_CAM_VERSION_CODE;
 module_param(version, int, S_IRUGO);
 
@@ -650,9 +653,10 @@ fail:
 out:
     return ret;
 }
+#if defined(CONFIG_ARCH_RK3188)
 static void rk_camera_store_register(struct rk_camera_dev *pcdev)
 {
-#if defined(CONFIG_ARCH_RK3188)
+
        pcdev->reginfo_suspend.cifCtrl = read_cif_reg(pcdev->base,CIF_CIF_CTRL);
        pcdev->reginfo_suspend.cifCrop = read_cif_reg(pcdev->base,CIF_CIF_CROP);
        pcdev->reginfo_suspend.cifFs = read_cif_reg(pcdev->base,CIF_CIF_SET_SIZE);
@@ -664,12 +668,9 @@ static void rk_camera_store_register(struct rk_camera_dev *pcdev)
        cru_set_soft_reset(SOFT_RST_CIF0, true);
        udelay(5);
        cru_set_soft_reset(SOFT_RST_CIF0, false);
-       
-#endif
 }
 static void rk_camera_restore_register(struct rk_camera_dev *pcdev)
 {
-#if defined(CONFIG_ARCH_RK3188)
     if (pcdev->reginfo_suspend.cifCtrl&ENABLE_CAPTURE)
         write_cif_reg(pcdev->base,CIF_CIF_CTRL, pcdev->reginfo_suspend.cifCtrl&~ENABLE_CAPTURE);
        write_cif_reg(pcdev->base,CIF_CIF_INTEN, pcdev->reginfo_suspend.cifIntEn);
@@ -680,8 +681,10 @@ static void rk_camera_restore_register(struct rk_camera_dev *pcdev)
        write_cif_reg(pcdev->base,CIF_CIF_SCL_CTRL, pcdev->reginfo_suspend.cifScale);
     if (pcdev->reginfo_suspend.cifCtrl&ENABLE_CAPTURE)
         write_cif_reg(pcdev->base,CIF_CIF_CTRL, pcdev->reginfo_suspend.cifCtrl);
-#endif
+
+
 }
+#endif
 static inline void rk_videobuf_capture(struct videobuf_buffer *vb,struct rk_camera_dev *rk_pcdev)
 {
        unsigned int y_addr,uv_addr;
@@ -788,7 +791,7 @@ static int rk_pixfmt2ippfmt(unsigned int pixfmt, int *ippfmt)
 rk_pixfmt2ippfmt_err:
        return -1;
 }
-
+#if (CONFIG_CAMERA_SCALE_CROP_MACHINE == RK_CAM_SCALE_CROP_RGA)
 static int rk_pixfmt2rgafmt(unsigned int pixfmt, int *ippfmt)
 {
        switch (pixfmt)
@@ -825,6 +828,7 @@ static int rk_pixfmt2rgafmt(unsigned int pixfmt, int *ippfmt)
 rk_pixfmt2rgafmt_err:
        return -1;
 }
+#endif
 #if (CONFIG_CAMERA_SCALE_CROP_MACHINE == RK_CAM_SCALE_CROP_PP)
 static int rk_camera_scale_crop_pp(struct work_struct *work){
        struct rk_camera_work *camera_work = container_of(work, struct rk_camera_work, work);
@@ -1055,8 +1059,6 @@ static int rk_camera_scale_crop_ipp(struct work_struct *work)
     if (scale_crop_ret == 0x01) {
         ret = rk_camera_scale_crop_arm(work);
     }
-    
-do_ipp_err:
 
     if (ret) {
         spin_lock_irqsave(&pcdev->lock, flags);
@@ -1185,8 +1187,7 @@ static int rk_camera_scale_crop_arm(struct work_struct *work)
         }
         pdUV += dstW*2;
     }
-rk_camera_scale_crop_arm_end:
-
+    
     dmac_flush_range((void*)src,(void*)(src+pcdev->vipmem_bsize));
     outer_flush_range((phys_addr_t)src_phy,(phys_addr_t)(src_phy+pcdev->vipmem_bsize));
     
@@ -1447,9 +1448,6 @@ rk_camera_clk_ctrl_end:
 
 static int rk_camera_activate(struct rk_camera_dev *pcdev, struct soc_camera_device *icd)
 {
-    int err = 0;
-    struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent);    
-
     /*
     * ddl@rock-chips.com : Cif clk control in rk_sensor_power which in rk_camera.c
     */
@@ -1494,8 +1492,6 @@ static int rk_camera_activate(struct rk_camera_dev *pcdev, struct soc_camera_dev
     write_cif_reg(pcdev->base,CIF_CIF_INTEN, 0x01);    //capture complete interrupt enable
     RKCAMERA_DG("CIF_CIF_CTRL = 0x%x\n",read_cif_reg(pcdev->base, CIF_CIF_CTRL));
     return 0;
-RK_CAMERA_ACTIVE_ERR:
-    return -ENODEV;
 }
 
 static void rk_camera_deactivate(struct rk_camera_dev *pcdev)
@@ -2121,7 +2117,7 @@ static int rk_camera_set_fmt(struct soc_camera_device *icd,
        mf.field        = pix->field;
        mf.colorspace   = pix->colorspace;
        mf.code         = xlate->code;
-    mf.reserved[7] = pix->priv;
+    mf.reserved[6] = pix->priv;              /* ddl@rock-chips.com : v0.3.3 */      
        ret = v4l2_subdev_call(sd, video, s_mbus_fmt, &mf);
        if (mf.code != xlate->code)
                return -EINVAL;
@@ -3307,7 +3303,7 @@ static int __devexit rk_camera_remove(struct platform_device *pdev)
         if (meminfo_ptr->vbase == meminfo_ptrr->vbase) {
             meminfo_ptr->vbase = NULL;
         } else {
-            iounmap((void __iomem*)pcdev->vipmem_phybase);
+            iounmap((void __iomem*)pcdev->vipmem_virbase);
             release_mem_region(pcdev->vipmem_phybase, pcdev->vipmem_size);
             meminfo_ptr->vbase = NULL;
         }