Merge branches 'x86/cleanups', 'x86/mm', 'x86/setup' and 'linus' into x86/core
[linux-2.6] / drivers / media / video / gspca / m5602 / m5602_s5k83a.h
1 /*
2  * Driver for the s5k83a 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  * This program is free software; you can redistribute it and/or
14  * modify it under the terms of the GNU General Public License as
15  * published by the Free Software Foundation, version 2.
16  *
17  */
18
19 #ifndef M5602_S5K83A_H_
20 #define M5602_S5K83A_H_
21
22 #include "m5602_sensor.h"
23
24 #define S5K83A_FLIP                             0x01
25 #define S5K83A_HFLIP_TUNE                       0x03
26 #define S5K83A_VFLIP_TUNE                       0x05
27 #define S5K83A_WHITENESS                        0x0a
28 #define S5K83A_GAIN                             0x18
29 #define S5K83A_BRIGHTNESS                       0x1b
30 #define S5K83A_PAGE_MAP                         0xec
31
32 #define S5K83A_DEFAULT_BRIGHTNESS               0x71
33 #define S5K83A_DEFAULT_WHITENESS                0x7e
34 #define S5K83A_DEFAULT_GAIN                     0x00
35 #define S5K83A_MAXIMUM_GAIN                     0x3c
36 #define S5K83A_FLIP_MASK                        0x10
37
38
39 /*****************************************************************************/
40
41 /* Kernel module parameters */
42 extern int force_sensor;
43 extern int dump_sensor;
44
45 int s5k83a_probe(struct sd *sd);
46 int s5k83a_init(struct sd *sd);
47 int s5k83a_power_down(struct sd *sd);
48
49 int s5k83a_set_brightness(struct gspca_dev *gspca_dev, __s32 val);
50 int s5k83a_get_brightness(struct gspca_dev *gspca_dev, __s32 *val);
51 int s5k83a_set_whiteness(struct gspca_dev *gspca_dev, __s32 val);
52 int s5k83a_get_whiteness(struct gspca_dev *gspca_dev, __s32 *val);
53 int s5k83a_set_gain(struct gspca_dev *gspca_dev, __s32 val);
54 int s5k83a_get_gain(struct gspca_dev *gspca_dev, __s32 *val);
55 int s5k83a_get_vflip(struct gspca_dev *gspca_dev, __s32 *val);
56 int s5k83a_set_vflip(struct gspca_dev *gspca_dev, __s32 val);
57 int s5k83a_get_hflip(struct gspca_dev *gspca_dev, __s32 *val);
58 int s5k83a_set_hflip(struct gspca_dev *gspca_dev, __s32 val);
59
60 static struct m5602_sensor s5k83a = {
61         .name = "S5K83A",
62         .probe = s5k83a_probe,
63         .init = s5k83a_init,
64         .power_down = s5k83a_power_down,
65         .i2c_slave_id = 0x5a,
66         .i2c_regW = 2,
67         .nctrls = 5,
68         .ctrls = {
69         {
70                 {
71                         .id = V4L2_CID_BRIGHTNESS,
72                         .type = V4L2_CTRL_TYPE_INTEGER,
73                         .name = "brightness",
74                         .minimum = 0x00,
75                         .maximum = 0xff,
76                         .step = 0x01,
77                         .default_value = S5K83A_DEFAULT_BRIGHTNESS,
78                         .flags = V4L2_CTRL_FLAG_SLIDER
79                 },
80                         .set = s5k83a_set_brightness,
81                         .get = s5k83a_get_brightness
82
83         }, {
84                 {
85                         .id = V4L2_CID_WHITENESS,
86                         .type = V4L2_CTRL_TYPE_INTEGER,
87                         .name = "whiteness",
88                         .minimum = 0x00,
89                         .maximum = 0xff,
90                         .step = 0x01,
91                         .default_value = S5K83A_DEFAULT_WHITENESS,
92                         .flags = V4L2_CTRL_FLAG_SLIDER
93                 },
94                         .set = s5k83a_set_whiteness,
95                         .get = s5k83a_get_whiteness,
96         }, {
97                 {
98                         .id = V4L2_CID_GAIN,
99                         .type = V4L2_CTRL_TYPE_INTEGER,
100                         .name = "gain",
101                         .minimum = 0x00,
102                         .maximum = S5K83A_MAXIMUM_GAIN,
103                         .step = 0x01,
104                         .default_value = S5K83A_DEFAULT_GAIN,
105                         .flags = V4L2_CTRL_FLAG_SLIDER
106                 },
107                         .set = s5k83a_set_gain,
108                         .get = s5k83a_get_gain
109         }, {
110                 {
111                         .id         = V4L2_CID_HFLIP,
112                         .type       = V4L2_CTRL_TYPE_BOOLEAN,
113                         .name       = "horizontal flip",
114                         .minimum    = 0,
115                         .maximum    = 1,
116                         .step       = 1,
117                         .default_value  = 0
118                 },
119                         .set = s5k83a_set_hflip,
120                         .get = s5k83a_get_hflip
121         }, {
122                 {
123                  .id         = V4L2_CID_VFLIP,
124                 .type       = V4L2_CTRL_TYPE_BOOLEAN,
125                 .name       = "vertical flip",
126                 .minimum    = 0,
127                 .maximum    = 1,
128                 .step       = 1,
129                 .default_value  = 0
130                 },
131                 .set = s5k83a_set_vflip,
132                 .get = s5k83a_get_vflip
133                 }
134         },
135         .nmodes = 1,
136         .modes = {
137         {
138                 M5602_DEFAULT_FRAME_WIDTH,
139                 M5602_DEFAULT_FRAME_HEIGHT,
140                 V4L2_PIX_FMT_SBGGR8,
141                 V4L2_FIELD_NONE,
142                 .sizeimage =
143                         M5602_DEFAULT_FRAME_WIDTH * M5602_DEFAULT_FRAME_HEIGHT,
144                 .bytesperline = M5602_DEFAULT_FRAME_WIDTH,
145                 .colorspace = V4L2_COLORSPACE_SRGB,
146                 .priv = 1
147         }
148         }
149 };
150
151 static const unsigned char preinit_s5k83a[][4] =
152 {
153         {BRIDGE, M5602_XB_MCU_CLK_DIV, 0x02, 0x00},
154         {BRIDGE, M5602_XB_MCU_CLK_CTRL, 0xb0, 0x00},
155         {BRIDGE, M5602_XB_SEN_CLK_DIV, 0x00, 0x00},
156         {BRIDGE, M5602_XB_SEN_CLK_CTRL, 0xb0, 0x00},
157         {BRIDGE, M5602_XB_ADC_CTRL, 0xc0, 0x00},
158         {BRIDGE, M5602_XB_SENSOR_TYPE, 0x0d, 0x00},
159         {BRIDGE, M5602_XB_SENSOR_CTRL, 0x00, 0x00},
160
161         {BRIDGE, M5602_XB_SIG_INI, 0x00, 0x00},
162         {BRIDGE, M5602_XB_GPIO_DIR, 0x1d, 0x00},
163         {BRIDGE, M5602_XB_GPIO_DAT, 0x08, 0x00},
164         {BRIDGE, M5602_XB_GPIO_EN_H, 0x3f, 0x00},
165         {BRIDGE, M5602_XB_GPIO_DIR_H, 0x3f, 0x00},
166         {BRIDGE, M5602_XB_GPIO_DAT_H, 0x00, 0x00},
167         {BRIDGE, M5602_XB_GPIO_EN_L, 0xff, 0x00},
168         {BRIDGE, M5602_XB_GPIO_DIR_L, 0xff, 0x00},
169         {BRIDGE, M5602_XB_GPIO_DAT_L, 0x00, 0x00},
170         {BRIDGE, M5602_XB_SEN_CLK_DIV, 0xb0, 0x00},
171         {BRIDGE, M5602_XB_SEN_CLK_CTRL, 0x80, 0x00},
172         {BRIDGE, M5602_XB_SEN_CLK_DIV, 0x00, 0x00},
173         {BRIDGE, M5602_XB_SEN_CLK_CTRL, 0xb0, 0x00},
174         {BRIDGE, M5602_XB_ADC_CTRL, 0xc0, 0x00},
175         {BRIDGE, M5602_XB_SENSOR_TYPE, 0x09, 0x00},
176         {BRIDGE, M5602_XB_MCU_CLK_DIV, 0x02, 0x00},
177         {BRIDGE, M5602_XB_MCU_CLK_CTRL, 0xb0, 0x00},
178         {BRIDGE, M5602_XB_SEN_CLK_DIV, 0x00, 0x00},
179         {BRIDGE, M5602_XB_SEN_CLK_CTRL, 0xf0, 0x00},
180         {BRIDGE, M5602_XB_GPIO_DIR, 0x1d, 0x00},
181         {BRIDGE, M5602_XB_GPIO_DAT, 0x1c, 0x00},
182         {BRIDGE, M5602_XB_GPIO_EN_H, 0x06, 0x00},
183         {BRIDGE, M5602_XB_GPIO_DIR_H, 0x06, 0x00},
184         {BRIDGE, M5602_XB_GPIO_DAT_H, 0x00, 0x00},
185         {BRIDGE, M5602_XB_GPIO_EN_L, 0x00, 0x00},
186         {BRIDGE, M5602_XB_I2C_CLK_DIV, 0x20, 0x00},
187
188         {SENSOR, S5K83A_PAGE_MAP, 0x00, 0x00}
189 };
190
191 /* This could probably be considerably shortened.
192    I don't have the hardware to experiment with it, patches welcome
193 */
194 static const unsigned char init_s5k83a[][4] =
195 {
196         {SENSOR, S5K83A_PAGE_MAP, 0x04, 0x00},
197         {SENSOR, 0xaf, 0x01, 0x00},
198         {SENSOR, S5K83A_PAGE_MAP, 0x00, 0x00},
199         {SENSOR, 0x7b, 0xff, 0x00},
200         {SENSOR, S5K83A_PAGE_MAP, 0x05, 0x00},
201         {SENSOR, 0x01, 0x50, 0x00},
202         {SENSOR, 0x12, 0x20, 0x00},
203         {SENSOR, 0x17, 0x40, 0x00},
204         {SENSOR, S5K83A_BRIGHTNESS, 0x0f, 0x00},
205         {SENSOR, 0x1c, 0x00, 0x00},
206         {SENSOR, 0x02, 0x70, 0x00},
207         {SENSOR, 0x03, 0x0b, 0x00},
208         {SENSOR, 0x04, 0xf0, 0x00},
209         {SENSOR, 0x05, 0x0b, 0x00},
210         {SENSOR, S5K83A_PAGE_MAP, 0x05, 0x00},
211
212         {BRIDGE, M5602_XB_SEN_CLK_DIV, 0x06, 0x00},
213         {BRIDGE, M5602_XB_SEN_CLK_CTRL, 0xb0, 0x00},
214         {BRIDGE, M5602_XB_ADC_CTRL, 0xc0, 0x00},
215         {BRIDGE, M5602_XB_SENSOR_TYPE, 0x09, 0x00},
216         {BRIDGE, M5602_XB_LINE_OF_FRAME_H, 0x81, 0x00},
217         {BRIDGE, M5602_XB_PIX_OF_LINE_H, 0x82, 0x00},
218         {BRIDGE, M5602_XB_SIG_INI, 0x01, 0x00},
219         {BRIDGE, M5602_XB_VSYNC_PARA, 0x00, 0x00},
220         {BRIDGE, M5602_XB_VSYNC_PARA, 0x00, 0x00},
221         {BRIDGE, M5602_XB_VSYNC_PARA, 0x00, 0x00},
222         {BRIDGE, M5602_XB_VSYNC_PARA, 0x00, 0x00},
223         {BRIDGE, M5602_XB_VSYNC_PARA, 0x01, 0x00},
224         {BRIDGE, M5602_XB_VSYNC_PARA, 0xe4, 0x00},
225         {BRIDGE, M5602_XB_VSYNC_PARA, 0x00, 0x00},
226         {BRIDGE, M5602_XB_VSYNC_PARA, 0x00, 0x00},
227         {BRIDGE, M5602_XB_SIG_INI, 0x00, 0x00},
228         {BRIDGE, M5602_XB_SIG_INI, 0x02, 0x00},
229         {BRIDGE, M5602_XB_HSYNC_PARA, 0x00, 0x00},
230         {BRIDGE, M5602_XB_HSYNC_PARA, 0x00, 0x00},
231         {BRIDGE, M5602_XB_HSYNC_PARA, 0x02, 0x00},
232         {BRIDGE, M5602_XB_HSYNC_PARA, 0x87, 0x00},
233         {BRIDGE, M5602_XB_SIG_INI, 0x00, 0x00},
234         {BRIDGE, M5602_XB_SEN_CLK_DIV, 0x00, 0x00},
235         {BRIDGE, M5602_XB_SEN_CLK_CTRL, 0xb0, 0x00},
236
237         {SENSOR, S5K83A_PAGE_MAP, 0x05, 0x00},
238         {SENSOR, 0x06, 0x71, 0x00},
239         {SENSOR, 0x07, 0xe8, 0x00},
240         {SENSOR, 0x08, 0x02, 0x00},
241         {SENSOR, 0x09, 0x88, 0x00},
242         {SENSOR, 0x14, 0x00, 0x00},
243         {SENSOR, 0x15, 0x20, 0x00},
244         {SENSOR, 0x19, 0x00, 0x00},
245         {SENSOR, 0x1a, 0x98, 0x00},
246         {SENSOR, 0x0f, 0x02, 0x00},
247         {SENSOR, 0x10, 0xe5, 0x00},
248         {SENSOR, S5K83A_PAGE_MAP, 0x05, 0x00},
249         {SENSOR_LONG, 0x14, 0x00, 0x20},
250         {SENSOR_LONG, 0x0d, 0x00, 0x7d},
251         {SENSOR_LONG, 0x1b, 0x0d, 0x05},
252
253         {BRIDGE, M5602_XB_SEN_CLK_DIV, 0x06, 0x00},
254         {BRIDGE, M5602_XB_SEN_CLK_CTRL, 0xb0, 0x00},
255         {BRIDGE, M5602_XB_ADC_CTRL, 0xc0, 0x00},
256         {BRIDGE, M5602_XB_SENSOR_TYPE, 0x09, 0x00},
257         {BRIDGE, M5602_XB_LINE_OF_FRAME_H, 0x81, 0x00},
258         {BRIDGE, M5602_XB_PIX_OF_LINE_H, 0x82, 0x00},
259         {BRIDGE, M5602_XB_SIG_INI, 0x01, 0x00},
260         {BRIDGE, M5602_XB_VSYNC_PARA, 0x00, 0x00},
261         {BRIDGE, M5602_XB_VSYNC_PARA, 0x00, 0x00},
262         {BRIDGE, M5602_XB_VSYNC_PARA, 0x00, 0x00},
263         {BRIDGE, M5602_XB_VSYNC_PARA, 0x00, 0x00},
264         {BRIDGE, M5602_XB_VSYNC_PARA, 0x01, 0x00},
265         {BRIDGE, M5602_XB_VSYNC_PARA, 0xe4, 0x00},
266         {BRIDGE, M5602_XB_VSYNC_PARA, 0x00, 0x00},
267         {BRIDGE, M5602_XB_VSYNC_PARA, 0x00, 0x00},
268         {BRIDGE, M5602_XB_SIG_INI, 0x00, 0x00},
269         {BRIDGE, M5602_XB_SIG_INI, 0x02, 0x00},
270         {BRIDGE, M5602_XB_HSYNC_PARA, 0x00, 0x00},
271         {BRIDGE, M5602_XB_HSYNC_PARA, 0x00, 0x00},
272         {BRIDGE, M5602_XB_HSYNC_PARA, 0x02, 0x00},
273         {BRIDGE, M5602_XB_HSYNC_PARA, 0x87, 0x00},
274
275         {BRIDGE, M5602_XB_SIG_INI, 0x00, 0x00},
276         {BRIDGE, M5602_XB_GPIO_DIR, 0x1d, 0x00},
277         {BRIDGE, M5602_XB_GPIO_DAT, 0x08, 0x00},
278         {BRIDGE, M5602_XB_GPIO_EN_H, 0x3f, 0x00},
279         {BRIDGE, M5602_XB_GPIO_DIR_H, 0x3f, 0x00},
280         {BRIDGE, M5602_XB_GPIO_DAT_H, 0x00, 0x00},
281         {BRIDGE, M5602_XB_GPIO_EN_L, 0xff, 0x00},
282         {BRIDGE, M5602_XB_GPIO_DIR_L, 0xff, 0x00},
283         {BRIDGE, M5602_XB_GPIO_DAT_L, 0x00, 0x00},
284         {BRIDGE, M5602_XB_SEN_CLK_DIV, 0xb0, 0x00},
285         {BRIDGE, M5602_XB_SEN_CLK_CTRL, 0x80, 0x00},
286         {BRIDGE, M5602_XB_SEN_CLK_DIV, 0x00, 0x00},
287         {BRIDGE, M5602_XB_SEN_CLK_CTRL, 0xb0, 0x00},
288         {BRIDGE, M5602_XB_ADC_CTRL, 0xc0, 0x00},
289         {BRIDGE, M5602_XB_SENSOR_TYPE, 0x09, 0x00},
290         {BRIDGE, M5602_XB_MCU_CLK_DIV, 0x02, 0x00},
291         {BRIDGE, M5602_XB_MCU_CLK_CTRL, 0xb0, 0x00},
292         {BRIDGE, M5602_XB_SEN_CLK_DIV, 0x00, 0x00},
293         {BRIDGE, M5602_XB_SEN_CLK_CTRL, 0xf0, 0x00},
294         {BRIDGE, M5602_XB_GPIO_DIR, 0x1d, 0x00},
295         {BRIDGE, M5602_XB_GPIO_DAT, 0x1c, 0x00},
296         {BRIDGE, M5602_XB_GPIO_EN_H, 0x06, 0x00},
297         {BRIDGE, M5602_XB_GPIO_DIR_H, 0x06, 0x00},
298         {BRIDGE, M5602_XB_GPIO_DAT_H, 0x00, 0x00},
299         {BRIDGE, M5602_XB_GPIO_EN_L, 0x00, 0x00},
300         {BRIDGE, M5602_XB_I2C_CLK_DIV, 0x20, 0x00},
301
302         {SENSOR, S5K83A_PAGE_MAP, 0x04, 0x00},
303         {SENSOR, 0xaf, 0x01, 0x00},
304         {SENSOR, S5K83A_PAGE_MAP, 0x05, 0x00},
305         /* ff ( init value )is very dark) || 71 and f0 better */
306         {SENSOR, 0x7b, 0xff, 0x00},
307         {SENSOR, S5K83A_PAGE_MAP, 0x05, 0x00},
308         {SENSOR, 0x01, 0x50, 0x00},
309         {SENSOR, 0x12, 0x20, 0x00},
310         {SENSOR, 0x17, 0x40, 0x00},
311         {SENSOR, S5K83A_BRIGHTNESS, 0x0f, 0x00},
312         {SENSOR, 0x1c, 0x00, 0x00},
313         {SENSOR, 0x02, 0x70, 0x00},
314         /* some values like 0x10 give a blue-purple image */
315         {SENSOR, 0x03, 0x0b, 0x00},
316         {SENSOR, 0x04, 0xf0, 0x00},
317         {SENSOR, 0x05, 0x0b, 0x00},
318         {SENSOR, S5K83A_PAGE_MAP, 0x05, 0x00},
319
320         {BRIDGE, M5602_XB_SEN_CLK_DIV, 0x06, 0x00},
321         /* under 80 don't work, highter depend on value */
322         {BRIDGE, M5602_XB_SEN_CLK_CTRL, 0xb0, 0x00},
323
324         {BRIDGE, M5602_XB_ADC_CTRL, 0xc0, 0x00},
325         {BRIDGE, M5602_XB_SENSOR_TYPE, 0x09, 0x00},
326         {BRIDGE, M5602_XB_LINE_OF_FRAME_H, 0x81, 0x00},
327         {BRIDGE, M5602_XB_PIX_OF_LINE_H, 0x82, 0x00},
328         {BRIDGE, M5602_XB_SIG_INI, 0x01, 0x00},
329         {BRIDGE, M5602_XB_VSYNC_PARA, 0x00, 0x00},
330         {BRIDGE, M5602_XB_VSYNC_PARA, 0x00, 0x00},
331         {BRIDGE, M5602_XB_VSYNC_PARA, 0x00, 0x00},
332         {BRIDGE, M5602_XB_VSYNC_PARA, 0x00, 0x00},
333         {BRIDGE, M5602_XB_VSYNC_PARA, 0x01, 0x00},
334         {BRIDGE, M5602_XB_VSYNC_PARA, 0xe4, 0x00},
335         {BRIDGE, M5602_XB_VSYNC_PARA, 0x00, 0x00},
336         {BRIDGE, M5602_XB_VSYNC_PARA, 0x00, 0x00},
337         {BRIDGE, M5602_XB_SIG_INI, 0x02, 0x00},
338         {BRIDGE, M5602_XB_HSYNC_PARA, 0x00, 0x00},
339         {BRIDGE, M5602_XB_HSYNC_PARA, 0x00, 0x00},
340         {BRIDGE, M5602_XB_HSYNC_PARA, 0x02, 0x00},
341         {BRIDGE, M5602_XB_HSYNC_PARA, 0x7f, 0x00},
342
343         {BRIDGE, M5602_XB_SIG_INI, 0x00, 0x00},
344         {BRIDGE, M5602_XB_SEN_CLK_DIV, 0x00, 0x00},
345         {BRIDGE, M5602_XB_SEN_CLK_CTRL, 0xb0, 0x00},
346
347         {SENSOR, S5K83A_PAGE_MAP, 0x05, 0x00},
348         {SENSOR, 0x06, 0x71, 0x00},
349         {SENSOR, 0x07, 0xe8, 0x00},
350         {SENSOR, 0x08, 0x02, 0x00},
351         {SENSOR, 0x09, 0x88, 0x00},
352         {SENSOR, 0x14, 0x00, 0x00},
353         {SENSOR, 0x15, 0x20, 0x00},
354         {SENSOR, 0x19, 0x00, 0x00},
355         {SENSOR, 0x1a, 0x98, 0x00},
356         {SENSOR, 0x0f, 0x02, 0x00},
357         {SENSOR, 0x10, 0xe5, 0x00},
358         {SENSOR, S5K83A_PAGE_MAP, 0x05, 0x00},
359         {SENSOR_LONG, 0x14, 0x00, 0x20},
360         {SENSOR_LONG, 0x0d, 0x00, 0x7d},
361         {SENSOR_LONG, 0x1b, 0x0d, 0x05},
362
363         /* The following sequence is useless after a clean boot
364            but is necessary after resume from suspend */
365         {BRIDGE, M5602_XB_GPIO_DIR, 0x1d, 0x00},
366         {BRIDGE, M5602_XB_GPIO_DAT, 0x08, 0x00},
367         {BRIDGE, M5602_XB_GPIO_EN_H, 0x3f, 0x00},
368         {BRIDGE, M5602_XB_GPIO_DIR_H, 0x3f, 0x00},
369         {BRIDGE, M5602_XB_GPIO_DAT_H, 0x00, 0x00},
370         {BRIDGE, M5602_XB_GPIO_EN_L, 0xff, 0x00},
371         {BRIDGE, M5602_XB_GPIO_DIR_L, 0xff, 0x00},
372         {BRIDGE, M5602_XB_GPIO_DAT_L, 0x00, 0x00},
373         {BRIDGE, M5602_XB_SEN_CLK_DIV, 0xb0, 0x00},
374         {BRIDGE, M5602_XB_SEN_CLK_CTRL, 0x80, 0x00},
375         {BRIDGE, M5602_XB_SEN_CLK_DIV, 0x00, 0x00},
376         {BRIDGE, M5602_XB_SEN_CLK_CTRL, 0xb0, 0x00},
377         {BRIDGE, M5602_XB_ADC_CTRL, 0xc0, 0x00},
378         {BRIDGE, M5602_XB_SENSOR_TYPE, 0x09, 0x00},
379         {BRIDGE, M5602_XB_MCU_CLK_DIV, 0x02, 0x00},
380         {BRIDGE, M5602_XB_MCU_CLK_CTRL, 0xb0, 0x00},
381         {BRIDGE, M5602_XB_SEN_CLK_DIV, 0x00, 0x00},
382         {BRIDGE, M5602_XB_SEN_CLK_CTRL, 0xf0, 0x00},
383         {BRIDGE, M5602_XB_GPIO_DIR, 0x1d, 0x00},
384         {BRIDGE, M5602_XB_GPIO_DAT, 0x1c, 0x00},
385         {BRIDGE, M5602_XB_GPIO_EN_H, 0x06, 0x00},
386         {BRIDGE, M5602_XB_GPIO_DIR_H, 0x06, 0x00},
387         {BRIDGE, M5602_XB_GPIO_DAT_H, 0x00, 0x00},
388         {BRIDGE, M5602_XB_GPIO_EN_L, 0x00, 0x00},
389         {BRIDGE, M5602_XB_I2C_CLK_DIV, 0x20, 0x00},
390
391         {SENSOR, S5K83A_PAGE_MAP, 0x04, 0x00},
392         {SENSOR, 0xaf, 0x01, 0x00},
393         {SENSOR, S5K83A_PAGE_MAP, 0x00, 0x00},
394         {SENSOR, 0x7b, 0xff, 0x00},
395         {SENSOR, S5K83A_PAGE_MAP, 0x05, 0x00},
396         {SENSOR, 0x01, 0x50, 0x00},
397         {SENSOR, 0x12, 0x20, 0x00},
398         {SENSOR, 0x17, 0x40, 0x00},
399         {SENSOR, S5K83A_BRIGHTNESS, 0x0f, 0x00},
400         {SENSOR, 0x1c, 0x00, 0x00},
401         {SENSOR, 0x02, 0x70, 0x00},
402         {SENSOR, 0x03, 0x0b, 0x00},
403         {SENSOR, 0x04, 0xf0, 0x00},
404         {SENSOR, 0x05, 0x0b, 0x00},
405         {SENSOR, S5K83A_PAGE_MAP, 0x05, 0x00},
406
407         {BRIDGE, M5602_XB_SEN_CLK_DIV, 0x06, 0x00},
408         {BRIDGE, M5602_XB_SEN_CLK_CTRL, 0xb0, 0x00},
409         {BRIDGE, M5602_XB_ADC_CTRL, 0xc0, 0x00},
410         {BRIDGE, M5602_XB_SENSOR_TYPE, 0x09, 0x00},
411         {BRIDGE, M5602_XB_LINE_OF_FRAME_H, 0x81, 0x00},
412         {BRIDGE, M5602_XB_PIX_OF_LINE_H, 0x82, 0x00},
413         {BRIDGE, M5602_XB_SIG_INI, 0x01, 0x00},
414         {BRIDGE, M5602_XB_VSYNC_PARA, 0x00, 0x00},
415         {BRIDGE, M5602_XB_VSYNC_PARA, 0x00, 0x00},
416         {BRIDGE, M5602_XB_VSYNC_PARA, 0x00, 0x00},
417         {BRIDGE, M5602_XB_VSYNC_PARA, 0x00, 0x00},
418         {BRIDGE, M5602_XB_VSYNC_PARA, 0x01, 0x00},
419         {BRIDGE, M5602_XB_VSYNC_PARA, 0xe4, 0x00},
420         {BRIDGE, M5602_XB_VSYNC_PARA, 0x00, 0x00},
421         {BRIDGE, M5602_XB_VSYNC_PARA, 0x00, 0x00},
422         {BRIDGE, M5602_XB_SIG_INI, 0x00, 0x00},
423         {BRIDGE, M5602_XB_SIG_INI, 0x02, 0x00},
424         {BRIDGE, M5602_XB_HSYNC_PARA, 0x00, 0x00},
425         {BRIDGE, M5602_XB_HSYNC_PARA, 0x00, 0x00},
426         {BRIDGE, M5602_XB_HSYNC_PARA, 0x02, 0x00},
427         {BRIDGE, M5602_XB_HSYNC_PARA, 0x7f, 0x00},
428         {BRIDGE, M5602_XB_SIG_INI, 0x00, 0x00},
429         {BRIDGE, M5602_XB_SEN_CLK_DIV, 0x00, 0x00},
430         {BRIDGE, M5602_XB_SEN_CLK_CTRL, 0xb0, 0x00},
431
432         {SENSOR, S5K83A_PAGE_MAP, 0x05, 0x00},
433         {SENSOR, 0x06, 0x71, 0x00},
434         {SENSOR, 0x07, 0xe8, 0x00},
435         {SENSOR, 0x08, 0x02, 0x00},
436         {SENSOR, 0x09, 0x88, 0x00},
437         {SENSOR, 0x14, 0x00, 0x00},
438         {SENSOR, 0x15, 0x20, 0x00},
439         {SENSOR, 0x19, 0x00, 0x00},
440         {SENSOR, 0x1a, 0x98, 0x00},
441         {SENSOR, 0x0f, 0x02, 0x00},
442
443         {SENSOR, 0x10, 0xe5, 0x00},
444         {SENSOR, S5K83A_PAGE_MAP, 0x05, 0x00},
445         {SENSOR_LONG, 0x14, 0x00, 0x20},
446         {SENSOR_LONG, 0x0d, 0x00, 0x7d},
447         {SENSOR_LONG, 0x1b, 0x0d, 0x05},
448
449         /* normal colors
450            (this is value after boot, but after tries can be different) */
451         {SENSOR, 0x00, 0x06, 0x00},
452
453         /* set default brightness */
454         {SENSOR_LONG, 0x14, 0x00, 0x20},
455         {SENSOR_LONG, 0x0d, 0x01, 0x00},
456         {SENSOR_LONG, 0x1b, S5K83A_DEFAULT_BRIGHTNESS >> 3,
457                             S5K83A_DEFAULT_BRIGHTNESS >> 1},
458
459         /* set default whiteness */
460         {SENSOR, S5K83A_WHITENESS, S5K83A_DEFAULT_WHITENESS, 0x00},
461
462         /* set default gain */
463         {SENSOR_LONG, 0x18, 0x00, S5K83A_DEFAULT_GAIN},
464
465         /* set default flip */
466         {SENSOR, S5K83A_PAGE_MAP, 0x05, 0x00},
467         {SENSOR, S5K83A_FLIP, 0x00 | S5K83A_FLIP_MASK, 0x00},
468         {SENSOR, S5K83A_HFLIP_TUNE, 0x0b, 0x00},
469         {SENSOR, S5K83A_VFLIP_TUNE, 0x0a, 0x00}
470
471 };
472
473 #endif