diff options
author | Michael Hunold <devnull@localhost> | 2002-12-23 20:37:45 +0000 |
---|---|---|
committer | Michael Hunold <devnull@localhost> | 2002-12-23 20:37:45 +0000 |
commit | 6db9f8d774b8f70c56c786e1637367d5b5f2b6ca (patch) | |
tree | 05ddacee654b31c4d0fd4ae6a3a789730a2e1f4d | |
parent | 0a77956ce8816e957f40b1b5437c6b3e2fd62e34 (diff) | |
download | mediapointer-dvb-s2-6db9f8d774b8f70c56c786e1637367d5b5f2b6ca.tar.gz mediapointer-dvb-s2-6db9f8d774b8f70c56c786e1637367d5b5f2b6ca.tar.bz2 |
For some unobvious reason, analog cards (ie. the MXB) and digital cards
(ie. the av7110) handle the odd/even fields differently. I added a new
field to the extension, which holds special flags of the extension and the
device. I declared the MXB way of handling fields as "normal", so the
av7110 extension sets SAA7146_EXT_SWAP_ODD_EVEN here.
@Holger: I added some superfluous "struct saa7146_dev *dev" variables
back to some functions. These cause ugly warnings at compile time, I admit,
but they are necessary if you want to use the debug macros to trace a
saa7146 register for example. Please leave them in for now -- I need this
when I switch between old-DVB / old-MXB <=> new-DVB / new-MXB drivers and
try to hack out the differences.
-rw-r--r-- | linux/drivers/media/common/saa7146.h | 12 | ||||
-rw-r--r-- | linux/drivers/media/common/saa7146_core.c | 16 | ||||
-rw-r--r-- | linux/drivers/media/common/saa7146_hlp.c | 26 | ||||
-rw-r--r-- | linux/drivers/media/common/saa7146_vbi.c | 2 | ||||
-rw-r--r-- | linux/drivers/media/common/saa7146_video.c | 4 | ||||
-rw-r--r-- | linux/drivers/media/dvb/av7110/av7110.c | 7 | ||||
-rw-r--r-- | linux/drivers/media/video/mxb.c | 10 |
7 files changed, 53 insertions, 24 deletions
diff --git a/linux/drivers/media/common/saa7146.h b/linux/drivers/media/common/saa7146.h index c650cf70d..4fd023dd5 100644 --- a/linux/drivers/media/common/saa7146.h +++ b/linux/drivers/media/common/saa7146.h @@ -38,7 +38,8 @@ from flaws in video-buf.c => Gerd Knorr */ #define BOARD_CAN_DO_VBI(dev) (dev->revision != 0 && 0 != dev->ext->vbi) extern unsigned int saa7146_debug; -//#define DEBUG_PROLOG printk("(0x%08x) %s: %s(): ",(dev==0?-1:(dev->mem==0?-1:saa7146_read(dev,IER))),__stringify(KBUILD_MODNAME),__FUNCTION__) + +//#define DEBUG_PROLOG printk("(0x%08x)(0x%08x) %s: %s(): ",(dev==0?-1:(dev->mem==0?-1:saa7146_read(dev,RPS_ADDR0))),(dev==0?-1:(dev->mem==0?-1:saa7146_read(dev,IER))),__stringify(KBUILD_MODNAME),__FUNCTION__) #define DEBUG_PROLOG printk("%s: %s(): ",__stringify(KBUILD_MODNAME),__FUNCTION__) #define DEB_S(x) if (0!=(saa7146_debug&0x01)) { DEBUG_PROLOG; printk x; } /* simple debug messages */ @@ -75,13 +76,20 @@ struct saa7146_sub_info { #define SAA7146_BEFORE 0x2 #define SAA7146_AFTER 0x4 +/* flags */ +#define SAA7146_EXT_PROVIDES_VIDEO 0x1 /* provides vbi device */ +#define SAA7146_EXT_PROVIDES_VBI 0x2 /* provides vbi device */ +#define SAA7146_EXT_SWAP_ODD_EVEN 0x4 /* needs odd/even fields swapped */ + struct saa7146_extension { char name[32]; /* name of the device */ int inputs; int audios; u32 capabilities; - + + int flags; + struct list_head item; /* pairs of subvendor and subdevice ids for diff --git a/linux/drivers/media/common/saa7146_core.c b/linux/drivers/media/common/saa7146_core.c index 22c7f3e22..50ed45496 100644 --- a/linux/drivers/media/common/saa7146_core.c +++ b/linux/drivers/media/common/saa7146_core.c @@ -253,6 +253,7 @@ static int video_ioctl(struct inode *inode, struct file *file, unsigned int cmd, static int video_mmap(struct file *file, struct vm_area_struct * vma) { struct saa7146_fh *fh = file->private_data; + struct saa7146_dev *dev = fh->dev; struct videobuf_queue *q; switch (fh->type) { @@ -276,6 +277,7 @@ static int video_mmap(struct file *file, struct vm_area_struct * vma) static unsigned int video_poll(struct file *file, struct poll_table_struct *wait) { struct saa7146_fh *fh = file->private_data; + struct saa7146_dev *dev = fh->dev; struct videobuf_buffer *buf = NULL; struct videobuf_queue *q; @@ -307,6 +309,7 @@ static unsigned int video_poll(struct file *file, struct poll_table_struct *wait static ssize_t video_read(struct file *file, char *data, size_t count, loff_t *ppos) { struct saa7146_fh *fh = file->private_data; + struct saa7146_dev *dev = fh->dev; switch (fh->type) { case V4L2_BUF_TYPE_VIDEO_CAPTURE: { @@ -354,6 +357,7 @@ static void interrupt_hw(int irq, void *dev_id, struct pt_regs *regs) } saa7146_write(dev, ISR, isr); +// DEB_INT(("0x%08x\n",isr)); if( 0 != (dev->ext)) { if( 0 != (dev->ext->irq_mask & isr )) { @@ -638,6 +642,7 @@ static int try_match_device_to_extension(struct saa7146_dev *dev) static int try_match_extension_to_device(struct saa7146_extension *ext) { struct list_head *list = NULL; + struct saa7146_dev *dev = NULL; DEB_EE(("ext:%p, num:%d\n",ext,saa7146_num)); @@ -649,7 +654,7 @@ static int try_match_extension_to_device(struct saa7146_extension *ext) return -ERESTARTSYS; list_for_each(list,&devices) { - struct saa7146_dev *dev = list_entry(list, struct saa7146_dev, item); + dev = list_entry(list, struct saa7146_dev, item); try_attach_extension_and_device(dev,ext); } @@ -659,6 +664,8 @@ static int try_match_extension_to_device(struct saa7146_extension *ext) int saa7146_register_extension(struct saa7146_extension* ext) { + struct saa7146_dev *dev = NULL; + DEB_EE(("ext:%p\n",ext)); if( 0 == initialized ) { @@ -705,7 +712,7 @@ int saa7146_unregister_extension(struct saa7146_extension* ext) /* make sure to erase the minor number... */ dev->video_dev = device_template; -// dump_registers(dev); + dump_registers(dev); } list_del(&ext->item); @@ -892,6 +899,8 @@ static void unconfig_a_device(struct saa7146_dev* dev) static int __devinit saa7146_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) { + struct saa7146_dev *dev = NULL; + DEB_EE(("pdev:%p\n",pdev)); if (config_a_device(pdev)) @@ -932,6 +941,8 @@ struct pci_driver saa7146_driver = { static int __init saa7146_init_module(void) { + struct saa7146_dev *dev = NULL; + DEB_EE((".\n")); if( 0 == initialized ) { @@ -948,6 +959,7 @@ int __init saa7146_init_module(void) static void __exit saa7146_cleanup_module(void) { + struct saa7146_dev *dev = NULL; DEB_EE((".\n")); pci_unregister_driver(&saa7146_driver); } diff --git a/linux/drivers/media/common/saa7146_hlp.c b/linux/drivers/media/common/saa7146_hlp.c index 4ebbfa2ff..ec6b97aa8 100644 --- a/linux/drivers/media/common/saa7146_hlp.c +++ b/linux/drivers/media/common/saa7146_hlp.c @@ -595,9 +595,10 @@ void saa7146_set_position(struct saa7146_dev *dev, int w_x, int w_y, int w_heigh /* calculate memory offsets for picture, look if we shall top-down-flip */ vdma1.pitch = 2*b_bpl; if ( 0 == td_flip ) { - vdma1.base_odd = (u32)base + (w_y * (vdma1.pitch/2)) + (w_x * (b_depth / 8)); - vdma1.base_even = vdma1.base_odd + (vdma1.pitch / 2); - vdma1.prot_addr = vdma1.base_odd + (w_height * (vdma1.pitch / 2)); + vdma1.base_even = (u32)base + (w_y * (vdma1.pitch/2)) + (w_x * (b_depth / 8)); + vdma1.base_odd = vdma1.base_even + (vdma1.pitch / 2); + vdma1.prot_addr = vdma1.base_even + (w_height * (vdma1.pitch / 2)); + printk("0x%08x,0x%08x\n",vdma1.base_even,vdma1.base_odd); } else { vdma1.base_even = (u32)base + ((w_y+w_height) * (vdma1.pitch/2)) + (w_x * (b_depth / 8)); @@ -622,15 +623,7 @@ void saa7146_set_position(struct saa7146_dev *dev, int w_x, int w_y, int w_heigh vdma1.base_page = 0; vdma1.num_line_byte = (dev->standard->v_field<<16)+dev->standard->h_pixels; - saa7146_write(dev, BASE_EVEN1, vdma1.base_even); - saa7146_write(dev, BASE_ODD1, vdma1.base_odd); - saa7146_write(dev, PROT_ADDR1, vdma1.prot_addr); - saa7146_write(dev, BASE_PAGE1, vdma1.base_page); - saa7146_write(dev, PITCH1, vdma1.pitch); - saa7146_write(dev, NUM_LINE_BYTE1, vdma1.num_line_byte); - - /* update the video dma 1 registers */ - saa7146_write(dev, MC2, (MASK_02 | MASK_18)); + saa7146_write_out_dma(dev, 1, &vdma1); } static @@ -725,8 +718,13 @@ void saa7146_write_out_dma(struct saa7146_dev* dev, int which, struct saa7146_vi /* calculate starting address */ where = (which-1)*0x18; - saa7146_write(dev, where, vdma->base_odd); - saa7146_write(dev, where+0x04, vdma->base_even); + if( 0 != (dev->ext->flags & SAA7146_EXT_SWAP_ODD_EVEN)) { + saa7146_write(dev, where, vdma->base_even); + saa7146_write(dev, where+0x04, vdma->base_odd); + } else { + saa7146_write(dev, where, vdma->base_odd); + saa7146_write(dev, where+0x04, vdma->base_even); + } saa7146_write(dev, where+0x08, vdma->prot_addr); saa7146_write(dev, where+0x0c, vdma->pitch); saa7146_write(dev, where+0x10, vdma->base_page); diff --git a/linux/drivers/media/common/saa7146_vbi.c b/linux/drivers/media/common/saa7146_vbi.c index a6f4cb06f..be318cfee 100644 --- a/linux/drivers/media/common/saa7146_vbi.c +++ b/linux/drivers/media/common/saa7146_vbi.c @@ -261,10 +261,8 @@ int buffer_prepare(struct file *file, struct videobuf_buffer *vb) static int buffer_setup(struct file *file, int *count, int *size) { -/* struct saa7146_fh *fh = file->private_data; struct saa7146_dev *dev = fh->dev; -*/ int llength,lines; lines = 16 * 2 ; /* 2 fields */ diff --git a/linux/drivers/media/common/saa7146_video.c b/linux/drivers/media/common/saa7146_video.c index c0c01e2bd..8c0f19239 100644 --- a/linux/drivers/media/common/saa7146_video.c +++ b/linux/drivers/media/common/saa7146_video.c @@ -1145,8 +1145,8 @@ static int buffer_setup(struct file *file, int *count, int *size) { struct saa7146_fh *fh = file->private_data; -/* struct saa7146_dev *dev = fh->dev; +/* */ if (0 == *count || *count > MAX_SAA7146_CAPTURE_BUFFERS) *count = MAX_SAA7146_CAPTURE_BUFFERS; @@ -1167,8 +1167,8 @@ static void buffer_queue(struct file *file, struct videobuf_buffer *vb) { struct saa7146_fh *fh = file->private_data; -/* struct saa7146_dev *dev = fh->dev; +/* */ struct saa7146_buf *buf = (struct saa7146_buf *)vb; diff --git a/linux/drivers/media/dvb/av7110/av7110.c b/linux/drivers/media/dvb/av7110/av7110.c index a2f8448aa..eae95837c 100644 --- a/linux/drivers/media/dvb/av7110/av7110.c +++ b/linux/drivers/media/dvb/av7110/av7110.c @@ -4779,6 +4779,9 @@ void av7110_dec_use(struct saa7146_dev* adap) #endif +/* FIXME: 0x3a seems to be a little too small, you'll notice a small black bar on + some channels. perhaps increase this to 0x42? looks good for me, but is not + based on facts... (MiHu) */ static struct saa7146_standard standard[] = { { "PAL", V4L2_STD_PAL, 0x15, 288, 576, 0x3a, 720, 721, 576, 768 }, @@ -4792,6 +4795,10 @@ struct saa7146_extension av7110_extension = { .audios = 1, .capabilities = 0, + /* FIXME: SAA7146_EXT_PROVIDES_VIDEO not true for budget cards, + separate these two... */ + .flags = SAA7146_EXT_PROVIDES_VIDEO|SAA7146_EXT_SWAP_ODD_EVEN + .devices = &sub_data[0], .module = THIS_MODULE, diff --git a/linux/drivers/media/video/mxb.c b/linux/drivers/media/video/mxb.c index 572faa133..5b3c4b824 100644 --- a/linux/drivers/media/video/mxb.c +++ b/linux/drivers/media/video/mxb.c @@ -318,8 +318,8 @@ static int mxb_init_done(struct saa7146_dev* dev) /* select tuner-output on saa7111a */ i = 0; mxb->saa7111a->driver->command(mxb->saa7111a,DECODER_SET_INPUT, &i); - i = VIDEO_MODE_PAL; - mxb->saa7111a->driver->command(mxb->saa7111a,DECODER_SET_NORM, &i); +// i = VIDEO_MODE_PAL; +// mxb->saa7111a->driver->command(mxb->saa7111a,DECODER_SET_NORM, &i); /* select a tuner type */ i = 5; @@ -954,6 +954,8 @@ struct saa7146_extension extension = { .inputs = MXB_INPUTS, .audios = MXB_AUDIOS, .capabilities = V4L2_CAP_TUNER, + + .flags = SAA7146_EXT_PROVIDES_VIDEO|SAA7146_EXT_PROVIDES_VBI, .devices = &sub_data[0], .module = THIS_MODULE, @@ -983,6 +985,8 @@ struct saa7146_extension extension = { int __init mxb_init_module(void) { + struct saa7146_dev *dev = NULL; + if( 0 != saa7146_register_extension(&extension)) { DEB_S(("failed to register extension.\n")); return -ENODEV; @@ -993,6 +997,8 @@ int __init mxb_init_module(void) void __exit mxb_cleanup_module(void) { + struct saa7146_dev *dev = NULL; + saa7146_unregister_extension(&extension); } |