V4L/DVB (7331): Fix em2800 altsetting selection
Signed-off-by: Sascha Sommer <saschasommer@freenet.de> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
This commit is contained in:
committed by
Mauro Carvalho Chehab
parent
4a24ce3a17
commit
2c4a07b2da
@@ -813,19 +813,27 @@ int em28xx_set_alternate(struct em28xx *dev)
|
|||||||
{
|
{
|
||||||
int errCode, prev_alt = dev->alt;
|
int errCode, prev_alt = dev->alt;
|
||||||
int i;
|
int i;
|
||||||
unsigned int min_pkt_size = dev->bytesperline+4;
|
unsigned int min_pkt_size = dev->bytesperline + 4;
|
||||||
|
|
||||||
/* When image size is bigger than a ceirtain value,
|
/* When image size is bigger than a certain value,
|
||||||
the frame size should be increased, otherwise, only
|
the frame size should be increased, otherwise, only
|
||||||
green screen will be received.
|
green screen will be received.
|
||||||
*/
|
*/
|
||||||
if (dev->frame_size > 720*240*2)
|
if (dev->frame_size > 720*240*2)
|
||||||
min_pkt_size *= 2;
|
min_pkt_size *= 2;
|
||||||
|
|
||||||
for (i = 0; i < dev->num_alt; i++)
|
for (i = 0; i < dev->num_alt; i++) {
|
||||||
if (dev->alt_max_pkt_size[i] >= min_pkt_size)
|
/* stop when the selected alt setting offers enough bandwidth */
|
||||||
|
if (dev->alt_max_pkt_size[i] >= min_pkt_size) {
|
||||||
|
dev->alt = i;
|
||||||
break;
|
break;
|
||||||
dev->alt = i;
|
/* otherwise make sure that we end up with the maximum bandwidth
|
||||||
|
because the min_pkt_size equation might be wrong...
|
||||||
|
*/
|
||||||
|
} else if (dev->alt_max_pkt_size[i] >
|
||||||
|
dev->alt_max_pkt_size[dev->alt])
|
||||||
|
dev->alt = i;
|
||||||
|
}
|
||||||
|
|
||||||
if (dev->alt != prev_alt) {
|
if (dev->alt != prev_alt) {
|
||||||
em28xx_coredbg("minimum isoc packet size: %u (alt=%d)\n",
|
em28xx_coredbg("minimum isoc packet size: %u (alt=%d)\n",
|
||||||
|
Reference in New Issue
Block a user