diff options
Diffstat (limited to 'extras/recipes-kernel/linux/linux-omap-psp-2.6.32/cam/0066-mt9t112-Add-Context-selection-to-configuration.patch')
-rw-r--r-- | extras/recipes-kernel/linux/linux-omap-psp-2.6.32/cam/0066-mt9t112-Add-Context-selection-to-configuration.patch | 96 |
1 files changed, 96 insertions, 0 deletions
diff --git a/extras/recipes-kernel/linux/linux-omap-psp-2.6.32/cam/0066-mt9t112-Add-Context-selection-to-configuration.patch b/extras/recipes-kernel/linux/linux-omap-psp-2.6.32/cam/0066-mt9t112-Add-Context-selection-to-configuration.patch new file mode 100644 index 00000000..0afb340d --- /dev/null +++ b/extras/recipes-kernel/linux/linux-omap-psp-2.6.32/cam/0066-mt9t112-Add-Context-selection-to-configuration.patch | |||
@@ -0,0 +1,96 @@ | |||
1 | From a1066fd19c56f96201b877b394247db9c41c3c18 Mon Sep 17 00:00:00 2001 | ||
2 | From: Sergio Aguirre <saaguirre@ti.com> | ||
3 | Date: Sun, 18 Jul 2010 01:12:41 -0500 | ||
4 | Subject: [PATCH 66/75] mt9t112: Add Context selection to configuration | ||
5 | |||
6 | Thsi makes always start at least with preview mode | ||
7 | (context A), and then, if needed, transition to capture | ||
8 | mode (context B) | ||
9 | |||
10 | Signed-off-by: Sergio Aguirre <saaguirre@ti.com> | ||
11 | --- | ||
12 | drivers/media/video/mt9t112.c | 54 +++++++++++++++++++++++++++++++++++++++++ | ||
13 | 1 files changed, 54 insertions(+), 0 deletions(-) | ||
14 | |||
15 | diff --git a/drivers/media/video/mt9t112.c b/drivers/media/video/mt9t112.c | ||
16 | index ee991ef..ec7514f 100644 | ||
17 | --- a/drivers/media/video/mt9t112.c | ||
18 | +++ b/drivers/media/video/mt9t112.c | ||
19 | @@ -73,6 +73,9 @@ | ||
20 | #define mt9t112_reg_read(ret, client, a) \ | ||
21 | ECHECKER(ret, __mt9t112_reg_read(client, a)) | ||
22 | |||
23 | +#define mt9t112_mcu_read(ret, client, a) \ | ||
24 | + ECHECKER(ret, __mt9t112_mcu_read(client, a)) | ||
25 | + | ||
26 | /* | ||
27 | * Logical address | ||
28 | */ | ||
29 | @@ -737,6 +740,50 @@ static int mt9t112_auto_focus_trigger(const struct i2c_client *client) | ||
30 | return ret; | ||
31 | } | ||
32 | |||
33 | +static int mt9t112_goto_preview(const struct i2c_client *client) | ||
34 | +{ | ||
35 | + int ret, trycount = 0; | ||
36 | + | ||
37 | + /* Is it already in preview mode? */ | ||
38 | + mt9t112_mcu_read(ret, client, VAR8(1, 1)); | ||
39 | + if (ret == 0x3) | ||
40 | + return 0; | ||
41 | + | ||
42 | + /* Go to preview mode */ | ||
43 | + mt9t112_mcu_write(ret, client, VAR8(1, 0), 1); | ||
44 | + do { | ||
45 | + mt9t112_mcu_read(ret, client, VAR8(1, 1)); | ||
46 | + mdelay(1); | ||
47 | + } while ((ret != 0x3) && (++trycount < 100)); | ||
48 | + | ||
49 | + if (trycount >= 100) | ||
50 | + return -EBUSY; | ||
51 | + | ||
52 | + return 0; | ||
53 | +} | ||
54 | + | ||
55 | +static int mt9t112_goto_capture(const struct i2c_client *client) | ||
56 | +{ | ||
57 | + int ret, trycount = 0; | ||
58 | + | ||
59 | + /* Is it already in capture mode? */ | ||
60 | + mt9t112_mcu_read(ret, client, VAR8(1, 1)); | ||
61 | + if (ret == 0x7) | ||
62 | + return 0; | ||
63 | + | ||
64 | + /* Go to capture mode */ | ||
65 | + mt9t112_mcu_write(ret, client, VAR8(1, 0), 2); | ||
66 | + do { | ||
67 | + mt9t112_mcu_read(ret, client, VAR8(1, 1)); | ||
68 | + mdelay(1); | ||
69 | + } while ((ret != 0x7) && (++trycount < 100)); | ||
70 | + | ||
71 | + if (trycount >= 100) | ||
72 | + return -EBUSY; | ||
73 | + | ||
74 | + return 0; | ||
75 | +} | ||
76 | + | ||
77 | static int mt9t112_init_camera(const struct i2c_client *client) | ||
78 | { | ||
79 | int ret; | ||
80 | @@ -1034,6 +1081,13 @@ static int mt9t112_v4l2_int_s_power(struct v4l2_int_device *s, | ||
81 | |||
82 | ECHECKER(ret, mt9t112_auto_focus_trigger(client)); | ||
83 | |||
84 | + ECHECKER(ret, mt9t112_goto_preview(client)); | ||
85 | + | ||
86 | + if ((priv->pix.width == MAX_WIDTH) && | ||
87 | + (priv->pix.height == MAX_HEIGHT)) { | ||
88 | + ECHECKER(ret, mt9t112_goto_capture(client)); | ||
89 | + } | ||
90 | + | ||
91 | dev_dbg(&client->dev, "format : %d\n", priv->pix.pixelformat); | ||
92 | dev_dbg(&client->dev, "size : %d x %d\n", | ||
93 | priv->pix.width, | ||
94 | -- | ||
95 | 1.6.6.1 | ||
96 | |||