diff options
author | Erik Andren <erik.andren@gmail.com> | 2008-10-01 03:51:53 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2008-10-12 07:37:13 -0400 |
commit | c109f8168f259ea1f1ab7009c6b99dbe8ea0e2b2 (patch) | |
tree | 6dac06f9756469284dcc8c6dccb88ecdd4b10f9c /drivers/media/video/gspca/m5602/m5602_ov9650.h | |
parent | a3a58467db3c90a1e289970ef319c7abb90be617 (diff) |
V4L/DVB (9091): gspca: Subdriver m5602 (ALi) added.
This patch adds support for the ALi m5602 usb bridge and is based on
the gspca framework.
It contains code for communicating with 5 different sensors:
OmniVision OV9650, Pixel Plus PO1030, Samsung S5K83A, S5K4AA and
finally Micron MT9M111.
Signed-off-by: Erik Andren <erik.andren@gmail.com>
Signed-off-by: Jean-Francois Moine <moinejf@free.fr>
[mchehab@redhat.com: fix m5602/Makefile]
[mchehab@redhat.com: extern debug caused conflicts. Renamed to m5602_debug]
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/gspca/m5602/m5602_ov9650.h')
-rw-r--r-- | drivers/media/video/gspca/m5602/m5602_ov9650.h | 501 |
1 files changed, 501 insertions, 0 deletions
diff --git a/drivers/media/video/gspca/m5602/m5602_ov9650.h b/drivers/media/video/gspca/m5602/m5602_ov9650.h new file mode 100644 index 00000000000..486ea337a8b --- /dev/null +++ b/drivers/media/video/gspca/m5602/m5602_ov9650.h | |||
@@ -0,0 +1,501 @@ | |||
1 | /* | ||
2 | * Driver for the ov9650 sensor | ||
3 | * | ||
4 | * Copyright (C) 2008 Erik Andren | ||
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_OV9650_H_ | ||
20 | #define M5602_OV9650_H_ | ||
21 | |||
22 | #include <linux/dmi.h> | ||
23 | |||
24 | #include "m5602_sensor.h" | ||
25 | |||
26 | /*****************************************************************************/ | ||
27 | |||
28 | #define OV9650_GAIN 0x00 | ||
29 | #define OV9650_BLUE 0x01 | ||
30 | #define OV9650_RED 0x02 | ||
31 | #define OV9650_VREF 0x03 | ||
32 | #define OV9650_COM1 0x04 | ||
33 | #define OV9650_BAVE 0x05 | ||
34 | #define OV9650_GEAVE 0x06 | ||
35 | #define OV9650_RSVD7 0x07 | ||
36 | #define OV9650_PID 0x0a | ||
37 | #define OV9650_VER 0x0b | ||
38 | #define OV9650_COM3 0x0c | ||
39 | #define OV9650_COM5 0x0e | ||
40 | #define OV9650_COM6 0x0f | ||
41 | #define OV9650_AECH 0x10 | ||
42 | #define OV9650_CLKRC 0x11 | ||
43 | #define OV9650_COM7 0x12 | ||
44 | #define OV9650_COM8 0x13 | ||
45 | #define OV9650_COM9 0x14 | ||
46 | #define OV9650_COM10 0x15 | ||
47 | #define OV9650_RSVD16 0x16 | ||
48 | #define OV9650_HSTART 0x17 | ||
49 | #define OV9650_HSTOP 0x18 | ||
50 | #define OV9650_VSTRT 0x19 | ||
51 | #define OV9650_VSTOP 0x1a | ||
52 | #define OV9650_PSHFT 0x1b | ||
53 | #define OV9650_MVFP 0x1e | ||
54 | #define OV9650_AEW 0x24 | ||
55 | #define OV9650_AEB 0x25 | ||
56 | #define OV9650_VPT 0x26 | ||
57 | #define OV9650_BBIAS 0x27 | ||
58 | #define OV9650_GbBIAS 0x28 | ||
59 | #define OV9650_Gr_COM 0x29 | ||
60 | #define OV9650_RBIAS 0x2c | ||
61 | #define OV9650_HREF 0x32 | ||
62 | #define OV9650_CHLF 0x33 | ||
63 | #define OV9650_ARBLM 0x34 | ||
64 | #define OV9650_RSVD35 0x35 | ||
65 | #define OV9650_RSVD36 0x36 | ||
66 | #define OV9650_ADC 0x37 | ||
67 | #define OV9650_ACOM38 0x38 | ||
68 | #define OV9650_OFON 0x39 | ||
69 | #define OV9650_TSLB 0x3a | ||
70 | #define OV9650_COM12 0x3c | ||
71 | #define OV9650_COM13 0x3d | ||
72 | #define OV9650_COM15 0x40 | ||
73 | #define OV9650_COM16 0x41 | ||
74 | #define OV9650_LCC1 0x62 | ||
75 | #define OV9650_LCC2 0x63 | ||
76 | #define OV9650_LCC3 0x64 | ||
77 | #define OV9650_LCC4 0x65 | ||
78 | #define OV9650_LCC5 0x66 | ||
79 | #define OV9650_HV 0x69 | ||
80 | #define OV9650_DBLV 0x6b | ||
81 | #define OV9650_COM21 0x8b | ||
82 | #define OV9650_COM22 0x8c | ||
83 | #define OV9650_COM24 0x8e | ||
84 | #define OV9650_DBLC1 0x8f | ||
85 | #define OV9650_RSVD94 0x94 | ||
86 | #define OV9650_RSVD95 0x95 | ||
87 | #define OV9650_RSVD96 0x96 | ||
88 | #define OV9650_LCCFB 0x9d | ||
89 | #define OV9650_LCCFR 0x9e | ||
90 | #define OV9650_AECHM 0xa1 | ||
91 | #define OV9650_COM26 0xa5 | ||
92 | #define OV9650_ACOMA8 0xa8 | ||
93 | #define OV9650_ACOMA9 0xa9 | ||
94 | |||
95 | #define OV9650_REGISTER_RESET (1 << 7) | ||
96 | #define OV9650_VGA_SELECT (1 << 6) | ||
97 | #define OV9650_RGB_SELECT (1 << 2) | ||
98 | #define OV9650_RAW_RGB_SELECT (1 << 0) | ||
99 | |||
100 | #define OV9650_FAST_AGC_AEC (1 << 7) | ||
101 | #define OV9650_AEC_UNLIM_STEP_SIZE (1 << 6) | ||
102 | #define OV9650_BANDING (1 << 5) | ||
103 | #define OV9650_AGC_EN (1 << 2) | ||
104 | #define OV9650_AWB_EN (1 << 1) | ||
105 | #define OV9650_AEC_EN (1 << 0) | ||
106 | |||
107 | #define OV9650_VARIOPIXEL (1 << 2) | ||
108 | #define OV9650_SYSTEM_CLK_SEL (1 << 7) | ||
109 | #define OV9650_SLAM_MODE (1 << 4) | ||
110 | |||
111 | #define OV9650_VFLIP (1 << 4) | ||
112 | #define OV9650_HFLIP (1 << 5) | ||
113 | |||
114 | #define GAIN_DEFAULT 0x14 | ||
115 | #define RED_GAIN_DEFAULT 0x70 | ||
116 | #define BLUE_GAIN_DEFAULT 0x20 | ||
117 | #define EXPOSURE_DEFAULT 0x5003 | ||
118 | |||
119 | /*****************************************************************************/ | ||
120 | |||
121 | /* Kernel module parameters */ | ||
122 | extern int force_sensor; | ||
123 | extern int dump_sensor; | ||
124 | extern unsigned int m5602_debug; | ||
125 | |||
126 | int ov9650_probe(struct sd *sd); | ||
127 | int ov9650_init(struct sd *sd); | ||
128 | int ov9650_power_down(struct sd *sd); | ||
129 | |||
130 | int ov9650_read_sensor(struct sd *sd, const u8 address, | ||
131 | u8 *i2c_data, const u8 len); | ||
132 | int ov9650_write_sensor(struct sd *sd, const u8 address, | ||
133 | u8 *i2c_data, const u8 len); | ||
134 | |||
135 | void ov9650_dump_registers(struct sd *sd); | ||
136 | |||
137 | int ov9650_set_exposure(struct gspca_dev *gspca_dev, __s32 val); | ||
138 | int ov9650_get_exposure(struct gspca_dev *gspca_dev, __s32 *val); | ||
139 | int ov9650_get_gain(struct gspca_dev *gspca_dev, __s32 *val); | ||
140 | int ov9650_set_gain(struct gspca_dev *gspca_dev, __s32 val); | ||
141 | int ov9650_get_red_balance(struct gspca_dev *gspca_dev, __s32 *val); | ||
142 | int ov9650_set_red_balance(struct gspca_dev *gspca_dev, __s32 val); | ||
143 | int ov9650_get_blue_balance(struct gspca_dev *gspca_dev, __s32 *val); | ||
144 | int ov9650_set_blue_balance(struct gspca_dev *gspca_dev, __s32 val); | ||
145 | int ov9650_get_hflip(struct gspca_dev *gspca_dev, __s32 *val); | ||
146 | int ov9650_set_hflip(struct gspca_dev *gspca_dev, __s32 val); | ||
147 | int ov9650_get_vflip(struct gspca_dev *gspca_dev, __s32 *val); | ||
148 | int ov9650_set_vflip(struct gspca_dev *gspca_dev, __s32 val); | ||
149 | int ov9650_get_brightness(struct gspca_dev *gspca_dev, __s32 *val); | ||
150 | int ov9650_set_brightness(struct gspca_dev *gspca_dev, __s32 val); | ||
151 | int ov9650_get_auto_white_balance(struct gspca_dev *gspca_dev, __s32 *val); | ||
152 | int ov9650_set_auto_white_balance(struct gspca_dev *gspca_dev, __s32 val); | ||
153 | int ov9650_get_auto_gain(struct gspca_dev *gspca_dev, __s32 *val); | ||
154 | int ov9650_set_auto_gain(struct gspca_dev *gspca_dev, __s32 val); | ||
155 | |||
156 | static struct m5602_sensor ov9650 = { | ||
157 | .name = "OV9650", | ||
158 | .i2c_slave_id = 0x60, | ||
159 | .probe = ov9650_probe, | ||
160 | .init = ov9650_init, | ||
161 | .power_down = ov9650_power_down, | ||
162 | .read_sensor = ov9650_read_sensor, | ||
163 | .write_sensor = ov9650_write_sensor, | ||
164 | |||
165 | .nctrls = 8, | ||
166 | .ctrls = { | ||
167 | { | ||
168 | { | ||
169 | .id = V4L2_CID_EXPOSURE, | ||
170 | .type = V4L2_CTRL_TYPE_INTEGER, | ||
171 | .name = "exposure", | ||
172 | .minimum = 0x00, | ||
173 | .maximum = 0xffff, | ||
174 | .step = 0x1, | ||
175 | .default_value = EXPOSURE_DEFAULT, | ||
176 | .flags = V4L2_CTRL_FLAG_SLIDER | ||
177 | }, | ||
178 | .set = ov9650_set_exposure, | ||
179 | .get = ov9650_get_exposure | ||
180 | }, { | ||
181 | { | ||
182 | .id = V4L2_CID_GAIN, | ||
183 | .type = V4L2_CTRL_TYPE_INTEGER, | ||
184 | .name = "gain", | ||
185 | .minimum = 0x00, | ||
186 | .maximum = 0x3ff, | ||
187 | .step = 0x1, | ||
188 | .default_value = GAIN_DEFAULT, | ||
189 | .flags = V4L2_CTRL_FLAG_SLIDER | ||
190 | }, | ||
191 | .set = ov9650_set_gain, | ||
192 | .get = ov9650_get_gain | ||
193 | }, { | ||
194 | { | ||
195 | .type = V4L2_CTRL_TYPE_INTEGER, | ||
196 | .name = "red balance", | ||
197 | .minimum = 0x00, | ||
198 | .maximum = 0xff, | ||
199 | .step = 0x1, | ||
200 | .default_value = RED_GAIN_DEFAULT, | ||
201 | .flags = V4L2_CTRL_FLAG_SLIDER | ||
202 | }, | ||
203 | .set = ov9650_set_red_balance, | ||
204 | .get = ov9650_get_red_balance | ||
205 | }, { | ||
206 | { | ||
207 | .type = V4L2_CTRL_TYPE_INTEGER, | ||
208 | .name = "blue balance", | ||
209 | .minimum = 0x00, | ||
210 | .maximum = 0xff, | ||
211 | .step = 0x1, | ||
212 | .default_value = BLUE_GAIN_DEFAULT, | ||
213 | .flags = V4L2_CTRL_FLAG_SLIDER | ||
214 | }, | ||
215 | .set = ov9650_set_blue_balance, | ||
216 | .get = ov9650_get_blue_balance | ||
217 | }, { | ||
218 | { | ||
219 | .id = V4L2_CID_HFLIP, | ||
220 | .type = V4L2_CTRL_TYPE_BOOLEAN, | ||
221 | .name = "horizontal flip", | ||
222 | .minimum = 0, | ||
223 | .maximum = 1, | ||
224 | .step = 1, | ||
225 | .default_value = 0 | ||
226 | }, | ||
227 | .set = ov9650_set_hflip, | ||
228 | .get = ov9650_get_hflip | ||
229 | }, { | ||
230 | { | ||
231 | .id = V4L2_CID_VFLIP, | ||
232 | .type = V4L2_CTRL_TYPE_BOOLEAN, | ||
233 | .name = "vertical flip", | ||
234 | .minimum = 0, | ||
235 | .maximum = 1, | ||
236 | .step = 1, | ||
237 | .default_value = 0 | ||
238 | }, | ||
239 | .set = ov9650_set_vflip, | ||
240 | .get = ov9650_get_vflip | ||
241 | }, { | ||
242 | { | ||
243 | .id = V4L2_CID_AUTO_WHITE_BALANCE, | ||
244 | .type = V4L2_CTRL_TYPE_BOOLEAN, | ||
245 | .name = "auto white balance", | ||
246 | .minimum = 0, | ||
247 | .maximum = 1, | ||
248 | .step = 1, | ||
249 | .default_value = 0 | ||
250 | }, | ||
251 | .set = ov9650_set_auto_white_balance, | ||
252 | .get = ov9650_get_auto_white_balance | ||
253 | }, { | ||
254 | { | ||
255 | .id = V4L2_CID_AUTOGAIN, | ||
256 | .type = V4L2_CTRL_TYPE_BOOLEAN, | ||
257 | .name = "auto gain control", | ||
258 | .minimum = 0, | ||
259 | .maximum = 1, | ||
260 | .step = 1, | ||
261 | .default_value = 0 | ||
262 | }, | ||
263 | .set = ov9650_set_auto_gain, | ||
264 | .get = ov9650_get_auto_gain | ||
265 | } | ||
266 | }, | ||
267 | |||
268 | .nmodes = 1, | ||
269 | .modes = { | ||
270 | { | ||
271 | M5602_DEFAULT_FRAME_WIDTH, | ||
272 | M5602_DEFAULT_FRAME_HEIGHT, | ||
273 | V4L2_PIX_FMT_SBGGR8, | ||
274 | V4L2_FIELD_NONE, | ||
275 | .sizeimage = | ||
276 | M5602_DEFAULT_FRAME_WIDTH * M5602_DEFAULT_FRAME_HEIGHT, | ||
277 | .bytesperline = M5602_DEFAULT_FRAME_WIDTH, | ||
278 | .colorspace = V4L2_COLORSPACE_SRGB, | ||
279 | .priv = 1 | ||
280 | } | ||
281 | } | ||
282 | }; | ||
283 | |||
284 | static const unsigned char preinit_ov9650[][3] = | ||
285 | { | ||
286 | /* [INITCAM] */ | ||
287 | {BRIDGE, M5602_XB_MCU_CLK_DIV, 0x02}, | ||
288 | {BRIDGE, M5602_XB_MCU_CLK_CTRL, 0xb0}, | ||
289 | {BRIDGE, M5602_XB_SEN_CLK_DIV, 0x00}, | ||
290 | {BRIDGE, M5602_XB_SEN_CLK_CTRL, 0xb0}, | ||
291 | {BRIDGE, M5602_XB_ADC_CTRL, 0xc0}, | ||
292 | {BRIDGE, M5602_XB_SENSOR_CTRL, 0x00}, | ||
293 | |||
294 | {BRIDGE, M5602_XB_SENSOR_TYPE, 0x08}, | ||
295 | {BRIDGE, M5602_XB_GPIO_DIR, 0x05}, | ||
296 | {BRIDGE, M5602_XB_GPIO_DAT, 0x04}, | ||
297 | {BRIDGE, M5602_XB_GPIO_EN_H, 0x06}, | ||
298 | {BRIDGE, M5602_XB_GPIO_DIR_H, 0x06}, | ||
299 | {BRIDGE, M5602_XB_GPIO_DAT_H, 0x00}, | ||
300 | {BRIDGE, M5602_XB_GPIO_DAT, 0x00}, | ||
301 | {BRIDGE, M5602_XB_I2C_CLK_DIV, 0x0a}, | ||
302 | /* Reset chip */ | ||
303 | {SENSOR, OV9650_COM7, OV9650_REGISTER_RESET}, | ||
304 | /* Enable double clock */ | ||
305 | {SENSOR, OV9650_CLKRC, 0x80}, | ||
306 | /* Do something out of spec with the power */ | ||
307 | {SENSOR, OV9650_OFON, 0x40} | ||
308 | }; | ||
309 | |||
310 | static const unsigned char init_ov9650[][3] = | ||
311 | { | ||
312 | /* [INITCAM] */ | ||
313 | {BRIDGE, M5602_XB_MCU_CLK_DIV, 0x02}, | ||
314 | {BRIDGE, M5602_XB_MCU_CLK_CTRL, 0xb0}, | ||
315 | {BRIDGE, M5602_XB_SEN_CLK_DIV, 0x00}, | ||
316 | {BRIDGE, M5602_XB_SEN_CLK_CTRL, 0xb0}, | ||
317 | {BRIDGE, M5602_XB_ADC_CTRL, 0xc0}, | ||
318 | {BRIDGE, M5602_XB_SENSOR_CTRL, 0x00}, | ||
319 | |||
320 | {BRIDGE, M5602_XB_SENSOR_TYPE, 0x08}, | ||
321 | {BRIDGE, M5602_XB_GPIO_DIR, 0x05}, | ||
322 | {BRIDGE, M5602_XB_GPIO_DAT, 0x04}, | ||
323 | {BRIDGE, M5602_XB_GPIO_EN_H, 0x06}, | ||
324 | {BRIDGE, M5602_XB_GPIO_DIR_H, 0x06}, | ||
325 | {BRIDGE, M5602_XB_GPIO_DAT_H, 0x00}, | ||
326 | {BRIDGE, M5602_XB_GPIO_DAT, 0x00}, | ||
327 | {BRIDGE, M5602_XB_I2C_CLK_DIV, 0x0a}, | ||
328 | /* Reset chip */ | ||
329 | {SENSOR, OV9650_COM7, OV9650_REGISTER_RESET}, | ||
330 | /* Enable double clock */ | ||
331 | {SENSOR, OV9650_CLKRC, 0x80}, | ||
332 | /* Do something out of spec with the power */ | ||
333 | {SENSOR, OV9650_OFON, 0x40}, | ||
334 | |||
335 | /* Set QQVGA */ | ||
336 | {SENSOR, OV9650_COM1, 0x20}, | ||
337 | /* Set fast AGC/AEC algorithm with unlimited step size */ | ||
338 | {SENSOR, OV9650_COM8, OV9650_FAST_AGC_AEC | | ||
339 | OV9650_AEC_UNLIM_STEP_SIZE | | ||
340 | OV9650_AWB_EN | OV9650_AGC_EN}, | ||
341 | |||
342 | {SENSOR, OV9650_CHLF, 0x10}, | ||
343 | {SENSOR, OV9650_ARBLM, 0xbf}, | ||
344 | {SENSOR, OV9650_ACOM38, 0x81}, | ||
345 | /* Turn off color matrix coefficient double option */ | ||
346 | {SENSOR, OV9650_COM16, 0x00}, | ||
347 | /* Enable color matrix for RGB/YUV, Delay Y channel, | ||
348 | set output Y/UV delay to 1 */ | ||
349 | {SENSOR, OV9650_COM13, 0x19}, | ||
350 | /* Enable digital BLC, Set output mode to U Y V Y */ | ||
351 | {SENSOR, OV9650_TSLB, 0x0c}, | ||
352 | /* Limit the AGC/AEC stable upper region */ | ||
353 | {SENSOR, OV9650_COM24, 0x00}, | ||
354 | /* Enable HREF and some out of spec things */ | ||
355 | {SENSOR, OV9650_COM12, 0x73}, | ||
356 | /* Set all DBLC offset signs to positive and | ||
357 | do some out of spec stuff */ | ||
358 | {SENSOR, OV9650_DBLC1, 0xdf}, | ||
359 | {SENSOR, OV9650_COM21, 0x06}, | ||
360 | {SENSOR, OV9650_RSVD35, 0x91}, | ||
361 | /* Necessary, no camera stream without it */ | ||
362 | {SENSOR, OV9650_RSVD16, 0x06}, | ||
363 | {SENSOR, OV9650_RSVD94, 0x99}, | ||
364 | {SENSOR, OV9650_RSVD95, 0x99}, | ||
365 | {SENSOR, OV9650_RSVD96, 0x04}, | ||
366 | /* Enable full range output */ | ||
367 | {SENSOR, OV9650_COM15, 0x0}, | ||
368 | /* Enable HREF at optical black, enable ADBLC bias, | ||
369 | enable ADBLC, reset timings at format change */ | ||
370 | {SENSOR, OV9650_COM6, 0x4b}, | ||
371 | /* Subtract 32 from the B channel bias */ | ||
372 | {SENSOR, OV9650_BBIAS, 0xa0}, | ||
373 | /* Subtract 32 from the Gb channel bias */ | ||
374 | {SENSOR, OV9650_GbBIAS, 0xa0}, | ||
375 | /* Do not bypass the analog BLC and to some out of spec stuff */ | ||
376 | {SENSOR, OV9650_Gr_COM, 0x00}, | ||
377 | /* Subtract 32 from the R channel bias */ | ||
378 | {SENSOR, OV9650_RBIAS, 0xa0}, | ||
379 | /* Subtract 32 from the R channel bias */ | ||
380 | {SENSOR, OV9650_RBIAS, 0x0}, | ||
381 | {SENSOR, OV9650_COM26, 0x80}, | ||
382 | {SENSOR, OV9650_ACOMA9, 0x98}, | ||
383 | /* Set the AGC/AEC stable region upper limit */ | ||
384 | {SENSOR, OV9650_AEW, 0x68}, | ||
385 | /* Set the AGC/AEC stable region lower limit */ | ||
386 | {SENSOR, OV9650_AEB, 0x5c}, | ||
387 | /* Set the high and low limit nibbles to 3 */ | ||
388 | {SENSOR, OV9650_VPT, 0xc3}, | ||
389 | /* Set the Automatic Gain Ceiling (AGC) to 128x, | ||
390 | drop VSYNC at frame drop, | ||
391 | limit exposure timing, | ||
392 | drop frame when the AEC step is larger than the exposure gap */ | ||
393 | {SENSOR, OV9650_COM9, 0x6e}, | ||
394 | /* Set VSYNC negative, Set RESET to SLHS (slave mode horizontal sync) | ||
395 | and set PWDN to SLVS (slave mode vertical sync) */ | ||
396 | {SENSOR, OV9650_COM10, 0x42}, | ||
397 | /* Set horizontal column start high to default value */ | ||
398 | {SENSOR, OV9650_HSTART, 0x1a}, | ||
399 | /* Set horizontal column end */ | ||
400 | {SENSOR, OV9650_HSTOP, 0xbf}, | ||
401 | /* Complementing register to the two writes above */ | ||
402 | {SENSOR, OV9650_HREF, 0xb2}, | ||
403 | /* Set vertical row start high bits */ | ||
404 | {SENSOR, OV9650_VSTRT, 0x02}, | ||
405 | /* Set vertical row end low bits */ | ||
406 | {SENSOR, OV9650_VSTOP, 0x7e}, | ||
407 | /* Set complementing vertical frame control */ | ||
408 | {SENSOR, OV9650_VREF, 0x10}, | ||
409 | /* Set raw RGB output format with VGA resolution */ | ||
410 | {SENSOR, OV9650_COM7, OV9650_VGA_SELECT | | ||
411 | OV9650_RGB_SELECT | | ||
412 | OV9650_RAW_RGB_SELECT}, | ||
413 | {SENSOR, OV9650_ADC, 0x04}, | ||
414 | {SENSOR, OV9650_HV, 0x40}, | ||
415 | /* Enable denoise, and white-pixel erase */ | ||
416 | {SENSOR, OV9650_COM22, 0x23}, | ||
417 | |||
418 | /* Set the high bits of the exposure value */ | ||
419 | {SENSOR, OV9650_AECH, ((EXPOSURE_DEFAULT & 0xff00) >> 8)}, | ||
420 | |||
421 | /* Set the low bits of the exposure value */ | ||
422 | {SENSOR, OV9650_COM1, (EXPOSURE_DEFAULT & 0xff)}, | ||
423 | {SENSOR, OV9650_GAIN, GAIN_DEFAULT}, | ||
424 | {SENSOR, OV9650_BLUE, BLUE_GAIN_DEFAULT}, | ||
425 | {SENSOR, OV9650_RED, RED_GAIN_DEFAULT}, | ||
426 | |||
427 | {SENSOR, OV9650_COM3, OV9650_VARIOPIXEL}, | ||
428 | {SENSOR, OV9650_COM5, OV9650_SYSTEM_CLK_SEL}, | ||
429 | |||
430 | {BRIDGE, M5602_XB_LINE_OF_FRAME_H, 0x82}, | ||
431 | {BRIDGE, M5602_XB_LINE_OF_FRAME_L, 0x00}, | ||
432 | {BRIDGE, M5602_XB_PIX_OF_LINE_H, 0x82}, | ||
433 | {BRIDGE, M5602_XB_PIX_OF_LINE_L, 0x00}, | ||
434 | {BRIDGE, M5602_XB_SIG_INI, 0x01}, | ||
435 | {BRIDGE, M5602_XB_VSYNC_PARA, 0x00}, | ||
436 | {BRIDGE, M5602_XB_VSYNC_PARA, 0x09}, | ||
437 | {BRIDGE, M5602_XB_VSYNC_PARA, 0x00}, | ||
438 | {BRIDGE, M5602_XB_VSYNC_PARA, 0x01}, | ||
439 | {BRIDGE, M5602_XB_VSYNC_PARA, 0xe0}, | ||
440 | {BRIDGE, M5602_XB_VSYNC_PARA, 0x00}, | ||
441 | {BRIDGE, M5602_XB_HSYNC_PARA, 0x00}, | ||
442 | {BRIDGE, M5602_XB_HSYNC_PARA, 0x5e}, | ||
443 | {BRIDGE, M5602_XB_HSYNC_PARA, 0x02}, | ||
444 | {BRIDGE, M5602_XB_HSYNC_PARA, 0xde} | ||
445 | }; | ||
446 | |||
447 | static const unsigned char power_down_ov9650[][3] = | ||
448 | { | ||
449 | {BRIDGE, M5602_XB_SEN_CLK_DIV, 0x04}, | ||
450 | {BRIDGE, M5602_XB_SEN_CLK_CTRL, 0xb0}, | ||
451 | {SENSOR, OV9650_COM7, 0x80}, | ||
452 | {SENSOR, OV9650_OFON, 0xf4}, | ||
453 | {SENSOR, OV9650_MVFP, 0x80}, | ||
454 | {SENSOR, OV9650_DBLV, 0x3f}, | ||
455 | {SENSOR, OV9650_RSVD36, 0x49}, | ||
456 | {SENSOR, OV9650_COM7, 0x05}, | ||
457 | |||
458 | {BRIDGE, M5602_XB_GPIO_DIR, 0x05}, | ||
459 | {BRIDGE, M5602_XB_GPIO_DAT, 0x04}, | ||
460 | {BRIDGE, M5602_XB_GPIO_EN_H, 0x06}, | ||
461 | {BRIDGE, M5602_XB_GPIO_EN_L, 0x06}, | ||
462 | {BRIDGE, M5602_XB_GPIO_DAT_H, 0x02}, | ||
463 | {BRIDGE, M5602_XB_SEN_CLK_DIV, 0x04}, | ||
464 | {BRIDGE, M5602_XB_SEN_CLK_CTRL, 0xb0} | ||
465 | }; | ||
466 | |||
467 | /* Vertically and horizontally flips the image if matched, needed for machines | ||
468 | where the sensor is mounted upside down */ | ||
469 | static const struct dmi_system_id ov9650_flip_dmi_table[] = { | ||
470 | { | ||
471 | .ident = "ASUS A6VC", | ||
472 | .matches = { | ||
473 | DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK Computer Inc."), | ||
474 | DMI_MATCH(DMI_PRODUCT_NAME, "A6VC") | ||
475 | } | ||
476 | }, | ||
477 | { | ||
478 | .ident = "ASUS A6VM", | ||
479 | .matches = { | ||
480 | DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK Computer Inc."), | ||
481 | DMI_MATCH(DMI_PRODUCT_NAME, "A6VM") | ||
482 | } | ||
483 | }, | ||
484 | { | ||
485 | .ident = "ASUS A6JC", | ||
486 | .matches = { | ||
487 | DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK Computer Inc."), | ||
488 | DMI_MATCH(DMI_PRODUCT_NAME, "A6JC") | ||
489 | } | ||
490 | }, | ||
491 | { | ||
492 | .ident = "ASUS A6Kt", | ||
493 | .matches = { | ||
494 | DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK Computer Inc."), | ||
495 | DMI_MATCH(DMI_PRODUCT_NAME, "A6Kt") | ||
496 | } | ||
497 | }, | ||
498 | { } | ||
499 | }; | ||
500 | |||
501 | #endif | ||