diff options
author | Hans de Goede <hdegoede@redhat.com> | 2010-12-12 13:55:03 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2010-12-29 05:17:01 -0500 |
commit | 00765f16f116b45aa67de306ac923ed4ba262bf9 (patch) | |
tree | f3d25700d84a1d97867ac5b700ec006cafacf537 /drivers/media/video/gspca | |
parent | 2b3e284a89dfa53eb42b6470e4c03e5ddfdb24c5 (diff) |
[media] gspca_sonixb: Add support for 0c45:602a
Add support for cameras with the HV7131D sensor, such as the 0c45:602a
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/gspca')
-rw-r--r-- | drivers/media/video/gspca/sonixb.c | 70 |
1 files changed, 59 insertions, 11 deletions
diff --git a/drivers/media/video/gspca/sonixb.c b/drivers/media/video/gspca/sonixb.c index f47a82902fa..73504a3f87b 100644 --- a/drivers/media/video/gspca/sonixb.c +++ b/drivers/media/video/gspca/sonixb.c | |||
@@ -73,14 +73,15 @@ struct sd { | |||
73 | #define BRIDGE_103 1 | 73 | #define BRIDGE_103 1 |
74 | 74 | ||
75 | __u8 sensor; /* Type of image sensor chip */ | 75 | __u8 sensor; /* Type of image sensor chip */ |
76 | #define SENSOR_HV7131R 0 | 76 | #define SENSOR_HV7131D 0 |
77 | #define SENSOR_OV6650 1 | 77 | #define SENSOR_HV7131R 1 |
78 | #define SENSOR_OV7630 2 | 78 | #define SENSOR_OV6650 2 |
79 | #define SENSOR_PAS106 3 | 79 | #define SENSOR_OV7630 3 |
80 | #define SENSOR_PAS202 4 | 80 | #define SENSOR_PAS106 4 |
81 | #define SENSOR_TAS5110C 5 | 81 | #define SENSOR_PAS202 5 |
82 | #define SENSOR_TAS5110D 6 | 82 | #define SENSOR_TAS5110C 6 |
83 | #define SENSOR_TAS5130CXX 7 | 83 | #define SENSOR_TAS5110D 7 |
84 | #define SENSOR_TAS5130CXX 8 | ||
84 | __u8 reg11; | 85 | __u8 reg11; |
85 | }; | 86 | }; |
86 | 87 | ||
@@ -305,14 +306,29 @@ static const struct v4l2_pix_format sif_mode[] = { | |||
305 | .priv = 0}, | 306 | .priv = 0}, |
306 | }; | 307 | }; |
307 | 308 | ||
308 | static const __u8 initHv7131[] = { | 309 | static const __u8 initHv7131d[] = { |
310 | 0x04, 0x03, 0x00, 0x04, 0x00, 0x00, 0x00, 0x80, 0x11, 0x00, 0x00, 0x00, | ||
311 | 0x00, 0x00, | ||
312 | 0x00, 0x00, 0x00, 0x02, 0x02, 0x00, | ||
313 | 0x28, 0x1e, 0x60, 0x8e, 0x42, | ||
314 | 0x1d, 0x10, 0x02, 0x03, 0x0f, 0x0c | ||
315 | }; | ||
316 | static const __u8 hv7131d_sensor_init[][8] = { | ||
317 | {0xa0, 0x11, 0x01, 0x04, 0x00, 0x00, 0x00, 0x17}, | ||
318 | {0xa0, 0x11, 0x02, 0x00, 0x00, 0x00, 0x00, 0x17}, | ||
319 | {0xa0, 0x11, 0x28, 0x00, 0x00, 0x00, 0x00, 0x17}, | ||
320 | {0xa0, 0x11, 0x30, 0x30, 0x00, 0x00, 0x00, 0x17}, /* reset level */ | ||
321 | {0xa0, 0x11, 0x34, 0x02, 0x00, 0x00, 0x00, 0x17}, /* pixel bias volt */ | ||
322 | }; | ||
323 | |||
324 | static const __u8 initHv7131r[] = { | ||
309 | 0x46, 0x77, 0x00, 0x04, 0x00, 0x00, 0x00, 0x80, 0x11, 0x00, 0x00, 0x00, | 325 | 0x46, 0x77, 0x00, 0x04, 0x00, 0x00, 0x00, 0x80, 0x11, 0x00, 0x00, 0x00, |
310 | 0x00, 0x00, | 326 | 0x00, 0x00, |
311 | 0x00, 0x00, 0x00, 0x02, 0x01, 0x00, | 327 | 0x00, 0x00, 0x00, 0x02, 0x01, 0x00, |
312 | 0x28, 0x1e, 0x60, 0x8a, 0x20, | 328 | 0x28, 0x1e, 0x60, 0x8a, 0x20, |
313 | 0x1d, 0x10, 0x02, 0x03, 0x0f, 0x0c | 329 | 0x1d, 0x10, 0x02, 0x03, 0x0f, 0x0c |
314 | }; | 330 | }; |
315 | static const __u8 hv7131_sensor_init[][8] = { | 331 | static const __u8 hv7131r_sensor_init[][8] = { |
316 | {0xc0, 0x11, 0x31, 0x38, 0x2a, 0x2e, 0x00, 0x10}, | 332 | {0xc0, 0x11, 0x31, 0x38, 0x2a, 0x2e, 0x00, 0x10}, |
317 | {0xa0, 0x11, 0x01, 0x08, 0x2a, 0x2e, 0x00, 0x10}, | 333 | {0xa0, 0x11, 0x01, 0x08, 0x2a, 0x2e, 0x00, 0x10}, |
318 | {0xb0, 0x11, 0x20, 0x00, 0xd0, 0x2e, 0x00, 0x10}, | 334 | {0xb0, 0x11, 0x20, 0x00, 0xd0, 0x2e, 0x00, 0x10}, |
@@ -553,7 +569,8 @@ static const __u8 tas5130_sensor_init[][8] = { | |||
553 | }; | 569 | }; |
554 | 570 | ||
555 | static struct sensor_data sensor_data[] = { | 571 | static struct sensor_data sensor_data[] = { |
556 | SENS(initHv7131, NULL, hv7131_sensor_init, NULL, NULL, 0, NO_EXPO|NO_FREQ, 0), | 572 | SENS(initHv7131d, NULL, hv7131d_sensor_init, NULL, NULL, F_GAIN, NO_BRIGHTNESS|NO_FREQ, 0), |
573 | SENS(initHv7131r, NULL, hv7131r_sensor_init, NULL, NULL, 0, NO_BRIGHTNESS|NO_EXPO|NO_FREQ, 0), | ||
557 | SENS(initOv6650, NULL, ov6650_sensor_init, NULL, NULL, F_GAIN|F_SIF, 0, 0x60), | 574 | SENS(initOv6650, NULL, ov6650_sensor_init, NULL, NULL, F_GAIN|F_SIF, 0, 0x60), |
558 | SENS(initOv7630, initOv7630_3, ov7630_sensor_init, NULL, ov7630_sensor_init_3, | 575 | SENS(initOv7630, initOv7630_3, ov7630_sensor_init, NULL, ov7630_sensor_init_3, |
559 | F_GAIN, 0, 0x21), | 576 | F_GAIN, 0, 0x21), |
@@ -703,7 +720,18 @@ static void setsensorgain(struct gspca_dev *gspca_dev) | |||
703 | unsigned char gain = sd->gain; | 720 | unsigned char gain = sd->gain; |
704 | 721 | ||
705 | switch (sd->sensor) { | 722 | switch (sd->sensor) { |
723 | case SENSOR_HV7131D: { | ||
724 | __u8 i2c[] = | ||
725 | {0xc0, 0x11, 0x31, 0x00, 0x00, 0x00, 0x00, 0x17}; | ||
726 | |||
727 | i2c[3] = 0x3f - (sd->gain / 4); | ||
728 | i2c[4] = 0x3f - (sd->gain / 4); | ||
729 | i2c[5] = 0x3f - (sd->gain / 4); | ||
706 | 730 | ||
731 | if (i2c_w(gspca_dev, i2c) < 0) | ||
732 | goto err; | ||
733 | break; | ||
734 | } | ||
707 | case SENSOR_TAS5110C: | 735 | case SENSOR_TAS5110C: |
708 | case SENSOR_TAS5110D: { | 736 | case SENSOR_TAS5110D: { |
709 | __u8 i2c[] = | 737 | __u8 i2c[] = |
@@ -790,6 +818,23 @@ static void setexposure(struct gspca_dev *gspca_dev) | |||
790 | struct sd *sd = (struct sd *) gspca_dev; | 818 | struct sd *sd = (struct sd *) gspca_dev; |
791 | 819 | ||
792 | switch (sd->sensor) { | 820 | switch (sd->sensor) { |
821 | case SENSOR_HV7131D: { | ||
822 | /* Note the datasheet wrongly says line mode exposure uses reg | ||
823 | 0x26 and 0x27, testing has shown 0x25 + 0x26 */ | ||
824 | __u8 i2c[] = {0xc0, 0x11, 0x25, 0x00, 0x00, 0x00, 0x00, 0x17}; | ||
825 | /* The HV7131D's exposure goes from 0 - 65535, we scale our | ||
826 | exposure of 0-1023 to 0-6138. There are 2 reasons for this: | ||
827 | 1) This puts our exposure knee of 200 at approx the point | ||
828 | where the framerate starts dropping | ||
829 | 2) At 6138 the framerate has already dropped to 2 fps, | ||
830 | going any lower makes little sense */ | ||
831 | __u16 reg = sd->exposure * 6; | ||
832 | i2c[3] = reg >> 8; | ||
833 | i2c[4] = reg & 0xff; | ||
834 | if (i2c_w(gspca_dev, i2c) != 0) | ||
835 | goto err; | ||
836 | break; | ||
837 | } | ||
793 | case SENSOR_TAS5110C: | 838 | case SENSOR_TAS5110C: |
794 | case SENSOR_TAS5110D: { | 839 | case SENSOR_TAS5110D: { |
795 | /* register 19's high nibble contains the sn9c10x clock divider | 840 | /* register 19's high nibble contains the sn9c10x clock divider |
@@ -1494,9 +1539,12 @@ static const struct usb_device_id device_table[] __devinitconst = { | |||
1494 | #endif | 1539 | #endif |
1495 | {USB_DEVICE(0x0c45, 0x6028), SB(PAS202, 102)}, | 1540 | {USB_DEVICE(0x0c45, 0x6028), SB(PAS202, 102)}, |
1496 | {USB_DEVICE(0x0c45, 0x6029), SB(PAS106, 102)}, | 1541 | {USB_DEVICE(0x0c45, 0x6029), SB(PAS106, 102)}, |
1542 | {USB_DEVICE(0x0c45, 0x602a), SB(HV7131D, 102)}, | ||
1543 | /* {USB_DEVICE(0x0c45, 0x602b), SB(MI0343, 102)}, */ | ||
1497 | {USB_DEVICE(0x0c45, 0x602c), SB(OV7630, 102)}, | 1544 | {USB_DEVICE(0x0c45, 0x602c), SB(OV7630, 102)}, |
1498 | {USB_DEVICE(0x0c45, 0x602d), SB(HV7131R, 102)}, | 1545 | {USB_DEVICE(0x0c45, 0x602d), SB(HV7131R, 102)}, |
1499 | {USB_DEVICE(0x0c45, 0x602e), SB(OV7630, 102)}, | 1546 | {USB_DEVICE(0x0c45, 0x602e), SB(OV7630, 102)}, |
1547 | /* {USB_DEVICE(0x0c45, 0x602b), SB(MI03XX, 102)}, */ /* MI0343 MI0360 MI0330 */ | ||
1500 | {USB_DEVICE(0x0c45, 0x608f), SB(OV7630, 103)}, | 1548 | {USB_DEVICE(0x0c45, 0x608f), SB(OV7630, 103)}, |
1501 | #if !defined CONFIG_USB_SN9C102 && !defined CONFIG_USB_SN9C102_MODULE | 1549 | #if !defined CONFIG_USB_SN9C102 && !defined CONFIG_USB_SN9C102_MODULE |
1502 | {USB_DEVICE(0x0c45, 0x60af), SB(PAS202, 103)}, | 1550 | {USB_DEVICE(0x0c45, 0x60af), SB(PAS202, 103)}, |