diff options
Diffstat (limited to 'drivers/media/video/gspca/stv06xx/stv06xx_pb0100.c')
-rw-r--r-- | drivers/media/video/gspca/stv06xx/stv06xx_pb0100.c | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/drivers/media/video/gspca/stv06xx/stv06xx_pb0100.c b/drivers/media/video/gspca/stv06xx/stv06xx_pb0100.c index 285221e6b390..ac47b4c94388 100644 --- a/drivers/media/video/gspca/stv06xx/stv06xx_pb0100.c +++ b/drivers/media/video/gspca/stv06xx/stv06xx_pb0100.c | |||
@@ -208,11 +208,24 @@ static int pb0100_probe(struct sd *sd) | |||
208 | 208 | ||
209 | static int pb0100_start(struct sd *sd) | 209 | static int pb0100_start(struct sd *sd) |
210 | { | 210 | { |
211 | int err; | 211 | int err, packet_size, max_packet_size; |
212 | struct usb_host_interface *alt; | ||
213 | struct usb_interface *intf; | ||
212 | struct cam *cam = &sd->gspca_dev.cam; | 214 | struct cam *cam = &sd->gspca_dev.cam; |
213 | s32 *sensor_settings = sd->sensor_priv; | 215 | s32 *sensor_settings = sd->sensor_priv; |
214 | u32 mode = cam->cam_mode[sd->gspca_dev.curr_mode].priv; | 216 | u32 mode = cam->cam_mode[sd->gspca_dev.curr_mode].priv; |
215 | 217 | ||
218 | intf = usb_ifnum_to_if(sd->gspca_dev.dev, sd->gspca_dev.iface); | ||
219 | alt = usb_altnum_to_altsetting(intf, sd->gspca_dev.alt); | ||
220 | packet_size = le16_to_cpu(alt->endpoint[0].desc.wMaxPacketSize); | ||
221 | |||
222 | /* If we don't have enough bandwidth use a lower framerate */ | ||
223 | max_packet_size = sd->sensor->max_packet_size[sd->gspca_dev.curr_mode]; | ||
224 | if (packet_size < max_packet_size) | ||
225 | stv06xx_write_sensor(sd, PB_ROWSPEED, BIT(4)|BIT(3)|BIT(1)); | ||
226 | else | ||
227 | stv06xx_write_sensor(sd, PB_ROWSPEED, BIT(5)|BIT(3)|BIT(1)); | ||
228 | |||
216 | /* Setup sensor window */ | 229 | /* Setup sensor window */ |
217 | if (mode & PB0100_CROP_TO_VGA) { | 230 | if (mode & PB0100_CROP_TO_VGA) { |
218 | stv06xx_write_sensor(sd, PB_RSTART, 30); | 231 | stv06xx_write_sensor(sd, PB_RSTART, 30); |
@@ -328,9 +341,6 @@ static int pb0100_init(struct sd *sd) | |||
328 | stv06xx_write_bridge(sd, STV_REG03, 0x45); | 341 | stv06xx_write_bridge(sd, STV_REG03, 0x45); |
329 | stv06xx_write_bridge(sd, STV_REG04, 0x07); | 342 | stv06xx_write_bridge(sd, STV_REG04, 0x07); |
330 | 343 | ||
331 | /* ISO-Size (0x27b: 635... why? - HDCS uses 847) */ | ||
332 | stv06xx_write_bridge(sd, STV_ISO_SIZE_L, 847); | ||
333 | |||
334 | /* Scan/timing for the sensor */ | 344 | /* Scan/timing for the sensor */ |
335 | stv06xx_write_sensor(sd, PB_ROWSPEED, BIT(4)|BIT(3)|BIT(1)); | 345 | stv06xx_write_sensor(sd, PB_ROWSPEED, BIT(4)|BIT(3)|BIT(1)); |
336 | stv06xx_write_sensor(sd, PB_CFILLIN, 14); | 346 | stv06xx_write_sensor(sd, PB_CFILLIN, 14); |