Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 226190
b: refs/heads/master
c: bc46bae
h: refs/heads/master
v: v3
  • Loading branch information
Hans de Goede authored and Mauro Carvalho Chehab committed Dec 29, 2010
1 parent eb3d9df commit f050f3a
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 11 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 2661da47daefd4f22f9fdc7e9294a1cb9edf515b
refs/heads/master: bc46bae6373c87897959c7aa8fb9f6c4218695b8
53 changes: 43 additions & 10 deletions trunk/drivers/media/video/gspca/xirlink_cit.c
Original file line number Diff line number Diff line change
Expand Up @@ -2769,16 +2769,55 @@ static int sd_start(struct gspca_dev *gspca_dev)
return 0;
}

static int sd_isoc_init(struct gspca_dev *gspca_dev)
{
struct usb_host_interface *alt;
int max_packet_size;

switch (gspca_dev->width) {
case 160:
max_packet_size = 450;
break;
case 176:
max_packet_size = 600;
break;
default:
max_packet_size = 1022;
break;
}

/* Start isoc bandwidth "negotiation" at max isoc bandwidth */
alt = &gspca_dev->dev->config->intf_cache[0]->altsetting[1];
alt->endpoint[0].desc.wMaxPacketSize = cpu_to_le16(max_packet_size);

return 0;
}

static int sd_isoc_nego(struct gspca_dev *gspca_dev)
{
int ret, packet_size;
int ret, packet_size, min_packet_size;
struct usb_host_interface *alt;

switch (gspca_dev->width) {
case 160:
min_packet_size = 200;
break;
case 176:
min_packet_size = 266;
break;
default:
min_packet_size = 400;
break;
}

alt = &gspca_dev->dev->config->intf_cache[0]->altsetting[1];
packet_size = le16_to_cpu(alt->endpoint[0].desc.wMaxPacketSize);
packet_size -= 100;
if (packet_size < 300)
if (packet_size <= min_packet_size)
return -EIO;

packet_size -= 100;
if (packet_size < min_packet_size)
packet_size = min_packet_size;
alt->endpoint[0].desc.wMaxPacketSize = cpu_to_le16(packet_size);

ret = usb_set_interface(gspca_dev->dev, gspca_dev->iface, 1);
Expand All @@ -2796,15 +2835,12 @@ static void sd_stopN(struct gspca_dev *gspca_dev)
static void sd_stop0(struct gspca_dev *gspca_dev)
{
struct sd *sd = (struct sd *) gspca_dev;
struct usb_host_interface *alt;

/* We cannot use gspca_dev->present here as that is not set when
sd_init gets called and we get called from sd_init */
if (!gspca_dev->dev)
return;

alt = &gspca_dev->dev->config->intf_cache[0]->altsetting[1];

switch (sd->model) {
case CIT_MODEL0:
/* HDG windows does this, but it causes the cams autogain to
Expand Down Expand Up @@ -2859,10 +2895,6 @@ static void sd_stop0(struct gspca_dev *gspca_dev)
restarting the stream after this */
/* cit_write_reg(gspca_dev, 0x0000, 0x0112); */
cit_write_reg(gspca_dev, 0x00c0, 0x0100);

/* Start isoc bandwidth "negotiation" at max isoc bandwith
next stream start */
alt->endpoint[0].desc.wMaxPacketSize = cpu_to_le16(1022);
break;
}
}
Expand Down Expand Up @@ -3179,6 +3211,7 @@ static const struct sd_desc sd_desc_isoc_nego = {
.config = sd_config,
.init = sd_init,
.start = sd_start,
.isoc_init = sd_isoc_init,
.isoc_nego = sd_isoc_nego,
.stopN = sd_stopN,
.stop0 = sd_stop0,
Expand Down

0 comments on commit f050f3a

Please sign in to comment.