]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - glsdk/meta-ti-glsdk.git/blob - recipes-kernel/linux/linux-omap-psp-2.6.32/cam/0063-mt9t112-Correct-register-settings-for-mt9t111-sensor.patch
netbase: automatically bring up usb0 on BeagleBoard xM
[glsdk/meta-ti-glsdk.git] / recipes-kernel / linux / linux-omap-psp-2.6.32 / cam / 0063-mt9t112-Correct-register-settings-for-mt9t111-sensor.patch
1 From fa6380a53783b185189c372dd5e9d17f46c5c4d7 Mon Sep 17 00:00:00 2001
2 From: Sergio Aguirre <saaguirre@ti.com>
3 Date: Fri, 16 Jul 2010 07:52:06 -0500
4 Subject: [PATCH 63/75] mt9t112: Correct register settings for mt9t111 sensor
6 This now matches with Aptina's recommended values.
8 Signed-off-by: Sergio Aguirre <saaguirre@ti.com>
9 ---
10  drivers/media/video/mt9t112.c |   46 ++++++++++++++++++++++++++++------------
11  1 files changed, 32 insertions(+), 14 deletions(-)
13 diff --git a/drivers/media/video/mt9t112.c b/drivers/media/video/mt9t112.c
14 index 44234e4..ac295dd 100644
15 --- a/drivers/media/video/mt9t112.c
16 +++ b/drivers/media/video/mt9t112.c
17 @@ -44,6 +44,9 @@
18  #define MAX_WIDTH   2048
19  #define MAX_HEIGHT  1536
20  
21 +#define MAX_WIDTH_PREV   1024
22 +#define MAX_HEIGHT_PREV  768
23 +
24  #define VGA_WIDTH   640
25  #define VGA_HEIGHT  480
26  
27 @@ -392,24 +395,39 @@ static int mt9t112_set_a_frame_size(const struct i2c_client *client,
28                                    u16 height)
29  {
30         int ret;
31 -       u16 wstart = (MAX_WIDTH - width) / 2;
32 -       u16 hstart = (MAX_HEIGHT - height) / 2;
33 +       u16 wstart, hstart, wend, hend;
34 +       u16 max_width = MAX_WIDTH_PREV, max_height = MAX_HEIGHT_PREV;
35 +
36 +       if ((width > max_width) || (height > max_height)) {
37 +               /* Capture case */
38 +               max_width = MAX_WIDTH;
39 +               max_height = MAX_HEIGHT;
40 +               hstart = 4;
41 +               wstart = 4;
42 +               hend = 1547;
43 +               wend = 2059;
44 +       } else {
45 +               hstart = 0;
46 +               wstart = 0;
47 +               hend = 1549;
48 +               wend = 2061;
49 +       }
50  
51         /* (Context A) Image Width/Height */
52         mt9t112_mcu_write(ret, client, VAR(26, 0), width);
53         mt9t112_mcu_write(ret, client, VAR(26, 2), height);
54  
55         /* (Context A) Output Width/Height */
56 -       mt9t112_mcu_write(ret, client, VAR(18, 43), 8 + width);
57 -       mt9t112_mcu_write(ret, client, VAR(18, 45), 8 + height);
58 +       mt9t112_mcu_write(ret, client, VAR(18, 43), 8 + max_width);
59 +       mt9t112_mcu_write(ret, client, VAR(18, 45), 8 + max_height);
60  
61         /* (Context A) Start Row/Column */
62 -       mt9t112_mcu_write(ret, client, VAR(18, 2), 4 + hstart);
63 -       mt9t112_mcu_write(ret, client, VAR(18, 4), 4 + wstart);
64 +       mt9t112_mcu_write(ret, client, VAR(18, 2), hstart);
65 +       mt9t112_mcu_write(ret, client, VAR(18, 4), wstart);
66  
67         /* (Context A) End Row/Column */
68 -       mt9t112_mcu_write(ret, client, VAR(18, 6), 11 + height + hstart);
69 -       mt9t112_mcu_write(ret, client, VAR(18, 8), 11 + width  + wstart);
70 +       mt9t112_mcu_write(ret, client, VAR(18, 6), hend);
71 +       mt9t112_mcu_write(ret, client, VAR(18, 8), wend);
72  
73         mt9t112_mcu_write(ret, client, VAR8(1, 0), 0x06);
74  
75 @@ -547,25 +565,25 @@ static int mt9t112_init_setting(const struct i2c_client *client)
76         mt9t112_mcu_mask_set(ret, client, VAR(26, 160), 0x0040, 0x0000);
77  
78         /* Read Mode (A) */
79 -       mt9t112_mcu_write(ret, client, VAR(18, 12), 0x0024);
80 +       mt9t112_mcu_write(ret, client, VAR(18, 12), 0x046C);
81  
82         /* Fine Correction (A) */
83         mt9t112_mcu_write(ret, client, VAR(18, 15), 0x00CC);
84  
85         /* Fine IT Min (A) */
86 -       mt9t112_mcu_write(ret, client, VAR(18, 17), 0x01f1);
87 +       mt9t112_mcu_write(ret, client, VAR(18, 17), 0x0381);
88  
89         /* Fine IT Max Margin (A) */
90 -       mt9t112_mcu_write(ret, client, VAR(18, 19), 0x00fF);
91 +       mt9t112_mcu_write(ret, client, VAR(18, 19), 0x024F);
92  
93         /* Base Frame Lines (A) */
94 -       mt9t112_mcu_write(ret, client, VAR(18, 29), 0x032D);
95 +       mt9t112_mcu_write(ret, client, VAR(18, 29), 0x0378);
96  
97         /* Min Line Length (A) */
98 -       mt9t112_mcu_write(ret, client, VAR(18, 31), 0x073a);
99 +       mt9t112_mcu_write(ret, client, VAR(18, 31), 0x05D0);
100  
101         /* Line Length (A) */
102 -       mt9t112_mcu_write(ret, client, VAR(18, 37), 0x07d0);
103 +       mt9t112_mcu_write(ret, client, VAR(18, 37), 0x07AC);
104  
105         /* Adaptive Output Clock (B) */
106         mt9t112_mcu_mask_set(ret, client, VAR(27, 160), 0x0040, 0x0000);
107 -- 
108 1.6.6.1