V4L/DVB: gspca_xirlink_cit: Use alt setting -> fps formula for model 1 cams too

gspca_xirlink_cit: Use alt setting -> fps formula for model 1 cams too

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
This commit is contained in:
Hans de Goede 2010-08-30 14:47:45 -03:00 committed by Mauro Carvalho Chehab
parent 659fefa0eb
commit 55c1b7d357

View File

@ -1659,7 +1659,19 @@ static int cit_start_model0(struct gspca_dev *gspca_dev)
static int cit_start_model1(struct gspca_dev *gspca_dev) static int cit_start_model1(struct gspca_dev *gspca_dev)
{ {
struct sd *sd = (struct sd *) gspca_dev; struct sd *sd = (struct sd *) gspca_dev;
int i, clock_div = 0; int clock_div = 7; /* 0=30 1=25 2=20 3=15 4=12 5=7.5 6=6 7=3fps ?? */
int fps[8] = { 30, 25, 20, 15, 12, 8, 6, 3 };
int i, packet_size;
packet_size = cit_get_packet_size(gspca_dev);
if (packet_size < 0)
return packet_size;
while (clock_div > 3 &&
1000 * packet_size >
gspca_dev->width * gspca_dev->height *
fps[clock_div - 1] * 3 / 2)
clock_div--;
cit_read_reg(gspca_dev, 0x0128); cit_read_reg(gspca_dev, 0x0128);
cit_read_reg(gspca_dev, 0x0100); cit_read_reg(gspca_dev, 0x0100);
@ -1767,7 +1779,6 @@ static int cit_start_model1(struct gspca_dev *gspca_dev)
cit_write_reg(gspca_dev, 0x0b, 0x011d); cit_write_reg(gspca_dev, 0x0b, 0x011d);
cit_write_reg(gspca_dev, 0x00, 0x011e); /* Same everywhere */ cit_write_reg(gspca_dev, 0x00, 0x011e); /* Same everywhere */
cit_write_reg(gspca_dev, 0x00, 0x0129); cit_write_reg(gspca_dev, 0x00, 0x0129);
clock_div = 3;
break; break;
case 176: /* 176x144 */ case 176: /* 176x144 */
cit_write_reg(gspca_dev, 0xb0, 0x0103); cit_write_reg(gspca_dev, 0xb0, 0x0103);
@ -1777,7 +1788,6 @@ static int cit_start_model1(struct gspca_dev *gspca_dev)
cit_write_reg(gspca_dev, 0x0d, 0x011d); cit_write_reg(gspca_dev, 0x0d, 0x011d);
cit_write_reg(gspca_dev, 0x00, 0x011e); /* Same everywhere */ cit_write_reg(gspca_dev, 0x00, 0x011e); /* Same everywhere */
cit_write_reg(gspca_dev, 0x03, 0x0129); cit_write_reg(gspca_dev, 0x03, 0x0129);
clock_div = 3;
break; break;
case 352: /* 352x288 */ case 352: /* 352x288 */
cit_write_reg(gspca_dev, 0xb0, 0x0103); cit_write_reg(gspca_dev, 0xb0, 0x0103);
@ -1787,7 +1797,6 @@ static int cit_start_model1(struct gspca_dev *gspca_dev)
cit_write_reg(gspca_dev, 0x05, 0x011d); cit_write_reg(gspca_dev, 0x05, 0x011d);
cit_write_reg(gspca_dev, 0x00, 0x011e); /* Same everywhere */ cit_write_reg(gspca_dev, 0x00, 0x011e); /* Same everywhere */
cit_write_reg(gspca_dev, 0x00, 0x0129); cit_write_reg(gspca_dev, 0x00, 0x0129);
clock_div = 5;
break; break;
} }
@ -1852,6 +1861,7 @@ static int cit_start_model1(struct gspca_dev *gspca_dev)
cit_write_reg(gspca_dev, 0x01, 0x0100); /* LED On */ cit_write_reg(gspca_dev, 0x01, 0x0100); /* LED On */
cit_write_reg(gspca_dev, clock_div, 0x0111); cit_write_reg(gspca_dev, clock_div, 0x0111);
PDEBUG(D_PROBE, "Using clockdiv: %d", clock_div);
return 0; return 0;
} }