summaryrefslogtreecommitdiffstats
path: root/recipes/linux/linux-omap-psp-2.6.32/cam/0066-mt9t112-Add-Context-selection-to-configuration.patch
diff options
context:
space:
mode:
Diffstat (limited to 'recipes/linux/linux-omap-psp-2.6.32/cam/0066-mt9t112-Add-Context-selection-to-configuration.patch')
-rw-r--r--recipes/linux/linux-omap-psp-2.6.32/cam/0066-mt9t112-Add-Context-selection-to-configuration.patch96
1 files changed, 96 insertions, 0 deletions
diff --git a/recipes/linux/linux-omap-psp-2.6.32/cam/0066-mt9t112-Add-Context-selection-to-configuration.patch b/recipes/linux/linux-omap-psp-2.6.32/cam/0066-mt9t112-Add-Context-selection-to-configuration.patch
new file mode 100644
index 0000000000..adda004db0
--- /dev/null
+++ b/recipes/linux/linux-omap-psp-2.6.32/cam/0066-mt9t112-Add-Context-selection-to-configuration.patch
@@ -0,0 +1,96 @@
+From d53224070b960f08989a50f1786adeecfca227eb Mon Sep 17 00:00:00 2001
+From: Sergio Aguirre <saaguirre@ti.com>
+Date: Sun, 18 Jul 2010 01:12:41 -0500
+Subject: [PATCH 66/71] mt9t112: Add Context selection to configuration
+
+Thsi makes always start at least with preview mode
+(context A), and then, if needed, transition to capture
+mode (context B)
+
+Signed-off-by: Sergio Aguirre <saaguirre@ti.com>
+---
+ drivers/media/video/mt9t112.c | 54 +++++++++++++++++++++++++++++++++++++++++
+ 1 files changed, 54 insertions(+), 0 deletions(-)
+
+diff --git a/drivers/media/video/mt9t112.c b/drivers/media/video/mt9t112.c
+index ee991ef..ec7514f 100644
+--- a/drivers/media/video/mt9t112.c
++++ b/drivers/media/video/mt9t112.c
+@@ -73,6 +73,9 @@
+ #define mt9t112_reg_read(ret, client, a) \
+ ECHECKER(ret, __mt9t112_reg_read(client, a))
+
++#define mt9t112_mcu_read(ret, client, a) \
++ ECHECKER(ret, __mt9t112_mcu_read(client, a))
++
+ /*
+ * Logical address
+ */
+@@ -737,6 +740,50 @@ static int mt9t112_auto_focus_trigger(const struct i2c_client *client)
+ return ret;
+ }
+
++static int mt9t112_goto_preview(const struct i2c_client *client)
++{
++ int ret, trycount = 0;
++
++ /* Is it already in preview mode? */
++ mt9t112_mcu_read(ret, client, VAR8(1, 1));
++ if (ret == 0x3)
++ return 0;
++
++ /* Go to preview mode */
++ mt9t112_mcu_write(ret, client, VAR8(1, 0), 1);
++ do {
++ mt9t112_mcu_read(ret, client, VAR8(1, 1));
++ mdelay(1);
++ } while ((ret != 0x3) && (++trycount < 100));
++
++ if (trycount >= 100)
++ return -EBUSY;
++
++ return 0;
++}
++
++static int mt9t112_goto_capture(const struct i2c_client *client)
++{
++ int ret, trycount = 0;
++
++ /* Is it already in capture mode? */
++ mt9t112_mcu_read(ret, client, VAR8(1, 1));
++ if (ret == 0x7)
++ return 0;
++
++ /* Go to capture mode */
++ mt9t112_mcu_write(ret, client, VAR8(1, 0), 2);
++ do {
++ mt9t112_mcu_read(ret, client, VAR8(1, 1));
++ mdelay(1);
++ } while ((ret != 0x7) && (++trycount < 100));
++
++ if (trycount >= 100)
++ return -EBUSY;
++
++ return 0;
++}
++
+ static int mt9t112_init_camera(const struct i2c_client *client)
+ {
+ int ret;
+@@ -1034,6 +1081,13 @@ static int mt9t112_v4l2_int_s_power(struct v4l2_int_device *s,
+
+ ECHECKER(ret, mt9t112_auto_focus_trigger(client));
+
++ ECHECKER(ret, mt9t112_goto_preview(client));
++
++ if ((priv->pix.width == MAX_WIDTH) &&
++ (priv->pix.height == MAX_HEIGHT)) {
++ ECHECKER(ret, mt9t112_goto_capture(client));
++ }
++
+ dev_dbg(&client->dev, "format : %d\n", priv->pix.pixelformat);
+ dev_dbg(&client->dev, "size : %d x %d\n",
+ priv->pix.width,
+--
+1.6.6.1
+