aboutsummaryrefslogtreecommitdiff
path: root/drivers/media/video/em28xx/em28xx-core.c
diff options
context:
space:
mode:
authorSascha Sommer <saschasommer@freenet.de>2005-11-08 21:38:10 -0800
committerLinus Torvalds <torvalds@g5.osdl.org>2005-11-09 07:56:24 -0800
commit52c02fcd00cf6fb6f5b2c8beae3b283c63cf1210 (patch)
tree575ef8bbbc7cd82ac9a129563fd2445d46ed7c2e /drivers/media/video/em28xx/em28xx-core.c
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/em28xx-core.c')
-rw-r--r--drivers/media/video/em28xx/em28xx-core.c38
1 files changed, 15 insertions, 23 deletions
diff --git a/drivers/media/video/em28xx/em28xx-core.c b/drivers/media/video/em28xx/em28xx-core.c
index ba2d986c6df..263b6c91adb 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,
int em2820_scaler_set(struct em2820 *dev, u16 h, u16 v)
{
- u8 buf[2];
- buf[0] = h;
- buf[1] = h >> 8;
- em2820_write_regs(dev, HSCALELOW_REG, (char *)buf, 2);
- buf[0] = v;
- buf[1] = v >> 8;
- em2820_write_regs(dev, VSCALELOW_REG, (char *)buf, 2);
- if(dev->is_em2800){
- /* FIXME */
- /* random ratio scaling and 720x567 doesn't seem to work */
- /* the maximum we can get is 640x480 with disabled scaler */
- /* and norm_maxw set to 640 */
- if(dev->width == 640 && dev->height == 480)
- return em2820_write_regs(dev, COMPR_REG,"\x00",1);
- if(dev->height > 288)
- return em2820_write_regs(dev, COMPR_REG,"\x10",1);
- if(dev->width > 360)
- return em2820_write_regs(dev, COMPR_REG,"\x20",1);
+ u8 mode;
+ /* the em2800 scaler only supports scaling down to 50% */
+ if(dev->is_em2800)
+ mode = (v ? 0x20 : 0x00) | (h ? 0x10 : 0x00);
+ else {
+ u8 buf[2];
+ buf[0] = h;
+ buf[1] = h >> 8;
+ em2820_write_regs(dev, HSCALELOW_REG, (char *)buf, 2);
+ buf[0] = v;
+ buf[1] = v >> 8;
+ em2820_write_regs(dev, VSCALELOW_REG, (char *)buf, 2);
+ /* it seems that both H and V scalers must be active to work correctly */
+ mode = (h || v)? 0x30: 0x00;
}
- /* when H and V mixershould be used? */
- /* return em2820_write_reg_bits(dev, COMPR_REG, (h ? 0x20 : 0x00) | (v ? 0x10 : 0x00), 0x30); */
- /* it seems that both H and V scalers must be active to work correctly */
- return em2820_write_reg_bits(dev, COMPR_REG, h
- || v ? 0x30 : 0x00, 0x30);
+ return em2820_write_reg_bits(dev, COMPR_REG, mode, 0x30);
}
/* FIXME: this only function read values from dev */