diff options
Diffstat (limited to 'drivers/media')
-rw-r--r-- | drivers/media/video/mxc/capture/ov3640.c | 72 |
1 files changed, 14 insertions, 58 deletions
diff --git a/drivers/media/video/mxc/capture/ov3640.c b/drivers/media/video/mxc/capture/ov3640.c index 47f6e8f3e4a5..3ff269dda924 100644 --- a/drivers/media/video/mxc/capture/ov3640.c +++ b/drivers/media/video/mxc/capture/ov3640.c @@ -22,14 +22,6 @@ #include <media/v4l2-int-device.h> #include "mxc_v4l2_capture.h" -#define CAMERA_DBG - -#ifdef CAMERA_DBG - #define CAMERA_TRACE(x) (printk)x -#else - #define CAMERA_TRACE(x) -#endif - #define OV3640_VOLTAGE_ANALOG 2800000 #define OV3640_VOLTAGE_DIGITAL_CORE 1500000 #define OV3640_VOLTAGE_DIGITAL_IO 1800000 @@ -458,8 +450,6 @@ static int ov3640_init_mode(enum ov3640_frame_rate frame_rate, u8 RegVal = 0; int retval = 0; - CAMERA_TRACE(("CAMERA_DBG Entry: ov3640_init_mode\n")); - if (mode > ov3640_mode_MAX || mode < ov3640_mode_MIN) { pr_err("Wrong ov3640 mode detected!\n"); return -1; @@ -496,8 +486,6 @@ static int ov3640_init_mode(enum ov3640_frame_rate frame_rate, msleep(Delay_ms); } err: - CAMERA_TRACE(("CAMERA_DBG Exit: ov3640_init_mode\n")); - return retval; } @@ -505,7 +493,6 @@ err: static int ioctl_g_ifparm(struct v4l2_int_device *s, struct v4l2_ifparm *p) { - CAMERA_TRACE(("In ov3640:ioctl_g_ifparm\n")); if (s == NULL) { pr_err(" ERROR!! no slave device set!\n"); return -1; @@ -535,8 +522,6 @@ static int ioctl_s_power(struct v4l2_int_device *s, int on) { struct sensor *sensor = s->priv; - CAMERA_TRACE(("In ov3640:ioctl_s_power\n")); - if (on && !sensor->on) { gpio_sensor_active(ov3640_data.csi); if (io_regulator) @@ -581,11 +566,9 @@ static int ioctl_g_parm(struct v4l2_int_device *s, struct v4l2_streamparm *a) struct v4l2_captureparm *cparm = &a->parm.capture; int ret = 0; - CAMERA_TRACE(("In ov3640:ioctl_g_parm\n")); switch (a->type) { /* This is the only case currently handled. */ case V4L2_BUF_TYPE_VIDEO_CAPTURE: - CAMERA_TRACE((" type is V4L2_BUF_TYPE_VIDEO_CAPTURE\n")); memset(a, 0, sizeof(*a)); a->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; cparm->capability = sensor->streamcap.capability; @@ -601,9 +584,6 @@ static int ioctl_g_parm(struct v4l2_int_device *s, struct v4l2_streamparm *a) case V4L2_BUF_TYPE_VBI_OUTPUT: case V4L2_BUF_TYPE_SLICED_VBI_CAPTURE: case V4L2_BUF_TYPE_SLICED_VBI_OUTPUT: - CAMERA_TRACE((" type is not " \ - "V4L2_BUF_TYPE_VIDEO_CAPTURE but %d\n", - a->type)); ret = -EINVAL; break; @@ -633,12 +613,9 @@ static int ioctl_s_parm(struct v4l2_int_device *s, struct v4l2_streamparm *a) enum ov3640_frame_rate frame_rate; int ret = 0; - CAMERA_TRACE(("In ov3640:ioctl_s_parm\n")); switch (a->type) { /* This is the only case currently handled. */ case V4L2_BUF_TYPE_VIDEO_CAPTURE: - CAMERA_TRACE((" type is V4L2_BUF_TYPE_VIDEO_CAPTURE\n")); - /* Check that the new frame rate is allowed. */ if ((timeperframe->numerator == 0) || (timeperframe->denominator == 0)) { @@ -712,8 +689,6 @@ static int ioctl_g_fmt_cap(struct v4l2_int_device *s, struct v4l2_format *f) { struct sensor *sensor = s->priv; - CAMERA_TRACE(("In ov3640:ioctl_g_fmt_cap.\n")); - f->fmt.pix = sensor->pix; return 0; @@ -732,7 +707,6 @@ static int ioctl_g_ctrl(struct v4l2_int_device *s, struct v4l2_control *vc) { int ret = 0; - CAMERA_TRACE(("In ov3640:ioctl_g_ctrl\n")); switch (vc->id) { case V4L2_CID_BRIGHTNESS: vc->value = ov3640_data.brightness; @@ -780,49 +754,34 @@ static int ioctl_s_ctrl(struct v4l2_int_device *s, struct v4l2_control *vc) switch (vc->id) { case V4L2_CID_BRIGHTNESS: - CAMERA_TRACE((" V4L2_CID_BRIGHTNESS\n")); break; case V4L2_CID_CONTRAST: - CAMERA_TRACE((" V4L2_CID_CONTRAST\n")); break; case V4L2_CID_SATURATION: - CAMERA_TRACE((" V4L2_CID_SATURATION\n")); break; case V4L2_CID_HUE: - CAMERA_TRACE((" V4L2_CID_HUE\n")); break; case V4L2_CID_AUTO_WHITE_BALANCE: - CAMERA_TRACE((" V4L2_CID_AUTO_WHITE_BALANCE\n")); break; case V4L2_CID_DO_WHITE_BALANCE: - CAMERA_TRACE((" V4L2_CID_DO_WHITE_BALANCE\n")); break; case V4L2_CID_RED_BALANCE: - CAMERA_TRACE((" V4L2_CID_RED_BALANCE\n")); break; case V4L2_CID_BLUE_BALANCE: - CAMERA_TRACE((" V4L2_CID_BLUE_BALANCE\n")); break; case V4L2_CID_GAMMA: - CAMERA_TRACE((" V4L2_CID_GAMMA\n")); break; case V4L2_CID_EXPOSURE: - CAMERA_TRACE((" V4L2_CID_EXPOSURE\n")); break; case V4L2_CID_AUTOGAIN: - CAMERA_TRACE((" V4L2_CID_AUTOGAIN\n")); break; case V4L2_CID_GAIN: - CAMERA_TRACE((" V4L2_CID_GAIN\n")); break; case V4L2_CID_HFLIP: - CAMERA_TRACE((" V4L2_CID_HFLIP\n")); break; case V4L2_CID_VFLIP: - CAMERA_TRACE((" V4L2_CID_VFLIP\n")); break; default: - CAMERA_TRACE((" Default case\n")); retval = -EPERM; break; } @@ -836,7 +795,6 @@ static int ioctl_s_ctrl(struct v4l2_int_device *s, struct v4l2_control *vc) */ static int ioctl_init(struct v4l2_int_device *s) { - CAMERA_TRACE(("In ov3640:ioctl_init\n")); return 0; } @@ -854,8 +812,6 @@ static int ioctl_dev_init(struct v4l2_int_device *s) u32 tgt_fps; /* target frames per secound */ enum ov3640_frame_rate frame_rate; - CAMERA_TRACE(("In ov3640:ioctl_dev_init\n")); - gpio_sensor_active(ov3640_data.csi); ov3640_data.on = true; @@ -884,12 +840,25 @@ static int ioctl_dev_init(struct v4l2_int_device *s) } /*! + * ioctl_dev_exit - V4L2 sensor interface handler for vidioc_int_dev_exit_num + * @s: pointer to standard V4L2 device structure + * + * Delinitialise the device when slave detaches to the master. + */ +static int ioctl_dev_exit(struct v4l2_int_device *s) +{ + gpio_sensor_inactive(ov3640_data.csi); + + return 0; +} + +/*! * This structure defines all the ioctls for this module and links them to the * enumeration. */ static struct v4l2_int_ioctl_desc ov3640_ioctl_desc[] = { {vidioc_int_dev_init_num, (v4l2_int_ioctl_func *)ioctl_dev_init}, -/* {vidioc_int_dev_exit_num, (v4l2_int_ioctl_func *)ioctl_dev_exit}, */ + {vidioc_int_dev_exit_num, ioctl_dev_exit}, {vidioc_int_s_power_num, (v4l2_int_ioctl_func *)ioctl_s_power}, {vidioc_int_g_ifparm_num, (v4l2_int_ioctl_func *)ioctl_g_ifparm}, /* {vidioc_int_g_needs_reset_num, @@ -935,8 +904,6 @@ static int ov3640_probe(struct i2c_client *client, int retval; struct mxc_camera_platform_data *plat_data = client->dev.platform_data; - CAMERA_TRACE(("CAMERA_DBG Entry: ov3640_probe\n")); - /* Set initial values for the sensor struct. */ memset(&ov3640_data, 0, sizeof(ov3640_data)); ov3640_data.mclk = 24000000; /* 6 - 54 MHz, typical 24MHz */ @@ -1055,8 +1022,6 @@ err1: */ static int ov3640_remove(struct i2c_client *client) { - CAMERA_TRACE(("In ov3640_remove\n")); - v4l2_int_device_unregister(&ov3640_int_device); if (gpo_regulator) { @@ -1092,15 +1057,11 @@ static __init int ov3640_init(void) { u8 err; - CAMERA_TRACE(("CAMERA_DBG Entry: ov3640_init\n")); - err = i2c_add_driver(&ov3640_i2c_driver); if (err != 0) pr_err("%s:driver registration failed, error=%d \n", __func__, err); - CAMERA_TRACE(("CAMERA_DBG Exit: ov3640_init\n")); - return err; } @@ -1112,12 +1073,7 @@ static __init int ov3640_init(void) */ static void __exit ov3640_clean(void) { - CAMERA_TRACE(("CAMERA_DBG Entry: ov3640_clean\n")); - i2c_del_driver(&ov3640_i2c_driver); - gpio_sensor_inactive(ov3640_data.csi); - - CAMERA_TRACE(("CAMERA_DBG Exit: ov3640_clean\n")); } module_init(ov3640_init); |