aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/media/sn9c102_ov7630.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/usb/media/sn9c102_ov7630.c')
-rw-r--r--drivers/usb/media/sn9c102_ov7630.c33
1 files changed, 19 insertions, 14 deletions
diff --git a/drivers/usb/media/sn9c102_ov7630.c b/drivers/usb/media/sn9c102_ov7630.c
index 4a36519b5af4..42852b7cb042 100644
--- a/drivers/usb/media/sn9c102_ov7630.c
+++ b/drivers/usb/media/sn9c102_ov7630.c
@@ -34,8 +34,8 @@ static int ov7630_init(struct sn9c102_device* cam)
34 err += sn9c102_write_reg(cam, 0x0f, 0x18); 34 err += sn9c102_write_reg(cam, 0x0f, 0x18);
35 err += sn9c102_write_reg(cam, 0x50, 0x19); 35 err += sn9c102_write_reg(cam, 0x50, 0x19);
36 36
37 err += sn9c102_i2c_write(cam, 0x12, 0x8d); 37 err += sn9c102_i2c_write(cam, 0x12, 0x80);
38 err += sn9c102_i2c_write(cam, 0x11, 0x00); 38 err += sn9c102_i2c_write(cam, 0x11, 0x01);
39 err += sn9c102_i2c_write(cam, 0x15, 0x34); 39 err += sn9c102_i2c_write(cam, 0x15, 0x34);
40 err += sn9c102_i2c_write(cam, 0x16, 0x03); 40 err += sn9c102_i2c_write(cam, 0x16, 0x03);
41 err += sn9c102_i2c_write(cam, 0x17, 0x1c); 41 err += sn9c102_i2c_write(cam, 0x17, 0x1c);
@@ -43,12 +43,14 @@ static int ov7630_init(struct sn9c102_device* cam)
43 err += sn9c102_i2c_write(cam, 0x19, 0x06); 43 err += sn9c102_i2c_write(cam, 0x19, 0x06);
44 err += sn9c102_i2c_write(cam, 0x1a, 0xf6); 44 err += sn9c102_i2c_write(cam, 0x1a, 0xf6);
45 err += sn9c102_i2c_write(cam, 0x1b, 0x04); 45 err += sn9c102_i2c_write(cam, 0x1b, 0x04);
46 err += sn9c102_i2c_write(cam, 0x20, 0x44); 46 err += sn9c102_i2c_write(cam, 0x20, 0xf6);
47 err += sn9c102_i2c_write(cam, 0x23, 0xee); 47 err += sn9c102_i2c_write(cam, 0x23, 0xee);
48 err += sn9c102_i2c_write(cam, 0x26, 0xa0); 48 err += sn9c102_i2c_write(cam, 0x26, 0xa0);
49 err += sn9c102_i2c_write(cam, 0x27, 0x9a); 49 err += sn9c102_i2c_write(cam, 0x27, 0x9a);
50 err += sn9c102_i2c_write(cam, 0x28, 0x20); 50 err += sn9c102_i2c_write(cam, 0x28, 0xa0);
51 err += sn9c102_i2c_write(cam, 0x29, 0x30); 51 err += sn9c102_i2c_write(cam, 0x29, 0x30);
52 err += sn9c102_i2c_write(cam, 0x2a, 0xa0);
53 err += sn9c102_i2c_write(cam, 0x2b, 0x1f);
52 err += sn9c102_i2c_write(cam, 0x2f, 0x3d); 54 err += sn9c102_i2c_write(cam, 0x2f, 0x3d);
53 err += sn9c102_i2c_write(cam, 0x30, 0x24); 55 err += sn9c102_i2c_write(cam, 0x30, 0x24);
54 err += sn9c102_i2c_write(cam, 0x32, 0x86); 56 err += sn9c102_i2c_write(cam, 0x32, 0x86);
@@ -80,7 +82,7 @@ static int ov7630_set_ctrl(struct sn9c102_device* cam,
80 err += sn9c102_i2c_write(cam, 0x02, ctrl->value); 82 err += sn9c102_i2c_write(cam, 0x02, ctrl->value);
81 break; 83 break;
82 case V4L2_CID_BLUE_BALANCE: 84 case V4L2_CID_BLUE_BALANCE:
83 err += sn9c102_i2c_write(cam, 0x03, ctrl->value); 85 err += sn9c102_i2c_write(cam, 0x01, ctrl->value);
84 break; 86 break;
85 case V4L2_CID_GAIN: 87 case V4L2_CID_GAIN:
86 err += sn9c102_i2c_write(cam, 0x00, ctrl->value); 88 err += sn9c102_i2c_write(cam, 0x00, ctrl->value);
@@ -108,7 +110,7 @@ static int ov7630_set_ctrl(struct sn9c102_device* cam,
108 err += sn9c102_i2c_write(cam, 0x0d, ctrl->value); 110 err += sn9c102_i2c_write(cam, 0x0d, ctrl->value);
109 break; 111 break;
110 case V4L2_CID_AUTO_WHITE_BALANCE: 112 case V4L2_CID_AUTO_WHITE_BALANCE:
111 err += sn9c102_i2c_write(cam, 0x12, (ctrl->value << 2) | 0x09); 113 err += sn9c102_i2c_write(cam, 0x12, (ctrl->value << 2) | 0x78);
112 break; 114 break;
113 case V4L2_CID_AUTOGAIN: 115 case V4L2_CID_AUTOGAIN:
114 err += sn9c102_i2c_write(cam, 0x13, ctrl->value); 116 err += sn9c102_i2c_write(cam, 0x13, ctrl->value);
@@ -371,26 +373,29 @@ static struct sn9c102_sensor ov7630 = {
371 373
372int sn9c102_probe_ov7630(struct sn9c102_device* cam) 374int sn9c102_probe_ov7630(struct sn9c102_device* cam)
373{ 375{
376 const struct usb_device_id ov7630_id_table[] = {
377 { USB_DEVICE(0x0c45, 0x602c), },
378 { USB_DEVICE(0x0c45, 0x602d), },
379 { USB_DEVICE(0x0c45, 0x608f), },
380 { USB_DEVICE(0x0c45, 0x60b0), },
381 { }
382 };
374 int err = 0; 383 int err = 0;
375 384
376 sn9c102_attach_sensor(cam, &ov7630); 385 if (!sn9c102_match_id(cam, ov7630_id_table))
377
378 if (le16_to_cpu(ov7630.usbdev->descriptor.idProduct) != 0x602c &&
379 le16_to_cpu(ov7630.usbdev->descriptor.idProduct) != 0x602d &&
380 le16_to_cpu(ov7630.usbdev->descriptor.idProduct) != 0x608f &&
381 le16_to_cpu(ov7630.usbdev->descriptor.idProduct) != 0x60b0)
382 return -ENODEV; 386 return -ENODEV;
383 387
384 err += sn9c102_write_reg(cam, 0x01, 0x01); 388 err += sn9c102_write_reg(cam, 0x01, 0x01);
385 err += sn9c102_write_reg(cam, 0x00, 0x01); 389 err += sn9c102_write_reg(cam, 0x00, 0x01);
386 err += sn9c102_write_reg(cam, 0x28, 0x17); 390 err += sn9c102_write_reg(cam, 0x28, 0x17);
387
388 if (err) 391 if (err)
389 return -EIO; 392 return -EIO;
390 393
391 err += sn9c102_i2c_write(cam, 0x0b, 0); 394 err += sn9c102_i2c_try_write(cam, &ov7630, 0x0b, 0);
392 if (err) 395 if (err)
393 return -ENODEV; 396 return -ENODEV;
394 397
398 sn9c102_attach_sensor(cam, &ov7630);
399
395 return 0; 400 return 0;
396} 401}