summaryrefslogtreecommitdiff
path: root/linux/drivers/media/dvb/av7110/av7110.c
diff options
context:
space:
mode:
authorMichael Hunold <devnull@localhost>2002-12-29 22:15:54 +0000
committerMichael Hunold <devnull@localhost>2002-12-29 22:15:54 +0000
commit4ac441dd0b30a80cdcf026cc2952cc547bf5dbad (patch)
tree4c3a932425b22564f32df85049cc7674052b7702 /linux/drivers/media/dvb/av7110/av7110.c
parentbc7712bb01e71d41013f0b642740832819849d30 (diff)
downloadmediapointer-dvb-s2-4ac441dd0b30a80cdcf026cc2952cc547bf5dbad.tar.gz
mediapointer-dvb-s2-4ac441dd0b30a80cdcf026cc2952cc547bf5dbad.tar.bz2
Major cleanup: the goal is to get rid of the budget card <=> saa7146.o <=> videodev.o dependency,
so we can later split up the av7110 driver into a av7110 and budget card driver. I tested this on 2.4.18-3 (original RedHat 7.3 kernel) and 2.5.53. Changes in detail: saa7146: - fixed the unitialised timer warnings - split saa7146.o into saa7146.o and saa7146_vv.o: all videodev (ie. v4l) related stuff is now encapsulated in saa7146_vv.o. the extension (ie. mxb or dvb-ttpci) now has to make sure to register the v4l devices via helper functions provided by saa7146_vv mxb: - changes to make the driver compile with the new saa7146 and saa7146_vv parts - fix the vbi bypass issue for MXBs with saa7146, rev. 1 card av7110: - changes to make the driver compile with the new saa7146 and saa7146_vv parts - some changes related to the upcoming av7110 <=> budget splitup, but they are commented out - changed the saa7146 PAL values to experimental values that look good to me, but kept the old values as a comment. where are the original values from? there is a big black border on most channels on the left side which annoyed me... - changed from video/generic_usercopy() to dvb_usercopy() and put this into the source code, not into compat.c - moved the crc_32* stuff from compat.c to the source file where it is used - now compat.[ch] was removed completely, all references were deleted from all other files. other: - updated the README and TODO files - changed "makelinks" to remove alps_bsru6 stuff from kernel when making the symlinks - fixed the build files in "build-2.4" - fixed all other files needed for 2.5.x kernel build
Diffstat (limited to 'linux/drivers/media/dvb/av7110/av7110.c')
-rw-r--r--linux/drivers/media/dvb/av7110/av7110.c85
1 files changed, 48 insertions, 37 deletions
diff --git a/linux/drivers/media/dvb/av7110/av7110.c b/linux/drivers/media/dvb/av7110/av7110.c
index f0c75b5e5..77ccc15db 100644
--- a/linux/drivers/media/dvb/av7110/av7110.c
+++ b/linux/drivers/media/dvb/av7110/av7110.c
@@ -4517,7 +4517,7 @@ static
int av7110_attach (struct saa7146_dev* dev)
{
av7110_t *av7110 = (av7110_t*)dev->ext_priv;
- struct scatterlist *slist;
+ struct scatterlist *slist = NULL;
int slen = 0;
int length = TS_WIDTH*TS_HEIGHT;
int pages = (length+PAGE_SIZE-1)/PAGE_SIZE;
@@ -4525,8 +4525,13 @@ int av7110_attach (struct saa7146_dev* dev)
DEB_EE(("dev: %p, av7110: %p\n",dev,av7110));
- av7110->dev=(struct saa7146_dev *)dev;
+ saa7146_video_uops.init(dev);
+ if( 0 != saa7146_register_device(&av7110->vd, dev, "av7710", VFL_TYPE_GRABBER)) {
+ ERR(("cannot register capture device. skipping.\n"));
+ return -1;
+ }
+ av7110->dev=(struct saa7146_dev *)dev;
dvb_register_adapter(&av7110->dvb_adapter, av7110->card_type->name);
saa7146_i2c_adapter_prepare(dev, NULL, SAA7146_I2C_BUS_BIT_RATE_3200);
@@ -4537,32 +4542,31 @@ int av7110_attach (struct saa7146_dev* dev)
return -ENOMEM;
}
- av7110->grabbing = vmalloc(length);
- if (!av7110->grabbing) {
- printk(KERN_ERR "dvb: vmalloc() failed.\n");
- ret = -ENOMEM;
- goto err;
- }
+// fixme if (av7110->card_type->type >= DVB_CARD_TT_BUDGET)
+ av7110->grabbing = vmalloc(length);
+ if (!av7110->grabbing) {
+ printk(KERN_ERR "dvb: vmalloc() failed.\n");
+ ret = -ENOMEM;
+ goto err;
+ }
- if (!(slist = videobuf_vmalloc_to_sg(av7110->grabbing, pages))) {
- vfree(av7110->grabbing);
- printk(KERN_ERR "dvb: videobuf_vmalloc_to_sg() failed.\n");
- ret = -ENOMEM;
- goto err;
- }
+ if (!(slist = videobuf_vmalloc_to_sg(av7110->grabbing, pages))) {
+ printk(KERN_ERR "dvb: videobuf_vmalloc_to_sg() failed.\n");
+ ret = -ENOMEM;
+ goto err;
+ }
- // FIXME: is direction ok?
- if (saa7146_pgtable_alloc(dev->pci, &av7110->pt)) {
- printk(KERN_ERR "dvb: saa7146_pgtable_alloc() failed.\n");
- kfree(slist);
- vfree(av7110->grabbing);
- ret = -ENOMEM;
- goto err;
- }
-
- slen = pci_map_sg(dev->pci,slist,pages,PCI_DMA_FROMDEVICE);
- saa7146_pgtable_build_single(dev->pci, &av7110->pt, slist, slen);
+ if (saa7146_pgtable_alloc(dev->pci, &av7110->pt)) {
+ printk(KERN_ERR "dvb: saa7146_pgtable_alloc() failed.\n");
+ ret = -ENOMEM;
+ goto err;
+ }
+
+ slen = pci_map_sg(dev->pci,slist,pages,PCI_DMA_FROMDEVICE);
+ saa7146_pgtable_build_single(dev->pci, &av7110->pt, slist, slen);
+// }
+
saa7146_write(dev, PCI_BT_V1, 0x1c00101f);
saa7146_write(dev, BCS_CTRL, 0x80400040);
@@ -4703,6 +4707,12 @@ int av7110_attach (struct saa7146_dev* dev)
return 0;
err:
+ if( NULL != av7110->grabbing ) {
+ vfree(av7110->grabbing);
+ }
+ if( NULL != slist ) {
+ kfree(slist);
+ }
dvb_unregister_i2c_bus (master_xfer,av7110->i2c_bus->adapter, av7110->i2c_bus->id);
dvb_unregister_adapter (av7110->dvb_adapter);
return ret;
@@ -4714,6 +4724,8 @@ int av7110_detach (struct saa7146_dev* saa)
av7110_t *av7110 = (av7110_t*)saa->ext_priv;
DEB_EE(("av7110: %p\n",av7110));
+ saa7146_unregister_device(&av7110->vd, saa);
+
av7110->arm_rmmod=1;
wake_up_interruptible(&av7110->arm_wait);
@@ -4735,8 +4747,11 @@ int av7110_detach (struct saa7146_dev* saa)
pci_free_consistent(saa->pci, 8192, av7110->debi_virt,
av7110->debi_bus);
- saa7146_pgtable_free(saa->pci, &av7110->pt);
-
+// fixme if (av7110->card_type->type >= DVB_CARD_TT_BUDGET)
+ saa7146_pgtable_free(saa->pci, &av7110->pt);
+ vfree(av7110->grabbing);
+// }
+
dvb_unregister_i2c_bus (master_xfer,av7110->i2c_bus->adapter, av7110->i2c_bus->id);
dvb_unregister_adapter (av7110->dvb_adapter);
@@ -4784,12 +4799,12 @@ 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) */
+/* FIXME: these values are experimental values that look better than the
+ values from the latest "official" driver -- at least for me... (MiHu) */
static
struct saa7146_standard standard[] = {
- { "PAL", V4L2_STD_PAL, 0x15, 288, 576, 0x3a, 720, 721, 576, 768 },
+ { "PAL", V4L2_STD_PAL, 0x15, 288, 576, 0x4a, 708, 709, 576, 768 },
+// { "PAL", V4L2_STD_PAL, 0x15, 288, 576, 0x3a, 720, 721, 576, 768 },
/* FIXME: more to come here */
};
@@ -4799,11 +4814,9 @@ struct saa7146_extension av7110_extension = {
.inputs = 1,
.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,
+ .flags = SAA7146_EXT_SWAP_ODD_EVEN,
+
.devices = &sub_data[0],
.module = THIS_MODULE,
@@ -4816,8 +4829,6 @@ struct saa7146_extension av7110_extension = {
.num_stds = sizeof(standard)/sizeof(struct saa7146_standard),
.std_callback = NULL,
- .vbi = NULL,
-
.ioctls = &ioctls[0],
.preinit = av7110_preinit,