Merge branch 'topic/oss-fix' into for-linus
[linux-2.6] / drivers / media / video / gspca / m5602 / m5602_po1030.h
1 /*
2  * Driver for the po1030 sensor.
3  *
4  * Copyright (c) 2008 Erik AndrĂ©n
5  * Copyright (c) 2007 Ilyes Gouta. Based on the m5603x Linux Driver Project.
6  * Copyright (c) 2005 m5603x Linux Driver Project <m5602@x3ng.com.br>
7  *
8  * Portions of code to USB interface and ALi driver software,
9  * Copyright (c) 2006 Willem Duinker
10  * v4l2 interface modeled after the V4L2 driver
11  * for SN9C10x PC Camera Controllers
12  *
13  * Register defines taken from Pascal Stangs Procyon Armlib
14  *
15  * This program is free software; you can redistribute it and/or
16  * modify it under the terms of the GNU General Public License as
17  * published by the Free Software Foundation, version 2.
18  *
19  */
20
21 #ifndef M5602_PO1030_H_
22 #define M5602_PO1030_H_
23
24 #include "m5602_sensor.h"
25
26 /*****************************************************************************/
27
28 #define PO1030_REG_DEVID_H              0x00
29 #define PO1030_REG_DEVID_L              0x01
30 #define PO1030_REG_FRAMEWIDTH_H         0x04
31 #define PO1030_REG_FRAMEWIDTH_L         0x05
32 #define PO1030_REG_FRAMEHEIGHT_H        0x06
33 #define PO1030_REG_FRAMEHEIGHT_L        0x07
34 #define PO1030_REG_WINDOWX_H            0x08
35 #define PO1030_REG_WINDOWX_L            0x09
36 #define PO1030_REG_WINDOWY_H            0x0a
37 #define PO1030_REG_WINDOWY_L            0x0b
38 #define PO1030_REG_WINDOWWIDTH_H        0x0c
39 #define PO1030_REG_WINDOWWIDTH_L        0x0d
40 #define PO1030_REG_WINDOWHEIGHT_H       0x0e
41 #define PO1030_REG_WINDOWHEIGHT_L       0x0f
42
43 #define PO1030_REG_GLOBALIBIAS          0x12
44 #define PO1030_REG_PIXELIBIAS           0x13
45
46 #define PO1030_REG_GLOBALGAIN           0x15
47 #define PO1030_REG_RED_GAIN             0x16
48 #define PO1030_REG_GREEN_1_GAIN         0x17
49 #define PO1030_REG_BLUE_GAIN            0x18
50 #define PO1030_REG_GREEN_2_GAIN         0x19
51
52 #define PO1030_REG_INTEGLINES_H         0x1a
53 #define PO1030_REG_INTEGLINES_M         0x1b
54 #define PO1030_REG_INTEGLINES_L         0x1c
55
56 #define PO1030_REG_CONTROL1             0x1d
57 #define PO1030_REG_CONTROL2             0x1e
58 #define PO1030_REG_CONTROL3             0x1f
59 #define PO1030_REG_CONTROL4             0x20
60
61 #define PO1030_REG_PERIOD50_H           0x23
62 #define PO1030_REG_PERIOD50_L           0x24
63 #define PO1030_REG_PERIOD60_H           0x25
64 #define PO1030_REG_PERIOD60_L           0x26
65 #define PO1030_REG_REGCLK167            0x27
66 #define PO1030_REG_DELTA50              0x28
67 #define PO1030_REG_DELTA60              0x29
68
69 #define PO1030_REG_ADCOFFSET            0x2c
70
71 /* Gamma Correction Coeffs */
72 #define PO1030_REG_GC0                  0x2d
73 #define PO1030_REG_GC1                  0x2e
74 #define PO1030_REG_GC2                  0x2f
75 #define PO1030_REG_GC3                  0x30
76 #define PO1030_REG_GC4                  0x31
77 #define PO1030_REG_GC5                  0x32
78 #define PO1030_REG_GC6                  0x33
79 #define PO1030_REG_GC7                  0x34
80
81 /* Color Transform Matrix */
82 #define PO1030_REG_CT0                  0x35
83 #define PO1030_REG_CT1                  0x36
84 #define PO1030_REG_CT2                  0x37
85 #define PO1030_REG_CT3                  0x38
86 #define PO1030_REG_CT4                  0x39
87 #define PO1030_REG_CT5                  0x3a
88 #define PO1030_REG_CT6                  0x3b
89 #define PO1030_REG_CT7                  0x3c
90 #define PO1030_REG_CT8                  0x3d
91
92 #define PO1030_REG_AUTOCTRL1            0x3e
93 #define PO1030_REG_AUTOCTRL2            0x3f
94
95 #define PO1030_REG_YTARGET              0x40
96 #define PO1030_REG_GLOBALGAINMIN        0x41
97 #define PO1030_REG_GLOBALGAINMAX        0x42
98
99 /* Output format control */
100 #define PO1030_REG_OUTFORMCTRL1         0x5a
101 #define PO1030_REG_OUTFORMCTRL2         0x5b
102 #define PO1030_REG_OUTFORMCTRL3         0x5c
103 #define PO1030_REG_OUTFORMCTRL4         0x5d
104 #define PO1030_REG_OUTFORMCTRL5         0x5e
105
106 /* Imaging coefficients */
107 #define PO1030_REG_YBRIGHT              0x73
108 #define PO1030_REG_YCONTRAST            0x74
109 #define PO1030_REG_YSATURATION          0x75
110
111 #define PO1030_HFLIP                    (1 << 7)
112 #define PO1030_VFLIP                    (1 << 6)
113
114 /*****************************************************************************/
115
116 #define PO1030_GLOBAL_GAIN_DEFAULT      0x12
117 #define PO1030_EXPOSURE_DEFAULT         0x0085
118 #define PO1030_BLUE_GAIN_DEFAULT        0x40
119 #define PO1030_RED_GAIN_DEFAULT         0x40
120
121 /*****************************************************************************/
122
123 /* Kernel module parameters */
124 extern int force_sensor;
125 extern int dump_sensor;
126
127 int po1030_probe(struct sd *sd);
128 int po1030_init(struct sd *sd);
129 int po1030_power_down(struct sd *sd);
130
131 int po1030_get_exposure(struct gspca_dev *gspca_dev, __s32 *val);
132 int po1030_set_exposure(struct gspca_dev *gspca_dev, __s32 val);
133 int po1030_get_gain(struct gspca_dev *gspca_dev, __s32 *val);
134 int po1030_set_gain(struct gspca_dev *gspca_dev, __s32 val);
135 int po1030_get_red_balance(struct gspca_dev *gspca_dev, __s32 *val);
136 int po1030_set_red_balance(struct gspca_dev *gspca_dev, __s32 val);
137 int po1030_get_blue_balance(struct gspca_dev *gspca_dev, __s32 *val);
138 int po1030_set_blue_balance(struct gspca_dev *gspca_dev, __s32 val);
139 int po1030_get_hflip(struct gspca_dev *gspca_dev, __s32 *val);
140 int po1030_set_hflip(struct gspca_dev *gspca_dev, __s32 val);
141 int po1030_get_vflip(struct gspca_dev *gspca_dev, __s32 *val);
142 int po1030_set_vflip(struct gspca_dev *gspca_dev, __s32 val);
143
144 static struct m5602_sensor po1030 = {
145         .name = "PO1030",
146
147         .i2c_slave_id = 0xdc,
148         .i2c_regW = 1,
149
150         .probe = po1030_probe,
151         .init = po1030_init,
152         .power_down = po1030_power_down,
153
154         .nctrls = 6,
155         .ctrls = {
156         {
157                 {
158                         .id             = V4L2_CID_GAIN,
159                         .type           = V4L2_CTRL_TYPE_INTEGER,
160                         .name           = "gain",
161                         .minimum        = 0x00,
162                         .maximum        = 0x4f,
163                         .step           = 0x1,
164                         .default_value  = PO1030_GLOBAL_GAIN_DEFAULT,
165                         .flags          = V4L2_CTRL_FLAG_SLIDER
166                 },
167                 .set = po1030_set_gain,
168                 .get = po1030_get_gain
169         }, {
170                 {
171                         .id             = V4L2_CID_EXPOSURE,
172                         .type           = V4L2_CTRL_TYPE_INTEGER,
173                         .name           = "exposure",
174                         .minimum        = 0x00,
175                         .maximum        = 0x02ff,
176                         .step           = 0x1,
177                         .default_value  = PO1030_EXPOSURE_DEFAULT,
178                         .flags          = V4L2_CTRL_FLAG_SLIDER
179                 },
180                 .set = po1030_set_exposure,
181                 .get = po1030_get_exposure
182         }, {
183                 {
184                         .id             = V4L2_CID_RED_BALANCE,
185                         .type           = V4L2_CTRL_TYPE_INTEGER,
186                         .name           = "red balance",
187                         .minimum        = 0x00,
188                         .maximum        = 0xff,
189                         .step           = 0x1,
190                         .default_value  = PO1030_RED_GAIN_DEFAULT,
191                         .flags          = V4L2_CTRL_FLAG_SLIDER
192                 },
193                 .set = po1030_set_red_balance,
194                 .get = po1030_get_red_balance
195         }, {
196                 {
197                         .id             = V4L2_CID_BLUE_BALANCE,
198                         .type           = V4L2_CTRL_TYPE_INTEGER,
199                         .name           = "blue balance",
200                         .minimum        = 0x00,
201                         .maximum        = 0xff,
202                         .step           = 0x1,
203                         .default_value  = PO1030_BLUE_GAIN_DEFAULT,
204                         .flags          = V4L2_CTRL_FLAG_SLIDER
205                 },
206                 .set = po1030_set_blue_balance,
207                 .get = po1030_get_blue_balance
208         }, {
209                 {
210                         .id             = V4L2_CID_HFLIP,
211                         .type           = V4L2_CTRL_TYPE_BOOLEAN,
212                         .name           = "horizontal flip",
213                         .minimum        = 0,
214                         .maximum        = 1,
215                         .step           = 1,
216                         .default_value  = 0,
217                 },
218                 .set = po1030_set_hflip,
219                 .get = po1030_get_hflip
220         }, {
221                 {
222                         .id             = V4L2_CID_VFLIP,
223                         .type           = V4L2_CTRL_TYPE_BOOLEAN,
224                         .name           = "vertical flip",
225                         .minimum        = 0,
226                         .maximum        = 1,
227                         .step           = 1,
228                         .default_value  = 0,
229                 },
230                 .set = po1030_set_vflip,
231                 .get = po1030_get_vflip
232         }
233         },
234
235         .nmodes = 1,
236         .modes = {
237         {
238                 M5602_DEFAULT_FRAME_WIDTH,
239                 M5602_DEFAULT_FRAME_HEIGHT,
240                 V4L2_PIX_FMT_SBGGR8,
241                 V4L2_FIELD_NONE,
242                 .sizeimage =
243                         M5602_DEFAULT_FRAME_WIDTH * M5602_DEFAULT_FRAME_HEIGHT,
244                 .bytesperline = M5602_DEFAULT_FRAME_WIDTH,
245                 .colorspace = V4L2_COLORSPACE_SRGB,
246                 .priv = 1
247         }
248         }
249 };
250
251 static const unsigned char preinit_po1030[][3] =
252 {
253         {BRIDGE, M5602_XB_MCU_CLK_DIV, 0x02},
254         {BRIDGE, M5602_XB_MCU_CLK_CTRL, 0xb0},
255         {BRIDGE, M5602_XB_SEN_CLK_DIV, 0x00},
256         {BRIDGE, M5602_XB_SEN_CLK_CTRL, 0xb0},
257         {BRIDGE, M5602_XB_ADC_CTRL, 0xc0},
258         {BRIDGE, M5602_XB_SENSOR_TYPE, 0x0d},
259         {BRIDGE, M5602_XB_SENSOR_CTRL, 0x00},
260         {BRIDGE, M5602_XB_ADC_CTRL, 0xc0},
261         {BRIDGE, M5602_XB_SENSOR_TYPE, 0x0c},
262
263         {SENSOR, PO1030_REG_AUTOCTRL2, 0x24},
264
265         {BRIDGE, M5602_XB_GPIO_DIR, 0x05},
266         {BRIDGE, M5602_XB_GPIO_DAT, 0x04},
267         {BRIDGE, M5602_XB_GPIO_EN_H, 0x06},
268         {BRIDGE, M5602_XB_GPIO_DIR_H, 0x06},
269         {BRIDGE, M5602_XB_GPIO_DAT_H, 0x02},
270         {BRIDGE, M5602_XB_SEN_CLK_DIV, 0x04},
271         {BRIDGE, M5602_XB_SEN_CLK_CTRL, 0xb0},
272         {BRIDGE, M5602_XB_SEN_CLK_DIV, 0x06},
273         {BRIDGE, M5602_XB_SEN_CLK_CTRL, 0xb0},
274         {BRIDGE, M5602_XB_ADC_CTRL, 0xc0},
275         {BRIDGE, M5602_XB_SENSOR_TYPE, 0x0c},
276         {BRIDGE, M5602_XB_LINE_OF_FRAME_H, 0x81},
277         {BRIDGE, M5602_XB_PIX_OF_LINE_H, 0x82},
278         {BRIDGE, M5602_XB_SIG_INI, 0x01},
279         {BRIDGE, M5602_XB_VSYNC_PARA, 0x00},
280         {BRIDGE, M5602_XB_VSYNC_PARA, 0x02},
281         {BRIDGE, M5602_XB_VSYNC_PARA, 0x00},
282         {BRIDGE, M5602_XB_VSYNC_PARA, 0x00},
283         {BRIDGE, M5602_XB_VSYNC_PARA, 0x01},
284         {BRIDGE, M5602_XB_VSYNC_PARA, 0xec},
285         {BRIDGE, M5602_XB_VSYNC_PARA, 0x00},
286         {BRIDGE, M5602_XB_VSYNC_PARA, 0x00},
287         {BRIDGE, M5602_XB_SIG_INI, 0x00},
288         {BRIDGE, M5602_XB_SIG_INI, 0x02},
289         {BRIDGE, M5602_XB_HSYNC_PARA, 0x00},
290         {BRIDGE, M5602_XB_HSYNC_PARA, 0x00},
291         {BRIDGE, M5602_XB_HSYNC_PARA, 0x02},
292         {BRIDGE, M5602_XB_HSYNC_PARA, 0x87},
293         {BRIDGE, M5602_XB_SIG_INI, 0x00},
294
295         {SENSOR, PO1030_REG_AUTOCTRL2, 0x24},
296
297         {BRIDGE, M5602_XB_GPIO_DIR, 0x05},
298         {BRIDGE, M5602_XB_GPIO_DAT, 0x04},
299         {BRIDGE, M5602_XB_GPIO_EN_H, 0x06},
300         {BRIDGE, M5602_XB_GPIO_DIR_H, 0x06},
301         {BRIDGE, M5602_XB_GPIO_DAT_H, 0x02},
302         {BRIDGE, M5602_XB_SEN_CLK_DIV, 0x04},
303         {BRIDGE, M5602_XB_SEN_CLK_CTRL, 0xb0},
304         {BRIDGE, M5602_XB_SEN_CLK_DIV, 0x00},
305         {BRIDGE, M5602_XB_SEN_CLK_CTRL, 0xb0},
306         {BRIDGE, M5602_XB_ADC_CTRL, 0xc0},
307         {BRIDGE, M5602_XB_SENSOR_TYPE, 0x0c},
308         {BRIDGE, M5602_XB_GPIO_DIR, 0x05},
309         {BRIDGE, M5602_XB_GPIO_DAT, 0x00}
310 };
311
312 static const unsigned char init_po1030[][4] =
313 {
314         {BRIDGE, M5602_XB_MCU_CLK_DIV, 0x02},
315         {BRIDGE, M5602_XB_MCU_CLK_CTRL, 0xb0},
316         /*sequence 1*/
317         {BRIDGE, M5602_XB_SEN_CLK_DIV, 0x00},
318         {BRIDGE, M5602_XB_SEN_CLK_CTRL, 0xb0},
319         {BRIDGE, M5602_XB_ADC_CTRL, 0xc0},
320         {BRIDGE, M5602_XB_SENSOR_TYPE, 0x0d},
321
322         {BRIDGE, M5602_XB_SENSOR_CTRL, 0x00},
323         {BRIDGE, M5602_XB_ADC_CTRL, 0xc0},
324         {BRIDGE, M5602_XB_SENSOR_TYPE, 0x0c},
325         /*end of sequence 1*/
326
327         /*sequence 2 (same as stop sequence)*/
328         {SENSOR, PO1030_REG_AUTOCTRL2, 0x24},
329         {BRIDGE, M5602_XB_GPIO_DIR, 0x05},
330         {BRIDGE, M5602_XB_GPIO_DAT, 0x04},
331         {BRIDGE, M5602_XB_GPIO_EN_H, 0x06},
332         {BRIDGE, M5602_XB_GPIO_DIR_H, 0x06},
333         {BRIDGE, M5602_XB_GPIO_DAT_H, 0x02},
334
335         {BRIDGE, M5602_XB_SEN_CLK_DIV, 0x04},
336         {BRIDGE, M5602_XB_SEN_CLK_CTRL, 0xb0},
337         /*end of sequence 2*/
338
339         /*sequence 5*/
340         {BRIDGE, M5602_XB_SEN_CLK_DIV, 0x06},
341         {BRIDGE, M5602_XB_SEN_CLK_CTRL, 0xb0},
342         {BRIDGE, M5602_XB_ADC_CTRL, 0xc0},
343         {BRIDGE, M5602_XB_SENSOR_TYPE, 0x0c},
344         {BRIDGE, M5602_XB_LINE_OF_FRAME_H, 0x81},
345         {BRIDGE, M5602_XB_PIX_OF_LINE_H, 0x82},
346         {BRIDGE, M5602_XB_SIG_INI, 0x01},
347         {BRIDGE, M5602_XB_VSYNC_PARA, 0x00},
348         {BRIDGE, M5602_XB_VSYNC_PARA, 0x02},
349         {BRIDGE, M5602_XB_VSYNC_PARA, 0x00},
350         {BRIDGE, M5602_XB_VSYNC_PARA, 0x00},
351         {BRIDGE, M5602_XB_VSYNC_PARA, 0x01},
352         {BRIDGE, M5602_XB_VSYNC_PARA, 0xec},
353         {BRIDGE, M5602_XB_VSYNC_PARA, 0x00},
354         {BRIDGE, M5602_XB_VSYNC_PARA, 0x00},
355         {BRIDGE, M5602_XB_SIG_INI, 0x00},
356         {BRIDGE, M5602_XB_SIG_INI, 0x02},
357         {BRIDGE, M5602_XB_HSYNC_PARA, 0x00},
358         {BRIDGE, M5602_XB_HSYNC_PARA, 0x00},
359         {BRIDGE, M5602_XB_HSYNC_PARA, 0x02},
360         {BRIDGE, M5602_XB_HSYNC_PARA, 0x87},
361         {BRIDGE, M5602_XB_SIG_INI, 0x00},
362         /*end of sequence 5*/
363
364         /*sequence 2 stop */
365         {SENSOR, PO1030_REG_AUTOCTRL2, 0x24},
366
367         {BRIDGE, M5602_XB_GPIO_DIR, 0x05},
368         {BRIDGE, M5602_XB_GPIO_DAT, 0x04},
369         {BRIDGE, M5602_XB_GPIO_EN_H, 0x06},
370         {BRIDGE, M5602_XB_GPIO_DIR_H, 0x06},
371         {BRIDGE, M5602_XB_GPIO_DAT_H, 0x02},
372         {BRIDGE, M5602_XB_SEN_CLK_DIV, 0x04},
373         {BRIDGE, M5602_XB_SEN_CLK_CTRL, 0xb0},
374         /*end of sequence 2 stop */
375
376 /* ---------------------------------
377  * end of init - begin of start
378  * --------------------------------- */
379
380         /*sequence 3*/
381         {BRIDGE, M5602_XB_SEN_CLK_DIV, 0x00},
382         {BRIDGE, M5602_XB_SEN_CLK_CTRL, 0xb0},
383         {BRIDGE, M5602_XB_ADC_CTRL, 0xc0},
384         {BRIDGE, M5602_XB_SENSOR_TYPE, 0x0c},
385         /*end of sequence 3*/
386         /*sequence 4*/
387         {BRIDGE, M5602_XB_GPIO_DIR, 0x05},
388         {BRIDGE, M5602_XB_GPIO_DAT, 0x00},
389         {BRIDGE, M5602_XB_GPIO_EN_H, 0x06},
390         {BRIDGE, M5602_XB_GPIO_EN_L, 0x00},
391
392         {SENSOR, PO1030_REG_AUTOCTRL2, 0x04},
393
394         /* Set the width to 751 */
395         {SENSOR, PO1030_REG_FRAMEWIDTH_H, 0x02},
396         {SENSOR, PO1030_REG_FRAMEWIDTH_L, 0xef},
397
398         /* Set the height to 540 */
399         {SENSOR, PO1030_REG_FRAMEHEIGHT_H, 0x02},
400         {SENSOR, PO1030_REG_FRAMEHEIGHT_L, 0x1c},
401
402         /* Set the x window to 1 */
403         {SENSOR, PO1030_REG_WINDOWX_H, 0x00},
404         {SENSOR, PO1030_REG_WINDOWX_L, 0x01},
405
406         /* Set the y window to 1 */
407         {SENSOR, PO1030_REG_WINDOWY_H, 0x00},
408         {SENSOR, PO1030_REG_WINDOWY_L, 0x01},
409
410         {SENSOR, PO1030_REG_WINDOWWIDTH_H, 0x02},
411         {SENSOR, PO1030_REG_WINDOWWIDTH_L, 0x87},
412         {SENSOR, PO1030_REG_WINDOWHEIGHT_H, 0x01},
413         {SENSOR, PO1030_REG_WINDOWHEIGHT_L, 0xe3},
414
415         {SENSOR, PO1030_REG_OUTFORMCTRL2, 0x04},
416         {SENSOR, PO1030_REG_OUTFORMCTRL2, 0x04},
417         {SENSOR, PO1030_REG_AUTOCTRL1, 0x08},
418         {SENSOR, PO1030_REG_CONTROL2, 0x03},
419         {SENSOR, 0x21, 0x90},
420         {SENSOR, PO1030_REG_YTARGET, 0x60},
421         {SENSOR, 0x59, 0x13},
422         {SENSOR, PO1030_REG_OUTFORMCTRL1, 0x40},
423         {SENSOR, 0x5f, 0x00},
424         {SENSOR, 0x60, 0x80},
425         {SENSOR, 0x78, 0x14},
426         {SENSOR, 0x6f, 0x01},
427         {SENSOR, PO1030_REG_CONTROL1, 0x18},
428         {SENSOR, PO1030_REG_GLOBALGAINMAX, 0x14},
429         {SENSOR, 0x63, 0x38},
430         {SENSOR, 0x64, 0x38},
431         {SENSOR, PO1030_REG_CONTROL1, 0x58},
432         {SENSOR, PO1030_REG_RED_GAIN, 0x30},
433         {SENSOR, PO1030_REG_GREEN_1_GAIN, 0x30},
434         {SENSOR, PO1030_REG_BLUE_GAIN, 0x30},
435         {SENSOR, PO1030_REG_GREEN_2_GAIN, 0x30},
436         {SENSOR, PO1030_REG_GC0, 0x10},
437         {SENSOR, PO1030_REG_GC1, 0x20},
438         {SENSOR, PO1030_REG_GC2, 0x40},
439         {SENSOR, PO1030_REG_GC3, 0x60},
440         {SENSOR, PO1030_REG_GC4, 0x80},
441         {SENSOR, PO1030_REG_GC5, 0xa0},
442         {SENSOR, PO1030_REG_GC6, 0xc0},
443         {SENSOR, PO1030_REG_GC7, 0xff},
444         /*end of sequence 4*/
445         /*sequence 5*/
446         {BRIDGE, M5602_XB_SEN_CLK_DIV, 0x06},
447         {BRIDGE, M5602_XB_SEN_CLK_CTRL, 0xb0},
448         {BRIDGE, M5602_XB_ADC_CTRL, 0xc0},
449         {BRIDGE, M5602_XB_SENSOR_TYPE, 0x0c},
450         {BRIDGE, M5602_XB_LINE_OF_FRAME_H, 0x81},
451         {BRIDGE, M5602_XB_PIX_OF_LINE_H, 0x82},
452         {BRIDGE, M5602_XB_SIG_INI, 0x01},
453         {BRIDGE, M5602_XB_VSYNC_PARA, 0x00},
454         {BRIDGE, M5602_XB_VSYNC_PARA, 0x02},
455         {BRIDGE, M5602_XB_VSYNC_PARA, 0x00},
456         {BRIDGE, M5602_XB_VSYNC_PARA, 0x00},
457         {BRIDGE, M5602_XB_VSYNC_PARA, 0x01},
458         {BRIDGE, M5602_XB_VSYNC_PARA, 0xec},
459         {BRIDGE, M5602_XB_VSYNC_PARA, 0x00},
460         {BRIDGE, M5602_XB_VSYNC_PARA, 0x00},
461         {BRIDGE, M5602_XB_SIG_INI, 0x00},
462         {BRIDGE, M5602_XB_SIG_INI, 0x00},
463         {BRIDGE, M5602_XB_HSYNC_PARA, 0x00},
464         {BRIDGE, M5602_XB_HSYNC_PARA, 0x00},
465         {BRIDGE, M5602_XB_HSYNC_PARA, 0x02},
466         {BRIDGE, M5602_XB_HSYNC_PARA, 0x7e},
467         {BRIDGE, M5602_XB_SIG_INI, 0x00},
468         /*end of sequence 5*/
469
470         /*sequence 6*/
471         /* Changing 40 in f0 the image becomes green in bayer mode and red in
472          * rgb mode */
473         {SENSOR, PO1030_REG_RED_GAIN, PO1030_RED_GAIN_DEFAULT},
474         /* in changing 40 in f0 the image becomes green in bayer mode and red in
475          * rgb mode */
476         {SENSOR, PO1030_REG_BLUE_GAIN, PO1030_BLUE_GAIN_DEFAULT},
477
478         /* with a very low lighted environment increase the exposure but
479          * decrease the FPS (Frame Per Second) */
480         {BRIDGE, M5602_XB_SEN_CLK_DIV, 0x00},
481         {BRIDGE, M5602_XB_SEN_CLK_CTRL, 0xb0},
482
483         /* Controls high exposure more than SENSOR_LOW_EXPOSURE, use only in
484          * low lighted environment (f0 is more than ff ?)*/
485         {SENSOR, PO1030_REG_INTEGLINES_H, ((PO1030_EXPOSURE_DEFAULT >> 2)
486                 & 0xff)},
487
488         /* Controls middle exposure, use only in high lighted environment */
489         {SENSOR, PO1030_REG_INTEGLINES_M, PO1030_EXPOSURE_DEFAULT & 0xff},
490
491         /* Controls clarity (not sure) */
492         {SENSOR, PO1030_REG_INTEGLINES_L, 0x00},
493         /* Controls gain (the image is more lighted) */
494         {SENSOR, PO1030_REG_GLOBALGAIN, PO1030_GLOBAL_GAIN_DEFAULT},
495
496         /* Sets the width */
497         {SENSOR, PO1030_REG_FRAMEWIDTH_H, 0x02},
498         {SENSOR, PO1030_REG_FRAMEWIDTH_L, 0xef}
499         /*end of sequence 6*/
500 };
501
502 #endif