From 2eafa12c1c7a489f8ea0ece0e3371ebaaf38ffde Mon Sep 17 00:00:00 2001 From: Alejandro Gonzalez Date: Thu, 4 Nov 2010 12:32:12 +0100 Subject: Implement VIDIOC_INT_INIT It's used by some applications to set reasonable default values to the sensor. Signed-off-by: Alejandro Gonzalez --- drivers/media/video/mxc/capture/mt9v111.c | 34 +++++++++++++++++++------------ 1 file changed, 21 insertions(+), 13 deletions(-) (limited to 'drivers/media') diff --git a/drivers/media/video/mxc/capture/mt9v111.c b/drivers/media/video/mxc/capture/mt9v111.c index 567261c7c838..3ffcdf64bd01 100644 --- a/drivers/media/video/mxc/capture/mt9v111.c +++ b/drivers/media/video/mxc/capture/mt9v111.c @@ -1112,19 +1112,6 @@ static int ioctl_s_ctrl(struct v4l2_int_device *s, struct v4l2_control *vc) return retval; } -/*! - * ioctl_init - V4L2 sensor interface handler for VIDIOC_INT_INIT - * @s: pointer to standard V4L2 device structure - */ -static int ioctl_init(struct v4l2_int_device *s) -{ - int sensorid = mt9v111_id_from_name(((struct sensor *)s->priv)->v4l2_int_device->name); - - pr_debug("In mt9v111:ioctl_init for sensor %d\n",sensorid); - - return 0; -} - static void mt9v111_ifp_reset ( int sensorid ) { mt9v111_write_reg(sensorid,MT9V111S_ADDR_SPACE_SEL, 0x0001); @@ -1143,6 +1130,27 @@ static void mt9v111_sensor_reset ( int sensorid ) msleep(100); } +/*! + * ioctl_init - V4L2 sensor interface handler for VIDIOC_INT_INIT + * @s: pointer to standard V4L2 device structure + */ +static int ioctl_init(struct v4l2_int_device *s) +{ + int sensorid = 0; + + sensorid = mt9v111_id_from_name(((struct sensor *)s->priv)->v4l2_int_device->name); + if( sensorid < 0 ) + return 0; + + pr_debug("In mt9v111:ioctl_init for sensor %d\n",sensorid); + + mt9v111_sensor_reset(sensorid); + mt9v111_ifp_reset(sensorid); + mt9v111_sensor_lib_datasheet(sensorid,mt9v111_device.coreReg, mt9v111_device.ifpReg); + + return 0; +} + /*! * ioctl_dev_init - V4L2 sensor interface handler for vidioc_int_dev_init_num * @s: pointer to standard V4L2 device structure -- cgit v1.2.3