summaryrefslogtreecommitdiff
path: root/linux
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@infradead.org>2008-03-08 06:50:17 -0300
committerMauro Carvalho Chehab <mchehab@infradead.org>2008-03-08 06:50:17 -0300
commit073577d733f738c84aa56ef40de678f019b9c53c (patch)
treed87234e824095b8832d308f09e97543a637290eb /linux
parent4177905e93cd9f2d1de81831d10fd9137cac3ad6 (diff)
downloadmediapointer-dvb-s2-073577d733f738c84aa56ef40de678f019b9c53c.tar.gz
mediapointer-dvb-s2-073577d733f738c84aa56ef40de678f019b9c53c.tar.bz2
Fix em2800 altsetting selection.
From: Sascha Sommer <saschasommer@freenet.de> Signed-off-by: Sascha Sommer <saschasommer@freenet.de> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'linux')
-rw-r--r--linux/drivers/media/video/em28xx/em28xx-core.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/linux/drivers/media/video/em28xx/em28xx-core.c b/linux/drivers/media/video/em28xx/em28xx-core.c
index efc0e4a99..1f6abc803 100644
--- a/linux/drivers/media/video/em28xx/em28xx-core.c
+++ b/linux/drivers/media/video/em28xx/em28xx-core.c
@@ -876,19 +876,27 @@ int em28xx_set_alternate(struct em28xx *dev)
{
int errCode, prev_alt = dev->alt;
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
green screen will be received.
*/
if (dev->frame_size > 720*240*2)
min_pkt_size *= 2;
- for (i = 0; i < dev->num_alt; i++)
- if (dev->alt_max_pkt_size[i] >= min_pkt_size)
+ for (i = 0; i < dev->num_alt; i++) {
+ /* stop when the selected alt setting offers enough bandwidth */
+ if (dev->alt_max_pkt_size[i] >= min_pkt_size) {
+ dev->alt = i;
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) {
em28xx_coredbg("minimum isoc packet size: %u (alt=%d)\n",