@@ -365,6 +365,8 @@ static const __u8 tas5130a_sensor_init[][8] = {
365
365
{},
366
366
};
367
367
368
+ static __u8 sensor_reset [] = {0x61 , 0x68 , 0x62 , 0xff , 0x60 , 0x07 };
369
+
368
370
/* read 1 byte */
369
371
static int reg_r (struct gspca_dev * gspca_dev ,
370
372
__u16 index )
@@ -437,12 +439,25 @@ static void om6802_sensor_init(struct gspca_dev *gspca_dev)
437
439
0x90 , 0x24 ,
438
440
0x91 , 0xb2 ,
439
441
0x82 , 0x32 ,
440
- 0xfd , 0x00 ,
441
- 0xfd , 0x01 ,
442
442
0xfd , 0x41 ,
443
443
0x00 /* table end */
444
444
};
445
445
446
+ reg_w_buf (gspca_dev , sensor_reset , sizeof sensor_reset );
447
+ msleep (5 );
448
+ i = 4 ;
449
+ while (-- i < 0 ) {
450
+ byte = reg_r (gspca_dev , 0x0060 );
451
+ if (!(byte & 0x01 ))
452
+ break ;
453
+ msleep (100 );
454
+ }
455
+ byte = reg_r (gspca_dev , 0x0063 );
456
+ if (byte != 0x17 ) {
457
+ err ("Bad sensor reset %02x" , byte );
458
+ /* continue? */
459
+ }
460
+
446
461
p = sensor_init ;
447
462
while (* p != 0 ) {
448
463
val [1 ] = * p ++ ;
@@ -458,7 +473,8 @@ static void om6802_sensor_init(struct gspca_dev *gspca_dev)
458
473
break ;
459
474
}
460
475
}
461
- reg_w (gspca_dev , 0x3c80 );
476
+ msleep (15 );
477
+ reg_w (gspca_dev , 0x3c80 );
462
478
}
463
479
464
480
/* this function is called at probe time */
@@ -512,8 +528,6 @@ static int sd_init(struct gspca_dev *gspca_dev)
512
528
{0x08 , 0x03 , 0x09 , 0x03 , 0x12 , 0x04 };
513
529
static const __u8 n2 [] =
514
530
{0x08 , 0x00 };
515
- static const __u8 nset [] =
516
- { 0x61 , 0x68 , 0x62 , 0xff , 0x60 , 0x07 };
517
531
static const __u8 n3 [] =
518
532
{0x61 , 0x68 , 0x65 , 0x0a , 0x60 , 0x04 };
519
533
static const __u8 n4 [] =
@@ -572,8 +586,7 @@ static int sd_init(struct gspca_dev *gspca_dev)
572
586
test_byte = 0 ;
573
587
i = 5 ;
574
588
while (-- i >= 0 ) {
575
- reg_w_buf (gspca_dev , nset , sizeof nset );
576
- msleep (5 );
589
+ reg_w_buf (gspca_dev , sensor_reset , sizeof sensor_reset );
577
590
test_byte = reg_r (gspca_dev , 0x0063 );
578
591
msleep (100 );
579
592
if (test_byte == 0x17 )
0 commit comments