Commit | Line | Data |
---|---|---|
6a7eba24 | 1 | /* |
5b34e3e4 | 2 | * Sonix sn9c102p sn9c105 sn9c120 (jpeg) subdriver |
d5aa3856 | 3 | * |
27c6f9e5 | 4 | * Copyright (C) 2009-2010 Jean-François Moine <http://moinejf.free.fr> |
5b34e3e4 | 5 | * Copyright (C) 2005 Michel Xhaard mxhaard@magic.fr |
6a7eba24 JFM |
6 | * |
7 | * This program is free software; you can redistribute it and/or modify | |
8 | * it under the terms of the GNU General Public License as published by | |
9 | * the Free Software Foundation; either version 2 of the License, or | |
10 | * any later version. | |
11 | * | |
12 | * This program is distributed in the hope that it will be useful, | |
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
15 | * GNU General Public License for more details. | |
16 | * | |
17 | * You should have received a copy of the GNU General Public License | |
18 | * along with this program; if not, write to the Free Software | |
19 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
20 | */ | |
21 | ||
22 | #define MODULE_NAME "sonixj" | |
23 | ||
9712a8be | 24 | #include <linux/input.h> |
6a7eba24 JFM |
25 | #include "gspca.h" |
26 | #include "jpeg.h" | |
27 | ||
27c6f9e5 | 28 | MODULE_AUTHOR("Jean-François Moine <http://moinejf.free.fr>"); |
6a7eba24 JFM |
29 | MODULE_DESCRIPTION("GSPCA/SONIX JPEG USB Camera Driver"); |
30 | MODULE_LICENSE("GPL"); | |
31 | ||
3afef85b JFM |
32 | static int starcam; |
33 | ||
72b667eb JFM |
34 | /* controls */ |
35 | enum e_ctrl { | |
36 | BRIGHTNESS, | |
37 | CONTRAST, | |
38 | COLORS, | |
39 | BLUE, | |
40 | RED, | |
41 | GAMMA, | |
42 | AUTOGAIN, | |
76ad3b68 | 43 | HFLIP, |
72b667eb JFM |
44 | VFLIP, |
45 | SHARPNESS, | |
3afef85b | 46 | ILLUM, |
72b667eb JFM |
47 | FREQ, |
48 | NCTRLS /* number of controls */ | |
49 | }; | |
50 | ||
6a7eba24 JFM |
51 | /* specific webcam descriptor */ |
52 | struct sd { | |
53 | struct gspca_dev gspca_dev; /* !! must be the first item */ | |
54 | ||
72b667eb JFM |
55 | struct gspca_ctrl ctrls[NCTRLS]; |
56 | ||
cebf3b67 | 57 | atomic_t avg_lum; |
98819187 JFM |
58 | u32 exposure; |
59 | ||
a4a3076f JFM |
60 | s8 short_mark; |
61 | ||
71cb2764 | 62 | u8 quality; /* image quality */ |
77ac0baf JFM |
63 | #define QUALITY_MIN 60 |
64 | #define QUALITY_MAX 95 | |
65 | #define QUALITY_DEF 80 | |
71cb2764 JFM |
66 | u8 jpegqual; /* webcam quality */ |
67 | ||
0e4d413a JFM |
68 | u8 reg01; |
69 | u8 reg17; | |
71cb2764 | 70 | u8 reg18; |
c6c14330 | 71 | u8 flags; |
6a7eba24 | 72 | |
98819187 | 73 | s8 ag_cnt; |
6a7eba24 JFM |
74 | #define AG_CNT_START 13 |
75 | ||
98819187 | 76 | u8 bridge; |
3647fea8 HG |
77 | #define BRIDGE_SN9C102P 0 |
78 | #define BRIDGE_SN9C105 1 | |
79 | #define BRIDGE_SN9C110 2 | |
80 | #define BRIDGE_SN9C120 3 | |
98819187 | 81 | u8 sensor; /* Type of image sensor chip */ |
11ce884a JFM |
82 | u8 i2c_addr; |
83 | ||
84 | u8 jpeg_hdr[JPEG_HDR_SZ]; | |
85 | }; | |
86 | enum sensors { | |
9c33afc6 | 87 | SENSOR_ADCM1700, |
ad98c0f6 | 88 | SENSOR_GC0307, |
9c33afc6 JFM |
89 | SENSOR_HV7131R, |
90 | SENSOR_MI0360, | |
a067db84 | 91 | SENSOR_MI0360B, |
9c33afc6 JFM |
92 | SENSOR_MO4000, |
93 | SENSOR_MT9V111, | |
94 | SENSOR_OM6802, | |
95 | SENSOR_OV7630, | |
96 | SENSOR_OV7648, | |
97 | SENSOR_OV7660, | |
98 | SENSOR_PO1030, | |
ad98c0f6 | 99 | SENSOR_PO2030N, |
03ed2a11 | 100 | SENSOR_SOI768, |
9c33afc6 | 101 | SENSOR_SP80708, |
6a7eba24 JFM |
102 | }; |
103 | ||
b2272a49 | 104 | /* device flags */ |
3afef85b JFM |
105 | #define F_PDN_INV 0x01 /* inverse pin S_PWR_DN / sn_xxx tables */ |
106 | #define F_ILLUM 0x02 /* presence of illuminator */ | |
b2272a49 | 107 | |
4fd350ee JFM |
108 | /* sn9c1xx definitions */ |
109 | /* register 0x01 */ | |
110 | #define S_PWR_DN 0x01 /* sensor power down */ | |
111 | #define S_PDN_INV 0x02 /* inverse pin S_PWR_DN */ | |
112 | #define V_TX_EN 0x04 /* video transfer enable */ | |
113 | #define LED 0x08 /* output to pin LED */ | |
114 | #define SCL_SEL_OD 0x20 /* open-drain mode */ | |
115 | #define SYS_SEL_48M 0x40 /* system clock 0: 24MHz, 1: 48MHz */ | |
116 | /* register 0x17 */ | |
117 | #define MCK_SIZE_MASK 0x1f /* sensor master clock */ | |
118 | #define SEN_CLK_EN 0x20 /* enable sensor clock */ | |
119 | #define DEF_EN 0x80 /* defect pixel by 0: soft, 1: hard */ | |
120 | ||
6a7eba24 | 121 | /* V4L2 controls supported by the driver */ |
72b667eb JFM |
122 | static void setbrightness(struct gspca_dev *gspca_dev); |
123 | static void setcontrast(struct gspca_dev *gspca_dev); | |
124 | static void setcolors(struct gspca_dev *gspca_dev); | |
125 | static void setredblue(struct gspca_dev *gspca_dev); | |
126 | static void setgamma(struct gspca_dev *gspca_dev); | |
127 | static void setautogain(struct gspca_dev *gspca_dev); | |
76ad3b68 | 128 | static void sethvflip(struct gspca_dev *gspca_dev); |
72b667eb | 129 | static void setsharpness(struct gspca_dev *gspca_dev); |
3afef85b | 130 | static void setillum(struct gspca_dev *gspca_dev); |
72b667eb JFM |
131 | static void setfreq(struct gspca_dev *gspca_dev); |
132 | ||
133 | static const struct ctrl sd_ctrls[NCTRLS] = { | |
134 | [BRIGHTNESS] = { | |
6a7eba24 JFM |
135 | { |
136 | .id = V4L2_CID_BRIGHTNESS, | |
137 | .type = V4L2_CTRL_TYPE_INTEGER, | |
138 | .name = "Brightness", | |
139 | .minimum = 0, | |
72b667eb | 140 | .maximum = 0xff, |
6a7eba24 | 141 | .step = 1, |
72b667eb | 142 | .default_value = 0x80, |
6a7eba24 | 143 | }, |
72b667eb | 144 | .set_control = setbrightness |
6a7eba24 | 145 | }, |
72b667eb | 146 | [CONTRAST] = { |
6a7eba24 JFM |
147 | { |
148 | .id = V4L2_CID_CONTRAST, | |
149 | .type = V4L2_CTRL_TYPE_INTEGER, | |
150 | .name = "Contrast", | |
151 | .minimum = 0, | |
05b809c7 JFM |
152 | #define CONTRAST_MAX 127 |
153 | .maximum = CONTRAST_MAX, | |
6a7eba24 | 154 | .step = 1, |
72b667eb | 155 | .default_value = 63, |
6a7eba24 | 156 | }, |
72b667eb | 157 | .set_control = setcontrast |
6a7eba24 | 158 | }, |
72b667eb | 159 | [COLORS] = { |
6a7eba24 JFM |
160 | { |
161 | .id = V4L2_CID_SATURATION, | |
162 | .type = V4L2_CTRL_TYPE_INTEGER, | |
3fb4a57b | 163 | .name = "Saturation", |
6a7eba24 | 164 | .minimum = 0, |
403123d2 | 165 | .maximum = 40, |
6a7eba24 | 166 | .step = 1, |
72b667eb JFM |
167 | #define COLORS_DEF 25 |
168 | .default_value = COLORS_DEF, | |
6a7eba24 | 169 | }, |
72b667eb | 170 | .set_control = setcolors |
6a7eba24 | 171 | }, |
72b667eb | 172 | [BLUE] = { |
403123d2 JFM |
173 | { |
174 | .id = V4L2_CID_BLUE_BALANCE, | |
175 | .type = V4L2_CTRL_TYPE_INTEGER, | |
176 | .name = "Blue Balance", | |
177 | .minimum = 24, | |
178 | .maximum = 40, | |
179 | .step = 1, | |
72b667eb | 180 | .default_value = 32, |
403123d2 | 181 | }, |
72b667eb | 182 | .set_control = setredblue |
403123d2 | 183 | }, |
72b667eb | 184 | [RED] = { |
403123d2 JFM |
185 | { |
186 | .id = V4L2_CID_RED_BALANCE, | |
187 | .type = V4L2_CTRL_TYPE_INTEGER, | |
188 | .name = "Red Balance", | |
189 | .minimum = 24, | |
190 | .maximum = 40, | |
191 | .step = 1, | |
72b667eb | 192 | .default_value = 32, |
403123d2 | 193 | }, |
72b667eb | 194 | .set_control = setredblue |
403123d2 | 195 | }, |
72b667eb | 196 | [GAMMA] = { |
592f4eb9 JFM |
197 | { |
198 | .id = V4L2_CID_GAMMA, | |
199 | .type = V4L2_CTRL_TYPE_INTEGER, | |
200 | .name = "Gamma", | |
201 | .minimum = 0, | |
202 | .maximum = 40, | |
203 | .step = 1, | |
204 | #define GAMMA_DEF 20 | |
205 | .default_value = GAMMA_DEF, | |
206 | }, | |
72b667eb | 207 | .set_control = setgamma |
592f4eb9 | 208 | }, |
72b667eb | 209 | [AUTOGAIN] = { |
6a7eba24 JFM |
210 | { |
211 | .id = V4L2_CID_AUTOGAIN, | |
212 | .type = V4L2_CTRL_TYPE_BOOLEAN, | |
213 | .name = "Auto Gain", | |
214 | .minimum = 0, | |
215 | .maximum = 1, | |
216 | .step = 1, | |
72b667eb | 217 | .default_value = 1 |
6a7eba24 | 218 | }, |
72b667eb | 219 | .set_control = setautogain |
6a7eba24 | 220 | }, |
76ad3b68 NM |
221 | [HFLIP] = { |
222 | { | |
223 | .id = V4L2_CID_HFLIP, | |
224 | .type = V4L2_CTRL_TYPE_BOOLEAN, | |
225 | .name = "Mirror", | |
226 | .minimum = 0, | |
227 | .maximum = 1, | |
228 | .step = 1, | |
229 | .default_value = 0, | |
230 | }, | |
231 | .set_control = sethvflip | |
232 | }, | |
72b667eb | 233 | [VFLIP] = { |
6c86274f JFM |
234 | { |
235 | .id = V4L2_CID_VFLIP, | |
236 | .type = V4L2_CTRL_TYPE_BOOLEAN, | |
237 | .name = "Vflip", | |
238 | .minimum = 0, | |
239 | .maximum = 1, | |
240 | .step = 1, | |
72b667eb | 241 | .default_value = 0, |
6c86274f | 242 | }, |
76ad3b68 | 243 | .set_control = sethvflip |
6c86274f | 244 | }, |
72b667eb | 245 | [SHARPNESS] = { |
878b35ae JFM |
246 | { |
247 | .id = V4L2_CID_SHARPNESS, | |
248 | .type = V4L2_CTRL_TYPE_INTEGER, | |
249 | .name = "Sharpness", | |
250 | .minimum = 0, | |
251 | .maximum = 255, | |
252 | .step = 1, | |
72b667eb | 253 | .default_value = 90, |
878b35ae | 254 | }, |
72b667eb | 255 | .set_control = setsharpness |
878b35ae | 256 | }, |
3afef85b | 257 | [ILLUM] = { |
0cae8964 | 258 | { |
3afef85b | 259 | .id = V4L2_CID_ILLUMINATORS_1, |
0cae8964 | 260 | .type = V4L2_CTRL_TYPE_BOOLEAN, |
3afef85b | 261 | .name = "Illuminator / infrared", |
0cae8964 JFM |
262 | .minimum = 0, |
263 | .maximum = 1, | |
264 | .step = 1, | |
72b667eb | 265 | .default_value = 0, |
0cae8964 | 266 | }, |
3afef85b | 267 | .set_control = setillum |
0cae8964 | 268 | }, |
37c6dbe2 | 269 | /* ov7630/ov7648/ov7660 only */ |
72b667eb | 270 | [FREQ] = { |
37c6dbe2 HG |
271 | { |
272 | .id = V4L2_CID_POWER_LINE_FREQUENCY, | |
273 | .type = V4L2_CTRL_TYPE_MENU, | |
274 | .name = "Light frequency filter", | |
275 | .minimum = 0, | |
276 | .maximum = 2, /* 0: 0, 1: 50Hz, 2:60Hz */ | |
277 | .step = 1, | |
72b667eb | 278 | .default_value = 1, |
37c6dbe2 | 279 | }, |
72b667eb | 280 | .set_control = setfreq |
37c6dbe2 | 281 | }, |
6a7eba24 JFM |
282 | }; |
283 | ||
577cbf49 | 284 | /* table of the disabled controls */ |
9c33afc6 | 285 | static const __u32 ctrl_dis[] = { |
72b667eb | 286 | [SENSOR_ADCM1700] = (1 << AUTOGAIN) | |
76ad3b68 | 287 | (1 << HFLIP) | |
72b667eb JFM |
288 | (1 << VFLIP) | |
289 | (1 << FREQ), | |
290 | ||
3afef85b | 291 | [SENSOR_GC0307] = (1 << HFLIP) | |
72b667eb JFM |
292 | (1 << VFLIP) | |
293 | (1 << FREQ), | |
294 | ||
3afef85b | 295 | [SENSOR_HV7131R] = (1 << HFLIP) | |
72b667eb JFM |
296 | (1 << FREQ), |
297 | ||
3afef85b | 298 | [SENSOR_MI0360] = (1 << HFLIP) | |
72b667eb JFM |
299 | (1 << VFLIP) | |
300 | (1 << FREQ), | |
301 | ||
3afef85b | 302 | [SENSOR_MI0360B] = (1 << HFLIP) | |
72b667eb JFM |
303 | (1 << VFLIP) | |
304 | (1 << FREQ), | |
305 | ||
3afef85b | 306 | [SENSOR_MO4000] = (1 << HFLIP) | |
72b667eb JFM |
307 | (1 << VFLIP) | |
308 | (1 << FREQ), | |
309 | ||
76ad3b68 NM |
310 | [SENSOR_MT9V111] = (1 << HFLIP) | |
311 | (1 << VFLIP) | | |
72b667eb JFM |
312 | (1 << FREQ), |
313 | ||
3afef85b | 314 | [SENSOR_OM6802] = (1 << HFLIP) | |
72b667eb JFM |
315 | (1 << VFLIP) | |
316 | (1 << FREQ), | |
317 | ||
3afef85b | 318 | [SENSOR_OV7630] = (1 << HFLIP), |
72b667eb | 319 | |
3afef85b | 320 | [SENSOR_OV7648] = (1 << HFLIP), |
72b667eb JFM |
321 | |
322 | [SENSOR_OV7660] = (1 << AUTOGAIN) | | |
76ad3b68 | 323 | (1 << HFLIP) | |
72b667eb JFM |
324 | (1 << VFLIP), |
325 | ||
326 | [SENSOR_PO1030] = (1 << AUTOGAIN) | | |
76ad3b68 | 327 | (1 << HFLIP) | |
72b667eb JFM |
328 | (1 << VFLIP) | |
329 | (1 << FREQ), | |
330 | ||
331 | [SENSOR_PO2030N] = (1 << AUTOGAIN) | | |
72b667eb | 332 | (1 << FREQ), |
780e3121 | 333 | |
72b667eb | 334 | [SENSOR_SOI768] = (1 << AUTOGAIN) | |
76ad3b68 | 335 | (1 << HFLIP) | |
72b667eb JFM |
336 | (1 << VFLIP) | |
337 | (1 << FREQ), | |
338 | ||
339 | [SENSOR_SP80708] = (1 << AUTOGAIN) | | |
76ad3b68 | 340 | (1 << HFLIP) | |
72b667eb JFM |
341 | (1 << VFLIP) | |
342 | (1 << FREQ), | |
577cbf49 JFM |
343 | }; |
344 | ||
64677573 JFM |
345 | static const struct v4l2_pix_format cif_mode[] = { |
346 | {352, 288, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE, | |
347 | .bytesperline = 352, | |
348 | .sizeimage = 352 * 288 * 4 / 8 + 590, | |
349 | .colorspace = V4L2_COLORSPACE_JPEG, | |
350 | .priv = 0}, | |
351 | }; | |
cc611b8a | 352 | static const struct v4l2_pix_format vga_mode[] = { |
c2446b3e JFM |
353 | {160, 120, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE, |
354 | .bytesperline = 160, | |
5d05294a | 355 | .sizeimage = 160 * 120 * 4 / 8 + 590, |
c2446b3e JFM |
356 | .colorspace = V4L2_COLORSPACE_JPEG, |
357 | .priv = 2}, | |
358 | {320, 240, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE, | |
359 | .bytesperline = 320, | |
360 | .sizeimage = 320 * 240 * 3 / 8 + 590, | |
361 | .colorspace = V4L2_COLORSPACE_JPEG, | |
362 | .priv = 1}, | |
363 | {640, 480, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE, | |
364 | .bytesperline = 640, | |
a5d1cc39 HG |
365 | /* Note 3 / 8 is not large enough, not even 5 / 8 is ?! */ |
366 | .sizeimage = 640 * 480 * 3 / 4 + 590, | |
c2446b3e JFM |
367 | .colorspace = V4L2_COLORSPACE_JPEG, |
368 | .priv = 0}, | |
6a7eba24 JFM |
369 | }; |
370 | ||
64677573 JFM |
371 | static const u8 sn_adcm1700[0x1c] = { |
372 | /* reg0 reg1 reg2 reg3 reg4 reg5 reg6 reg7 */ | |
878b35ae | 373 | 0x00, 0x43, 0x60, 0x00, 0x1a, 0x00, 0x00, 0x00, |
64677573 JFM |
374 | /* reg8 reg9 rega regb regc regd rege regf */ |
375 | 0x80, 0x51, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | |
376 | /* reg10 reg11 reg12 reg13 reg14 reg15 reg16 reg17 */ | |
377 | 0x03, 0x00, 0x05, 0x01, 0x05, 0x16, 0x12, 0x42, | |
378 | /* reg18 reg19 reg1a reg1b */ | |
379 | 0x06, 0x00, 0x00, 0x00 | |
380 | }; | |
381 | ||
ad98c0f6 JFM |
382 | static const u8 sn_gc0307[0x1c] = { |
383 | /* reg0 reg1 reg2 reg3 reg4 reg5 reg6 reg7 */ | |
384 | 0x00, 0x61, 0x62, 0x00, 0x1a, 0x00, 0x00, 0x00, | |
385 | /* reg8 reg9 rega regb regc regd rege regf */ | |
386 | 0x80, 0x21, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | |
387 | /* reg10 reg11 reg12 reg13 reg14 reg15 reg16 reg17 */ | |
388 | 0x03, 0x00, 0x03, 0x01, 0x08, 0x28, 0x1e, 0x02, | |
389 | /* reg18 reg19 reg1a reg1b */ | |
390 | 0x06, 0x00, 0x00, 0x00 | |
391 | }; | |
392 | ||
8c2ba441 | 393 | static const u8 sn_hv7131[0x1c] = { |
8f47a3ce | 394 | /* reg0 reg1 reg2 reg3 reg4 reg5 reg6 reg7 */ |
19697b54 | 395 | 0x00, 0x03, 0x60, 0x00, 0x1a, 0x20, 0x20, 0x20, |
8f47a3ce | 396 | /* reg8 reg9 rega regb regc regd rege regf */ |
98941e4d | 397 | 0x81, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
8f47a3ce JFM |
398 | /* reg10 reg11 reg12 reg13 reg14 reg15 reg16 reg17 */ |
399 | 0x03, 0x00, 0x00, 0x01, 0x03, 0x28, 0x1e, 0x41, | |
8c2ba441 JFM |
400 | /* reg18 reg19 reg1a reg1b */ |
401 | 0x0a, 0x00, 0x00, 0x00 | |
6a7eba24 JFM |
402 | }; |
403 | ||
8c2ba441 | 404 | static const u8 sn_mi0360[0x1c] = { |
8f47a3ce | 405 | /* reg0 reg1 reg2 reg3 reg4 reg5 reg6 reg7 */ |
19697b54 | 406 | 0x00, 0x61, 0x40, 0x00, 0x1a, 0x20, 0x20, 0x20, |
8f47a3ce | 407 | /* reg8 reg9 rega regb regc regd rege regf */ |
98941e4d | 408 | 0x81, 0x5d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
8f47a3ce JFM |
409 | /* reg10 reg11 reg12 reg13 reg14 reg15 reg16 reg17 */ |
410 | 0x03, 0x00, 0x00, 0x02, 0x0a, 0x28, 0x1e, 0x61, | |
8c2ba441 JFM |
411 | /* reg18 reg19 reg1a reg1b */ |
412 | 0x06, 0x00, 0x00, 0x00 | |
6a7eba24 JFM |
413 | }; |
414 | ||
a067db84 JFM |
415 | static const u8 sn_mi0360b[0x1c] = { |
416 | /* reg0 reg1 reg2 reg3 reg4 reg5 reg6 reg7 */ | |
417 | 0x00, 0x61, 0x40, 0x00, 0x1a, 0x00, 0x00, 0x00, | |
418 | /* reg8 reg9 rega regb regc regd rege regf */ | |
419 | 0x81, 0x5d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | |
420 | /* reg10 reg11 reg12 reg13 reg14 reg15 reg16 reg17 */ | |
421 | 0x03, 0x00, 0x00, 0x02, 0x0a, 0x28, 0x1e, 0x40, | |
422 | /* reg18 reg19 reg1a reg1b */ | |
423 | 0x06, 0x00, 0x00, 0x00 | |
424 | }; | |
425 | ||
8c2ba441 | 426 | static const u8 sn_mo4000[0x1c] = { |
8f47a3ce | 427 | /* reg0 reg1 reg2 reg3 reg4 reg5 reg6 reg7 */ |
8c2ba441 | 428 | 0x00, 0x23, 0x60, 0x00, 0x1a, 0x00, 0x20, 0x18, |
8f47a3ce JFM |
429 | /* reg8 reg9 rega regb regc regd rege regf */ |
430 | 0x81, 0x21, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | |
431 | /* reg10 reg11 reg12 reg13 reg14 reg15 reg16 reg17 */ | |
432 | 0x03, 0x00, 0x0b, 0x0f, 0x14, 0x28, 0x1e, 0x40, | |
8c2ba441 JFM |
433 | /* reg18 reg19 reg1a reg1b */ |
434 | 0x08, 0x00, 0x00, 0x00 | |
6a7eba24 JFM |
435 | }; |
436 | ||
3ef2c5be JFM |
437 | static const u8 sn_mt9v111[0x1c] = { |
438 | /* reg0 reg1 reg2 reg3 reg4 reg5 reg6 reg7 */ | |
439 | 0x00, 0x61, 0x40, 0x00, 0x1a, 0x20, 0x20, 0x20, | |
440 | /* reg8 reg9 rega regb regc regd rege regf */ | |
98941e4d | 441 | 0x81, 0x5c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
3ef2c5be JFM |
442 | /* reg10 reg11 reg12 reg13 reg14 reg15 reg16 reg17 */ |
443 | 0x03, 0x00, 0x00, 0x02, 0x1c, 0x28, 0x1e, 0x40, | |
444 | /* reg18 reg19 reg1a reg1b */ | |
445 | 0x06, 0x00, 0x00, 0x00 | |
446 | }; | |
447 | ||
8c2ba441 | 448 | static const u8 sn_om6802[0x1c] = { |
d2d16e90 | 449 | /* reg0 reg1 reg2 reg3 reg4 reg5 reg6 reg7 */ |
46b4f2ab | 450 | 0x00, 0x23, 0x72, 0x00, 0x1a, 0x20, 0x20, 0x19, |
d2d16e90 JFM |
451 | /* reg8 reg9 rega regb regc regd rege regf */ |
452 | 0x80, 0x34, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | |
453 | /* reg10 reg11 reg12 reg13 reg14 reg15 reg16 reg17 */ | |
454 | 0x03, 0x00, 0x51, 0x01, 0x00, 0x28, 0x1e, 0x40, | |
8c2ba441 JFM |
455 | /* reg18 reg19 reg1a reg1b */ |
456 | 0x05, 0x00, 0x00, 0x00 | |
d2d16e90 JFM |
457 | }; |
458 | ||
8c2ba441 | 459 | static const u8 sn_ov7630[0x1c] = { |
6ab0b174 | 460 | /* reg0 reg1 reg2 reg3 reg4 reg5 reg6 reg7 */ |
0a85c74b | 461 | 0x00, 0x21, 0x40, 0x00, 0x1a, 0x00, 0x00, 0x00, |
6ab0b174 | 462 | /* reg8 reg9 rega regb regc regd rege regf */ |
98941e4d | 463 | 0x81, 0x21, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
6ab0b174 JFM |
464 | /* reg10 reg11 reg12 reg13 reg14 reg15 reg16 reg17 */ |
465 | 0x03, 0x00, 0x04, 0x01, 0x0a, 0x28, 0x1e, 0xc2, | |
8c2ba441 JFM |
466 | /* reg18 reg19 reg1a reg1b */ |
467 | 0x0b, 0x00, 0x00, 0x00 | |
6ab0b174 JFM |
468 | }; |
469 | ||
8c2ba441 | 470 | static const u8 sn_ov7648[0x1c] = { |
8f47a3ce | 471 | /* reg0 reg1 reg2 reg3 reg4 reg5 reg6 reg7 */ |
6270330a | 472 | 0x00, 0x63, 0x40, 0x00, 0x1a, 0x20, 0x20, 0x20, |
8f47a3ce | 473 | /* reg8 reg9 rega regb regc regd rege regf */ |
98941e4d | 474 | 0x81, 0x21, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
8f47a3ce | 475 | /* reg10 reg11 reg12 reg13 reg14 reg15 reg16 reg17 */ |
6270330a | 476 | 0x03, 0x00, 0x00, 0x01, 0x00, 0x28, 0x1e, 0x00, |
8c2ba441 JFM |
477 | /* reg18 reg19 reg1a reg1b */ |
478 | 0x0b, 0x00, 0x00, 0x00 | |
6a7eba24 JFM |
479 | }; |
480 | ||
8c2ba441 | 481 | static const u8 sn_ov7660[0x1c] = { |
8f47a3ce | 482 | /* reg0 reg1 reg2 reg3 reg4 reg5 reg6 reg7 */ |
c8b9b2ca | 483 | 0x00, 0x61, 0x40, 0x00, 0x1a, 0x00, 0x00, 0x00, |
8f47a3ce | 484 | /* reg8 reg9 rega regb regc regd rege regf */ |
c8b9b2ca | 485 | 0x81, 0x21, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
8f47a3ce JFM |
486 | /* reg10 reg11 reg12 reg13 reg14 reg15 reg16 reg17 */ |
487 | 0x03, 0x00, 0x01, 0x01, 0x08, 0x28, 0x1e, 0x20, | |
8c2ba441 JFM |
488 | /* reg18 reg19 reg1a reg1b */ |
489 | 0x07, 0x00, 0x00, 0x00 | |
6a7eba24 JFM |
490 | }; |
491 | ||
b8c8a5bf JFM |
492 | static const u8 sn_po1030[0x1c] = { |
493 | /* reg0 reg1 reg2 reg3 reg4 reg5 reg6 reg7 */ | |
494 | 0x00, 0x21, 0x62, 0x00, 0x1a, 0x20, 0x20, 0x20, | |
495 | /* reg8 reg9 rega regb regc regd rege regf */ | |
496 | 0x81, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | |
497 | /* reg10 reg11 reg12 reg13 reg14 reg15 reg16 reg17 */ | |
498 | 0x03, 0x00, 0x00, 0x06, 0x06, 0x28, 0x1e, 0x00, | |
499 | /* reg18 reg19 reg1a reg1b */ | |
500 | 0x07, 0x00, 0x00, 0x00 | |
501 | }; | |
502 | ||
ad98c0f6 JFM |
503 | static const u8 sn_po2030n[0x1c] = { |
504 | /* reg0 reg1 reg2 reg3 reg4 reg5 reg6 reg7 */ | |
505 | 0x00, 0x63, 0x40, 0x00, 0x1a, 0x00, 0x00, 0x00, | |
506 | /* reg8 reg9 rega regb regc regd rege regf */ | |
507 | 0x81, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | |
508 | /* reg10 reg11 reg12 reg13 reg14 reg15 reg16 reg17 */ | |
509 | 0x03, 0x00, 0x00, 0x01, 0x14, 0x28, 0x1e, 0x00, | |
510 | /* reg18 reg19 reg1a reg1b */ | |
511 | 0x07, 0x00, 0x00, 0x00 | |
512 | }; | |
513 | ||
03ed2a11 JFM |
514 | static const u8 sn_soi768[0x1c] = { |
515 | /* reg0 reg1 reg2 reg3 reg4 reg5 reg6 reg7 */ | |
516 | 0x00, 0x21, 0x40, 0x00, 0x1a, 0x00, 0x00, 0x00, | |
517 | /* reg8 reg9 rega regb regc regd rege regf */ | |
518 | 0x81, 0x21, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | |
519 | /* reg10 reg11 reg12 reg13 reg14 reg15 reg16 reg17 */ | |
520 | 0x03, 0x00, 0x00, 0x01, 0x08, 0x28, 0x1e, 0x00, | |
521 | /* reg18 reg19 reg1a reg1b */ | |
522 | 0x07, 0x00, 0x00, 0x00 | |
523 | }; | |
524 | ||
5e31dc8d JFM |
525 | static const u8 sn_sp80708[0x1c] = { |
526 | /* reg0 reg1 reg2 reg3 reg4 reg5 reg6 reg7 */ | |
527 | 0x00, 0x63, 0x60, 0x00, 0x1a, 0x20, 0x20, 0x20, | |
528 | /* reg8 reg9 rega regb regc regd rege regf */ | |
98941e4d | 529 | 0x81, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
5e31dc8d JFM |
530 | /* reg10 reg11 reg12 reg13 reg14 reg15 reg16 reg17 */ |
531 | 0x03, 0x00, 0x00, 0x03, 0x04, 0x28, 0x1e, 0x00, | |
532 | /* reg18 reg19 reg1a reg1b */ | |
533 | 0x07, 0x00, 0x00, 0x00 | |
534 | }; | |
535 | ||
6a7eba24 | 536 | /* sequence specific to the sensors - !! index = SENSOR_xxx */ |
8c2ba441 | 537 | static const u8 *sn_tb[] = { |
9c33afc6 | 538 | [SENSOR_ADCM1700] = sn_adcm1700, |
ad98c0f6 | 539 | [SENSOR_GC0307] = sn_gc0307, |
9c33afc6 JFM |
540 | [SENSOR_HV7131R] = sn_hv7131, |
541 | [SENSOR_MI0360] = sn_mi0360, | |
a067db84 | 542 | [SENSOR_MI0360B] = sn_mi0360b, |
9c33afc6 JFM |
543 | [SENSOR_MO4000] = sn_mo4000, |
544 | [SENSOR_MT9V111] = sn_mt9v111, | |
545 | [SENSOR_OM6802] = sn_om6802, | |
546 | [SENSOR_OV7630] = sn_ov7630, | |
547 | [SENSOR_OV7648] = sn_ov7648, | |
548 | [SENSOR_OV7660] = sn_ov7660, | |
549 | [SENSOR_PO1030] = sn_po1030, | |
ad98c0f6 | 550 | [SENSOR_PO2030N] = sn_po2030n, |
03ed2a11 JFM |
551 | [SENSOR_SOI768] = sn_soi768, |
552 | [SENSOR_SP80708] = sn_sp80708, | |
6a7eba24 JFM |
553 | }; |
554 | ||
b083b92f | 555 | /* default gamma table */ |
98819187 | 556 | static const u8 gamma_def[17] = { |
6a7eba24 JFM |
557 | 0x00, 0x2d, 0x46, 0x5a, 0x6c, 0x7c, 0x8b, 0x99, |
558 | 0xa6, 0xb2, 0xbf, 0xca, 0xd5, 0xe0, 0xeb, 0xf5, 0xff | |
559 | }; | |
64677573 JFM |
560 | /* gamma for sensor ADCM1700 */ |
561 | static const u8 gamma_spec_0[17] = { | |
562 | 0x0f, 0x39, 0x5a, 0x74, 0x86, 0x95, 0xa6, 0xb4, | |
563 | 0xbd, 0xc4, 0xcc, 0xd4, 0xd5, 0xde, 0xe4, 0xed, 0xf5 | |
564 | }; | |
b083b92f JFM |
565 | /* gamma for sensors HV7131R and MT9V111 */ |
566 | static const u8 gamma_spec_1[17] = { | |
567 | 0x08, 0x3a, 0x52, 0x65, 0x75, 0x83, 0x91, 0x9d, | |
568 | 0xa9, 0xb4, 0xbe, 0xc8, 0xd2, 0xdb, 0xe4, 0xed, 0xf5 | |
569 | }; | |
ad98c0f6 | 570 | /* gamma for sensor GC0307 */ |
b083b92f | 571 | static const u8 gamma_spec_2[17] = { |
ad98c0f6 JFM |
572 | 0x14, 0x37, 0x50, 0x6a, 0x7c, 0x8d, 0x9d, 0xab, |
573 | 0xb5, 0xbf, 0xc2, 0xcb, 0xd1, 0xd6, 0xdb, 0xe1, 0xeb | |
574 | }; | |
575 | /* gamma for sensor SP80708 */ | |
576 | static const u8 gamma_spec_3[17] = { | |
b083b92f JFM |
577 | 0x0a, 0x2d, 0x4e, 0x68, 0x7d, 0x8f, 0x9f, 0xab, |
578 | 0xb7, 0xc2, 0xcc, 0xd3, 0xd8, 0xde, 0xe2, 0xe5, 0xe6 | |
579 | }; | |
592f4eb9 | 580 | |
803f9ccf | 581 | /* color matrix and offsets */ |
98819187 | 582 | static const u8 reg84[] = { |
803f9ccf JFM |
583 | 0x14, 0x00, 0x27, 0x00, 0x07, 0x00, /* YR YG YB gains */ |
584 | 0xe8, 0x0f, 0xda, 0x0f, 0x40, 0x00, /* UR UG UB */ | |
585 | 0x3e, 0x00, 0xcd, 0x0f, 0xf7, 0x0f, /* VR VG VB */ | |
586 | 0x00, 0x00, 0x00 /* YUV offsets */ | |
6a7eba24 | 587 | }; |
ccbc5df2 NM |
588 | |
589 | #define DELAY 0xdd | |
590 | ||
64677573 JFM |
591 | static const u8 adcm1700_sensor_init[][8] = { |
592 | {0xa0, 0x51, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x10}, | |
878b35ae | 593 | {0xb0, 0x51, 0x04, 0x08, 0x00, 0x00, 0x00, 0x10}, /* reset */ |
ccbc5df2 | 594 | {DELAY, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, |
64677573 | 595 | {0xb0, 0x51, 0x04, 0x00, 0x00, 0x00, 0x00, 0x10}, |
ccbc5df2 | 596 | {DELAY, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, |
64677573 JFM |
597 | {0xb0, 0x51, 0x0c, 0xe0, 0x2e, 0x00, 0x00, 0x10}, |
598 | {0xb0, 0x51, 0x10, 0x02, 0x02, 0x00, 0x00, 0x10}, | |
599 | {0xb0, 0x51, 0x14, 0x0e, 0x0e, 0x00, 0x00, 0x10}, | |
600 | {0xb0, 0x51, 0x1c, 0x00, 0x80, 0x00, 0x00, 0x10}, | |
601 | {0xb0, 0x51, 0x20, 0x01, 0x00, 0x00, 0x00, 0x10}, | |
ccbc5df2 | 602 | {DELAY, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, |
64677573 | 603 | {0xb0, 0x51, 0x04, 0x04, 0x00, 0x00, 0x00, 0x10}, |
ccbc5df2 | 604 | {DELAY, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, |
64677573 JFM |
605 | {0xb0, 0x51, 0x04, 0x01, 0x00, 0x00, 0x00, 0x10}, |
606 | {0xa0, 0x51, 0xfe, 0x10, 0x00, 0x00, 0x00, 0x10}, | |
607 | {0xb0, 0x51, 0x14, 0x01, 0x00, 0x00, 0x00, 0x10}, | |
608 | {0xb0, 0x51, 0x32, 0x00, 0x00, 0x00, 0x00, 0x10}, | |
609 | {} | |
610 | }; | |
611 | static const u8 adcm1700_sensor_param1[][8] = { | |
878b35ae | 612 | {0xb0, 0x51, 0x26, 0xf9, 0x01, 0x00, 0x00, 0x10}, /* exposure? */ |
64677573 JFM |
613 | {0xd0, 0x51, 0x1e, 0x8e, 0x8e, 0x8e, 0x8e, 0x10}, |
614 | ||
615 | {0xa0, 0x51, 0xfe, 0x01, 0x00, 0x00, 0x00, 0x10}, | |
616 | {0xb0, 0x51, 0x00, 0x02, 0x00, 0x00, 0x00, 0x10}, | |
617 | {0xa0, 0x51, 0xfe, 0x10, 0x00, 0x00, 0x00, 0x10}, | |
618 | {0xb0, 0x51, 0x32, 0x00, 0x72, 0x00, 0x00, 0x10}, | |
878b35ae | 619 | {0xd0, 0x51, 0x1e, 0xbe, 0xd7, 0xe8, 0xbe, 0x10}, /* exposure? */ |
64677573 | 620 | |
878b35ae JFM |
621 | {0xa0, 0x51, 0xfe, 0x01, 0x00, 0x00, 0x00, 0x10}, |
622 | {0xb0, 0x51, 0x00, 0x02, 0x00, 0x00, 0x00, 0x10}, | |
623 | {0xa0, 0x51, 0xfe, 0x10, 0x00, 0x00, 0x00, 0x10}, | |
624 | {0xb0, 0x51, 0x32, 0x00, 0xa2, 0x00, 0x00, 0x10}, | |
64677573 JFM |
625 | {} |
626 | }; | |
ad98c0f6 JFM |
627 | static const u8 gc0307_sensor_init[][8] = { |
628 | {0xa0, 0x21, 0x43, 0x00, 0x00, 0x00, 0x00, 0x10}, | |
629 | {0xa0, 0x21, 0x44, 0xa2, 0x00, 0x00, 0x00, 0x10}, | |
630 | {0xa0, 0x21, 0x01, 0x6a, 0x00, 0x00, 0x00, 0x10}, | |
631 | {0xa0, 0x21, 0x02, 0x70, 0x00, 0x00, 0x00, 0x10}, | |
632 | {0xa0, 0x21, 0x10, 0x00, 0x00, 0x00, 0x00, 0x10}, | |
633 | {0xa0, 0x21, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x10}, | |
634 | {0xa0, 0x21, 0x1d, 0x00, 0x00, 0x00, 0x00, 0x10}, | |
635 | {0xa0, 0x21, 0x11, 0x05, 0x00, 0x00, 0x00, 0x10}, | |
636 | {0xa0, 0x21, 0x05, 0x00, 0x00, 0x00, 0x00, 0x10}, | |
637 | {0xa0, 0x21, 0x06, 0x00, 0x00, 0x00, 0x00, 0x10}, | |
638 | {0xa0, 0x21, 0x07, 0x00, 0x00, 0x00, 0x00, 0x10}, | |
639 | {0xa0, 0x21, 0x08, 0x02, 0x00, 0x00, 0x00, 0x10}, | |
640 | {0xa0, 0x21, 0x09, 0x01, 0x00, 0x00, 0x00, 0x10}, | |
641 | {0xa0, 0x21, 0x0a, 0xe8, 0x00, 0x00, 0x00, 0x10}, | |
642 | {0xa0, 0x21, 0x0b, 0x02, 0x00, 0x00, 0x00, 0x10}, | |
643 | {0xa0, 0x21, 0x0c, 0x80, 0x00, 0x00, 0x00, 0x10}, | |
644 | {0xa0, 0x21, 0x0d, 0x22, 0x00, 0x00, 0x00, 0x10}, | |
645 | {0xa0, 0x21, 0x0e, 0x02, 0x00, 0x00, 0x00, 0x10}, | |
646 | {0xa0, 0x21, 0x0f, 0xb2, 0x00, 0x00, 0x00, 0x10}, | |
647 | {0xa0, 0x21, 0x12, 0x70, 0x00, 0x00, 0x00, 0x10}, | |
ccbc5df2 | 648 | {DELAY, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*delay 10ms*/ |
ad98c0f6 JFM |
649 | {0xa0, 0x21, 0x13, 0x00, 0x00, 0x00, 0x00, 0x10}, |
650 | {0xa0, 0x21, 0x15, 0xb8, 0x00, 0x00, 0x00, 0x10}, | |
651 | {0xa0, 0x21, 0x16, 0x13, 0x00, 0x00, 0x00, 0x10}, | |
652 | {0xa0, 0x21, 0x17, 0x52, 0x00, 0x00, 0x00, 0x10}, | |
653 | {0xa0, 0x21, 0x18, 0x50, 0x00, 0x00, 0x00, 0x10}, | |
654 | {0xa0, 0x21, 0x1e, 0x0d, 0x00, 0x00, 0x00, 0x10}, | |
655 | {0xa0, 0x21, 0x1f, 0x32, 0x00, 0x00, 0x00, 0x10}, | |
656 | {0xa0, 0x21, 0x61, 0x90, 0x00, 0x00, 0x00, 0x10}, | |
657 | {0xa0, 0x21, 0x63, 0x70, 0x00, 0x00, 0x00, 0x10}, | |
658 | {0xa0, 0x21, 0x65, 0x98, 0x00, 0x00, 0x00, 0x10}, | |
659 | {0xa0, 0x21, 0x67, 0x90, 0x00, 0x00, 0x00, 0x10}, | |
660 | {0xa0, 0x21, 0x03, 0x00, 0x00, 0x00, 0x00, 0x10}, | |
661 | {0xa0, 0x21, 0x04, 0x96, 0x00, 0x00, 0x00, 0x10}, | |
662 | {0xa0, 0x21, 0x45, 0x27, 0x00, 0x00, 0x00, 0x10}, | |
663 | {0xa0, 0x21, 0x47, 0x2c, 0x00, 0x00, 0x00, 0x10}, | |
664 | {0xa0, 0x21, 0x43, 0x47, 0x00, 0x00, 0x00, 0x10}, | |
665 | {0xa0, 0x21, 0x44, 0xd8, 0x00, 0x00, 0x00, 0x10}, | |
666 | {} | |
667 | }; | |
668 | static const u8 gc0307_sensor_param1[][8] = { | |
669 | {0xa0, 0x21, 0x68, 0x13, 0x00, 0x00, 0x00, 0x10}, | |
670 | {0xd0, 0x21, 0x61, 0x80, 0x00, 0x80, 0x00, 0x10}, | |
671 | {0xc0, 0x21, 0x65, 0x80, 0x00, 0x80, 0x00, 0x10}, | |
672 | {0xc0, 0x21, 0x63, 0xa0, 0x00, 0xa6, 0x00, 0x10}, | |
673 | /*param3*/ | |
674 | {0xa0, 0x21, 0x01, 0x6e, 0x00, 0x00, 0x00, 0x10}, | |
675 | {0xa0, 0x21, 0x02, 0x88, 0x00, 0x00, 0x00, 0x10}, | |
ad98c0f6 JFM |
676 | {} |
677 | }; | |
678 | ||
98819187 | 679 | static const u8 hv7131r_sensor_init[][8] = { |
8c2ba441 JFM |
680 | {0xc1, 0x11, 0x01, 0x08, 0x01, 0x00, 0x00, 0x10}, |
681 | {0xb1, 0x11, 0x34, 0x17, 0x7f, 0x00, 0x00, 0x10}, | |
682 | {0xd1, 0x11, 0x40, 0xff, 0x7f, 0x7f, 0x7f, 0x10}, | |
683 | /* {0x91, 0x11, 0x44, 0x00, 0x00, 0x00, 0x00, 0x10}, */ | |
684 | {0xd1, 0x11, 0x10, 0x00, 0x00, 0x00, 0x00, 0x10}, | |
685 | {0xd1, 0x11, 0x14, 0x01, 0xe2, 0x02, 0x82, 0x10}, | |
686 | /* {0x91, 0x11, 0x18, 0x00, 0x00, 0x00, 0x00, 0x10}, */ | |
687 | ||
688 | {0xa1, 0x11, 0x01, 0x08, 0x00, 0x00, 0x00, 0x10}, | |
689 | {0xa1, 0x11, 0x01, 0x08, 0x00, 0x00, 0x00, 0x10}, | |
690 | {0xc1, 0x11, 0x25, 0x00, 0x61, 0xa8, 0x00, 0x10}, | |
691 | {0xa1, 0x11, 0x30, 0x22, 0x00, 0x00, 0x00, 0x10}, | |
692 | {0xc1, 0x11, 0x31, 0x20, 0x2e, 0x20, 0x00, 0x10}, | |
693 | {0xc1, 0x11, 0x25, 0x00, 0xc3, 0x50, 0x00, 0x10}, | |
694 | {0xa1, 0x11, 0x30, 0x07, 0x00, 0x00, 0x00, 0x10}, /* gain14 */ | |
695 | {0xc1, 0x11, 0x31, 0x10, 0x10, 0x10, 0x00, 0x10}, /* r g b 101a10 */ | |
696 | ||
697 | {0xa1, 0x11, 0x01, 0x08, 0x00, 0x00, 0x00, 0x10}, | |
698 | {0xa1, 0x11, 0x20, 0x00, 0x00, 0x00, 0x00, 0x10}, | |
7fb101ae | 699 | {0xa1, 0x11, 0x21, 0xd0, 0x00, 0x00, 0x00, 0x10}, |
8c2ba441 JFM |
700 | {0xa1, 0x11, 0x22, 0x00, 0x00, 0x00, 0x00, 0x10}, |
701 | {0xa1, 0x11, 0x23, 0x09, 0x00, 0x00, 0x00, 0x10}, | |
702 | ||
703 | {0xa1, 0x11, 0x01, 0x08, 0x00, 0x00, 0x00, 0x10}, | |
704 | {0xa1, 0x11, 0x20, 0x00, 0x00, 0x00, 0x00, 0x10}, | |
705 | {0xa1, 0x11, 0x21, 0xd0, 0x00, 0x00, 0x00, 0x10}, | |
706 | {0xa1, 0x11, 0x22, 0x00, 0x00, 0x00, 0x00, 0x10}, | |
707 | {0xa1, 0x11, 0x23, 0x10, 0x00, 0x00, 0x00, 0x10}, | |
23a98274 JFM |
708 | {0xa1, 0x11, 0x01, 0x18, 0x00, 0x00, 0x00, 0x10}, |
709 | /* set sensor clock */ | |
a5ae2062 | 710 | {} |
6a7eba24 | 711 | }; |
98819187 | 712 | static const u8 mi0360_sensor_init[][8] = { |
8c2ba441 | 713 | {0xb1, 0x5d, 0x07, 0x00, 0x02, 0x00, 0x00, 0x10}, |
98819187 | 714 | {0xb1, 0x5d, 0x0d, 0x00, 0x01, 0x00, 0x00, 0x10}, |
3ef2c5be | 715 | {0xb1, 0x5d, 0x0d, 0x00, 0x00, 0x00, 0x00, 0x10}, |
8c2ba441 JFM |
716 | {0xd1, 0x5d, 0x01, 0x00, 0x08, 0x00, 0x16, 0x10}, |
717 | {0xd1, 0x5d, 0x03, 0x01, 0xe2, 0x02, 0x82, 0x10}, | |
718 | {0xd1, 0x5d, 0x05, 0x00, 0x09, 0x00, 0x53, 0x10}, | |
719 | {0xb1, 0x5d, 0x0d, 0x00, 0x02, 0x00, 0x00, 0x10}, | |
720 | {0xd1, 0x5d, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x10}, | |
721 | {0xd1, 0x5d, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x10}, | |
722 | {0xd1, 0x5d, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x10}, | |
723 | {0xd1, 0x5d, 0x10, 0x00, 0x00, 0x00, 0x00, 0x10}, | |
724 | {0xd1, 0x5d, 0x12, 0x00, 0x00, 0x00, 0x00, 0x10}, | |
725 | {0xd1, 0x5d, 0x14, 0x00, 0x00, 0x00, 0x00, 0x10}, | |
726 | {0xd1, 0x5d, 0x16, 0x00, 0x00, 0x00, 0x00, 0x10}, | |
727 | {0xd1, 0x5d, 0x18, 0x00, 0x00, 0x00, 0x00, 0x10}, | |
728 | {0xd1, 0x5d, 0x1a, 0x00, 0x00, 0x00, 0x00, 0x10}, | |
729 | {0xd1, 0x5d, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x10}, | |
730 | {0xb1, 0x5d, 0x32, 0x00, 0x00, 0x00, 0x00, 0x10}, | |
731 | {0xd1, 0x5d, 0x20, 0x91, 0x01, 0x00, 0x00, 0x10}, | |
732 | {0xd1, 0x5d, 0x22, 0x00, 0x00, 0x00, 0x00, 0x10}, | |
733 | {0xd1, 0x5d, 0x24, 0x00, 0x00, 0x00, 0x00, 0x10}, | |
734 | {0xd1, 0x5d, 0x26, 0x00, 0x00, 0x00, 0x24, 0x10}, | |
98819187 | 735 | {0xd1, 0x5d, 0x2f, 0xf7, 0xB0, 0x00, 0x04, 0x10}, |
8c2ba441 JFM |
736 | {0xd1, 0x5d, 0x31, 0x00, 0x00, 0x00, 0x00, 0x10}, |
737 | {0xd1, 0x5d, 0x33, 0x00, 0x00, 0x01, 0x00, 0x10}, | |
738 | {0xb1, 0x5d, 0x3d, 0x06, 0x8f, 0x00, 0x00, 0x10}, | |
739 | {0xd1, 0x5d, 0x40, 0x01, 0xe0, 0x00, 0xd1, 0x10}, | |
740 | {0xb1, 0x5d, 0x44, 0x00, 0x82, 0x00, 0x00, 0x10}, | |
741 | {0xd1, 0x5d, 0x58, 0x00, 0x78, 0x00, 0x43, 0x10}, | |
742 | {0xd1, 0x5d, 0x5a, 0x00, 0x00, 0x00, 0x00, 0x10}, | |
743 | {0xd1, 0x5d, 0x5c, 0x00, 0x00, 0x00, 0x00, 0x10}, | |
744 | {0xd1, 0x5d, 0x5e, 0x00, 0x00, 0xa3, 0x1d, 0x10}, | |
745 | {0xb1, 0x5d, 0x62, 0x04, 0x11, 0x00, 0x00, 0x10}, | |
746 | ||
747 | {0xb1, 0x5d, 0x20, 0x91, 0x01, 0x00, 0x00, 0x10}, | |
748 | {0xb1, 0x5d, 0x20, 0x11, 0x01, 0x00, 0x00, 0x10}, | |
749 | {0xb1, 0x5d, 0x09, 0x00, 0x64, 0x00, 0x00, 0x10}, | |
750 | {0xd1, 0x5d, 0x2b, 0x00, 0xa0, 0x00, 0xb0, 0x10}, | |
751 | {0xd1, 0x5d, 0x2d, 0x00, 0xa0, 0x00, 0xa0, 0x10}, | |
752 | ||
753 | {0xb1, 0x5d, 0x0a, 0x00, 0x02, 0x00, 0x00, 0x10}, /* sensor clck ?2 */ | |
754 | {0xb1, 0x5d, 0x06, 0x00, 0x30, 0x00, 0x00, 0x10}, | |
755 | {0xb1, 0x5d, 0x05, 0x00, 0x0a, 0x00, 0x00, 0x10}, | |
756 | {0xb1, 0x5d, 0x09, 0x02, 0x35, 0x00, 0x00, 0x10}, /* exposure 2 */ | |
757 | ||
758 | {0xd1, 0x5d, 0x2b, 0x00, 0xb9, 0x00, 0xe3, 0x10}, | |
759 | {0xd1, 0x5d, 0x2d, 0x00, 0x5f, 0x00, 0xb9, 0x10}, /* 42 */ | |
760 | /* {0xb1, 0x5d, 0x35, 0x00, 0x67, 0x00, 0x00, 0x10}, * gain orig */ | |
761 | /* {0xb1, 0x5d, 0x35, 0x00, 0x20, 0x00, 0x00, 0x10}, * gain */ | |
762 | {0xb1, 0x5d, 0x07, 0x00, 0x03, 0x00, 0x00, 0x10}, /* update */ | |
763 | {0xb1, 0x5d, 0x07, 0x00, 0x02, 0x00, 0x00, 0x10}, /* sensor on */ | |
a5ae2062 | 764 | {} |
6a7eba24 | 765 | }; |
a067db84 JFM |
766 | static const u8 mi0360b_sensor_init[][8] = { |
767 | {0xb1, 0x5d, 0x07, 0x00, 0x02, 0x00, 0x00, 0x10}, | |
768 | {0xb1, 0x5d, 0x0d, 0x00, 0x01, 0x00, 0x00, 0x10}, | |
ccbc5df2 | 769 | {DELAY, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*delay 20ms*/ |
a067db84 | 770 | {0xb1, 0x5d, 0x0d, 0x00, 0x00, 0x00, 0x00, 0x10}, |
ccbc5df2 | 771 | {DELAY, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*delay 20ms*/ |
a067db84 JFM |
772 | {0xd1, 0x5d, 0x01, 0x00, 0x08, 0x00, 0x16, 0x10}, |
773 | {0xd1, 0x5d, 0x03, 0x01, 0xe2, 0x02, 0x82, 0x10}, | |
774 | {0xd1, 0x5d, 0x05, 0x00, 0x00, 0x00, 0x00, 0x10}, | |
775 | {0xb1, 0x5d, 0x0d, 0x00, 0x02, 0x00, 0x00, 0x10}, | |
776 | {0xd1, 0x5d, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x10}, | |
777 | {0xd1, 0x5d, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x10}, | |
778 | {0xd1, 0x5d, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x10}, | |
779 | {0xd1, 0x5d, 0x10, 0x00, 0x00, 0x00, 0x00, 0x10}, | |
780 | {0xd1, 0x5d, 0x12, 0x00, 0x00, 0x00, 0x00, 0x10}, | |
781 | {0xd1, 0x5d, 0x14, 0x00, 0x00, 0x00, 0x00, 0x10}, | |
782 | {0xd1, 0x5d, 0x16, 0x00, 0x00, 0x00, 0x00, 0x10}, | |
783 | {0xd1, 0x5d, 0x18, 0x00, 0x00, 0x00, 0x00, 0x10}, | |
784 | {0xd1, 0x5d, 0x1a, 0x00, 0x00, 0x00, 0x00, 0x10}, | |
785 | {0xd1, 0x5d, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x10}, | |
786 | {0xb1, 0x5d, 0x32, 0x00, 0x00, 0x00, 0x00, 0x10}, | |
787 | {0xd1, 0x5d, 0x20, 0x11, 0x01, 0x00, 0x00, 0x10}, | |
788 | {0xd1, 0x5d, 0x22, 0x00, 0x00, 0x00, 0x00, 0x10}, | |
789 | {0xd1, 0x5d, 0x24, 0x00, 0x00, 0x00, 0x00, 0x10}, | |
790 | {0xd1, 0x5d, 0x26, 0x00, 0x00, 0x00, 0x24, 0x10}, | |
791 | {0xd1, 0x5d, 0x2f, 0xf7, 0xb0, 0x00, 0x04, 0x10}, | |
792 | {0xd1, 0x5d, 0x31, 0x00, 0x00, 0x00, 0x00, 0x10}, | |
793 | {0xd1, 0x5d, 0x33, 0x00, 0x00, 0x01, 0x00, 0x10}, | |
794 | {0xb1, 0x5d, 0x3d, 0x06, 0x8f, 0x00, 0x00, 0x10}, | |
795 | {0xd1, 0x5d, 0x40, 0x01, 0xe0, 0x00, 0xd1, 0x10}, | |
796 | {0xb1, 0x5d, 0x44, 0x00, 0x82, 0x00, 0x00, 0x10}, | |
797 | {0xd1, 0x5d, 0x58, 0x00, 0x78, 0x00, 0x43, 0x10}, | |
798 | {0xd1, 0x5d, 0x5a, 0x00, 0x00, 0x00, 0x00, 0x10}, | |
799 | {0xd1, 0x5d, 0x5c, 0x00, 0x00, 0x00, 0x00, 0x10}, | |
800 | {0xd1, 0x5d, 0x5e, 0x00, 0x00, 0xa3, 0x1d, 0x10}, | |
801 | {0xb1, 0x5d, 0x62, 0x04, 0x11, 0x00, 0x00, 0x10}, | |
802 | ||
803 | {0xb1, 0x5d, 0x20, 0x11, 0x01, 0x00, 0x00, 0x10}, | |
804 | {0xb1, 0x5d, 0x20, 0x11, 0x01, 0x00, 0x00, 0x10}, | |
805 | {0xb1, 0x5d, 0x09, 0x00, 0x64, 0x00, 0x00, 0x10}, | |
806 | {0xd1, 0x5d, 0x2b, 0x00, 0x33, 0x00, 0xa0, 0x10}, | |
807 | {0xd1, 0x5d, 0x2d, 0x00, 0xa0, 0x00, 0x33, 0x10}, | |
808 | {} | |
809 | }; | |
810 | static const u8 mi0360b_sensor_param1[][8] = { | |
811 | {0xb1, 0x5d, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x10}, | |
812 | {0xb1, 0x5d, 0x06, 0x00, 0x53, 0x00, 0x00, 0x10}, | |
813 | {0xb1, 0x5d, 0x05, 0x00, 0x09, 0x00, 0x00, 0x10}, | |
814 | {0xb1, 0x5d, 0x09, 0x02, 0x35, 0x00, 0x00, 0x10}, /* exposure 2 */ | |
815 | ||
816 | {0xd1, 0x5d, 0x2b, 0x00, 0xd1, 0x01, 0xc9, 0x10}, | |
817 | {0xd1, 0x5d, 0x2d, 0x00, 0xed, 0x00, 0xd1, 0x10}, | |
818 | {0xb1, 0x5d, 0x07, 0x00, 0x03, 0x00, 0x00, 0x10}, /* update */ | |
819 | {0xb1, 0x5d, 0x07, 0x00, 0x02, 0x00, 0x00, 0x10}, /* sensor on */ | |
820 | {} | |
821 | }; | |
98819187 | 822 | static const u8 mo4000_sensor_init[][8] = { |
6a7eba24 JFM |
823 | {0xa1, 0x21, 0x01, 0x02, 0x00, 0x00, 0x00, 0x10}, |
824 | {0xa1, 0x21, 0x02, 0x00, 0x00, 0x00, 0x00, 0x10}, | |
825 | {0xa1, 0x21, 0x03, 0x00, 0x00, 0x00, 0x00, 0x10}, | |
826 | {0xa1, 0x21, 0x04, 0x00, 0x00, 0x00, 0x00, 0x10}, | |
827 | {0xa1, 0x21, 0x05, 0x00, 0x00, 0x00, 0x00, 0x10}, | |
828 | {0xa1, 0x21, 0x05, 0x04, 0x00, 0x00, 0x00, 0x10}, | |
829 | {0xa1, 0x21, 0x06, 0x80, 0x00, 0x00, 0x00, 0x10}, | |
830 | {0xa1, 0x21, 0x06, 0x81, 0x00, 0x00, 0x00, 0x10}, | |
831 | {0xa1, 0x21, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x10}, | |
832 | {0xa1, 0x21, 0x11, 0x00, 0x00, 0x00, 0x00, 0x10}, | |
833 | {0xa1, 0x21, 0x11, 0x20, 0x00, 0x00, 0x00, 0x10}, | |
834 | {0xa1, 0x21, 0x11, 0x30, 0x00, 0x00, 0x00, 0x10}, | |
835 | {0xa1, 0x21, 0x11, 0x38, 0x00, 0x00, 0x00, 0x10}, | |
836 | {0xa1, 0x21, 0x11, 0x38, 0x00, 0x00, 0x00, 0x10}, | |
837 | {0xa1, 0x21, 0x12, 0x00, 0x00, 0x00, 0x00, 0x10}, | |
838 | {0xa1, 0x21, 0x10, 0x00, 0x00, 0x00, 0x00, 0x10}, | |
839 | {0xa1, 0x21, 0x0f, 0x20, 0x00, 0x00, 0x00, 0x10}, | |
840 | {0xa1, 0x21, 0x10, 0x20, 0x00, 0x00, 0x00, 0x10}, | |
841 | {0xa1, 0x21, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10}, | |
842 | {0xa1, 0x21, 0x11, 0x38, 0x00, 0x00, 0x00, 0x10}, | |
a5ae2062 | 843 | {} |
6a7eba24 | 844 | }; |
3ef2c5be JFM |
845 | static const u8 mt9v111_sensor_init[][8] = { |
846 | {0xb1, 0x5c, 0x0d, 0x00, 0x01, 0x00, 0x00, 0x10}, /* reset? */ | |
ccbc5df2 | 847 | {DELAY, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* delay 20ms */ |
3ef2c5be JFM |
848 | {0xb1, 0x5c, 0x0d, 0x00, 0x00, 0x00, 0x00, 0x10}, |
849 | {0xb1, 0x5c, 0x01, 0x00, 0x01, 0x00, 0x00, 0x10}, /* IFP select */ | |
850 | {0xb1, 0x5c, 0x08, 0x04, 0x80, 0x00, 0x00, 0x10}, /* output fmt ctrl */ | |
851 | {0xb1, 0x5c, 0x06, 0x00, 0x00, 0x00, 0x00, 0x10}, /* op mode ctrl */ | |
2687a2fb JFM |
852 | {0xb1, 0x5c, 0x02, 0x00, 0x16, 0x00, 0x00, 0x10}, |
853 | {0xb1, 0x5c, 0x03, 0x01, 0xe1, 0x00, 0x00, 0x10}, | |
854 | {0xb1, 0x5c, 0x04, 0x02, 0x81, 0x00, 0x00, 0x10}, | |
855 | {0xb1, 0x5c, 0x05, 0x00, 0x04, 0x00, 0x00, 0x10}, | |
3ef2c5be | 856 | {0xb1, 0x5c, 0x01, 0x00, 0x04, 0x00, 0x00, 0x10}, /* sensor select */ |
2687a2fb JFM |
857 | {0xb1, 0x5c, 0x02, 0x00, 0x16, 0x00, 0x00, 0x10}, |
858 | {0xb1, 0x5c, 0x03, 0x01, 0xe6, 0x00, 0x00, 0x10}, | |
859 | {0xb1, 0x5c, 0x04, 0x02, 0x86, 0x00, 0x00, 0x10}, | |
860 | {0xb1, 0x5c, 0x05, 0x00, 0x04, 0x00, 0x00, 0x10}, | |
861 | {0xb1, 0x5c, 0x06, 0x00, 0x00, 0x00, 0x00, 0x10}, | |
3ef2c5be | 862 | {0xb1, 0x5c, 0x08, 0x00, 0x08, 0x00, 0x00, 0x10}, /* row start */ |
2687a2fb | 863 | {0xb1, 0x5c, 0x0e, 0x00, 0x08, 0x00, 0x00, 0x10}, |
3ef2c5be JFM |
864 | {0xb1, 0x5c, 0x02, 0x00, 0x16, 0x00, 0x00, 0x10}, /* col start */ |
865 | {0xb1, 0x5c, 0x03, 0x01, 0xe7, 0x00, 0x00, 0x10}, /* window height */ | |
866 | {0xb1, 0x5c, 0x04, 0x02, 0x87, 0x00, 0x00, 0x10}, /* window width */ | |
867 | {0xb1, 0x5c, 0x07, 0x30, 0x02, 0x00, 0x00, 0x10}, /* output ctrl */ | |
868 | {0xb1, 0x5c, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x10}, /* shutter delay */ | |
869 | {0xb1, 0x5c, 0x12, 0x00, 0xb0, 0x00, 0x00, 0x10}, /* zoom col start */ | |
870 | {0xb1, 0x5c, 0x13, 0x00, 0x7c, 0x00, 0x00, 0x10}, /* zoom row start */ | |
871 | {0xb1, 0x5c, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x10}, /* digital zoom */ | |
872 | {0xb1, 0x5c, 0x20, 0x00, 0x00, 0x00, 0x00, 0x10}, /* read mode */ | |
873 | {0xb1, 0x5c, 0x20, 0x00, 0x00, 0x00, 0x00, 0x10}, | |
3fccb774 JFM |
874 | {} |
875 | }; | |
876 | static const u8 mt9v111_sensor_param1[][8] = { | |
3ef2c5be JFM |
877 | {0xb1, 0x5c, 0x20, 0x00, 0x00, 0x00, 0x00, 0x10}, |
878 | {0xb1, 0x5c, 0x20, 0x00, 0x00, 0x00, 0x00, 0x10}, | |
2687a2fb | 879 | {0xb1, 0x5c, 0x09, 0x01, 0x2c, 0x00, 0x00, 0x10}, |
3ef2c5be JFM |
880 | {0xd1, 0x5c, 0x2b, 0x00, 0x33, 0x00, 0xa0, 0x10}, /* green1 gain */ |
881 | {0xd1, 0x5c, 0x2d, 0x00, 0xa0, 0x00, 0x33, 0x10}, /* red gain */ | |
882 | /*******/ | |
883 | {0xb1, 0x5c, 0x06, 0x00, 0x1e, 0x00, 0x00, 0x10}, /* vert blanking */ | |
884 | {0xb1, 0x5c, 0x05, 0x00, 0x0a, 0x00, 0x00, 0x10}, /* horiz blanking */ | |
885 | {0xd1, 0x5c, 0x2c, 0x00, 0xad, 0x00, 0xad, 0x10}, /* blue gain */ | |
886 | {0xb1, 0x5c, 0x35, 0x01, 0xc0, 0x00, 0x00, 0x10}, /* global gain */ | |
887 | {} | |
888 | }; | |
3fccb774 JFM |
889 | static const u8 om6802_init0[2][8] = { |
890 | /*fixme: variable*/ | |
891 | {0xa0, 0x34, 0x29, 0x0e, 0x00, 0x00, 0x00, 0x10}, | |
892 | {0xa0, 0x34, 0x23, 0xb0, 0x00, 0x00, 0x00, 0x10}, | |
893 | }; | |
98819187 | 894 | static const u8 om6802_sensor_init[][8] = { |
3fccb774 JFM |
895 | {0xa0, 0x34, 0xdf, 0x6d, 0x00, 0x00, 0x00, 0x10}, |
896 | /* factory mode */ | |
d2d16e90 | 897 | {0xa0, 0x34, 0xdd, 0x18, 0x00, 0x00, 0x00, 0x10}, |
d5aa3856 | 898 | /* output raw RGB */ |
3fccb774 | 899 | {0xa0, 0x34, 0x5a, 0xc0, 0x00, 0x00, 0x00, 0x10}, |
d2d16e90 JFM |
900 | /* {0xa0, 0x34, 0xfb, 0x11, 0x00, 0x00, 0x00, 0x10}, */ |
901 | {0xa0, 0x34, 0xf0, 0x04, 0x00, 0x00, 0x00, 0x10}, | |
d5aa3856 | 902 | /* auto-exposure speed (0) / white balance mode (auto RGB) */ |
d2d16e90 JFM |
903 | /* {0xa0, 0x34, 0xf1, 0x02, 0x00, 0x00, 0x00, 0x10}, |
904 | * set color mode */ | |
905 | /* {0xa0, 0x34, 0xfe, 0x5b, 0x00, 0x00, 0x00, 0x10}, | |
906 | * max AGC value in AE */ | |
907 | /* {0xa0, 0x34, 0xe5, 0x00, 0x00, 0x00, 0x00, 0x10}, | |
908 | * preset AGC */ | |
909 | /* {0xa0, 0x34, 0xe6, 0x00, 0x00, 0x00, 0x00, 0x10}, | |
910 | * preset brightness */ | |
911 | /* {0xa0, 0x34, 0xe7, 0x00, 0x00, 0x00, 0x00, 0x10}, | |
912 | * preset contrast */ | |
913 | /* {0xa0, 0x34, 0xe8, 0x31, 0x00, 0x00, 0x00, 0x10}, | |
914 | * preset gamma */ | |
915 | {0xa0, 0x34, 0xe9, 0x0f, 0x00, 0x00, 0x00, 0x10}, | |
d5aa3856 | 916 | /* luminance mode (0x4f -> AutoExpo on) */ |
d2d16e90 JFM |
917 | {0xa0, 0x34, 0xe4, 0xff, 0x00, 0x00, 0x00, 0x10}, |
918 | /* preset shutter */ | |
919 | /* {0xa0, 0x34, 0xef, 0x00, 0x00, 0x00, 0x00, 0x10}, | |
920 | * auto frame rate */ | |
921 | /* {0xa0, 0x34, 0xfb, 0xee, 0x00, 0x00, 0x00, 0x10}, */ | |
3fccb774 JFM |
922 | {0xa0, 0x34, 0x5d, 0x80, 0x00, 0x00, 0x00, 0x10}, |
923 | {} | |
924 | }; | |
925 | static const u8 om6802_sensor_param1[][8] = { | |
926 | {0xa0, 0x34, 0x71, 0x84, 0x00, 0x00, 0x00, 0x10}, | |
927 | {0xa0, 0x34, 0x72, 0x05, 0x00, 0x00, 0x00, 0x10}, | |
928 | {0xa0, 0x34, 0x68, 0x80, 0x00, 0x00, 0x00, 0x10}, | |
929 | {0xa0, 0x34, 0x69, 0x01, 0x00, 0x00, 0x00, 0x10}, | |
d2d16e90 JFM |
930 | {} |
931 | }; | |
98819187 | 932 | static const u8 ov7630_sensor_init[][8] = { |
6ab0b174 JFM |
933 | {0xa1, 0x21, 0x76, 0x01, 0x00, 0x00, 0x00, 0x10}, |
934 | {0xa1, 0x21, 0x12, 0xc8, 0x00, 0x00, 0x00, 0x10}, | |
ccbc5df2 | 935 | {DELAY, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* delay 20ms */ |
6ab0b174 JFM |
936 | {0xa1, 0x21, 0x12, 0x48, 0x00, 0x00, 0x00, 0x10}, |
937 | {0xa1, 0x21, 0x12, 0xc8, 0x00, 0x00, 0x00, 0x10}, | |
ccbc5df2 | 938 | {DELAY, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* delay 20ms */ |
6ab0b174 | 939 | {0xa1, 0x21, 0x12, 0x48, 0x00, 0x00, 0x00, 0x10}, |
05b809c7 | 940 | /* win: i2c_r from 00 to 80 */ |
6ab0b174 JFM |
941 | {0xd1, 0x21, 0x03, 0x80, 0x10, 0x20, 0x80, 0x10}, |
942 | {0xb1, 0x21, 0x0c, 0x20, 0x20, 0x00, 0x00, 0x10}, | |
cc7b5b57 HG |
943 | /* HDG: 0x11 was 0x00 change to 0x01 for better exposure (15 fps instead of 30) |
944 | 0x13 was 0xc0 change to 0xc3 for auto gain and exposure */ | |
945 | {0xd1, 0x21, 0x11, 0x01, 0x48, 0xc3, 0x00, 0x10}, | |
6ab0b174 JFM |
946 | {0xb1, 0x21, 0x15, 0x80, 0x03, 0x00, 0x00, 0x10}, |
947 | {0xd1, 0x21, 0x17, 0x1b, 0xbd, 0x05, 0xf6, 0x10}, | |
948 | {0xa1, 0x21, 0x1b, 0x04, 0x00, 0x00, 0x00, 0x10}, | |
949 | {0xd1, 0x21, 0x1f, 0x00, 0x80, 0x80, 0x80, 0x10}, | |
950 | {0xd1, 0x21, 0x23, 0xde, 0x10, 0x8a, 0xa0, 0x10}, | |
951 | {0xc1, 0x21, 0x27, 0xca, 0xa2, 0x74, 0x00, 0x10}, | |
952 | {0xd1, 0x21, 0x2a, 0x88, 0x00, 0x88, 0x01, 0x10}, | |
953 | {0xc1, 0x21, 0x2e, 0x80, 0x00, 0x18, 0x00, 0x10}, | |
954 | {0xa1, 0x21, 0x21, 0x08, 0x00, 0x00, 0x00, 0x10}, | |
955 | {0xa1, 0x21, 0x22, 0x00, 0x00, 0x00, 0x00, 0x10}, | |
956 | {0xa1, 0x21, 0x2e, 0x00, 0x00, 0x00, 0x00, 0x10}, | |
957 | {0xb1, 0x21, 0x32, 0xc2, 0x08, 0x00, 0x00, 0x10}, | |
958 | {0xb1, 0x21, 0x4c, 0x00, 0x00, 0x00, 0x00, 0x10}, | |
959 | {0xd1, 0x21, 0x60, 0x05, 0x40, 0x12, 0x57, 0x10}, | |
960 | {0xa1, 0x21, 0x64, 0x73, 0x00, 0x00, 0x00, 0x10}, | |
961 | {0xd1, 0x21, 0x65, 0x00, 0x55, 0x01, 0xac, 0x10}, | |
962 | {0xa1, 0x21, 0x69, 0x38, 0x00, 0x00, 0x00, 0x10}, | |
963 | {0xd1, 0x21, 0x6f, 0x1f, 0x01, 0x00, 0x10, 0x10}, | |
964 | {0xd1, 0x21, 0x73, 0x50, 0x20, 0x02, 0x01, 0x10}, | |
965 | {0xd1, 0x21, 0x77, 0xf3, 0x90, 0x98, 0x98, 0x10}, | |
966 | {0xc1, 0x21, 0x7b, 0x00, 0x4c, 0xf7, 0x00, 0x10}, | |
967 | {0xd1, 0x21, 0x17, 0x1b, 0xbd, 0x05, 0xf6, 0x10}, | |
968 | {0xa1, 0x21, 0x1b, 0x04, 0x00, 0x00, 0x00, 0x10}, | |
bdd2b93c JFM |
969 | {} |
970 | }; | |
971 | static const u8 ov7630_sensor_param1[][8] = { | |
6ab0b174 JFM |
972 | {0xa1, 0x21, 0x12, 0x48, 0x00, 0x00, 0x00, 0x10}, |
973 | {0xa1, 0x21, 0x12, 0x48, 0x00, 0x00, 0x00, 0x10}, | |
974 | /*fixme: + 0x12, 0x04*/ | |
6c86274f JFM |
975 | /* {0xa1, 0x21, 0x75, 0x82, 0x00, 0x00, 0x00, 0x10}, * COMN |
976 | * set by setvflip */ | |
6ab0b174 JFM |
977 | {0xa1, 0x21, 0x10, 0x32, 0x00, 0x00, 0x00, 0x10}, |
978 | {0xa1, 0x21, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10}, | |
979 | {0xb1, 0x21, 0x01, 0x80, 0x80, 0x00, 0x00, 0x10}, | |
05b809c7 | 980 | /* */ |
37c6dbe2 HG |
981 | /* {0xa1, 0x21, 0x2a, 0x88, 0x00, 0x00, 0x00, 0x10}, * set by setfreq */ |
982 | /* {0xa1, 0x21, 0x2b, 0x34, 0x00, 0x00, 0x00, 0x10}, * set by setfreq */ | |
05b809c7 | 983 | /* */ |
6ab0b174 | 984 | {0xa1, 0x21, 0x10, 0x83, 0x00, 0x00, 0x00, 0x10}, |
91de65ac | 985 | /* {0xb1, 0x21, 0x01, 0x88, 0x70, 0x00, 0x00, 0x10}, */ |
6ab0b174 JFM |
986 | {} |
987 | }; | |
6270330a | 988 | |
98819187 | 989 | static const u8 ov7648_sensor_init[][8] = { |
6270330a JFM |
990 | {0xa1, 0x21, 0x76, 0x00, 0x00, 0x00, 0x00, 0x10}, |
991 | {0xa1, 0x21, 0x12, 0x80, 0x00, 0x00, 0x00, 0x10}, /* reset */ | |
ccbc5df2 | 992 | {DELAY, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* delay 20ms */ |
6270330a JFM |
993 | {0xa1, 0x21, 0x12, 0x00, 0x00, 0x00, 0x00, 0x10}, |
994 | {0xd1, 0x21, 0x03, 0xa4, 0x30, 0x88, 0x00, 0x10}, | |
995 | {0xb1, 0x21, 0x11, 0x80, 0x08, 0x00, 0x00, 0x10}, | |
996 | {0xc1, 0x21, 0x13, 0xa0, 0x04, 0x84, 0x00, 0x10}, | |
997 | {0xd1, 0x21, 0x17, 0x1a, 0x02, 0xba, 0xf4, 0x10}, | |
998 | {0xa1, 0x21, 0x1b, 0x04, 0x00, 0x00, 0x00, 0x10}, | |
999 | {0xd1, 0x21, 0x1f, 0x41, 0xc0, 0x80, 0x80, 0x10}, | |
1000 | {0xd1, 0x21, 0x23, 0xde, 0xa0, 0x80, 0x32, 0x10}, | |
1001 | {0xd1, 0x21, 0x27, 0xfe, 0xa0, 0x00, 0x91, 0x10}, | |
1002 | {0xd1, 0x21, 0x2b, 0x00, 0x88, 0x85, 0x80, 0x10}, | |
1003 | {0xc1, 0x21, 0x2f, 0x9c, 0x00, 0xc4, 0x00, 0x10}, | |
1004 | {0xd1, 0x21, 0x60, 0xa6, 0x60, 0x88, 0x12, 0x10}, | |
1005 | {0xd1, 0x21, 0x64, 0x88, 0x00, 0x00, 0x94, 0x10}, | |
1006 | {0xd1, 0x21, 0x68, 0x7a, 0x0c, 0x00, 0x00, 0x10}, | |
1007 | {0xd1, 0x21, 0x6c, 0x11, 0x33, 0x22, 0x00, 0x10}, | |
1008 | {0xd1, 0x21, 0x70, 0x11, 0x00, 0x10, 0x50, 0x10}, | |
1009 | {0xd1, 0x21, 0x74, 0x20, 0x06, 0x00, 0xb5, 0x10}, | |
1010 | {0xd1, 0x21, 0x78, 0x8a, 0x00, 0x00, 0x00, 0x10}, | |
1011 | {0xb1, 0x21, 0x7c, 0x00, 0x43, 0x00, 0x00, 0x10}, | |
1012 | ||
1013 | {0xd1, 0x21, 0x21, 0x86, 0x00, 0xde, 0xa0, 0x10}, | |
1014 | /* {0xd1, 0x21, 0x25, 0x80, 0x32, 0xfe, 0xa0, 0x10}, jfm done */ | |
1015 | /* {0xd1, 0x21, 0x29, 0x00, 0x91, 0x00, 0x88, 0x10}, jfm done */ | |
37c6dbe2 | 1016 | /* {0xb1, 0x21, 0x2d, 0x85, 0x00, 0x00, 0x00, 0x10}, set by setfreq */ |
3fccb774 JFM |
1017 | {} |
1018 | }; | |
1019 | static const u8 ov7648_sensor_param1[][8] = { | |
6270330a | 1020 | /* {0xa1, 0x21, 0x12, 0x08, 0x00, 0x00, 0x00, 0x10}, jfm done */ |
2797ba2a JFM |
1021 | /* {0xa1, 0x21, 0x75, 0x06, 0x00, 0x00, 0x00, 0x10}, * COMN |
1022 | * set by setvflip */ | |
6270330a JFM |
1023 | {0xa1, 0x21, 0x19, 0x02, 0x00, 0x00, 0x00, 0x10}, |
1024 | {0xa1, 0x21, 0x10, 0x32, 0x00, 0x00, 0x00, 0x10}, | |
1025 | /* {0xa1, 0x21, 0x16, 0x00, 0x00, 0x00, 0x00, 0x10}, jfm done */ | |
1026 | /* {0xa1, 0x21, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10}, * GAIN - def */ | |
1027 | /* {0xb1, 0x21, 0x01, 0x6c, 0x6c, 0x00, 0x00, 0x10}, * B R - def: 80 */ | |
1028 | /*...*/ | |
1029 | {0xa1, 0x21, 0x11, 0x81, 0x00, 0x00, 0x00, 0x10}, /* CLKRC */ | |
1030 | /* {0xa1, 0x21, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x10}, jfm done */ | |
1031 | /* {0xa1, 0x21, 0x16, 0x00, 0x00, 0x00, 0x00, 0x10}, jfm done */ | |
1032 | /* {0xa1, 0x21, 0x2a, 0x91, 0x00, 0x00, 0x00, 0x10}, jfm done */ | |
1033 | /* {0xa1, 0x21, 0x2b, 0x00, 0x00, 0x00, 0x00, 0x10}, jfm done */ | |
1034 | /* {0xb1, 0x21, 0x01, 0x64, 0x84, 0x00, 0x00, 0x10}, * B R - def: 80 */ | |
1035 | ||
1036 | {} | |
1037 | }; | |
1038 | ||
98819187 | 1039 | static const u8 ov7660_sensor_init[][8] = { |
6a7eba24 | 1040 | {0xa1, 0x21, 0x12, 0x80, 0x00, 0x00, 0x00, 0x10}, /* reset SCCB */ |
ccbc5df2 | 1041 | {DELAY, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* delay 20ms */ |
6a7eba24 | 1042 | {0xa1, 0x21, 0x12, 0x05, 0x00, 0x00, 0x00, 0x10}, |
738608ae | 1043 | /* Outformat = rawRGB */ |
6a7eba24 | 1044 | {0xa1, 0x21, 0x13, 0xb8, 0x00, 0x00, 0x00, 0x10}, /* init COM8 */ |
d8f400ef | 1045 | {0xd1, 0x21, 0x00, 0x01, 0x74, 0x92, 0x00, 0x10}, |
6a7eba24 JFM |
1046 | /* GAIN BLUE RED VREF */ |
1047 | {0xd1, 0x21, 0x04, 0x00, 0x7d, 0x62, 0x00, 0x10}, | |
1048 | /* COM 1 BAVE GEAVE AECHH */ | |
1049 | {0xb1, 0x21, 0x08, 0x83, 0x01, 0x00, 0x00, 0x10}, /* RAVE COM2 */ | |
1050 | {0xd1, 0x21, 0x0c, 0x00, 0x08, 0x04, 0x4f, 0x10}, /* COM 3 4 5 6 */ | |
47f7f6fb | 1051 | {0xd1, 0x21, 0x10, 0x7f, 0x40, 0x05, 0xff, 0x10}, |
6a7eba24 JFM |
1052 | /* AECH CLKRC COM7 COM8 */ |
1053 | {0xc1, 0x21, 0x14, 0x2c, 0x00, 0x02, 0x00, 0x10}, /* COM9 COM10 */ | |
1054 | {0xd1, 0x21, 0x17, 0x10, 0x60, 0x02, 0x7b, 0x10}, | |
1055 | /* HSTART HSTOP VSTRT VSTOP */ | |
1056 | {0xa1, 0x21, 0x1b, 0x02, 0x00, 0x00, 0x00, 0x10}, /* PSHFT */ | |
1057 | {0xb1, 0x21, 0x1e, 0x01, 0x0e, 0x00, 0x00, 0x10}, /* MVFP LAEC */ | |
1058 | {0xd1, 0x21, 0x20, 0x07, 0x07, 0x07, 0x07, 0x10}, | |
1059 | /* BOS GBOS GROS ROS (BGGR offset) */ | |
738608ae JFM |
1060 | /* {0xd1, 0x21, 0x24, 0x68, 0x58, 0xd4, 0x80, 0x10}, */ |
1061 | {0xd1, 0x21, 0x24, 0x78, 0x68, 0xd4, 0x80, 0x10}, | |
6a7eba24 JFM |
1062 | /* AEW AEB VPT BBIAS */ |
1063 | {0xd1, 0x21, 0x28, 0x80, 0x30, 0x00, 0x00, 0x10}, | |
1064 | /* GbBIAS RSVD EXHCH EXHCL */ | |
1065 | {0xd1, 0x21, 0x2c, 0x80, 0x00, 0x00, 0x62, 0x10}, | |
1066 | /* RBIAS ADVFL ASDVFH YAVE */ | |
1067 | {0xc1, 0x21, 0x30, 0x08, 0x30, 0xb4, 0x00, 0x10}, | |
1068 | /* HSYST HSYEN HREF */ | |
1069 | {0xd1, 0x21, 0x33, 0x00, 0x07, 0x84, 0x00, 0x10}, /* reserved */ | |
1070 | {0xd1, 0x21, 0x37, 0x0c, 0x02, 0x43, 0x00, 0x10}, | |
1071 | /* ADC ACOM OFON TSLB */ | |
1072 | {0xd1, 0x21, 0x3b, 0x02, 0x6c, 0x19, 0x0e, 0x10}, | |
1073 | /* COM11 COM12 COM13 COM14 */ | |
1074 | {0xd1, 0x21, 0x3f, 0x41, 0xc1, 0x22, 0x08, 0x10}, | |
1075 | /* EDGE COM15 COM16 COM17 */ | |
1076 | {0xd1, 0x21, 0x43, 0xf0, 0x10, 0x78, 0xa8, 0x10}, /* reserved */ | |
1077 | {0xd1, 0x21, 0x47, 0x60, 0x80, 0x00, 0x00, 0x10}, /* reserved */ | |
1078 | {0xd1, 0x21, 0x4b, 0x00, 0x00, 0x00, 0x00, 0x10}, /* reserved */ | |
1079 | {0xd1, 0x21, 0x4f, 0x46, 0x36, 0x0f, 0x17, 0x10}, /* MTX 1 2 3 4 */ | |
1080 | {0xd1, 0x21, 0x53, 0x7f, 0x96, 0x40, 0x40, 0x10}, /* MTX 5 6 7 8 */ | |
1081 | {0xb1, 0x21, 0x57, 0x40, 0x0f, 0x00, 0x00, 0x10}, /* MTX9 MTXS */ | |
1082 | {0xd1, 0x21, 0x59, 0xba, 0x9a, 0x22, 0xb9, 0x10}, /* reserved */ | |
1083 | {0xd1, 0x21, 0x5d, 0x9b, 0x10, 0xf0, 0x05, 0x10}, /* reserved */ | |
1084 | {0xa1, 0x21, 0x61, 0x60, 0x00, 0x00, 0x00, 0x10}, /* reserved */ | |
1085 | {0xd1, 0x21, 0x62, 0x00, 0x00, 0x50, 0x30, 0x10}, | |
1086 | /* LCC1 LCC2 LCC3 LCC4 */ | |
1087 | {0xa1, 0x21, 0x66, 0x00, 0x00, 0x00, 0x00, 0x10}, /* LCC5 */ | |
738608ae | 1088 | {0xd1, 0x21, 0x67, 0x80, 0x7a, 0x90, 0x80, 0x10}, /* MANU */ |
6a7eba24 | 1089 | {0xa1, 0x21, 0x6b, 0x0a, 0x00, 0x00, 0x00, 0x10}, |
738608ae | 1090 | /* band gap reference [0:3] DBLV */ |
6a7eba24 JFM |
1091 | {0xd1, 0x21, 0x6c, 0x30, 0x48, 0x80, 0x74, 0x10}, /* gamma curve */ |
1092 | {0xd1, 0x21, 0x70, 0x64, 0x60, 0x5c, 0x58, 0x10}, /* gamma curve */ | |
1093 | {0xd1, 0x21, 0x74, 0x54, 0x4c, 0x40, 0x38, 0x10}, /* gamma curve */ | |
1094 | {0xd1, 0x21, 0x78, 0x34, 0x30, 0x2f, 0x2b, 0x10}, /* gamma curve */ | |
1095 | {0xd1, 0x21, 0x7c, 0x03, 0x07, 0x17, 0x34, 0x10}, /* gamma curve */ | |
1096 | {0xd1, 0x21, 0x80, 0x41, 0x4d, 0x58, 0x63, 0x10}, /* gamma curve */ | |
1097 | {0xd1, 0x21, 0x84, 0x6e, 0x77, 0x87, 0x95, 0x10}, /* gamma curve */ | |
1098 | {0xc1, 0x21, 0x88, 0xaf, 0xc7, 0xdf, 0x00, 0x10}, /* gamma curve */ | |
1099 | {0xc1, 0x21, 0x8b, 0x99, 0x99, 0xcf, 0x00, 0x10}, /* reserved */ | |
738608ae | 1100 | {0xb1, 0x21, 0x92, 0x00, 0x00, 0x00, 0x00, 0x10}, /* DM_LNL/H */ |
3fccb774 | 1101 | /* not in all ms-win traces*/ |
47f7f6fb | 1102 | {0xa1, 0x21, 0xa1, 0x00, 0x00, 0x00, 0x00, 0x10}, |
3fccb774 JFM |
1103 | {} |
1104 | }; | |
1105 | static const u8 ov7660_sensor_param1[][8] = { | |
738608ae | 1106 | {0xa1, 0x21, 0x1e, 0x01, 0x00, 0x00, 0x00, 0x10}, /* MVFP */ |
6a7eba24 JFM |
1107 | /* bits[3..0]reserved */ |
1108 | {0xa1, 0x21, 0x1e, 0x01, 0x00, 0x00, 0x00, 0x10}, | |
1109 | {0xa1, 0x21, 0x03, 0x00, 0x00, 0x00, 0x00, 0x10}, | |
1110 | /* VREF vertical frame ctrl */ | |
1111 | {0xa1, 0x21, 0x03, 0x00, 0x00, 0x00, 0x00, 0x10}, | |
738608ae JFM |
1112 | {0xa1, 0x21, 0x10, 0x20, 0x00, 0x00, 0x00, 0x10}, /* AECH 0x20 */ |
1113 | {0xa1, 0x21, 0x2d, 0x00, 0x00, 0x00, 0x00, 0x10}, /* ADVFL */ | |
1114 | {0xa1, 0x21, 0x2e, 0x00, 0x00, 0x00, 0x00, 0x10}, /* ADVFH */ | |
1115 | {0xa1, 0x21, 0x00, 0x1f, 0x00, 0x00, 0x00, 0x10}, /* GAIN */ | |
1116 | /* {0xb1, 0x21, 0x01, 0x78, 0x78, 0x00, 0x00, 0x10}, * BLUE */ | |
6a7eba24 | 1117 | /****** (some exchanges in the win trace) ******/ |
3fccb774 | 1118 | /*fixme:param2*/ |
6a7eba24 | 1119 | {0xa1, 0x21, 0x93, 0x00, 0x00, 0x00, 0x00, 0x10},/* dummy line hight */ |
738608ae JFM |
1120 | {0xa1, 0x21, 0x92, 0x25, 0x00, 0x00, 0x00, 0x10}, /* dummy line low */ |
1121 | {0xa1, 0x21, 0x2a, 0x00, 0x00, 0x00, 0x00, 0x10}, /* EXHCH */ | |
1122 | {0xa1, 0x21, 0x2b, 0x00, 0x00, 0x00, 0x00, 0x10}, /* EXHCL */ | |
1123 | /* {0xa1, 0x21, 0x02, 0x90, 0x00, 0x00, 0x00, 0x10}, * RED */ | |
6a7eba24 | 1124 | /****** (some exchanges in the win trace) ******/ |
738608ae | 1125 | /******!! startsensor KO if changed !!****/ |
3fccb774 | 1126 | /*fixme: param3*/ |
6a7eba24 JFM |
1127 | {0xa1, 0x21, 0x93, 0x01, 0x00, 0x00, 0x00, 0x10}, |
1128 | {0xa1, 0x21, 0x92, 0xff, 0x00, 0x00, 0x00, 0x10}, | |
1129 | {0xa1, 0x21, 0x2a, 0x00, 0x00, 0x00, 0x00, 0x10}, | |
1130 | {0xa1, 0x21, 0x2b, 0xc3, 0x00, 0x00, 0x00, 0x10}, | |
a5ae2062 | 1131 | {} |
6a7eba24 | 1132 | }; |
6a7eba24 | 1133 | |
b8c8a5bf JFM |
1134 | static const u8 po1030_sensor_init[][8] = { |
1135 | /* the sensor registers are described in m5602/m5602_po1030.h */ | |
1136 | {0xa1, 0x6e, 0x3f, 0x20, 0x00, 0x00, 0x00, 0x10}, /* sensor reset */ | |
ccbc5df2 | 1137 | {DELAY, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* delay 20ms */ |
b8c8a5bf JFM |
1138 | {0xa1, 0x6e, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x10}, |
1139 | {0xa1, 0x6e, 0x3e, 0x00, 0x00, 0x00, 0x00, 0x10}, | |
1140 | {0xd1, 0x6e, 0x04, 0x02, 0xb1, 0x02, 0x39, 0x10}, | |
1141 | {0xd1, 0x6e, 0x08, 0x00, 0x01, 0x00, 0x00, 0x10}, | |
1142 | {0xd1, 0x6e, 0x0c, 0x02, 0x7f, 0x01, 0xe0, 0x10}, | |
1143 | {0xd1, 0x6e, 0x12, 0x03, 0x02, 0x00, 0x03, 0x10}, | |
1144 | {0xd1, 0x6e, 0x16, 0x85, 0x40, 0x4a, 0x40, 0x10}, /* r/g1/b/g2 gains */ | |
1145 | {0xc1, 0x6e, 0x1a, 0x00, 0x80, 0x00, 0x00, 0x10}, | |
1146 | {0xd1, 0x6e, 0x1d, 0x08, 0x03, 0x00, 0x00, 0x10}, | |
1147 | {0xd1, 0x6e, 0x23, 0x00, 0xb0, 0x00, 0x94, 0x10}, | |
1148 | {0xd1, 0x6e, 0x27, 0x58, 0x00, 0x00, 0x00, 0x10}, | |
1149 | {0xb1, 0x6e, 0x2b, 0x00, 0x00, 0x00, 0x00, 0x10}, | |
1150 | {0xd1, 0x6e, 0x2d, 0x14, 0x35, 0x61, 0x84, 0x10}, /* gamma corr */ | |
1151 | {0xd1, 0x6e, 0x31, 0xa2, 0xbd, 0xd8, 0xff, 0x10}, | |
1152 | {0xd1, 0x6e, 0x35, 0x06, 0x1e, 0x12, 0x02, 0x10}, /* color matrix */ | |
1153 | {0xd1, 0x6e, 0x39, 0xaa, 0x53, 0x37, 0xd5, 0x10}, | |
1154 | {0xa1, 0x6e, 0x3d, 0xf2, 0x00, 0x00, 0x00, 0x10}, | |
1155 | {0xd1, 0x6e, 0x3e, 0x00, 0x00, 0x80, 0x03, 0x10}, | |
1156 | {0xd1, 0x6e, 0x42, 0x03, 0x00, 0x00, 0x00, 0x10}, | |
1157 | {0xc1, 0x6e, 0x46, 0x00, 0x80, 0x80, 0x00, 0x10}, | |
1158 | {0xd1, 0x6e, 0x4b, 0x02, 0xef, 0x08, 0xcd, 0x10}, | |
1159 | {0xd1, 0x6e, 0x4f, 0x00, 0xd0, 0x00, 0xa0, 0x10}, | |
1160 | {0xd1, 0x6e, 0x53, 0x01, 0xaa, 0x01, 0x40, 0x10}, | |
1161 | {0xd1, 0x6e, 0x5a, 0x50, 0x04, 0x30, 0x03, 0x10}, /* raw rgb bayer */ | |
1162 | {0xa1, 0x6e, 0x5e, 0x00, 0x00, 0x00, 0x00, 0x10}, | |
1163 | {0xd1, 0x6e, 0x5f, 0x10, 0x40, 0xff, 0x00, 0x10}, | |
1164 | ||
1165 | {0xd1, 0x6e, 0x63, 0x40, 0x40, 0x00, 0x00, 0x10}, | |
1166 | {0xd1, 0x6e, 0x67, 0x00, 0x00, 0x00, 0x00, 0x10}, | |
1167 | {0xd1, 0x6e, 0x6b, 0x00, 0x00, 0x00, 0x00, 0x10}, | |
1168 | {0xd1, 0x6e, 0x6f, 0x00, 0x00, 0x00, 0x00, 0x10}, | |
1169 | {0xc1, 0x6e, 0x73, 0x10, 0x80, 0xeb, 0x00, 0x10}, | |
1170 | {} | |
1171 | }; | |
1172 | static const u8 po1030_sensor_param1[][8] = { | |
1173 | /* from ms-win traces - these values change with auto gain/expo/wb.. */ | |
1174 | {0xa1, 0x6e, 0x1e, 0x03, 0x00, 0x00, 0x00, 0x10}, | |
1175 | {0xa1, 0x6e, 0x1e, 0x03, 0x00, 0x00, 0x00, 0x10}, | |
1176 | /* mean values */ | |
1177 | {0xc1, 0x6e, 0x1a, 0x02, 0xd4, 0xa4, 0x00, 0x10}, /* integlines */ | |
1178 | {0xa1, 0x6e, 0x15, 0x04, 0x00, 0x00, 0x00, 0x10}, /* global gain */ | |
1179 | {0xc1, 0x6e, 0x16, 0x40, 0x40, 0x40, 0x00, 0x10}, /* r/g1/b gains */ | |
1180 | ||
1181 | {0xa1, 0x6e, 0x1d, 0x08, 0x00, 0x00, 0x00, 0x10}, /* control1 */ | |
1182 | {0xa1, 0x6e, 0x06, 0x02, 0x00, 0x00, 0x00, 0x10}, /* frameheight */ | |
1183 | {0xa1, 0x6e, 0x07, 0xd5, 0x00, 0x00, 0x00, 0x10}, | |
1184 | /* {0xc1, 0x6e, 0x16, 0x49, 0x40, 0x45, 0x00, 0x10}, */ | |
1185 | {} | |
1186 | }; | |
1187 | ||
ad98c0f6 JFM |
1188 | static const u8 po2030n_sensor_init[][8] = { |
1189 | {0xa1, 0x6e, 0x1e, 0x1a, 0x00, 0x00, 0x00, 0x10}, | |
1190 | {0xa1, 0x6e, 0x1f, 0x99, 0x00, 0x00, 0x00, 0x10}, | |
ccbc5df2 | 1191 | {DELAY, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* delay 10ms */ |
ad98c0f6 JFM |
1192 | {0xa1, 0x6e, 0x1e, 0x0a, 0x00, 0x00, 0x00, 0x10}, |
1193 | {0xa1, 0x6e, 0x1f, 0x19, 0x00, 0x00, 0x00, 0x10}, | |
ccbc5df2 | 1194 | {DELAY, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* delay 10ms */ |
ad98c0f6 JFM |
1195 | {0xa1, 0x6e, 0x20, 0x44, 0x00, 0x00, 0x00, 0x10}, |
1196 | {0xa1, 0x6e, 0x04, 0x03, 0x00, 0x00, 0x00, 0x10}, | |
1197 | {0xa1, 0x6e, 0x05, 0x70, 0x00, 0x00, 0x00, 0x10}, | |
1198 | {0xa1, 0x6e, 0x06, 0x02, 0x00, 0x00, 0x00, 0x10}, | |
1199 | {0xa1, 0x6e, 0x07, 0x25, 0x00, 0x00, 0x00, 0x10}, | |
1200 | {0xd1, 0x6e, 0x08, 0x00, 0xd0, 0x00, 0x08, 0x10}, | |
1201 | {0xd1, 0x6e, 0x0c, 0x03, 0x50, 0x01, 0xe8, 0x10}, | |
1202 | {0xd1, 0x6e, 0x1d, 0x20, 0x0a, 0x19, 0x44, 0x10}, | |
1203 | {0xd1, 0x6e, 0x21, 0x00, 0x00, 0x00, 0x00, 0x10}, | |
1204 | {0xd1, 0x6e, 0x25, 0x00, 0x00, 0x00, 0x00, 0x10}, | |
1205 | {0xd1, 0x6e, 0x29, 0x00, 0x00, 0x00, 0x00, 0x10}, | |
1206 | {0xd1, 0x6e, 0x2d, 0x00, 0x00, 0x00, 0x00, 0x10}, | |
1207 | {0xd1, 0x6e, 0x31, 0x00, 0x00, 0x00, 0x00, 0x10}, | |
1208 | {0xd1, 0x6e, 0x35, 0x00, 0x00, 0x00, 0x00, 0x10}, | |
1209 | {0xd1, 0x6e, 0x39, 0x00, 0x00, 0x00, 0x00, 0x10}, | |
1210 | {0xd1, 0x6e, 0x3d, 0x00, 0x00, 0x00, 0x00, 0x10}, | |
1211 | {0xd1, 0x6e, 0x41, 0x00, 0x00, 0x00, 0x00, 0x10}, | |
1212 | {0xd1, 0x6e, 0x45, 0x00, 0x00, 0x00, 0x00, 0x10}, | |
1213 | {0xd1, 0x6e, 0x49, 0x00, 0x00, 0x00, 0x00, 0x10}, | |
1214 | {0xd1, 0x6e, 0x4d, 0x00, 0x00, 0x00, 0xed, 0x10}, | |
1215 | {0xd1, 0x6e, 0x51, 0x17, 0x4a, 0x2f, 0xc0, 0x10}, | |
1216 | {0xd1, 0x6e, 0x55, 0x00, 0x00, 0x00, 0x00, 0x10}, | |
1217 | {0xd1, 0x6e, 0x59, 0x00, 0x00, 0x00, 0x00, 0x10}, | |
1218 | {0xd1, 0x6e, 0x5d, 0x00, 0x00, 0x00, 0x00, 0x10}, | |
1219 | {0xd1, 0x6e, 0x61, 0x00, 0x00, 0x00, 0x00, 0x10}, | |
1220 | {0xd1, 0x6e, 0x65, 0x00, 0x00, 0x00, 0x00, 0x10}, | |
1221 | {0xd1, 0x6e, 0x69, 0x00, 0x00, 0x00, 0x00, 0x10}, | |
1222 | {0xd1, 0x6e, 0x6d, 0x00, 0x00, 0x00, 0x00, 0x10}, | |
1223 | {0xd1, 0x6e, 0x71, 0x00, 0x00, 0x00, 0x00, 0x10}, | |
1224 | {0xd1, 0x6e, 0x75, 0x00, 0x00, 0x00, 0x00, 0x10}, | |
1225 | {0xd1, 0x6e, 0x79, 0x00, 0x00, 0x00, 0x00, 0x10}, | |
1226 | {0xd1, 0x6e, 0x7d, 0x00, 0x00, 0x00, 0x00, 0x10}, | |
1227 | {0xd1, 0x6e, 0x81, 0x00, 0x00, 0x00, 0x00, 0x10}, | |
1228 | {0xd1, 0x6e, 0x85, 0x00, 0x00, 0x00, 0x08, 0x10}, | |
1229 | {0xd1, 0x6e, 0x89, 0x01, 0xe8, 0x00, 0x01, 0x10}, | |
1230 | {0xa1, 0x6e, 0x8d, 0x00, 0x00, 0x00, 0x00, 0x10}, | |
1231 | {0xd1, 0x6e, 0x21, 0x00, 0x00, 0x00, 0x00, 0x10}, | |
1232 | {0xd1, 0x6e, 0x25, 0x00, 0x00, 0x00, 0x01, 0x10}, | |
1233 | {0xd1, 0x6e, 0x29, 0xe6, 0x00, 0xbd, 0x03, 0x10}, | |
1234 | {0xd1, 0x6e, 0x2d, 0x41, 0x38, 0x68, 0x40, 0x10}, | |
1235 | {0xd1, 0x6e, 0x31, 0x2b, 0x00, 0x36, 0x00, 0x10}, | |
1236 | {0xd1, 0x6e, 0x35, 0x30, 0x30, 0x08, 0x00, 0x10}, | |
1237 | {0xd1, 0x6e, 0x39, 0x00, 0x00, 0x33, 0x06, 0x10}, | |
1238 | {0xb1, 0x6e, 0x3d, 0x06, 0x02, 0x00, 0x00, 0x10}, | |
1239 | {} | |
1240 | }; | |
1241 | static const u8 po2030n_sensor_param1[][8] = { | |
1242 | {0xa1, 0x6e, 0x1a, 0x01, 0x00, 0x00, 0x00, 0x10}, | |
ccbc5df2 | 1243 | {DELAY, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* delay 8ms */ |
ad98c0f6 JFM |
1244 | {0xa1, 0x6e, 0x1b, 0xf4, 0x00, 0x00, 0x00, 0x10}, |
1245 | {0xa1, 0x6e, 0x15, 0x04, 0x00, 0x00, 0x00, 0x10}, | |
1246 | {0xd1, 0x6e, 0x16, 0x50, 0x40, 0x49, 0x40, 0x10}, | |
1247 | /*param2*/ | |
1248 | {0xa1, 0x6e, 0x1d, 0x00, 0x00, 0x00, 0x00, 0x10}, | |
1249 | {0xa1, 0x6e, 0x04, 0x03, 0x00, 0x00, 0x00, 0x10}, | |
1250 | {0xa1, 0x6e, 0x05, 0x6f, 0x00, 0x00, 0x00, 0x10}, | |
1251 | {0xa1, 0x6e, 0x06, 0x02, 0x00, 0x00, 0x00, 0x10}, | |
1252 | {0xa1, 0x6e, 0x07, 0x25, 0x00, 0x00, 0x00, 0x10}, | |
1253 | {0xa1, 0x6e, 0x15, 0x04, 0x00, 0x00, 0x00, 0x10}, | |
1254 | {0xc1, 0x6e, 0x16, 0x52, 0x40, 0x48, 0x00, 0x10}, | |
1255 | /*after start*/ | |
1256 | {0xa1, 0x6e, 0x15, 0x0f, 0x00, 0x00, 0x00, 0x10}, | |
ccbc5df2 | 1257 | {DELAY, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* delay 5ms */ |
ad98c0f6 | 1258 | {0xa1, 0x6e, 0x1a, 0x05, 0x00, 0x00, 0x00, 0x10}, |
ccbc5df2 | 1259 | {DELAY, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* delay 5ms */ |
ad98c0f6 JFM |
1260 | {0xa1, 0x6e, 0x1b, 0x53, 0x00, 0x00, 0x00, 0x10}, |
1261 | {} | |
1262 | }; | |
1263 | ||
03ed2a11 JFM |
1264 | static const u8 soi768_sensor_init[][8] = { |
1265 | {0xa1, 0x21, 0x12, 0x80, 0x00, 0x00, 0x00, 0x10}, /* reset */ | |
ccbc5df2 | 1266 | {DELAY, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* delay 96ms */ |
03ed2a11 JFM |
1267 | {0xa1, 0x21, 0x12, 0x00, 0x00, 0x00, 0x00, 0x10}, |
1268 | {0xa1, 0x21, 0x13, 0x80, 0x00, 0x00, 0x00, 0x10}, | |
1269 | {0xa1, 0x21, 0x0f, 0x03, 0x00, 0x00, 0x00, 0x10}, | |
1270 | {0xa1, 0x21, 0x19, 0x00, 0x00, 0x00, 0x00, 0x10}, | |
1271 | {} | |
1272 | }; | |
1273 | static const u8 soi768_sensor_param1[][8] = { | |
1274 | {0xa1, 0x21, 0x10, 0x10, 0x00, 0x00, 0x00, 0x10}, | |
1275 | {0xa1, 0x21, 0x2d, 0x00, 0x00, 0x00, 0x00, 0x10}, | |
1276 | {0xa1, 0x21, 0x2e, 0x00, 0x00, 0x00, 0x00, 0x10}, | |
1277 | {0xa1, 0x21, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10}, | |
1278 | {0xb1, 0x21, 0x01, 0x7f, 0x7f, 0x00, 0x00, 0x10}, | |
1279 | /* */ | |
1280 | /* {0xa1, 0x21, 0x2e, 0x00, 0x00, 0x00, 0x00, 0x10}, */ | |
1281 | /* {0xa1, 0x21, 0x2d, 0x25, 0x00, 0x00, 0x00, 0x10}, */ | |
1282 | {0xa1, 0x21, 0x2b, 0x00, 0x00, 0x00, 0x00, 0x10}, | |
1283 | /* {0xb1, 0x21, 0x2d, 0x00, 0x00, 0x00, 0x00, 0x10}, */ | |
1284 | {0xa1, 0x21, 0x02, 0x8d, 0x00, 0x00, 0x00, 0x10}, | |
1285 | /* the next sequence should be used for auto gain */ | |
1286 | {0xa1, 0x21, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10}, | |
1287 | /* global gain ? : 07 - change with 0x15 at the end */ | |
1288 | {0xa1, 0x21, 0x10, 0x3f, 0x00, 0x00, 0x00, 0x10}, /* ???? : 063f */ | |
1289 | {0xa1, 0x21, 0x04, 0x06, 0x00, 0x00, 0x00, 0x10}, | |
1290 | {0xb1, 0x21, 0x2d, 0x00, 0x02, 0x00, 0x00, 0x10}, | |
1291 | /* exposure ? : 0200 - change with 0x1e at the end */ | |
1292 | {} | |
1293 | }; | |
1294 | ||
5e31dc8d JFM |
1295 | static const u8 sp80708_sensor_init[][8] = { |
1296 | {0xa1, 0x18, 0x06, 0xf9, 0x00, 0x00, 0x00, 0x10}, | |
1297 | {0xa1, 0x18, 0x09, 0x1f, 0x00, 0x00, 0x00, 0x10}, | |
1298 | {0xa1, 0x18, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x10}, | |
1299 | {0xa1, 0x18, 0x0d, 0xc0, 0x00, 0x00, 0x00, 0x10}, | |
1300 | {0xa1, 0x18, 0x0c, 0x04, 0x00, 0x00, 0x00, 0x10}, | |
1301 | {0xa1, 0x18, 0x0f, 0x0f, 0x00, 0x00, 0x00, 0x10}, | |
1302 | {0xa1, 0x18, 0x10, 0x40, 0x00, 0x00, 0x00, 0x10}, | |
1303 | {0xa1, 0x18, 0x11, 0x4e, 0x00, 0x00, 0x00, 0x10}, | |
1304 | {0xa1, 0x18, 0x12, 0x53, 0x00, 0x00, 0x00, 0x10}, | |
1305 | {0xa1, 0x18, 0x15, 0x80, 0x00, 0x00, 0x00, 0x10}, | |
1306 | {0xa1, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x10}, | |
1307 | {0xa1, 0x18, 0x19, 0x18, 0x00, 0x00, 0x00, 0x10}, | |
1308 | {0xa1, 0x18, 0x1a, 0x10, 0x00, 0x00, 0x00, 0x10}, | |
1309 | {0xa1, 0x18, 0x1b, 0x10, 0x00, 0x00, 0x00, 0x10}, | |
1310 | {0xa1, 0x18, 0x1c, 0x28, 0x00, 0x00, 0x00, 0x10}, | |
1311 | {0xa1, 0x18, 0x1d, 0x02, 0x00, 0x00, 0x00, 0x10}, | |
1312 | {0xa1, 0x18, 0x1e, 0x10, 0x00, 0x00, 0x00, 0x10}, | |
1313 | {0xa1, 0x18, 0x26, 0x04, 0x00, 0x00, 0x00, 0x10}, | |
1314 | {0xa1, 0x18, 0x27, 0x1e, 0x00, 0x00, 0x00, 0x10}, | |
1315 | {0xa1, 0x18, 0x28, 0x5a, 0x00, 0x00, 0x00, 0x10}, | |
1316 | {0xa1, 0x18, 0x29, 0x28, 0x00, 0x00, 0x00, 0x10}, | |
1317 | {0xa1, 0x18, 0x2a, 0x78, 0x00, 0x00, 0x00, 0x10}, | |
1318 | {0xa1, 0x18, 0x2b, 0x01, 0x00, 0x00, 0x00, 0x10}, | |
1319 | {0xa1, 0x18, 0x2c, 0xf7, 0x00, 0x00, 0x00, 0x10}, | |
1320 | {0xa1, 0x18, 0x2d, 0x2d, 0x00, 0x00, 0x00, 0x10}, | |
1321 | {0xa1, 0x18, 0x2e, 0xd5, 0x00, 0x00, 0x00, 0x10}, | |
1322 | {0xa1, 0x18, 0x39, 0x42, 0x00, 0x00, 0x00, 0x10}, | |
1323 | {0xa1, 0x18, 0x3a, 0x67, 0x00, 0x00, 0x00, 0x10}, | |
1324 | {0xa1, 0x18, 0x3b, 0x87, 0x00, 0x00, 0x00, 0x10}, | |
1325 | {0xa1, 0x18, 0x3c, 0xa3, 0x00, 0x00, 0x00, 0x10}, | |
1326 | {0xa1, 0x18, 0x3d, 0xb0, 0x00, 0x00, 0x00, 0x10}, | |
1327 | {0xa1, 0x18, 0x3e, 0xbc, 0x00, 0x00, 0x00, 0x10}, | |
1328 | {0xa1, 0x18, 0x3f, 0xc8, 0x00, 0x00, 0x00, 0x10}, | |
1329 | {0xa1, 0x18, 0x40, 0xd4, 0x00, 0x00, 0x00, 0x10}, | |
1330 | {0xa1, 0x18, 0x41, 0xdf, 0x00, 0x00, 0x00, 0x10}, | |
1331 | {0xa1, 0x18, 0x42, 0xea, 0x00, 0x00, 0x00, 0x10}, | |
1332 | {0xa1, 0x18, 0x43, 0xf5, 0x00, 0x00, 0x00, 0x10}, | |
1333 | {0xa1, 0x18, 0x45, 0x80, 0x00, 0x00, 0x00, 0x10}, | |
1334 | {0xa1, 0x18, 0x46, 0x60, 0x00, 0x00, 0x00, 0x10}, | |
1335 | {0xa1, 0x18, 0x47, 0x50, 0x00, 0x00, 0x00, 0x10}, | |
1336 | {0xa1, 0x18, 0x48, 0x30, 0x00, 0x00, 0x00, 0x10}, | |
1337 | {0xa1, 0x18, 0x49, 0x01, 0x00, 0x00, 0x00, 0x10}, | |
1338 | {0xa1, 0x18, 0x4d, 0xae, 0x00, 0x00, 0x00, 0x10}, | |
1339 | {0xa1, 0x18, 0x4e, 0x03, 0x00, 0x00, 0x00, 0x10}, | |
1340 | {0xa1, 0x18, 0x4f, 0x66, 0x00, 0x00, 0x00, 0x10}, | |
1341 | {0xa1, 0x18, 0x50, 0x1c, 0x00, 0x00, 0x00, 0x10}, | |
1342 | {0xa1, 0x18, 0x44, 0x10, 0x00, 0x00, 0x00, 0x10}, | |
1343 | {0xa1, 0x18, 0x4a, 0x30, 0x00, 0x00, 0x00, 0x10}, | |
1344 | {0xa1, 0x18, 0x51, 0x80, 0x00, 0x00, 0x00, 0x10}, | |
1345 | {0xa1, 0x18, 0x52, 0x80, 0x00, 0x00, 0x00, 0x10}, | |
1346 | {0xa1, 0x18, 0x53, 0x80, 0x00, 0x00, 0x00, 0x10}, | |
1347 | {0xa1, 0x18, 0x54, 0x80, 0x00, 0x00, 0x00, 0x10}, | |
1348 | {0xa1, 0x18, 0x55, 0x80, 0x00, 0x00, 0x00, 0x10}, | |
1349 | {0xa1, 0x18, 0x56, 0x80, 0x00, 0x00, 0x00, 0x10}, | |
1350 | {0xa1, 0x18, 0x57, 0xe0, 0x00, 0x00, 0x00, 0x10}, | |
1351 | {0xa1, 0x18, 0x58, 0xc0, 0x00, 0x00, 0x00, 0x10}, | |
1352 | {0xa1, 0x18, 0x59, 0xab, 0x00, 0x00, 0x00, 0x10}, | |
1353 | {0xa1, 0x18, 0x5a, 0xa0, 0x00, 0x00, 0x00, 0x10}, | |
1354 | {0xa1, 0x18, 0x5b, 0x99, 0x00, 0x00, 0x00, 0x10}, | |
1355 | {0xa1, 0x18, 0x5c, 0x90, 0x00, 0x00, 0x00, 0x10}, | |
1356 | {0xa1, 0x18, 0x5e, 0x24, 0x00, 0x00, 0x00, 0x10}, | |
1357 | {0xa1, 0x18, 0x5f, 0x00, 0x00, 0x00, 0x00, 0x10}, | |
1358 | {0xa1, 0x18, 0x60, 0x00, 0x00, 0x00, 0x00, 0x10}, | |
1359 | {0xa1, 0x18, 0x61, 0x73, 0x00, 0x00, 0x00, 0x10}, | |
1360 | {0xa1, 0x18, 0x63, 0x42, 0x00, 0x00, 0x00, 0x10}, | |
1361 | {0xa1, 0x18, 0x64, 0x42, 0x00, 0x00, 0x00, 0x10}, | |
1362 | {0xa1, 0x18, 0x65, 0x42, 0x00, 0x00, 0x00, 0x10}, | |
1363 | {0xa1, 0x18, 0x66, 0x24, 0x00, 0x00, 0x00, 0x10}, | |
1364 | {0xa1, 0x18, 0x67, 0x24, 0x00, 0x00, 0x00, 0x10}, | |
1365 | {0xa1, 0x18, 0x68, 0x08, 0x00, 0x00, 0x00, 0x10}, | |
1366 | {0xa1, 0x18, 0x2f, 0xc9, 0x00, 0x00, 0x00, 0x10}, | |
3fccb774 JFM |
1367 | {} |
1368 | }; | |
1369 | static const u8 sp80708_sensor_param1[][8] = { | |
5e31dc8d JFM |
1370 | {0xa1, 0x18, 0x0c, 0x04, 0x00, 0x00, 0x00, 0x10}, |
1371 | {0xa1, 0x18, 0x0c, 0x04, 0x00, 0x00, 0x00, 0x10}, | |
1372 | {0xa1, 0x18, 0x03, 0x01, 0x00, 0x00, 0x00, 0x10}, | |
1373 | {0xa1, 0x18, 0x04, 0xa4, 0x00, 0x00, 0x00, 0x10}, | |
1374 | {0xa1, 0x18, 0x14, 0x3f, 0x00, 0x00, 0x00, 0x10}, | |
1375 | {0xa1, 0x18, 0x5d, 0x80, 0x00, 0x00, 0x00, 0x10}, | |
1376 | {0xb1, 0x18, 0x11, 0x40, 0x40, 0x00, 0x00, 0x10}, | |
1377 | {} | |
1378 | }; | |
1379 | ||
9c33afc6 JFM |
1380 | static const u8 (*sensor_init[])[8] = { |
1381 | [SENSOR_ADCM1700] = adcm1700_sensor_init, | |
ad98c0f6 | 1382 | [SENSOR_GC0307] = gc0307_sensor_init, |
9c33afc6 JFM |
1383 | [SENSOR_HV7131R] = hv7131r_sensor_init, |
1384 | [SENSOR_MI0360] = mi0360_sensor_init, | |
a067db84 | 1385 | [SENSOR_MI0360B] = mi0360b_sensor_init, |
9c33afc6 JFM |
1386 | [SENSOR_MO4000] = mo4000_sensor_init, |
1387 | [SENSOR_MT9V111] = mt9v111_sensor_init, | |
1388 | [SENSOR_OM6802] = om6802_sensor_init, | |
1389 | [SENSOR_OV7630] = ov7630_sensor_init, | |
1390 | [SENSOR_OV7648] = ov7648_sensor_init, | |
1391 | [SENSOR_OV7660] = ov7660_sensor_init, | |
1392 | [SENSOR_PO1030] = po1030_sensor_init, | |
ad98c0f6 | 1393 | [SENSOR_PO2030N] = po2030n_sensor_init, |
03ed2a11 | 1394 | [SENSOR_SOI768] = soi768_sensor_init, |
9c33afc6 | 1395 | [SENSOR_SP80708] = sp80708_sensor_init, |
23a98274 JFM |
1396 | }; |
1397 | ||
8295d99e | 1398 | /* read <len> bytes to gspca_dev->usb_buf */ |
739570bb | 1399 | static void reg_r(struct gspca_dev *gspca_dev, |
98819187 | 1400 | u16 value, int len) |
6a7eba24 | 1401 | { |
4bf8b679 JFM |
1402 | int ret; |
1403 | ||
1404 | if (gspca_dev->usb_err < 0) | |
1405 | return; | |
8295d99e JFM |
1406 | #ifdef GSPCA_DEBUG |
1407 | if (len > USB_BUF_SZ) { | |
1408 | err("reg_r: buffer overflow"); | |
1409 | return; | |
1410 | } | |
1411 | #endif | |
4bf8b679 | 1412 | ret = usb_control_msg(gspca_dev->dev, |
739570bb | 1413 | usb_rcvctrlpipe(gspca_dev->dev, 0), |
6a7eba24 JFM |
1414 | 0, |
1415 | USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_INTERFACE, | |
1416 | value, 0, | |
739570bb | 1417 | gspca_dev->usb_buf, len, |
6a7eba24 | 1418 | 500); |
60017617 | 1419 | PDEBUG(D_USBI, "reg_r [%02x] -> %02x", value, gspca_dev->usb_buf[0]); |
4bf8b679 JFM |
1420 | if (ret < 0) { |
1421 | err("reg_r err %d", ret); | |
1422 | gspca_dev->usb_err = ret; | |
1423 | } | |
6a7eba24 JFM |
1424 | } |
1425 | ||
60017617 | 1426 | static void reg_w1(struct gspca_dev *gspca_dev, |
98819187 JFM |
1427 | u16 value, |
1428 | u8 data) | |
60017617 | 1429 | { |
4bf8b679 JFM |
1430 | int ret; |
1431 | ||
1432 | if (gspca_dev->usb_err < 0) | |
1433 | return; | |
3ef2c5be | 1434 | PDEBUG(D_USBO, "reg_w1 [%04x] = %02x", value, data); |
60017617 | 1435 | gspca_dev->usb_buf[0] = data; |
4bf8b679 | 1436 | ret = usb_control_msg(gspca_dev->dev, |
60017617 JFM |
1437 | usb_sndctrlpipe(gspca_dev->dev, 0), |
1438 | 0x08, | |
1439 | USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_INTERFACE, | |
1440 | value, | |
1441 | 0, | |
1442 | gspca_dev->usb_buf, 1, | |
1443 | 500); | |
4bf8b679 JFM |
1444 | if (ret < 0) { |
1445 | err("reg_w1 err %d", ret); | |
1446 | gspca_dev->usb_err = ret; | |
1447 | } | |
60017617 | 1448 | } |
739570bb | 1449 | static void reg_w(struct gspca_dev *gspca_dev, |
98819187 JFM |
1450 | u16 value, |
1451 | const u8 *buffer, | |
6a7eba24 JFM |
1452 | int len) |
1453 | { | |
4bf8b679 JFM |
1454 | int ret; |
1455 | ||
1456 | if (gspca_dev->usb_err < 0) | |
1457 | return; | |
3ef2c5be | 1458 | PDEBUG(D_USBO, "reg_w [%04x] = %02x %02x ..", |
60017617 | 1459 | value, buffer[0], buffer[1]); |
8295d99e JFM |
1460 | #ifdef GSPCA_DEBUG |
1461 | if (len > USB_BUF_SZ) { | |
1462 | err("reg_w: buffer overflow"); | |
1463 | return; | |
bf7f0b98 | 1464 | } |
8295d99e JFM |
1465 | #endif |
1466 | memcpy(gspca_dev->usb_buf, buffer, len); | |
4bf8b679 | 1467 | ret = usb_control_msg(gspca_dev->dev, |
8295d99e JFM |
1468 | usb_sndctrlpipe(gspca_dev->dev, 0), |
1469 | 0x08, | |
1470 | USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_INTERFACE, | |
1471 | value, 0, | |
1472 | gspca_dev->usb_buf, len, | |
1473 | 500); | |
4bf8b679 JFM |
1474 | if (ret < 0) { |
1475 | err("reg_w err %d", ret); | |
1476 | gspca_dev->usb_err = ret; | |
1477 | } | |
6a7eba24 JFM |
1478 | } |
1479 | ||
60017617 | 1480 | /* I2C write 1 byte */ |
98819187 | 1481 | static void i2c_w1(struct gspca_dev *gspca_dev, u8 reg, u8 val) |
6a7eba24 JFM |
1482 | { |
1483 | struct sd *sd = (struct sd *) gspca_dev; | |
4bf8b679 | 1484 | int ret; |
6a7eba24 | 1485 | |
4bf8b679 JFM |
1486 | if (gspca_dev->usb_err < 0) |
1487 | return; | |
cfd23c8e | 1488 | PDEBUG(D_USBO, "i2c_w1 [%02x] = %02x", reg, val); |
a782636c | 1489 | switch (sd->sensor) { |
64677573 | 1490 | case SENSOR_ADCM1700: |
ad98c0f6 JFM |
1491 | case SENSOR_OM6802: |
1492 | case SENSOR_GC0307: /* i2c command = a0 (100 kHz) */ | |
a782636c JFM |
1493 | gspca_dev->usb_buf[0] = 0x80 | (2 << 4); |
1494 | break; | |
1495 | default: /* i2c command = a1 (400 kHz) */ | |
1496 | gspca_dev->usb_buf[0] = 0x81 | (2 << 4); | |
1497 | break; | |
1498 | } | |
d5aa3856 | 1499 | gspca_dev->usb_buf[1] = sd->i2c_addr; |
60017617 JFM |
1500 | gspca_dev->usb_buf[2] = reg; |
1501 | gspca_dev->usb_buf[3] = val; | |
1502 | gspca_dev->usb_buf[4] = 0; | |
1503 | gspca_dev->usb_buf[5] = 0; | |
1504 | gspca_dev->usb_buf[6] = 0; | |
1505 | gspca_dev->usb_buf[7] = 0x10; | |
4bf8b679 | 1506 | ret = usb_control_msg(gspca_dev->dev, |
60017617 JFM |
1507 | usb_sndctrlpipe(gspca_dev->dev, 0), |
1508 | 0x08, | |
1509 | USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_INTERFACE, | |
1510 | 0x08, /* value = i2c */ | |
1511 | 0, | |
1512 | gspca_dev->usb_buf, 8, | |
1513 | 500); | |
4bf8b679 JFM |
1514 | if (ret < 0) { |
1515 | err("i2c_w1 err %d", ret); | |
1516 | gspca_dev->usb_err = ret; | |
1517 | } | |
6a7eba24 JFM |
1518 | } |
1519 | ||
739570bb JFM |
1520 | /* I2C write 8 bytes */ |
1521 | static void i2c_w8(struct gspca_dev *gspca_dev, | |
98819187 | 1522 | const u8 *buffer) |
6a7eba24 | 1523 | { |
4bf8b679 JFM |
1524 | int ret; |
1525 | ||
1526 | if (gspca_dev->usb_err < 0) | |
1527 | return; | |
cfd23c8e JFM |
1528 | PDEBUG(D_USBO, "i2c_w8 [%02x] = %02x ..", |
1529 | buffer[2], buffer[3]); | |
60017617 | 1530 | memcpy(gspca_dev->usb_buf, buffer, 8); |
4bf8b679 | 1531 | ret = usb_control_msg(gspca_dev->dev, |
60017617 JFM |
1532 | usb_sndctrlpipe(gspca_dev->dev, 0), |
1533 | 0x08, | |
1534 | USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_INTERFACE, | |
1535 | 0x08, 0, /* value, index */ | |
1536 | gspca_dev->usb_buf, 8, | |
1537 | 500); | |
8d768e14 | 1538 | msleep(2); |
4bf8b679 JFM |
1539 | if (ret < 0) { |
1540 | err("i2c_w8 err %d", ret); | |
1541 | gspca_dev->usb_err = ret; | |
1542 | } | |
6a7eba24 JFM |
1543 | } |
1544 | ||
b8c8a5bf JFM |
1545 | /* sensor read 'len' (1..5) bytes in gspca_dev->usb_buf */ |
1546 | static void i2c_r(struct gspca_dev *gspca_dev, u8 reg, int len) | |
6a7eba24 JFM |
1547 | { |
1548 | struct sd *sd = (struct sd *) gspca_dev; | |
98819187 | 1549 | u8 mode[8]; |
6a7eba24 | 1550 | |
a782636c | 1551 | switch (sd->sensor) { |
64677573 | 1552 | case SENSOR_ADCM1700: |
ad98c0f6 JFM |
1553 | case SENSOR_OM6802: |
1554 | case SENSOR_GC0307: /* i2c command = a0 (100 kHz) */ | |
a782636c JFM |
1555 | mode[0] = 0x80 | 0x10; |
1556 | break; | |
1557 | default: /* i2c command = 91 (400 kHz) */ | |
1558 | mode[0] = 0x81 | 0x10; | |
1559 | break; | |
1560 | } | |
d5aa3856 | 1561 | mode[1] = sd->i2c_addr; |
6a7eba24 JFM |
1562 | mode[2] = reg; |
1563 | mode[3] = 0; | |
1564 | mode[4] = 0; | |
1565 | mode[5] = 0; | |
1566 | mode[6] = 0; | |
1567 | mode[7] = 0x10; | |
739570bb | 1568 | i2c_w8(gspca_dev, mode); |
60017617 | 1569 | msleep(2); |
b8c8a5bf | 1570 | mode[0] = (mode[0] & 0x81) | (len << 4) | 0x02; |
6a7eba24 | 1571 | mode[2] = 0; |
739570bb | 1572 | i2c_w8(gspca_dev, mode); |
60017617 | 1573 | msleep(2); |
739570bb | 1574 | reg_r(gspca_dev, 0x0a, 5); |
6a7eba24 JFM |
1575 | } |
1576 | ||
23a98274 JFM |
1577 | static void i2c_w_seq(struct gspca_dev *gspca_dev, |
1578 | const u8 (*data)[8]) | |
1579 | { | |
1580 | while ((*data)[0] != 0) { | |
ccbc5df2 | 1581 | if ((*data)[0] != DELAY) |
23a98274 JFM |
1582 | i2c_w8(gspca_dev, *data); |
1583 | else | |
1584 | msleep((*data)[1]); | |
1585 | data++; | |
1586 | } | |
1587 | } | |
1588 | ||
a79cc7b9 JFM |
1589 | /* check the ID of the hv7131 sensor */ |
1590 | /* this sequence is needed because it activates the sensor */ | |
7fb101ae | 1591 | static void hv7131r_probe(struct gspca_dev *gspca_dev) |
6a7eba24 | 1592 | { |
a79cc7b9 | 1593 | i2c_w1(gspca_dev, 0x02, 0); /* sensor wakeup */ |
6a7eba24 | 1594 | msleep(10); |
a79cc7b9 | 1595 | reg_w1(gspca_dev, 0x02, 0x66); /* Gpio on */ |
6a7eba24 | 1596 | msleep(10); |
a79cc7b9 JFM |
1597 | i2c_r(gspca_dev, 0, 5); /* read sensor id */ |
1598 | if (gspca_dev->usb_buf[0] == 0x02 /* chip ID (02 is R) */ | |
739570bb | 1599 | && gspca_dev->usb_buf[1] == 0x09 |
a79cc7b9 JFM |
1600 | && gspca_dev->usb_buf[2] == 0x01) { |
1601 | PDEBUG(D_PROBE, "Sensor HV7131R found"); | |
7fb101ae | 1602 | return; |
6a7eba24 | 1603 | } |
a79cc7b9 | 1604 | warn("Erroneous HV7131R ID 0x%02x 0x%02x 0x%02x", |
739570bb JFM |
1605 | gspca_dev->usb_buf[0], gspca_dev->usb_buf[1], |
1606 | gspca_dev->usb_buf[2]); | |
6a7eba24 JFM |
1607 | } |
1608 | ||
65c5259c | 1609 | static void mi0360_probe(struct gspca_dev *gspca_dev) |
3ef2c5be | 1610 | { |
65c5259c | 1611 | struct sd *sd = (struct sd *) gspca_dev; |
3ef2c5be | 1612 | int i, j; |
92e8c91b | 1613 | u16 val = 0; |
3ef2c5be | 1614 | static const u8 probe_tb[][4][8] = { |
65c5259c | 1615 | { /* mi0360 */ |
3ef2c5be JFM |
1616 | {0xb0, 0x5d, 0x07, 0x00, 0x02, 0x00, 0x00, 0x10}, |
1617 | {0x90, 0x5d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10}, | |
1618 | {0xa2, 0x5d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10}, | |
1619 | {0xb0, 0x5d, 0x07, 0x00, 0x00, 0x00, 0x00, 0x10} | |
1620 | }, | |
65c5259c | 1621 | { /* mt9v111 */ |
3ef2c5be JFM |
1622 | {0xb0, 0x5c, 0x01, 0x00, 0x04, 0x00, 0x00, 0x10}, |
1623 | {0x90, 0x5c, 0x36, 0x00, 0x00, 0x00, 0x00, 0x10}, | |
1624 | {0xa2, 0x5c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10}, | |
1625 | {} | |
1626 | }, | |
1627 | }; | |
1628 | ||
1629 | for (i = 0; i < ARRAY_SIZE(probe_tb); i++) { | |
1630 | reg_w1(gspca_dev, 0x17, 0x62); | |
1631 | reg_w1(gspca_dev, 0x01, 0x08); | |
1632 | for (j = 0; j < 3; j++) | |
1633 | i2c_w8(gspca_dev, probe_tb[i][j]); | |
1634 | msleep(2); | |
1635 | reg_r(gspca_dev, 0x0a, 5); | |
1636 | val = (gspca_dev->usb_buf[3] << 8) | gspca_dev->usb_buf[4]; | |
1637 | if (probe_tb[i][3][0] != 0) | |
1638 | i2c_w8(gspca_dev, probe_tb[i][3]); | |
1639 | reg_w1(gspca_dev, 0x01, 0x29); | |
1640 | reg_w1(gspca_dev, 0x17, 0x42); | |
1641 | if (val != 0xffff) | |
1642 | break; | |
1643 | } | |
4bf8b679 JFM |
1644 | if (gspca_dev->usb_err < 0) |
1645 | return; | |
3ef2c5be | 1646 | switch (val) { |
a067db84 JFM |
1647 | case 0x8221: |
1648 | PDEBUG(D_PROBE, "Sensor mi0360b"); | |
1649 | sd->sensor = SENSOR_MI0360B; | |
1650 | break; | |
3ef2c5be JFM |
1651 | case 0x823a: |
1652 | PDEBUG(D_PROBE, "Sensor mt9v111"); | |
65c5259c | 1653 | sd->sensor = SENSOR_MT9V111; |
65c5259c | 1654 | break; |
3ef2c5be JFM |
1655 | case 0x8243: |
1656 | PDEBUG(D_PROBE, "Sensor mi0360"); | |
65c5259c JFM |
1657 | break; |
1658 | default: | |
1659 | PDEBUG(D_PROBE, "Unknown sensor %04x - forced to mi0360", val); | |
1660 | break; | |
3ef2c5be | 1661 | } |
3ef2c5be JFM |
1662 | } |
1663 | ||
03ed2a11 JFM |
1664 | static void ov7630_probe(struct gspca_dev *gspca_dev) |
1665 | { | |
1666 | struct sd *sd = (struct sd *) gspca_dev; | |
1667 | u16 val; | |
1668 | ||
1669 | /* check ov76xx */ | |
1670 | reg_w1(gspca_dev, 0x17, 0x62); | |
1671 | reg_w1(gspca_dev, 0x01, 0x08); | |
1672 | sd->i2c_addr = 0x21; | |
1673 | i2c_r(gspca_dev, 0x0a, 2); | |
1674 | val = (gspca_dev->usb_buf[3] << 8) | gspca_dev->usb_buf[4]; | |
1675 | reg_w1(gspca_dev, 0x01, 0x29); | |
1676 | reg_w1(gspca_dev, 0x17, 0x42); | |
4bf8b679 JFM |
1677 | if (gspca_dev->usb_err < 0) |
1678 | return; | |
03ed2a11 JFM |
1679 | if (val == 0x7628) { /* soi768 */ |
1680 | sd->sensor = SENSOR_SOI768; | |
1681 | /*fixme: only valid for 0c45:613e?*/ | |
1682 | gspca_dev->cam.input_flags = | |
1683 | V4L2_IN_ST_VFLIP | V4L2_IN_ST_HFLIP; | |
1684 | PDEBUG(D_PROBE, "Sensor soi768"); | |
1685 | return; | |
1686 | } | |
1687 | PDEBUG(D_PROBE, "Sensor ov%04x", val); | |
1688 | } | |
1689 | ||
b8c8a5bf JFM |
1690 | static void ov7648_probe(struct gspca_dev *gspca_dev) |
1691 | { | |
1692 | struct sd *sd = (struct sd *) gspca_dev; | |
e3302cad | 1693 | u16 val; |
b8c8a5bf JFM |
1694 | |
1695 | /* check ov76xx */ | |
1696 | reg_w1(gspca_dev, 0x17, 0x62); | |
1697 | reg_w1(gspca_dev, 0x01, 0x08); | |
1698 | sd->i2c_addr = 0x21; | |
1699 | i2c_r(gspca_dev, 0x0a, 2); | |
e3302cad | 1700 | val = (gspca_dev->usb_buf[3] << 8) | gspca_dev->usb_buf[4]; |
b8c8a5bf JFM |
1701 | reg_w1(gspca_dev, 0x01, 0x29); |
1702 | reg_w1(gspca_dev, 0x17, 0x42); | |
e3302cad JFM |
1703 | if ((val & 0xff00) == 0x7600) { /* ov76xx */ |
1704 | PDEBUG(D_PROBE, "Sensor ov%04x", val); | |
1705 | return; | |
1706 | } | |
b8c8a5bf JFM |
1707 | |
1708 | /* check po1030 */ | |
1709 | reg_w1(gspca_dev, 0x17, 0x62); | |
1710 | reg_w1(gspca_dev, 0x01, 0x08); | |
1711 | sd->i2c_addr = 0x6e; | |
1712 | i2c_r(gspca_dev, 0x00, 2); | |
e3302cad JFM |
1713 | val = (gspca_dev->usb_buf[3] << 8) | gspca_dev->usb_buf[4]; |
1714 | reg_w1(gspca_dev, 0x01, 0x29); | |
1715 | reg_w1(gspca_dev, 0x17, 0x42); | |
4bf8b679 JFM |
1716 | if (gspca_dev->usb_err < 0) |
1717 | return; | |
e3302cad | 1718 | if (val == 0x1030) { /* po1030 */ |
b8c8a5bf JFM |
1719 | PDEBUG(D_PROBE, "Sensor po1030"); |
1720 | sd->sensor = SENSOR_PO1030; | |
1721 | return; | |
1722 | } | |
0b656321 | 1723 | err("Unknown sensor %04x", val); |
b8c8a5bf JFM |
1724 | } |
1725 | ||
ad98c0f6 JFM |
1726 | /* 0c45:6142 sensor may be po2030n, gc0305 or gc0307 */ |
1727 | static void po2030n_probe(struct gspca_dev *gspca_dev) | |
1728 | { | |
1729 | struct sd *sd = (struct sd *) gspca_dev; | |
e3302cad | 1730 | u16 val; |
ad98c0f6 JFM |
1731 | |
1732 | /* check gc0307 */ | |
1733 | reg_w1(gspca_dev, 0x17, 0x62); | |
1734 | reg_w1(gspca_dev, 0x01, 0x08); | |
1735 | reg_w1(gspca_dev, 0x02, 0x22); | |
1736 | sd->i2c_addr = 0x21; | |
1737 | i2c_r(gspca_dev, 0x00, 1); | |
e3302cad | 1738 | val = gspca_dev->usb_buf[4]; |
ad98c0f6 JFM |
1739 | reg_w1(gspca_dev, 0x01, 0x29); /* reset */ |
1740 | reg_w1(gspca_dev, 0x17, 0x42); | |
e3302cad | 1741 | if (val == 0x99) { /* gc0307 (?) */ |
ad98c0f6 JFM |
1742 | PDEBUG(D_PROBE, "Sensor gc0307"); |
1743 | sd->sensor = SENSOR_GC0307; | |
1744 | return; | |
1745 | } | |
1746 | ||
1747 | /* check po2030n */ | |
1748 | reg_w1(gspca_dev, 0x17, 0x62); | |
1749 | reg_w1(gspca_dev, 0x01, 0x0a); | |
1750 | sd->i2c_addr = 0x6e; | |
1751 | i2c_r(gspca_dev, 0x00, 2); | |
e3302cad | 1752 | val = (gspca_dev->usb_buf[3] << 8) | gspca_dev->usb_buf[4]; |
ad98c0f6 JFM |
1753 | reg_w1(gspca_dev, 0x01, 0x29); |
1754 | reg_w1(gspca_dev, 0x17, 0x42); | |
4bf8b679 JFM |
1755 | if (gspca_dev->usb_err < 0) |
1756 | return; | |
e3302cad | 1757 | if (val == 0x2030) { |
ad98c0f6 JFM |
1758 | PDEBUG(D_PROBE, "Sensor po2030n"); |
1759 | /* sd->sensor = SENSOR_PO2030N; */ | |
e3302cad | 1760 | } else { |
0b656321 | 1761 | err("Unknown sensor ID %04x", val); |
e3302cad | 1762 | } |
ad98c0f6 JFM |
1763 | } |
1764 | ||
6a7eba24 JFM |
1765 | /* this function is called at probe time */ |
1766 | static int sd_config(struct gspca_dev *gspca_dev, | |
1767 | const struct usb_device_id *id) | |
1768 | { | |
1769 | struct sd *sd = (struct sd *) gspca_dev; | |
1770 | struct cam *cam; | |
6a7eba24 | 1771 | |
eac8f5fa | 1772 | sd->bridge = id->driver_info >> 16; |
c6c14330 JFM |
1773 | sd->sensor = id->driver_info >> 8; |
1774 | sd->flags = id->driver_info; | |
eac8f5fa | 1775 | |
6a7eba24 | 1776 | cam = &gspca_dev->cam; |
64677573 JFM |
1777 | if (sd->sensor == SENSOR_ADCM1700) { |
1778 | cam->cam_mode = cif_mode; | |
1779 | cam->nmodes = ARRAY_SIZE(cif_mode); | |
1780 | } else { | |
1781 | cam->cam_mode = vga_mode; | |
1782 | cam->nmodes = ARRAY_SIZE(vga_mode); | |
1783 | } | |
49cb6b04 | 1784 | cam->npkt = 24; /* 24 packets per ISOC message */ |
72b667eb | 1785 | cam->ctrls = sd->ctrls; |
a5ae2062 | 1786 | |
cebf3b67 | 1787 | sd->ag_cnt = -1; |
77ac0baf | 1788 | sd->quality = QUALITY_DEF; |
71cb2764 | 1789 | sd->jpegqual = 80; |
cebf3b67 | 1790 | |
6a7eba24 JFM |
1791 | return 0; |
1792 | } | |
1793 | ||
012d6b02 JFM |
1794 | /* this function is called at probe and resume time */ |
1795 | static int sd_init(struct gspca_dev *gspca_dev) | |
6a7eba24 JFM |
1796 | { |
1797 | struct sd *sd = (struct sd *) gspca_dev; | |
d5aa3856 | 1798 | const u8 *sn9c1xx; |
19697b54 | 1799 | u8 regGpio[] = { 0x29, 0x74 }; /* with audio */ |
98819187 | 1800 | u8 regF1; |
6a7eba24 | 1801 | |
3647fea8 | 1802 | /* setup a selector by bridge */ |
60017617 | 1803 | reg_w1(gspca_dev, 0xf1, 0x01); |
739570bb | 1804 | reg_r(gspca_dev, 0x00, 1); |
4f67f3ad | 1805 | reg_w1(gspca_dev, 0xf1, 0x00); |
8f47a3ce | 1806 | reg_r(gspca_dev, 0x00, 1); /* get sonix chip id */ |
739570bb | 1807 | regF1 = gspca_dev->usb_buf[0]; |
4bf8b679 JFM |
1808 | if (gspca_dev->usb_err < 0) |
1809 | return gspca_dev->usb_err; | |
8f47a3ce | 1810 | PDEBUG(D_PROBE, "Sonix chip id: %02x", regF1); |
3647fea8 HG |
1811 | switch (sd->bridge) { |
1812 | case BRIDGE_SN9C102P: | |
e530a5e3 | 1813 | case BRIDGE_SN9C105: |
6a7eba24 JFM |
1814 | if (regF1 != 0x11) |
1815 | return -ENODEV; | |
e530a5e3 HG |
1816 | break; |
1817 | default: | |
1818 | /* case BRIDGE_SN9C110: */ | |
1819 | /* case BRIDGE_SN9C120: */ | |
1820 | if (regF1 != 0x12) | |
1821 | return -ENODEV; | |
1822 | } | |
1823 | ||
1824 | switch (sd->sensor) { | |
1825 | case SENSOR_MI0360: | |
1826 | mi0360_probe(gspca_dev); | |
1827 | break; | |
1828 | case SENSOR_OV7630: | |
1829 | ov7630_probe(gspca_dev); | |
1830 | break; | |
1831 | case SENSOR_OV7648: | |
1832 | ov7648_probe(gspca_dev); | |
1833 | break; | |
1834 | case SENSOR_PO2030N: | |
1835 | po2030n_probe(gspca_dev); | |
1836 | break; | |
1837 | } | |
1838 | ||
1839 | switch (sd->bridge) { | |
1840 | case BRIDGE_SN9C102P: | |
60017617 | 1841 | reg_w1(gspca_dev, 0x02, regGpio[1]); |
6a7eba24 | 1842 | break; |
3647fea8 | 1843 | case BRIDGE_SN9C105: |
674cbc69 | 1844 | reg_w(gspca_dev, 0x01, regGpio, 2); |
6a7eba24 | 1845 | break; |
e530a5e3 HG |
1846 | case BRIDGE_SN9C110: |
1847 | reg_w1(gspca_dev, 0x02, 0x62); | |
1848 | break; | |
3647fea8 | 1849 | case BRIDGE_SN9C120: |
19697b54 | 1850 | regGpio[1] = 0x70; /* no audio */ |
674cbc69 | 1851 | reg_w(gspca_dev, 0x01, regGpio, 2); |
6a7eba24 | 1852 | break; |
6a7eba24 JFM |
1853 | } |
1854 | ||
72b667eb JFM |
1855 | if (sd->sensor == SENSOR_OM6802) |
1856 | sd->ctrls[SHARPNESS].def = 0x10; | |
1857 | ||
9712a8be HG |
1858 | /* Note we do not disable the sensor clock here (power saving mode), |
1859 | as that also disables the button on the cam. */ | |
1860 | reg_w1(gspca_dev, 0xf1, 0x00); | |
6a7eba24 | 1861 | |
d5aa3856 JFM |
1862 | /* set the i2c address */ |
1863 | sn9c1xx = sn_tb[sd->sensor]; | |
1864 | sd->i2c_addr = sn9c1xx[9]; | |
1865 | ||
b8c8a5bf | 1866 | gspca_dev->ctrl_dis = ctrl_dis[sd->sensor]; |
3afef85b JFM |
1867 | if (!(sd->flags & F_ILLUM)) |
1868 | gspca_dev->ctrl_dis |= (1 << ILLUM); | |
b8c8a5bf | 1869 | |
4bf8b679 | 1870 | return gspca_dev->usb_err; |
6a7eba24 JFM |
1871 | } |
1872 | ||
98819187 JFM |
1873 | static u32 setexposure(struct gspca_dev *gspca_dev, |
1874 | u32 expo) | |
6a7eba24 JFM |
1875 | { |
1876 | struct sd *sd = (struct sd *) gspca_dev; | |
6a7eba24 JFM |
1877 | |
1878 | switch (sd->sensor) { | |
c26b12d0 JFM |
1879 | case SENSOR_GC0307: { |
1880 | int a, b; | |
1881 | ||
1882 | /* expo = 0..255 -> a = 19..43 */ | |
1883 | a = 19 + expo * 25 / 256; | |
1884 | i2c_w1(gspca_dev, 0x68, a); | |
1885 | a -= 12; | |
1886 | b = a * a * 4; /* heuristic */ | |
1887 | i2c_w1(gspca_dev, 0x03, b >> 8); | |
1888 | i2c_w1(gspca_dev, 0x04, b); | |
1889 | break; | |
1890 | } | |
6a7eba24 | 1891 | case SENSOR_HV7131R: { |
98819187 | 1892 | u8 Expodoit[] = |
d5aa3856 | 1893 | { 0xc1, 0x11, 0x25, 0x00, 0x00, 0x00, 0x00, 0x16 }; |
6a7eba24 JFM |
1894 | |
1895 | Expodoit[3] = expo >> 16; | |
1896 | Expodoit[4] = expo >> 8; | |
1897 | Expodoit[5] = expo; | |
739570bb | 1898 | i2c_w8(gspca_dev, Expodoit); |
6a7eba24 JFM |
1899 | break; |
1900 | } | |
a067db84 JFM |
1901 | case SENSOR_MI0360: |
1902 | case SENSOR_MI0360B: { | |
3ef2c5be | 1903 | u8 expoMi[] = /* exposure 0x0635 -> 4 fp/s 0x10 */ |
d5aa3856 | 1904 | { 0xb1, 0x5d, 0x09, 0x00, 0x00, 0x00, 0x00, 0x16 }; |
98819187 JFM |
1905 | static const u8 doit[] = /* update sensor */ |
1906 | { 0xb1, 0x5d, 0x07, 0x00, 0x03, 0x00, 0x00, 0x10 }; | |
1907 | static const u8 sensorgo[] = /* sensor on */ | |
1908 | { 0xb1, 0x5d, 0x07, 0x00, 0x02, 0x00, 0x00, 0x10 }; | |
6a7eba24 JFM |
1909 | |
1910 | if (expo > 0x0635) | |
1911 | expo = 0x0635; | |
1912 | else if (expo < 0x0001) | |
1913 | expo = 0x0001; | |
1914 | expoMi[3] = expo >> 8; | |
1915 | expoMi[4] = expo; | |
739570bb JFM |
1916 | i2c_w8(gspca_dev, expoMi); |
1917 | i2c_w8(gspca_dev, doit); | |
1918 | i2c_w8(gspca_dev, sensorgo); | |
6a7eba24 JFM |
1919 | break; |
1920 | } | |
1921 | case SENSOR_MO4000: { | |
98819187 | 1922 | u8 expoMof[] = |
d5aa3856 | 1923 | { 0xa1, 0x21, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x10 }; |
98819187 | 1924 | u8 expoMo10[] = |
d5aa3856 | 1925 | { 0xa1, 0x21, 0x10, 0x00, 0x00, 0x00, 0x00, 0x10 }; |
98819187 JFM |
1926 | static const u8 gainMo[] = |
1927 | { 0xa1, 0x21, 0x00, 0x10, 0x00, 0x00, 0x00, 0x1d }; | |
6a7eba24 JFM |
1928 | |
1929 | if (expo > 0x1fff) | |
1930 | expo = 0x1fff; | |
1931 | else if (expo < 0x0001) | |
1932 | expo = 0x0001; | |
1933 | expoMof[3] = (expo & 0x03fc) >> 2; | |
739570bb | 1934 | i2c_w8(gspca_dev, expoMof); |
6a7eba24 JFM |
1935 | expoMo10[3] = ((expo & 0x1c00) >> 10) |
1936 | | ((expo & 0x0003) << 4); | |
739570bb JFM |
1937 | i2c_w8(gspca_dev, expoMo10); |
1938 | i2c_w8(gspca_dev, gainMo); | |
3ef2c5be | 1939 | PDEBUG(D_FRAM, "set exposure %d", |
6a7eba24 JFM |
1940 | ((expoMo10[3] & 0x07) << 10) |
1941 | | (expoMof[3] << 2) | |
1942 | | ((expoMo10[3] & 0x30) >> 4)); | |
1943 | break; | |
1944 | } | |
3ef2c5be JFM |
1945 | case SENSOR_MT9V111: { |
1946 | u8 expo_c1[] = | |
1947 | { 0xb1, 0x5c, 0x09, 0x00, 0x00, 0x00, 0x00, 0x10 }; | |
1948 | ||
1949 | if (expo > 0x0280) | |
1950 | expo = 0x0280; | |
1951 | else if (expo < 0x0040) | |
1952 | expo = 0x0040; | |
1953 | expo_c1[3] = expo >> 8; | |
1954 | expo_c1[4] = expo; | |
1955 | i2c_w8(gspca_dev, expo_c1); | |
1956 | break; | |
1957 | } | |
d2d16e90 | 1958 | case SENSOR_OM6802: { |
98819187 | 1959 | u8 gainOm[] = |
d2d16e90 | 1960 | { 0xa0, 0x34, 0xe5, 0x00, 0x00, 0x00, 0x00, 0x10 }; |
d5aa3856 | 1961 | /* preset AGC - works when AutoExpo = off */ |
d2d16e90 JFM |
1962 | |
1963 | if (expo > 0x03ff) | |
1964 | expo = 0x03ff; | |
1965 | if (expo < 0x0001) | |
1966 | expo = 0x0001; | |
1967 | gainOm[3] = expo >> 2; | |
1968 | i2c_w8(gspca_dev, gainOm); | |
d5aa3856 | 1969 | reg_w1(gspca_dev, 0x96, expo >> 5); |
3ef2c5be | 1970 | PDEBUG(D_FRAM, "set exposure %d", gainOm[3]); |
d2d16e90 JFM |
1971 | break; |
1972 | } | |
6a7eba24 JFM |
1973 | } |
1974 | return expo; | |
1975 | } | |
1976 | ||
1977 | static void setbrightness(struct gspca_dev *gspca_dev) | |
1978 | { | |
1979 | struct sd *sd = (struct sd *) gspca_dev; | |
1980 | unsigned int expo; | |
72b667eb | 1981 | int brightness; |
98819187 | 1982 | u8 k2; |
6a7eba24 | 1983 | |
72b667eb JFM |
1984 | brightness = sd->ctrls[BRIGHTNESS].val; |
1985 | k2 = (brightness - 0x80) >> 2; | |
6a7eba24 | 1986 | switch (sd->sensor) { |
64677573 | 1987 | case SENSOR_ADCM1700: |
878b35ae JFM |
1988 | if (k2 > 0x1f) |
1989 | k2 = 0; /* only positive Y offset */ | |
1990 | break; | |
6a7eba24 | 1991 | case SENSOR_HV7131R: |
72b667eb | 1992 | expo = brightness << 12; |
6a7eba24 JFM |
1993 | if (expo > 0x002dc6c0) |
1994 | expo = 0x002dc6c0; | |
1995 | else if (expo < 0x02a0) | |
1996 | expo = 0x02a0; | |
1997 | sd->exposure = setexposure(gspca_dev, expo); | |
1998 | break; | |
1999 | case SENSOR_MI0360: | |
6a7eba24 | 2000 | case SENSOR_MO4000: |
72b667eb | 2001 | expo = brightness << 4; |
6a7eba24 JFM |
2002 | sd->exposure = setexposure(gspca_dev, expo); |
2003 | break; | |
a067db84 | 2004 | case SENSOR_MI0360B: |
72b667eb | 2005 | expo = brightness << 2; |
a067db84 JFM |
2006 | sd->exposure = setexposure(gspca_dev, expo); |
2007 | break; | |
c26b12d0 | 2008 | case SENSOR_GC0307: |
3ef2c5be | 2009 | case SENSOR_MT9V111: |
72b667eb | 2010 | expo = brightness; |
3ef2c5be | 2011 | sd->exposure = setexposure(gspca_dev, expo); |
d5aa3856 | 2012 | return; /* don't set the Y offset */ |
d2d16e90 | 2013 | case SENSOR_OM6802: |
72b667eb | 2014 | expo = brightness << 2; |
d2d16e90 | 2015 | sd->exposure = setexposure(gspca_dev, expo); |
72b667eb | 2016 | k2 = brightness >> 3; |
d2d16e90 | 2017 | break; |
6a7eba24 JFM |
2018 | } |
2019 | ||
d5aa3856 | 2020 | reg_w1(gspca_dev, 0x96, k2); /* color matrix Y offset */ |
6a7eba24 JFM |
2021 | } |
2022 | ||
2023 | static void setcontrast(struct gspca_dev *gspca_dev) | |
2024 | { | |
2025 | struct sd *sd = (struct sd *) gspca_dev; | |
98819187 JFM |
2026 | u8 k2; |
2027 | u8 contrast[6]; | |
6a7eba24 | 2028 | |
72b667eb JFM |
2029 | k2 = sd->ctrls[CONTRAST].val * 0x30 / (CONTRAST_MAX + 1) |
2030 | + 0x10; /* 10..40 */ | |
91bd3412 | 2031 | contrast[0] = (k2 + 1) / 2; /* red */ |
577cbf49 | 2032 | contrast[1] = 0; |
91bd3412 | 2033 | contrast[2] = k2; /* green */ |
577cbf49 | 2034 | contrast[3] = 0; |
91bd3412 | 2035 | contrast[4] = (k2 + 1) / 5; /* blue */ |
577cbf49 JFM |
2036 | contrast[5] = 0; |
2037 | reg_w(gspca_dev, 0x84, contrast, sizeof contrast); | |
6a7eba24 JFM |
2038 | } |
2039 | ||
2040 | static void setcolors(struct gspca_dev *gspca_dev) | |
2041 | { | |
2042 | struct sd *sd = (struct sd *) gspca_dev; | |
72b667eb | 2043 | int i, v, colors; |
a067db84 | 2044 | const s16 *uv; |
98819187 | 2045 | u8 reg8a[12]; /* U & V gains */ |
a067db84 | 2046 | static const s16 uv_com[6] = { /* same as reg84 in signed decimal */ |
403123d2 JFM |
2047 | -24, -38, 64, /* UR UG UB */ |
2048 | 62, -51, -9 /* VR VG VB */ | |
2049 | }; | |
a067db84 JFM |
2050 | static const s16 uv_mi0360b[6] = { |
2051 | -20, -38, 64, /* UR UG UB */ | |
2052 | 60, -51, -9 /* VR VG VB */ | |
2053 | }; | |
d5aa3856 | 2054 | |
72b667eb | 2055 | colors = sd->ctrls[COLORS].val; |
a067db84 JFM |
2056 | if (sd->sensor == SENSOR_MI0360B) |
2057 | uv = uv_mi0360b; | |
2058 | else | |
2059 | uv = uv_com; | |
403123d2 | 2060 | for (i = 0; i < 6; i++) { |
72b667eb | 2061 | v = uv[i] * colors / COLORS_DEF; |
bd088835 JFM |
2062 | reg8a[i * 2] = v; |
2063 | reg8a[i * 2 + 1] = (v >> 8) & 0x0f; | |
d55b83d3 | 2064 | } |
bd088835 | 2065 | reg_w(gspca_dev, 0x8a, reg8a, sizeof reg8a); |
403123d2 JFM |
2066 | } |
2067 | ||
2068 | static void setredblue(struct gspca_dev *gspca_dev) | |
2069 | { | |
2070 | struct sd *sd = (struct sd *) gspca_dev; | |
2071 | ||
72b667eb | 2072 | reg_w1(gspca_dev, 0x05, sd->ctrls[RED].val); |
9c5f70f2 | 2073 | /* reg_w1(gspca_dev, 0x07, 32); */ |
72b667eb | 2074 | reg_w1(gspca_dev, 0x06, sd->ctrls[BLUE].val); |
6a7eba24 JFM |
2075 | } |
2076 | ||
592f4eb9 JFM |
2077 | static void setgamma(struct gspca_dev *gspca_dev) |
2078 | { | |
2079 | struct sd *sd = (struct sd *) gspca_dev; | |
72b667eb | 2080 | int i, val; |
592f4eb9 | 2081 | u8 gamma[17]; |
b083b92f | 2082 | const u8 *gamma_base; |
592f4eb9 JFM |
2083 | static const u8 delta[17] = { |
2084 | 0x00, 0x14, 0x1c, 0x1c, 0x1c, 0x1c, 0x1b, 0x1a, | |
2085 | 0x18, 0x13, 0x10, 0x0e, 0x08, 0x07, 0x04, 0x02, 0x00 | |
2086 | }; | |
2087 | ||
b083b92f | 2088 | switch (sd->sensor) { |
64677573 JFM |
2089 | case SENSOR_ADCM1700: |
2090 | gamma_base = gamma_spec_0; | |
2091 | break; | |
b083b92f | 2092 | case SENSOR_HV7131R: |
a067db84 | 2093 | case SENSOR_MI0360B: |
b083b92f JFM |
2094 | case SENSOR_MT9V111: |
2095 | gamma_base = gamma_spec_1; | |
2096 | break; | |
ad98c0f6 | 2097 | case SENSOR_GC0307: |
b083b92f JFM |
2098 | gamma_base = gamma_spec_2; |
2099 | break; | |
ad98c0f6 JFM |
2100 | case SENSOR_SP80708: |
2101 | gamma_base = gamma_spec_3; | |
2102 | break; | |
b083b92f JFM |
2103 | default: |
2104 | gamma_base = gamma_def; | |
2105 | break; | |
2106 | } | |
5e31dc8d | 2107 | |
72b667eb | 2108 | val = sd->ctrls[GAMMA].val; |
592f4eb9 | 2109 | for (i = 0; i < sizeof gamma; i++) |
b083b92f | 2110 | gamma[i] = gamma_base[i] |
72b667eb | 2111 | + delta[i] * (val - GAMMA_DEF) / 32; |
592f4eb9 JFM |
2112 | reg_w(gspca_dev, 0x20, gamma, sizeof gamma); |
2113 | } | |
2114 | ||
cebf3b67 JFM |
2115 | static void setautogain(struct gspca_dev *gspca_dev) |
2116 | { | |
2117 | struct sd *sd = (struct sd *) gspca_dev; | |
2118 | ||
72b667eb | 2119 | if (gspca_dev->ctrl_dis & (1 << AUTOGAIN)) |
f50ba1be | 2120 | return; |
2797ba2a JFM |
2121 | switch (sd->sensor) { |
2122 | case SENSOR_OV7630: | |
2123 | case SENSOR_OV7648: { | |
2124 | u8 comb; | |
2125 | ||
2126 | if (sd->sensor == SENSOR_OV7630) | |
2127 | comb = 0xc0; | |
2128 | else | |
2129 | comb = 0xa0; | |
72b667eb | 2130 | if (sd->ctrls[AUTOGAIN].val) |
1fec747c | 2131 | comb |= 0x03; |
2797ba2a JFM |
2132 | i2c_w1(&sd->gspca_dev, 0x13, comb); |
2133 | return; | |
2134 | } | |
2135 | } | |
72b667eb | 2136 | if (sd->ctrls[AUTOGAIN].val) |
f50ba1be JFM |
2137 | sd->ag_cnt = AG_CNT_START; |
2138 | else | |
2139 | sd->ag_cnt = -1; | |
cebf3b67 JFM |
2140 | } |
2141 | ||
76ad3b68 | 2142 | static void sethvflip(struct gspca_dev *gspca_dev) |
6c86274f | 2143 | { |
72b667eb | 2144 | struct sd *sd = (struct sd *) gspca_dev; |
2797ba2a JFM |
2145 | u8 comn; |
2146 | ||
f6b22e5e JFM |
2147 | switch (sd->sensor) { |
2148 | case SENSOR_HV7131R: | |
2149 | comn = 0x18; /* clkdiv = 1, ablcen = 1 */ | |
72b667eb | 2150 | if (sd->ctrls[VFLIP].val) |
f6b22e5e | 2151 | comn |= 0x01; |
72b667eb | 2152 | i2c_w1(gspca_dev, 0x01, comn); /* sctra */ |
f6b22e5e JFM |
2153 | break; |
2154 | case SENSOR_OV7630: | |
2797ba2a | 2155 | comn = 0x02; |
72b667eb | 2156 | if (!sd->ctrls[VFLIP].val) |
f800952c | 2157 | comn |= 0x80; |
72b667eb | 2158 | i2c_w1(gspca_dev, 0x75, comn); |
f6b22e5e | 2159 | break; |
76ad3b68 | 2160 | case SENSOR_OV7648: |
2797ba2a | 2161 | comn = 0x06; |
72b667eb | 2162 | if (sd->ctrls[VFLIP].val) |
f800952c | 2163 | comn |= 0x80; |
72b667eb | 2164 | i2c_w1(gspca_dev, 0x75, comn); |
f6b22e5e | 2165 | break; |
76ad3b68 NM |
2166 | case SENSOR_PO2030N: |
2167 | /* Reg. 0x1E: Timing Generator Control Register 2 (Tgcontrol2) | |
2168 | * (reset value: 0x0A) | |
2169 | * bit7: HM: Horizontal Mirror: 0: disable, 1: enable | |
2170 | * bit6: VM: Vertical Mirror: 0: disable, 1: enable | |
2171 | * bit5: ST: Shutter Selection: 0: electrical, 1: mechanical | |
2172 | * bit4: FT: Single Frame Transfer: 0: disable, 1: enable | |
2173 | * bit3-0: X | |
2174 | */ | |
2175 | comn = 0x0a; | |
2176 | if (sd->ctrls[HFLIP].val) | |
2177 | comn |= 0x80; | |
2178 | if (sd->ctrls[VFLIP].val) | |
2179 | comn |= 0x40; | |
2180 | i2c_w1(&sd->gspca_dev, 0x1e, comn); | |
2181 | break; | |
f800952c | 2182 | } |
6c86274f JFM |
2183 | } |
2184 | ||
72b667eb | 2185 | static void setsharpness(struct gspca_dev *gspca_dev) |
878b35ae | 2186 | { |
72b667eb JFM |
2187 | struct sd *sd = (struct sd *) gspca_dev; |
2188 | ||
2189 | reg_w1(gspca_dev, 0x99, sd->ctrls[SHARPNESS].val); | |
878b35ae JFM |
2190 | } |
2191 | ||
3afef85b | 2192 | static void setillum(struct gspca_dev *gspca_dev) |
0cae8964 | 2193 | { |
72b667eb JFM |
2194 | struct sd *sd = (struct sd *) gspca_dev; |
2195 | ||
3afef85b | 2196 | if (gspca_dev->ctrl_dis & (1 << ILLUM)) |
47f7f6fb | 2197 | return; |
a63d6018 JFM |
2198 | switch (sd->sensor) { |
2199 | case SENSOR_ADCM1700: | |
2200 | reg_w1(gspca_dev, 0x02, /* gpio */ | |
2201 | sd->ctrls[ILLUM].val ? 0x64 : 0x60); | |
2202 | break; | |
2203 | case SENSOR_MT9V111: | |
2204 | if (starcam) | |
2205 | reg_w1(gspca_dev, 0x02, | |
2206 | sd->ctrls[ILLUM].val ? | |
2207 | 0x55 : 0x54); /* 370i */ | |
2208 | else | |
2209 | reg_w1(gspca_dev, 0x02, | |
2210 | sd->ctrls[ILLUM].val ? | |
2211 | 0x66 : 0x64); /* Clip */ | |
2212 | break; | |
2213 | } | |
0cae8964 JFM |
2214 | } |
2215 | ||
37c6dbe2 HG |
2216 | static void setfreq(struct gspca_dev *gspca_dev) |
2217 | { | |
2218 | struct sd *sd = (struct sd *) gspca_dev; | |
2219 | ||
72b667eb | 2220 | if (gspca_dev->ctrl_dis & (1 << FREQ)) |
27954930 | 2221 | return; |
37c6dbe2 | 2222 | if (sd->sensor == SENSOR_OV7660) { |
d8f400ef JFM |
2223 | u8 com8; |
2224 | ||
47f7f6fb | 2225 | com8 = 0xdf; /* auto gain/wb/expo */ |
72b667eb | 2226 | switch (sd->ctrls[FREQ].val) { |
37c6dbe2 | 2227 | case 0: /* Banding filter disabled */ |
47f7f6fb | 2228 | i2c_w1(gspca_dev, 0x13, com8 | 0x20); |
37c6dbe2 HG |
2229 | break; |
2230 | case 1: /* 50 hz */ | |
d8f400ef | 2231 | i2c_w1(gspca_dev, 0x13, com8); |
37c6dbe2 HG |
2232 | i2c_w1(gspca_dev, 0x3b, 0x0a); |
2233 | break; | |
2234 | case 2: /* 60 hz */ | |
d8f400ef | 2235 | i2c_w1(gspca_dev, 0x13, com8); |
37c6dbe2 HG |
2236 | i2c_w1(gspca_dev, 0x3b, 0x02); |
2237 | break; | |
2238 | } | |
2239 | } else { | |
2240 | u8 reg2a = 0, reg2b = 0, reg2d = 0; | |
2241 | ||
2242 | /* Get reg2a / reg2d base values */ | |
2243 | switch (sd->sensor) { | |
2244 | case SENSOR_OV7630: | |
2245 | reg2a = 0x08; | |
2246 | reg2d = 0x01; | |
2247 | break; | |
2248 | case SENSOR_OV7648: | |
2249 | reg2a = 0x11; | |
2250 | reg2d = 0x81; | |
2251 | break; | |
2252 | } | |
2253 | ||
72b667eb | 2254 | switch (sd->ctrls[FREQ].val) { |
37c6dbe2 HG |
2255 | case 0: /* Banding filter disabled */ |
2256 | break; | |
2257 | case 1: /* 50 hz (filter on and framerate adj) */ | |
2258 | reg2a |= 0x80; | |
2259 | reg2b = 0xac; | |
2260 | reg2d |= 0x04; | |
2261 | break; | |
2262 | case 2: /* 60 hz (filter on, no framerate adj) */ | |
2263 | reg2a |= 0x80; | |
2264 | reg2d |= 0x04; | |
2265 | break; | |
2266 | } | |
2267 | i2c_w1(gspca_dev, 0x2a, reg2a); | |
2268 | i2c_w1(gspca_dev, 0x2b, reg2b); | |
2269 | i2c_w1(gspca_dev, 0x2d, reg2d); | |
2270 | } | |
2271 | } | |
2272 | ||
71cb2764 JFM |
2273 | static void setjpegqual(struct gspca_dev *gspca_dev) |
2274 | { | |
2275 | struct sd *sd = (struct sd *) gspca_dev; | |
2276 | int i, sc; | |
2277 | ||
2278 | if (sd->jpegqual < 50) | |
2279 | sc = 5000 / sd->jpegqual; | |
2280 | else | |
2281 | sc = 200 - sd->jpegqual * 2; | |
2282 | #if USB_BUF_SZ < 64 | |
2283 | #error "No room enough in usb_buf for quantization table" | |
2284 | #endif | |
2285 | for (i = 0; i < 64; i++) | |
2286 | gspca_dev->usb_buf[i] = | |
2287 | (jpeg_head[JPEG_QT0_OFFSET + i] * sc + 50) / 100; | |
2288 | usb_control_msg(gspca_dev->dev, | |
2289 | usb_sndctrlpipe(gspca_dev->dev, 0), | |
2290 | 0x08, | |
2291 | USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_INTERFACE, | |
2292 | 0x0100, 0, | |
2293 | gspca_dev->usb_buf, 64, | |
2294 | 500); | |
2295 | for (i = 0; i < 64; i++) | |
2296 | gspca_dev->usb_buf[i] = | |
2297 | (jpeg_head[JPEG_QT1_OFFSET + i] * sc + 50) / 100; | |
2298 | usb_control_msg(gspca_dev->dev, | |
2299 | usb_sndctrlpipe(gspca_dev->dev, 0), | |
2300 | 0x08, | |
2301 | USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_INTERFACE, | |
2302 | 0x0140, 0, | |
2303 | gspca_dev->usb_buf, 64, | |
2304 | 500); | |
2305 | ||
2306 | sd->reg18 ^= 0x40; | |
2307 | reg_w1(gspca_dev, 0x18, sd->reg18); | |
2308 | } | |
2309 | ||
6a7eba24 | 2310 | /* -- start the camera -- */ |
72ab97ce | 2311 | static int sd_start(struct gspca_dev *gspca_dev) |
6a7eba24 JFM |
2312 | { |
2313 | struct sd *sd = (struct sd *) gspca_dev; | |
6a7eba24 | 2314 | int i; |
0e4d413a | 2315 | u8 reg01, reg17; |
5e68f400 | 2316 | u8 reg0102[2]; |
98819187 | 2317 | const u8 *sn9c1xx; |
3fccb774 | 2318 | const u8 (*init)[8]; |
4f67f3ad | 2319 | const u8 *reg9a; |
6a7eba24 | 2320 | int mode; |
5e68f400 JFM |
2321 | static const u8 reg9a_def[] = |
2322 | {0x00, 0x40, 0x20, 0x00, 0x00, 0x00}; | |
2323 | static const u8 reg9a_spec[] = | |
2324 | {0x00, 0x40, 0x38, 0x30, 0x00, 0x20}; | |
2325 | static const u8 regd4[] = {0x60, 0x00, 0x00}; | |
98819187 JFM |
2326 | static const u8 C0[] = { 0x2d, 0x2d, 0x3a, 0x05, 0x04, 0x3f }; |
2327 | static const u8 CA[] = { 0x28, 0xd8, 0x14, 0xec }; | |
64677573 JFM |
2328 | static const u8 CA_adcm1700[] = |
2329 | { 0x14, 0xec, 0x0a, 0xf6 }; | |
ad98c0f6 JFM |
2330 | static const u8 CA_po2030n[] = |
2331 | { 0x1e, 0xe2, 0x14, 0xec }; | |
98819187 | 2332 | static const u8 CE[] = { 0x32, 0xdd, 0x2d, 0xdd }; /* MI0360 */ |
ad98c0f6 JFM |
2333 | static const u8 CE_gc0307[] = |
2334 | { 0x32, 0xce, 0x2d, 0xd3 }; | |
98819187 | 2335 | static const u8 CE_ov76xx[] = |
674cbc69 | 2336 | { 0x32, 0xdd, 0x32, 0xdd }; |
ad98c0f6 JFM |
2337 | static const u8 CE_po2030n[] = |
2338 | { 0x14, 0xe7, 0x1e, 0xdd }; | |
6a7eba24 | 2339 | |
71cb2764 | 2340 | /* create the JPEG header */ |
71cb2764 JFM |
2341 | jpeg_define(sd->jpeg_hdr, gspca_dev->height, gspca_dev->width, |
2342 | 0x21); /* JPEG 422 */ | |
2343 | jpeg_set_qual(sd->jpeg_hdr, sd->quality); | |
2344 | ||
3fccb774 JFM |
2345 | /* initialize the bridge */ |
2346 | sn9c1xx = sn_tb[sd->sensor]; | |
5e68f400 JFM |
2347 | |
2348 | /* sensor clock already enabled in sd_init */ | |
2349 | /* reg_w1(gspca_dev, 0xf1, 0x00); */ | |
0e4d413a | 2350 | reg01 = sn9c1xx[1]; |
3afef85b | 2351 | if (sd->flags & F_PDN_INV) |
0e4d413a JFM |
2352 | reg01 ^= S_PDN_INV; /* power down inverted */ |
2353 | reg_w1(gspca_dev, 0x01, reg01); | |
5e68f400 JFM |
2354 | |
2355 | /* configure gpio */ | |
0e4d413a | 2356 | reg0102[0] = reg01; |
5e68f400 JFM |
2357 | reg0102[1] = sn9c1xx[2]; |
2358 | if (gspca_dev->audio) | |
2359 | reg0102[1] |= 0x04; /* keep the audio connection */ | |
2360 | reg_w(gspca_dev, 0x01, reg0102, 2); | |
2361 | reg_w(gspca_dev, 0x08, &sn9c1xx[8], 2); | |
2362 | reg_w(gspca_dev, 0x17, &sn9c1xx[0x17], 5); | |
2363 | switch (sd->sensor) { | |
2364 | case SENSOR_GC0307: | |
2365 | case SENSOR_OV7660: | |
2366 | case SENSOR_PO1030: | |
2367 | case SENSOR_PO2030N: | |
2368 | case SENSOR_SOI768: | |
2369 | case SENSOR_SP80708: | |
2370 | reg9a = reg9a_spec; | |
2371 | break; | |
2372 | default: | |
2373 | reg9a = reg9a_def; | |
2374 | break; | |
2375 | } | |
2376 | reg_w(gspca_dev, 0x9a, reg9a, 6); | |
2377 | ||
2378 | reg_w(gspca_dev, 0xd4, regd4, sizeof regd4); | |
2379 | ||
2380 | reg_w(gspca_dev, 0x03, &sn9c1xx[3], 0x0f); | |
2381 | ||
0e4d413a | 2382 | reg17 = sn9c1xx[0x17]; |
5e68f400 | 2383 | switch (sd->sensor) { |
5e68f400 | 2384 | case SENSOR_GC0307: |
0e4d413a | 2385 | msleep(50); /*fixme: is it useful? */ |
5e68f400 JFM |
2386 | break; |
2387 | case SENSOR_OM6802: | |
2388 | msleep(10); | |
2389 | reg_w1(gspca_dev, 0x02, 0x73); | |
0e4d413a JFM |
2390 | reg17 |= SEN_CLK_EN; |
2391 | reg_w1(gspca_dev, 0x17, reg17); | |
5e68f400 JFM |
2392 | reg_w1(gspca_dev, 0x01, 0x22); |
2393 | msleep(100); | |
0e4d413a JFM |
2394 | reg01 = SCL_SEL_OD | S_PDN_INV; |
2395 | reg17 &= MCK_SIZE_MASK; | |
2396 | reg17 |= 0x04; /* clock / 4 */ | |
2397 | break; | |
2398 | } | |
2399 | reg01 |= SYS_SEL_48M; | |
2400 | reg_w1(gspca_dev, 0x01, reg01); | |
2401 | reg17 |= SEN_CLK_EN; | |
2402 | reg_w1(gspca_dev, 0x17, reg17); | |
2403 | reg01 &= ~S_PWR_DN; /* sensor power on */ | |
2404 | reg_w1(gspca_dev, 0x01, reg01); | |
2405 | reg01 &= ~SYS_SEL_48M; | |
2406 | reg_w1(gspca_dev, 0x01, reg01); | |
2407 | ||
2408 | switch (sd->sensor) { | |
2409 | case SENSOR_HV7131R: | |
2410 | hv7131r_probe(gspca_dev); /*fixme: is it useful? */ | |
2411 | break; | |
2412 | case SENSOR_OM6802: | |
5e68f400 | 2413 | msleep(10); |
0e4d413a | 2414 | reg_w1(gspca_dev, 0x01, reg01); |
5e68f400 JFM |
2415 | i2c_w8(gspca_dev, om6802_init0[0]); |
2416 | i2c_w8(gspca_dev, om6802_init0[1]); | |
2417 | msleep(15); | |
2418 | reg_w1(gspca_dev, 0x02, 0x71); | |
2419 | msleep(150); | |
2420 | break; | |
5e68f400 | 2421 | case SENSOR_SP80708: |
5e68f400 JFM |
2422 | msleep(100); |
2423 | reg_w1(gspca_dev, 0x02, 0x62); | |
2424 | break; | |
5e68f400 | 2425 | } |
d5aa3856 | 2426 | |
3fccb774 JFM |
2427 | /* initialize the sensor */ |
2428 | i2c_w_seq(gspca_dev, sensor_init[sd->sensor]); | |
2429 | ||
60017617 JFM |
2430 | reg_w1(gspca_dev, 0x15, sn9c1xx[0x15]); |
2431 | reg_w1(gspca_dev, 0x16, sn9c1xx[0x16]); | |
2432 | reg_w1(gspca_dev, 0x12, sn9c1xx[0x12]); | |
2433 | reg_w1(gspca_dev, 0x13, sn9c1xx[0x13]); | |
2434 | reg_w1(gspca_dev, 0x18, sn9c1xx[0x18]); | |
64677573 | 2435 | if (sd->sensor == SENSOR_ADCM1700) { |
878b35ae JFM |
2436 | reg_w1(gspca_dev, 0xd2, 0x3a); /* AE_H_SIZE = 116 */ |
2437 | reg_w1(gspca_dev, 0xd3, 0x30); /* AE_V_SIZE = 96 */ | |
64677573 | 2438 | } else { |
878b35ae JFM |
2439 | reg_w1(gspca_dev, 0xd2, 0x6a); /* AE_H_SIZE = 212 */ |
2440 | reg_w1(gspca_dev, 0xd3, 0x50); /* AE_V_SIZE = 160 */ | |
64677573 | 2441 | } |
60017617 JFM |
2442 | reg_w1(gspca_dev, 0xc6, 0x00); |
2443 | reg_w1(gspca_dev, 0xc7, 0x00); | |
64677573 | 2444 | if (sd->sensor == SENSOR_ADCM1700) { |
878b35ae JFM |
2445 | reg_w1(gspca_dev, 0xc8, 0x2c); /* AW_H_STOP = 352 */ |
2446 | reg_w1(gspca_dev, 0xc9, 0x24); /* AW_V_STOP = 288 */ | |
64677573 | 2447 | } else { |
878b35ae JFM |
2448 | reg_w1(gspca_dev, 0xc8, 0x50); /* AW_H_STOP = 640 */ |
2449 | reg_w1(gspca_dev, 0xc9, 0x3c); /* AW_V_STOP = 480 */ | |
64677573 | 2450 | } |
60017617 | 2451 | reg_w1(gspca_dev, 0x18, sn9c1xx[0x18]); |
6ab0b174 | 2452 | switch (sd->sensor) { |
0e4d413a JFM |
2453 | case SENSOR_OM6802: |
2454 | /* case SENSOR_OV7648: * fixme: sometimes */ | |
b8c8a5bf | 2455 | break; |
568788a7 | 2456 | default: |
0e4d413a | 2457 | reg17 |= DEF_EN; |
568788a7 JFM |
2458 | break; |
2459 | } | |
8f47a3ce | 2460 | reg_w1(gspca_dev, 0x17, reg17); |
878b35ae JFM |
2461 | |
2462 | reg_w1(gspca_dev, 0x05, 0x00); /* red */ | |
2463 | reg_w1(gspca_dev, 0x07, 0x00); /* green */ | |
2464 | reg_w1(gspca_dev, 0x06, 0x00); /* blue */ | |
60017617 | 2465 | reg_w1(gspca_dev, 0x14, sn9c1xx[0x14]); |
b083b92f | 2466 | |
5e31dc8d JFM |
2467 | setgamma(gspca_dev); |
2468 | ||
878b35ae | 2469 | /*fixme: 8 times with all zeroes and 1 or 2 times with normal values */ |
05b809c7 JFM |
2470 | for (i = 0; i < 8; i++) |
2471 | reg_w(gspca_dev, 0x84, reg84, sizeof reg84); | |
674cbc69 | 2472 | switch (sd->sensor) { |
64677573 | 2473 | case SENSOR_ADCM1700: |
878b35ae JFM |
2474 | case SENSOR_OV7660: |
2475 | case SENSOR_SP80708: | |
64677573 | 2476 | reg_w1(gspca_dev, 0x9a, 0x05); |
64677573 | 2477 | break; |
ad98c0f6 | 2478 | case SENSOR_GC0307: |
3ef2c5be | 2479 | case SENSOR_MT9V111: |
a067db84 | 2480 | case SENSOR_MI0360B: |
3ef2c5be | 2481 | reg_w1(gspca_dev, 0x9a, 0x07); |
3fccb774 | 2482 | break; |
0a85c74b | 2483 | case SENSOR_OV7630: |
6270330a JFM |
2484 | case SENSOR_OV7648: |
2485 | reg_w1(gspca_dev, 0x9a, 0x0a); | |
5e31dc8d | 2486 | break; |
ad98c0f6 | 2487 | case SENSOR_PO2030N: |
03ed2a11 | 2488 | case SENSOR_SOI768: |
ad98c0f6 JFM |
2489 | reg_w1(gspca_dev, 0x9a, 0x06); |
2490 | break; | |
674cbc69 | 2491 | default: |
60017617 | 2492 | reg_w1(gspca_dev, 0x9a, 0x08); |
674cbc69 JFM |
2493 | break; |
2494 | } | |
72b667eb | 2495 | setsharpness(gspca_dev); |
6a7eba24 | 2496 | |
3fccb774 | 2497 | reg_w(gspca_dev, 0x84, reg84, sizeof reg84); |
878b35ae JFM |
2498 | reg_w1(gspca_dev, 0x05, 0x20); /* red */ |
2499 | reg_w1(gspca_dev, 0x07, 0x20); /* green */ | |
2500 | reg_w1(gspca_dev, 0x06, 0x20); /* blue */ | |
23a98274 | 2501 | |
3fccb774 | 2502 | init = NULL; |
d5aa3856 | 2503 | mode = gspca_dev->cam.cam_mode[gspca_dev->curr_mode].priv; |
0e4d413a JFM |
2504 | reg01 |= SYS_SEL_48M | V_TX_EN; |
2505 | reg17 &= ~MCK_SIZE_MASK; | |
2506 | reg17 |= 0x02; /* clock / 2 */ | |
6a7eba24 | 2507 | switch (sd->sensor) { |
64677573 JFM |
2508 | case SENSOR_ADCM1700: |
2509 | init = adcm1700_sensor_param1; | |
64677573 | 2510 | break; |
ad98c0f6 JFM |
2511 | case SENSOR_GC0307: |
2512 | init = gc0307_sensor_param1; | |
0e4d413a JFM |
2513 | break; |
2514 | case SENSOR_HV7131R: | |
2515 | case SENSOR_MI0360: | |
2516 | if (mode) | |
2517 | reg01 |= SYS_SEL_48M; /* 320x240: clk 48Mhz */ | |
2518 | else | |
2519 | reg01 &= ~SYS_SEL_48M; /* 640x480: clk 24Mhz */ | |
2520 | reg17 &= ~MCK_SIZE_MASK; | |
2521 | reg17 |= 0x01; /* clock / 1 */ | |
ad98c0f6 | 2522 | break; |
a067db84 JFM |
2523 | case SENSOR_MI0360B: |
2524 | init = mi0360b_sensor_param1; | |
a067db84 | 2525 | break; |
6a7eba24 | 2526 | case SENSOR_MO4000: |
0e4d413a JFM |
2527 | if (mode) { /* if 320x240 */ |
2528 | reg01 &= ~SYS_SEL_48M; /* clk 24Mz */ | |
2529 | reg17 &= ~MCK_SIZE_MASK; | |
2530 | reg17 |= 0x01; /* clock / 1 */ | |
6a7eba24 JFM |
2531 | } |
2532 | break; | |
3ef2c5be | 2533 | case SENSOR_MT9V111: |
3fccb774 | 2534 | init = mt9v111_sensor_param1; |
0fbe0574 | 2535 | break; |
d2d16e90 | 2536 | case SENSOR_OM6802: |
3fccb774 | 2537 | init = om6802_sensor_param1; |
0e4d413a JFM |
2538 | if (!mode) { /* if 640x480 */ |
2539 | reg17 &= ~MCK_SIZE_MASK; | |
aa777a88 | 2540 | reg17 |= 0x04; /* clock / 4 */ |
0e4d413a | 2541 | } |
d2d16e90 | 2542 | break; |
6ab0b174 | 2543 | case SENSOR_OV7630: |
bdd2b93c | 2544 | init = ov7630_sensor_param1; |
6ab0b174 | 2545 | break; |
6a7eba24 | 2546 | case SENSOR_OV7648: |
3fccb774 | 2547 | init = ov7648_sensor_param1; |
0e4d413a JFM |
2548 | reg17 &= ~MCK_SIZE_MASK; |
2549 | reg17 |= 0x01; /* clock / 1 */ | |
6a7eba24 | 2550 | break; |
5e31dc8d | 2551 | case SENSOR_OV7660: |
3fccb774 | 2552 | init = ov7660_sensor_param1; |
6a7eba24 | 2553 | break; |
b8c8a5bf JFM |
2554 | case SENSOR_PO1030: |
2555 | init = po1030_sensor_param1; | |
b8c8a5bf | 2556 | break; |
ad98c0f6 JFM |
2557 | case SENSOR_PO2030N: |
2558 | init = po2030n_sensor_param1; | |
ad98c0f6 | 2559 | break; |
03ed2a11 JFM |
2560 | case SENSOR_SOI768: |
2561 | init = soi768_sensor_param1; | |
03ed2a11 | 2562 | break; |
0303a90a | 2563 | case SENSOR_SP80708: |
3fccb774 | 2564 | init = sp80708_sensor_param1; |
5e31dc8d | 2565 | break; |
6a7eba24 | 2566 | } |
3fccb774 JFM |
2567 | |
2568 | /* more sensor initialization - param1 */ | |
2569 | if (init != NULL) { | |
2570 | i2c_w_seq(gspca_dev, init); | |
2571 | /* init = NULL; */ | |
2572 | } | |
2573 | ||
739570bb | 2574 | reg_w(gspca_dev, 0xc0, C0, 6); |
ad98c0f6 JFM |
2575 | switch (sd->sensor) { |
2576 | case SENSOR_ADCM1700: | |
2577 | case SENSOR_GC0307: | |
03ed2a11 | 2578 | case SENSOR_SOI768: |
64677573 | 2579 | reg_w(gspca_dev, 0xca, CA_adcm1700, 4); |
ad98c0f6 JFM |
2580 | break; |
2581 | case SENSOR_PO2030N: | |
2582 | reg_w(gspca_dev, 0xca, CA_po2030n, 4); | |
2583 | break; | |
2584 | default: | |
64677573 | 2585 | reg_w(gspca_dev, 0xca, CA, 4); |
ad98c0f6 JFM |
2586 | break; |
2587 | } | |
6ab0b174 | 2588 | switch (sd->sensor) { |
64677573 | 2589 | case SENSOR_ADCM1700: |
6ab0b174 JFM |
2590 | case SENSOR_OV7630: |
2591 | case SENSOR_OV7648: | |
674cbc69 | 2592 | case SENSOR_OV7660: |
03ed2a11 | 2593 | case SENSOR_SOI768: |
6ab0b174 | 2594 | reg_w(gspca_dev, 0xce, CE_ov76xx, 4); |
6a7eba24 | 2595 | break; |
ad98c0f6 JFM |
2596 | case SENSOR_GC0307: |
2597 | reg_w(gspca_dev, 0xce, CE_gc0307, 4); | |
2598 | break; | |
2599 | case SENSOR_PO2030N: | |
2600 | reg_w(gspca_dev, 0xce, CE_po2030n, 4); | |
2601 | break; | |
6a7eba24 | 2602 | default: |
739570bb | 2603 | reg_w(gspca_dev, 0xce, CE, 4); |
6a7eba24 JFM |
2604 | /* ?? {0x1e, 0xdd, 0x2d, 0xe7} */ |
2605 | break; | |
2606 | } | |
2607 | ||
2608 | /* here change size mode 0 -> VGA; 1 -> CIF */ | |
71cb2764 JFM |
2609 | sd->reg18 = sn9c1xx[0x18] | (mode << 4) | 0x40; |
2610 | reg_w1(gspca_dev, 0x18, sd->reg18); | |
2611 | setjpegqual(gspca_dev); | |
6a7eba24 | 2612 | |
60017617 | 2613 | reg_w1(gspca_dev, 0x17, reg17); |
0e4d413a JFM |
2614 | reg_w1(gspca_dev, 0x01, reg01); |
2615 | sd->reg01 = reg01; | |
2616 | sd->reg17 = reg17; | |
3fccb774 | 2617 | |
76ad3b68 | 2618 | sethvflip(gspca_dev); |
91bd3412 JFM |
2619 | setbrightness(gspca_dev); |
2620 | setcontrast(gspca_dev); | |
fff2f708 | 2621 | setcolors(gspca_dev); |
cebf3b67 | 2622 | setautogain(gspca_dev); |
37c6dbe2 | 2623 | setfreq(gspca_dev); |
4bf8b679 | 2624 | return gspca_dev->usb_err; |
6a7eba24 JFM |
2625 | } |
2626 | ||
2627 | static void sd_stopN(struct gspca_dev *gspca_dev) | |
2628 | { | |
2629 | struct sd *sd = (struct sd *) gspca_dev; | |
98819187 | 2630 | static const u8 stophv7131[] = |
6a7eba24 | 2631 | { 0xa1, 0x11, 0x02, 0x09, 0x00, 0x00, 0x00, 0x10 }; |
98819187 | 2632 | static const u8 stopmi0360[] = |
6a7eba24 | 2633 | { 0xb1, 0x5d, 0x07, 0x00, 0x00, 0x00, 0x00, 0x10 }; |
98819187 | 2634 | static const u8 stopov7648[] = |
6270330a | 2635 | { 0xa1, 0x21, 0x76, 0x20, 0x00, 0x00, 0x00, 0x10 }; |
03ed2a11 JFM |
2636 | static const u8 stopsoi768[] = |
2637 | { 0xa1, 0x21, 0x12, 0x80, 0x00, 0x00, 0x00, 0x10 }; | |
0e4d413a JFM |
2638 | u8 reg01; |
2639 | u8 reg17; | |
6a7eba24 | 2640 | |
0e4d413a JFM |
2641 | reg01 = sd->reg01; |
2642 | reg17 = sd->reg17 & ~SEN_CLK_EN; | |
6a7eba24 | 2643 | switch (sd->sensor) { |
0e4d413a | 2644 | case SENSOR_ADCM1700: |
ad98c0f6 | 2645 | case SENSOR_GC0307: |
0e4d413a JFM |
2646 | case SENSOR_PO2030N: |
2647 | case SENSOR_SP80708: | |
2648 | reg01 |= LED; | |
2649 | reg_w1(gspca_dev, 0x01, reg01); | |
2650 | reg01 &= ~(LED | V_TX_EN); | |
2651 | reg_w1(gspca_dev, 0x01, reg01); | |
2652 | /* reg_w1(gspca_dev, 0x02, 0x??); * LED off ? */ | |
ad98c0f6 | 2653 | break; |
6a7eba24 | 2654 | case SENSOR_HV7131R: |
0e4d413a JFM |
2655 | reg01 &= ~V_TX_EN; |
2656 | reg_w1(gspca_dev, 0x01, reg01); | |
739570bb | 2657 | i2c_w8(gspca_dev, stophv7131); |
6a7eba24 JFM |
2658 | break; |
2659 | case SENSOR_MI0360: | |
a067db84 | 2660 | case SENSOR_MI0360B: |
0e4d413a JFM |
2661 | reg01 &= ~V_TX_EN; |
2662 | reg_w1(gspca_dev, 0x01, reg01); | |
2663 | /* reg_w1(gspca_dev, 0x02, 0x40); * LED off ? */ | |
739570bb | 2664 | i2c_w8(gspca_dev, stopmi0360); |
6a7eba24 | 2665 | break; |
3ef2c5be | 2666 | case SENSOR_MT9V111: |
0e4d413a | 2667 | case SENSOR_OM6802: |
b8c8a5bf | 2668 | case SENSOR_PO1030: |
0e4d413a JFM |
2669 | reg01 &= ~V_TX_EN; |
2670 | reg_w1(gspca_dev, 0x01, reg01); | |
2671 | break; | |
2672 | case SENSOR_OV7630: | |
2673 | case SENSOR_OV7648: | |
2674 | reg01 &= ~V_TX_EN; | |
2675 | reg_w1(gspca_dev, 0x01, reg01); | |
2676 | i2c_w8(gspca_dev, stopov7648); | |
2677 | break; | |
2678 | case SENSOR_OV7660: | |
2679 | reg01 &= ~V_TX_EN; | |
2680 | reg_w1(gspca_dev, 0x01, reg01); | |
6a7eba24 | 2681 | break; |
03ed2a11 JFM |
2682 | case SENSOR_SOI768: |
2683 | i2c_w8(gspca_dev, stopsoi768); | |
03ed2a11 | 2684 | break; |
6a7eba24 | 2685 | } |
0e4d413a JFM |
2686 | |
2687 | reg01 |= SCL_SEL_OD; | |
2688 | reg_w1(gspca_dev, 0x01, reg01); | |
2689 | reg01 |= S_PWR_DN; /* sensor power down */ | |
2690 | reg_w1(gspca_dev, 0x01, reg01); | |
2691 | reg_w1(gspca_dev, 0x17, reg17); | |
2692 | reg01 &= ~SYS_SEL_48M; /* clock 24MHz */ | |
2693 | reg_w1(gspca_dev, 0x01, reg01); | |
2694 | reg01 |= LED; | |
2695 | reg_w1(gspca_dev, 0x01, reg01); | |
9712a8be HG |
2696 | /* Don't disable sensor clock as that disables the button on the cam */ |
2697 | /* reg_w1(gspca_dev, 0xf1, 0x01); */ | |
6a7eba24 JFM |
2698 | } |
2699 | ||
cebf3b67 | 2700 | static void do_autogain(struct gspca_dev *gspca_dev) |
6a7eba24 JFM |
2701 | { |
2702 | struct sd *sd = (struct sd *) gspca_dev; | |
6a7eba24 | 2703 | int delta; |
cebf3b67 | 2704 | int expotimes; |
98819187 JFM |
2705 | u8 luma_mean = 130; |
2706 | u8 luma_delta = 20; | |
6a7eba24 | 2707 | |
cebf3b67 JFM |
2708 | /* Thanks S., without your advice, autobright should not work :) */ |
2709 | if (sd->ag_cnt < 0) | |
2710 | return; | |
2711 | if (--sd->ag_cnt >= 0) | |
2712 | return; | |
2713 | sd->ag_cnt = AG_CNT_START; | |
2714 | ||
2715 | delta = atomic_read(&sd->avg_lum); | |
2716 | PDEBUG(D_FRAM, "mean lum %d", delta); | |
6a7eba24 JFM |
2717 | if (delta < luma_mean - luma_delta || |
2718 | delta > luma_mean + luma_delta) { | |
2719 | switch (sd->sensor) { | |
c26b12d0 JFM |
2720 | case SENSOR_GC0307: |
2721 | expotimes = sd->exposure; | |
2722 | expotimes += (luma_mean - delta) >> 6; | |
2723 | if (expotimes < 0) | |
2724 | expotimes = 0; | |
2725 | sd->exposure = setexposure(gspca_dev, | |
2726 | (unsigned int) expotimes); | |
2727 | break; | |
6a7eba24 JFM |
2728 | case SENSOR_HV7131R: |
2729 | expotimes = sd->exposure >> 8; | |
2730 | expotimes += (luma_mean - delta) >> 4; | |
2731 | if (expotimes < 0) | |
2732 | expotimes = 0; | |
2733 | sd->exposure = setexposure(gspca_dev, | |
2734 | (unsigned int) (expotimes << 8)); | |
2735 | break; | |
46b4f2ab AM |
2736 | case SENSOR_OM6802: |
2737 | expotimes = sd->exposure; | |
2738 | expotimes += (luma_mean - delta) >> 2; | |
2739 | if (expotimes < 0) | |
2740 | expotimes = 0; | |
2741 | sd->exposure = setexposure(gspca_dev, | |
2742 | (unsigned int) expotimes); | |
2743 | setredblue(gspca_dev); | |
2744 | break; | |
cebf3b67 JFM |
2745 | default: |
2746 | /* case SENSOR_MO4000: */ | |
2747 | /* case SENSOR_MI0360: */ | |
a067db84 | 2748 | /* case SENSOR_MI0360B: */ |
3ef2c5be | 2749 | /* case SENSOR_MT9V111: */ |
6a7eba24 JFM |
2750 | expotimes = sd->exposure; |
2751 | expotimes += (luma_mean - delta) >> 6; | |
2752 | if (expotimes < 0) | |
2753 | expotimes = 0; | |
2754 | sd->exposure = setexposure(gspca_dev, | |
2755 | (unsigned int) expotimes); | |
403123d2 | 2756 | setredblue(gspca_dev); |
6a7eba24 JFM |
2757 | break; |
2758 | } | |
2759 | } | |
2760 | } | |
2761 | ||
0f77f40c JFM |
2762 | /* set the average luminosity from an isoc marker */ |
2763 | static void set_lum(struct sd *sd, | |
2764 | u8 *data) | |
2765 | { | |
2766 | int avg_lum; | |
2767 | ||
2768 | /* w0 w1 w2 | |
2769 | * w3 w4 w5 | |
2770 | * w6 w7 w8 | |
2771 | */ | |
2772 | avg_lum = (data[27] << 8) + data[28] /* w3 */ | |
2773 | ||
2774 | + (data[31] << 8) + data[32] /* w5 */ | |
2775 | ||
2776 | + (data[23] << 8) + data[24] /* w1 */ | |
2777 | ||
2778 | + (data[35] << 8) + data[36] /* w7 */ | |
2779 | ||
2780 | + (data[29] << 10) + (data[30] << 2); /* w4 * 4 */ | |
2781 | avg_lum >>= 10; | |
2782 | atomic_set(&sd->avg_lum, avg_lum); | |
2783 | } | |
2784 | ||
cebf3b67 JFM |
2785 | /* scan the URB packets */ |
2786 | /* This function is run at interrupt level. */ | |
6a7eba24 | 2787 | static void sd_pkt_scan(struct gspca_dev *gspca_dev, |
98819187 | 2788 | u8 *data, /* isoc packet */ |
6a7eba24 JFM |
2789 | int len) /* iso packet length */ |
2790 | { | |
2791 | struct sd *sd = (struct sd *) gspca_dev; | |
a4a3076f JFM |
2792 | int i; |
2793 | ||
2794 | /* | |
2795 | * A frame ends on the marker | |
2796 | * ff ff 00 c4 c4 96 .. | |
2797 | * which is 62 bytes long and is followed by various information | |
2798 | * including statuses and luminosity. | |
2799 | * | |
2800 | * A marker may be splitted on two packets. | |
2801 | * | |
2802 | * The 6th byte of a marker contains the bits: | |
2803 | * 0x08: USB full | |
2804 | * 0xc0: frame sequence | |
2805 | * When the bit 'USB full' is set, the frame must be discarded; | |
2806 | * this is also the case when the 2 bytes before the marker are | |
2807 | * not the JPEG end of frame ('ff d9'). | |
2808 | */ | |
2809 | ||
2810 | /*fixme: assumption about the following code: | |
2811 | * - there can be only one marker in a packet | |
2812 | */ | |
2813 | ||
2814 | /* skip the remaining bytes of a short marker */ | |
2815 | i = sd->short_mark; | |
2816 | if (i != 0) { | |
2817 | sd->short_mark = 0; | |
2818 | if (i < 0 /* if 'ff' at end of previous packet */ | |
2819 | && data[0] == 0xff | |
2820 | && data[1] == 0x00) | |
2821 | goto marker_found; | |
2822 | if (data[0] == 0xff && data[1] == 0xff) { | |
2823 | i = 0; | |
2824 | goto marker_found; | |
2825 | } | |
2826 | len -= i; | |
2827 | if (len <= 0) | |
2828 | return; | |
2829 | data += i; | |
2830 | } | |
2831 | ||
2832 | /* search backwards if there is a marker in the packet */ | |
2833 | for (i = len - 1; --i >= 0; ) { | |
2834 | if (data[i] != 0xff) { | |
2835 | i--; | |
2836 | continue; | |
2837 | } | |
2838 | if (data[i + 1] == 0xff) { | |
2839 | ||
2840 | /* (there may be 'ff ff' inside a marker) */ | |
2841 | if (i + 2 >= len || data[i + 2] == 0x00) | |
2842 | goto marker_found; | |
2843 | } | |
2844 | } | |
2845 | ||
2846 | /* no marker found */ | |
2847 | /* add the JPEG header if first fragment */ | |
2848 | if (data[len - 1] == 0xff) | |
2849 | sd->short_mark = -1; | |
2850 | if (gspca_dev->last_packet_type == LAST_PACKET) | |
a95bd640 JFM |
2851 | gspca_frame_add(gspca_dev, FIRST_PACKET, |
2852 | sd->jpeg_hdr, JPEG_HDR_SZ); | |
a95bd640 | 2853 | gspca_frame_add(gspca_dev, INTER_PACKET, data, len); |
a4a3076f JFM |
2854 | return; |
2855 | ||
2856 | /* marker found */ | |
2857 | /* if some error, discard the frame */ | |
2858 | marker_found: | |
2859 | if (i > 2) { | |
2860 | if (data[i - 2] != 0xff || data[i - 1] != 0xd9) { | |
2861 | gspca_dev->last_packet_type = DISCARD_PACKET; | |
2862 | } | |
2863 | } else if (i + 6 < len) { | |
2864 | if (data[i + 6] & 0x08) { | |
2865 | gspca_dev->last_packet_type = DISCARD_PACKET; | |
2866 | } | |
2867 | } | |
a95bd640 | 2868 | |
a4a3076f JFM |
2869 | gspca_frame_add(gspca_dev, LAST_PACKET, data, i); |
2870 | ||
2871 | /* if the marker is smaller than 62 bytes, | |
2872 | * memorize the number of bytes to skip in the next packet */ | |
2873 | if (i + 62 > len) { /* no more usable data */ | |
2874 | sd->short_mark = i + 62 - len; | |
a95bd640 | 2875 | return; |
a4a3076f | 2876 | } |
a95bd640 | 2877 | |
0f77f40c | 2878 | if (sd->ag_cnt >= 0) |
a4a3076f JFM |
2879 | set_lum(sd, data + i); |
2880 | ||
2881 | /* if more data, start a new frame */ | |
2882 | i += 62; | |
2883 | if (i < len) { | |
2884 | data += i; | |
2885 | len -= i; | |
2886 | gspca_frame_add(gspca_dev, FIRST_PACKET, | |
2887 | sd->jpeg_hdr, JPEG_HDR_SZ); | |
2888 | gspca_frame_add(gspca_dev, INTER_PACKET, data, len); | |
2889 | } | |
6a7eba24 JFM |
2890 | } |
2891 | ||
77ac0baf JFM |
2892 | static int sd_set_jcomp(struct gspca_dev *gspca_dev, |
2893 | struct v4l2_jpegcompression *jcomp) | |
2894 | { | |
2895 | struct sd *sd = (struct sd *) gspca_dev; | |
2896 | ||
2897 | if (jcomp->quality < QUALITY_MIN) | |
2898 | sd->quality = QUALITY_MIN; | |
2899 | else if (jcomp->quality > QUALITY_MAX) | |
2900 | sd->quality = QUALITY_MAX; | |
2901 | else | |
2902 | sd->quality = jcomp->quality; | |
2903 | if (gspca_dev->streaming) | |
2904 | jpeg_set_qual(sd->jpeg_hdr, sd->quality); | |
2905 | return 0; | |
2906 | } | |
2907 | ||
2908 | static int sd_get_jcomp(struct gspca_dev *gspca_dev, | |
2909 | struct v4l2_jpegcompression *jcomp) | |
2910 | { | |
2911 | struct sd *sd = (struct sd *) gspca_dev; | |
2912 | ||
2913 | memset(jcomp, 0, sizeof *jcomp); | |
2914 | jcomp->quality = sd->quality; | |
2915 | jcomp->jpeg_markers = V4L2_JPEG_MARKER_DHT | |
2916 | | V4L2_JPEG_MARKER_DQT; | |
2917 | return 0; | |
2918 | } | |
2919 | ||
37c6dbe2 HG |
2920 | static int sd_querymenu(struct gspca_dev *gspca_dev, |
2921 | struct v4l2_querymenu *menu) | |
2922 | { | |
2923 | switch (menu->id) { | |
2924 | case V4L2_CID_POWER_LINE_FREQUENCY: | |
2925 | switch (menu->index) { | |
2926 | case 0: /* V4L2_CID_POWER_LINE_FREQUENCY_DISABLED */ | |
2927 | strcpy((char *) menu->name, "NoFliker"); | |
2928 | return 0; | |
2929 | case 1: /* V4L2_CID_POWER_LINE_FREQUENCY_50HZ */ | |
2930 | strcpy((char *) menu->name, "50 Hz"); | |
2931 | return 0; | |
2932 | case 2: /* V4L2_CID_POWER_LINE_FREQUENCY_60HZ */ | |
2933 | strcpy((char *) menu->name, "60 Hz"); | |
2934 | return 0; | |
2935 | } | |
2936 | break; | |
2937 | } | |
2938 | return -EINVAL; | |
2939 | } | |
2940 | ||
2856643e | 2941 | #if defined(CONFIG_INPUT) || defined(CONFIG_INPUT_MODULE) |
9712a8be HG |
2942 | static int sd_int_pkt_scan(struct gspca_dev *gspca_dev, |
2943 | u8 *data, /* interrupt packet data */ | |
2944 | int len) /* interrupt packet length */ | |
2945 | { | |
2946 | int ret = -EINVAL; | |
2947 | ||
2948 | if (len == 1 && data[0] == 1) { | |
2949 | input_report_key(gspca_dev->input_dev, KEY_CAMERA, 1); | |
2950 | input_sync(gspca_dev->input_dev); | |
2951 | input_report_key(gspca_dev->input_dev, KEY_CAMERA, 0); | |
2952 | input_sync(gspca_dev->input_dev); | |
2953 | ret = 0; | |
2954 | } | |
2955 | ||
2956 | return ret; | |
2957 | } | |
2958 | #endif | |
2959 | ||
6a7eba24 | 2960 | /* sub-driver description */ |
a5ae2062 | 2961 | static const struct sd_desc sd_desc = { |
6a7eba24 JFM |
2962 | .name = MODULE_NAME, |
2963 | .ctrls = sd_ctrls, | |
72b667eb | 2964 | .nctrls = NCTRLS, |
6a7eba24 | 2965 | .config = sd_config, |
012d6b02 | 2966 | .init = sd_init, |
6a7eba24 JFM |
2967 | .start = sd_start, |
2968 | .stopN = sd_stopN, | |
6a7eba24 | 2969 | .pkt_scan = sd_pkt_scan, |
cebf3b67 | 2970 | .dq_callback = do_autogain, |
77ac0baf JFM |
2971 | .get_jcomp = sd_get_jcomp, |
2972 | .set_jcomp = sd_set_jcomp, | |
37c6dbe2 | 2973 | .querymenu = sd_querymenu, |
2856643e | 2974 | #if defined(CONFIG_INPUT) || defined(CONFIG_INPUT_MODULE) |
9712a8be HG |
2975 | .int_pkt_scan = sd_int_pkt_scan, |
2976 | #endif | |
6a7eba24 JFM |
2977 | }; |
2978 | ||
2979 | /* -- module initialisation -- */ | |
d5aa3856 | 2980 | #define BS(bridge, sensor) \ |
9d64fdb1 | 2981 | .driver_info = (BRIDGE_ ## bridge << 16) \ |
c6c14330 JFM |
2982 | | (SENSOR_ ## sensor << 8) |
2983 | #define BSF(bridge, sensor, flags) \ | |
2984 | .driver_info = (BRIDGE_ ## bridge << 16) \ | |
2985 | | (SENSOR_ ## sensor << 8) \ | |
2986 | | (flags) | |
95c967c1 | 2987 | static const struct usb_device_id device_table[] = { |
d5aa3856 JFM |
2988 | {USB_DEVICE(0x0458, 0x7025), BS(SN9C120, MI0360)}, |
2989 | {USB_DEVICE(0x0458, 0x702e), BS(SN9C120, OV7660)}, | |
3afef85b JFM |
2990 | {USB_DEVICE(0x045e, 0x00f5), BSF(SN9C105, OV7660, F_PDN_INV)}, |
2991 | {USB_DEVICE(0x045e, 0x00f7), BSF(SN9C105, OV7660, F_PDN_INV)}, | |
d5aa3856 JFM |
2992 | {USB_DEVICE(0x0471, 0x0327), BS(SN9C105, MI0360)}, |
2993 | {USB_DEVICE(0x0471, 0x0328), BS(SN9C105, MI0360)}, | |
2994 | {USB_DEVICE(0x0471, 0x0330), BS(SN9C105, MI0360)}, | |
2995 | {USB_DEVICE(0x06f8, 0x3004), BS(SN9C105, OV7660)}, | |
2996 | {USB_DEVICE(0x06f8, 0x3008), BS(SN9C105, OV7660)}, | |
2997 | /* {USB_DEVICE(0x0c45, 0x603a), BS(SN9C102P, OV7648)}, */ | |
2998 | {USB_DEVICE(0x0c45, 0x6040), BS(SN9C102P, HV7131R)}, | |
2999 | /* {USB_DEVICE(0x0c45, 0x607a), BS(SN9C102P, OV7648)}, */ | |
3000 | /* {USB_DEVICE(0x0c45, 0x607b), BS(SN9C102P, OV7660)}, */ | |
3001 | {USB_DEVICE(0x0c45, 0x607c), BS(SN9C102P, HV7131R)}, | |
3002 | /* {USB_DEVICE(0x0c45, 0x607e), BS(SN9C102P, OV7630)}, */ | |
3afef85b | 3003 | {USB_DEVICE(0x0c45, 0x60c0), BSF(SN9C105, MI0360, F_ILLUM)}, |
a067db84 | 3004 | /* or MT9V111 */ |
d5aa3856 JFM |
3005 | /* {USB_DEVICE(0x0c45, 0x60c2), BS(SN9C105, P1030xC)}, */ |
3006 | /* {USB_DEVICE(0x0c45, 0x60c8), BS(SN9C105, OM6802)}, */ | |
3007 | /* {USB_DEVICE(0x0c45, 0x60cc), BS(SN9C105, HV7131GP)}, */ | |
c4f95d84 | 3008 | {USB_DEVICE(0x0c45, 0x60ce), BS(SN9C105, SP80708)}, |
d5aa3856 JFM |
3009 | {USB_DEVICE(0x0c45, 0x60ec), BS(SN9C105, MO4000)}, |
3010 | /* {USB_DEVICE(0x0c45, 0x60ef), BS(SN9C105, ICM105C)}, */ | |
3011 | /* {USB_DEVICE(0x0c45, 0x60fa), BS(SN9C105, OV7648)}, */ | |
6804675e | 3012 | /* {USB_DEVICE(0x0c45, 0x60f2), BS(SN9C105, OV7660)}, */ |
d5aa3856 | 3013 | {USB_DEVICE(0x0c45, 0x60fb), BS(SN9C105, OV7660)}, |
d5aa3856 JFM |
3014 | {USB_DEVICE(0x0c45, 0x60fc), BS(SN9C105, HV7131R)}, |
3015 | {USB_DEVICE(0x0c45, 0x60fe), BS(SN9C105, OV7630)}, | |
d5aa3856 | 3016 | {USB_DEVICE(0x0c45, 0x6100), BS(SN9C120, MI0360)}, /*sn9c128*/ |
860e7f47 | 3017 | {USB_DEVICE(0x0c45, 0x6102), BS(SN9C120, PO2030N)}, /* /GC0305*/ |
d5aa3856 JFM |
3018 | /* {USB_DEVICE(0x0c45, 0x6108), BS(SN9C120, OM6802)}, */ |
3019 | {USB_DEVICE(0x0c45, 0x610a), BS(SN9C120, OV7648)}, /*sn9c128*/ | |
3020 | {USB_DEVICE(0x0c45, 0x610b), BS(SN9C120, OV7660)}, /*sn9c128*/ | |
3021 | {USB_DEVICE(0x0c45, 0x610c), BS(SN9C120, HV7131R)}, /*sn9c128*/ | |
3022 | {USB_DEVICE(0x0c45, 0x610e), BS(SN9C120, OV7630)}, /*sn9c128*/ | |
3023 | /* {USB_DEVICE(0x0c45, 0x610f), BS(SN9C120, S5K53BEB)}, */ | |
3024 | /* {USB_DEVICE(0x0c45, 0x6122), BS(SN9C110, ICM105C)}, */ | |
3025 | /* {USB_DEVICE(0x0c45, 0x6123), BS(SN9C110, SanyoCCD)}, */ | |
3026 | {USB_DEVICE(0x0c45, 0x6128), BS(SN9C120, OM6802)}, /*sn9c325?*/ | |
d2d16e90 | 3027 | /*bw600.inf:*/ |
b8c8a5bf | 3028 | {USB_DEVICE(0x0c45, 0x612a), BS(SN9C120, OV7648)}, /*sn9c325?*/ |
2a3b501f | 3029 | {USB_DEVICE(0x0c45, 0x612b), BS(SN9C110, ADCM1700)}, |
d5aa3856 JFM |
3030 | {USB_DEVICE(0x0c45, 0x612c), BS(SN9C110, MO4000)}, |
3031 | {USB_DEVICE(0x0c45, 0x612e), BS(SN9C110, OV7630)}, | |
3032 | /* {USB_DEVICE(0x0c45, 0x612f), BS(SN9C110, ICM105C)}, */ | |
d5aa3856 | 3033 | {USB_DEVICE(0x0c45, 0x6130), BS(SN9C120, MI0360)}, |
a067db84 | 3034 | /* or MT9V111 / MI0360B */ |
d5aa3856 JFM |
3035 | /* {USB_DEVICE(0x0c45, 0x6132), BS(SN9C120, OV7670)}, */ |
3036 | {USB_DEVICE(0x0c45, 0x6138), BS(SN9C120, MO4000)}, | |
3037 | {USB_DEVICE(0x0c45, 0x613a), BS(SN9C120, OV7648)}, | |
d5aa3856 | 3038 | {USB_DEVICE(0x0c45, 0x613b), BS(SN9C120, OV7660)}, |
d5aa3856 JFM |
3039 | {USB_DEVICE(0x0c45, 0x613c), BS(SN9C120, HV7131R)}, |
3040 | {USB_DEVICE(0x0c45, 0x613e), BS(SN9C120, OV7630)}, | |
ad98c0f6 | 3041 | {USB_DEVICE(0x0c45, 0x6142), BS(SN9C120, PO2030N)}, /*sn9c120b*/ |
6804675e | 3042 | /* or GC0305 / GC0307 */ |
d5aa3856 JFM |
3043 | {USB_DEVICE(0x0c45, 0x6143), BS(SN9C120, SP80708)}, /*sn9c120b*/ |
3044 | {USB_DEVICE(0x0c45, 0x6148), BS(SN9C120, OM6802)}, /*sn9c120b*/ | |
a63d6018 | 3045 | {USB_DEVICE(0x0c45, 0x614a), BSF(SN9C120, ADCM1700, F_ILLUM)}, |
e48d38f7 | 3046 | /* {USB_DEVICE(0x0c45, 0x614c), BS(SN9C120, GC0306)}, */ /*sn9c120b*/ |
6a7eba24 JFM |
3047 | {} |
3048 | }; | |
3049 | MODULE_DEVICE_TABLE(usb, device_table); | |
3050 | ||
3051 | /* -- device connect -- */ | |
3052 | static int sd_probe(struct usb_interface *intf, | |
3053 | const struct usb_device_id *id) | |
3054 | { | |
3055 | return gspca_dev_probe(intf, id, &sd_desc, sizeof(struct sd), | |
3056 | THIS_MODULE); | |
3057 | } | |
3058 | ||
3059 | static struct usb_driver sd_driver = { | |
3060 | .name = MODULE_NAME, | |
3061 | .id_table = device_table, | |
3062 | .probe = sd_probe, | |
3063 | .disconnect = gspca_disconnect, | |
6a709749 JFM |
3064 | #ifdef CONFIG_PM |
3065 | .suspend = gspca_suspend, | |
3066 | .resume = gspca_resume, | |
3067 | #endif | |
6a7eba24 JFM |
3068 | }; |
3069 | ||
3070 | /* -- module insert / remove -- */ | |
3071 | static int __init sd_mod_init(void) | |
3072 | { | |
54826437 | 3073 | return usb_register(&sd_driver); |
6a7eba24 JFM |
3074 | } |
3075 | static void __exit sd_mod_exit(void) | |
3076 | { | |
3077 | usb_deregister(&sd_driver); | |
6a7eba24 JFM |
3078 | } |
3079 | ||
3080 | module_init(sd_mod_init); | |
3081 | module_exit(sd_mod_exit); | |
3afef85b JFM |
3082 | |
3083 | module_param(starcam, int, 0644); | |
3084 | MODULE_PARM_DESC(starcam, | |
3085 | "StarCam model. 0: Clip, 1: 370i"); |