Add doxygen documentation to all functions in ov965x.c
[microdia.git] / microdia-dev.c
blobbebef2fd2ad4ad241f86cf783308cc2428a4aeba
1 /**
2 * @file microdia-dev.c
3 * @author Nicolas VIVIEN
4 * @date 2008-02-01
6 * @brief Device specific functions
8 * @note Copyright (C) Nicolas VIVIEN
10 * @par Licences
12 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License as published by
14 * the Free Software Foundation; either version 2 of the License, or
15 * any later version.
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, write to the Free Software
24 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
27 #include <linux/errno.h>
28 #include <linux/string.h>
29 #include <stdarg.h>
31 #include "microdia.h"
32 #include "sn9c20x.h"
33 #include "ov7670.h"
34 #include "ov965x.h"
35 #include "mt9vx11.h"
36 #include "ov7660.h"
38 /**
39 * @brief Set USB-bandwidth to maximum
41 * @param dev Pointer to device structure
43 * @returns 0 or negative error value
45 int dev_microdia_camera_on(struct usb_microdia *dev)
47 int ret = -1;
48 struct usb_device *udev = dev->udev;
50 ret = usb_set_interface(udev, 0, 8);
52 if (ret < 0)
53 UDIA_ERROR("usb_set_interface failed !\n");
55 return ret;
58 /**
59 * @brief Set USB-bandwidth to minimum
61 * @param dev Pointer to device structure
63 * @returns 0 or negative error value
65 int dev_microdia_camera_off(struct usb_microdia *dev)
67 int ret = -1;
68 struct usb_device *udev = dev->udev;
70 ret = usb_set_interface(udev, 0, 0);
72 if (ret < 0)
73 UDIA_ERROR("usb_set_interface failed !\n");
75 return 0;
78 /**
79 * @brief Wrapper function for camera-setting functions
81 * @param dev Pointer to device structure
83 * @returns 0
85 int dev_microdia_camera_settings(struct usb_microdia *dev)
87 dev_microdia_camera_set_contrast(dev);
88 dev_microdia_camera_set_brightness(dev);
89 dev_microdia_camera_set_gamma(dev);
90 dev_microdia_camera_set_exposure(dev);
91 dev_microdia_camera_set_hvflip(dev);
92 dev_microdia_camera_set_sharpness(dev);
93 dev_microdia_camera_set_rgb_gain(dev);
94 dev_microdia_camera_set_auto_exposure(dev);
95 dev_microdia_camera_set_auto_whitebalance(dev);
96 return 0;
99 /**
100 * @brief Wrapper function for device-specific contrast functions
102 * @param dev Pointer to device structure
104 * @returns 0 or negative error value
106 * This will execute a function determined by the array #cameras and
107 * the function find_camera().
110 int dev_microdia_camera_set_contrast(struct usb_microdia *dev)
112 int ret = -ENODEV;
113 if (dev && dev->set_contrast)
114 ret = dev->set_contrast(dev);
115 return ret;
119 * @brief Wrapper function for device-specific brightness functions
121 * @param dev Pointer to device structure
123 * @returns 0 or negative error value
125 * This will execute a function determined by the array #cameras and
126 * the function find_camera().
129 int dev_microdia_camera_set_brightness(struct usb_microdia *dev)
131 int ret = -ENODEV;
132 if (dev && dev->set_brightness)
133 ret = dev->set_brightness(dev);
134 return ret;
138 * @brief Wrapper function for device-specific gamma functions
140 * @param dev Pointer to device structure
142 * @returns 0 or negative error value
144 * This will execute a function determined by the array #cameras and
145 * the function find_camera().
148 int dev_microdia_camera_set_gamma(struct usb_microdia *dev)
150 int ret = -ENODEV;
151 if (dev && dev->set_gamma)
152 ret = dev->set_gamma(dev);
153 return ret;
157 * @brief Wrapper function for device-specific exposure functions
159 * @param dev Pointer to device structure
161 * @returns 0 or negative error value
163 * This will execute a function determined by the array #cameras and
164 * the function find_camera().
167 int dev_microdia_camera_set_exposure(struct usb_microdia *dev)
169 if (dev->set_exposure != NULL)
170 return dev->set_exposure(dev);
172 return 0;
176 * @brief Wrapper function for device-specific hvflip functions
178 * @param dev Pointer to device structure
180 * @returns 0 or negative error value
182 * This will execute a function determined by the array #cameras and
183 * the function find_camera().
186 int dev_microdia_camera_set_hvflip(struct usb_microdia *dev)
188 int ret = -ENODEV;
189 if (dev && dev->set_hvflip)
190 ret = dev->set_hvflip(dev);
192 return ret;
196 * @brief Wrapper function for device-specific sharpness functions
198 * @param dev Pointer to device structure
200 * @returns 0 or negative error value
202 * This will execute a function determined by the array #cameras and
203 * the function find_camera().
206 int dev_microdia_camera_set_sharpness(struct usb_microdia *dev)
208 int ret = -ENODEV;
209 if (dev && dev->set_sharpness)
210 ret = dev->set_sharpness(dev);
212 return ret;
216 * @brief Wrapper function for device-specific rgb-gain functions
218 * @param dev Pointer to device structure
220 * @returns 0 or negative error value
222 * This will execute a function determined by the array #cameras and
223 * the function find_camera().
226 int dev_microdia_camera_set_rgb_gain(struct usb_microdia *dev)
228 int ret = -ENODEV;
229 if (dev && dev->set_rgb_gain)
230 ret = dev->set_rgb_gain(dev);
232 return ret;
236 * @brief Wrapper function for device-specific auto-exposure functions
238 * @param dev Pointer to device structure
240 * @returns 0 or negative error value
242 * This will execute a function determined by the array #cameras and
243 * the function find_camera().
246 int dev_microdia_camera_set_auto_exposure(struct usb_microdia *dev)
248 int ret = -ENODEV;
249 if (dev && dev->set_auto_exposure)
250 ret = dev->set_auto_exposure(dev);
252 return ret;
256 * @brief Wrapper function for device-specific auto-whitebalance functions
258 * @param dev Pointer to device structure
260 * @returns 0 or negative error value
262 * This will execute a function determined by the array #cameras and
263 * the function find_camera().
266 int dev_microdia_camera_set_auto_whitebalance(struct usb_microdia *dev)
268 int ret = -ENODEV;
269 if (dev && dev->set_auto_whitebalance)
270 ret = dev->set_auto_whitebalance(dev);
272 return ret;
277 * @brief Wrapper function for device-specific initialization functions
279 * @param dev Pointer to device structure
281 * @returns 0 or negative error value
283 * This will execute a function determined by the array #cameras and
284 * the function find_camera().
287 int dev_microdia_initialize_device(struct usb_microdia *dev)
289 int ret = -ENODEV;
291 if (dev && dev->initialize)
292 ret = dev->initialize(dev);
294 return ret;
298 * @brief From init-physical-replug.log
300 * @param dev
302 * @returns 0
304 * @author psnel
306 * For SN9C201 with MI1300.
309 int microdia_6240_initialize(struct usb_microdia *dev)
311 return 0;
315 * @brief From start.log (14 jun 2008)
317 * @param dev
319 * @returns 0
321 * @author psnel
323 * For SN9C201 with MI1300.
326 int microdia_6240_start_stream(struct usb_microdia *dev)
328 int ret = 0;
329 int i;
330 __u16 reg;
331 __u8 value[1];
333 /* Setup the bridge registers */
334 static __u16 bridge6240_init[][2] = {
335 {0x1020, 0x80},
336 {0x1066, 0x00},
337 {0x1007, 0x20},
338 {0x1006, 0x00},
339 {0x1000, 0x78},
340 {0x1001, 0xc7},
341 {0x1002, 0x18},
342 {0x1006, 0x80},
343 {0x1007, 0xa0},
344 {0x1061, 0x01},
345 {0x1020, 0x80},
346 {0x1067, 0x40},
347 {0x1068, 0x30},
348 {0x1069, 0x20},
349 {0x1070, 0x10},
350 {0x1071, 0x08},
351 {0x10e0, 0x45},
352 {0x10f5, 0x60},
353 {0x10f8, 0x00},
354 {0x10f9, 0x00},
355 {0x10fa, 0x00},
356 {0x10fb, 0x00},
357 {0x10fc, 0xa0},
358 {0x10fd, 0x00},
359 {0x10fe, 0xf0},
360 {0x10ff, 0x00},
361 {0x1188, 0x06},
362 {0x1189, 0x4c},
363 {0x1190, 0x08},
364 {0x118b, 0x00},
365 {0x118c, 0x20},
366 {0x118d, 0x20},
367 {0x118e, 0x20},
368 {0x118f, 0x20},
369 {0x1190, 0x00},
370 {0x1191, 0x24},
371 {0x1192, 0x3b},
372 {0x1193, 0x4f},
373 {0x1194, 0x61},
374 {0x1195, 0x71},
375 {0x1196, 0x80},
376 {0x1197, 0x8f},
377 {0x1198, 0x9d},
378 {0x1199, 0xab},
379 {0x119a, 0xb8},
380 {0x119b, 0xc4},
381 {0x119c, 0xd1},
382 {0x119d, 0xdd},
383 {0x119e, 0xe9},
384 {0x119f, 0xf4},
385 {0x11a0, 0xff},
386 {0x11a1, 0x00},
387 {0x11a2, 0x00},
388 {0x11b8, 0x60},
389 {0x11b9, 0x28},
390 {0x11ba, 0x00},
391 {0x11bb, 0x08},
392 {0x11bc, 0x00},
393 {0x11bd, 0x00},
394 {0x11be, 0x00},
395 {0x11bf, 0x00},
396 {0x11c0, 0x00},
397 {0x11b8, 0x38},
398 {0x1000, 0x78},
399 {0x10e0, 0x47},
400 {0x10e0, 0x07},
401 {0x1001, 0xc6},
402 {0x1001, 0xc4},
403 {0x1001, 0x44},
404 {0x1189, 0x0c},
405 {0x11bc, 0x00},
406 {0x11bd, 0x00},
407 {0x11be, 0x00},
408 {0x11bf, 0x00},
409 {0x1180, 0x02},
410 {0x1181, 0x00},
411 {0x1182, 0x02},
412 {0x1183, 0x00},
413 {0x1184, 0x28},
414 {0x1185, 0x3c},
415 {0x11fb, 0x00},
416 {0x11fc, 0xa0},
417 {0x11fd, 0x00},
418 {0x11fe, 0xf0},
419 {0x11ff, 0x00},
420 {0x1189, 0x0c},
421 {0x11a1, 0x00},
422 {0x11a2, 0x00},
423 {0x11a3, 0x6a},
424 {0x11a4, 0x50},
425 {0x11ab, 0x00},
426 {0x11ac, 0x00},
427 {0x11ad, 0x50},
428 {0x11ae, 0x3c},
429 {0x1000, 0x7c},
430 {0x1002, 0x1c},
431 {0x1002, 0x1c},
432 {0x11b8, 0x38},
433 {0x118a, 0x05},
434 {0x0395, 0x05},
435 {0x11b8, 0x78},
436 {0x11b8, 0x79},
437 {0x11b8, 0x7a},
438 {0x11b8, 0x7b},
439 {0x11b8, 0xfc},
440 {0x11b8, 0x78},
441 {0x11ba, 0x0a},
442 {0x118b, 0x0a},
443 {0x10f7, 0x07},
444 {0x10f8, 0x14},
445 {0x10fa, 0xff},
446 {0x10f9, 0x00},
447 {0x10f9, 0x00},
448 {0x11ba, 0x0a},
449 {0x11bc, 0x00},
450 {0x11bd, 0x00},
451 {0x11be, 0x00},
452 {0x11bf, 0x00},
453 {0x11c0, 0x00},
454 {0x11c1, 0x00},
455 {0x11c2, 0x00},
456 {0x11c3, 0x00},
457 {0x11c4, 0x00},
458 {0x11c5, 0x00},
459 {0x11c6, 0x00},
460 {0x11c7, 0x00},
461 {0x11c8, 0x00},
462 {0x11c9, 0x00},
463 {0x11ca, 0x00},
464 {0x11cb, 0x00},
465 {0x11cc, 0x00},
466 {0x11cd, 0x00},
467 {0x11ce, 0x00},
468 {0x11cf, 0x00},
469 {0x11d0, 0x00},
470 {0x11d1, 0x00},
471 {0x11d2, 0x00},
472 {0x11d3, 0x00},
473 {0x11d4, 0x00},
474 {0x11d5, 0x00},
475 {0x11d6, 0x00},
476 {0x11d7, 0x00},
477 {0x11d8, 0x00},
478 {0x11d9, 0x00},
479 {0x11da, 0x00},
480 {0x11db, 0x00},
481 {0x11dc, 0x00},
482 {0x11dd, 0x00},
483 {0x11de, 0x00},
484 {0x11df, 0x00},
485 {0x11e0, 0x00},
486 {0x11e1, 0x00},
487 {0x11e2, 0x00},
488 {0x11e3, 0x00},
489 {0x11e4, 0x00},
490 {0x11e5, 0x00},
491 {0x11e6, 0x00},
492 {0x11e7, 0x00},
493 {0x11e8, 0x00},
494 {0x11e9, 0x00},
495 {0x11ea, 0x00},
496 {0x11eb, 0x00},
497 {0x11ec, 0x00},
498 {0x11ed, 0x00},
499 {0x11ee, 0x00},
500 {0x11ef, 0x00},
501 {0x1180, 0x02},
502 {0x11a5, 0x2d},
503 {0x11a6, 0x2d},
504 {0x11a7, 0x3a},
505 {0x11a8, 0x05},
506 {0x11a9, 0x04},
507 {0x11aa, 0x3f},
508 {0x11af, 0x28},
509 {0x11b0, 0xd8},
510 {0x11b1, 0x14},
511 {0x11b2, 0xec},
512 {0x11b3, 0x32},
513 {0x11b4, 0xdd},
514 {0x11b5, 0x2d},
515 {0x11b6, 0xdd},
516 {0x10e0, 0x07},
517 {0x10e0, 0x27},
518 {0x1100, 0x0d},
519 {0x1101, 0x08},
520 {0x1102, 0x08},
521 {0x1103, 0x0d},
522 {0x1104, 0x08},
523 {0x1105, 0x08},
524 {0x1106, 0x0d},
525 {0x1107, 0x0d},
526 {0x1108, 0x0d},
527 {0x1109, 0x0d},
528 {0x110a, 0x11},
529 {0x110b, 0x0d},
530 {0x110c, 0x0d},
531 {0x110d, 0x11},
532 {0x110e, 0x15},
533 {0x110f, 0x21},
534 {0x1110, 0x15},
535 {0x1111, 0x15},
536 {0x1112, 0x11},
537 {0x1113, 0x11},
538 {0x1114, 0x15},
539 {0x1115, 0x2a},
540 {0x1116, 0x1d},
541 {0x1117, 0x1d},
542 {0x1118, 0x19},
543 {0x1119, 0x21},
544 {0x111a, 0x32},
545 {0x111b, 0x2a},
546 {0x111c, 0x32},
547 {0x111d, 0x32},
548 {0x111e, 0x2e},
549 {0x111f, 0x2a},
550 {0x1120, 0x2e},
551 {0x1121, 0x2e},
552 {0x1122, 0x36},
553 {0x1123, 0x3a},
554 {0x1124, 0x4b},
555 {0x1125, 0x43},
556 {0x1126, 0x36},
557 {0x1127, 0x3a},
558 {0x1128, 0x47},
559 {0x1129, 0x3a},
560 {0x112a, 0x2e},
561 {0x112b, 0x2e},
562 {0x112c, 0x43},
563 {0x112d, 0x5c},
564 {0x112e, 0x43},
565 {0x112f, 0x47},
566 {0x1130, 0x4f},
567 {0x1131, 0x54},
568 {0x1132, 0x58},
569 {0x1133, 0x58},
570 {0x1134, 0x58},
571 {0x1135, 0x32},
572 {0x1136, 0x3f},
573 {0x1137, 0x60},
574 {0x1138, 0x64},
575 {0x1139, 0x5c},
576 {0x113a, 0x54},
577 {0x113b, 0x64},
578 {0x113c, 0x4b},
579 {0x113d, 0x54},
580 {0x113e, 0x58},
581 {0x113f, 0x54},
582 {0x1140, 0x0d},
583 {0x1141, 0x11},
584 {0x1142, 0x11},
585 {0x1143, 0x15},
586 {0x1144, 0x11},
587 {0x1145, 0x15},
588 {0x1146, 0x26},
589 {0x1147, 0x15},
590 {0x1148, 0x15},
591 {0x1149, 0x26},
592 {0x114a, 0x54},
593 {0x114b, 0x36},
594 {0x114c, 0x2e},
595 {0x114d, 0x36},
596 {0x114e, 0x54},
597 {0x114f, 0x54},
598 {0x1150, 0x54},
599 {0x1151, 0x54},
600 {0x1152, 0x54},
601 {0x1153, 0x54},
602 {0x1154, 0x54},
603 {0x1155, 0x54},
604 {0x1156, 0x54},
605 {0x1157, 0x54},
606 {0x1158, 0x54},
607 {0x1159, 0x54},
608 {0x115a, 0x54},
609 {0x115b, 0x54},
610 {0x115c, 0x54},
611 {0x115d, 0x54},
612 {0x115e, 0x54},
613 {0x115f, 0x54},
614 {0x1160, 0x54},
615 {0x1161, 0x54},
616 {0x1162, 0x54},
617 {0x1163, 0x54},
618 {0x1164, 0x54},
619 {0x1165, 0x54},
620 {0x1166, 0x54},
621 {0x1167, 0x54},
622 {0x1168, 0x54},
623 {0x1169, 0x54},
624 {0x116a, 0x54},
625 {0x116b, 0x54},
626 {0x116c, 0x54},
627 {0x116d, 0x54},
628 {0x116e, 0x54},
629 {0x116f, 0x54},
630 {0x1170, 0x54},
631 {0x1171, 0x54},
632 {0x1172, 0x54},
633 {0x1173, 0x54},
634 {0x1174, 0x54},
635 {0x1175, 0x54},
636 {0x1176, 0x54},
637 {0x1177, 0x54},
638 {0x1178, 0x54},
639 {0x1179, 0x54},
640 {0x117a, 0x54},
641 {0x117b, 0x54},
642 {0x117c, 0x54},
643 {0x117d, 0x54},
644 {0x117e, 0x54},
645 {0x117f, 0x54},
646 {0x11e0, 0x07},
647 {0x11e0, 0x0b},
648 {0x1189, 0x0c},
649 {0x11bc, 0x00},
650 {0x11bd, 0x00},
651 {0x11be, 0x00},
652 {0x11bf, 0x00},
653 {0x1180, 0x02},
654 {0x1181, 0x00},
655 {0x1182, 0x02},
656 {0x1183, 0x00},
657 {0x1184, 0x28},
658 {0x1185, 0x3c},
659 {0x10fb, 0x00},
660 {0x10fc, 0xa0},
661 {0x10fd, 0x00},
662 {0x10fe, 0xf0},
663 {0x10ff, 0x00},
664 {0x1189, 0x0c},
665 {0x11a1, 0x00},
666 {0x11a2, 0x00},
667 {0x11a3, 0x6a},
668 {0x11a4, 0x50},
669 {0x11ab, 0x00},
670 {0x11ac, 0x00},
671 {0x11ad, 0x50},
672 {0x11ae, 0x3c},
673 {0x1061, 0x03},
674 {0x11ba, 0x0a},
675 {0x11b9, 0x00},
676 {0x11ba, 0x0b},
677 {0x1061, 0x01},
678 {0x1000, 0x7c},
679 {0x1002, 0x1c},
680 {0x1002, 0x1c},
681 {0x11b8, 0x78},
682 {0x118a, 0x05},
683 {0x0395, 0x05},
684 {0x11b8, 0x78},
685 {0x11b8, 0x79},
686 {0x11b8, 0x7a},
687 {0x11b8, 0x7b},
688 {0x11b8, 0xfc},
689 {0x11b8, 0x78},
690 {0x1061, 0x03},
691 {0x1061, 0x01},
692 {0x1000, 0x3c},
693 {0x11b8, 0x68},
694 {0x1007, 0xa0},
695 {0x1006, 0xa0},
696 {0x1000, 0x98},
697 {0x1001, 0xef},
698 {0x1002, 0x11},
699 {0x1066, 0x00},
700 {0x1066, 0x01},
701 {0x1007, 0xa0},
702 {0x1006, 0x80},
703 {0x1000, 0x78},
704 {0x1001, 0xc7},
705 {0x1002, 0x18},
706 {0x1006, 0x80},
707 {0x1007, 0xa0},
708 {0x1061, 0x01},
709 {0x1020, 0x80},
710 {0x1067, 0x40},
711 {0x1068, 0x30},
712 {0x1069, 0x20},
713 {0x106a, 0x10},
714 {0x106b, 0x08},
715 {0x10e0, 0x45},
716 {0x10f5, 0x60},
717 {0x10f8, 0x00},
718 {0x10f9, 0x00},
719 {0x10fa, 0x00},
720 {0x10fb, 0x00},
721 {0x10fc, 0xa0},
722 {0x10fd, 0x00},
723 {0x10fe, 0xf0},
724 {0x10ff, 0x00},
725 {0x1188, 0x06},
726 {0x1189, 0x4c},
727 {0x118a, 0x08},
728 {0x118b, 0x00},
729 {0x118c, 0x20},
730 {0x118d, 0x20},
731 {0x118e, 0x20},
732 {0x118f, 0x20},
733 {0x1190, 0x00},
734 {0x1191, 0x24},
735 {0x1192, 0x3b},
736 {0x1193, 0x4f},
737 {0x1194, 0x61},
738 {0x1195, 0x71},
739 {0x1196, 0x80},
740 {0x1197, 0x8f},
741 {0x1198, 0x9d},
742 {0x119a, 0xab},
743 {0x119b, 0xb8},
744 {0x119c, 0xc4},
745 {0x119d, 0xd1},
746 {0x119e, 0xdd},
747 {0x119f, 0xe9},
748 {0x1200, 0xf4},
749 {0x1201, 0xff},
750 {0x11a1, 0x00},
751 {0x11a2, 0x00},
752 {0x11b7, 0x60},
753 {0x11b8, 0x28},
754 {0x11b9, 0x00},
755 {0x11ba, 0x08},
756 {0x11bb, 0x00},
757 {0x11bc, 0x00},
758 {0x11bd, 0x00},
759 {0x11be, 0x00},
760 {0x11bf, 0x00},
761 {0x11b8, 0x38},
762 {0x1000, 0x78},
763 {0x10e0, 0x47},
764 {0x10e0, 0x07},
765 {0x1001, 0xc6},
766 {0x1001, 0xc4},
767 {0x1001, 0x44},
768 {0x1189, 0x0c},
769 {0x11bc, 0x00},
770 {0x11bd, 0x00},
771 {0x11be, 0x00},
772 {0x11bf, 0x00},
773 {0x1180, 0x02},
774 {0x1181, 0x00},
775 {0x1182, 0x02},
776 {0x1183, 0x00},
777 {0x1184, 0x28},
778 {0x1185, 0x3c},
779 {0x10fb, 0x00},
780 {0x10fc, 0xa0},
781 {0x10fd, 0x00},
782 {0x10fe, 0xf0},
783 {0x10ff, 0x00},
784 {0x1189, 0x0c},
785 {0x11a1, 0x00},
786 {0x11a2, 0x00},
787 {0x11a3, 0x6a},
788 {0x11a4, 0x50},
789 {0x11ab, 0x00},
790 {0x11ac, 0x00},
791 {0x11ad, 0x50},
792 {0x11ae, 0x3c},
793 {0x1000, 0x7c},
794 {0x1002, 0x1c},
795 {0x1002, 0x1c},
796 {0x11b8, 0x38},
797 {0x118a, 0x05},
798 {0x0395, 0x05},
799 {0x11b8, 0x78},
800 {0x11b8, 0x79},
801 {0x11b8, 0x7a},
802 {0x11b8, 0x7b},
803 {0x11b8, 0xfc},
804 {0x11b8, 0x78},
805 {0x11ba, 0x0a},
806 {0x118b, 0x0a},
807 {0x10f7, 0x07},
808 {0x10f8, 0x14},
809 {0x10fa, 0xff},
810 {0x10f9, 0x00},
811 {0x10f9, 0x00},
812 {0x11ba, 0x0a},
813 {0x11bc, 0x00},
814 {0x11bd, 0x00},
815 {0x11be, 0x00},
816 {0x11bf, 0x00},
817 {0x11c0, 0x00},
818 {0x11c1, 0x00},
819 {0x11c2, 0x00},
820 {0x11c3, 0x00},
821 {0x11c4, 0x00},
822 {0x11c5, 0x00},
823 {0x11c6, 0x00},
824 {0x11c7, 0x00},
825 {0x11c8, 0x00},
826 {0x11c9, 0x00},
827 {0x11ca, 0x00},
828 {0x11cb, 0x00},
829 {0x11cc, 0x00},
830 {0x11cd, 0x00},
831 {0x11ce, 0x00},
832 {0x11cf, 0x00},
833 {0x11d0, 0x00},
834 {0x11d1, 0x00},
835 {0x11d2, 0x00},
836 {0x11d3, 0x00},
837 {0x11d4, 0x00},
838 {0x11d5, 0x00},
839 {0x11d6, 0x00},
840 {0x11d7, 0x00},
841 {0x11d8, 0x00},
842 {0x11d9, 0x00},
843 {0x11da, 0x00},
844 {0x11db, 0x00},
845 {0x11dc, 0x00},
846 {0x11dd, 0x00},
847 {0x11de, 0x00},
848 {0x11df, 0x00},
849 {0x11e0, 0x00},
850 {0x11e1, 0x00},
851 {0x11e2, 0x00},
852 {0x11e3, 0x00},
853 {0x11e4, 0x00},
854 {0x11e5, 0x00},
855 {0x11e6, 0x00},
856 {0x11e7, 0x00},
857 {0x11e8, 0x00},
858 {0x11e9, 0x00},
859 {0x11ea, 0x00},
860 {0x11eb, 0x00},
861 {0x11ec, 0x00},
862 {0x11ed, 0x00},
863 {0x11ee, 0x00},
864 {0x11ef, 0x00},
865 {0x1180, 0x02},
866 {0x1182, 0x02},
867 {0x11a5, 0x2d},
868 {0x11a6, 0x2d},
869 {0x11a7, 0x3a},
870 {0x11a8, 0x05},
871 {0x11a9, 0x04},
872 {0x11aa, 0x3f},
873 {0x11af, 0x28},
874 {0x11b0, 0xd8},
875 {0x11b1, 0x14},
876 {0x11b2, 0xec},
877 {0x11b3, 0x32},
878 {0x11b4, 0xdd},
879 {0x11b5, 0x2d},
880 {0x11b6, 0xdd},
881 {0x11e0, 0x07},
882 {0x11e0, 0x27},
883 {0x1100, 0x0d},
884 {0x1101, 0x08},
885 {0x1102, 0x08},
886 {0x1103, 0x0d},
887 {0x1104, 0x08},
888 {0x1105, 0x08},
889 {0x1106, 0x0d},
890 {0x1107, 0x0d},
891 {0x1108, 0x0d},
892 {0x1109, 0x0d},
893 {0x110a, 0x11},
894 {0x110b, 0x0d},
895 {0x110c, 0x0d},
896 {0x110d, 0x11},
897 {0x110e, 0x15},
898 {0x110f, 0x21},
899 {0x1110, 0x15},
900 {0x1111, 0x15},
901 {0x1112, 0x11},
902 {0x1113, 0x11},
903 {0x1114, 0x15},
904 {0x1115, 0x2a},
905 {0x1116, 0x1d},
906 {0x1117, 0x1d},
907 {0x1118, 0x19},
908 {0x1119, 0x21},
909 {0x111a, 0x32},
910 {0x111b, 0x2a},
911 {0x111c, 0x32},
912 {0x111d, 0x32},
913 {0x111e, 0x2e},
914 {0x111f, 0x2a},
915 {0x1120, 0x2e},
916 {0x1121, 0x2e},
917 {0x1122, 0x36},
918 {0x1123, 0x3a},
919 {0x1124, 0x4b},
920 {0x1125, 0x43},
921 {0x1126, 0x36},
922 {0x1127, 0x3a},
923 {0x1128, 0x47},
924 {0x1129, 0x3a},
925 {0x112a, 0x2e},
926 {0x112b, 0x2e},
927 {0x112c, 0x43},
928 {0x112d, 0x5c},
929 {0x112e, 0x43},
930 {0x112f, 0x47},
931 {0x1130, 0x4f},
932 {0x1131, 0x54},
933 {0x1132, 0x58},
934 {0x1133, 0x58},
935 {0x1134, 0x58},
936 {0x1135, 0x32},
937 {0x1136, 0x3f},
938 {0x1137, 0x60},
939 {0x1138, 0x64},
940 {0x1139, 0x5c},
941 {0x113a, 0x54},
942 {0x113b, 0x64},
943 {0x113c, 0x4b},
944 {0x113d, 0x54},
945 {0x113e, 0x58},
946 {0x113f, 0x54},
947 {0x1140, 0x0d},
948 {0x1141, 0x11},
949 {0x1142, 0x11},
950 {0x1143, 0x15},
951 {0x1144, 0x11},
952 {0x1145, 0x15},
953 {0x1146, 0x26},
954 {0x1147, 0x15},
955 {0x1148, 0x15},
956 {0x1149, 0x26},
957 {0x114a, 0x54},
958 {0x114b, 0x36},
959 {0x114c, 0x2e},
960 {0x114d, 0x36},
961 {0x114e, 0x54},
962 {0x114f, 0x54},
963 {0x1150, 0x54},
964 {0x1151, 0x54},
965 {0x1152, 0x54},
966 {0x1153, 0x54},
967 {0x1154, 0x54},
968 {0x1155, 0x54},
969 {0x1156, 0x54},
970 {0x1157, 0x54},
971 {0x1158, 0x54},
972 {0x1159, 0x54},
973 {0x115a, 0x54},
974 {0x115b, 0x54},
975 {0x115c, 0x54},
976 {0x115d, 0x54},
977 {0x115e, 0x54},
978 {0x115f, 0x54},
979 {0x1160, 0x54},
980 {0x1161, 0x54},
981 {0x1162, 0x54},
982 {0x1163, 0x54},
983 {0x1164, 0x54},
984 {0x1165, 0x54},
985 {0x1166, 0x54},
986 {0x1167, 0x54},
987 {0x1168, 0x54},
988 {0x1169, 0x54},
989 {0x116a, 0x54},
990 {0x116b, 0x54},
991 {0x116c, 0x54},
992 {0x116d, 0x54},
993 {0x116e, 0x54},
994 {0x116f, 0x54},
995 {0x1170, 0x54},
996 {0x1171, 0x54},
997 {0x1172, 0x54},
998 {0x1173, 0x54},
999 {0x1174, 0x54},
1000 {0x1175, 0x54},
1001 {0x1176, 0x54},
1002 {0x1177, 0x54},
1003 {0x1178, 0x54},
1004 {0x1179, 0x54},
1005 {0x117a, 0x54},
1006 {0x117b, 0x54},
1007 {0x117c, 0x54},
1008 {0x117d, 0x54},
1009 {0x117e, 0x54},
1010 {0x117f, 0x54},
1011 {0x11e0, 0x07},
1012 {0x11e0, 0x0b},
1013 {0x1189, 0x0c},
1014 {0x1189, 0x00},
1015 {0x11bc, 0x00},
1016 {0x11bd, 0x00},
1017 {0x11be, 0x00},
1018 {0x11bf, 0x00},
1019 {0x1180, 0x02},
1020 {0x1181, 0x00},
1021 {0x1182, 0x02},
1022 {0x1183, 0x00},
1023 {0x1184, 0x28},
1024 {0x1185, 0x3c},
1025 {0x10fb, 0x00},
1026 {0x10fc, 0xa0},
1027 {0x10fd, 0x00},
1028 {0x10fe, 0xf0},
1029 {0x10ff, 0x00},
1030 {0x1189, 0x0c},
1031 {0x11a1, 0x00},
1032 {0x11a2, 0x00},
1033 {0x11a3, 0x6a},
1034 {0x11a4, 0x50},
1035 {0x11ab, 0x00},
1036 {0x11ac, 0x00},
1037 {0x11ad, 0x50},
1038 {0x11ae, 0x3c},
1039 {0x1061, 0x03},
1040 {0x11ba, 0x0a},
1041 {0x11b9, 0x00},
1042 {0x11ba, 0x0b},
1043 {0x1061, 0x01},
1044 {0x1000, 0x7c},
1045 {0x1002, 0x1c},
1046 {0x1002, 0x1c},
1047 {0x11b8, 0x78},
1048 {0x118a, 0x05},
1049 {0x0395, 0x05},
1050 {0x11b8, 0x78},
1051 {0x11b8, 0x79},
1052 {0x11b8, 0x7a},
1053 {0x11b8, 0x7b},
1054 {0x11b8, 0xfc},
1055 {0x11b8, 0x78},
1056 {0x1061, 0x03},
1059 static __u8 mi1300_init[][2] = {
1060 {0x07, 0x00},
1061 {0x08, 0x02},
1062 {0x0d, 0x00},
1063 {0x0e, 0x01},
1064 {0x0d, 0x00},
1065 {0x0e, 0x00},
1066 {0x01, 0x00},
1067 {0x02, 0x0e},
1068 {0x03, 0x00},
1069 {0x04, 0x14},
1070 {0x03, 0x03},
1071 {0x04, 0xc1},
1072 {0x05, 0x05},
1073 {0x06, 0x01},
1074 {0x05, 0x00},
1075 {0x06, 0x83},
1076 {0x07, 0x00},
1077 {0x08, 0x06},
1078 {0x0d, 0x00},
1079 {0x0e, 0x02},
1080 {0x09, 0x00},
1081 {0x0a, 0x00},
1082 {0x0b, 0x00},
1083 {0x0c, 0x00},
1084 {0x0b, 0x00},
1085 {0x0c, 0x00},
1086 {0x0d, 0x00},
1087 {0x0e, 0x00},
1088 {0x11, 0x00},
1089 {0x12, 0x00},
1090 {0x1e, 0x80},
1091 {0x1f, 0x00},
1092 {0x20, 0x11},
1093 {0x21, 0x05},
1094 {0x2b, 0x00},
1095 {0x2c, 0x08},
1096 {0x2d, 0x00},
1097 {0x2e, 0x10},
1098 {0x2d, 0x00},
1099 {0x2e, 0x14},
1100 {0x2f, 0x00},
1101 {0x30, 0x08},
1102 {0x5f, 0x89},
1103 {0x60, 0x04},
1104 {0x60, 0x00},
1105 {0x61, 0x00},
1106 {0x62, 0x00},
1107 {0x63, 0x00},
1108 {0x62, 0x04},
1109 {0x63, 0x98},
1110 {0x64, 0x00},
1111 {0x65, 0x00},
1112 {0x68, 0x00},
1113 {0x69, 0x00},
1114 {0x20, 0x11},
1115 {0x21, 0x1d},
1116 {0x06, 0x00},
1117 {0x07, 0xf2},
1118 {0x05, 0x00},
1119 {0x06, 0x13},
1120 {0x20, 0x11},
1121 {0x21, 0x1d},
1122 {0x20, 0x11},
1123 {0x21, 0x1d},
1124 {0x09, 0x03},
1125 {0x0a, 0xe8},
1126 {0x07, 0x00},
1127 {0x08, 0x03},
1128 {0x2b, 0x00},
1129 {0x2c, 0x10},
1130 {0x2d, 0x00},
1131 {0x2e, 0x10},
1132 {0x2d, 0x00},
1133 {0x2e, 0x10},
1134 {0x2f, 0x00},
1135 {0x30, 0x10},
1136 {0x07, 0x00},
1137 {0x08, 0x02},
1138 {0x07, 0x00},
1139 {0x08, 0x03},
1140 {0x2c, 0x00},
1141 {0x2d, 0x1d},
1142 {0x2e, 0x00},
1143 {0x2f, 0x1d},
1144 {0x07, 0x00},
1145 {0x08, 0x02},
1146 {0x06, 0x00},
1147 {0x07, 0xf2},
1148 {0x05, 0x00},
1149 {0x06, 0x13},
1150 {0x00, 0x00},
1151 {0x07, 0x00},
1152 {0x08, 0x00},
1153 {0x07, 0x00},
1154 {0x08, 0x00},
1155 {0x07, 0x00},
1156 {0x08, 0x02},
1157 {0x0d, 0x00},
1158 {0x0e, 0x01},
1159 {0x0d, 0x00},
1160 {0x0e, 0x00},
1161 {0x01, 0x00},
1162 {0x02, 0x0e},
1163 {0x03, 0x00},
1164 {0x04, 0x14},
1165 {0x03, 0x03},
1166 {0x04, 0xc1},
1167 {0x05, 0x05},
1168 {0x06, 0x01},
1169 {0x05, 0x00},
1170 {0x06, 0x83},
1171 {0x07, 0x00},
1172 {0x08, 0x06},
1173 {0x0d, 0x00},
1174 {0x0e, 0x02},
1175 {0x09, 0x00},
1176 {0x0a, 0x00},
1177 {0x0b, 0x00},
1178 {0x0c, 0x00},
1179 {0x0b, 0x00},
1180 {0x0c, 0x00},
1181 {0x0d, 0x00},
1182 {0x0e, 0x00},
1183 {0x11, 0x00},
1184 {0x12, 0x00},
1185 {0x1e, 0x80},
1186 {0x1f, 0x00},
1187 {0x20, 0x11},
1188 {0x21, 0x05},
1189 {0x2b, 0x00},
1190 {0x2c, 0x08},
1191 {0x2d, 0x00},
1192 {0x2e, 0x10},
1193 {0x2d, 0x00},
1194 {0x2e, 0x14},
1195 {0x2f, 0x00},
1196 {0x30, 0x08},
1197 {0x5f, 0x89},
1198 {0x60, 0x04},
1199 {0x60, 0x00},
1200 {0x61, 0x00},
1201 {0x62, 0x00},
1202 {0x63, 0x00},
1203 {0x62, 0x00},
1204 {0x63, 0x98},
1205 {0x64, 0x00},
1206 {0x65, 0x00},
1207 {0x68, 0x00},
1208 {0x69, 0x00},
1209 {0x20, 0x11},
1210 {0x21, 0x1d},
1211 {0x06, 0x00},
1212 {0x07, 0xf2},
1213 {0x05, 0x00},
1214 {0x06, 0x13},
1215 {0x20, 0x11},
1216 {0x21, 0x1d},
1217 {0x20, 0x11},
1218 {0x21, 0x1d},
1219 {0x07, 0x00},
1220 {0x08, 0x03},
1221 {0x2b, 0x00},
1222 {0x2c, 0x10},
1223 {0x2d, 0x00},
1224 {0x2e, 0x10},
1225 {0x2d, 0x00},
1226 {0x2e, 0x10},
1227 {0x2f, 0x00},
1228 {0x30, 0x10},
1229 {0x07, 0x00},
1230 {0x08, 0x02},
1231 {0x07, 0x00},
1232 {0x08, 0x03},
1233 {0x2c, 0x00},
1234 {0x2d, 0x1d},
1235 {0x2e, 0x00},
1236 {0x2f, 0x1d},
1237 {0x07, 0x00},
1238 {0x08, 0x02},
1239 {0x06, 0x00},
1240 {0x07, 0xf2},
1241 {0x05, 0x00},
1242 {0x06, 0x13},
1243 {0x00, 0x00},
1246 /* initialize SN9C201 for 6240 */
1247 for (i = 0; i < ARRAY_SIZE(bridge6240_init); i++) {
1248 reg = bridge6240_init[i][0];
1249 value[0] = bridge6240_init[i][1];
1250 ret = usb_microdia_control_write(dev, reg, value, 1);
1251 if (ret < 0) {
1252 UDIA_INFO("6240 Bridge: Inititialization Error (%d) on array line %d\n", ret, i);
1253 break;
1257 /* initialize the Bridge to I2C interface */
1258 ret = sn9c20x_i2c_initialize(dev);
1260 /* initialize the Sensor MI 1300 */
1261 for (i = 0; i < ARRAY_SIZE(mi1300_init); i++) {
1262 reg = mi1300_init[i][0];
1263 value[0] = mi1300_init[i][1];
1264 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 1,
1265 reg, dev->sensor_flags, value);
1266 if (ret < 0) {
1267 UDIA_INFO("Sensor MI 1300: Inititialization Error (%d) on array line %d\n", ret, i);
1268 break;
1272 UDIA_INFO("...start function completed without errors.\n");
1273 return ret;
1277 * @brief From stop-close-amcap.log
1279 * @param dev
1281 * @returns 0
1283 * @author psnel
1285 * For SN9C201 with MI1300. Comments from parser-usbsnoop(updated_13Mar2008).pl output
1288 int microdia_6240_stop_stream(struct usb_microdia *dev)
1290 int ret = 0;
1291 int i;
1292 __u16 reg;
1293 __u8 value[1];
1295 static __u8 mi1300_stop[][2] = {
1296 {0x07, 0x00},
1297 {0x08, 0x00},
1300 static __u16 bridge6240_stop[][2] = {
1301 {0x1061, 0x01},
1302 {0x1000, 0x3c},
1303 {0x11b8, 0x68},
1304 {0x1007, 0xa0},
1305 {0x1006, 0xa0},
1306 {0x1000, 0x98},
1307 {0x1001, 0xef},
1308 {0x1002, 0x11},
1309 {0x1066, 0x00},
1312 UDIA_INFO("Stopping camera...\n");
1314 for (i = 0; i < ARRAY_SIZE(mi1300_stop); i++) {
1315 reg = mi1300_stop[i][0];
1316 value[0] = mi1300_stop[i][1];
1317 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 1,
1318 reg, dev->sensor_flags, value);
1319 if (ret < 0) {
1320 UDIA_INFO("Sensor MI 1300: Stop Sequence Error (%d) on array line %d\n", ret, i);
1321 break;
1325 for (i = 0; i < ARRAY_SIZE(bridge6240_stop); i++) {
1326 reg = bridge6240_stop[i][0];
1327 value[0] = bridge6240_stop[i][1];
1328 ret = usb_microdia_control_write(dev, reg, value, 1);
1329 if (ret < 0) {
1330 UDIA_INFO("6240 Bridge: Stop Sequence Error (%d) on array line %d\n", ret, i);
1331 break;
1335 return 0;
1339 * @brief From init.sequence.log
1341 * @param dev
1343 * @returns 0
1345 * @author GWater
1347 * For SN9C201 with SOI968.
1348 * Tests showed this function is actually unnecessary.
1349 * Nevertheless the reads may give us valuable values we don't know about yet.
1351 int microdia_624e_initialize(struct usb_microdia *dev)
1353 __u8 buf;
1355 usb_microdia_control_read(dev, 0x130d, &buf, 1);
1356 usb_microdia_control_read(dev, 0x1040, &buf, 1);
1358 return 0;
1362 * @brief From UsbSnoop-plugin-parsed.log
1364 * @param dev
1366 * @returns
1368 int microdia_624f_initialize(struct usb_microdia *dev)
1370 /* Do nothing here */
1371 return 0;
1375 * @brief From UsbSnoop-plugin-parsed.log
1377 * @param dev
1379 * @returns
1381 int microdia_6260_initialize(struct usb_microdia *dev)
1383 __u8 buf;
1385 usb_microdia_control_read(dev, 0x130d, &buf, 1);
1386 usb_microdia_control_read(dev, 0x1040, &buf, 1);
1387 buf = 0x00;
1388 usb_microdia_control_write(dev, 0x10c8, &buf, 1);
1389 usb_microdia_control_read(dev, 0x100a, &buf, 1);
1390 buf = 0x04;
1391 usb_microdia_control_write(dev, 0x100a, &buf, 1);
1392 usb_microdia_control_read(dev, 0x100b, &buf, 1);
1393 buf = 0x04;
1394 usb_microdia_control_write(dev, 0x100b, &buf, 1);
1395 usb_microdia_control_read(dev, 0x1001, &buf, 1);
1396 buf = 0xc7;
1397 usb_microdia_control_write(dev, 0x1001, &buf, 1);
1398 usb_microdia_control_read(dev, 0x1040, &buf, 1);
1399 buf = 0x00;
1400 usb_microdia_control_write(dev, 0x1040, &buf, 1);
1401 usb_microdia_control_read(dev, 0x1045, &buf, 1);
1402 buf = 0x04;
1403 usb_microdia_control_write(dev, 0x1045, &buf, 1);
1404 usb_microdia_control_read(dev, 0x1046, &buf, 1);
1405 buf = 0x10;
1406 usb_microdia_control_write(dev, 0x1046, &buf, 1);
1407 buf = 0x14;
1408 usb_microdia_control_write(dev, 0x1045, &buf, 1);
1409 buf = 0x01;
1410 usb_microdia_control_write(dev, 0x1040, &buf, 1);
1411 buf = 0x80;
1412 usb_microdia_control_write(dev, 0x1020, &buf, 1);
1414 return 0;
1418 * @brief From 6 init-logs
1420 * @param dev
1422 * @returns 0 (ok) or -1 (error)
1424 * @author Comer352l
1426 * Windows driver versions: 5.5.8.12 and 5.7.23.000
1427 * Windows versions: 2000 and XP
1428 * USB-Logger: SniffUSB 1.8 and 2.0, USBTrace 2.0, SnoopyPro
1430 * Comments behind read oprations contain HEX-values that appeared in the logs
1432 int microdia_6270_initialize(struct usb_microdia *dev)
1434 /* int actual; */
1435 int ret = 0;
1436 int retSP = 0;
1437 int retASS = 0;
1438 __u8 buf[8];
1439 __u8 buf_0395[1];
1440 __u8 buf_1000[5];
1441 __u8 buf_1060[2];
1442 __u8 buf_11b8[1];
1444 ret += usb_microdia_control_read(dev, 0x130d, buf, 1); /* URB 5 0x81,0x85,0x04,0x8b,0x02,... */
1446 ret += usb_microdia_control_read(dev, 0x1040, buf, 1); /* URB 6 0xe4,0xc4,0xa4,0x44,... */
1449 * THE OLD DRIVER 5.5.8.12 DOES AN ADDITIONAL WRITE HERE:
1450 * buf[0]=0x00;
1451 * usb_microdia_control_write(dev, 0x10c8, buf, 1);
1454 ret += usb_microdia_control_read(dev, 0x118a, buf, 1); /* URB 7 0x05,0x7b,0x01,0x04,... */
1456 ret += usb_microdia_control_read(dev, 0x0395, buf_0395, 1); /* URB 8 0xc2,0x82,0x38,0x98,0x04,... */
1457 /* => this value will be rewritten to 0x118a and 0x0395 later (URBs 81+82) */
1459 buf[0] = 0x05;
1460 ret += usb_microdia_control_write(dev, 0x118a, buf, 1); /* URB 9 */
1462 ret += usb_microdia_control_write(dev, 0x0395, buf, 1); /* URB 10 */
1464 ret += usb_microdia_control_read(dev, 0x11b8, buf_11b8, 1); /* URB 11 0xa0,0x00,0x24,... */
1465 /* => this value will be rewritten to 0x11b8 later (URB 83) */
1467 buf[0] = 0x10;
1468 ret += usb_microdia_control_write(dev, 0x11b8, buf, 1); /* URB 12 */
1470 ret += usb_microdia_control_read(dev, 0x1000, buf_1000, 5); /* URB 13 0x30 0xCF 0x00 0x03 (0x02 or 0x00) */
1471 /* => these values will be rewritten to 0x1000 later (URB 84) */
1473 buf[0] = 0x70; buf[1] = 0x00; buf[2] = 0x18; buf[3] = 0x00; buf[4] = 0x00;
1474 ret += usb_microdia_control_write(dev, 0x1000, buf, 5); /* URB 14 */
1476 ret += usb_microdia_control_read(dev, 0x1060, buf_1060, 2); /* URB 15 0x08 0x00 (always ???) */
1477 /* => this value will be rewritten to 0x1060 later (URB 85) */
1479 buf[0] = 0x00; buf[1] = 0x03;
1480 ret += usb_microdia_control_write(dev, 0x1060, buf, 2); /* URB 16 */
1482 /* initialize I2C registers to avoid getting no ACK at first I2C operation: */
1483 ret += sn9c20x_i2c_initialize(dev);
1485 /* enable I2C communication (bit 0) */
1486 buf[0] = 0x21; /* THE OLD DRIVER 5.5.8.12 WRITES 0x5d */
1487 ret += usb_microdia_control_write(dev, 0x10c8, buf, 1); /* URB 17 */
1489 /* probe sensor model: */
1490 retSP = mt9vx11_sensor_probe(dev); /* substitutes URBs 18-48 */
1491 if ((retSP == 0) && (dev->sensor_slave_address == MT9V111_I2C_SLAVE_ADDRESS))
1492 /* switch (back) to IFP address space: */
1493 retASS = mt9v111_select_address_space(dev, MT9V111_ADDRESSSPACE_IFP);
1495 ret += usb_microdia_control_write(dev, 0x118a, buf_0395, 1); /* URB 81 => write value read with URB 8 */
1497 ret += usb_microdia_control_write(dev, 0x0395, buf_0395, 1); /* URB 82 => write value read with URB 8 */
1499 ret += usb_microdia_control_write(dev, 0x11b8, buf_11b8, 1); /* URB 83 => write value read with URB 11 */
1501 ret += usb_microdia_control_write(dev, 0x1000, buf_1000, 5); /* URB 84 => write value read with URB 13 */
1503 ret += usb_microdia_control_write(dev, 0x1060, buf_1060, 2); /* URB 85 => write value read with URB 15; (always 08 00 ???) */
1505 /* USB-interrupt-message: doesn't work yet (returns error -110) */
1506 /* usb_interrupt_msg(dev->udev, usb_rcvintpipe(dev->udev, dev->int_in_endpointAddr), dev->int_in_buffer, dev->int_in_size, &actual, 1000); // URB 86 */
1509 * THE OLD DRIVER 5.5.8.12 DOES AN ADDITIONAL WRITE HERE:
1510 * wbuf[0]=0x80;
1511 * usb_microdia_control_write(dev, 0x1020, wbuf, 1);
1514 if ((retSP != 0) || (retASS != 0) || (ret < 33)) {
1515 if (ret < 33)
1516 UDIA_INFO("One ore more errors occured during initialization !\n");
1517 return -1;
1518 } else {
1519 return 0;
1525 * @brief From UsbSnoop-plugin-parsed.log
1527 * @param dev
1529 * @returns
1531 int microdia_627b_initialize(struct usb_microdia *dev)
1533 /* Apparently we don't need to write anything here */
1534 return 0;
1538 * @brief From init-start-stop-log (made by Víctor M. Hernández Rocamora)
1540 * @param dev
1542 * @returns 0 (ok) or -1 (error)
1544 * @author Comer352l
1546 * USB-Logger: SniffUSB 2.0
1548 * Comments behind read oprations contain HEX-values that appeared in the log
1550 int microdia_627f_initialize(struct usb_microdia *dev)
1552 __u8 buf[1];
1553 int ret = 0;
1555 ret += usb_microdia_control_read(dev, 0x130d, buf, 1); /* URB 5 0x81 */
1557 ret += usb_microdia_control_read(dev, 0x1040, buf, 1); /* URB 6 0xe4 */
1559 buf[0] = 0x00;
1560 ret += usb_microdia_control_write(dev, 0x10c8, buf, 1); /* URB 7 */
1562 buf[0] = 0x80;
1563 ret += usb_microdia_control_write(dev, 0x1020, buf, 1); /* URB 8 */
1565 ret += usb_microdia_control_read(dev, 0x1045, buf, 1); /* URB 9 0x0f */
1567 buf[0] = 0x1f;
1568 ret += usb_microdia_control_write(dev, 0x1045, buf, 1); /* URB 10 */
1570 ret += usb_microdia_control_read(dev, 0x1045, buf, 1); /* URB 11 0x1f */
1572 buf[0] = 0x0f;
1573 ret += usb_microdia_control_write(dev, 0x1045, buf, 1); /* URB 12 */
1575 ret += usb_microdia_control_read(dev, 0x1045, buf, 1); /* URB 13 0x0f */
1577 buf[0] = 0x1f;
1578 ret += usb_microdia_control_write(dev, 0x1045, buf, 1); /* URB 14 */
1580 if (ret < 10) {
1581 UDIA_INFO("One ore more errors occured during initialization !\n");
1582 return -1;
1584 return 0;
1588 * @brief From UsbSnoop-plugin-parsed.log
1590 * @param dev
1592 * @returns 0 (OK) or <0 (Error)
1594 * @author Vincent, Kuzja
1596 int microdia_6288_initialize(struct usb_microdia *dev)
1599 int ret;
1600 __u16 reg;
1601 __u8 buf[2];
1603 reg = 0x130d ;
1604 ret = usb_microdia_control_read(dev, reg, buf, 1);
1605 if (ret < 0)
1606 goto err;
1608 reg = 0x1040 ;
1609 ret = usb_microdia_control_read(dev, reg, buf, 1);
1610 if (ret < 0)
1611 goto err;
1613 if (ret < 0)
1614 return ret;
1615 else
1616 return 0;
1617 err:
1618 UDIA_ERROR("r/w in Register %x failed (%d)!\n", reg, ret);
1619 return ret;
1623 * @brief Wrapper function for device-specific startstream functions
1625 * @param dev Pointer to device structure
1627 * @returns 0
1629 * This will execute a function determined by the array #cameras and
1630 * the function find_camera().
1633 int dev_microdia_start_stream(struct usb_microdia *dev)
1635 int ret = -ENODEV;
1636 if (dev && dev->start_stream)
1637 ret = dev->start_stream(dev);
1639 return ret;
1643 * @brief From start.htm
1645 * @param dev
1647 * @returns 0
1649 * @author GWater
1651 * For SN9C201 with MI1310.
1653 int microdia_6242_start_stream(struct usb_microdia *dev)
1655 int i = -1;
1656 __u8 buf[48];
1658 __u8 urb10[24] = {
1659 0x01, 0x18, 0x00, 0x30, 0x00, 0x09, 0x00, 0xed,
1660 0x0f, 0xda, 0x0f, 0x3a, 0x00, 0x3a, 0x00, 0xd0,
1661 0x0f, 0xf7, 0x0f, 0x00, 0x00, 0x00, 0x60, 0x0a};
1663 __u8 urb13[11] = {
1664 0x02, 0x00, 0x02, 0x00, 0x50, 0x78, 0x00, 0x00,
1665 0x07, 0xc0, 0x0a};
1667 __u8 urb14[22] = {
1668 0x00, 0x20, 0x20, 0x20, 0x20, 0x00, 0x24, 0x3b,
1669 0x4f, 0x61, 0x71, 0x80, 0x8f, 0x9d, 0xab, 0xb8,
1670 0xc4, 0xd1, 0xdd, 0xe9, 0xf4, 0xff};
1672 __u8 qtable1[64] = {
1673 0x0d, 0x08, 0x08, 0x0d, 0x08, 0x08, 0x0d, 0x0d,
1674 0x0d, 0x0d, 0x11, 0x0d, 0x0d, 0x11, 0x15, 0x21,
1675 0x15, 0x15, 0x11, 0x11, 0x15, 0x2a, 0x1d, 0x1d,
1676 0x19, 0x21, 0x32, 0x2a, 0x32, 0x32, 0x2e, 0x2a,
1677 0x2e, 0x2e, 0x36, 0x3a, 0x4b, 0x43, 0x36, 0x3a,
1678 0x47, 0x3a, 0x2e, 0x2e, 0x43, 0x5c, 0x43, 0x47,
1679 0x4f, 0x54, 0x58, 0x58, 0x58, 0x32, 0x3f, 0x60,
1680 0x64, 0x5c, 0x54, 0x64, 0x4b, 0x54, 0x58, 0x54};
1682 __u8 qtable2[64] = {
1683 0x0d, 0x11, 0x11, 0x15, 0x11, 0x15, 0x26, 0x15,
1684 0x15, 0x26, 0x54, 0x36, 0x2e, 0x36, 0x54, 0x54,
1685 0x54, 0x54, 0x54, 0x54, 0x54, 0x54, 0x54, 0x54,
1686 0x54, 0x54, 0x54, 0x54, 0x54, 0x54, 0x54, 0x54,
1687 0x54, 0x54, 0x54, 0x54, 0x54, 0x54, 0x54, 0x54,
1688 0x54, 0x54, 0x54, 0x54, 0x54, 0x54, 0x54, 0x54,
1689 0x54, 0x54, 0x54, 0x54, 0x54, 0x54, 0x54, 0x54,
1690 0x54, 0x54, 0x54, 0x54, 0x54, 0x54, 0x54, 0x54};
1692 __u8 first10c0[7][3] = {
1693 {0x0d, 0x00, 0x08},
1694 {0x0d, 0x00, 0x09},
1695 {0x0d, 0x00, 0x08},
1696 {0xf0, 0x00, 0x01},
1697 {0x3a, 0x73, 0x00},
1698 {0x06, 0x30, 0x8c},
1699 {0xf0, 0x00, 0x00}
1702 __u8 second10c0a[2][5] = {
1703 {0x01, 0x00, 0x0e, 0x00, 0x14},
1704 {0x03, 0x03, 0xc4, 0x05, 0x14}
1707 __u8 second10c0b[3] =
1708 {0xc8, 0x00, 0x03};
1710 __u8 third10c0[4][3] = {
1711 {0x0a, 0x00, 0x01},
1712 {0x06, 0x00, 0x29},
1713 {0x05, 0x00, 0x72},
1714 {0x20, 0x00, 0x00}
1717 __u8 fourth10c0a[3][3] = {
1718 {0x20, 0x00, 0x00},
1719 {0x09, 0x01, 0x90},
1720 {0x0d, 0x80, 0x08}
1723 __u8 fourth10c0b[2][5] = {
1724 {0x2b, 0x01, 0x88, 0x01, 0x88},
1725 {0x2d, 0x01, 0x88, 0x01, 0x88}
1728 __u8 fifth10c0[4][3] = {
1729 {0x0a, 0x00, 0x01},
1730 {0x06, 0x00, 0x29},
1731 {0x05, 0x00, 0x72}
1734 /* interrupt down */
1736 buf[0] = 0x00;
1737 usb_microdia_control_write(dev, 0x1066, buf, 1); /* URB 1 */
1739 /* interrupt up */
1740 /* interrupt down */
1742 buf[0] = 0x60;
1743 usb_microdia_control_write(dev, 0x1007, buf, 1);
1745 buf[0] = 0x00;
1746 usb_microdia_control_write(dev, 0x1006, buf, 1);
1748 buf[0] = 0x78;
1749 usb_microdia_control_write(dev, 0x1000, buf, 1);
1751 buf[0] = 0xc7;
1752 usb_microdia_control_write(dev, 0x1001, buf, 1);
1754 buf[0] = 0x1c;
1755 usb_microdia_control_write(dev, 0x1002, buf, 1);
1757 buf[0] = 0x01;
1758 usb_microdia_control_write(dev, 0x1061, buf, 1);
1760 buf[0] = 0x80;
1761 usb_microdia_control_write(dev, 0x1020, buf, 1);
1763 buf[0] = 0x40; buf[1] = 0x30; buf[2] = 0x20;
1764 buf[3] = 0x10; buf[4] = 0x08;
1765 usb_microdia_control_write(dev, 0x1067, buf, 5);
1767 buf[0] = 0xb0; buf[1] = dev->sensor_slave_address; buf[2] = 0x0d;
1768 buf[3] = 0x00; buf[4] = 0x00; buf[5] = 0x00;
1769 buf[6] = 0x00; buf[7] = 0x10; buf[8] = 0x03;
1770 usb_microdia_control_write(dev, 0x10c0, buf, 9);
1772 usb_microdia_control_write(dev, 0x10e0, urb10, 24); /* URB 10 */
1774 buf[0] = 0x00; buf[1] = 0x00; buf[3] = 0x00;
1775 usb_microdia_control_write(dev, 0x10f8, buf, 3);
1777 buf[0] = 0x00; buf[1] = 0x40; buf[2] = 0x00;
1778 buf[3] = 0xe0; buf[4] = 0x03;
1779 usb_microdia_control_write(dev, 0x10fb, buf, 5);
1781 usb_microdia_control_write(dev, 0x1180, urb13, 11);
1783 usb_microdia_control_write(dev, 0x118b, urb14, 22);
1785 buf[0] = 0x00; buf[1] = 0x00;
1786 usb_microdia_control_write(dev, 0x11a1, buf, 2);
1788 buf[0] = 0x60; buf[1] = 0x20; buf[2] = 0x00;
1789 buf[3] = 0x08; buf[4] = 0x00; buf[5] = 0x00;
1790 buf[6] = 0x00; buf[7] = 0x00; buf[8] = 0x00;
1791 usb_microdia_control_write(dev, 0x11b7, buf, 9);
1793 buf[0] = 0x30;
1794 usb_microdia_control_write(dev, 0x11b8, buf, 1);
1796 buf[0] = 0x78;
1797 usb_microdia_control_write(dev, 0x1000, buf, 1);
1799 for (i = 0; i < 7; i++)
1800 sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 2,
1801 first10c0[i][0], dev->sensor_flags, &first10c0[i][1]); /* URB 9-48 */
1803 buf[0] = 0x60;
1804 usb_microdia_control_write(dev, 0x1007, buf, 1);
1806 buf[0] = 0x00;
1807 usb_microdia_control_write(dev, 0x1006, buf, 1);
1809 buf[0] = 0x03;
1810 usb_microdia_control_write(dev, 0x10e0, buf, 1); /* URB 50 */
1812 buf[0] = 0x03;
1813 usb_microdia_control_write(dev, 0x10e0, buf, 1);
1815 buf[0] = 0xc6;
1816 usb_microdia_control_write(dev, 0x1001, buf, 1);
1818 buf[0] = 0xc4;
1819 usb_microdia_control_write(dev, 0x1001, buf, 1);
1821 buf[0] = 0x44;
1822 usb_microdia_control_write(dev, 0x1001, buf, 1);
1824 buf[0] = 0x80;
1825 usb_microdia_control_write(dev, 0x1189, buf, 1);
1827 buf[0] = 0x00;
1828 usb_microdia_control_write(dev, 0x11bc, buf, 1);
1830 buf[0] = 0x00;
1831 usb_microdia_control_write(dev, 0x11bd, buf, 1);
1833 buf[0] = 0x00;
1834 usb_microdia_control_write(dev, 0x11be, buf, 1);
1836 buf[0] = 0x00;
1837 usb_microdia_control_write(dev, 0x11bf, buf, 1);
1839 sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4,
1840 second10c0a[0][0], dev->sensor_flags, &second10c0a[0][1]);
1842 sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4,
1843 second10c0a[1][0], dev->sensor_flags, &second10c0a[1][1]);
1845 sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 0,
1846 0x09, dev->sensor_flags, NULL);
1848 sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 2,
1849 second10c0b[0], dev->sensor_flags, &second10c0b[1]);
1851 buf[0] = 0x06; buf[1] = 0x00; buf[2] = 0x02;
1852 buf[3] = 0x00; buf[4] = 0x28; buf[5] = 0x3c;
1853 usb_microdia_control_write(dev, 0x1180, buf, 6);
1855 buf[0] = 0x00; buf[1] = 0xa0; buf[2] = 0x00;
1856 buf[3] = 0xf0; buf[4] = 0x00;
1857 usb_microdia_control_write(dev, 0x10fb, buf, 5); /* URB 70 */
1859 buf[0] = 0x8c;
1860 usb_microdia_control_write(dev, 0x1189, buf, 1);
1862 buf[0] = 0x00; buf[1] = 0x00; buf[2] = 0x6a; buf[3] = 0x50;
1863 usb_microdia_control_write(dev, 0x11a1, buf, 4);
1865 buf[0] = 0x00; buf[1] = 0x00; buf[2] = 0x50; buf[3] = 0x3c;
1866 usb_microdia_control_write(dev, 0x11ab, buf, 4);
1868 buf[0] = 0x78;
1869 usb_microdia_control_write(dev, 0x1000, buf, 1);
1871 buf[0] = 0x18;
1872 usb_microdia_control_write(dev, 0x1002, buf, 1);
1874 buf[0] = 0x18;
1875 usb_microdia_control_write(dev, 0x1002, buf, 1);
1877 buf[0] = 0x38;
1878 usb_microdia_control_write(dev, 0x11b8, buf, 1);
1880 buf[0] = 0x02;
1881 usb_microdia_control_write(dev, 0x118a, buf, 1);
1883 buf[0] = 0x02;
1884 usb_microdia_control_write(dev, 0x0395, buf, 1);
1886 buf[0] = 0x78;
1887 usb_microdia_control_write(dev, 0x11b8, buf, 1); /* URB 80 */
1888 usb_microdia_control_read(dev, 0x11b8, buf, 1);
1890 buf[0] = 0xf9;
1891 usb_microdia_control_write(dev, 0x11b8, buf, 1);
1892 usb_microdia_control_read(dev, 0x11b8, buf, 1);
1894 buf[0] = 0xfa;
1895 usb_microdia_control_write(dev, 0x11b8, buf, 1);
1896 usb_microdia_control_read(dev, 0x11b8, buf, 1);
1898 buf[0] = 0x7b;
1899 usb_microdia_control_write(dev, 0x11b8, buf, 1);
1900 usb_microdia_control_read(dev, 0x11b8, buf, 1);
1902 buf[0] = 0x7c;
1903 usb_microdia_control_write(dev, 0x11b8, buf, 1);
1904 usb_microdia_control_read(dev, 0x11b8, buf, 1);
1906 buf[0] = 0x7b;
1907 usb_microdia_control_write(dev, 0x11b8, buf, 1); /* URB 90 */
1909 for (i = 0; i < 4; i++)
1910 sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 2,
1911 third10c0[i][0], dev->sensor_flags, &third10c0[i][1]); /* URB 97-106 */
1913 buf[0] = 0x06;
1914 usb_microdia_control_write(dev, 0x1180, buf, 1);
1916 for (i = 0; i < 3; i++)
1917 sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 2,
1918 fourth10c0a[i][0], dev->sensor_flags, &fourth10c0a[i][1]);
1920 for (i = 0; i < 2; i++)
1921 sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4,
1922 fourth10c0b[i][0], dev->sensor_flags, &fourth10c0b[i][1]);
1924 sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 0,
1925 0x33, dev->sensor_flags, NULL);
1927 sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 2,
1928 first10c0[0][0], dev->sensor_flags, &first10c0[0][1]);
1930 buf[0] = 0x0a;
1931 usb_microdia_control_write(dev, 0x11ba, buf, 1);
1933 buf[0] = 0x10;
1934 usb_microdia_control_write(dev, 0x118b, buf, 1);
1936 buf[0] = 0x05;
1937 usb_microdia_control_write(dev, 0x10f7, buf, 1);
1939 buf[0] = 0x14;
1940 usb_microdia_control_write(dev, 0x10f8, buf, 1);
1942 buf[0] = 0xff;
1943 usb_microdia_control_write(dev, 0x10fa, buf, 1);
1945 buf[0] = 0x00;
1946 usb_microdia_control_write(dev, 0x10f9, buf, 1);
1948 buf[0] = 0x00;
1949 usb_microdia_control_write(dev, 0x10f9, buf, 1);
1951 buf[0] = 0x0a;
1952 usb_microdia_control_write(dev, 0x11ba, buf, 1);
1954 buf[0] = 0x00; buf[1] = 0x00; buf[2] = 0x00; buf[3] = 0x00;
1955 usb_microdia_control_write(dev, 0x11bc, buf, 4);
1957 /* Set whole array buf to 0x00 */
1958 memset(buf, 0x00, 48);
1959 usb_microdia_control_write(dev, 0x11c0, buf, 48);
1961 buf[0] = 0x2d; buf[1] = 0x2d; buf[2] = 0x3a;
1962 buf[3] = 0x05; buf[4] = 0x04; buf[5] = 0x3f;
1963 usb_microdia_control_write(dev, 0x11a5, buf, 6);
1965 buf[0] = 0x14; buf[1] = 0xec; buf[2] = 0x0a; buf[3] = 0xf6;
1966 usb_microdia_control_write(dev, 0x11af, buf, 4);
1968 buf[0] = 0x32; buf[1] = 0xdd; buf[2] = 0x2d; buf[3] = 0xdd;
1969 usb_microdia_control_write(dev, 0x11b3, buf, 4);
1971 buf[0] = 0x07;
1972 usb_microdia_control_write(dev, 0x10e0, buf, 1);
1974 buf[0] = 0x01;
1975 usb_microdia_control_write(dev, 0x1061, buf, 1);
1977 buf[0] = 0x27;
1978 usb_microdia_control_write(dev, 0x10e0, buf, 1);
1980 usb_microdia_control_write(dev, 0x1100, qtable1, 64);
1982 usb_microdia_control_write(dev, 0x1140, qtable2, 64); /* URB 150 */
1984 buf[0] = 0x07;
1985 usb_microdia_control_write(dev, 0x10e0, buf, 1);
1987 buf[0] = 0x03;
1988 usb_microdia_control_write(dev, 0x1061, buf, 1);
1990 buf[0] = 0x0b;
1991 usb_microdia_control_write(dev, 0x10e0, buf, 1);
1993 buf[0] = 0x8c;
1994 usb_microdia_control_write(dev, 0x1189, buf, 1);
1996 buf[0] = 0x00;
1997 usb_microdia_control_write(dev, 0x11bc, buf, 1);
1999 buf[0] = 0x00;
2000 usb_microdia_control_write(dev, 0x11bd, buf, 1);
2002 buf[0] = 0x00;
2003 usb_microdia_control_write(dev, 0x11be, buf, 1);
2005 buf[0] = 0x00;
2006 usb_microdia_control_write(dev, 0x11bf, buf, 1);
2008 sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4,
2009 second10c0a[0][0], dev->sensor_flags, &second10c0a[0][1]);
2011 sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4,
2012 second10c0a[1][0], dev->sensor_flags, &second10c0a[1][1]);
2014 sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 0,
2015 0x09, dev->sensor_flags, NULL);
2017 sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 2,
2018 second10c0b[0], dev->sensor_flags, &second10c0b[1]);
2020 buf[0] = 0x06; buf[1] = 0x00; buf[2] = 0x02;
2021 buf[3] = 0x00; buf[4] = 0x28; buf[5] = 0x3c;
2022 usb_microdia_control_write(dev, 0x1180, buf, 6);
2024 buf[0] = 0x00; buf[1] = 0xa0; buf[2] = 0x00;
2025 buf[3] = 0xf0; buf[4] = 0x00;
2026 usb_microdia_control_write(dev, 0x10fb, buf, 5);
2028 buf[0] = 0x8c;
2029 usb_microdia_control_write(dev, 0x1189, buf, 1);
2031 buf[0] = 0x00; buf[1] = 0x00; buf[2] = 0x6a; buf[3] = 0x50;
2032 usb_microdia_control_write(dev, 0x11a1, buf, 4); /* URB 170 */
2034 buf[0] = 0x00; buf[1] = 0x00; buf[2] = 0x50; buf[3] = 0x3c;
2035 usb_microdia_control_write(dev, 0x11ab, buf, 4);
2037 buf[0] = 0x03;
2038 usb_microdia_control_write(dev, 0x1061, buf, 1);
2040 buf[0] = 0x0a;
2041 usb_microdia_control_write(dev, 0x11ba, buf, 1);
2043 buf[0] = 0x00;
2044 usb_microdia_control_write(dev, 0x11b9, buf, 1);
2046 buf[0] = 0x0b;
2047 usb_microdia_control_write(dev, 0x11ba, buf, 1);
2049 buf[0] = 0x01;
2050 usb_microdia_control_write(dev, 0x1061, buf, 1);
2052 buf[0] = 0x78;
2053 usb_microdia_control_write(dev, 0x1000, buf, 1);
2055 buf[0] = 0x18;
2056 usb_microdia_control_write(dev, 0x1002, buf, 1);
2058 buf[0] = 0x18;
2059 usb_microdia_control_write(dev, 0x1002, buf, 1);
2061 buf[0] = 0x7b;
2062 usb_microdia_control_write(dev, 0x11b8, buf, 1); /* URB 180 */
2064 buf[0] = 0x02;
2065 usb_microdia_control_write(dev, 0x118a, buf, 1);
2067 buf[0] = 0x02;
2068 usb_microdia_control_write(dev, 0x0395, buf, 1);
2070 buf[0] = 0x78;
2071 usb_microdia_control_write(dev, 0x11b8, buf, 1);
2072 usb_microdia_control_read(dev, 0x11b8, buf, 1);
2074 buf[0] = 0xf9;
2075 usb_microdia_control_write(dev, 0x11b8, buf, 1);
2076 usb_microdia_control_read(dev, 0x11b8, buf, 1);
2078 buf[0] = 0xfa;
2079 usb_microdia_control_write(dev, 0x11b8, buf, 1);
2080 usb_microdia_control_read(dev, 0x11b8, buf, 1);
2082 buf[0] = 0x7b;
2083 usb_microdia_control_write(dev, 0x11b8, buf, 1);
2084 usb_microdia_control_read(dev, 0x11b8, buf, 1); /* URB 190 */
2086 buf[0] = 0x7c;
2087 usb_microdia_control_write(dev, 0x11b8, buf, 1);
2088 usb_microdia_control_read(dev, 0x11b8, buf, 1);
2090 buf[0] = 0x7b;
2091 usb_microdia_control_write(dev, 0x11b8, buf, 1);
2093 for (i = 0; i < 3; i++)
2094 sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 2,
2095 fifth10c0[i][0], dev->sensor_flags, &fifth10c0[i][1]); /* URB 200-205 */
2097 sn9c20x_read_i2c_data(dev, dev->sensor_slave_address, 2,
2098 0x00, dev->sensor_flags, buf);
2099 /* __u8 result[2] = {buf[3], buf[4]}; */
2101 buf[0] = 0x03;
2102 usb_microdia_control_write(dev, 0x1061, buf, 1);
2104 return 0;
2109 * @brief From startstream.log
2111 * @param dev
2113 * @returns 0
2115 * @author GWater
2117 * For SN9C201 with SOI968.
2118 * This is function triggers a working stream of image data and a glowing LED.
2120 int microdia_624e_start_stream(struct usb_microdia *dev)
2122 int ret, i;
2123 __u8 unknown1[9] = { dev->sensor_flags, dev->sensor_slave_address,
2124 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03 };
2126 __u16 reg;
2127 __u8 value;
2129 __u16 regs[][2] = {
2130 {0x1066, 0x00},
2131 {0x1000, 0x7c},
2132 {0x1001, 0x44},
2133 {0x1002, 0x1c},
2134 {0x1006, 0x80},
2135 {0x1007, 0xa0},
2136 {0x1061, 0x03},
2137 {0x1020, 0x80},
2138 {0x1067, 0x40},
2139 {0x1068, 0x30},
2140 {0x1069, 0x20},
2141 {0x106a, 0x10},
2142 {0x106b, 0x08},
2143 {0x10e0, 0x0b},
2144 {0x10f6, 0x60},
2145 {0x10f7, 0x07},
2146 {0x10f8, 0x14},
2147 {0x10f9, 0x00},
2148 {0x10fa, 0xff},
2149 {0x1188, 0x8a},
2150 {0x118b, 0x0a},
2151 {0x118c, 0x20},
2152 {0x118d, 0x20},
2153 {0x118e, 0x20},
2154 {0x118f, 0x20},
2155 {0x1190, 0x00},
2156 {0x1191, 0x24},
2157 {0x1192, 0x3b},
2158 {0x1193, 0x4f},
2159 {0x1194, 0x61},
2160 {0x1195, 0x71},
2161 {0x1196, 0x80},
2162 {0x1197, 0x8f},
2163 {0x1198, 0x9d},
2164 {0x1199, 0xab},
2165 {0x119a, 0xb8},
2166 {0x119b, 0xc4},
2167 {0x119c, 0xd1},
2168 {0x119d, 0xdd},
2169 {0x119e, 0xe9},
2170 {0x119f, 0xf4},
2171 {0x11a0, 0xff},
2172 {0x11a1, 0x00},
2173 {0x11a2, 0x00},
2174 {0x11b7, 0x60},
2175 {0x11b8, 0x7a},
2176 {0x11b9, 0x00},
2177 {0x11ba, 0x0f},
2178 {0x11bb, 0x00},
2179 {0x11bc, 0x00},
2180 {0x11bd, 0x00},
2181 {0x11be, 0x00},
2182 {0x11bf, 0x00},
2183 {0x1180, 0x3c},
2184 {0x1181, 0x00},
2185 {0x1182, 0x0b},
2186 {0x1183, 0x00},
2187 {0x1184, 0x28},
2188 {0x1185, 0x3c},
2189 {0x11a1, 0x00},
2190 {0x11a2, 0x00},
2191 {0x11a3, 0x6a},
2192 {0x11a4, 0x50},
2193 {0x11ab, 0x00},
2194 {0x11ac, 0x00},
2195 {0x11ad, 0x50},
2196 {0x11ae, 0x3c},
2197 {0x118a, 0x05},
2198 {0x0395, 0x05},
2199 {0x11a5, 0x2d},
2200 {0x11a6, 0x2d},
2201 {0x11a7, 0x3a},
2202 {0x11a8, 0x05},
2203 {0x11a9, 0x04},
2204 {0x11aa, 0x3f},
2205 {0x11af, 0x28},
2206 {0x11b0, 0xd8},
2207 {0x11b1, 0x14},
2208 {0x11b2, 0xec},
2209 {0x11b3, 0x32},
2210 {0x11b4, 0xdd},
2211 {0x11b5, 0x2d},
2212 {0x11b6, 0xdd},
2215 __u8 reg_11c0[48];
2217 __u8 qtable1[64] = {
2218 0x0d, 0x08, 0x08, 0x0d, 0x08, 0x08, 0x0d, 0x0d,
2219 0x0d, 0x0d, 0x11, 0x0d, 0x0d, 0x11, 0x15, 0x21,
2220 0x15, 0x15, 0x11, 0x11, 0x15, 0x2a, 0x1d, 0x1d,
2221 0x19, 0x21, 0x32, 0x2a, 0x32, 0x32, 0x2e, 0x2a,
2222 0x2e, 0x2e, 0x36, 0x3a, 0x4b, 0x43, 0x36, 0x3a,
2223 0x47, 0x3a, 0x2e, 0x2e, 0x43, 0x5c, 0x43, 0x47,
2224 0x4f, 0x53, 0x58, 0x58, 0x58, 0x32, 0x3f, 0x60,
2225 0x64, 0x5c, 0x53, 0x64, 0x4b, 0x53, 0x58, 0x53
2228 __u8 qtable2[64] = {
2229 0x0d, 0x11, 0x11, 0x15, 0x11, 0x15, 0x26, 0x15,
2230 0x15, 0x26, 0x53, 0x36, 0x2e, 0x36, 0x53, 0x53,
2231 0x53, 0x53, 0x53, 0x53, 0x53, 0x53, 0x53, 0x53,
2232 0x53, 0x53, 0x53, 0x53, 0x53, 0x53, 0x53, 0x53,
2233 0x53, 0x53, 0x53, 0x53, 0x53, 0x53, 0x53, 0x53,
2234 0x53, 0x53, 0x53, 0x53, 0x53, 0x53, 0x53, 0x53,
2235 0x53, 0x53, 0x53, 0x53, 0x53, 0x53, 0x53, 0x53,
2236 0x53, 0x53, 0x53, 0x53, 0x53, 0x53, 0x53, 0x53
2240 for (i = 0; i < ARRAY_SIZE(regs); i++) {
2241 reg = regs[i][0];
2242 value = regs[i][1];
2243 ret = usb_microdia_control_write(dev, reg, &value, 1);
2244 if (ret < 0) {
2245 UDIA_INFO("Bridge Init Error (%d). line %d\n", ret, i);
2246 goto err;
2250 memset(reg_11c0, 0x00, 48);
2251 ret = usb_microdia_control_write(dev, 0x11c0, reg_11c0, 48);
2252 if (ret < 0)
2253 goto err;
2255 ret = usb_microdia_control_write(dev, 0x1100, qtable1, 64);
2256 if (ret < 0)
2257 goto err;
2259 ret = usb_microdia_control_write(dev, 0x1140, qtable2, 64);
2260 if (ret < 0)
2261 goto err;
2263 /* this is the same register as the I2C write, not sure why
2264 * we're writing 9 bytes -- the SN9C102 docs say all writes
2265 * must be 8 bytes, but we don't have docs for SN9C20x */
2266 ret = usb_microdia_control_write(dev, 0x10c0, unknown1, 9);
2267 if (ret < 0)
2268 goto err;
2270 if (dev->sensor_init)
2271 dev->sensor_init(dev);
2273 return 0;
2275 err:
2276 UDIA_ERROR("start stream: failed (%d)!\n", ret);
2277 return ret;
2280 int microdia_624f_start_stream(struct usb_microdia *dev)
2282 int ret, i;
2283 __u8 unknown1[9] = { dev->sensor_flags, dev->sensor_slave_address,
2284 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03 };
2286 __u16 reg;
2287 __u8 value;
2289 __u16 regs[][2] = {
2290 {0x1007, 0x20},
2291 {0x1006, 0x00},
2292 {0x1000, 0x78},
2293 {0x1001, 0x44},
2294 {0x1002, 0x1c},
2295 {0x1061, 0x01},
2296 {0x1020, 0x80},
2297 {0x1067, 0x40},
2298 {0x1068, 0x30},
2299 {0x1069, 0x20},
2300 {0x1070, 0x10},
2301 {0x1071, 0x08},
2302 {0x1188, 0x87},
2303 {0x11a1, 0x00},
2304 {0x11a2, 0x00},
2305 {0x11a3, 0x6a},
2306 {0x11a4, 0x50},
2307 {0x11ab, 0x00},
2308 {0x11ac, 0x00},
2309 {0x11ad, 0x50},
2310 {0x11ae, 0x3c},
2311 {0x118a, 0x04},
2312 {0x0395, 0x04},
2313 {0x11b8, 0x3a},
2314 {0x118b, 0x0e},
2315 {0x10f7, 0x05},
2316 {0x10f8, 0x14},
2317 {0x10fa, 0xff},
2318 {0x10f9, 0x00},
2319 {0x11ba, 0x0e},
2320 {0x11a5, 0x2d},
2321 {0x11a6, 0x2d},
2322 {0x11a7, 0x3a},
2323 {0x11a8, 0x05},
2324 {0x11a9, 0x04},
2325 {0x11aa, 0x3f},
2326 {0x11af, 0x28},
2327 {0x11b0, 0xd8},
2328 {0x11b1, 0x14},
2329 {0x11b2, 0xec},
2330 {0x11b3, 0x32},
2331 {0x11b4, 0xdd},
2332 {0x11b5, 0x32},
2333 {0x11b6, 0xdd},
2334 {0x10e0, 0x0b},
2335 {0x11bc, 0x40},
2336 {0x11bd, 0x01},
2337 {0x11be, 0xf0},
2338 {0x11bf, 0x00},
2339 {0x1180, 0x02},
2340 {0x1181, 0x00},
2341 {0x1182, 0x07},
2342 {0x1183, 0x00},
2343 {0x1184, 0x28},
2344 {0x1185, 0x3c},
2345 {0x1061, 0x03},
2348 __u8 reg_11c0[48] = {
2349 0x10, 0x21, 0x34, 0x40, 0x47, 0x4f, 0x57, 0x5f,
2350 0x64, 0x68, 0x6d, 0x73, 0x79, 0x80, 0x89, 0x97,
2351 0x0d, 0x1c, 0x2a, 0x33, 0x38, 0x3d, 0x44, 0x4a,
2352 0x4e, 0x52, 0x56, 0x5b, 0x61, 0x68, 0x6f, 0x7a,
2353 0x0d, 0x1a, 0x2a, 0x31, 0x36, 0x3b, 0x41, 0x47,
2354 0x4a, 0x4e, 0x53, 0x58, 0x5d, 0x64, 0x6b, 0x76
2357 __u8 qtable1[64] = {
2358 0x0d, 0x08, 0x08, 0x0d, 0x08, 0x08, 0x0d, 0x0d,
2359 0x0d, 0x0d, 0x11, 0x0d, 0x0d, 0x11, 0x15, 0x21,
2360 0x15, 0x15, 0x11, 0x11, 0x15, 0x2a, 0x1d, 0x1d,
2361 0x19, 0x21, 0x32, 0x2a, 0x32, 0x32, 0x2e, 0x2a,
2362 0x2e, 0x2e, 0x36, 0x3a, 0x4b, 0x43, 0x36, 0x3a,
2363 0x47, 0x3a, 0x2e, 0x2e, 0x43, 0x5c, 0x43, 0x47,
2364 0x4f, 0x54, 0x58, 0x58, 0x58, 0x32, 0x3f, 0x60,
2365 0x64, 0x5c, 0x54, 0x64, 0x4b, 0x54, 0x58, 0x54
2368 __u8 qtable2[64] = {
2369 0x0d, 0x11, 0x11, 0x15, 0x11, 0x15, 0x26, 0x15,
2370 0x15, 0x26, 0x54, 0x36, 0x2e, 0x36, 0x54, 0x54,
2371 0x54, 0x54, 0x54, 0x54, 0x54, 0x54, 0x54, 0x54,
2372 0x54, 0x54, 0x54, 0x54, 0x54, 0x54, 0x54, 0x54,
2373 0x54, 0x54, 0x54, 0x54, 0x54, 0x54, 0x54, 0x54,
2374 0x54, 0x54, 0x54, 0x54, 0x54, 0x54, 0x54, 0x54,
2375 0x54, 0x54, 0x54, 0x54, 0x54, 0x54, 0x54, 0x54,
2376 0x54, 0x54, 0x54, 0x54, 0x54, 0x54, 0x54, 0x54
2379 for (i = 0; i < ARRAY_SIZE(regs); i++) {
2380 reg = regs[i][0];
2381 value = regs[i][1];
2382 ret = usb_microdia_control_write(dev, reg, &value, 1);
2383 if (ret < 0) {
2384 UDIA_INFO("Bridge Init Error (%d). line %d\n", ret, i);
2385 goto err;
2389 ret = usb_microdia_control_write(dev, 0x11c0, reg_11c0, 48);
2390 if (ret < 0)
2391 goto err;
2393 ret = usb_microdia_control_write(dev, 0x1100, qtable1, 64);
2394 if (ret < 0)
2395 goto err;
2397 ret = usb_microdia_control_write(dev, 0x1140, qtable2, 64);
2398 if (ret < 0)
2399 goto err;
2401 /* this is the same register as the I2C write, not sure why
2402 * we're writing 9 bytes -- the SN9C102 docs say all writes
2403 * must be 8 bytes, but we don't have docs for SN9C20x */
2404 ret = usb_microdia_control_write(dev, 0x10c0, unknown1, 9);
2405 if (ret < 0)
2406 goto err;
2408 if (dev->sensor_init)
2409 dev->sensor_init(dev);
2411 return 0;
2413 err:
2414 UDIA_ERROR("start stream: failed (%d)!\n", ret);
2415 return ret;
2419 * @brief Start stream from 6260 devices
2421 * @param dev
2423 * @returns 0 or negative error code
2426 int microdia_6260_start_stream(struct usb_microdia *dev)
2428 int ret;
2429 __u8 buf[32];
2431 ret = usb_microdia_control_read(dev, 0x1045, buf, 1);
2432 buf[0] = 0x1f;
2433 ret = usb_microdia_control_write(dev, 0x1045, buf, 1);
2434 buf[0] = 0x00;
2435 ret = usb_microdia_control_write(dev, 0x1066, buf, 1);
2436 buf[0] = 0x20;
2437 ret = usb_microdia_control_write(dev, 0x1007, buf, 1);
2438 buf[0] = 0x00;
2439 ret = usb_microdia_control_write(dev, 0x1006, buf, 1);
2440 buf[0] = 0x78;
2441 ret = usb_microdia_control_write(dev, 0x1000, buf, 1);
2442 buf[0] = 0xc7;
2443 ret = usb_microdia_control_write(dev, 0x1001, buf, 1);
2444 buf[0] = 0x18;
2445 ret = usb_microdia_control_write(dev, 0x1002, buf, 1);
2446 buf[0] = 0x01;
2447 ret = usb_microdia_control_write(dev, 0x1061, buf, 1);
2448 buf[0] = 0x80;
2449 ret = usb_microdia_control_write(dev, 0x1020, buf, 1);
2451 buf[0] = 0x40; buf[1] = 0x30; buf[2] = 0x20; buf[3] = 0x10;
2452 buf[4] = 0x08;
2453 ret = usb_microdia_control_write(dev, 0x1067, buf, 5);
2455 buf[0] = 0x80; buf[1] = 0x21; buf[2] = 0x00; buf[3] = 0x00;
2456 buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x00;
2457 buf[8] = 0x03;
2458 ret = usb_microdia_control_write(dev, 0x10c0, buf, 9);
2460 buf[0] = 0x45; buf[1] = 0x18; buf[2] = 0x00; buf[3] = 0x30;
2461 buf[4] = 0x00; buf[5] = 0x09; buf[6] = 0x00; buf[7] = 0xed;
2462 buf[8] = 0x0f; buf[9] = 0xda; buf[10] = 0x0f; buf[11] = 0x3a;
2463 buf[12] = 0x00; buf[13] = 0x3a; buf[14] = 0x00; buf[15] = 0xd0;
2464 buf[16] = 0x0f; buf[17] = 0xf7; buf[18] = 0x0f; buf[19] = 0x00;
2465 buf[20] = 0x00; buf[21] = 0x00; buf[22] = 0x60; buf[23] = 0x0a;
2466 ret = usb_microdia_control_write(dev, 0x10e0, buf, 24);
2468 buf[0] = 0x00; buf[1] = 0x00; buf[2] = 0x00;
2469 ret = usb_microdia_control_write(dev, 0x10f8, buf, 3);
2471 buf[0] = 0x00; buf[1] = 0xa0; buf[2] = 0x00; buf[3] = 0xf0;
2472 buf[4] = 0x00;
2473 ret = usb_microdia_control_write(dev, 0x10fb, buf, 5);
2475 buf[0] = 0x8a; buf[1] = 0x8c; buf[2] = 0x08;
2476 ret = usb_microdia_control_write(dev, 0x1188, buf, 3);
2478 buf[0] = 0x00; buf[1] = 0x20; buf[2] = 0x20; buf[3] = 0x20;
2479 buf[4] = 0x20; buf[5] = 0x00; buf[6] = 0x24; buf[7] = 0x3b;
2480 buf[8] = 0x4f; buf[9] = 0x61; buf[10] = 0x71; buf[11] = 0x80;
2481 buf[12] = 0x8f; buf[13] = 0x9d; buf[14] = 0xab; buf[15] = 0xb8;
2482 buf[16] = 0xc4; buf[17] = 0xd1; buf[18] = 0xdd; buf[19] = 0xe9;
2483 buf[20] = 0xf4; buf[21] = 0xff;
2484 ret = usb_microdia_control_write(dev, 0x118b, buf, 22);
2486 buf[0] = 0x00; buf[1] = 0x00;
2487 ret = usb_microdia_control_write(dev, 0x11a1, buf, 2);
2489 buf[0] = 0x60; buf[1] = 0x28; buf[2] = 0x00; buf[3] = 0x00;
2490 buf[4] = 0x00; buf[5] = 0x40; buf[6] = 0x01; buf[7] = 0xf0;
2491 buf[8] = 0x00;
2492 ret = usb_microdia_control_write(dev, 0x11b7, buf, 9);
2494 buf[0] = 0x78;
2495 ret = usb_microdia_control_write(dev, 0x1000, buf, 1);
2497 buf[0] = 0x38;
2498 ret = usb_microdia_control_write(dev, 0x11b8, buf, 1);
2500 ret = ov7670_initialise(dev);
2501 if (ret < 0)
2502 return ret;
2504 ret = sn9c20x_read_i2c_data(dev, dev->sensor_slave_address, 1, 0x3b, dev->sensor_flags, buf);
2505 ret = usb_microdia_control_read(dev, 0x10c1, buf, 1);
2506 buf[0] = 0x50;
2507 ret = usb_microdia_control_write(dev, 0x10c1, buf, 1);
2509 /* TRY TO READ FROM EEPROM: */
2510 ret = sn9c20x_read_i2c_data(dev, 0x50, 1, 0x00, dev->sensor_flags, buf);
2511 if (ret < 0)
2512 UDIA_INFO("No EEPROM found\n");
2513 else
2514 UDIA_INFO("Read from EEPROM successful\n");
2516 buf[0] = 0x21;
2517 ret = usb_microdia_control_write(dev, 0x10c1, buf, 1);
2518 buf[0] = 0x45;
2519 ret = usb_microdia_control_write(dev, 0x10e0, buf, 1);
2520 buf[0] = 0xc6;
2521 ret = usb_microdia_control_write(dev, 0x1001, buf, 1);
2522 buf[0] = 0xc4;
2523 ret = usb_microdia_control_write(dev, 0x1001, buf, 1);
2525 buf[0] = 0x00; buf[1] = 0x00; buf[2] = 0x01; buf[3] = 0x00;
2526 buf[4] = 0x50; buf[5] = 0x3c;
2527 ret = usb_microdia_control_write(dev, 0x1180, buf, 6);
2529 buf[0] = 0x00; buf[1] = 0x40; buf[2] = 0x00; buf[3] = 0xf0;
2530 buf[4] = 0x01;
2531 ret = usb_microdia_control_write(dev, 0x10fb, buf, 5);
2533 buf[0] = 0x80;
2534 ret = usb_microdia_control_write(dev, 0x1189, buf, 1);
2536 buf[0] = 0x00; buf[1] = 0x00; buf[2] = 0xd5; buf[3] = 0x50;
2537 ret = usb_microdia_control_write(dev, 0x11a1, buf, 4);
2539 buf[0] = 0x00; buf[1] = 0x00; buf[2] = 0xa0; buf[3] = 0x3c;
2540 ret = usb_microdia_control_write(dev, 0x11ab, buf, 4);
2541 buf[0] = 0x78;
2542 ret = usb_microdia_control_write(dev, 0x1000, buf, 1);
2543 buf[0] = 0x10;
2544 ret = usb_microdia_control_write(dev, 0x1002, buf, 1);
2545 buf[0] = 0x00;
2546 ret = usb_microdia_control_write(dev, 0x1002, buf, 1);
2547 buf[0] = 0x38;
2548 ret = usb_microdia_control_write(dev, 0x11b8, buf, 1);
2549 buf[0] = 0x04;
2550 ret = usb_microdia_control_write(dev, 0x118a, buf, 1);
2551 buf[0] = 0x04;
2552 ret = usb_microdia_control_write(dev, 0x0395, buf, 1);
2553 buf[0] = 0x78;
2554 ret = usb_microdia_control_write(dev, 0x11b8, buf, 1);
2555 ret = usb_microdia_control_read(dev, 0x11b8, buf, 1);
2556 buf[0] = 0xf9;
2557 ret = usb_microdia_control_write(dev, 0x11b8, buf, 1);
2558 ret = usb_microdia_control_read(dev, 0x11b8, buf, 1);
2559 buf[0] = 0xfa;
2560 ret = usb_microdia_control_write(dev, 0x11b8, buf, 1);
2561 ret = usb_microdia_control_read(dev, 0x11b8, buf, 1);
2562 buf[0] = 0x7b;
2563 ret = usb_microdia_control_write(dev, 0x11b8, buf, 1);
2564 ret = usb_microdia_control_read(dev, 0x11b8, buf, 1);
2565 buf[0] = 0x7c;
2566 ret = usb_microdia_control_write(dev, 0x11b8, buf, 1);
2567 ret = usb_microdia_control_read(dev, 0x11b8, buf, 1);
2568 buf[0] = 0x7d;
2569 ret = usb_microdia_control_write(dev, 0x11b8, buf, 1);
2570 ret = usb_microdia_control_read(dev, 0x11b8, buf, 1);
2571 buf[0] = 0x7b;
2572 ret = usb_microdia_control_write(dev, 0x11b8, buf, 1);
2574 /* OV7670 Intialise Part 2 */
2575 buf[0] = 0x00; buf[1] = 0x00; buf[2] = 0x01; buf[3] = 0x00;
2576 buf[4] = 0x50; buf[5] = 0x3c;
2577 ret = usb_microdia_control_write(dev, 0x1180, buf, 6);
2579 buf[0] = 0x00; buf[1] = 0x40; buf[2] = 0x00; buf[3] = 0xf0;
2580 buf[4] = 0x01;
2581 ret = usb_microdia_control_write(dev, 0x10fb, buf, 5);
2583 buf[0] = 0x80;
2584 ret = usb_microdia_control_write(dev, 0x1189, buf, 1);
2586 buf[0] = 0x00; buf[1] = 0x00; buf[2] = 0xd5; buf[3] = 0x50;
2587 ret = usb_microdia_control_write(dev, 0x11a1, buf, 4);
2589 buf[0] = 0x00; buf[1] = 0x00; buf[2] = 0xa0; buf[3] = 0x3c;
2590 ret = usb_microdia_control_write(dev, 0x11ab, buf, 4);
2592 buf[0] = 0x03;
2593 ret = usb_microdia_control_write(dev, 0x1061, buf, 1);
2594 buf[0] = 0x01;
2595 ret = usb_microdia_control_write(dev, 0x1061, buf, 1);
2596 buf[0] = 0x78;
2597 ret = usb_microdia_control_write(dev, 0x1000, buf, 1);
2598 buf[0] = 0x00;
2599 ret = usb_microdia_control_write(dev, 0x1002, buf, 1);
2600 buf[0] = 0x00;
2601 ret = usb_microdia_control_write(dev, 0x1002, buf, 1);
2602 buf[0] = 0x7b;
2603 ret = usb_microdia_control_write(dev, 0x11b8, buf, 1);
2604 buf[0] = 0x04;
2605 ret = usb_microdia_control_write(dev, 0x118a, buf, 1);
2606 buf[0] = 0x04;
2607 ret = usb_microdia_control_write(dev, 0x0395, buf, 1);
2608 buf[0] = 0x78;
2609 ret = usb_microdia_control_write(dev, 0x11b8, buf, 1);
2610 ret = usb_microdia_control_read(dev, 0x11b8, buf, 1);
2611 buf[0] = 0x79;
2612 ret = usb_microdia_control_write(dev, 0x11b8, buf, 1);
2613 ret = usb_microdia_control_read(dev, 0x11b8, buf, 1);
2614 buf[0] = 0x7a;
2615 ret = usb_microdia_control_write(dev, 0x11b8, buf, 1);
2616 ret = usb_microdia_control_read(dev, 0x11b8, buf, 1);
2617 buf[0] = 0x7b;
2618 ret = usb_microdia_control_write(dev, 0x11b8, buf, 1);
2619 ret = usb_microdia_control_read(dev, 0x11b8, buf, 1);
2620 buf[0] = 0x7c;
2621 ret = usb_microdia_control_write(dev, 0x11b8, buf, 1);
2622 ret = usb_microdia_control_read(dev, 0x11b8, buf, 1);
2623 buf[0] = 0x7d;
2624 ret = usb_microdia_control_write(dev, 0x11b8, buf, 1);
2625 ret = usb_microdia_control_read(dev, 0x11b8, buf, 1);
2626 buf[0] = 0xfa;
2627 ret = usb_microdia_control_write(dev, 0x11b8, buf, 1);
2629 /* OV7670 Initialisation Part 3 Goes Here */
2630 buf[0] = 0x03;
2631 ret = usb_microdia_control_write(dev, 0x1061, buf, 1);
2633 return ret;
2637 * @brief From 7 start-stop-logs (made by Alex Carlos, Boris Borisov, bohzan and Comer352l)
2639 * @param dev
2641 * @returns 0 (ok) or -1 (error)
2643 * @author Comer352l
2645 * Windows driver versions: 5.7.23.000
2646 * Windows versions: 2000 and XP
2647 * USB-Logger: SniffUSB 1.8 and 2.0, USBTrace 2.0, SnoopyPro
2648 * All logs were made using AMCAP with 640x480, RGB24
2650 int microdia_6270_start_stream(struct usb_microdia *dev)
2652 __u8 buf[64];
2653 __u8 last_11b8[1];
2654 int k;
2655 int retI2C;
2657 /* Check if sensor slave address is valid: */
2658 if ((dev->sensor_slave_address != MT9V111_I2C_SLAVE_ADDRESS) && (dev->sensor_slave_address != MT9V011_I2C_SLAVE_ADDRESS)) {
2659 UDIA_INFO("microdia_6270_start_stream(): Invalid sensor slave address !\n");
2660 return -1;
2663 /* <= INTERRUPT COMING BACK (URB 1953) */
2664 /* SWITCH TO ALTERNATE SETTINGS 8 (URB 1954) // NOT IN ALEX'S LOG */
2665 /* => INTERRUPT GOING DOWN (URB 1955) */
2667 buf[0] = 0x00;
2668 usb_microdia_control_write(dev, 0x1066, buf, 1); /* URB 1956 */
2670 /* <= INTERRUPT COMING BACK (URB 1955) */
2671 /* => INTERRUPT GOING DOWN (URB 1957) */
2673 buf[0] = 0x78;
2674 usb_microdia_control_write(dev, 0x1000, buf, 1); /* URB 1958 */
2675 buf[0] = 0xc7;
2676 usb_microdia_control_write(dev, 0x1001, buf, 1); /* URB 1959 */
2677 buf[0] = 0x18;
2678 usb_microdia_control_write(dev, 0x1002, buf, 1); /* URB 1960 */
2679 buf[0] = 0x01;
2680 usb_microdia_control_write(dev, 0x1061, buf, 1); /* URB 1961 */
2681 buf[0] = 0x80;
2682 usb_microdia_control_write(dev, 0x1020, buf, 1); /* URB 1962 */
2683 buf[0] = 0x40; buf[1] = 0x30; buf[2] = 0x20; buf[3] = 0x10; buf[4] = 0x08;
2684 usb_microdia_control_write(dev, 0x1067, buf, 5); /* URB 1963 */
2686 /* +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ */
2687 /* STRANGE I2C MESSAGE: */
2688 /* - 9 bytes */
2689 /* - byte 8 = 0x00 at first start + first cycle */
2690 /* - procedure not complete: no wait/check for ack/error, no readout of 0x10c2 */
2691 /* - dummy writes at first cycle and read at second cycle, but there are many I2C messages in the meantime, so this should not work */
2692 /* */
2693 /* AT FIRST START + FIRST CYCLE: */
2694 buf[0] = 0x80; buf[1] = dev->sensor_slave_address; buf[2] = 0x00; buf[3] = 0x00;
2695 buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x00; buf[8] = 0x03;
2696 /* AT ALL FURTHER STARTS + FIRST CYCLE: */
2697 /* MT9V111: I2C MESSAGE => IFP Register 0x33: Auto exposure */
2698 /* buf[0] = 0x90; buf[1] = dev->sensor_slave_address; buf[2] = 0x33; buf[3] = 0x00; */
2699 /* buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10; buf[8] = 0x03; */
2700 /* MT9V011: ????????????????????????? */
2701 /* buf[0] = 0x90; buf[1] = dev->sensor_slave_address; buf[2] = 0x07; buf[3] = 0x00; */
2702 /* buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10; buf[8] = 0x03; */
2703 /* ALWAYS AT 2nd AND FURTHER CYCLES: */
2704 /* MT9V111: */
2705 /* buf[0] = 0xa2; buf[1] = 0x5c; buf[2] = 0x00; buf[3] = 0x36; */
2706 /* buf[4] = 0x00; buf[5] = 0x82; buf[6] = 0x3a; buf[7] = 0x10; buf[8] = 0x03; */
2707 /* => buf[3] to buf[6] simply contain bytes read with URB 2215 */
2708 /* MT9V011: */
2709 /* buf[0] = 0xb0; buf[1] = 0x5d; buf[2] = 0x07; buf[3] = 0x00; */
2710 /* buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10; buf[8] = 0x03; */
2711 usb_microdia_control_write(dev, 0x10c0, buf, 9); /* URB 1964 */
2712 /* ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ */
2714 buf[0] = 0x45; buf[1] = 0x18; buf[2] = 0x00; buf[3] = 0x30;
2715 buf[4] = 0x00; buf[5] = 0x09; buf[6] = 0x00; buf[7] = 0xed;
2716 buf[8] = 0x0f; buf[9] = 0xda; buf[10] = 0x0f; buf[11] = 0x3a;
2717 buf[12] = 0x00; buf[13] = 0x3a; buf[14] = 0x00; buf[15] = 0xd0;
2718 buf[16] = 0x0f; buf[17] = 0xf7; buf[18] = 0x0f; buf[19] = 0x00;
2719 buf[20] = 0x00; buf[21] = 0x00; buf[22] = 0x60; buf[23] = 0x0a;
2720 usb_microdia_control_write(dev, 0x10e0, buf, 24); /* URB 1965 */
2721 buf[0] = 0x00; buf[1] = 0x00; buf[2] = 0x00;
2722 usb_microdia_control_write(dev, 0x10f8, buf, 3); /* URB 1966 */
2723 buf[0] = 0x00; buf[1] = 0xa0; buf[2] = 0x00; buf[3] = 0xf0; buf[4] = 0x00;
2724 usb_microdia_control_write(dev, 0x10fb, buf, 5); /* URB 1967 */
2725 buf[0] = 0x06; buf[1] = 0x0c; buf[2] = 0x08;
2726 usb_microdia_control_write(dev, 0x1188, buf, 3); /* URB 1968 */
2727 buf[0] = 0x00; buf[1] = 0x20; buf[2] = 0x20; buf[3] = 0x20;
2728 buf[4] = 0x20; buf[5] = 0x00; buf[6] = 0x24; buf[7] = 0x3b;
2729 buf[8] = 0x4f; buf[9] = 0x61; buf[10] = 0x71; buf[11] = 0x80;
2730 buf[12] = 0x8f; buf[13] = 0x9d; buf[14] = 0xab; buf[15] = 0xb8;
2731 buf[16] = 0xc4; buf[17] = 0xd1; buf[18] = 0xdd; buf[19] = 0xe9;
2732 buf[20] = 0xf4; buf[21] = 0xff;
2733 usb_microdia_control_write(dev, 0x118b, buf, 22); /* URB 1969 */
2734 buf[0] = 0x00; buf[1] = 0x00;
2735 usb_microdia_control_write(dev, 0x11a1, buf, 2); /* URB 1970 */
2736 buf[0] = 0x60; buf[1] = 0x28; buf[2] = 0x00; buf[3] = 0x08;
2737 buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x00;
2738 buf[8] = 0x00;
2739 usb_microdia_control_write(dev, 0x11b7, buf, 9); /* URB 1971 */
2740 buf[0] = 0x38;
2741 usb_microdia_control_write(dev, 0x11b8, buf, 1); /* URB 1972 */
2742 buf[0] = 0x78;
2743 usb_microdia_control_write(dev, 0x1000, buf, 1); /* URB 1973 */
2745 /* +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ */
2746 /* I2C MESSAGES */
2747 retI2C = 0;
2748 if (dev->sensor_slave_address == MT9V111_I2C_SLAVE_ADDRESS) {
2749 /* Write to IFP register 0x0d: Color Correction Register 8 */
2750 buf[0] = 0x00; buf[1] = 0x01;
2751 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 2, 0x0d, dev->sensor_flags, buf); /* URBs 1974-1976 */
2752 /* Write to IFP register 0x0d: Color Correction Register 8 */
2753 buf[0] = 0x00; buf[1] = 0x00; /* ??? */
2754 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 2, 0x0d, dev->sensor_flags, buf); /* URBs 1977-1979 */
2755 /* Writes to IFP registers 0x01: Register Address Space Selection */
2756 /* 0x02: Color Correction Register 1 */
2757 buf[0] = 0x00; buf[1] = 0x01; /* select IFP address space */
2758 buf[2] = 0x00; buf[3] = 0x16; /* ??? // AT FIRST START + FIRST CYCLE: 0x00 0x00 */
2759 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, 0x01, dev->sensor_flags, buf); /* URBs 1980-1982 */
2760 /* Writes to IFP registers 0x03: Color Correction Register 3 */
2761 /* 0x04: Color Correction Register 4 */
2762 buf[0] = 0x01; buf[1] = 0xe1; /* ??? // AT FIRST START + FIRST CYCLE: 0x00 0x00 */
2763 buf[2] = 0x02; buf[3] = 0x81; /* ??? // AT FIRST START + FIRST CYCLE: 0x00 0x00 */
2764 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, 0x03, dev->sensor_flags, buf); /* URBs 1983-1985 */
2765 /* Writes to IFP registers 0x05: Aperture Correction (Sharpening) */
2766 /* 0x06: Operating Mode Control */
2767 buf[0] = 0x00; buf[1] = 0x04; /* 100% sharpening, no automatic sharpness reduction at low light // AT FIRST START + FIRST CYCLE: 0x00 0x00: no sharpening */
2768 buf[2] = 0x00; buf[3] = 0x00; /* stop AWB at the current values, no on-the-fly defect correction, no auto exposure, + RESREVED option */
2769 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, 0x05, dev->sensor_flags, buf); /* URBs 1986-1988 */
2770 /* Writes to IFP registers 0x07: Image Flow Processor Soft Reset */
2771 /* 0x08: Output Format Control */
2772 buf[0] = 0x30; buf[1] = 0x02; /* reset // AT FIRST START + FIRST CYCLE: 0x00 0x00 */
2773 buf[2] = 0x04; buf[3] = 0x80; /* bypass entire image processing, raw 8+2 Bayer data output directly */
2774 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, 0x07, dev->sensor_flags, buf); /* URBs 1989-1991 */
2775 /* "Dummy" write to IFP Register 0x11: Color Correction Register 12 */
2776 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 0, 0x11, dev->sensor_flags, NULL); /* URBs 1992-1993 */
2777 /* Write to register 0x01: Register address space selection */
2778 /* Write to sensor register 0x02: Column Start */
2779 buf[0] = 0x00; buf[1] = 0x04; /* select sensor address space */
2780 buf[2] = 0x00; buf[3] = 0x16; /* start with column 22 */
2781 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, 0x01, dev->sensor_flags, buf); /* URBs 1994-1996 */
2782 /* Writes to sensor registers 0x03: Window Height */
2783 /* 0x04: Window Width */
2784 buf[0] = 0x01; buf[1] = 0xe6; /* 486 */
2785 buf[2] = 0x02; buf[3] = 0x86; /* 646 */
2786 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, 0x03, dev->sensor_flags, buf); /* URBs 1997-1999 */
2787 /* Writes to sensor registers 0x05: Horizontal Blanking */
2788 /* 0x06: Vertical Blanking */
2789 buf[0] = 0x00; buf[1] = 0x04; /* 4 columns (pixel clocks) // AT FIRST START + FIRST CYCLE: 0x00 0x00 */
2790 buf[2] = 0x00; buf[3] = 0x00; /* 0 rows */
2791 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, 0x05, dev->sensor_flags, buf); /* URBs 2000-2002 */
2792 /* Writes to sensor registers 0x07: Output Control */
2793 /* 0x08: Row Start */
2794 buf[0] = 0x30; buf[1] = 0x02; /* normal operation + chip enable + RESERVED options */
2795 buf[2] = 0x00; buf[3] = 0x08; /* row 8 */
2796 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, 0x07, dev->sensor_flags, buf); /* URBs 2003-2005 */
2797 /* "Dummy" write to sensor Register 0x11: UNDOCUMENTED */
2798 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 0, 0x11, dev->sensor_flags, NULL); /* URBs 2006-2007 */
2799 /* Writes to sensor registers 0x0c: Shutter Delay */
2800 /* 0x0d: Reset (Soft) (from MT9V011 datasheet) */
2801 buf[0] = 0x00; buf[1] = 0x00; /* 0 master clocks */
2802 buf[2] = 0x00; buf[3] = 0x00; /* return to normal operation */
2803 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, 0x0c, dev->sensor_flags, buf); /* URBs 2008-2010 */
2804 /* Writes to sensor registers 0x0e: UNDOCUMENTED */
2805 /* 0x0f: UNDOCUMENTED */
2806 buf[0] = 0x00; buf[1] = 0x00;
2807 buf[2] = 0x00; buf[3] = 0x00;
2808 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, 0x0e, dev->sensor_flags, buf); /* URBs 2011-2013 */
2809 /* Writes to sensor registers 0x10: UNDOCUMENTED */
2810 /* 0x11: UNDOCUMENTED */
2811 buf[0] = 0x00; buf[1] = 0x00;
2812 buf[2] = 0x00; buf[3] = 0x00;
2813 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, 0x10, dev->sensor_flags, buf); /* URBs 2014-2016 */
2814 /* Writes to sensor registers 0x12: 2X Zoom Col Start => 0x1e bit 0 must be set to activate zoom */
2815 /* 0x13: 2X Zoom Row Start => 0x1e bit 0 must be set to activate zoom */
2816 buf[0] = 0x00; buf[1] = 0xb0; /* column 176 */
2817 buf[2] = 0x00; buf[3] = 0x7c; /* row 124 */
2818 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, 0x12, dev->sensor_flags, buf); /* URBs 2017-2018 */
2819 /* Writes to sensor registers 0x14: UNDOCUMENTED */
2820 /* 0x15: UNDOCUMENTED */
2821 buf[0] = 0x00; buf[1] = 0x00;
2822 buf[2] = 0x00; buf[3] = 0x00;
2823 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, 0x14, dev->sensor_flags, buf); /* URBs 2019-2021 */
2824 /* Writes to sensor registers 0x16: UNDOCUMENTED */
2825 /* 0x17: UNDOCUMENTED */
2826 buf[0] = 0x00; buf[1] = 0x00;
2827 buf[2] = 0x00; buf[3] = 0x00;
2828 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, 0x16, dev->sensor_flags, buf); /* URBs 2022-2024 */
2829 /* Writes to sensor registers 0x18: UNDOCUMENTED */
2830 /* 0x19: UNDOCUMENTED */
2831 buf[0] = 0x00; buf[1] = 0x00;
2832 buf[2] = 0x00; buf[3] = 0x00;
2833 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, 0x18, dev->sensor_flags, buf); /* URBs 2025-2027 */
2834 /* Writes to sensor registers 0x1a: UNDOCUMENTED */
2835 /* 0x1b: UNDOCUMENTED */
2836 buf[0] = 0x00; buf[1] = 0x00;
2837 buf[2] = 0x00; buf[3] = 0x00;
2838 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, 0x1a, dev->sensor_flags, buf); /* URBs 2028-2030 */
2839 /* Writes to sensor registers 0x1c: UNDOCUMENTED */
2840 /* 0x1d: UNDOCUMENTED */
2841 buf[0] = 0x00; buf[1] = 0x00;
2842 buf[2] = 0x00; buf[3] = 0x00;
2843 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, 0x1c, dev->sensor_flags, buf); /* URBs 2031-2033 */
2844 /* Write to sensor register 0x30: RESERVED */
2845 buf[0] = 0x00; buf[1] = 0x00;
2846 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 2, 0x30, dev->sensor_flags, buf); /* URBs 2034-2036 */
2847 /* Write to sensor register 0x20: Read Mode */
2848 buf[0] = 0x00; buf[1] = 0x00; /* normal readout */
2849 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 2, 0x20, dev->sensor_flags, buf); /* URBs 2037-2039 */
2850 /* Writes to sensor registers 0x30: RESERVED */
2851 /* 0x31: RESERVED */
2852 buf[0] = 0x00; buf[1] = 0x05;
2853 buf[2] = 0x00; buf[3] = 0x00;
2854 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, 0x30, dev->sensor_flags, buf); /* URBs 2040-2042 */
2855 /* "Dummy" write to sensor Register 0x34: RESERVED */
2856 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 0, 0x34, dev->sensor_flags, NULL); /* URBs 2043-2044 */
2857 } else if (dev->sensor_slave_address == MT9V011_I2C_SLAVE_ADDRESS) {
2858 /* Write to sensor register 0x07: Output Control */
2859 buf[0] = 0x00; buf[1] = 0x02; /* chip enable, normal operation */
2860 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 2, 0x07, dev->sensor_flags, buf);
2861 /* Write to sensor register 0x0d: Soft Reset */
2862 buf[0] = 0x00; buf[1] = 0x01; /* reset */
2863 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 2, 0x0d, dev->sensor_flags, buf);
2864 /* Write to sensor register 0x0d: Soft Reset */
2865 buf[0] = 0x00; buf[1] = 0x00; /* resume operation */
2866 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 2, 0x0d, dev->sensor_flags, buf);
2867 /* Writes to sensor registers 0x01: Row start */
2868 /* 0x02: Column Start */
2869 buf[0] = 0x00; buf[1] = 0x08; /* start with row 8 */
2870 buf[2] = 0x00; buf[3] = 0x16; /* start with column 22 */
2871 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, 0x01, dev->sensor_flags, buf);
2872 /* Writes to sensor registers 0x03: Window Height */
2873 /* 0x04: Window Width */
2874 buf[0] = 0x01; buf[1] = 0xe1; /* 481 */
2875 buf[2] = 0x02; buf[3] = 0x81; /* 641 */
2876 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, 0x03, dev->sensor_flags, buf);
2877 /* Writes to sensor registers 0x05: Horizontal Blanking */
2878 /* 0x06: Vertical Blanking */
2879 buf[0] = 0x00; buf[1] = 0x83; /* 131 columns (pixel clocks) */
2880 buf[2] = 0x00; buf[3] = 0x06; /* 6 rows */
2881 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, 0x05, dev->sensor_flags, buf);
2882 /* Write to sensor register 0x0d: Soft Reset */
2883 buf[0] = 0x00; buf[1] = 0x02; /* UNKNOWN */
2884 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 2, 0x0d, dev->sensor_flags, buf);
2885 /* Writes to sensor registers 0x0a: Pixel Clock Speed */
2886 /* 0x0b: Frame Restart */
2887 buf[0] = 0x00; buf[1] = 0x00; /* default */
2888 buf[2] = 0x00; buf[3] = 0x00; /* (has no effect/no restart) */
2889 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, 0x0a, dev->sensor_flags, buf);
2890 /* Writes to sensor registers 0x0c: Shutter Delay */
2891 /* 0x0d: Soft Reset */
2892 buf[0] = 0x00; buf[1] = 0x00; /* 0 master clocks */
2893 buf[2] = 0x00; buf[3] = 0x00; /* resume operation */
2894 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, 0x0c, dev->sensor_flags, buf);
2895 /* Writes to sensor registers 0x0e: UNDOCUMENTED */
2896 /* 0x0f: UNDOCUMENTED */
2897 buf[0] = 0x00; buf[1] = 0x00;
2898 buf[2] = 0x00; buf[3] = 0x00;
2899 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, 0x0e, dev->sensor_flags, buf);
2900 /* Writes to sensor registers 0x10: UNDOCUMENTED */
2901 /* 0x11: UNDOCUMENTED */
2902 buf[0] = 0x00; buf[1] = 0x00;
2903 buf[2] = 0x00; buf[3] = 0x00;
2904 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, 0x10, dev->sensor_flags, buf);
2905 /* Writes to sensor registers 0x12: 2X Zoom Column Start (from MT9V111 datasheet) */
2906 /* 0x13: 2X Zoom Row Start (from MT9V111 datasheet) */
2907 buf[0] = 0x00; buf[1] = 0x00; /* column 0 => bit0 of reg 0x1e must be set to activate zoom */
2908 buf[2] = 0x00; buf[3] = 0x00; /* row 0 => bit0 of reg 0x1e must be set to activate zoom */
2909 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, 0x12, dev->sensor_flags, buf);
2910 /* Writes to sensor registers 0x14: UNDOCUMENTED */
2911 /* 0x15: UNDOCUMENTED */
2912 buf[0] = 0x00; buf[1] = 0x00;
2913 buf[2] = 0x00; buf[3] = 0x00;
2914 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, 0x14, dev->sensor_flags, buf);
2915 /* Writes to sensor registers 0x16: UNDOCUMENTED */
2916 /* 0x17: UNDOCUMENTED */
2917 buf[0] = 0x00; buf[1] = 0x00;
2918 buf[2] = 0x00; buf[3] = 0x00;
2919 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, 0x16, dev->sensor_flags, buf);
2920 /* Writes to sensor registers 0x18: UNDOCUMENTED */
2921 /* 0x19: UNDOCUMENTED */
2922 buf[0] = 0x00; buf[1] = 0x00;
2923 buf[2] = 0x00; buf[3] = 0x00;
2924 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, 0x18, dev->sensor_flags, buf);
2925 /* Writes to sensor registers 0x1a: UNDOCUMENTED */
2926 /* 0x1b: UNDOCUMENTED */
2927 buf[0] = 0x00; buf[1] = 0x00;
2928 buf[2] = 0x00; buf[3] = 0x00;
2929 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, 0x1a, dev->sensor_flags, buf);
2930 /* Writes to sensor registers 0x1c: UNDOCUMENTED */
2931 /* 0x1d: UNDOCUMENTED */
2932 buf[0] = 0x00; buf[1] = 0x00;
2933 buf[2] = 0x00; buf[3] = 0x00;
2934 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, 0x1c, dev->sensor_flags, buf);
2935 /* Write to sensor register 0x32: RESERVED */
2936 buf[0] = 0x00; buf[1] = 0x00;
2937 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 2, 0x32, dev->sensor_flags, buf);
2938 /* Writes to sensor registers 0x20: Read Mode */
2939 /* 0x21: RESERVED */
2940 buf[0] = 0x11; buf[1] = 0x01; /* output all frames (including bad frames) + UNDOCUMENTED */
2941 buf[2] = 0x00; buf[3] = 0x00;
2942 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, 0x20, dev->sensor_flags, buf);
2943 /* Writes to sensor registers 0x22: RESERVED */
2944 /* 0x23: UNDOCUMENTED */
2945 buf[0] = 0x00; buf[1] = 0x00;
2946 buf[2] = 0x00; buf[3] = 0x00;
2947 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, 0x22, dev->sensor_flags, buf);
2948 /* Writes to sensor registers 0x24: UNDOCUMENTED */
2949 /* 0x25: UNDOCUMENTED */
2950 buf[0] = 0x00; buf[1] = 0x00;
2951 buf[2] = 0x00; buf[3] = 0x00;
2952 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, 0x24, dev->sensor_flags, buf);
2953 /* Writes to sensor registers 0x26: UNDOCUMENTED */
2954 /* 0x27: RESERVED */
2955 buf[0] = 0x00; buf[1] = 0x00;
2956 buf[2] = 0x00; buf[3] = 0x24;
2957 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, 0x26, dev->sensor_flags, buf);
2958 /* "Dummy" write to sensor Register 0x30: RESERVED */
2959 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 0, 0x30, dev->sensor_flags, NULL);
2960 /* Writes to sensor registers 0x2f: RESERVED */
2961 /* 0x30: RESERVED */
2962 buf[0] = 0xf7; buf[1] = 0xb0;
2963 buf[2] = 0x00; buf[3] = 0x05;
2964 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, 0x2f, dev->sensor_flags, buf);
2965 /* Writes to sensor registers 0x31: RESERVED */
2966 /* 0x32: RESERVED */
2967 buf[0] = 0x00; buf[1] = 0x00;
2968 buf[2] = 0x00; buf[3] = 0x00;
2969 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, 0x31, dev->sensor_flags, buf);
2970 /* Writes to sensor registers 0x33: RESERVED */
2971 /* 0x34: RESERVED */
2972 buf[0] = 0x00; buf[1] = 0x00;
2973 buf[2] = 0x01; buf[3] = 0x00;
2974 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, 0x33, dev->sensor_flags, buf);
2975 /* "Dummy" write to sensor Register 0x3b: RESERVED */
2976 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 0, 0x3b, dev->sensor_flags, NULL);
2977 /* Write to sensor register 0x3d: RESERVED */
2978 buf[0] = 0x06; buf[1] = 0x8f;
2979 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 2, 0x3d, dev->sensor_flags, buf);
2980 /* Writes to sensor registers 0x40: RESERVED */
2981 /* 0x41: RESERVED */
2982 buf[0] = 0x01; buf[1] = 0xe0;
2983 buf[2] = 0x00; buf[3] = 0xd1;
2984 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, 0x40, dev->sensor_flags, buf);
2985 /* Write to sensor register 0x44: UNDOCUMENTED */
2986 buf[0] = 0x00; buf[1] = 0x82;
2987 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 2, 0x44, dev->sensor_flags, buf);
2988 /* Writes to sensor registers 0x5a: RESERVED */
2989 /* 0x5b: RESERVED */
2990 buf[0] = 0x00; buf[1] = 0x00;
2991 buf[2] = 0x00; buf[3] = 0x00;
2992 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, 0x5a, dev->sensor_flags, buf);
2993 /* Writes to sensor registers 0x5c: RESERVED */
2994 /* 0x5d: RESERVED */
2995 buf[0] = 0x00; buf[1] = 0x00;
2996 buf[2] = 0x00; buf[3] = 0x00;
2997 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, 0x5c, dev->sensor_flags, buf);
2998 /* Writes to sensor registers 0x5e: RESERVED */
2999 /* 0x5f: RESERVED */
3000 buf[0] = 0x00; buf[1] = 0x00;
3001 buf[2] = 0xa3; buf[3] = 0x1d;
3002 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, 0x5e, dev->sensor_flags, buf);
3003 /* "Dummy" write to sensor Register 0x68: UNDOCUMENTED */
3004 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 0, 0x68, dev->sensor_flags, NULL);
3005 /* Write to sensor register 0x62: RESERVED */
3006 buf[0] = 0x06; buf[1] = 0x11;
3007 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 2, 0x62, dev->sensor_flags, buf);
3009 if (retI2C < 0) {
3010 UDIA_INFO("1 or more errors occured in I2C-message-block 1 !\n");
3011 return -1;
3013 /* END OF I2C MESSAGES */
3014 /* +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ */
3016 if (dev->sensor_slave_address == MT9V011_I2C_SLAVE_ADDRESS) {
3017 buf[0] = 0x40;
3018 usb_microdia_control_write(dev, 0x1007, buf, 8);
3019 buf[0] = 0x40;
3020 usb_microdia_control_write(dev, 0x1006, buf, 8);
3024 /* *** TEMPORARY SWITCH TO SLAVE ADDRESS 0x50, I2C READ ATTEMPT: */
3025 /* - WE CURRENTLY KNOW NO 6270 CAM THAT IS SUCCESSFULLY READ HERE */
3026 /* - IF READ FAILS, THIS IS NEVER DONE AGAIN (IN NEXT CYCLE OR FURTHER STARTS) */
3027 usb_microdia_control_read(dev, 0x10c1, buf, 1); /* returns 0x5c */
3028 buf[0] = 0x50;
3029 usb_microdia_control_write(dev, 0x10c1, buf, 1);
3030 retI2C = sn9c20x_read_i2c_data(dev, 0x50, 1, 0x00, SN9C20X_I2C_2WIRE, buf);
3031 if (retI2C >= 0)
3032 UDIA_INFO("Read of address 0x00 from slave 0x50 successful:\n=> Please report this to microdia@googlegroups.com (http:/* groups.google.com/group/microdia) !\n");
3033 buf[0] = 0x5c;
3034 usb_microdia_control_write(dev, 0x10c1, buf, 1);
3037 buf[0] = 0x47; /* ALEX: 0x44 */
3038 usb_microdia_control_write(dev, 0x10e0, buf, 1); /* URB 2045 */
3039 buf[0] = 0x47; /* ALEX: 0x04 */
3040 usb_microdia_control_write(dev, 0x10e0, buf, 1); /* URB 2046 */
3041 buf[0] = 0xc6;
3042 usb_microdia_control_write(dev, 0x1001, buf, 1); /* URB 2047 */
3043 buf[0] = 0xc4;
3044 usb_microdia_control_write(dev, 0x1001, buf, 1); /* URB 2048 */
3045 buf[0] = 0x84; /* ALEX: 0xc0 */
3046 usb_microdia_control_write(dev, 0x1001, buf, 1); /* URB 2049 */
3047 /* ALEX:
3048 buf[0] = 0x40;
3049 usb_microdia_control_write(dev, 0x1001, buf, 1);
3052 if (dev->sensor_slave_address == MT9V111_I2C_SLAVE_ADDRESS) {
3053 /* ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ */
3054 /* I2C MESSAGES */
3055 retI2C = 0;
3056 /* Writes to sensor registers 0x02: Column Start */
3057 /* 0x03: Window Height */
3058 buf[0] = 0x00; buf[1] = 0x16; /* coulmn 22 */
3059 buf[2] = 0x01; buf[3] = 0xe1; /* 481 */
3060 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, 0x02, dev->sensor_flags, buf); /* URBs 2050-2052 */
3061 /* Writes to sensor registers 0x04: Window Width */
3062 /* 0x05: Horizontal Blanking */
3063 buf[0] = 0x02; buf[1] = 0x81; /* 641 */
3064 buf[2] = 0x00; buf[3] = 0x04; /* 4 columns (pixel clocks) // AT FIRST START + FIRST CYCLE: 0x00 0x00 */
3065 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, 0x04, dev->sensor_flags, buf); /* URBs 2053-2055 */
3066 /* Writes to sensor registers 0x06: Vertical Blanking */
3067 /* 0x07: Output Control */
3068 buf[0] = 0x00; buf[1] = 0x00; /* 0 rows */
3069 buf[2] = 0x30; buf[3] = 0x02; /* normal operation + chip enable + RESERVED options */
3070 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, 0x06, dev->sensor_flags, buf); /* URBs 2056-2058 */
3071 /* Write to sensor register 0x0e: UNDOCUMENTED */
3072 buf[0] = 0x00; buf[1] = 0x08;
3073 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 2, 0x0e, dev->sensor_flags, buf); /* URBs 2059-2061 */
3074 if (retI2C < 0) {
3075 UDIA_INFO("1 or more errors occured in I2C-message-block 2 !\n");
3076 return -1;
3078 /* END OF I2C MESSAGES */
3079 /* +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ */
3082 buf[0] = 0x02; buf[1] = 0x00; buf[2] = 0x02; buf[3] = 0x00;
3083 buf[4] = 0x28; buf[5] = 0x3c;
3084 usb_microdia_control_write(dev, 0x1180, buf, 6); /* URB 2062 */
3085 buf[0] = 0x00; buf[1] = 0xa0; buf[2] = 0x00; buf[3] = 0xf0; buf[4] = 0x00;
3086 usb_microdia_control_write(dev, 0x10fb, buf, 5); /* URB 2063 */
3087 buf[0] = 0x0c;
3088 usb_microdia_control_write(dev, 0x1189, buf, 1); /* URB 2064 */
3089 buf[0] = 0x00; buf[1] = 0x00; buf[2] = 0x6a; buf[3] = 0x50;
3090 usb_microdia_control_write(dev, 0x11a1, buf, 4); /* URB 2065 */
3091 buf[0] = 0x00; buf[1] = 0x00; buf[2] = 0x50; buf[3] = 0x3c;
3092 usb_microdia_control_write(dev, 0x11ab, buf, 4); /* URB 2066 */
3093 buf[0] = 0x78; /* ALEX: 0x7c */
3094 usb_microdia_control_write(dev, 0x1000, buf, 1); /* URB 2067 */
3095 buf[0] = 0x18; /* ALEX: 0x1c */
3096 usb_microdia_control_write(dev, 0x1002, buf, 1); /* URB 2068 */
3097 buf[0] = 0x18; /* ALEX: 0x1c */
3098 usb_microdia_control_write(dev, 0x1002, buf, 1); /* URB 2069 */
3099 buf[0] = 0x38;
3100 usb_microdia_control_write(dev, 0x11b8, buf, 1); /* URB 2070 */
3101 buf[0] = 0x04;
3102 usb_microdia_control_write(dev, 0x118a, buf, 1); /* URB 2071 */
3103 buf[0] = 0x04;
3104 usb_microdia_control_write(dev, 0x0395, buf, 1); /* URB 2072 */
3106 buf[0] = 0x78;
3107 usb_microdia_control_write(dev, 0x11b8, buf, 1); /* URB 2073 */
3108 usb_microdia_control_read(dev, 0x11b8, buf, 1); /* URB 2074 // 0x38 */
3109 if (buf[0] == 0x38)
3110 buf[0] = 0x79;
3111 else if (buf[0] == 0xb8)
3112 buf[0] = 0xf9;
3113 usb_microdia_control_write(dev, 0x11b8, buf, 1); /* URB 2075 */
3114 usb_microdia_control_read(dev, 0x11b8, buf, 1); /* URB 2076 // 0xb9 */
3115 if (buf[0] == 0x39)
3116 buf[0] = 0x7a;
3117 else if (buf[0] == 0xb9)
3118 buf[0] = 0xfa;
3119 usb_microdia_control_write(dev, 0x11b8, buf, 1); /* URB 2077 */
3120 usb_microdia_control_read(dev, 0x11b8, buf, 1); /* URB 2078 */
3121 if (buf[0] == 0x3a)
3122 buf[0] = 0x7b;
3123 else if (buf[0] == 0xba)
3124 buf[0] = 0xfb;
3125 usb_microdia_control_write(dev, 0x11b8, buf, 1); /* URB 2079 */
3126 usb_microdia_control_read(dev, 0x11b8, buf, 1); /* URB 2080 // 0x3b */
3127 if (buf[0] == 0x3b)
3128 buf[0] = 0x7c;
3129 else if (buf[0] == 0xbb)
3130 buf[0] = 0xfc;
3131 usb_microdia_control_write(dev, 0x11b8, buf, 1); /* URB 2081 */
3132 usb_microdia_control_read(dev, 0x11b8, buf, 1); /* URB 2082 // 0x3c */
3133 if (buf[0] == 0x3c)
3134 buf[0] = 0x7d;
3135 else if (buf[0] == 0xbc)
3136 buf[0] = 0xfd;
3137 usb_microdia_control_write(dev, 0x11b8, buf, 1); /* URB 2083 */
3138 usb_microdia_control_read(dev, 0x11b8, buf, 1); /* URB 2084 // 0x3d */
3139 last_11b8[0] = buf[0];
3140 if (dev->sensor_slave_address == MT9V111_I2C_SLAVE_ADDRESS) {
3141 if (buf[0] == 0x3d)
3142 buf[0] = 0x7e;
3143 else if (buf[0] == 0xbd)
3144 buf[0] = 0xfe;
3145 usb_microdia_control_write(dev, 0x11b8, buf, 1); /* URB 2085 */
3146 usb_microdia_control_read(dev, 0x11b8, buf, 1); /* URB 2086 */
3147 if (buf[0] == 0x3e)
3148 buf[0] = 0x7f;
3149 else if (buf[0] == 0xbe)
3150 buf[0] = 0xff;
3151 usb_microdia_control_write(dev, 0x11b8, buf, 1); /* URB 2087 */
3152 usb_microdia_control_read(dev, 0x11b8, last_11b8, 1); /* URB 2088 */
3154 buf[0] = last_11b8[0] & 0xf0; /* 0xf0 or 0x70 */
3155 buf[0] = buf[0] | 0x0d; /* 0x0c => THIS VALUE SEEMS TO DEPEND ON WHAT WAS READ/WRITTEN IN THE LAST 8 READS/WRITES */
3156 usb_microdia_control_write(dev, 0x11b8, buf, 1); /* URB 2089 */
3159 /* ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ */
3160 /* I2C MESSAGES */
3161 retI2C = 0;
3162 if (dev->sensor_slave_address == MT9V111_I2C_SLAVE_ADDRESS) {
3163 /* Write to sensor register 0x06: Vertical Blanking */
3164 buf[0] = 0x00; buf[1] = 0x2d; /* 45 rows */
3165 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 2, 0x06, dev->sensor_flags, buf); /* URBs 2090-2092 */
3166 /* Write to sensor register 0x05: Horizontal Blanking */
3167 buf[0] = 0x00; buf[1] = 0x04; /* 4 columns (pixel clocks) */
3168 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 2, 0x05, dev->sensor_flags, buf); /* URBs 2093-2095 */
3169 /* Write to sensor register 0x20: Read Mode */
3170 buf[0] = 0x00; buf[1] = 0x00; /* normal readout */
3171 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 2, 0x20, dev->sensor_flags, buf); /* URBs 2096-2098 */
3172 } else if (dev->sensor_slave_address == MT9V011_I2C_SLAVE_ADDRESS) {
3173 /* Write to sensor register 0x0a: Pixel Clock Speed */
3174 buf[0] = 0x00; buf[1] = 0x00; /* default */
3175 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 2, 0x0a, dev->sensor_flags, buf);
3176 /* Write to sensor register 0x06: Vertical Blanking */
3177 buf[0] = 0x00; buf[1] = 0x29; /* 41 rows */
3178 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 2, 0x06, dev->sensor_flags, buf);
3179 /* Write to sensor register 0x05: Horizontal Blanking */
3180 buf[0] = 0x00; buf[1] = 0x09; /* 9 columns (pixel clocks) */
3181 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 2, 0x05, dev->sensor_flags, buf);
3182 /* Write to sensor register 0x20: Read Mode */
3183 buf[0] = 0x11; buf[1] = 0x01; /* output all frames (including bad ones) + UNKNOWN */
3184 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 2, 0x20, dev->sensor_flags, buf);
3186 if (retI2C < 0) {
3187 UDIA_INFO("1 or more errors occured in I2C-message-block 3 !\n");
3188 return -1;
3190 /* END OF I2C MESSAGES */
3191 /* +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ */
3194 buf[0] = 0x02;
3195 usb_microdia_control_write(dev, 0x1180, buf, 1); /* URB 2099 */
3197 /* ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ */
3198 /* I2C MESSAGE */
3199 retI2C = 0;
3200 if (dev->sensor_slave_address == MT9V111_I2C_SLAVE_ADDRESS) {
3201 /* Write to sensor register 0x20: Read Mode */
3202 buf[0] = 0x00; buf[1] = 0x00; /* normal readout */
3203 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 2, 0x20, dev->sensor_flags, buf); /* URBs 2100-2102 */
3204 } else if (dev->sensor_slave_address == MT9V011_I2C_SLAVE_ADDRESS) {
3205 /* Write to sensor register 0x20: Read Mode */
3206 buf[0] = 0x11; buf[1] = 0x01; /* output all frames (including bad ones) + UNKNOWN */
3207 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 2, 0x20, dev->sensor_flags, buf);
3209 if (retI2C < 0) {
3210 UDIA_INFO("1 or more errors occured in I2C-message-block 4 !\n");
3211 return -1;
3213 /* END OF I2C MESSAGES */
3214 /* +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ */
3217 buf[0] = 0x02;
3218 usb_microdia_control_write(dev, 0x1182, buf, 1); /* URB 2103 */
3221 /* ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ */
3222 /* I2C MESSAGES */
3223 retI2C = 0;
3224 if (dev->sensor_slave_address == MT9V111_I2C_SLAVE_ADDRESS) {
3225 /* Write to sensor register 0x09: Shutter Width */
3226 buf[0] = 0x00; buf[1] = 0x64; /* integration of 100 rows */
3227 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 2, 0x09, dev->sensor_flags, buf); /* URBs 2104-2106 */
3228 /* Write to sensor register 0x2b: Green 1 Gain */
3229 /* 0x2c: Blue Gain */
3230 buf[0] = 0x00; buf[1] = 0xa0; /* 32*0.03125*2 = 2 */
3231 buf[2] = 0x00; buf[3] = 0xa0; /* 32*0.03125*2 = 2 */
3232 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, 0x2b, dev->sensor_flags, buf); /* URBs 2107-2109 */
3233 /* Write to sensor register 0x2d: Red Gain */
3234 /* 0x2e: Green 2 Gain */
3235 buf[0] = 0x00; buf[1] = 0xa0; /* 32*0.03125*2 = 2 */
3236 buf[2] = 0x00; buf[3] = 0xa0; /* 32*0.03125*2 = 2 */
3237 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, 0x2d, dev->sensor_flags, buf); /* URBs 2110-2112 */
3238 /* "Dummy" write to sensor Register 0x33: RESERVED */
3239 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 0, 0x33, dev->sensor_flags, NULL); /* URBs 2113-2114 */
3240 } else if (dev->sensor_slave_address == MT9V011_I2C_SLAVE_ADDRESS) {
3241 /* Write to sensor register 0x09: Shutter Width */
3242 buf[0] = 0x00; buf[1] = 0x64; /* integration of 100 rows */
3243 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 2, 0x09, dev->sensor_flags, buf);
3244 /* Write to sensor register 0x07: Output Control */
3245 buf[0] = 0x00; buf[1] = 0x03; /* dont update changes until bit0=0, chip enable, normal operation */
3246 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 2, 0x07, dev->sensor_flags, buf);
3247 /* Write to sensor register 0x2b: Green 1 Gain */
3248 /* 0x2c: Blue Gain */
3249 buf[0] = 0x00; buf[1] = 0x33; /* 51*0.03125*1 = 1.59375 */
3250 buf[2] = 0x00; buf[3] = 0xa0; /* 32*0.03125*2 = 2 */
3251 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, 0x2b, dev->sensor_flags, buf);
3252 /* Write to sensor register 0x2d: Red Gain */
3253 /* 0x2e: Green 2 Gain */
3254 buf[0] = 0x00; buf[1] = 0xa0; /* 32*0.03125*2 = 2 */
3255 buf[2] = 0x00; buf[3] = 0x33; /* 51*0.03125*1 = 1.59375 */
3256 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, 0x2d, dev->sensor_flags, buf);
3257 /* "Dummy" write to sensor Register 0x33: RESERVED */
3258 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 0, 0x33, dev->sensor_flags, NULL);
3259 /* Write to sensor register 0x07: Output Control */
3260 buf[0] = 0x00; buf[1] = 0x02; /* chip enable, normal operation */
3261 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 2, 0x07, dev->sensor_flags, buf);
3263 if (retI2C < 0) {
3264 UDIA_INFO("1 or more errors occured in I2C-message-block 5 !\n");
3265 return -1;
3267 /* END OF I2C MESSAGES */
3268 /* +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ */
3270 buf[0] = 0x0a;
3271 usb_microdia_control_write(dev, 0x11ba, buf, 1); /* URB 2119 */
3273 if (dev->sensor_slave_address == MT9V111_I2C_SLAVE_ADDRESS)
3274 buf[0] = 0x14;
3275 else if (dev->sensor_slave_address == MT9V011_I2C_SLAVE_ADDRESS)
3276 buf[0] = 0x0a;
3277 usb_microdia_control_write(dev, 0x118b, buf, 1); /* URB 2124 */
3279 buf[0] = 0x07;
3280 usb_microdia_control_write(dev, 0x10f7, buf, 1); /* URB 2135 */
3282 if (dev->sensor_slave_address == MT9V111_I2C_SLAVE_ADDRESS)
3283 buf[0] = 0x01;
3284 else if (dev->sensor_slave_address == MT9V011_I2C_SLAVE_ADDRESS)
3285 buf[0] = 0x14;
3286 usb_microdia_control_write(dev, 0x10f8, buf, 1); /* URB 2138 */
3288 if (dev->sensor_slave_address == MT9V111_I2C_SLAVE_ADDRESS)
3289 buf[0] = 0x0a;
3290 else if (dev->sensor_slave_address == MT9V011_I2C_SLAVE_ADDRESS)
3291 buf[0] = 0xff;
3292 usb_microdia_control_write(dev, 0x10fa, buf, 1); /* URB 2139 */
3294 buf[0] = 0x00;
3295 usb_microdia_control_write(dev, 0x10f9, buf, 1); /* URB 2140 */
3296 buf[0] = 0x00;
3297 usb_microdia_control_write(dev, 0x10f9, buf, 1); /* URB 2141 */
3298 buf[0] = 0x0a;
3299 usb_microdia_control_write(dev, 0x11ba, buf, 1); /* URB 2142 */
3300 buf[0] = 0x00; buf[1] = 0x00; buf[2] = 0x00; buf[3] = 0x00;
3301 usb_microdia_control_write(dev, 0x11bc, buf, 4); /* URB 2143 */
3302 for (k = 0; k < 48; k++)
3303 buf[k] = 0x00;
3304 usb_microdia_control_write(dev, 0x11c0, buf, 48); /* URB 2144 */
3306 buf[0] = 0x2d; buf[1] = 0x2d; buf[2] = 0x3a; buf[3] = 0x05;
3307 buf[4] = 0x04; buf[5] = 0x3f;
3308 usb_microdia_control_write(dev, 0x11a5, buf, 6); /* URB 2149 */
3310 if (dev->sensor_slave_address == MT9V111_I2C_SLAVE_ADDRESS) {
3311 buf[0] = 0x14; buf[1] = 0xec; buf[2] = 0x0a; buf[3] = 0xf6;
3312 } else if (dev->sensor_slave_address == MT9V011_I2C_SLAVE_ADDRESS) {
3313 buf[0] = 0x28; buf[1] = 0xd8; buf[2] = 0x14; buf[3] = 0xec;
3315 usb_microdia_control_write(dev, 0x11af, buf, 4); /* URB 2150 */
3317 buf[0] = 0x32; buf[1] = 0xdd; buf[2] = 0x2d; buf[3] = 0xdd;
3318 usb_microdia_control_write(dev, 0x11b3, buf, 4); /* URB 2151 */
3319 buf[0] = 0x47; /* ALEX: 0x04 */
3320 usb_microdia_control_write(dev, 0x10e0, buf, 1); /* URB 2152 */
3321 buf[0] = 0x01;
3322 usb_microdia_control_write(dev, 0x1061, buf, 1); /* URB 2153 */
3323 buf[0] = 0x67; /* ALEX: 0x24 */
3324 usb_microdia_control_write(dev, 0x10e0, buf, 1); /* URB 2154 */
3325 buf[0] = 0x0d; buf[1] = 0x08; buf[2] = 0x08; buf[3] = 0x0d;
3326 buf[4] = 0x08; buf[5] = 0x08; buf[6] = 0x0d; buf[7] = 0x0d;
3327 buf[8] = 0x0d; buf[9] = 0x0d; buf[10] = 0x11; buf[11] = 0x0d;
3328 buf[12] = 0x0d; buf[13] = 0x11; buf[14] = 0x15; buf[15] = 0x21;
3329 buf[16] = 0x15; buf[17] = 0x15; buf[18] = 0x11; buf[19] = 0x11;
3330 buf[20] = 0x15; buf[21] = 0x2a; buf[22] = 0x1d; buf[23] = 0x1d;
3331 buf[24] = 0x19; buf[25] = 0x21; buf[26] = 0x32; buf[27] = 0x2a;
3332 buf[28] = 0x32; buf[29] = 0x32; buf[30] = 0x2e; buf[31] = 0x2a;
3333 buf[32] = 0x2e; buf[33] = 0x2e; buf[34] = 0x36; buf[35] = 0x3a;
3334 buf[36] = 0x4b; buf[37] = 0x43; buf[38] = 0x36; buf[39] = 0x3a;
3335 buf[40] = 0x47; buf[41] = 0x3a; buf[42] = 0x2e; buf[43] = 0x2e;
3336 buf[44] = 0x43; buf[45] = 0x5c; buf[46] = 0x43; buf[47] = 0x47;
3337 buf[48] = 0x4f; buf[49] = 0x53; buf[50] = 0x58; buf[51] = 0x58;
3338 buf[52] = 0x58; buf[53] = 0x32; buf[54] = 0x3f; buf[55] = 0x60;
3339 buf[56] = 0x64; buf[57] = 0x5c; buf[58] = 0x53; buf[59] = 0x64;
3340 buf[60] = 0x4b; buf[61] = 0x53; buf[62] = 0x58; buf[63] = 0x53;
3341 usb_microdia_control_write(dev, 0x1100, buf, 64); /* URB 2155 */
3342 buf[0] = 0x0d; buf[1] = 0x11; buf[2] = 0x11; buf[3] = 0x15;
3343 buf[4] = 0x11; buf[5] = 0x15; buf[6] = 0x26; buf[7] = 0x15;
3344 buf[8] = 0x15; buf[9] = 0x26; buf[10] = 0x53; buf[11] = 0x36;
3345 buf[12] = 0x2e; buf[13] = 0x36; buf[14] = 0x53; buf[15] = 0x53;
3346 buf[16] = 0x53; buf[17] = 0x53; buf[18] = 0x53; buf[19] = 0x53;
3347 buf[20] = 0x53; buf[21] = 0x53; buf[22] = 0x53; buf[23] = 0x53;
3348 buf[24] = 0x53; buf[25] = 0x53; buf[26] = 0x53; buf[27] = 0x53;
3349 buf[28] = 0x53; buf[29] = 0x53; buf[30] = 0x53; buf[31] = 0x53;
3350 buf[32] = 0x53; buf[33] = 0x53; buf[34] = 0x53; buf[35] = 0x53;
3351 buf[36] = 0x53; buf[37] = 0x53; buf[38] = 0x53; buf[39] = 0x53;
3352 buf[40] = 0x53; buf[41] = 0x53; buf[42] = 0x53; buf[43] = 0x53;
3353 buf[44] = 0x53; buf[45] = 0x53; buf[46] = 0x53; buf[47] = 0x53;
3354 buf[48] = 0x53; buf[49] = 0x53; buf[50] = 0x53; buf[51] = 0x53;
3355 buf[52] = 0x53; buf[53] = 0x53; buf[54] = 0x53; buf[55] = 0x53;
3356 buf[56] = 0x53; buf[57] = 0x53; buf[58] = 0x53; buf[59] = 0x53;
3357 buf[60] = 0x53; buf[61] = 0x53; buf[62] = 0x53; buf[63] = 0x53;
3358 usb_microdia_control_write(dev, 0x1140, buf, 64); /* URB 2156 */
3359 buf[0] = 0x47; /* ALEX: 0x04 */
3360 usb_microdia_control_write(dev, 0x10e0, buf, 1); /* URB 2157 */
3361 buf[0] = 0x03;
3362 usb_microdia_control_write(dev, 0x1061, buf, 1); /* URB 2158 */
3363 buf[0] = 0x4b; /* ALEX: 0x08 */
3364 usb_microdia_control_write(dev, 0x10e0, buf, 1); /* URB 2159 */
3366 if (dev->sensor_slave_address == MT9V111_I2C_SLAVE_ADDRESS) {
3367 /* ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ */
3368 /* I2C MESSAGES */
3369 retI2C = 0;
3370 /* Writes to sensor registers 0x02: Column Start */
3371 /* 0x03: Window Hight */
3372 buf[0] = 0x00; buf[1] = 0x16; /* coulmn 22 */
3373 buf[2] = 0x01; buf[3] = 0xe1; /* 481 */
3374 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, 0x02, dev->sensor_flags, buf); /* URBs 2160-2162 */
3375 /* Writes to sensor registers 0x04: Window Width */
3376 /* 0x05: Horizontal Blanking */
3377 buf[0] = 0x02; buf[1] = 0x81; /* 641 */
3378 buf[2] = 0x00; buf[3] = 0x04; /* 4 columns (pixel clocks) */
3379 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, 0x04, dev->sensor_flags, buf); /* URBs 2163-2165 */
3380 /* Writes to sensor registers 0x06: Vertical Blanking */
3381 /* 0x07: Output Control */
3382 buf[0] = 0x00; buf[1] = 0x2d; /* 45 rows */
3383 buf[2] = 0x30; buf[3] = 0x02; /* RESERVED options */
3384 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, 0x06, dev->sensor_flags, buf); /* URBs 2166-2167 */
3385 /* Writes to sensor register 0x0e: UNDOCUMENTED */
3386 buf[0] = 0x00; buf[1] = 0x08;
3387 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 2, 0x0e, dev->sensor_flags, buf); /* URBs 2168-2170 */
3388 if (retI2C < 0) {
3389 UDIA_INFO("1 or more errors occured in I2C-message-block 6 !\n");
3390 return -1;
3392 /* END OF I2C MESSAGES */
3393 /* +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ */
3394 } else if (dev->sensor_slave_address == MT9V011_I2C_SLAVE_ADDRESS) {
3395 buf[0] = 0x40;
3396 usb_microdia_control_write(dev, 0x1007, buf, 1);
3397 buf[0] = 0x40;
3398 usb_microdia_control_write(dev, 0x1006, buf, 1);
3402 buf[0] = 0x02; buf[1] = 0x00; buf[2] = 0x02; buf[3] = 0x00;
3403 buf[4] = 0x28; buf[5] = 0x3c;
3404 usb_microdia_control_write(dev, 0x1180, buf, 6); /* URB 2171 */
3405 buf[0] = 0x00; buf[1] = 0xa0; buf[2] = 0x00; buf[3] = 0xf0; buf[4] = 0x00;
3406 usb_microdia_control_write(dev, 0x10fb, buf, 5); /* URB 2172 */
3407 buf[0] = 0x0c;
3408 usb_microdia_control_write(dev, 0x1189, buf, 1); /* URB 2173 */
3409 buf[0] = 0x00; buf[1] = 0x00; buf[2] = 0x6a; buf[3] = 0x50;
3410 usb_microdia_control_write(dev, 0x11a1, buf, 4); /* URB 2174 */
3411 buf[0] = 0x00; buf[1] = 0x00; buf[2] = 0x50; buf[3] = 0x3c;
3412 usb_microdia_control_write(dev, 0x11ab, buf, 4); /* URB 2175 */
3413 buf[0] = 0x03;
3414 usb_microdia_control_write(dev, 0x1061, buf, 1); /* URB 2176 */
3415 buf[0] = 0x0a;
3416 usb_microdia_control_write(dev, 0x11ba, buf, 1); /* URB 2177 */
3417 buf[0] = 0x00;
3418 usb_microdia_control_write(dev, 0x11b9, buf, 1); /* URB 2178 */
3419 buf[0] = 0x0b;
3420 usb_microdia_control_write(dev, 0x11ba, buf, 1); /* URB 2179 */
3421 buf[0] = 0x01;
3422 usb_microdia_control_write(dev, 0x1061, buf, 1); /* URB 2180 */
3423 buf[0] = 0x78; /* ALEX: 0x7c */
3424 usb_microdia_control_write(dev, 0x1000, buf, 1); /* URB 2181 */
3425 buf[0] = 0x18; /* ALEX: 0x1c */
3426 usb_microdia_control_write(dev, 0x1002, buf, 1); /* URB 2182 */
3427 buf[0] = 0x18; /* ALEX: 0x1c */
3428 usb_microdia_control_write(dev, 0x1002, buf, 1); /* URB 2183 */
3429 buf[0] = 0x7d; /* ALEX: 0xfc */
3430 usb_microdia_control_write(dev, 0x11b8, buf, 1); /* URB 2184 */
3431 buf[0] = 0x04;
3432 usb_microdia_control_write(dev, 0x118a, buf, 1); /* URB 2185 */
3433 buf[0] = 0x04;
3434 usb_microdia_control_write(dev, 0x0395, buf, 1); /* URB 2186 */
3436 if ((last_11b8[0] == 0x3d) || (last_11b8[0] == 0x3f))
3437 buf[0] = 0x78;
3438 else if ((last_11b8[0] == 0xbd) || (last_11b8[0] == 0xbf))
3439 buf[0] = 0xf8;
3440 usb_microdia_control_write(dev, 0x11b8, buf, 1); /* URB 2187 */
3441 usb_microdia_control_read(dev, 0x11b8, buf, 1); /* URB 2188 // 0x38 */
3442 if (buf[0] == 0x38)
3443 buf[0] = 0x79;
3444 else if (buf[0] == 0xb8)
3445 buf[0] = 0xf9;
3446 usb_microdia_control_write(dev, 0x11b8, buf, 1); /* URB 2189 */
3447 usb_microdia_control_read(dev, 0x11b8, buf, 1); /* URB 2190 // 0xb9 */
3448 if (buf[0] == 0x39)
3449 buf[0] = 0x7a;
3450 else if (buf[0] == 0xb9)
3451 buf[0] = 0xfa;
3452 usb_microdia_control_write(dev, 0x11b8, buf, 1); /* URB 2191 */
3453 usb_microdia_control_read(dev, 0x11b8, buf, 1); /* URB 2192 // 0xba */
3454 if (buf[0] == 0x3a)
3455 buf[0] = 0x7b;
3456 else if (buf[0] == 0xba)
3457 buf[0] = 0xfb;
3458 usb_microdia_control_write(dev, 0x11b8, buf, 1); /* URB 2193 */
3459 usb_microdia_control_read(dev, 0x11b8, buf, 1); /* URB 2194 // 0x3b */
3460 if (buf[0] == 0x3b)
3461 buf[0] = 0x7c;
3462 else if (buf[0] == 0xbb)
3463 buf[0] = 0xfc;
3464 usb_microdia_control_write(dev, 0x11b8, buf, 1); /* URB 2195 */
3465 usb_microdia_control_read(dev, 0x11b8, buf, 1); /* URB 2196 // 0x3c */
3466 if (buf[0] == 0x3c)
3467 buf[0] = 0x7d;
3468 else if (buf[0] == 0xbc)
3469 buf[0] = 0xfd;
3470 usb_microdia_control_write(dev, 0x11b8, buf, 1); /* URB 2197 */
3471 usb_microdia_control_read(dev, 0x11b8, buf, 1); /* URB 2198 // 0x3d */
3472 if (dev->sensor_slave_address == MT9V111_I2C_SLAVE_ADDRESS) {
3473 if (buf[0] == 0x3d)
3474 buf[0] = 0x7e;
3475 else if (buf[0] == 0xbd)
3476 buf[0] = 0xfe;
3477 usb_microdia_control_write(dev, 0x11b8, buf, 1); /* URB 2199 */
3478 usb_microdia_control_read(dev, 0x11b8, buf, 1); /* URB 2200 */
3479 if (buf[0] == 0x3e)
3480 buf[0] = 0x7f;
3481 else if (buf[0] == 0xbe)
3482 buf[0] = 0xff;
3483 usb_microdia_control_write(dev, 0x11b8, buf, 1); /* URB 2201 */
3484 usb_microdia_control_read(dev, 0x11b8, buf, 1); /* URB 2202 */
3486 buf[0] = buf[0] & 0xf0; /* 0xf0 or 0x70 */
3487 buf[0] = buf[0] | 0x0d; /* 0x0c => THIS VALUE SEEMS TO DEPEND ON WHAT WAS READ/WRITTEN IN THE LAST 8 READS/WRITES */
3488 usb_microdia_control_write(dev, 0x11b8, buf, 1); /* URB 2089 */
3490 /* ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ */
3491 /* I2C MESSAGES */
3492 retI2C = 0;
3493 if (dev->sensor_slave_address == MT9V111_I2C_SLAVE_ADDRESS) {
3494 /* Write to sensor register 0x06: Vertical Blanking */
3495 buf[0] = 0x00; buf[1] = 0x2d; /* 45 rows */
3496 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 2, 0x06, dev->sensor_flags, buf); /* URBs 2204-2206 */
3497 /* Write to sensor register 0x05: Horizontal Blanking */
3498 buf[0] = 0x00; buf[1] = 0x04; /* 4 columns (pixel clocks) */
3499 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 2, 0x05, dev->sensor_flags, buf); /* URBs 2207-2209 */
3500 /* Read of sensor register 0x36: Chip Version (mirror of reg0xff) */
3501 retI2C += sn9c20x_read_i2c_data(dev, dev->sensor_slave_address, 2, 0x36, dev->sensor_flags, buf); /* URBs 2211-2215 // 0x82 0x3a */
3502 } else if (dev->sensor_slave_address == MT9V011_I2C_SLAVE_ADDRESS) {
3503 /* Write to sensor register 0x0a: Pixel Clock Speed */
3504 buf[0] = 0x00; buf[1] = 0x00; /* default */
3505 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 2, 0x06, dev->sensor_flags, buf);
3506 /* Write to sensor register 0x06: Vertical Blanking */
3507 buf[0] = 0x00; buf[1] = 0x29; /* 41 rows */
3508 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 2, 0x06, dev->sensor_flags, buf);
3509 /* Write to sensor register 0x05: Horizontal Blanking */
3510 buf[0] = 0x00; buf[1] = 0x09; /* 9 columns (pixel clocks) */
3511 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 2, 0x05, dev->sensor_flags, buf);
3512 /* Read of sensor register 0x00: Chip Version (=reg0xff) */
3513 retI2C += sn9c20x_read_i2c_data(dev, dev->sensor_slave_address, 2, 0x00, dev->sensor_flags, buf); /* 0x82 0x43 */
3515 if (retI2C < 0) {
3516 UDIA_INFO("1 or more errors occured in I2C-message-block 7 !\n");
3517 return -1;
3519 /* END OF I2C MESSAGES */
3520 /* +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ */
3523 buf[0] = 0x03;
3524 usb_microdia_control_write(dev, 0x1061, buf, 1); /* URB 2216 */
3527 /*** NOW DRIVER DOES STOP-SEQUENCE
3528 - WITHOUT WRITES TO 0x1007 AND 0x1006 (URBs 3544-3550) => MT9V111
3529 - WRITING 0x40 INSTEAD OF 0x60 TO 0x1007 AND 0x1006 => MT9V011
3530 ***/
3531 /*** 2nd, 3rd, ... CYCLE: ALL MESSAGES (URBs 1953 - URBs 2216) ARE REPEATED ***/
3532 /*** ----- WE DON'T DO THIS, IT SEEMS TO BE UNNECESSARY ----- ***/
3534 /* Setup IFP registers for AE and AWB (new, not in the logs): */
3535 if (dev->sensor_slave_address == MT9V111_I2C_SLAVE_ADDRESS) {
3536 mt9v111_setup_autoexposure(dev);
3537 mt9v111_setup_autowhitebalance(dev);
3538 mt9v111_set_autocorrections(dev, 1);
3541 if (dev->sensor_slave_address == MT9V111_I2C_SLAVE_ADDRESS)
3542 buf[0] = 0x20;
3543 else if (dev->sensor_slave_address == MT9V011_I2C_SLAVE_ADDRESS)
3544 buf[0] = 0x60;
3545 usb_microdia_control_write(dev, 0x1007, buf, 1); /* URB 2489 */
3546 if (dev->sensor_slave_address == MT9V111_I2C_SLAVE_ADDRESS)
3547 buf[0] = 0x00;
3548 else if (dev->sensor_slave_address == MT9V011_I2C_SLAVE_ADDRESS)
3549 buf[0] = 0x40;
3550 usb_microdia_control_write(dev, 0x1006, buf, 1); /* URB 2490 */
3551 /* => These two writes seem to cause the cam to start sending isochronus USB messages */
3553 return 0;
3557 * @brief Start stream from 627b devices
3559 * @param dev
3561 * @returns 0 or negative error code
3564 int microdia_627b_start_stream(struct usb_microdia *dev)
3566 int ret;
3567 /* Initialize the Bridge Controller */
3568 ret = sn9c20x_initialize(dev);
3569 /* Initialize the I2C interface in the Bridge */
3570 ret = sn9c20x_i2c_initialize(dev);
3571 /* Finally, Initialize the Sensor array */
3572 if (dev->sensor_init)
3573 dev->sensor_init(dev);
3574 return ret;
3578 * @brief From UsbSnoop-plugin-parsed.log
3580 * @param dev
3582 * @returns 0 (OK) or <0 (Error)
3584 * @author Vincent, Kuzja
3586 int microdia_6288_start_stream(struct usb_microdia *dev)
3588 int ret;
3589 __u16 reg;
3590 __u8 buf[64];
3594 reg = 0x1066 ;
3595 buf[0] = 0x00;
3596 ret = usb_microdia_control_write(dev, reg, buf, 1);
3597 if (ret < 0)
3598 goto err;
3600 reg = 0x1000 ;
3601 buf[0] = 0x78;
3602 ret = usb_microdia_control_write(dev, reg, buf, 1);
3603 if (ret < 0)
3604 goto err;
3606 reg = 0x1001 ;
3607 buf[0] = 0xc7;
3608 ret = usb_microdia_control_write(dev, reg, buf, 1);
3609 if (ret < 0)
3610 goto err;
3612 reg = 0x1002 ;
3613 buf[0] = 0x1c;
3614 ret = usb_microdia_control_write(dev, reg, buf, 1);
3615 if (ret < 0)
3616 goto err;
3618 reg = 0x1061 ;
3619 buf[0] = 0x01;
3620 ret = usb_microdia_control_write(dev, reg, buf, 1);
3621 if (ret < 0)
3622 goto err;
3624 reg = 0x1020 ;
3625 buf[0] = 0x80;
3626 ret = usb_microdia_control_write(dev, reg, buf, 1);
3627 if (ret < 0)
3628 goto err;
3630 reg = 0x1067 ;
3631 buf[0] = 0x40; buf[1] = 0x30; buf[2] = 0x20;
3632 buf[3] = 0x10; buf[4] = 0x08;
3633 ret = usb_microdia_control_write(dev, reg, buf, 5);
3634 if (ret < 0)
3635 goto err;
3637 reg = 0x10c0 ;
3638 buf[0] = 0x80; buf[1] = 0x30; buf[2] = 0x00; buf[3] = 0x00; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x00; buf[8] = 0x03;
3639 ret = usb_microdia_control_write(dev, reg, buf, 9);
3640 if (ret < 0)
3641 goto err;
3643 reg = 0x10e0 ;
3644 buf[0] = 0x44; buf[1] = 0x18; buf[2] = 0x00; buf[3] = 0x30;
3645 buf[4] = 0x00; buf[5] = 0x09; buf[6] = 0x00; buf[7] = 0xed;
3646 buf[8] = 0x0f; buf[9] = 0xda; buf[10] = 0x0f; buf[11] = 0x3a;
3647 buf[12] = 0x00; buf[13] = 0x3a; buf[14] = 0x00; buf[15] = 0xd0;
3648 buf[16] = 0x0f; buf[17] = 0xf7; buf[18] = 0x0f; buf[19] = 0x00;
3649 buf[20] = 0x00; buf[21] = 0x00; buf[22] = 0x60; buf[23] = 0x0a;
3650 ret = usb_microdia_control_write(dev, reg, buf, 24);
3651 if (ret < 0)
3652 goto err;
3654 reg = 0x10f8 ;
3655 buf[0] = 0x00; buf[1] = 0x00; buf[2] = 0x00;
3656 ret = usb_microdia_control_write(dev, reg, buf, 3);
3657 if (ret < 0)
3658 goto err;
3660 reg = 0x10fb ;
3661 buf[0] = 0x00; buf[1] = 0xa0; buf[2] = 0x00; buf[3] = 0xf0; buf[4] = 0x00;
3662 ret = usb_microdia_control_write(dev, reg, buf, 5);
3663 if (ret < 0)
3664 goto err;
3666 reg = 0x1188 ;
3667 buf[0] = 0x86; buf[1] = 0xcc; buf[2] = 0x08;
3668 ret = usb_microdia_control_write(dev, reg, buf, 3);
3669 if (ret < 0)
3670 goto err;
3672 reg = 0x118b ;
3673 buf[0] = 0x00; buf[1] = 0x20; buf[2] = 0x20; buf[3] = 0x20;
3674 buf[4] = 0x20; buf[5] = 0x00; buf[6] = 0x24; buf[7] = 0x3b;
3675 buf[8] = 0x4f; buf[9] = 0x61; buf[10] = 0x71; buf[11] = 0x80;
3676 buf[12] = 0x8f; buf[13] = 0x9d; buf[14] = 0xab; buf[15] = 0xb8;
3677 buf[16] = 0xc4; buf[17] = 0xd1; buf[18] = 0xdd; buf[19] = 0xe9;
3678 buf[20] = 0xf4; buf[21] = 0xff;
3679 ret = usb_microdia_control_write(dev, reg, buf, 22);
3680 if (ret < 0)
3681 goto err;
3683 reg = 0x11a1 ;
3684 buf[0] = 0x00; buf[1] = 0x00;
3685 ret = usb_microdia_control_write(dev, reg, buf, 2);
3686 if (ret < 0)
3687 goto err;
3689 reg = 0x11b7 ;
3690 buf[0] = 0x60; buf[1] = 0x20; buf[2] = 0x00; buf[3] = 0x08;
3691 buf[4] = 0x00; buf[5] = 0x40; buf[6] = 0x01; buf[7] = 0xf0;
3692 buf[8] = 0x00;
3693 ret = usb_microdia_control_write(dev, reg, buf, 9);
3694 if (ret < 0)
3695 goto err;
3697 reg = 0x11b8 ;
3698 buf[0] = 0x30;
3699 ret = usb_microdia_control_write(dev, reg, buf, 1);
3700 if (ret < 0)
3701 goto err;
3703 reg = 0x1000 ;
3704 buf[0] = 0x78;
3705 ret = usb_microdia_control_write(dev, reg, buf, 1);
3706 if (ret < 0)
3707 goto err;
3709 reg = 0x10c0 ;
3710 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x12; buf[3] = 0x80; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
3711 ret = usb_microdia_control_write(dev, reg, buf, 8);
3712 if (ret < 0)
3713 goto err;
3715 reg = 0x10c0 ;
3716 ret = usb_microdia_control_read(dev, reg, buf, 1);
3717 if (ret < 0)
3718 goto err;
3720 reg = 0x10c0 ;
3721 ret = usb_microdia_control_read(dev, reg, buf, 1);
3722 if (ret < 0)
3723 goto err;
3725 reg = 0x10c0 ;
3726 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x12; buf[3] = 0x01; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
3727 ret = usb_microdia_control_write(dev, reg, buf, 8);
3728 if (ret < 0)
3729 goto err;
3731 reg = 0x10c0 ;
3732 ret = usb_microdia_control_read(dev, reg, buf, 1);
3733 if (ret < 0)
3734 goto err;
3736 reg = 0x10c0 ;
3737 ret = usb_microdia_control_read(dev, reg, buf, 1);
3738 if (ret < 0)
3739 goto err;
3741 reg = 0x10c0 ;
3742 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x0d; buf[3] = 0x00; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
3743 ret = usb_microdia_control_write(dev, reg, buf, 8);
3744 if (ret < 0)
3745 goto err;
3747 reg = 0x10c0 ;
3748 ret = usb_microdia_control_read(dev, reg, buf, 1);
3749 if (ret < 0)
3750 goto err;
3752 reg = 0x10c0 ;
3753 ret = usb_microdia_control_read(dev, reg, buf, 1);
3754 if (ret < 0)
3755 goto err;
3757 reg = 0x10c0 ;
3758 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x0e; buf[3] = 0x61; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
3759 ret = usb_microdia_control_write(dev, reg, buf, 8);
3760 if (ret < 0)
3761 goto err;
3763 reg = 0x10c0 ;
3764 ret = usb_microdia_control_read(dev, reg, buf, 1);
3765 if (ret < 0)
3766 goto err;
3768 reg = 0x10c0 ;
3769 ret = usb_microdia_control_read(dev, reg, buf, 1);
3770 if (ret < 0)
3771 goto err;
3773 reg = 0x10c0 ;
3774 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x11; buf[3] = 0x80; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
3775 ret = usb_microdia_control_write(dev, reg, buf, 8);
3776 if (ret < 0)
3777 goto err;
3779 reg = 0x10c0 ;
3780 ret = usb_microdia_control_read(dev, reg, buf, 1);
3781 if (ret < 0)
3782 goto err;
3784 reg = 0x10c0 ;
3785 ret = usb_microdia_control_read(dev, reg, buf, 1);
3786 if (ret < 0)
3787 goto err;
3789 reg = 0x10c0 ;
3790 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x13; buf[3] = 0xb8; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
3791 ret = usb_microdia_control_write(dev, reg, buf, 8);
3792 if (ret < 0)
3793 goto err;
3795 reg = 0x10c0 ;
3796 ret = usb_microdia_control_read(dev, reg, buf, 1);
3797 if (ret < 0)
3798 goto err;
3800 reg = 0x10c0 ;
3801 ret = usb_microdia_control_read(dev, reg, buf, 1);
3802 if (ret < 0)
3803 goto err;
3805 reg = 0x10c0 ;
3806 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x14; buf[3] = 0x3e; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
3807 ret = usb_microdia_control_write(dev, reg, buf, 8);
3808 if (ret < 0)
3809 goto err;
3811 reg = 0x10c0 ;
3812 ret = usb_microdia_control_read(dev, reg, buf, 1);
3813 if (ret < 0)
3814 goto err;
3816 reg = 0x10c0 ;
3817 ret = usb_microdia_control_read(dev, reg, buf, 1);
3818 if (ret < 0)
3819 goto err;
3821 reg = 0x10c0 ;
3822 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x16; buf[3] = 0x24; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
3823 ret = usb_microdia_control_write(dev, reg, buf, 8);
3824 if (ret < 0)
3825 goto err;
3827 reg = 0x10c0 ;
3828 ret = usb_microdia_control_read(dev, reg, buf, 1);
3829 if (ret < 0)
3830 goto err;
3832 reg = 0x10c0 ;
3833 ret = usb_microdia_control_read(dev, reg, buf, 1);
3834 if (ret < 0)
3835 goto err;
3837 reg = 0x10c0 ;
3838 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x1e; buf[3] = 0x00; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
3839 ret = usb_microdia_control_write(dev, reg, buf, 8);
3840 if (ret < 0)
3841 goto err;
3843 reg = 0x10c0 ;
3844 ret = usb_microdia_control_read(dev, reg, buf, 1);
3845 if (ret < 0)
3846 goto err;
3848 reg = 0x10c0 ;
3849 ret = usb_microdia_control_read(dev, reg, buf, 1);
3850 if (ret < 0)
3851 goto err;
3853 reg = 0x10c0 ;
3854 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x1e; buf[3] = 0x00; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
3855 ret = usb_microdia_control_write(dev, reg, buf, 8);
3856 if (ret < 0)
3857 goto err;
3859 reg = 0x10c0 ;
3860 ret = usb_microdia_control_read(dev, reg, buf, 1);
3861 if (ret < 0)
3862 goto err;
3864 reg = 0x10c0 ;
3865 ret = usb_microdia_control_read(dev, reg, buf, 1);
3866 if (ret < 0)
3867 goto err;
3869 reg = 0x10c0 ;
3870 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x1e; buf[3] = 0x04; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
3871 ret = usb_microdia_control_write(dev, reg, buf, 8);
3872 if (ret < 0)
3873 goto err;
3875 reg = 0x10c0 ;
3876 ret = usb_microdia_control_read(dev, reg, buf, 1);
3877 if (ret < 0)
3878 goto err;
3880 reg = 0x10c0 ;
3881 ret = usb_microdia_control_read(dev, reg, buf, 1);
3882 if (ret < 0)
3883 goto err;
3885 reg = 0x10c0 ;
3886 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x27; buf[3] = 0x08; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
3887 ret = usb_microdia_control_write(dev, reg, buf, 8);
3888 if (ret < 0)
3889 goto err;
3891 reg = 0x10c0 ;
3892 ret = usb_microdia_control_read(dev, reg, buf, 1);
3893 if (ret < 0)
3894 goto err;
3896 reg = 0x10c0 ;
3897 ret = usb_microdia_control_read(dev, reg, buf, 1);
3898 if (ret < 0)
3899 goto err;
3901 reg = 0x10c0 ;
3902 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x28; buf[3] = 0x08; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
3903 ret = usb_microdia_control_write(dev, reg, buf, 8);
3904 if (ret < 0)
3905 goto err;
3907 reg = 0x10c0 ;
3908 ret = usb_microdia_control_read(dev, reg, buf, 1);
3909 if (ret < 0)
3910 goto err;
3912 reg = 0x10c0 ;
3913 ret = usb_microdia_control_read(dev, reg, buf, 1);
3914 if (ret < 0)
3915 goto err;
3917 reg = 0x10c0 ;
3918 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x29; buf[3] = 0x15; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
3919 ret = usb_microdia_control_write(dev, reg, buf, 8);
3920 if (ret < 0)
3921 goto err;
3923 reg = 0x10c0 ;
3924 ret = usb_microdia_control_read(dev, reg, buf, 1);
3925 if (ret < 0)
3926 goto err;
3928 reg = 0x10c0 ;
3929 ret = usb_microdia_control_read(dev, reg, buf, 1);
3930 if (ret < 0)
3931 goto err;
3933 reg = 0x10c0 ;
3934 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x2c; buf[3] = 0x08; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
3935 ret = usb_microdia_control_write(dev, reg, buf, 8);
3936 if (ret < 0)
3937 goto err;
3939 reg = 0x10c0 ;
3940 ret = usb_microdia_control_read(dev, reg, buf, 1);
3941 if (ret < 0)
3942 goto err;
3944 reg = 0x10c0 ;
3945 ret = usb_microdia_control_read(dev, reg, buf, 1);
3946 if (ret < 0)
3947 goto err;
3949 reg = 0x10c0 ;
3950 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x32; buf[3] = 0x80; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
3951 ret = usb_microdia_control_write(dev, reg, buf, 8);
3952 if (ret < 0)
3953 goto err;
3955 reg = 0x10c0 ;
3956 ret = usb_microdia_control_read(dev, reg, buf, 1);
3957 if (ret < 0)
3958 goto err;
3960 reg = 0x10c0 ;
3961 ret = usb_microdia_control_read(dev, reg, buf, 1);
3962 if (ret < 0)
3963 goto err;
3965 reg = 0x10c0 ;
3966 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x34; buf[3] = 0x3d; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
3967 ret = usb_microdia_control_write(dev, reg, buf, 8);
3968 if (ret < 0)
3969 goto err;
3971 reg = 0x10c0 ;
3972 ret = usb_microdia_control_read(dev, reg, buf, 1);
3973 if (ret < 0)
3974 goto err;
3976 reg = 0x10c0 ;
3977 ret = usb_microdia_control_read(dev, reg, buf, 1);
3978 if (ret < 0)
3979 goto err;
3981 reg = 0x10c0 ;
3982 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x35; buf[3] = 0x00; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
3983 ret = usb_microdia_control_write(dev, reg, buf, 8);
3984 if (ret < 0)
3985 goto err;
3987 reg = 0x10c0 ;
3988 ret = usb_microdia_control_read(dev, reg, buf, 1);
3989 if (ret < 0)
3990 goto err;
3992 reg = 0x10c0 ;
3993 ret = usb_microdia_control_read(dev, reg, buf, 1);
3994 if (ret < 0)
3995 goto err;
3997 reg = 0x10c0 ;
3998 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x36; buf[3] = 0xf8; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
3999 ret = usb_microdia_control_write(dev, reg, buf, 8);
4000 if (ret < 0)
4001 goto err;
4003 reg = 0x10c0 ;
4004 ret = usb_microdia_control_read(dev, reg, buf, 1);
4005 if (ret < 0)
4006 goto err;
4008 reg = 0x10c0 ;
4009 ret = usb_microdia_control_read(dev, reg, buf, 1);
4010 if (ret < 0)
4011 goto err;
4013 reg = 0x10c0 ;
4014 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x38; buf[3] = 0x12; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
4015 ret = usb_microdia_control_write(dev, reg, buf, 8);
4016 if (ret < 0)
4017 goto err;
4019 reg = 0x10c0 ;
4020 ret = usb_microdia_control_read(dev, reg, buf, 1);
4021 if (ret < 0)
4022 goto err;
4024 reg = 0x10c0 ;
4025 ret = usb_microdia_control_read(dev, reg, buf, 1);
4026 if (ret < 0)
4027 goto err;
4029 reg = 0x10c0 ;
4030 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x39; buf[3] = 0x57; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
4031 ret = usb_microdia_control_write(dev, reg, buf, 8);
4032 if (ret < 0)
4033 goto err;
4035 reg = 0x10c0 ;
4036 ret = usb_microdia_control_read(dev, reg, buf, 1);
4037 if (ret < 0)
4038 goto err;
4040 reg = 0x10c0 ;
4041 ret = usb_microdia_control_read(dev, reg, buf, 1);
4042 if (ret < 0)
4043 goto err;
4045 reg = 0x10c0 ;
4046 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x3a; buf[3] = 0x00; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
4047 ret = usb_microdia_control_write(dev, reg, buf, 8);
4048 if (ret < 0)
4049 goto err;
4051 reg = 0x10c0 ;
4052 ret = usb_microdia_control_read(dev, reg, buf, 1);
4053 if (ret < 0)
4054 goto err;
4056 reg = 0x10c0 ;
4057 ret = usb_microdia_control_read(dev, reg, buf, 1);
4058 if (ret < 0)
4059 goto err;
4061 reg = 0x10c0 ;
4062 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x3b; buf[3] = 0xcc; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
4063 ret = usb_microdia_control_write(dev, reg, buf, 8);
4064 if (ret < 0)
4065 goto err;
4067 reg = 0x10c0 ;
4068 ret = usb_microdia_control_read(dev, reg, buf, 1);
4069 if (ret < 0)
4070 goto err;
4072 reg = 0x10c0 ;
4073 ret = usb_microdia_control_read(dev, reg, buf, 1);
4074 if (ret < 0)
4075 goto err;
4077 reg = 0x10c0 ;
4078 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x3c; buf[3] = 0x0c; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
4079 ret = usb_microdia_control_write(dev, reg, buf, 8);
4080 if (ret < 0)
4081 goto err;
4083 reg = 0x10c0 ;
4084 ret = usb_microdia_control_read(dev, reg, buf, 1);
4085 if (ret < 0)
4086 goto err;
4088 reg = 0x10c0 ;
4089 ret = usb_microdia_control_read(dev, reg, buf, 1);
4090 if (ret < 0)
4091 goto err;
4093 reg = 0x10c0 ;
4094 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x3d; buf[3] = 0x19; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
4095 ret = usb_microdia_control_write(dev, reg, buf, 8);
4096 if (ret < 0)
4097 goto err;
4099 reg = 0x10c0 ;
4100 ret = usb_microdia_control_read(dev, reg, buf, 1);
4101 if (ret < 0)
4102 goto err;
4104 reg = 0x10c0 ;
4105 ret = usb_microdia_control_read(dev, reg, buf, 1);
4106 if (ret < 0)
4107 goto err;
4109 reg = 0x10c0 ;
4110 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x3e; buf[3] = 0x0c; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
4111 ret = usb_microdia_control_write(dev, reg, buf, 8);
4112 if (ret < 0)
4113 goto err;
4115 reg = 0x10c0 ;
4116 ret = usb_microdia_control_read(dev, reg, buf, 1);
4117 if (ret < 0)
4118 goto err;
4120 reg = 0x10c0 ;
4121 ret = usb_microdia_control_read(dev, reg, buf, 1);
4122 if (ret < 0)
4123 goto err;
4125 reg = 0x10c0 ;
4126 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x3f; buf[3] = 0x01; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
4127 ret = usb_microdia_control_write(dev, reg, buf, 8);
4128 if (ret < 0)
4129 goto err;
4131 reg = 0x10c0 ;
4132 ret = usb_microdia_control_read(dev, reg, buf, 1);
4133 if (ret < 0)
4134 goto err;
4136 reg = 0x10c0 ;
4137 ret = usb_microdia_control_read(dev, reg, buf, 1);
4138 if (ret < 0)
4139 goto err;
4141 reg = 0x10c0 ;
4142 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x41; buf[3] = 0x40; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
4143 ret = usb_microdia_control_write(dev, reg, buf, 8);
4144 if (ret < 0)
4145 goto err;
4147 reg = 0x10c0 ;
4148 ret = usb_microdia_control_read(dev, reg, buf, 1);
4149 if (ret < 0)
4150 goto err;
4152 reg = 0x10c0 ;
4153 ret = usb_microdia_control_read(dev, reg, buf, 1);
4154 if (ret < 0)
4155 goto err;
4157 reg = 0x10c0 ;
4158 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x42; buf[3] = 0x80; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
4159 ret = usb_microdia_control_write(dev, reg, buf, 8);
4160 if (ret < 0)
4161 goto err;
4163 reg = 0x10c0 ;
4164 ret = usb_microdia_control_read(dev, reg, buf, 1);
4165 if (ret < 0)
4166 goto err;
4168 reg = 0x10c0 ;
4169 ret = usb_microdia_control_read(dev, reg, buf, 1);
4170 if (ret < 0)
4171 goto err;
4173 reg = 0x10c0 ;
4174 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x45; buf[3] = 0x46; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
4175 ret = usb_microdia_control_write(dev, reg, buf, 8);
4176 if (ret < 0)
4177 goto err;
4179 reg = 0x10c0 ;
4180 ret = usb_microdia_control_read(dev, reg, buf, 1);
4181 if (ret < 0)
4182 goto err;
4184 reg = 0x10c0 ;
4185 ret = usb_microdia_control_read(dev, reg, buf, 1);
4186 if (ret < 0)
4187 goto err;
4189 reg = 0x10c0 ;
4190 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x46; buf[3] = 0x62; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
4191 ret = usb_microdia_control_write(dev, reg, buf, 8);
4192 if (ret < 0)
4193 goto err;
4195 reg = 0x10c0 ;
4196 ret = usb_microdia_control_read(dev, reg, buf, 1);
4197 if (ret < 0)
4198 goto err;
4200 reg = 0x10c0 ;
4201 ret = usb_microdia_control_read(dev, reg, buf, 1);
4202 if (ret < 0)
4203 goto err;
4205 reg = 0x10c0 ;
4206 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x47; buf[3] = 0x2a; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
4207 ret = usb_microdia_control_write(dev, reg, buf, 8);
4208 if (ret < 0)
4209 goto err;
4211 reg = 0x10c0 ;
4212 ret = usb_microdia_control_read(dev, reg, buf, 1);
4213 if (ret < 0)
4214 goto err;
4216 reg = 0x10c0 ;
4217 ret = usb_microdia_control_read(dev, reg, buf, 1);
4218 if (ret < 0)
4219 goto err;
4221 reg = 0x10c0 ;
4222 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x48; buf[3] = 0x3c; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
4223 ret = usb_microdia_control_write(dev, reg, buf, 8);
4224 if (ret < 0)
4225 goto err;
4227 reg = 0x10c0 ;
4228 ret = usb_microdia_control_read(dev, reg, buf, 1);
4229 if (ret < 0)
4230 goto err;
4232 reg = 0x10c0 ;
4233 ret = usb_microdia_control_read(dev, reg, buf, 1);
4234 if (ret < 0)
4235 goto err;
4237 reg = 0x10c0 ;
4238 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x4a; buf[3] = 0xf0; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
4239 ret = usb_microdia_control_write(dev, reg, buf, 8);
4240 if (ret < 0)
4241 goto err;
4243 reg = 0x10c0 ;
4244 ret = usb_microdia_control_read(dev, reg, buf, 1);
4245 if (ret < 0)
4246 goto err;
4248 reg = 0x10c0 ;
4249 ret = usb_microdia_control_read(dev, reg, buf, 1);
4250 if (ret < 0)
4251 goto err;
4253 reg = 0x10c0 ;
4254 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x4b; buf[3] = 0xdc; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
4255 ret = usb_microdia_control_write(dev, reg, buf, 8);
4256 if (ret < 0)
4257 goto err;
4259 reg = 0x10c0 ;
4260 ret = usb_microdia_control_read(dev, reg, buf, 1);
4261 if (ret < 0)
4262 goto err;
4264 reg = 0x10c0 ;
4265 ret = usb_microdia_control_read(dev, reg, buf, 1);
4266 if (ret < 0)
4267 goto err;
4269 reg = 0x10c0 ;
4270 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x4c; buf[3] = 0xdc; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
4271 ret = usb_microdia_control_write(dev, reg, buf, 8);
4272 if (ret < 0)
4273 goto err;
4275 reg = 0x10c0 ;
4276 ret = usb_microdia_control_read(dev, reg, buf, 1);
4277 if (ret < 0)
4278 goto err;
4280 reg = 0x10c0 ;
4281 ret = usb_microdia_control_read(dev, reg, buf, 1);
4282 if (ret < 0)
4283 goto err;
4285 reg = 0x10c0 ;
4286 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x4d; buf[3] = 0xdc; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
4287 ret = usb_microdia_control_write(dev, reg, buf, 8);
4288 if (ret < 0)
4289 goto err;
4291 reg = 0x10c0 ;
4292 ret = usb_microdia_control_read(dev, reg, buf, 1);
4293 if (ret < 0)
4294 goto err;
4296 reg = 0x10c0 ;
4297 ret = usb_microdia_control_read(dev, reg, buf, 1);
4298 if (ret < 0)
4299 goto err;
4301 reg = 0x10c0 ;
4302 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x4e; buf[3] = 0xdc; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
4303 ret = usb_microdia_control_write(dev, reg, buf, 8);
4304 if (ret < 0)
4305 goto err;
4307 reg = 0x10c0 ;
4308 ret = usb_microdia_control_read(dev, reg, buf, 1);
4309 if (ret < 0)
4310 goto err;
4312 reg = 0x10c0 ;
4313 ret = usb_microdia_control_read(dev, reg, buf, 1);
4314 if (ret < 0)
4315 goto err;
4317 reg = 0x10c0 ;
4318 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x69; buf[3] = 0x02; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
4319 ret = usb_microdia_control_write(dev, reg, buf, 8);
4320 if (ret < 0)
4321 goto err;
4323 reg = 0x10c0 ;
4324 ret = usb_microdia_control_read(dev, reg, buf, 1);
4325 if (ret < 0)
4326 goto err;
4328 reg = 0x10c0 ;
4329 ret = usb_microdia_control_read(dev, reg, buf, 1);
4330 if (ret < 0)
4331 goto err;
4333 reg = 0x10c0 ;
4334 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x6c; buf[3] = 0x04; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
4335 ret = usb_microdia_control_write(dev, reg, buf, 8);
4336 if (ret < 0)
4337 goto err;
4339 reg = 0x10c0 ;
4340 ret = usb_microdia_control_read(dev, reg, buf, 1);
4341 if (ret < 0)
4342 goto err;
4344 reg = 0x10c0 ;
4345 ret = usb_microdia_control_read(dev, reg, buf, 1);
4346 if (ret < 0)
4347 goto err;
4349 reg = 0x10c0 ;
4350 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x6f; buf[3] = 0x9e; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
4351 ret = usb_microdia_control_write(dev, reg, buf, 8);
4352 if (ret < 0)
4353 goto err;
4355 reg = 0x10c0 ;
4356 ret = usb_microdia_control_read(dev, reg, buf, 1);
4357 if (ret < 0)
4358 goto err;
4360 reg = 0x10c0 ;
4361 ret = usb_microdia_control_read(dev, reg, buf, 1);
4362 if (ret < 0)
4363 goto err;
4365 reg = 0x10c0 ;
4366 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x70; buf[3] = 0x05; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
4367 ret = usb_microdia_control_write(dev, reg, buf, 8);
4368 if (ret < 0)
4369 goto err;
4371 reg = 0x10c0 ;
4372 ret = usb_microdia_control_read(dev, reg, buf, 1);
4373 if (ret < 0)
4374 goto err;
4376 reg = 0x10c0 ;
4377 ret = usb_microdia_control_read(dev, reg, buf, 1);
4378 if (ret < 0)
4379 goto err;
4381 reg = 0x10c0 ;
4382 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x71; buf[3] = 0x78; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
4383 ret = usb_microdia_control_write(dev, reg, buf, 8);
4384 if (ret < 0)
4385 goto err;
4387 reg = 0x10c0 ;
4388 ret = usb_microdia_control_read(dev, reg, buf, 1);
4389 if (ret < 0)
4390 goto err;
4392 reg = 0x10c0 ;
4393 ret = usb_microdia_control_read(dev, reg, buf, 1);
4394 if (ret < 0)
4395 goto err;
4397 reg = 0x10c0 ;
4398 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x77; buf[3] = 0x02; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
4399 ret = usb_microdia_control_write(dev, reg, buf, 8);
4400 if (ret < 0)
4401 goto err;
4403 reg = 0x10c0 ;
4404 ret = usb_microdia_control_read(dev, reg, buf, 1);
4405 if (ret < 0)
4406 goto err;
4408 reg = 0x10c0 ;
4409 ret = usb_microdia_control_read(dev, reg, buf, 1);
4410 if (ret < 0)
4411 goto err;
4413 reg = 0x10c0 ;
4414 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x8a; buf[3] = 0x23; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
4415 ret = usb_microdia_control_write(dev, reg, buf, 8);
4416 if (ret < 0)
4417 goto err;
4419 reg = 0x10c0 ;
4420 ret = usb_microdia_control_read(dev, reg, buf, 1);
4421 if (ret < 0)
4422 goto err;
4424 reg = 0x10c0 ;
4425 ret = usb_microdia_control_read(dev, reg, buf, 1);
4426 if (ret < 0)
4427 goto err;
4429 reg = 0x10c0 ;
4430 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x8c; buf[3] = 0x0d; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
4431 ret = usb_microdia_control_write(dev, reg, buf, 8);
4432 if (ret < 0)
4433 goto err;
4435 reg = 0x10c0 ;
4436 ret = usb_microdia_control_read(dev, reg, buf, 1);
4437 if (ret < 0)
4438 goto err;
4440 reg = 0x10c0 ;
4441 ret = usb_microdia_control_read(dev, reg, buf, 1);
4442 if (ret < 0)
4443 goto err;
4445 reg = 0x10c0 ;
4446 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x90; buf[3] = 0x7e; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
4447 ret = usb_microdia_control_write(dev, reg, buf, 8);
4448 if (ret < 0)
4449 goto err;
4451 reg = 0x10c0 ;
4452 ret = usb_microdia_control_read(dev, reg, buf, 1);
4453 if (ret < 0)
4454 goto err;
4456 reg = 0x10c0 ;
4457 ret = usb_microdia_control_read(dev, reg, buf, 1);
4458 if (ret < 0)
4459 goto err;
4461 reg = 0x10c0 ;
4462 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x91; buf[3] = 0x7c; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
4463 ret = usb_microdia_control_write(dev, reg, buf, 8);
4464 if (ret < 0)
4465 goto err;
4467 reg = 0x10c0 ;
4468 ret = usb_microdia_control_read(dev, reg, buf, 1);
4469 if (ret < 0)
4470 goto err;
4472 reg = 0x10c0 ;
4473 ret = usb_microdia_control_read(dev, reg, buf, 1);
4474 if (ret < 0)
4475 goto err;
4477 reg = 0x10c0 ;
4478 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x9f; buf[3] = 0x6e; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
4479 ret = usb_microdia_control_write(dev, reg, buf, 8);
4480 if (ret < 0)
4481 goto err;
4483 reg = 0x10c0 ;
4484 ret = usb_microdia_control_read(dev, reg, buf, 1);
4485 if (ret < 0)
4486 goto err;
4488 reg = 0x10c0 ;
4489 ret = usb_microdia_control_read(dev, reg, buf, 1);
4490 if (ret < 0)
4491 goto err;
4493 reg = 0x10c0 ;
4494 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0xa0; buf[3] = 0x6e; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
4495 ret = usb_microdia_control_write(dev, reg, buf, 8);
4496 if (ret < 0)
4497 goto err;
4499 reg = 0x10c0 ;
4500 ret = usb_microdia_control_read(dev, reg, buf, 1);
4501 if (ret < 0)
4502 goto err;
4504 reg = 0x10c0 ;
4505 ret = usb_microdia_control_read(dev, reg, buf, 1);
4506 if (ret < 0)
4507 goto err;
4509 reg = 0x10c0 ;
4510 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0xa4; buf[3] = 0x50; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
4511 ret = usb_microdia_control_write(dev, reg, buf, 8);
4512 if (ret < 0)
4513 goto err;
4515 reg = 0x10c0 ;
4516 ret = usb_microdia_control_read(dev, reg, buf, 1);
4517 if (ret < 0)
4518 goto err;
4520 reg = 0x10c0 ;
4521 ret = usb_microdia_control_read(dev, reg, buf, 1);
4522 if (ret < 0)
4523 goto err;
4525 reg = 0x10c0 ;
4526 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0xa5; buf[3] = 0x68; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
4527 ret = usb_microdia_control_write(dev, reg, buf, 8);
4528 if (ret < 0)
4529 goto err;
4531 reg = 0x10c0 ;
4532 ret = usb_microdia_control_read(dev, reg, buf, 1);
4533 if (ret < 0)
4534 goto err;
4536 reg = 0x10c0 ;
4537 ret = usb_microdia_control_read(dev, reg, buf, 1);
4538 if (ret < 0)
4539 goto err;
4541 reg = 0x10c0 ;
4542 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0xa6; buf[3] = 0x60; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
4543 ret = usb_microdia_control_write(dev, reg, buf, 8);
4544 if (ret < 0)
4545 goto err;
4547 reg = 0x10c0 ;
4548 ret = usb_microdia_control_read(dev, reg, buf, 1);
4549 if (ret < 0)
4550 goto err;
4552 reg = 0x10c0 ;
4553 ret = usb_microdia_control_read(dev, reg, buf, 1);
4554 if (ret < 0)
4555 goto err;
4557 reg = 0x10c0 ;
4558 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0xa8; buf[3] = 0xc1; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
4559 ret = usb_microdia_control_write(dev, reg, buf, 8);
4560 if (ret < 0)
4561 goto err;
4563 reg = 0x10c0 ;
4564 ret = usb_microdia_control_read(dev, reg, buf, 1);
4565 if (ret < 0)
4566 goto err;
4568 reg = 0x10c0 ;
4569 ret = usb_microdia_control_read(dev, reg, buf, 1);
4570 if (ret < 0)
4571 goto err;
4573 reg = 0x10c0 ;
4574 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0xa9; buf[3] = 0xfa; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
4575 ret = usb_microdia_control_write(dev, reg, buf, 8);
4576 if (ret < 0)
4577 goto err;
4579 reg = 0x10c0 ;
4580 ret = usb_microdia_control_read(dev, reg, buf, 1);
4581 if (ret < 0)
4582 goto err;
4584 reg = 0x10c0 ;
4585 ret = usb_microdia_control_read(dev, reg, buf, 1);
4586 if (ret < 0)
4587 goto err;
4589 reg = 0x10c0 ;
4590 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0xaa; buf[3] = 0x92; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
4591 ret = usb_microdia_control_write(dev, reg, buf, 8);
4592 if (ret < 0)
4593 goto err;
4595 reg = 0x10c0 ;
4596 ret = usb_microdia_control_read(dev, reg, buf, 1);
4597 if (ret < 0)
4598 goto err;
4600 reg = 0x10c0 ;
4601 ret = usb_microdia_control_read(dev, reg, buf, 1);
4602 if (ret < 0)
4603 goto err;
4605 reg = 0x10c0 ;
4606 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0xab; buf[3] = 0x04; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
4607 ret = usb_microdia_control_write(dev, reg, buf, 8);
4608 if (ret < 0)
4609 goto err;
4611 reg = 0x10c0 ;
4612 ret = usb_microdia_control_read(dev, reg, buf, 1);
4613 if (ret < 0)
4614 goto err;
4616 reg = 0x10c0 ;
4617 ret = usb_microdia_control_read(dev, reg, buf, 1);
4618 if (ret < 0)
4619 goto err;
4621 reg = 0x10c0 ;
4622 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0xac; buf[3] = 0x80; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
4623 ret = usb_microdia_control_write(dev, reg, buf, 8);
4624 if (ret < 0)
4625 goto err;
4627 reg = 0x10c0 ;
4628 ret = usb_microdia_control_read(dev, reg, buf, 1);
4629 if (ret < 0)
4630 goto err;
4632 reg = 0x10c0 ;
4633 ret = usb_microdia_control_read(dev, reg, buf, 1);
4634 if (ret < 0)
4635 goto err;
4637 reg = 0x10c0 ;
4638 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0xad; buf[3] = 0x80; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
4639 ret = usb_microdia_control_write(dev, reg, buf, 8);
4640 if (ret < 0)
4641 goto err;
4643 reg = 0x10c0 ;
4644 ret = usb_microdia_control_read(dev, reg, buf, 1);
4645 if (ret < 0)
4646 goto err;
4648 reg = 0x10c0 ;
4649 ret = usb_microdia_control_read(dev, reg, buf, 1);
4650 if (ret < 0)
4651 goto err;
4653 reg = 0x10c0 ;
4654 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0xae; buf[3] = 0x80; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
4655 ret = usb_microdia_control_write(dev, reg, buf, 8);
4656 if (ret < 0)
4657 goto err;
4659 reg = 0x10c0 ;
4660 ret = usb_microdia_control_read(dev, reg, buf, 1);
4661 if (ret < 0)
4662 goto err;
4664 reg = 0x10c0 ;
4665 ret = usb_microdia_control_read(dev, reg, buf, 1);
4666 if (ret < 0)
4667 goto err;
4669 reg = 0x10c0 ;
4670 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0xaf; buf[3] = 0x80; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
4671 ret = usb_microdia_control_write(dev, reg, buf, 8);
4672 if (ret < 0)
4673 goto err;
4675 reg = 0x10c0 ;
4676 ret = usb_microdia_control_read(dev, reg, buf, 1);
4677 if (ret < 0)
4678 goto err;
4680 reg = 0x10c0 ;
4681 ret = usb_microdia_control_read(dev, reg, buf, 1);
4682 if (ret < 0)
4683 goto err;
4685 reg = 0x10c0 ;
4686 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0xb2; buf[3] = 0xf2; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
4687 ret = usb_microdia_control_write(dev, reg, buf, 8);
4688 if (ret < 0)
4689 goto err;
4691 reg = 0x10c0 ;
4692 ret = usb_microdia_control_read(dev, reg, buf, 1);
4693 if (ret < 0)
4694 goto err;
4696 reg = 0x10c0 ;
4697 ret = usb_microdia_control_read(dev, reg, buf, 1);
4698 if (ret < 0)
4699 goto err;
4701 reg = 0x10c0 ;
4702 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0xb3; buf[3] = 0x20; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
4703 ret = usb_microdia_control_write(dev, reg, buf, 8);
4704 if (ret < 0)
4705 goto err;
4707 reg = 0x10c0 ;
4708 ret = usb_microdia_control_read(dev, reg, buf, 1);
4709 if (ret < 0)
4710 goto err;
4712 reg = 0x10c0 ;
4713 ret = usb_microdia_control_read(dev, reg, buf, 1);
4714 if (ret < 0)
4715 goto err;
4717 reg = 0x10c0 ;
4718 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0xb4; buf[3] = 0x20; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
4719 ret = usb_microdia_control_write(dev, reg, buf, 8);
4720 if (ret < 0)
4721 goto err;
4723 reg = 0x10c0 ;
4724 ret = usb_microdia_control_read(dev, reg, buf, 1);
4725 if (ret < 0)
4726 goto err;
4728 reg = 0x10c0 ;
4729 ret = usb_microdia_control_read(dev, reg, buf, 1);
4730 if (ret < 0)
4731 goto err;
4733 reg = 0x10c0 ;
4734 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0xb5; buf[3] = 0x00; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
4735 ret = usb_microdia_control_write(dev, reg, buf, 8);
4736 if (ret < 0)
4737 goto err;
4739 reg = 0x10c0 ;
4740 ret = usb_microdia_control_read(dev, reg, buf, 1);
4741 if (ret < 0)
4742 goto err;
4744 reg = 0x10c0 ;
4745 ret = usb_microdia_control_read(dev, reg, buf, 1);
4746 if (ret < 0)
4747 goto err;
4749 reg = 0x10c0 ;
4750 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0xb6; buf[3] = 0xaf; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
4751 ret = usb_microdia_control_write(dev, reg, buf, 8);
4752 if (ret < 0)
4753 goto err;
4755 reg = 0x10c0 ;
4756 ret = usb_microdia_control_read(dev, reg, buf, 1);
4757 if (ret < 0)
4758 goto err;
4760 reg = 0x10c0 ;
4761 ret = usb_microdia_control_read(dev, reg, buf, 1);
4762 if (ret < 0)
4763 goto err;
4765 reg = 0x10c0 ;
4766 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0xbb; buf[3] = 0xae; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
4767 ret = usb_microdia_control_write(dev, reg, buf, 8);
4768 if (ret < 0)
4769 goto err;
4771 reg = 0x10c0 ;
4772 ret = usb_microdia_control_read(dev, reg, buf, 1);
4773 if (ret < 0)
4774 goto err;
4776 reg = 0x10c0 ;
4777 ret = usb_microdia_control_read(dev, reg, buf, 1);
4778 if (ret < 0)
4779 goto err;
4781 reg = 0x10c0 ;
4782 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0xbc; buf[3] = 0x44; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
4783 ret = usb_microdia_control_write(dev, reg, buf, 8);
4784 if (ret < 0)
4785 goto err;
4787 reg = 0x10c0 ;
4788 ret = usb_microdia_control_read(dev, reg, buf, 1);
4789 if (ret < 0)
4790 goto err;
4792 reg = 0x10c0 ;
4793 ret = usb_microdia_control_read(dev, reg, buf, 1);
4794 if (ret < 0)
4795 goto err;
4797 reg = 0x10c0 ;
4798 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0xbd; buf[3] = 0x44; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
4799 ret = usb_microdia_control_write(dev, reg, buf, 8);
4800 if (ret < 0)
4801 goto err;
4803 reg = 0x10c0 ;
4804 ret = usb_microdia_control_read(dev, reg, buf, 1);
4805 if (ret < 0)
4806 goto err;
4808 reg = 0x10c0 ;
4809 ret = usb_microdia_control_read(dev, reg, buf, 1);
4810 if (ret < 0)
4811 goto err;
4813 reg = 0x10c0 ;
4814 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0xbe; buf[3] = 0x3b; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
4815 ret = usb_microdia_control_write(dev, reg, buf, 8);
4816 if (ret < 0)
4817 goto err;
4819 reg = 0x10c0 ;
4820 ret = usb_microdia_control_read(dev, reg, buf, 1);
4821 if (ret < 0)
4822 goto err;
4824 reg = 0x10c0 ;
4825 ret = usb_microdia_control_read(dev, reg, buf, 1);
4826 if (ret < 0)
4827 goto err;
4829 reg = 0x10c0 ;
4830 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0xbf; buf[3] = 0x3a; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
4831 ret = usb_microdia_control_write(dev, reg, buf, 8);
4832 if (ret < 0)
4833 goto err;
4835 reg = 0x10c0 ;
4836 ret = usb_microdia_control_read(dev, reg, buf, 1);
4837 if (ret < 0)
4838 goto err;
4840 reg = 0x10c0 ;
4841 ret = usb_microdia_control_read(dev, reg, buf, 1);
4842 if (ret < 0)
4843 goto err;
4845 reg = 0x10c0 ;
4846 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0xc0; buf[3] = 0xe2; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
4847 ret = usb_microdia_control_write(dev, reg, buf, 8);
4848 if (ret < 0)
4849 goto err;
4851 reg = 0x10c0 ;
4852 ret = usb_microdia_control_read(dev, reg, buf, 1);
4853 if (ret < 0)
4854 goto err;
4856 reg = 0x10c0 ;
4857 ret = usb_microdia_control_read(dev, reg, buf, 1);
4858 if (ret < 0)
4859 goto err;
4861 reg = 0x10c0 ;
4862 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0xc1; buf[3] = 0xc8; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
4863 ret = usb_microdia_control_write(dev, reg, buf, 8);
4864 if (ret < 0)
4865 goto err;
4867 reg = 0x10c0 ;
4868 ret = usb_microdia_control_read(dev, reg, buf, 1);
4869 if (ret < 0)
4870 goto err;
4872 reg = 0x10c0 ;
4873 ret = usb_microdia_control_read(dev, reg, buf, 1);
4874 if (ret < 0)
4875 goto err;
4877 reg = 0x10c0 ;
4878 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0xc2; buf[3] = 0x01; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
4879 ret = usb_microdia_control_write(dev, reg, buf, 8);
4880 if (ret < 0)
4881 goto err;
4883 reg = 0x10c0 ;
4884 ret = usb_microdia_control_read(dev, reg, buf, 1);
4885 if (ret < 0)
4886 goto err;
4888 reg = 0x10c0 ;
4889 ret = usb_microdia_control_read(dev, reg, buf, 1);
4890 if (ret < 0)
4891 goto err;
4893 reg = 0x10c0 ;
4894 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0xc4; buf[3] = 0x00; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
4895 ret = usb_microdia_control_write(dev, reg, buf, 8);
4896 if (ret < 0)
4897 goto err;
4899 reg = 0x10c0 ;
4900 ret = usb_microdia_control_read(dev, reg, buf, 1);
4901 if (ret < 0)
4902 goto err;
4904 reg = 0x10c0 ;
4905 ret = usb_microdia_control_read(dev, reg, buf, 1);
4906 if (ret < 0)
4907 goto err;
4909 reg = 0x10c0 ;
4910 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0xc6; buf[3] = 0x85; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
4911 ret = usb_microdia_control_write(dev, reg, buf, 8);
4912 if (ret < 0)
4913 goto err;
4915 reg = 0x10c0 ;
4916 ret = usb_microdia_control_read(dev, reg, buf, 1);
4917 if (ret < 0)
4918 goto err;
4920 reg = 0x10c0 ;
4921 ret = usb_microdia_control_read(dev, reg, buf, 1);
4922 if (ret < 0)
4923 goto err;
4925 reg = 0x10c0 ;
4926 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0xc7; buf[3] = 0x81; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
4927 ret = usb_microdia_control_write(dev, reg, buf, 8);
4928 if (ret < 0)
4929 goto err;
4931 reg = 0x10c0 ;
4932 ret = usb_microdia_control_read(dev, reg, buf, 1);
4933 if (ret < 0)
4934 goto err;
4936 reg = 0x10c0 ;
4937 ret = usb_microdia_control_read(dev, reg, buf, 1);
4938 if (ret < 0)
4939 goto err;
4941 reg = 0x10c0 ;
4942 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0xc9; buf[3] = 0xe0; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
4943 ret = usb_microdia_control_write(dev, reg, buf, 8);
4944 if (ret < 0)
4945 goto err;
4947 reg = 0x10c0 ;
4948 ret = usb_microdia_control_read(dev, reg, buf, 1);
4949 if (ret < 0)
4950 goto err;
4952 reg = 0x10c0 ;
4953 ret = usb_microdia_control_read(dev, reg, buf, 1);
4954 if (ret < 0)
4955 goto err;
4957 reg = 0x10c0 ;
4958 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0xca; buf[3] = 0xe8; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
4959 ret = usb_microdia_control_write(dev, reg, buf, 8);
4960 if (ret < 0)
4961 goto err;
4963 reg = 0x10c0 ;
4964 ret = usb_microdia_control_read(dev, reg, buf, 1);
4965 if (ret < 0)
4966 goto err;
4968 reg = 0x10c0 ;
4969 ret = usb_microdia_control_read(dev, reg, buf, 1);
4970 if (ret < 0)
4971 goto err;
4973 reg = 0x10c0 ;
4974 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0xcc; buf[3] = 0xd8; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
4975 ret = usb_microdia_control_write(dev, reg, buf, 8);
4976 if (ret < 0)
4977 goto err;
4979 reg = 0x10c0 ;
4980 ret = usb_microdia_control_read(dev, reg, buf, 1);
4981 if (ret < 0)
4982 goto err;
4984 reg = 0x10c0 ;
4985 ret = usb_microdia_control_read(dev, reg, buf, 1);
4986 if (ret < 0)
4987 goto err;
4989 reg = 0x10c0 ;
4990 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0xcd; buf[3] = 0x93; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
4991 ret = usb_microdia_control_write(dev, reg, buf, 8);
4992 if (ret < 0)
4993 goto err;
4995 reg = 0x10c0 ;
4996 ret = usb_microdia_control_read(dev, reg, buf, 1);
4997 if (ret < 0)
4998 goto err;
5000 reg = 0x10c0 ;
5001 ret = usb_microdia_control_read(dev, reg, buf, 1);
5002 if (ret < 0)
5003 goto err;
5005 reg = 0x10c1 ;
5006 ret = usb_microdia_control_read(dev, reg, buf, 1);
5007 if (ret < 0)
5008 goto err;
5010 reg = 0x10c1 ;
5011 buf[0] = 0x50;
5012 ret = usb_microdia_control_write(dev, reg, buf, 1);
5013 if (ret < 0)
5014 goto err;
5016 reg = 0x10c0 ;
5017 buf[0] = 0x90; buf[1] = 0x50; buf[2] = 0x00; buf[3] = 0x00; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
5018 ret = usb_microdia_control_write(dev, reg, buf, 8);
5019 if (ret < 0)
5020 goto err;
5022 reg = 0x10c0 ;
5023 ret = usb_microdia_control_read(dev, reg, buf, 1);
5024 if (ret < 0)
5025 goto err;
5027 reg = 0x10c0 ;
5028 buf[0] = 0x90; buf[1] = 0x50; buf[2] = 0x00; buf[3] = 0x00; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
5029 ret = usb_microdia_control_write(dev, reg, buf, 8);
5030 if (ret < 0)
5031 goto err;
5033 reg = 0x10c0 ;
5034 ret = usb_microdia_control_read(dev, reg, buf, 1);
5035 if (ret < 0)
5036 goto err;
5038 reg = 0x10c0 ;
5039 buf[0] = 0x90; buf[1] = 0x50; buf[2] = 0x00; buf[3] = 0x00; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
5040 ret = usb_microdia_control_write(dev, reg, buf, 8);
5041 if (ret < 0)
5042 goto err;
5044 reg = 0x10c0 ;
5045 ret = usb_microdia_control_read(dev, reg, buf, 1);
5046 if (ret < 0)
5047 goto err;
5049 reg = 0x10c0 ;
5050 buf[0] = 0x90; buf[1] = 0x50; buf[2] = 0x00; buf[3] = 0x00; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
5051 ret = usb_microdia_control_write(dev, reg, buf, 8);
5052 if (ret < 0)
5053 goto err;
5055 reg = 0x10c0 ;
5056 ret = usb_microdia_control_read(dev, reg, buf, 1);
5057 if (ret < 0)
5058 goto err;
5060 reg = 0x10c0 ;
5061 buf[0] = 0x90; buf[1] = 0x50; buf[2] = 0x00; buf[3] = 0x00; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
5062 ret = usb_microdia_control_write(dev, reg, buf, 8);
5063 if (ret < 0)
5064 goto err;
5066 reg = 0x10c0 ;
5067 ret = usb_microdia_control_read(dev, reg, buf, 1);
5068 if (ret < 0)
5069 goto err;
5071 reg = 0x10c0 ;
5072 buf[0] = 0x90; buf[1] = 0x50; buf[2] = 0x00; buf[3] = 0x00; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
5073 ret = usb_microdia_control_write(dev, reg, buf, 8);
5074 if (ret < 0)
5075 goto err;
5077 reg = 0x10c0 ;
5078 ret = usb_microdia_control_read(dev, reg, buf, 1);
5079 if (ret < 0)
5080 goto err;
5082 reg = 0x10c0 ;
5083 buf[0] = 0x90; buf[1] = 0x50; buf[2] = 0x00; buf[3] = 0x00; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
5084 ret = usb_microdia_control_write(dev, reg, buf, 8);
5085 if (ret < 0)
5086 goto err;
5088 reg = 0x10c0 ;
5089 ret = usb_microdia_control_read(dev, reg, buf, 1);
5090 if (ret < 0)
5091 goto err;
5093 reg = 0x10c0 ;
5094 buf[0] = 0x90; buf[1] = 0x50; buf[2] = 0x00; buf[3] = 0x00; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
5095 ret = usb_microdia_control_write(dev, reg, buf, 8);
5096 if (ret < 0)
5097 goto err;
5099 reg = 0x10c0 ;
5100 ret = usb_microdia_control_read(dev, reg, buf, 1);
5101 if (ret < 0)
5102 goto err;
5104 reg = 0x10c0 ;
5105 buf[0] = 0x90; buf[1] = 0x50; buf[2] = 0x00; buf[3] = 0x00; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
5106 ret = usb_microdia_control_write(dev, reg, buf, 8);
5107 if (ret < 0)
5108 goto err;
5110 reg = 0x10c0 ;
5111 buf[0] = 0x92; buf[1] = 0x50; buf[2] = 0x00; buf[3] = 0x00; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
5112 ret = usb_microdia_control_write(dev, reg, buf, 8);
5113 if (ret < 0)
5114 goto err;
5116 reg = 0x10c0 ;
5117 ret = usb_microdia_control_read(dev, reg, buf, 1);
5118 if (ret < 0)
5119 goto err;
5121 reg = 0x10c0 ;
5122 buf[0] = 0x92; buf[1] = 0x50; buf[2] = 0x00; buf[3] = 0x00; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
5123 ret = usb_microdia_control_write(dev, reg, buf, 8);
5124 if (ret < 0)
5125 goto err;
5127 reg = 0x10c0 ;
5128 ret = usb_microdia_control_read(dev, reg, buf, 1);
5129 if (ret < 0)
5130 goto err;
5132 reg = 0x10c0 ;
5133 buf[0] = 0x92; buf[1] = 0x50; buf[2] = 0x00; buf[3] = 0x00; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
5134 ret = usb_microdia_control_write(dev, reg, buf, 8);
5135 if (ret < 0)
5136 goto err;
5138 reg = 0x10c0 ;
5139 ret = usb_microdia_control_read(dev, reg, buf, 1);
5140 if (ret < 0)
5141 goto err;
5143 reg = 0x10c0 ;
5144 buf[0] = 0x92; buf[1] = 0x50; buf[2] = 0x00; buf[3] = 0x00; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
5145 ret = usb_microdia_control_write(dev, reg, buf, 8);
5146 if (ret < 0)
5147 goto err;
5149 reg = 0x10c0 ;
5150 ret = usb_microdia_control_read(dev, reg, buf, 1);
5151 if (ret < 0)
5152 goto err;
5154 reg = 0x10c0 ;
5155 buf[0] = 0x92; buf[1] = 0x50; buf[2] = 0x00; buf[3] = 0x00; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
5156 ret = usb_microdia_control_write(dev, reg, buf, 8);
5157 if (ret < 0)
5158 goto err;
5160 reg = 0x10c0 ;
5161 ret = usb_microdia_control_read(dev, reg, buf, 1);
5162 if (ret < 0)
5163 goto err;
5165 reg = 0x10c0 ;
5166 buf[0] = 0x92; buf[1] = 0x50; buf[2] = 0x00; buf[3] = 0x00; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
5167 ret = usb_microdia_control_write(dev, reg, buf, 8);
5168 if (ret < 0)
5169 goto err;
5171 reg = 0x10c0 ;
5172 ret = usb_microdia_control_read(dev, reg, buf, 1);
5173 if (ret < 0)
5174 goto err;
5176 reg = 0x10c0 ;
5177 buf[0] = 0x92; buf[1] = 0x50; buf[2] = 0x00; buf[3] = 0x00; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
5178 ret = usb_microdia_control_write(dev, reg, buf, 8);
5179 if (ret < 0)
5180 goto err;
5182 reg = 0x10c0 ;
5183 ret = usb_microdia_control_read(dev, reg, buf, 1);
5184 if (ret < 0)
5185 goto err;
5187 reg = 0x10c0 ;
5188 buf[0] = 0x92; buf[1] = 0x50; buf[2] = 0x00; buf[3] = 0x00; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
5189 ret = usb_microdia_control_write(dev, reg, buf, 8);
5190 if (ret < 0)
5191 goto err;
5193 reg = 0x10c0 ;
5194 ret = usb_microdia_control_read(dev, reg, buf, 1);
5195 if (ret < 0)
5196 goto err;
5198 reg = 0x10c0 ;
5199 buf[0] = 0x92; buf[1] = 0x50; buf[2] = 0x00; buf[3] = 0x00; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
5200 ret = usb_microdia_control_write(dev, reg, buf, 8);
5201 if (ret < 0)
5202 goto err;
5204 reg = 0x10c2 ;
5205 ret = usb_microdia_control_read(dev, reg, buf, 5);
5206 if (ret < 0)
5207 goto err;
5209 reg = 0x10c1 ;
5210 buf[0] = 0x30;
5211 ret = usb_microdia_control_write(dev, reg, buf, 1);
5212 if (ret < 0)
5213 goto err;
5215 reg = 0x10e0 ;
5216 buf[0] = 0x47;
5217 ret = usb_microdia_control_write(dev, reg, buf, 1);
5218 if (ret < 0)
5219 goto err;
5221 reg = 0x10e0 ;
5222 buf[0] = 0x47;
5223 ret = usb_microdia_control_write(dev, reg, buf, 1);
5224 if (ret < 0)
5225 goto err;
5227 reg = 0x1001 ;
5228 buf[0] = 0xc6;
5229 ret = usb_microdia_control_write(dev, reg, buf, 1);
5230 if (ret < 0)
5231 goto err;
5233 reg = 0x1001 ;
5234 buf[0] = 0xc4;
5235 ret = usb_microdia_control_write(dev, reg, buf, 1);
5236 if (ret < 0)
5237 goto err;
5239 reg = 0x1001 ;
5240 buf[0] = 0x84;
5241 ret = usb_microdia_control_write(dev, reg, buf, 1);
5242 if (ret < 0)
5243 goto err;
5245 reg = 0x1189 ;
5246 buf[0] = 0xcc;
5247 ret = usb_microdia_control_write(dev, reg, buf, 1);
5248 if (ret < 0)
5249 goto err;
5251 reg = 0x11bc ;
5252 buf[0] = 0x00;
5253 ret = usb_microdia_control_write(dev, reg, buf, 1);
5254 if (ret < 0)
5255 goto err;
5257 reg = 0x11bd ;
5258 buf[0] = 0x00;
5259 ret = usb_microdia_control_write(dev, reg, buf, 1);
5260 if (ret < 0)
5261 goto err;
5263 reg = 0x11be ;
5264 buf[0] = 0x00;
5265 ret = usb_microdia_control_write(dev, reg, buf, 1);
5266 if (ret < 0)
5267 goto err;
5269 reg = 0x11bf ;
5270 buf[0] = 0x00;
5271 ret = usb_microdia_control_write(dev, reg, buf, 1);
5272 if (ret < 0)
5273 goto err;
5275 reg = 0x10c0 ;
5276 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x03; buf[3] = 0x14; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
5277 ret = usb_microdia_control_write(dev, reg, buf, 8);
5278 if (ret < 0)
5279 goto err;
5281 reg = 0x10c0 ;
5282 ret = usb_microdia_control_read(dev, reg, buf, 1);
5283 if (ret < 0)
5284 goto err;
5286 reg = 0x10c0 ;
5287 ret = usb_microdia_control_read(dev, reg, buf, 1);
5288 if (ret < 0)
5289 goto err;
5291 reg = 0x10c0 ;
5292 buf[0] = 0xd0; buf[1] = 0x30; buf[2] = 0x17; buf[3] = 0x1b; buf[4] = 0xbc; buf[5] = 0x01; buf[6] = 0x7a; buf[7] = 0x10;
5293 ret = usb_microdia_control_write(dev, reg, buf, 8);
5294 if (ret < 0)
5295 goto err;
5297 reg = 0x10c0 ;
5298 ret = usb_microdia_control_read(dev, reg, buf, 1);
5299 if (ret < 0)
5300 goto err;
5302 reg = 0x10c0 ;
5303 ret = usb_microdia_control_read(dev, reg, buf, 1);
5304 if (ret < 0)
5305 goto err;
5307 reg = 0x10c0 ;
5308 buf[0] = 0x90; buf[1] = 0x30; buf[2] = 0x1b; buf[3] = 0x00; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
5309 ret = usb_microdia_control_write(dev, reg, buf, 8);
5310 if (ret < 0)
5311 goto err;
5313 reg = 0x10c0 ;
5314 ret = usb_microdia_control_read(dev, reg, buf, 1);
5315 if (ret < 0)
5316 goto err;
5318 reg = 0x10c0 ;
5319 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x32; buf[3] = 0x82; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
5320 ret = usb_microdia_control_write(dev, reg, buf, 8);
5321 if (ret < 0)
5322 goto err;
5324 reg = 0x10c0 ;
5325 ret = usb_microdia_control_read(dev, reg, buf, 1);
5326 if (ret < 0)
5327 goto err;
5329 reg = 0x10c0 ;
5330 ret = usb_microdia_control_read(dev, reg, buf, 1);
5331 if (ret < 0)
5332 goto err;
5334 reg = 0x1180 ;
5335 buf[0] = 0x05; buf[1] = 0x00; buf[2] = 0x01; buf[3] = 0x00; buf[4] = 0x50; buf[5] = 0x78;
5336 ret = usb_microdia_control_write(dev, reg, buf, 6);
5337 if (ret < 0)
5338 goto err;
5340 reg = 0x10fb ;
5341 buf[0] = 0x00; buf[1] = 0xa0; buf[2] = 0x00; buf[3] = 0xf0; buf[4] = 0x00;
5342 ret = usb_microdia_control_write(dev, reg, buf, 5);
5343 if (ret < 0)
5344 goto err;
5346 reg = 0x1189 ;
5347 buf[0] = 0xdc;
5348 ret = usb_microdia_control_write(dev, reg, buf, 1);
5349 if (ret < 0)
5350 goto err;
5352 reg = 0x1189 ;
5353 buf[0] = 0xd0;
5354 ret = usb_microdia_control_write(dev, reg, buf, 1);
5355 if (ret < 0)
5356 goto err;
5358 reg = 0x11a1 ;
5359 buf[0] = 0x00; buf[1] = 0x00; buf[2] = 0xd5; buf[3] = 0xa0;
5360 ret = usb_microdia_control_write(dev, reg, buf, 4);
5361 if (ret < 0)
5362 goto err;
5364 reg = 0x11ab ;
5365 buf[0] = 0x00; buf[1] = 0x00; buf[2] = 0xa0; buf[3] = 0x78;
5366 ret = usb_microdia_control_write(dev, reg, buf, 4);
5367 if (ret < 0)
5368 goto err;
5370 reg = 0x1000 ;
5371 buf[0] = 0x78;
5372 ret = usb_microdia_control_write(dev, reg, buf, 1);
5373 if (ret < 0)
5374 goto err;
5376 reg = 0x1002 ;
5377 buf[0] = 0x18;
5378 ret = usb_microdia_control_write(dev, reg, buf, 1);
5379 if (ret < 0)
5380 goto err;
5382 reg = 0x1002 ;
5383 buf[0] = 0x08;
5384 ret = usb_microdia_control_write(dev, reg, buf, 1);
5385 if (ret < 0)
5386 goto err;
5388 reg = 0x11b8 ;
5389 buf[0] = 0x38;
5390 ret = usb_microdia_control_write(dev, reg, buf, 1);
5391 if (ret < 0)
5392 goto err;
5394 reg = 0x118a ;
5395 buf[0] = 0x02;
5396 ret = usb_microdia_control_write(dev, reg, buf, 1);
5397 if (ret < 0)
5398 goto err;
5400 reg = 0x0395 ;
5401 buf[0] = 0x02;
5402 ret = usb_microdia_control_write(dev, reg, buf, 1);
5403 if (ret < 0)
5404 goto err;
5406 reg = 0x11b8 ;
5407 buf[0] = 0x78;
5408 ret = usb_microdia_control_write(dev, reg, buf, 1);
5409 if (ret < 0)
5410 goto err;
5412 reg = 0x11b8 ;
5413 ret = usb_microdia_control_read(dev, reg, buf, 1);
5414 if (ret < 0)
5415 goto err;
5417 reg = 0x11b8 ;
5418 buf[0] = 0xf9;
5419 ret = usb_microdia_control_write(dev, reg, buf, 1);
5420 if (ret < 0)
5421 goto err;
5423 reg = 0x11b8 ;
5424 ret = usb_microdia_control_read(dev, reg, buf, 1);
5425 if (ret < 0)
5426 goto err;
5428 reg = 0x11b8 ;
5429 buf[0] = 0x7a;
5430 ret = usb_microdia_control_write(dev, reg, buf, 1);
5431 if (ret < 0)
5432 goto err;
5434 reg = 0x11b8 ;
5435 ret = usb_microdia_control_read(dev, reg, buf, 1);
5436 if (ret < 0)
5437 goto err;
5439 reg = 0x11b8 ;
5440 buf[0] = 0x7b;
5441 ret = usb_microdia_control_write(dev, reg, buf, 1);
5442 if (ret < 0)
5443 goto err;
5445 reg = 0x11b8 ;
5446 ret = usb_microdia_control_read(dev, reg, buf, 1);
5447 if (ret < 0)
5448 goto err;
5450 reg = 0x11b8 ;
5451 buf[0] = 0x7c;
5452 ret = usb_microdia_control_write(dev, reg, buf, 1);
5453 if (ret < 0)
5454 goto err;
5456 reg = 0x11b8 ;
5457 ret = usb_microdia_control_read(dev, reg, buf, 1);
5458 if (ret < 0)
5459 goto err;
5461 reg = 0x11b8 ;
5462 buf[0] = 0xfd;
5463 ret = usb_microdia_control_write(dev, reg, buf, 1);
5464 if (ret < 0)
5465 goto err;
5467 reg = 0x11b8 ;
5468 ret = usb_microdia_control_read(dev, reg, buf, 1);
5469 if (ret < 0)
5470 goto err;
5472 reg = 0x11b8 ;
5473 buf[0] = 0xfa;
5474 ret = usb_microdia_control_write(dev, reg, buf, 1);
5475 if (ret < 0)
5476 goto err;
5478 reg = 0x10c0 ;
5479 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x11; buf[3] = 0x80; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
5480 ret = usb_microdia_control_write(dev, reg, buf, 8);
5481 if (ret < 0)
5482 goto err;
5484 reg = 0x10c0 ;
5485 ret = usb_microdia_control_read(dev, reg, buf, 1);
5486 if (ret < 0)
5487 goto err;
5489 reg = 0x10c0 ;
5490 ret = usb_microdia_control_read(dev, reg, buf, 1);
5491 if (ret < 0)
5492 goto err;
5494 reg = 0x10c0 ;
5495 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x2a; buf[3] = 0x00; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
5496 ret = usb_microdia_control_write(dev, reg, buf, 8);
5497 if (ret < 0)
5498 goto err;
5500 reg = 0x10c0 ;
5501 ret = usb_microdia_control_read(dev, reg, buf, 1);
5502 if (ret < 0)
5503 goto err;
5505 reg = 0x10c0 ;
5506 ret = usb_microdia_control_read(dev, reg, buf, 1);
5507 if (ret < 0)
5508 goto err;
5510 reg = 0x10c0 ;
5511 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x2b; buf[3] = 0x06; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
5512 ret = usb_microdia_control_write(dev, reg, buf, 8);
5513 if (ret < 0)
5514 goto err;
5516 reg = 0x10c0 ;
5517 ret = usb_microdia_control_read(dev, reg, buf, 1);
5518 if (ret < 0)
5519 goto err;
5521 reg = 0x10c0 ;
5522 ret = usb_microdia_control_read(dev, reg, buf, 1);
5523 if (ret < 0)
5524 goto err;
5526 reg = 0x10c0 ;
5527 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x92; buf[3] = 0x00; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
5528 ret = usb_microdia_control_write(dev, reg, buf, 8);
5529 if (ret < 0)
5530 goto err;
5532 reg = 0x10c0 ;
5533 ret = usb_microdia_control_read(dev, reg, buf, 1);
5534 if (ret < 0)
5535 goto err;
5537 reg = 0x10c0 ;
5538 ret = usb_microdia_control_read(dev, reg, buf, 1);
5539 if (ret < 0)
5540 goto err;
5542 reg = 0x10c0 ;
5543 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x93; buf[3] = 0x00; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
5544 ret = usb_microdia_control_write(dev, reg, buf, 8);
5545 if (ret < 0)
5546 goto err;
5548 reg = 0x10c0 ;
5549 ret = usb_microdia_control_read(dev, reg, buf, 1);
5550 if (ret < 0)
5551 goto err;
5553 reg = 0x10c0 ;
5554 ret = usb_microdia_control_read(dev, reg, buf, 1);
5555 if (ret < 0)
5556 goto err;
5558 reg = 0x10c0 ;
5559 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x1e; buf[3] = 0x04; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
5560 ret = usb_microdia_control_write(dev, reg, buf, 8);
5561 if (ret < 0)
5562 goto err;
5564 reg = 0x10c0 ;
5565 ret = usb_microdia_control_read(dev, reg, buf, 1);
5566 if (ret < 0)
5567 goto err;
5569 reg = 0x10c0 ;
5570 ret = usb_microdia_control_read(dev, reg, buf, 1);
5571 if (ret < 0)
5572 goto err;
5574 reg = 0x10c0 ;
5575 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x1e; buf[3] = 0x04; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
5576 ret = usb_microdia_control_write(dev, reg, buf, 8);
5577 if (ret < 0)
5578 goto err;
5580 reg = 0x10c0 ;
5581 ret = usb_microdia_control_read(dev, reg, buf, 1);
5582 if (ret < 0)
5583 goto err;
5585 reg = 0x10c0 ;
5586 ret = usb_microdia_control_read(dev, reg, buf, 1);
5587 if (ret < 0)
5588 goto err;
5590 reg = 0x1182 ;
5591 buf[0] = 0x01;
5592 ret = usb_microdia_control_write(dev, reg, buf, 1);
5593 if (ret < 0)
5594 goto err;
5596 reg = 0x10c0 ;
5597 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x10; buf[3] = 0x7d; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
5598 ret = usb_microdia_control_write(dev, reg, buf, 8);
5599 if (ret < 0)
5600 goto err;
5602 reg = 0x10c0 ;
5603 ret = usb_microdia_control_read(dev, reg, buf, 1);
5604 if (ret < 0)
5605 goto err;
5607 reg = 0x10c0 ;
5608 ret = usb_microdia_control_read(dev, reg, buf, 1);
5609 if (ret < 0)
5610 goto err;
5612 reg = 0x10c0 ;
5613 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x04; buf[3] = 0x00; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
5614 ret = usb_microdia_control_write(dev, reg, buf, 8);
5615 if (ret < 0)
5616 goto err;
5618 reg = 0x10c0 ;
5619 ret = usb_microdia_control_read(dev, reg, buf, 1);
5620 if (ret < 0)
5621 goto err;
5623 reg = 0x10c0 ;
5624 ret = usb_microdia_control_read(dev, reg, buf, 1);
5625 if (ret < 0)
5626 goto err;
5628 reg = 0x10c0 ;
5629 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0xa1; buf[3] = 0x00; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
5630 ret = usb_microdia_control_write(dev, reg, buf, 8);
5631 if (ret < 0)
5632 goto err;
5634 reg = 0x10c0 ;
5635 ret = usb_microdia_control_read(dev, reg, buf, 1);
5636 if (ret < 0)
5637 goto err;
5639 reg = 0x10c0 ;
5640 ret = usb_microdia_control_read(dev, reg, buf, 1);
5641 if (ret < 0)
5642 goto err;
5644 reg = 0x10c0 ;
5645 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x2d; buf[3] = 0x00; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
5646 ret = usb_microdia_control_write(dev, reg, buf, 8);
5647 if (ret < 0)
5648 goto err;
5650 reg = 0x10c0 ;
5651 ret = usb_microdia_control_read(dev, reg, buf, 1);
5652 if (ret < 0)
5653 goto err;
5655 reg = 0x10c0 ;
5656 ret = usb_microdia_control_read(dev, reg, buf, 1);
5657 if (ret < 0)
5658 goto err;
5660 reg = 0x10c0 ;
5661 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x2e; buf[3] = 0x00; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
5662 ret = usb_microdia_control_write(dev, reg, buf, 8);
5663 if (ret < 0)
5664 goto err;
5666 reg = 0x10c0 ;
5667 ret = usb_microdia_control_read(dev, reg, buf, 1);
5668 if (ret < 0)
5669 goto err;
5671 reg = 0x10c0 ;
5672 ret = usb_microdia_control_read(dev, reg, buf, 1);
5673 if (ret < 0)
5674 goto err;
5676 reg = 0x10c0 ;
5677 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x00; buf[3] = 0x00; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
5678 ret = usb_microdia_control_write(dev, reg, buf, 8);
5679 if (ret < 0)
5680 goto err;
5682 reg = 0x10c0 ;
5683 ret = usb_microdia_control_read(dev, reg, buf, 1);
5684 if (ret < 0)
5685 goto err;
5687 reg = 0x10c0 ;
5688 ret = usb_microdia_control_read(dev, reg, buf, 1);
5689 if (ret < 0)
5690 goto err;
5692 reg = 0x10c0 ;
5693 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x01; buf[3] = 0x80; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
5694 ret = usb_microdia_control_write(dev, reg, buf, 8);
5695 if (ret < 0)
5696 goto err;
5698 reg = 0x10c0 ;
5699 ret = usb_microdia_control_read(dev, reg, buf, 1);
5700 if (ret < 0)
5701 goto err;
5703 reg = 0x10c0 ;
5704 ret = usb_microdia_control_read(dev, reg, buf, 1);
5705 if (ret < 0)
5706 goto err;
5708 reg = 0x10c0 ;
5709 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x02; buf[3] = 0x80; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
5710 ret = usb_microdia_control_write(dev, reg, buf, 8);
5711 if (ret < 0)
5712 goto err;
5714 reg = 0x10c0 ;
5715 ret = usb_microdia_control_read(dev, reg, buf, 1);
5716 if (ret < 0)
5717 goto err;
5719 reg = 0x10c0 ;
5720 ret = usb_microdia_control_read(dev, reg, buf, 1);
5721 if (ret < 0)
5722 goto err;
5724 reg = 0x11ba ;
5725 buf[0] = 0x0a;
5726 ret = usb_microdia_control_write(dev, reg, buf, 1);
5727 if (ret < 0)
5728 goto err;
5730 reg = 0x118b ;
5731 buf[0] = 0x10;
5732 ret = usb_microdia_control_write(dev, reg, buf, 1);
5733 if (ret < 0)
5734 goto err;
5736 reg = 0x10f7;
5737 buf[0] = 0x05;
5738 ret = usb_microdia_control_write(dev, reg, buf, 1);
5739 if (ret < 0)
5740 goto err;
5742 reg = 0x10f8 ;
5743 buf[0] = 0x14;
5744 ret = usb_microdia_control_write(dev, reg, buf, 1);
5745 if (ret < 0)
5746 goto err;
5748 reg = 0x10fa ;
5749 buf[0] = 0xff;
5750 ret = usb_microdia_control_write(dev, reg, buf, 1);
5751 if (ret < 0)
5752 goto err;
5754 reg = 0x10f9 ;
5755 buf[0] = 0x00;
5756 ret = usb_microdia_control_write(dev, reg, buf, 1);
5757 if (ret < 0)
5758 goto err;
5760 reg = 0x10f9 ;
5761 buf[0] = 0x00;
5762 ret = usb_microdia_control_write(dev, reg, buf, 1);
5763 if (ret < 0)
5764 goto err;
5766 reg = 0x11ba ;
5767 buf[0] = 0x0a;
5768 ret = usb_microdia_control_write(dev, reg, buf, 1);
5769 if (ret < 0)
5770 goto err;
5772 reg = 0x11bc ;
5773 buf[0] = 0x00; buf[1] = 0x00; buf[2] = 0x00; buf[3] = 0x00;
5774 ret = usb_microdia_control_write(dev, reg, buf, 4);
5775 if (ret < 0)
5776 goto err;
5778 reg = 0x11c0;
5779 buf[0] = 0x00; buf[1] = 0x00; buf[2] = 0x00; buf[3] = 0x00;
5780 buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x00;
5781 buf[8] = 0x00; buf[9] = 0x00; buf[10] = 0x00; buf[11] = 0x00;
5782 buf[12] = 0x00; buf[13] = 0x00; buf[14] = 0x00; buf[15] = 0x00;
5783 buf[16] = 0x00; buf[17] = 0x00; buf[18] = 0x00; buf[19] = 0x00;
5784 buf[20] = 0x00; buf[21] = 0x00; buf[22] = 0x00; buf[23] = 0x00;
5785 buf[24] = 0x00; buf[25] = 0x00; buf[26] = 0x00; buf[27] = 0x00;
5786 buf[28] = 0x00; buf[29] = 0x00; buf[30] = 0x00; buf[31] = 0x00;
5787 buf[32] = 0x00; buf[33] = 0x00; buf[34] = 0x00; buf[35] = 0x00;
5788 buf[36] = 0x00; buf[37] = 0x00; buf[38] = 0x00; buf[39] = 0x00;
5789 buf[40] = 0x00; buf[41] = 0x00; buf[42] = 0x00; buf[43] = 0x00;
5790 buf[44] = 0x00; buf[45] = 0x00; buf[46] = 0x00; buf[47] = 0x00;
5791 ret = usb_microdia_control_write(dev, reg, buf, 48);
5792 if (ret < 0)
5793 goto err;
5795 reg = 0x11a5 ;
5796 buf[0] = 0x2d; buf[1] = 0x2d; buf[2] = 0x3a; buf[3] = 0x05;
5797 buf[4] = 0x04; buf[5] = 0x3f;
5798 ret = usb_microdia_control_write(dev, reg, buf, 6);
5799 if (ret < 0)
5800 goto err;
5802 reg = 0x11af ;
5803 buf[0] = 0x28; buf[1] = 0xd8; buf[2] = 0x14; buf[3] = 0xec;
5804 ret = usb_microdia_control_write(dev, reg, buf, 4);
5805 if (ret < 0)
5806 goto err;
5808 reg = 0x11b3 ;
5809 buf[0] = 0x32; buf[1] = 0xdd; buf[2] = 0x32; buf[3] = 0xdd;
5810 ret = usb_microdia_control_write(dev, reg, buf, 4);
5811 if (ret < 0)
5812 goto err;
5814 reg = 0x10e0 ;
5815 buf[0] = 0x47;
5816 ret = usb_microdia_control_write(dev, reg, buf, 1);
5817 if (ret < 0)
5818 goto err;
5820 reg = 0x1061 ;
5821 buf[0] = 0x01;
5822 ret = usb_microdia_control_write(dev, reg, buf, 1);
5823 if (ret < 0)
5824 goto err;
5826 reg = 0x10e0 ;
5827 buf[0] = 0x67;
5828 ret = usb_microdia_control_write(dev, reg, buf, 1);
5829 if (ret < 0)
5830 goto err;
5832 reg = 0x1100 ;
5833 buf[0] = 0x0d; buf[1] = 0x08; buf[2] = 0x08; buf[3] = 0x0d;
5834 buf[4] = 0x08; buf[5] = 0x08; buf[6] = 0x0d; buf[7] = 0x0d;
5835 buf[8] = 0x0d; buf[9] = 0x0d; buf[10] = 0x11; buf[11] = 0x0d;
5836 buf[12] = 0x0d; buf[13] = 0x11; buf[14] = 0x15; buf[15] = 0x21;
5837 buf[16] = 0x15; buf[17] = 0x15; buf[18] = 0x11; buf[19] = 0x11;
5838 buf[20] = 0x15; buf[21] = 0x2a; buf[22] = 0x1d; buf[23] = 0x1d;
5839 buf[24] = 0x19; buf[25] = 0x21; buf[26] = 0x32; buf[27] = 0x2a;
5840 buf[28] = 0x32; buf[29] = 0x32; buf[30] = 0x2e; buf[31] = 0x2a;
5841 buf[32] = 0x2e; buf[33] = 0x2e; buf[34] = 0x36; buf[35] = 0x3a;
5842 buf[36] = 0x4b; buf[37] = 0x43; buf[38] = 0x36; buf[39] = 0x3a;
5843 buf[40] = 0x47; buf[41] = 0x3a; buf[42] = 0x2e; buf[43] = 0x2e;
5844 buf[44] = 0x43; buf[45] = 0x5c; buf[46] = 0x43; buf[47] = 0x47;
5845 buf[48] = 0x4f; buf[49] = 0x53; buf[50] = 0x58; buf[51] = 0x58;
5846 buf[52] = 0x58; buf[53] = 0x32; buf[54] = 0x3f; buf[55] = 0x60;
5847 buf[56] = 0x64; buf[57] = 0x5c; buf[58] = 0x53; buf[59] = 0x64;
5848 buf[60] = 0x4b; buf[61] = 0x53; buf[62] = 0x58; buf[63] = 0x53;
5849 ret = usb_microdia_control_write(dev, reg, buf, 64);
5850 if (ret < 0)
5851 goto err;
5853 reg = 0x1140 ;
5854 buf[0] = 0x0d; buf[1] = 0x11; buf[2] = 0x11; buf[3] = 0x15;
5855 buf[4] = 0x11; buf[5] = 0x15; buf[6] = 0x26; buf[7] = 0x15;
5856 buf[8] = 0x15; buf[9] = 0x26; buf[10] = 0x53; buf[11] = 0x36;
5857 buf[12] = 0x2e; buf[13] = 0x36; buf[14] = 0x53; buf[15] = 0x53;
5858 buf[16] = 0x53; buf[17] = 0x53; buf[18] = 0x53; buf[19] = 0x53;
5859 buf[20] = 0x53; buf[21] = 0x53; buf[22] = 0x53; buf[23] = 0x53;
5860 buf[24] = 0x53; buf[25] = 0x53; buf[26] = 0x53; buf[27] = 0x53;
5861 buf[28] = 0x53; buf[29] = 0x53; buf[30] = 0x53; buf[31] = 0x53;
5862 buf[32] = 0x53; buf[33] = 0x53; buf[34] = 0x53; buf[35] = 0x53;
5863 buf[36] = 0x53; buf[37] = 0x53; buf[38] = 0x53; buf[39] = 0x53;
5864 buf[40] = 0x53; buf[41] = 0x53; buf[42] = 0x53; buf[43] = 0x53;
5865 buf[44] = 0x53; buf[45] = 0x53; buf[46] = 0x53; buf[47] = 0x53;
5866 buf[48] = 0x53; buf[49] = 0x53; buf[50] = 0x53; buf[51] = 0x53;
5867 buf[52] = 0x53; buf[53] = 0x53; buf[54] = 0x53; buf[55] = 0x53;
5868 buf[56] = 0x53; buf[57] = 0x53; buf[58] = 0x53; buf[59] = 0x53;
5869 buf[60] = 0x53; buf[61] = 0x53; buf[62] = 0x53; buf[63] = 0x53;
5870 ret = usb_microdia_control_write(dev, reg, buf, 64);
5871 if (ret < 0)
5872 goto err;
5874 reg = 0x10e0 ;
5875 buf[0] = 0x47;
5876 ret = usb_microdia_control_write(dev, reg, buf, 1);
5877 if (ret < 0)
5878 goto err;
5880 reg = 0x1061 ;
5881 buf[0] = 0x03;
5882 ret = usb_microdia_control_write(dev, reg, buf, 1);
5883 if (ret < 0)
5884 goto err;
5886 reg = 0x10e0 ;
5887 buf[0] = 0x4b;
5888 ret = usb_microdia_control_write(dev, reg, buf, 1);
5889 if (ret < 0)
5890 goto err;
5892 reg = 0x1189 ;
5893 buf[0] = 0xd0;
5894 ret = usb_microdia_control_write(dev, reg, buf, 1);
5895 if (ret < 0)
5896 goto err;
5898 reg = 0x11bc ;
5899 buf[0] = 0x00;
5900 ret = usb_microdia_control_write(dev, reg, buf, 1);
5901 if (ret < 0)
5902 goto err;
5904 reg = 0x11bd ;
5905 buf[0] = 0x00;
5906 ret = usb_microdia_control_write(dev, reg, buf, 1);
5907 if (ret < 0)
5908 goto err;
5910 reg = 0x11be ;
5911 buf[0] = 0x00;
5912 ret = usb_microdia_control_write(dev, reg, buf, 1);
5913 if (ret < 0)
5914 goto err;
5916 reg = 0x11bf ;
5917 buf[0] = 0x00;
5918 ret = usb_microdia_control_write(dev, reg, buf, 1);
5919 if (ret < 0)
5920 goto err;
5922 reg = 0x10c0 ;
5923 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x03; buf[3] = 0x14; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
5924 ret = usb_microdia_control_write(dev, reg, buf, 8);
5925 if (ret < 0)
5926 goto err;
5928 reg = 0x10c0 ;
5929 ret = usb_microdia_control_read(dev, reg, buf, 1);
5930 if (ret < 0)
5931 goto err;
5933 reg = 0x10c0 ;
5934 ret = usb_microdia_control_read(dev, reg, buf, 1);
5935 if (ret < 0)
5936 goto err;
5938 reg = 0x10c0 ;
5939 buf[0] = 0xd0; buf[1] = 0x30; buf[2] = 0x17; buf[3] = 0x1b; buf[4] = 0xbc; buf[5] = 0x01; buf[6] = 0x7a; buf[7] = 0x10;
5940 ret = usb_microdia_control_write(dev, reg, buf, 8);
5941 if (ret < 0)
5942 goto err;
5944 reg = 0x10c0 ;
5945 ret = usb_microdia_control_read(dev, reg, buf, 1);
5946 if (ret < 0)
5947 goto err;
5949 reg = 0x10c0 ;
5950 ret = usb_microdia_control_read(dev, reg, buf, 1);
5951 if (ret < 0)
5952 goto err;
5954 reg = 0x10c0 ;
5955 buf[0] = 0x90; buf[1] = 0x30; buf[2] = 0x1b; buf[3] = 0x00; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
5956 ret = usb_microdia_control_write(dev, reg, buf, 8);
5957 if (ret < 0)
5958 goto err;
5960 reg = 0x10c0 ;
5961 ret = usb_microdia_control_read(dev, reg, buf, 1);
5962 if (ret < 0)
5963 goto err;
5965 reg = 0x10c0 ;
5966 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x32; buf[3] = 0x82; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
5967 ret = usb_microdia_control_write(dev, reg, buf, 8);
5968 if (ret < 0)
5969 goto err;
5971 reg = 0x10c0 ;
5972 ret = usb_microdia_control_read(dev, reg, buf, 1);
5973 if (ret < 0)
5974 goto err;
5976 reg = 0x10c0 ;
5977 ret = usb_microdia_control_read(dev, reg, buf, 1);
5978 if (ret < 0)
5979 goto err;
5981 reg = 0x1180 ;
5982 buf[0] = 0x05; buf[1] = 0x00; buf[2] = 0x01; buf[3] = 0x00;
5983 buf[4] = 0x50; buf[5] = 0x78;
5984 ret = usb_microdia_control_write(dev, reg, buf, 6);
5985 if (ret < 0)
5986 goto err;
5988 reg = 0x10fb ;
5989 buf[0] = 0x00; buf[1] = 0xa0; buf[2] = 0x00; buf[3] = 0xf0;
5990 buf[4] = 0x00;
5991 ret = usb_microdia_control_write(dev, reg, buf, 5);
5992 if (ret < 0)
5993 goto err;
5995 reg = 0x1189 ;
5996 buf[0] = 0xd0;
5997 ret = usb_microdia_control_write(dev, reg, buf, 1);
5998 if (ret < 0)
5999 goto err;
6001 reg = 0x11a1 ;
6002 buf[0] = 0x00; buf[1] = 0x00; buf[2] = 0xd5; buf[3] = 0xa0;
6003 ret = usb_microdia_control_write(dev, reg, buf, 4);
6004 if (ret < 0)
6005 goto err;
6007 reg = 0x11ab ;
6008 buf[0] = 0x00; buf[1] = 0x00; buf[2] = 0xa0; buf[3] = 0x78;
6009 ret = usb_microdia_control_write(dev, reg, buf, 4);
6010 if (ret < 0)
6011 goto err;
6013 reg = 0x1061 ;
6014 buf[0] = 0x03;
6015 ret = usb_microdia_control_write(dev, reg, buf, 1);
6016 if (ret < 0)
6017 goto err;
6019 reg = 0x11ba ;
6020 buf[0] = 0x0a;
6021 ret = usb_microdia_control_write(dev, reg, buf, 1);
6022 if (ret < 0)
6023 goto err;
6025 reg = 0x11b9 ;
6026 buf[0] = 0x00;
6027 ret = usb_microdia_control_write(dev, reg, buf, 1);
6028 if (ret < 0)
6029 goto err;
6031 reg = 0x11ba ;
6032 buf[0] = 0x0b;
6033 ret = usb_microdia_control_write(dev, reg, buf, 1);
6034 if (ret < 0)
6035 goto err;
6037 reg = 0x1061 ;
6038 buf[0] = 0x01;
6039 ret = usb_microdia_control_write(dev, reg, buf, 1);
6040 if (ret < 0)
6041 goto err;
6043 reg = 0x1000 ;
6044 buf[0] = 0x78;
6045 ret = usb_microdia_control_write(dev, reg, buf, 1);
6046 if (ret < 0)
6047 goto err;
6049 reg = 0x1002 ;
6050 buf[0] = 0x08;
6051 ret = usb_microdia_control_write(dev, reg, buf, 1);
6052 if (ret < 0)
6053 goto err;
6055 reg = 0x1002 ;
6056 buf[0] = 0x08;
6057 ret = usb_microdia_control_write(dev, reg, buf, 1);
6058 if (ret < 0)
6059 goto err;
6061 reg = 0x11b8 ;
6062 buf[0] = 0xfa;
6063 ret = usb_microdia_control_write(dev, reg, buf, 1);
6064 if (ret < 0)
6065 goto err;
6067 reg = 0x118a ;
6068 buf[0] = 0x02;
6069 ret = usb_microdia_control_write(dev, reg, buf, 1);
6070 if (ret < 0)
6071 goto err;
6073 reg = 0x0395 ;
6074 buf[0] = 0x02;
6075 ret = usb_microdia_control_write(dev, reg, buf, 1);
6076 if (ret < 0)
6077 goto err;
6079 reg = 0x11b8 ;
6080 buf[0] = 0xf8;
6081 ret = usb_microdia_control_write(dev, reg, buf, 1);
6082 if (ret < 0)
6083 goto err;
6085 reg = 0x11b8 ;
6086 ret = usb_microdia_control_read(dev, reg, buf, 1);
6087 if (ret < 0)
6088 goto err;
6090 reg = 0x11b8 ;
6091 buf[0] = 0xf9;
6092 ret = usb_microdia_control_write(dev, reg, buf, 1);
6093 if (ret < 0)
6094 goto err;
6096 reg = 0x11b8 ;
6097 ret = usb_microdia_control_read(dev, reg, buf, 1);
6098 if (ret < 0)
6099 goto err;
6101 reg = 0x11b8 ;
6102 buf[0] = 0x7a;
6103 ret = usb_microdia_control_write(dev, reg, buf, 1);
6104 if (ret < 0)
6105 goto err;
6107 reg = 0x11b8 ;
6108 ret = usb_microdia_control_read(dev, reg, buf, 1);
6109 if (ret < 0)
6110 goto err;
6112 reg = 0x11b8 ;
6113 buf[0] = 0x7b;
6114 ret = usb_microdia_control_write(dev, reg, buf, 1);
6115 if (ret < 0)
6116 goto err;
6118 reg = 0x11b8 ;
6119 ret = usb_microdia_control_read(dev, reg, buf, 1);
6120 if (ret < 0)
6121 goto err;
6123 reg = 0x11b8 ;
6124 buf[0] = 0x7c;
6125 ret = usb_microdia_control_write(dev, reg, buf, 1);
6126 if (ret < 0)
6127 goto err;
6129 reg = 0x11b8 ;
6130 ret = usb_microdia_control_read(dev, reg, buf, 1);
6131 if (ret < 0)
6132 goto err;
6134 reg = 0x11b8 ;
6135 buf[0] = 0xfd;
6136 ret = usb_microdia_control_write(dev, reg, buf, 1);
6137 if (ret < 0)
6138 goto err;
6140 reg = 0x11b8 ;
6141 ret = usb_microdia_control_read(dev, reg, buf, 1);
6142 if (ret < 0)
6143 goto err;
6145 reg = 0x11b8 ;
6146 buf[0] = 0xfa;
6147 ret = usb_microdia_control_write(dev, reg, buf, 1);
6148 if (ret < 0)
6149 goto err;
6151 reg = 0x10c0 ;
6152 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x11; buf[3] = 0x80; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
6153 ret = usb_microdia_control_write(dev, reg, buf, 8);
6154 if (ret < 0)
6155 goto err;
6157 reg = 0x10c0 ;
6158 ret = usb_microdia_control_read(dev, reg, buf, 1);
6159 if (ret < 0)
6160 goto err;
6162 reg = 0x10c0 ;
6163 ret = usb_microdia_control_read(dev, reg, buf, 1);
6164 if (ret < 0)
6165 goto err;
6167 reg = 0x10c0 ;
6168 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x2a; buf[3] = 0x00; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
6169 ret = usb_microdia_control_write(dev, reg, buf, 8);
6170 if (ret < 0)
6171 goto err;
6173 reg = 0x10c0 ;
6174 ret = usb_microdia_control_read(dev, reg, buf, 1);
6175 if (ret < 0)
6176 goto err;
6178 reg = 0x10c0 ;
6179 ret = usb_microdia_control_read(dev, reg, buf, 1);
6180 if (ret < 0)
6181 goto err;
6183 reg = 0x10c0 ;
6184 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x2b; buf[3] = 0x70; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
6185 ret = usb_microdia_control_write(dev, reg, buf, 8);
6186 if (ret < 0)
6187 goto err;
6189 reg = 0x10c0 ;
6190 ret = usb_microdia_control_read(dev, reg, buf, 1);
6191 if (ret < 0)
6192 goto err;
6194 reg = 0x10c0 ;
6195 ret = usb_microdia_control_read(dev, reg, buf, 1);
6196 if (ret < 0)
6197 goto err;
6199 reg = 0x10c0 ;
6200 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x92; buf[3] = 0x00; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
6201 ret = usb_microdia_control_write(dev, reg, buf, 8);
6202 if (ret < 0)
6203 goto err;
6205 reg = 0x10c0 ;
6206 ret = usb_microdia_control_read(dev, reg, buf, 1);
6207 if (ret < 0)
6208 goto err;
6210 reg = 0x10c0 ;
6211 ret = usb_microdia_control_read(dev, reg, buf, 1);
6212 if (ret < 0)
6213 goto err;
6215 reg = 0x10c0 ;
6216 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x93; buf[3] = 0x00; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
6217 ret = usb_microdia_control_write(dev, reg, buf, 8);
6218 if (ret < 0)
6219 goto err;
6221 reg = 0x10c0 ;
6222 ret = usb_microdia_control_read(dev, reg, buf, 1);
6223 if (ret < 0)
6224 goto err;
6226 reg = 0x10c0 ;
6227 ret = usb_microdia_control_read(dev, reg, buf, 1);
6228 if (ret < 0)
6229 goto err;
6231 reg = 0x10c0 ;
6232 buf[0] = 0x90; buf[1] = 0x30; buf[2] = 0x0a; buf[3] = 0x00; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
6233 ret = usb_microdia_control_write(dev, reg, buf, 8);
6234 if (ret < 0)
6235 goto err;
6237 reg = 0x10c0 ;
6238 ret = usb_microdia_control_read(dev, reg, buf, 1);
6239 if (ret < 0)
6240 goto err;
6242 reg = 0x10c0 ;
6243 buf[0] = 0x92; buf[1] = 0x30; buf[2] = 0x00; buf[3] = 0x00; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
6244 ret = usb_microdia_control_write(dev, reg, buf, 8);
6245 if (ret < 0)
6246 goto err;
6248 reg = 0x10c0 ;
6249 ret = usb_microdia_control_read(dev, reg, buf, 1);
6250 if (ret < 0)
6251 goto err;
6253 reg = 0x10c2 ;
6254 ret = usb_microdia_control_read(dev, reg, buf, 5);
6255 if (ret < 0)
6256 goto err;
6258 reg = 0x10c0 ;
6259 buf[0] = 0x90; buf[1] = 0x30; buf[2] = 0x0b; buf[3] = 0x00; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
6260 ret = usb_microdia_control_write(dev, reg, buf, 8);
6261 if (ret < 0)
6262 goto err;
6264 reg = 0x10c0 ;
6265 ret = usb_microdia_control_read(dev, reg, buf, 1);
6266 if (ret < 0)
6267 goto err;
6269 reg = 0x10c0 ;
6270 buf[0] = 0x92; buf[1] = 0x30; buf[2] = 0x00; buf[3] = 0x00; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
6271 ret = usb_microdia_control_write(dev, reg, buf, 8);
6272 if (ret < 0)
6273 goto err;
6275 reg = 0x10c0 ;
6276 ret = usb_microdia_control_read(dev, reg, buf, 1);
6277 if (ret < 0)
6278 goto err;
6280 reg = 0x10c2 ;
6281 ret = usb_microdia_control_read(dev, reg, buf, 5);
6282 if (ret < 0)
6283 goto err;
6285 reg = 0x10c0 ;
6286 buf[0] = 0x90; buf[1] = 0x30; buf[2] = 0x1c; buf[3] = 0x00; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
6287 ret = usb_microdia_control_write(dev, reg, buf, 8);
6288 if (ret < 0)
6289 goto err;
6291 reg = 0x10c0 ;
6292 ret = usb_microdia_control_read(dev, reg, buf, 1);
6293 if (ret < 0)
6294 goto err;
6296 reg = 0x10c0 ;
6297 buf[0] = 0x92; buf[1] = 0x30; buf[2] = 0x00; buf[3] = 0x00; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
6298 ret = usb_microdia_control_write(dev, reg, buf, 8);
6299 if (ret < 0)
6300 goto err;
6302 reg = 0x10c0 ;
6303 ret = usb_microdia_control_read(dev, reg, buf, 1);
6304 if (ret < 0)
6305 goto err;
6307 reg = 0x10c2 ;
6308 ret = usb_microdia_control_read(dev, reg, buf, 5);
6309 if (ret < 0)
6310 goto err;
6312 reg = 0x10c0 ;
6313 buf[0] = 0x90; buf[1] = 0x30; buf[2] = 0x1d; buf[3] = 0x00; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
6314 ret = usb_microdia_control_write(dev, reg, buf, 8);
6315 if (ret < 0)
6316 goto err;
6318 reg = 0x10c0 ;
6319 ret = usb_microdia_control_read(dev, reg, buf, 1);
6320 if (ret < 0)
6321 goto err;
6323 reg = 0x10c0 ;
6324 buf[0] = 0x92; buf[1] = 0x30; buf[2] = 0x00; buf[3] = 0x00; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
6325 ret = usb_microdia_control_write(dev, reg, buf, 8);
6326 if (ret < 0)
6327 goto err;
6329 reg = 0x10c0 ;
6330 ret = usb_microdia_control_read(dev, reg, buf, 1);
6331 if (ret < 0)
6332 goto err;
6334 reg = 0x10c2 ;
6335 ret = usb_microdia_control_read(dev, reg, buf, 5);
6336 if (ret < 0)
6337 goto err;
6339 reg = 0x1061 ;
6340 buf[0] = 0x03;
6341 ret = usb_microdia_control_write(dev, reg, buf, 1);
6342 if (ret < 0)
6343 goto err;
6345 reg = 0x1007 ;
6346 buf[0] = 0x20;
6347 ret = usb_microdia_control_write(dev, reg, buf, 1);
6348 if (ret < 0)
6349 goto err;
6351 reg = 0x1006 ;
6352 buf[0] = 0x00;
6353 ret = usb_microdia_control_write(dev, reg, buf, 1);
6354 if (ret < 0)
6355 goto err;
6357 reg = 0x10c0 ;
6358 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0xa1; buf[3] = 0x01; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
6359 ret = usb_microdia_control_write(dev, reg, buf, 8);
6360 if (ret < 0)
6361 goto err;
6363 reg = 0x10c0 ;
6364 ret = usb_microdia_control_read(dev, reg, buf, 1);
6365 if (ret < 0)
6366 goto err;
6368 reg = 0x10c0 ;
6369 ret = usb_microdia_control_read(dev, reg, buf, 1);
6370 if (ret < 0)
6371 goto err;
6373 reg = 0x10c0 ;
6374 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x10; buf[3] = 0x06; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
6375 ret = usb_microdia_control_write(dev, reg, buf, 8);
6376 if (ret < 0)
6377 goto err;
6379 reg = 0x10c0 ;
6380 ret = usb_microdia_control_read(dev, reg, buf, 1);
6381 if (ret < 0)
6382 goto err;
6384 reg = 0x10c0 ;
6385 ret = usb_microdia_control_read(dev, reg, buf, 1);
6386 if (ret < 0)
6387 goto err;
6389 reg = 0x10c0 ;
6390 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x04; buf[3] = 0x00; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
6391 ret = usb_microdia_control_write(dev, reg, buf, 8);
6392 if (ret < 0)
6393 goto err;
6395 reg = 0x10c0 ;
6396 ret = usb_microdia_control_read(dev, reg, buf, 1);
6397 if (ret < 0)
6398 goto err;
6400 reg = 0x10c0 ;
6401 ret = usb_microdia_control_read(dev, reg, buf, 1);
6402 if (ret < 0)
6403 goto err;
6405 reg = 0x10c0 ;
6406 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x2d; buf[3] = 0x36; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
6407 ret = usb_microdia_control_write(dev, reg, buf, 8);
6408 if (ret < 0)
6409 goto err;
6411 reg = 0x10c0 ;
6412 ret = usb_microdia_control_read(dev, reg, buf, 1);
6413 if (ret < 0)
6414 goto err;
6416 reg = 0x10c0 ;
6417 ret = usb_microdia_control_read(dev, reg, buf, 1);
6418 if (ret < 0)
6419 goto err;
6421 reg = 0x10c0 ;
6422 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x2e; buf[3] = 0x00; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
6423 ret = usb_microdia_control_write(dev, reg, buf, 8);
6424 if (ret < 0)
6425 goto err;
6427 reg = 0x10c0 ;
6428 ret = usb_microdia_control_read(dev, reg, buf, 1);
6429 if (ret < 0)
6430 goto err;
6432 reg = 0x10c0 ;
6433 ret = usb_microdia_control_read(dev, reg, buf, 1);
6434 if (ret < 0)
6435 goto err;
6437 reg = 0x10c0 ;
6438 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x00; buf[3] = 0x01; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x15;
6439 ret = usb_microdia_control_write(dev, reg, buf, 8);
6440 if (ret < 0)
6441 goto err;
6443 reg = 0x10c0 ;
6444 ret = usb_microdia_control_read(dev, reg, buf, 1);
6445 if (ret < 0)
6446 goto err;
6448 reg = 0x10c0 ;
6449 ret = usb_microdia_control_read(dev, reg, buf, 1);
6450 if (ret < 0)
6451 goto err;
6453 reg = 0x10c0 ;
6454 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x00; buf[3] = 0x06; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x15;
6455 ret = usb_microdia_control_write(dev, reg, buf, 8);
6456 if (ret < 0)
6457 goto err;
6459 reg = 0x10c0 ;
6460 ret = usb_microdia_control_read(dev, reg, buf, 1);
6461 if (ret < 0)
6462 goto err;
6464 reg = 0x10c0 ;
6465 ret = usb_microdia_control_read(dev, reg, buf, 1);
6466 if (ret < 0)
6467 goto err;
6469 reg = 0x10c0 ;
6470 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x01; buf[3] = 0x94; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
6471 ret = usb_microdia_control_write(dev, reg, buf, 8);
6472 if (ret < 0)
6473 goto err;
6475 reg = 0x10c0 ;
6476 ret = usb_microdia_control_read(dev, reg, buf, 1);
6477 if (ret < 0)
6478 goto err;
6480 reg = 0x10c0 ;
6481 ret = usb_microdia_control_read(dev, reg, buf, 1);
6482 if (ret < 0)
6483 goto err;
6485 reg = 0x10c0 ;
6486 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x02; buf[3] = 0x8d; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
6487 ret = usb_microdia_control_write(dev, reg, buf, 8);
6488 if (ret < 0)
6489 goto err;
6491 reg = 0x10c0 ;
6492 ret = usb_microdia_control_read(dev, reg, buf, 1);
6493 if (ret < 0)
6494 goto err;
6496 reg = 0x10c0 ;
6497 ret = usb_microdia_control_read(dev, reg, buf, 1);
6498 if (ret < 0)
6499 goto err;
6501 reg = 0x10c0 ;
6502 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x00; buf[3] = 0x09; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x15;
6503 ret = usb_microdia_control_write(dev, reg, buf, 8);
6504 if (ret < 0)
6505 goto err;
6507 reg = 0x10c0 ;
6508 ret = usb_microdia_control_read(dev, reg, buf, 1);
6509 if (ret < 0)
6510 goto err;
6512 reg = 0x10c0 ;
6513 ret = usb_microdia_control_read(dev, reg, buf, 1);
6514 if (ret < 0)
6515 goto err;
6517 reg = 0x10c0 ;
6518 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x01; buf[3] = 0x95; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
6519 ret = usb_microdia_control_write(dev, reg, buf, 8);
6520 if (ret < 0)
6521 goto err;
6523 reg = 0x10c0 ;
6524 ret = usb_microdia_control_read(dev, reg, buf, 1);
6525 if (ret < 0)
6526 goto err;
6528 reg = 0x10c0 ;
6529 ret = usb_microdia_control_read(dev, reg, buf, 1);
6530 if (ret < 0)
6531 goto err;
6533 reg = 0x10c0 ;
6534 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x02; buf[3] = 0x85; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
6535 ret = usb_microdia_control_write(dev, reg, buf, 8);
6536 if (ret < 0)
6537 goto err;
6539 reg = 0x10c0 ;
6540 ret = usb_microdia_control_read(dev, reg, buf, 1);
6541 if (ret < 0)
6542 goto err;
6544 reg = 0x10c0 ;
6545 ret = usb_microdia_control_read(dev, reg, buf, 1);
6546 if (ret < 0)
6547 goto err;
6549 reg = 0x10c0 ;
6550 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x00; buf[3] = 0x0c; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x15;
6551 ret = usb_microdia_control_write(dev, reg, buf, 8);
6552 if (ret < 0)
6553 goto err;
6555 reg = 0x10c0 ;
6556 ret = usb_microdia_control_read(dev, reg, buf, 1);
6557 if (ret < 0)
6558 goto err;
6560 reg = 0x10c0 ;
6561 ret = usb_microdia_control_read(dev, reg, buf, 1);
6562 if (ret < 0)
6563 goto err;
6565 reg = 0x10c0 ;
6566 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x01; buf[3] = 0x96; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
6567 ret = usb_microdia_control_write(dev, reg, buf, 8);
6568 if (ret < 0)
6569 goto err;
6571 reg = 0x10c0 ;
6572 ret = usb_microdia_control_read(dev, reg, buf, 1);
6573 if (ret < 0)
6574 goto err;
6576 reg = 0x10c0 ;
6577 ret = usb_microdia_control_read(dev, reg, buf, 1);
6578 if (ret < 0)
6579 goto err;
6581 reg = 0x10c0 ;
6582 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x02; buf[3] = 0x80; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
6583 ret = usb_microdia_control_write(dev, reg, buf, 8);
6584 if (ret < 0)
6585 goto err;
6587 reg = 0x10c0 ;
6588 ret = usb_microdia_control_read(dev, reg, buf, 1);
6589 if (ret < 0)
6590 goto err;
6592 reg = 0x10c0 ;
6593 ret = usb_microdia_control_read(dev, reg, buf, 1);
6594 if (ret < 0)
6595 goto err;
6597 reg = 0x10c0 ;
6598 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x02; buf[3] = 0x7c; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
6599 ret = usb_microdia_control_write(dev, reg, buf, 8);
6600 if (ret < 0)
6601 goto err;
6603 reg = 0x10c0 ;
6604 ret = usb_microdia_control_read(dev, reg, buf, 1);
6605 if (ret < 0)
6606 goto err;
6608 reg = 0x10c0 ;
6609 ret = usb_microdia_control_read(dev, reg, buf, 1);
6610 if (ret < 0)
6611 goto err;
6613 reg = 0x1007 ;
6614 buf[0] = 0x20;
6615 ret = usb_microdia_control_write(dev, reg, buf, 1);
6616 if (ret < 0)
6617 goto err;
6619 reg = 0x1006 ;
6620 buf[0] = 0x20;
6621 ret = usb_microdia_control_write(dev, reg, buf, 1);
6622 if (ret < 0)
6623 goto err;
6628 /* END OF MICRODIA 6288 START STREAM */
6630 return 0;
6631 err:
6632 UDIA_ERROR("r/w in Register %x failed (%d)!\n", reg, ret);
6633 return ret;
6637 * @brief Wrapper function for device-specific stopstream functions
6639 * @param dev Pointer to device structure
6641 * @returns 0
6643 * This will execute a function determined by the array #cameras and
6644 * the function find_camera().
6647 int dev_microdia_stop_stream(struct usb_microdia *dev)
6649 int ret = -ENODEV;
6650 if (dev && dev->stop_stream)
6651 ret = dev->stop_stream(dev);
6653 return ret;
6657 * @brief From stop.htm
6659 * @param dev
6661 * @returns 0
6663 * @author GWater
6665 * For SN9C201 with MI1310.
6666 * This function has not been tested yet.
6668 int microdia_6242_stop_stream(struct usb_microdia *dev)
6670 __u8 buf[3];
6672 __u8 only10c0[3] = {0x0d, 0x00, 0x00};
6674 buf[0] = 0x01;
6675 usb_microdia_control_write(dev, 0x1061, buf, 1);
6677 buf[0] = 0x60;
6678 usb_microdia_control_write(dev, 0x1007, buf, 1);
6680 buf[0] = 0x00;
6681 usb_microdia_control_write(dev, 0x1006, buf, 1);
6683 sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 2,
6684 only10c0[0], dev->sensor_flags, &only10c0[1]);
6686 buf[0] = 0x38;
6687 usb_microdia_control_write(dev, 0x1000, buf, 1);
6689 buf[0] = 0x6b;
6690 usb_microdia_control_write(dev, 0x11b8, buf, 1);
6692 buf[0] = 0x60;
6693 usb_microdia_control_write(dev, 0x1007, buf, 1);
6695 buf[0] = 0x20;
6696 usb_microdia_control_write(dev, 0x1006, buf, 1);
6699 buf[0] = 0x98; buf[1] = 0xe7; buf[2] = 0x11;
6700 usb_microdia_control_write(dev, 0x1000, buf, 3);
6703 * After the select alternate setting 0 is actually another transfer:
6704 * buf[0] = 0x00;
6705 * usb_microdia_control_write(dev, 0x1066, buf, 1);
6708 return 0;
6713 * @brief From stopstream.log
6715 * @param dev
6717 * @returns 0
6719 * @author GWater
6721 * For SN9C201 with SOI968.
6722 * I don't whether the function really stops the stream.
6723 * Nevertheless the LED on the webcam now stops glowing.
6724 * The function is very similar to "microdia_624f_stop_stream".
6726 int microdia_624e_stop_stream(struct usb_microdia *dev)
6728 __u8 buf[3];
6730 buf[0] = 0x01;
6731 usb_microdia_control_write(dev, 0x1061, buf, 1);
6733 /* Next two writes added because it works better.
6734 * The LED stops glowing and I think the stream does too.
6735 * 0x20 = 0b00100000 which is the minimal of what the
6736 * other stopstreams have in common.
6738 buf[0] = 0x20;
6739 usb_microdia_control_write(dev, 0x1007, buf, 1);
6741 buf[0] = 0x20;
6742 usb_microdia_control_write(dev, 0x1006, buf, 1);
6744 buf[0] = 0x3c;
6745 usb_microdia_control_write(dev, 0x1000, buf, 1);
6747 buf[0] = 0x6a;
6748 usb_microdia_control_write(dev, 0x11b8, buf, 1);
6750 buf[0] = 0x38; buf[1] = 0xe7; buf[2] = 0x11;
6751 usb_microdia_control_write(dev, 0x1000, buf, 3);
6753 usb_microdia_control_read(dev, 0x1066, buf, 1);
6755 return 0;
6760 * @brief Stop device 624f from streaming
6762 * @param dev Pointer to device structure
6764 * @returns 0 or negative error code
6767 int microdia_624f_stop_stream(struct usb_microdia *dev)
6769 int ret;
6770 __u16 command;
6771 __u8 buf[3];
6773 buf[0] = 0x02;
6774 command = 0x1066;
6775 ret = usb_microdia_control_write(dev, command, buf, 1);
6776 if (ret < 0)
6777 goto err;
6779 buf[0] = 0x01;
6780 command = 0x1061;
6781 ret = usb_microdia_control_write(dev, command, buf, 1);
6782 if (ret < 0)
6783 goto err;
6785 buf[0] = 0x38;
6786 command = 0x1000;
6787 ret = usb_microdia_control_write(dev, command, buf, 1);
6788 if (ret < 0)
6789 goto err;
6791 buf[0] = 0x6a;
6792 command = 0x11b8;
6793 ret = usb_microdia_control_write(dev, command, buf, 1);
6794 if (ret < 0)
6795 goto err;
6797 buf[0] = 0x20;
6798 command = 0x1007;
6799 ret = usb_microdia_control_write(dev, command, buf, 1);
6800 if (ret < 0)
6801 goto err;
6803 buf[0] = 0x20;
6804 command = 0x1006;
6805 ret = usb_microdia_control_write(dev, command, buf, 1);
6806 if (ret < 0)
6807 goto err;
6809 buf[0] = 0x98;
6810 buf[1] = 0xe7;
6811 buf[2] = 0x11;
6812 command = 0x1000;
6813 ret = usb_microdia_control_write(dev, command, buf, 3);
6814 if (ret < 0)
6815 goto err;
6817 command = 0x1045;
6818 ret = usb_microdia_control_read(dev, command, buf, 1);
6819 if (ret < 0)
6820 goto err;
6822 buf[0] = 0x0f;
6823 ret = usb_microdia_control_write(dev, command, buf, 1);
6824 if (ret < 0)
6825 goto err;
6827 return ret;
6829 err:
6830 UDIA_ERROR("command %x failed (%d)!\n", command, ret);
6831 return ret;
6835 * @brief Stop device 6260 from streaming
6837 * @param dev Pointer to device structure
6839 * @returns 0 or negative error code
6842 int microdia_6260_stop_stream(struct usb_microdia *dev)
6844 int ret;
6845 __u8 buf[32];
6847 buf[0] = 0x01;
6848 ret = usb_microdia_control_write(dev, 0x1061, buf, 1);
6849 buf[0] = 0x38;
6850 ret = usb_microdia_control_write(dev, 0x1000, buf, 1);
6851 buf[0] = 0x6b;
6852 ret = usb_microdia_control_write(dev, 0x11b8, buf, 1);
6853 buf[0] = 0x20;
6854 ret = usb_microdia_control_write(dev, 0x1007, buf, 1);
6855 buf[0] = 0x20;
6856 ret = usb_microdia_control_write(dev, 0x1006, buf, 1);
6858 buf[0] = 0x98; buf[1] = 0xe7; buf[2] = 0x11;
6859 ret = usb_microdia_control_write(dev, 0x1000, buf, 3);
6861 buf[0] = 0x00;
6862 ret = usb_microdia_control_write(dev, 0x1066, buf, 1);
6863 ret = usb_microdia_control_read(dev, 0x1045, buf, 1);
6864 buf[0] = 0x0f;
6865 ret = usb_microdia_control_write(dev, 0x1045, buf, 1);
6866 buf[0] = 0x00;
6867 ret = usb_microdia_control_write(dev, 0x10c8, buf, 1);
6868 buf[0] = 0x80;
6869 ret = usb_microdia_control_write(dev, 0x1020, buf, 1);
6871 return ret;
6875 * @brief From 7 start-stop-logs (made by Alex Carlos, Boris Borisov, bohzan and Comer352l)
6877 * @param dev
6879 * @returns 0 (ok) or -1 (error)
6881 * @author Comer352l
6883 * Windows driver version: 5.7.23.000
6884 * Windows versions: 2000 and XP
6885 * USB-Logger: SniffUSB 1.8 and 2.0, USBTrace 2.0, SnoopyPro
6886 * All logs were made using AMCAP with 640x480, RGB24
6888 int microdia_6270_stop_stream(struct usb_microdia *dev)
6890 int ret = 0;
6891 int retI2C = 0;
6892 __u8 buf[3];
6894 if (dev->sensor_slave_address == MT9V111_I2C_SLAVE_ADDRESS) {
6895 buf[0] = 0x20;
6896 ret += usb_microdia_control_write(dev, 0x1007, buf, 1); /* URB 3541 */
6897 buf[0] = 0x20;
6898 ret += usb_microdia_control_write(dev, 0x1006, buf, 1); /* URB 3542 */
6899 /* => These two writes seem to cause the cam to stop sending isochronus USB messages */
6901 buf[0] = 0x01;
6902 ret += usb_microdia_control_write(dev, 0x1061, buf, 1); /* URB 3544 */
6903 if (dev->sensor_slave_address == MT9V011_I2C_SLAVE_ADDRESS) {
6904 buf[0] = 0x60;
6905 ret += usb_microdia_control_write(dev, 0x1007, buf, 1); /* URB 3541 */
6906 buf[0] = 0x60;
6907 ret += usb_microdia_control_write(dev, 0x1006, buf, 1); /* URB 3542 */
6909 if (dev->sensor_slave_address == MT9V011_I2C_SLAVE_ADDRESS) {
6910 /* Write to sensor register 0x07: Output Control */
6911 buf[0] = 0x00; buf[1] = 0x00; /* stop sensor readout, normal operation */
6912 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 2, 0x07, dev->sensor_flags, buf);
6914 buf[0] = 0x38; /* ALEX: 0x3c */
6915 ret += usb_microdia_control_write(dev, 0x1000, buf, 1); /* URB 3545 */
6916 buf[0] = 0x6d; /* ALEX: 0xec; FRANK: also 0x6c */
6917 ret += usb_microdia_control_write(dev, 0x11b8, buf, 1); /* URB 3546 */
6918 buf[0] = 0x38; buf[1] = 0xe7; buf[2] = 0x11;
6919 ret += usb_microdia_control_write(dev, 0x1000, buf, 3); /* URB 3547 */
6921 /* INTERRUPT COMMING BACK (URB 2227) */
6922 /* SELECT ALTERNATE SETTINGS (URB 3548) */
6923 /* INTERRUPT GOING DOWN (URB 3549) */
6925 buf[0] = 0x00;
6926 ret += usb_microdia_control_write(dev, 0x1066, buf, 1); /* URB 3550 */
6928 if (ret < 9) {
6929 UDIA_INFO("One ore more errors occured while stopping stream !\n");
6930 return -1;
6931 } else {
6932 return 0;
6937 * @brief Stop device 627b from streaming
6939 * @param dev Pointer to device structure
6941 * @returns 0 or negative error code
6944 int microdia_627b_stop_stream(struct usb_microdia *dev)
6946 int ret = 0;
6947 __u16 reg;
6948 __u8 buf[3];
6950 reg = 0x1007;
6951 buf[0] = 0x60;
6952 ret = usb_microdia_control_write(dev, reg, buf, 1);
6953 if (ret < 0)
6954 goto err;
6956 reg = 0x1006;
6957 buf[0] = 0x20;
6958 ret = usb_microdia_control_write(dev, reg, buf, 1);
6959 if (ret < 0)
6960 goto err;
6962 reg = 0x1061;
6963 buf[0] = 0x01;
6964 ret = usb_microdia_control_write(dev, reg, buf, 1);
6965 if (ret < 0)
6966 goto err;
6968 reg = 0x1000;
6969 buf[0] = 0x38;
6970 ret = usb_microdia_control_write(dev, reg, buf, 1);
6971 if (ret < 0)
6972 goto err;
6974 reg = 0x11b8;
6975 buf[0] = 0x6b;
6976 ret = usb_microdia_control_write(dev, reg, buf, 1);
6977 if (ret < 0)
6978 goto err;
6980 reg = 0x1000;
6981 buf[0] = 0x38; buf[1] = 0xe7; buf[2] = 0x11;
6982 ret = usb_microdia_control_write(dev, reg, buf, 3);
6983 if (ret < 0)
6984 goto err;
6986 reg = 0x1066;
6987 buf[0] = 0x00;
6988 ret = usb_microdia_control_write(dev, reg, buf, 1);
6989 if (ret < 0)
6990 goto err;
6992 return ret;
6994 err:
6995 UDIA_ERROR("r/w in Register %x failed (%d)!\n", reg, ret);
6996 return ret;
7000 * @brief From UsbSnoop-plugin-parsed.log
7002 * @param dev
7004 * @returns 0 (OK) or <0 (Error)
7006 * @author Vincent, Kuzja
7008 int microdia_6288_stop_stream(struct usb_microdia *dev)
7010 int ret = 0;
7011 __u16 reg;
7012 __u8 buf[8];
7014 reg = 0x1061 ;
7015 buf[0] = 0x01;
7016 ret = usb_microdia_control_write(dev, reg, buf, 1);
7017 if (ret < 0)
7018 goto err;
7020 reg = 0x1000 ;
7021 buf[0] = 0x38;
7022 ret = usb_microdia_control_write(dev, reg, buf, 1);
7023 if (ret < 0)
7024 goto err;
7026 reg = 0x11b8 ;
7027 buf[0] = 0xe9;
7028 ret = usb_microdia_control_write(dev, reg, buf, 1);
7029 if (ret < 0)
7030 goto err;
7032 reg = 0x1007 ;
7033 buf[0] = 0x20;
7034 ret = usb_microdia_control_write(dev, reg, buf, 1);
7035 if (ret < 0)
7036 goto err;
7038 reg = 0x1006 ;
7039 buf[0] = 0x20;
7040 ret = usb_microdia_control_write(dev, reg, buf, 1);
7041 if (ret < 0)
7042 goto err;
7044 reg = 0x1000 ;
7045 buf[0] = 0x98; buf[1] = 0xe7; buf[2] = 0x11;
7046 ret = usb_microdia_control_write(dev, reg, buf, 3);
7047 if (ret < 0)
7048 goto err;
7050 reg = 0x1066 ;
7051 buf[0] = 0x00;
7052 ret = usb_microdia_control_write(dev, reg, buf, 1);
7053 if (ret < 0)
7054 goto err;
7056 return 0;
7057 err:
7058 UDIA_ERROR("r/w in Register %x failed (%d)!\n", reg, ret);
7059 return ret;
7063 * @brief Detect whether the image for 624f has to be flipped
7065 * @param dev Pointer to device structure
7067 * @returns 0 or negative error code
7070 int microdia_624f_flip_detect(struct usb_microdia *dev)
7072 int ret = 0;
7073 __u8 val;
7075 ret = usb_microdia_control_read(dev, 0x1009, &val, 1);
7076 if (ret < 0)
7077 return -EAGAIN;
7078 if (val & 0x01)
7079 dev->vsettings.vflip = 1;
7080 else
7081 dev->vsettings.vflip = 0;
7082 return ret;
7086 * @brief Detect whether the image for 6260 has to be flipped
7088 * @param dev Pointer to device structure
7090 * @returns 0 or negative error code
7093 int microdia_6260_flip_detect(struct usb_microdia *dev)
7095 const __u8 flip_bit = 0x01;
7096 int ret = 0;
7097 __u8 val;
7098 static __u8 flip_reg = flip_bit;
7099 __u8 vflip;
7101 ret = usb_microdia_control_read(dev, 0x1009, &val, 1);
7102 if (ret < 0)
7103 return -EAGAIN;
7104 if (flip_reg != (val & flip_bit)) {
7105 if (val & flip_bit)
7106 vflip = 0;
7107 else
7108 vflip = 1;
7109 ret = ov7670_auto_flip(dev, vflip);
7110 flip_reg = (val & flip_bit);
7113 return ret;