aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/em28xx
diff options
context:
space:
mode:
authorSascha Sommer <saschasommer@freenet.de>2005-11-09 00:38:10 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2005-11-09 10:56:24 -0500
commit52c02fcd00cf6fb6f5b2c8beae3b283c63cf1210 (patch)
tree575ef8bbbc7cd82ac9a129563fd2445d46ed7c2e /drivers/media/video/em28xx
parent07345f5d6a92bc1184ca8b05069ec1cd3514fe11 (diff)
[PATCH] v4l: 850: update em2800 scaler code and comments based on info from empiatech
- Update em2800 scaler code and comments based on info from empiatech Signed-off-by: Sascha Sommer <saschasommer@freenet.de> Signed-off-by: Markus Rechberger <mrechberger@gmail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@brturbo.com.br> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/media/video/em28xx')
-rw-r--r--drivers/media/video/em28xx/em28xx-core.c38
-rw-r--r--drivers/media/video/em28xx/em28xx-video.c10
2 files changed, 22 insertions, 26 deletions
diff --git a/drivers/media/video/em28xx/em28xx-core.c b/drivers/media/video/em28xx/em28xx-core.c
index ba2d986c6dfc..263b6c91adb5 100644
--- a/drivers/media/video/em28xx/em28xx-core.c
+++ b/drivers/media/video/em28xx/em28xx-core.c
@@ -430,30 +430,22 @@ int em2820_capture_area_set(struct em2820 *dev, u8 hstart, u8 vstart,
430 430
431int em2820_scaler_set(struct em2820 *dev, u16 h, u16 v) 431int em2820_scaler_set(struct em2820 *dev, u16 h, u16 v)
432{ 432{
433 u8 buf[2]; 433 u8 mode;
434 buf[0] = h; 434 /* the em2800 scaler only supports scaling down to 50% */
435 buf[1] = h >> 8; 435 if(dev->is_em2800)
436 em2820_write_regs(dev, HSCALELOW_REG, (char *)buf, 2); 436 mode = (v ? 0x20 : 0x00) | (h ? 0x10 : 0x00);
437 buf[0] = v; 437 else {
438 buf[1] = v >> 8; 438 u8 buf[2];
439 em2820_write_regs(dev, VSCALELOW_REG, (char *)buf, 2); 439 buf[0] = h;
440 if(dev->is_em2800){ 440 buf[1] = h >> 8;
441 /* FIXME */ 441 em2820_write_regs(dev, HSCALELOW_REG, (char *)buf, 2);
442 /* random ratio scaling and 720x567 doesn't seem to work */ 442 buf[0] = v;
443 /* the maximum we can get is 640x480 with disabled scaler */ 443 buf[1] = v >> 8;
444 /* and norm_maxw set to 640 */ 444 em2820_write_regs(dev, VSCALELOW_REG, (char *)buf, 2);
445 if(dev->width == 640 && dev->height == 480) 445 /* it seems that both H and V scalers must be active to work correctly */
446 return em2820_write_regs(dev, COMPR_REG,"\x00",1); 446 mode = (h || v)? 0x30: 0x00;
447 if(dev->height > 288)
448 return em2820_write_regs(dev, COMPR_REG,"\x10",1);
449 if(dev->width > 360)
450 return em2820_write_regs(dev, COMPR_REG,"\x20",1);
451 } 447 }
452 /* when H and V mixershould be used? */ 448 return em2820_write_reg_bits(dev, COMPR_REG, mode, 0x30);
453 /* return em2820_write_reg_bits(dev, COMPR_REG, (h ? 0x20 : 0x00) | (v ? 0x10 : 0x00), 0x30); */
454 /* it seems that both H and V scalers must be active to work correctly */
455 return em2820_write_reg_bits(dev, COMPR_REG, h
456 || v ? 0x30 : 0x00, 0x30);
457} 449}
458 450
459/* FIXME: this only function read values from dev */ 451/* FIXME: this only function read values from dev */
diff --git a/drivers/media/video/em28xx/em28xx-video.c b/drivers/media/video/em28xx/em28xx-video.c
index 9f79c39349fb..a569be3e2f29 100644
--- a/drivers/media/video/em28xx/em28xx-video.c
+++ b/drivers/media/video/em28xx/em28xx-video.c
@@ -1308,14 +1308,18 @@ static int em2820_video_do_ioctl(struct inode *inode, struct file *filp,
1308 if (width > maxw) 1308 if (width > maxw)
1309 width = maxw; 1309 width = maxw;
1310 1310
1311 /* FIXME*/
1312 if(dev->is_em2800){ 1311 if(dev->is_em2800){
1313 /* we only know how to scale to 50% */ 1312 /* the em2800 can only scale down to 50% */
1314 if(height % (maxh / 2)) 1313 if(height % (maxh / 2))
1315 height=maxh; 1314 height=maxh;
1316 if(width % (maxw / 2)) 1315 if(width % (maxw / 2))
1317 width=maxw; 1316 width=maxw;
1318 /* larger resoltion don't seem to work either */ 1317 /* according to empiatech support */
1318 /* the MaxPacketSize is to small to support */
1319 /* framesizes larger than 640x480 @ 30 fps */
1320 /* or 640x576 @ 25 fps. As this would cut */
1321 /* of a part of the image we prefer */
1322 /* 360x576 or 360x480 for now */
1319 if(width == maxw && height == maxh) 1323 if(width == maxw && height == maxh)
1320 width /= 2; 1324 width /= 2;
1321 } 1325 }