From 7fcc580079b64564a8fc6030110ec785c8b31bc7 Mon Sep 17 00:00:00 2001 From: ddl Date: Thu, 20 Jan 2011 22:35:58 +0800 Subject: [PATCH] camera: fix vip and sensor(ov2655,ov2659,ov5642) driver debug message --- drivers/media/video/ov2655.c | 39 ++++++++-------- drivers/media/video/ov2659.c | 39 ++++++++-------- drivers/media/video/ov5642.c | 39 ++++++++-------- drivers/media/video/rk29_camera_oneframe.c | 52 ++++++++++------------ 4 files changed, 77 insertions(+), 92 deletions(-) diff --git a/drivers/media/video/ov2655.c b/drivers/media/video/ov2655.c index bf7233e73ec2..81151bfc0e5d 100755 --- a/drivers/media/video/ov2655.c +++ b/drivers/media/video/ov2655.c @@ -21,6 +21,17 @@ o* Driver for MT9M001 CMOS Image Sensor from Micron #include #include +static int debug; +module_param(debug, int, S_IRUGO|S_IWUSR); + +#define dprintk(level, fmt, arg...) do { \ + if (debug >= level) \ + printk(KERN_DEBUG fmt , ## arg); } while (0) + +#define SENSOR_TR(format, ...) printk(KERN_ERR format, ## __VA_ARGS__) +#define SENSOR_DG(format, ...) dprintk(1, format, ## __VA_ARGS__) + + #define _CONS(a,b) a##b #define CONS(a,b) _CONS(a,b) @@ -28,6 +39,9 @@ o* Driver for MT9M001 CMOS Image Sensor from Micron #define _STR(x) __STR(x) #define STR(x) _STR(x) +#define MIN(x,y) ((xy) ? x: y) + /* Sensor Driver Configuration */ #define SENSOR_NAME ov2655 #define SENSOR_V4L2_IDENT V4L2_IDENT_OV2655 @@ -59,26 +73,6 @@ o* Driver for MT9M001 CMOS Image Sensor from Micron #define CONFIG_SENSOR_I2C_NOSCHED 1 #define CONFIG_SENSOR_I2C_RDWRCHK 1 -#define CONFIG_SENSOR_TR 1 -#define CONFIG_SENSOR_DEBUG 1 - -#define SENSOR_NAME_STRING(a) STR(CONS(SENSOR_NAME, a)) -#define SENSOR_NAME_VARFUN(a) CONS(SENSOR_NAME, a) - -#define MIN(x,y) ((xy) ? x: y) - -#if (CONFIG_SENSOR_TR) - #define SENSOR_TR(format, ...) printk(format, ## __VA_ARGS__) - #if (CONFIG_SENSOR_DEBUG) - #define SENSOR_DG(format, ...) printk(format, ## __VA_ARGS__) - #else - #define SENSOR_DG(format, ...) - #endif -#else - #define SENSOR_TR(format, ...) -#endif - #define SENSOR_BUS_PARAM (SOCAM_MASTER | SOCAM_PCLK_SAMPLE_RISING |\ SOCAM_HSYNC_ACTIVE_HIGH | SOCAM_VSYNC_ACTIVE_LOW |\ SOCAM_DATA_ACTIVE_HIGH | SOCAM_DATAWIDTH_8 |SOCAM_MCLK_24MHZ) @@ -92,6 +86,9 @@ o* Driver for MT9M001 CMOS Image Sensor from Micron #define COLOR_TEMPERATURE_HOME_DN 2500 #define COLOR_TEMPERATURE_HOME_UP 3500 +#define SENSOR_NAME_STRING(a) STR(CONS(SENSOR_NAME, a)) +#define SENSOR_NAME_VARFUN(a) CONS(SENSOR_NAME, a) + struct reginfo { u16 reg; @@ -1963,7 +1960,7 @@ static int sensor_s_fmt(struct v4l2_subdev *sd, struct v4l2_format *f) } else { - SENSOR_TR("\n %s .. Current Format is validate. icd->width = %d.. icd->height %d\n",SENSOR_NAME_STRING(),set_w,set_h); + SENSOR_DG("\n %s .. Current Format is validate. icd->width = %d.. icd->height %d\n",SENSOR_NAME_STRING(),set_w,set_h); } pix->width = set_w; diff --git a/drivers/media/video/ov2659.c b/drivers/media/video/ov2659.c index 8ae03252e605..e44a5d9939a3 100755 --- a/drivers/media/video/ov2659.c +++ b/drivers/media/video/ov2659.c @@ -21,6 +21,17 @@ o* Driver for MT9M001 CMOS Image Sensor from Micron #include #include +static int debug; +module_param(debug, int, S_IRUGO|S_IWUSR); + +#define dprintk(level, fmt, arg...) do { \ + if (debug >= level) \ + printk(KERN_DEBUG fmt , ## arg); } while (0) + +#define SENSOR_TR(format, ...) printk(KERN_ERR format, ## __VA_ARGS__) +#define SENSOR_DG(format, ...) dprintk(1, format, ## __VA_ARGS__) + + #define _CONS(a,b) a##b #define CONS(a,b) _CONS(a,b) @@ -28,6 +39,9 @@ o* Driver for MT9M001 CMOS Image Sensor from Micron #define _STR(x) __STR(x) #define STR(x) _STR(x) +#define MIN(x,y) ((xy) ? x: y) + /* Sensor Driver Configuration */ #define SENSOR_NAME ov2659 #define SENSOR_V4L2_IDENT V4L2_IDENT_OV2659 @@ -59,26 +73,6 @@ o* Driver for MT9M001 CMOS Image Sensor from Micron #define CONFIG_SENSOR_I2C_NOSCHED 1 #define CONFIG_SENSOR_I2C_RDWRCHK 1 -#define CONFIG_SENSOR_TR 1 -#define CONFIG_SENSOR_DEBUG 1 - -#define SENSOR_NAME_STRING(a) STR(CONS(SENSOR_NAME, a)) -#define SENSOR_NAME_VARFUN(a) CONS(SENSOR_NAME, a) - -#define MIN(x,y) ((xy) ? x: y) - -#if (CONFIG_SENSOR_TR) - #define SENSOR_TR(format, ...) printk(format, ## __VA_ARGS__) - #if (CONFIG_SENSOR_DEBUG) - #define SENSOR_DG(format, ...) printk(format, ## __VA_ARGS__) - #else - #define SENSOR_DG(format, ...) - #endif -#else - #define SENSOR_TR(format, ...) -#endif - #define SENSOR_BUS_PARAM (SOCAM_MASTER | SOCAM_PCLK_SAMPLE_FALLING|\ SOCAM_HSYNC_ACTIVE_HIGH | SOCAM_VSYNC_ACTIVE_LOW |\ SOCAM_DATA_ACTIVE_HIGH | SOCAM_DATAWIDTH_8 |SOCAM_MCLK_24MHZ) @@ -92,6 +86,9 @@ o* Driver for MT9M001 CMOS Image Sensor from Micron #define COLOR_TEMPERATURE_HOME_DN 2500 #define COLOR_TEMPERATURE_HOME_UP 3500 +#define SENSOR_NAME_STRING(a) STR(CONS(SENSOR_NAME, a)) +#define SENSOR_NAME_VARFUN(a) CONS(SENSOR_NAME, a) + struct reginfo { u16 reg; @@ -1774,7 +1771,7 @@ static int sensor_s_fmt(struct v4l2_subdev *sd, struct v4l2_format *f) } else { - SENSOR_TR("\n %s .. Current Format is validate. icd->width = %d.. icd->height %d\n",SENSOR_NAME_STRING(),set_w,set_h); + SENSOR_DG("\n %s .. Current Format is validate. icd->width = %d.. icd->height %d\n",SENSOR_NAME_STRING(),set_w,set_h); } pix->width = set_w; diff --git a/drivers/media/video/ov5642.c b/drivers/media/video/ov5642.c index bda14735e6b0..07863248044e 100755 --- a/drivers/media/video/ov5642.c +++ b/drivers/media/video/ov5642.c @@ -22,6 +22,16 @@ #include #include "ov5642.h" +static int debug; +module_param(debug, int, S_IRUGO|S_IWUSR); + +#define dprintk(level, fmt, arg...) do { \ + if (debug >= level) \ + printk(KERN_DEBUG fmt , ## arg); } while (0) + +#define SENSOR_TR(format, ...) printk(KERN_ERR format, ## __VA_ARGS__) +#define SENSOR_DG(format, ...) dprintk(1, format, ## __VA_ARGS__) + #define _CONS(a,b) a##b #define CONS(a,b) _CONS(a,b) @@ -29,6 +39,9 @@ #define _STR(x) __STR(x) #define STR(x) _STR(x) +#define MIN(x,y) ((xy) ? x: y) + /* Sensor Driver Configuration */ #define SENSOR_NAME ov5642 #define SENSOR_V4L2_IDENT V4L2_IDENT_OV5642 @@ -65,25 +78,6 @@ #define CONFIG_SENSOR_I2C_NOSCHED 0 #define CONFIG_SENSOR_I2C_RDWRCHK 1 -#define CONFIG_SENSOR_TR 1 -#define CONFIG_SENSOR_DEBUG 1 - -#define SENSOR_NAME_STRING(a) STR(CONS(SENSOR_NAME, a)) -#define SENSOR_NAME_VARFUN(a) CONS(SENSOR_NAME, a) - -#define MIN(x,y) ((xy) ? x: y) - -#if (CONFIG_SENSOR_TR) - #define SENSOR_TR(format, ...) printk(format, ## __VA_ARGS__) - #if (CONFIG_SENSOR_DEBUG) - #define SENSOR_DG(format, ...) printk(format, ## __VA_ARGS__) - #else - #define SENSOR_DG(format, ...) - #endif -#else - #define SENSOR_TR(format, ...) -#endif #define SENSOR_BUS_PARAM (SOCAM_MASTER | SOCAM_PCLK_SAMPLE_RISING |\ SOCAM_HSYNC_ACTIVE_HIGH | SOCAM_VSYNC_ACTIVE_LOW |\ @@ -98,6 +92,9 @@ #define COLOR_TEMPERATURE_HOME_DN 2500 #define COLOR_TEMPERATURE_HOME_UP 3500 +#define SENSOR_NAME_STRING(a) STR(CONS(SENSOR_NAME, a)) +#define SENSOR_NAME_VARFUN(a) CONS(SENSOR_NAME, a) + #define SENSOR_AF_IS_ERR (0x00<<0) #define SENSOR_AF_IS_OK (0x01<<0) @@ -3368,7 +3365,7 @@ static int sensor_af_cmdset(struct i2c_client *client, int cmd_main, struct af_c SENSOR_TR("%s write CMD_PARA_Reg(main:0x%x para%d:0x%x) error!\n",SENSOR_NAME_STRING(),cmd_main,i,cmdinfo->cmd_para[i]); goto sensor_af_cmdset_err; } - SENSOR_TR("%s write CMD_PARA_Reg(main:0x%x para%d:0x%x) success!\n",SENSOR_NAME_STRING(),cmd_main,i,cmdinfo->cmd_para[i]); + SENSOR_DG("%s write CMD_PARA_Reg(main:0x%x para%d:0x%x) success!\n",SENSOR_NAME_STRING(),cmd_main,i,cmdinfo->cmd_para[i]); } } } else { @@ -4194,7 +4191,7 @@ static int sensor_s_fmt(struct v4l2_subdev *sd, struct v4l2_format *f) } else { - SENSOR_TR("\n %s .. Current Format is validate. icd->width = %d.. icd->height %d\n",SENSOR_NAME_STRING(),set_w,set_h); + SENSOR_DG("\n %s .. Current Format is validate. icd->width = %d.. icd->height %d\n",SENSOR_NAME_STRING(),set_w,set_h); } pix->width = set_w; diff --git a/drivers/media/video/rk29_camera_oneframe.c b/drivers/media/video/rk29_camera_oneframe.c index 0d82be6aa659..f2c31cf808f0 100755 --- a/drivers/media/video/rk29_camera_oneframe.c +++ b/drivers/media/video/rk29_camera_oneframe.c @@ -29,18 +29,26 @@ #include #include #include - #include #include #include - #include #include #include #include - #include + +static int debug; +module_param(debug, int, S_IRUGO|S_IWUSR); + +#define dprintk(level, fmt, arg...) do { \ + if (debug >= level) \ + printk(KERN_DEBUG "rk29xx_camera: " fmt , ## arg); } while (0) + +#define RK29CAMERA_TR(format, ...) printk(KERN_ERR format, ## __VA_ARGS__) +#define RK29CAMERA_DG(format, ...) dprintk(1, format, ## __VA_ARGS__) + // VIP Reg Offset #define RK29_VIP_AHBR_CTRL 0x00 #define RK29_VIP_INT_MASK 0x04 @@ -118,20 +126,6 @@ #define mask_grf_reg(addr, msk, val) write_vip_reg(addr, (val)|((~(msk))&read_vip_reg(addr))) //Configure Macro -#define CONFIG_RK29CAMERA_TR 1 -#define CONFIG_RK29CAMERA_DEBUG 1 -#if (CONFIG_RK29CAMERA_TR) - #define RK29CAMERA_TR(format, ...) printk(format, ## __VA_ARGS__) - #if (CONFIG_RK29CAMERA_DEBUG) - #define RK29CAMERA_DG(format, ...) printk(format, ## __VA_ARGS__) - #else - #define RK29CAMERA_DG(format, ...) - #endif -#else - #define RK29CAMERA_TR(format, ...) - #define RK29CAMERA_DG(format, ...) -#endif - #define RK29_CAM_VERSION_CODE KERNEL_VERSION(0, 0, 1) /* limit to rk29 hardware capabilities */ @@ -280,7 +274,7 @@ static int rk29_videobuf_setup(struct videobuf_queue *vq, unsigned int *count, if ((pcdev->host_width != pcdev->icd->user_width) || (pcdev->host_height != pcdev->icd->user_height)) BUG_ON(pcdev->vipmem_bsize*(*count) > pcdev->vipmem_size); - RK29CAMERA_DG("\n%s..%d.. videobuf size:%d, vipmem_buf size:%d \n",__FUNCTION__,__LINE__, *size,pcdev->vipmem_bsize); + RK29CAMERA_DG("%s..%d.. videobuf size:%d, vipmem_buf size:%d \n",__FUNCTION__,__LINE__, *size,pcdev->vipmem_bsize); return 0; } @@ -596,7 +590,7 @@ static int rk29_camera_activate(struct rk29_camera_dev *pcdev, struct soc_camera unsigned long sensor_bus_flags = SOCAM_MCLK_24MHZ; struct clk *parent; - RK29CAMERA_DG("\n%s..%d.. \n",__FUNCTION__,__LINE__); + RK29CAMERA_DG("%s..%d.. \n",__FUNCTION__,__LINE__); if (!pcdev->aclk_ddr_lcdc || !pcdev->aclk_disp_matrix || !pcdev->hclk_cpu_display || !pcdev->vip_slave || !pcdev->vip || !pcdev->vip_input || !pcdev->vip_bus || IS_ERR(pcdev->aclk_ddr_lcdc) || IS_ERR(pcdev->aclk_disp_matrix) || IS_ERR(pcdev->hclk_cpu_display) || @@ -793,7 +787,7 @@ static int rk29_camera_set_bus_param(struct soc_camera_device *icd, __u32 pixfmt unsigned int vip_ctrl_val = 0; int ret = 0; - RK29CAMERA_DG("\n%s..%d..\n",__FUNCTION__,__LINE__); + RK29CAMERA_DG("%s..%d..\n",__FUNCTION__,__LINE__); bus_flags = RK29_CAM_BUS_PARAM; if (icd->ops->query_bus_param) @@ -838,7 +832,7 @@ static int rk29_camera_set_bus_param(struct soc_camera_device *icd, __u32 pixfmt //vip_ctrl_val |= ENABLE_CAPTURE; write_vip_reg(RK29_VIP_CTRL, vip_ctrl_val); - RK29CAMERA_DG("\n%s..ctrl:0x%x CtrReg=%x AXI_AHB:0x%x aclk_hclk:0x%x \n",__FUNCTION__,vip_ctrl_val,read_vip_reg(RK29_VIP_CTRL), + RK29CAMERA_DG("%s..ctrl:0x%x CtrReg=%x AXI_AHB:0x%x aclk_hclk:0x%x \n",__FUNCTION__,vip_ctrl_val,read_vip_reg(RK29_VIP_CTRL), read_grf_reg(GRF_SOC_CON0_Reg)&VIP_AHBMASTER, read_grf_reg(GRF_OS_REG0)&VIP_ACLK_DIV_HCLK_2); RK29_CAMERA_SET_BUS_PARAM_END: @@ -947,7 +941,7 @@ static void rk29_camera_setup_format(struct soc_camera_device *icd, __u32 host_p pcdev->host_width = rect->width; pcdev->host_height = rect->height; - RK29CAMERA_DG("\n%s.. crop:0x%x fs:0x%x ctrl:0x%x CtrlReg:0x%x\n",__FUNCTION__,vip_crop,vip_fs,vip_ctrl_val,read_vip_reg(RK29_VIP_CTRL)); + RK29CAMERA_DG("%s.. crop:0x%x fs:0x%x ctrl:0x%x CtrlReg:0x%x\n",__FUNCTION__,vip_crop,vip_fs,vip_ctrl_val,read_vip_reg(RK29_VIP_CTRL)); return; } @@ -1064,7 +1058,7 @@ static int rk29_camera_set_fmt(struct soc_camera_device *icd, usr_w = pix->width; usr_h = pix->height; - RK29CAMERA_DG("\n%s enter width:%d height:%d\n",__FUNCTION__,usr_w,usr_h); + RK29CAMERA_DG("%s enter width:%d height:%d\n",__FUNCTION__,usr_w,usr_h); xlate = soc_camera_xlate_by_fourcc(icd, pix->pixelformat); if (!xlate) { @@ -1093,7 +1087,7 @@ static int rk29_camera_set_fmt(struct soc_camera_device *icd, rect.width = cam_f.fmt.pix.width; rect.height = cam_f.fmt.pix.height; - RK29CAMERA_DG("\n%s..%s..%s icd width:%d host width:%d \n",__FUNCTION__,xlate->host_fmt->name, cam_fmt->name, + RK29CAMERA_DG("%s..%s..%s icd width:%d host width:%d \n",__FUNCTION__,xlate->host_fmt->name, cam_fmt->name, rect.width, pix->width); rk29_camera_setup_format(icd, pix->pixelformat, cam_fmt->fourcc, &rect); icd->buswidth = xlate->buswidth; @@ -1123,7 +1117,7 @@ static int rk29_camera_try_fmt(struct soc_camera_device *icd, usr_w = pix->width; usr_h = pix->height; - RK29CAMERA_DG("\n%s enter width:%d height:%d\n",__FUNCTION__,usr_w,usr_h); + RK29CAMERA_DG("%s enter width:%d height:%d\n",__FUNCTION__,usr_w,usr_h); xlate = soc_camera_xlate_by_fourcc(icd, pixfmt); if (!xlate) { @@ -1353,7 +1347,7 @@ static int rk29_camera_probe(struct platform_device *pdev) int irq; int err = 0; - RK29CAMERA_DG("\n%s..%s..%d \n",__FUNCTION__,__FILE__,__LINE__); + RK29CAMERA_DG("%s..%s..%d \n",__FUNCTION__,__FILE__,__LINE__); res = platform_get_resource(pdev, IORESOURCE_MEM, 0); irq = platform_get_irq(pdev, 0); if (!res || irq < 0) { @@ -1411,7 +1405,7 @@ static int rk29_camera_probe(struct platform_device *pdev) if (pcdev->pdata && (strcmp(pcdev->pdata->meminfo.name,"camera_ipp_mem")==0)) { pcdev->vipmem_phybase = pcdev->pdata->meminfo.start; pcdev->vipmem_size = pcdev->pdata->meminfo.size; - RK29CAMERA_TR("\n%s Memory(start:0x%x size:0x%x) for IPP obtain \n",__FUNCTION__, pcdev->pdata->meminfo.start,pcdev->pdata->meminfo.size); + RK29CAMERA_DG("\n%s Memory(start:0x%x size:0x%x) for IPP obtain \n",__FUNCTION__, pcdev->pdata->meminfo.start,pcdev->pdata->meminfo.size); } else { RK29CAMERA_TR("\n%s Memory for IPP have not obtain! IPP Function is fail\n",__FUNCTION__); pcdev->vipmem_phybase = 0; @@ -1466,7 +1460,7 @@ static int rk29_camera_probe(struct platform_device *pdev) hrtimer_init(&pcdev->fps_timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL); pcdev->fps_timer.function = rk29_camera_fps_func; - RK29CAMERA_DG("\n%s..%s..%d \n",__FUNCTION__,__FILE__,__LINE__); + RK29CAMERA_DG("%s..%s..%d \n",__FUNCTION__,__FILE__,__LINE__); return 0; exit_free_irq: @@ -1564,7 +1558,7 @@ static struct platform_driver rk29_camera_driver = static int __devinit rk29_camera_init(void) { - RK29CAMERA_DG("\n%s..%s..%d \n",__FUNCTION__,__FILE__,__LINE__); + RK29CAMERA_DG("%s..%s..%d \n",__FUNCTION__,__FILE__,__LINE__); return platform_driver_register(&rk29_camera_driver); } -- 2.34.1