\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
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
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
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
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
\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
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
}\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
\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
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
}\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
\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
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
\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
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
}\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
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
\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
{ \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
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
{ \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
{\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
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
*
*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);
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);
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);
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;
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)
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);
if (scale_crop_ret == 0x01) {
ret = rk_camera_scale_crop_arm(work);
}
-
-do_ipp_err:
if (ret) {
spin_lock_irqsave(&pcdev->lock, flags);
}
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));
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
*/
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)
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;
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;
}