aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video
diff options
context:
space:
mode:
authorSascha Sommer <saschasommer@freenet.de>2008-04-22 13:45:47 -0400
committerMauro Carvalho Chehab <mchehab@infradead.org>2008-04-24 13:07:49 -0400
commit2c4a07b2da61bcd33f18195ff7f355c5bb285904 (patch)
tree8128eb02dabe6cd81cb74d715dec8d2a34f92f09 /drivers/media/video
parent4a24ce3a17ee713056db0a24cf558bd595211302 (diff)
V4L/DVB (7331): Fix em2800 altsetting selection
Signed-off-by: Sascha Sommer <saschasommer@freenet.de> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media/video')
-rw-r--r--drivers/media/video/em28xx/em28xx-core.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/drivers/media/video/em28xx/em28xx-core.c b/drivers/media/video/em28xx/em28xx-core.c
index dbea89c115b1..4ebef10b5722 100644
--- a/drivers/media/video/em28xx/em28xx-core.c
+++ b/drivers/media/video/em28xx/em28xx-core.c
@@ -813,19 +813,27 @@ int em28xx_set_alternate(struct em28xx *dev)
813{ 813{
814 int errCode, prev_alt = dev->alt; 814 int errCode, prev_alt = dev->alt;
815 int i; 815 int i;
816 unsigned int min_pkt_size = dev->bytesperline+4; 816 unsigned int min_pkt_size = dev->bytesperline + 4;
817 817
818 /* When image size is bigger than a ceirtain value, 818 /* When image size is bigger than a certain value,
819 the frame size should be increased, otherwise, only 819 the frame size should be increased, otherwise, only
820 green screen will be received. 820 green screen will be received.
821 */ 821 */
822 if (dev->frame_size > 720*240*2) 822 if (dev->frame_size > 720*240*2)
823 min_pkt_size *= 2; 823 min_pkt_size *= 2;
824 824
825 for (i = 0; i < dev->num_alt; i++) 825 for (i = 0; i < dev->num_alt; i++) {
826 if (dev->alt_max_pkt_size[i] >= min_pkt_size) 826 /* stop when the selected alt setting offers enough bandwidth */
827 if (dev->alt_max_pkt_size[i] >= min_pkt_size) {
828 dev->alt = i;
827 break; 829 break;
828 dev->alt = i; 830 /* otherwise make sure that we end up with the maximum bandwidth
831 because the min_pkt_size equation might be wrong...
832 */
833 } else if (dev->alt_max_pkt_size[i] >
834 dev->alt_max_pkt_size[dev->alt])
835 dev->alt = i;
836 }
829 837
830 if (dev->alt != prev_alt) { 838 if (dev->alt != prev_alt) {
831 em28xx_coredbg("minimum isoc packet size: %u (alt=%d)\n", 839 em28xx_coredbg("minimum isoc packet size: %u (alt=%d)\n",