diff options
author | Hans de Goede <hdegoede@redhat.com> | 2013-08-22 11:41:14 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <m.chehab@samsung.com> | 2013-08-24 03:49:56 -0400 |
commit | b82180dba53e71fbc1b08bc8beca75d1dea5e993 (patch) | |
tree | a8b9f6030936c203c29d36a2c229f55731e3b110 /drivers/media/usb/gspca | |
parent | 265d3b55ffdb5e9cf74fd85e2a841b04a82f3355 (diff) |
[media] gspca_ov519: Fix support for the Terratec Terracam USB Pro
This is a camera with an ov518+ revision 0 bridge + ov7620ae sensor,
which appearently needs different handling then the Trust spacecam 320, which
has an ov518+ revision 2 + ov7620ae sensor. The Terracam USB Pro used to write
this patch has kindly been provided by
Dr. Tilmann Bubeck <t.bubeck@reinform.de>.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Diffstat (limited to 'drivers/media/usb/gspca')
-rw-r--r-- | drivers/media/usb/gspca/ov519.c | 32 |
1 files changed, 25 insertions, 7 deletions
diff --git a/drivers/media/usb/gspca/ov519.c b/drivers/media/usb/gspca/ov519.c index a3958ee86816..8937d79fd176 100644 --- a/drivers/media/usb/gspca/ov519.c +++ b/drivers/media/usb/gspca/ov519.c | |||
@@ -75,6 +75,8 @@ struct sd { | |||
75 | struct v4l2_ctrl *brightness; | 75 | struct v4l2_ctrl *brightness; |
76 | }; | 76 | }; |
77 | 77 | ||
78 | u8 revision; | ||
79 | |||
78 | u8 packet_nr; | 80 | u8 packet_nr; |
79 | 81 | ||
80 | char bridge; | 82 | char bridge; |
@@ -3080,8 +3082,8 @@ static void ov518_configure(struct gspca_dev *gspca_dev) | |||
3080 | }; | 3082 | }; |
3081 | 3083 | ||
3082 | /* First 5 bits of custom ID reg are a revision ID on OV518 */ | 3084 | /* First 5 bits of custom ID reg are a revision ID on OV518 */ |
3083 | PDEBUG(D_PROBE, "Device revision %d", | 3085 | sd->revision = reg_r(sd, R51x_SYS_CUST_ID) & 0x1f; |
3084 | 0x1f & reg_r(sd, R51x_SYS_CUST_ID)); | 3086 | PDEBUG(D_PROBE, "Device revision %d", sd->revision); |
3085 | 3087 | ||
3086 | write_regvals(sd, init_518, ARRAY_SIZE(init_518)); | 3088 | write_regvals(sd, init_518, ARRAY_SIZE(init_518)); |
3087 | 3089 | ||
@@ -3657,7 +3659,11 @@ static void ov518_mode_init_regs(struct sd *sd) | |||
3657 | reg_w(sd, 0x2f, 0x80); | 3659 | reg_w(sd, 0x2f, 0x80); |
3658 | 3660 | ||
3659 | /******** Set the framerate ********/ | 3661 | /******** Set the framerate ********/ |
3660 | sd->clockdiv = 1; | 3662 | if (sd->bridge == BRIDGE_OV518PLUS && sd->revision == 0 && |
3663 | sd->sensor == SEN_OV7620AE) | ||
3664 | sd->clockdiv = 0; | ||
3665 | else | ||
3666 | sd->clockdiv = 1; | ||
3661 | 3667 | ||
3662 | /* Mode independent, but framerate dependent, regs */ | 3668 | /* Mode independent, but framerate dependent, regs */ |
3663 | /* 0x51: Clock divider; Only works on some cams which use 2 crystals */ | 3669 | /* 0x51: Clock divider; Only works on some cams which use 2 crystals */ |
@@ -3668,12 +3674,24 @@ static void ov518_mode_init_regs(struct sd *sd) | |||
3668 | if (sd->bridge == BRIDGE_OV518PLUS) { | 3674 | if (sd->bridge == BRIDGE_OV518PLUS) { |
3669 | switch (sd->sensor) { | 3675 | switch (sd->sensor) { |
3670 | case SEN_OV7620AE: | 3676 | case SEN_OV7620AE: |
3671 | if (sd->gspca_dev.width == 320) { | 3677 | /* |
3672 | reg_w(sd, 0x20, 0x00); | 3678 | * HdG: 640x480 needs special handling on device |
3673 | reg_w(sd, 0x21, 0x19); | 3679 | * revision 2, we check for device revison > 0 to |
3674 | } else { | 3680 | * avoid regressions, as we don't know the correct |
3681 | * thing todo for revision 1. | ||
3682 | * | ||
3683 | * Also this likely means we don't need to | ||
3684 | * differentiate between the OV7620 and OV7620AE, | ||
3685 | * earlier testing hitting this same problem likely | ||
3686 | * happened to be with revision < 2 cams using an | ||
3687 | * OV7620 and revision 2 cams using an OV7620AE. | ||
3688 | */ | ||
3689 | if (sd->revision > 0 && sd->gspca_dev.width == 640) { | ||
3675 | reg_w(sd, 0x20, 0x60); | 3690 | reg_w(sd, 0x20, 0x60); |
3676 | reg_w(sd, 0x21, 0x1f); | 3691 | reg_w(sd, 0x21, 0x1f); |
3692 | } else { | ||
3693 | reg_w(sd, 0x20, 0x00); | ||
3694 | reg_w(sd, 0x21, 0x19); | ||
3677 | } | 3695 | } |
3678 | break; | 3696 | break; |
3679 | case SEN_OV7620: | 3697 | case SEN_OV7620: |