[OMAPZOOM][PATCH 6/7] OMAP3: CAM: Lens position fix

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



>From 21157b257c091404b34b97fc08299c5009c86238 Mon Sep 17 00:00:00 2001
From: Sergio Aguirre <saaguirre@xxxxxx>
Date: Tue, 6 Jan 2009 14:17:34 -0600
Subject: [PATCH] OMAP3: CAM: Lens position fix

This change is to set the default value of the lens as INFINITE
position and set it each time the camera is opened also is to
keep the last value of the lens position after stream off call.

Signed-off-by: Sergio Aguirre <saaguirre@xxxxxx>
---
 drivers/media/video/dw9710.c      |    4 +++-
 drivers/media/video/omap34xxcam.c |    8 ++++++++
 2 files changed, 11 insertions(+), 1 deletions(-)
 mode change 100644 => 100755 drivers/media/video/dw9710.c
 mode change 100644 => 100755 drivers/media/video/omap34xxcam.c

diff --git a/drivers/media/video/dw9710.c b/drivers/media/video/dw9710.c
old mode 100644
new mode 100755
index 9bcc904..60350df
--- a/drivers/media/video/dw9710.c
+++ b/drivers/media/video/dw9710.c
@@ -31,6 +31,7 @@
 static int
 dw9710_probe(struct i2c_client *client, const struct i2c_device_id *id);
 static int __exit dw9710_remove(struct i2c_client *client);
+int position_global;
 
 struct dw9710_device {
 	const struct dw9710_platform_data *pdata;
@@ -266,6 +267,7 @@ int dw9710_af_setfocus(u16 posn)
 	if (ret)
 		printk(KERN_ERR "Setfocus register write failed\n");
 	dw9710.current_lens_posn = posn;
+	position_global = dw9710.current_lens_posn;
 	return ret;
 }
 EXPORT_SYMBOL(dw9710_af_setfocus);
@@ -437,7 +439,7 @@ static int ioctl_s_power(struct v4l2_int_device *s, enum v4l2_power on)
 
 	if ((lens->power_state == V4L2_POWER_STANDBY) && (on == V4L2_POWER_ON)
 					&& (lens->state == LENS_DETECTED))
-		dw9710_af_setfocus(lens->current_lens_posn);
+		dw9710_af_setfocus(position_global);
 
 	lens->power_state = on;
 	return 0;
diff --git a/drivers/media/video/omap34xxcam.c b/drivers/media/video/omap34xxcam.c
old mode 100644
new mode 100755
index f14a531..7fe3981
--- a/drivers/media/video/omap34xxcam.c
+++ b/drivers/media/video/omap34xxcam.c
@@ -1286,6 +1286,7 @@ static int omap34xxcam_open(struct inode *inode, struct file *file)
 	struct omap34xxcam_device *cam = omap34xxcam;
 	struct omap34xxcam_fh *fh;
 	struct v4l2_format format;
+	struct v4l2_control vc;
 	int i;
 
 	for (i = 0; i < OMAP34XXCAM_VIDEODEVS; i++) {
@@ -1310,6 +1311,13 @@ static int omap34xxcam_open(struct inode *inode, struct file *file)
 			mutex_unlock(&vdev->mutex);
 			goto out_try_module_get;
 		}
+
+		/* set the default lens position, if applicable */
+		if (vdev->vdev_lens) {
+			vc.id = V4L2_CID_FOCUS_ABSOLUTE;
+			vc.value = 0;
+			vidioc_int_s_ctrl(vdev->vdev_lens, &vc);
+		}
 	}
 
 	if (atomic_inc_return(&vdev->users) == 1) {
-- 
1.5.6.5

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Arm (vger)]     [ARM Kernel]     [ARM MSM]     [Linux Tegra]     [Linux WPAN Networking]     [Linux Wireless Networking]     [Maemo Users]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux