summaryrefslogtreecommitdiff
path: root/linux/drivers/media/dvb/av7110
diff options
context:
space:
mode:
Diffstat (limited to 'linux/drivers/media/dvb/av7110')
-rw-r--r--linux/drivers/media/dvb/av7110/av7110.c85
-rw-r--r--linux/drivers/media/dvb/av7110/av7110.h2
2 files changed, 49 insertions, 38 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,
diff --git a/linux/drivers/media/dvb/av7110/av7110.h b/linux/drivers/media/dvb/av7110/av7110.h
index 71dac7464..a379a3fcd 100644
--- a/linux/drivers/media/dvb/av7110/av7110.h
+++ b/linux/drivers/media/dvb/av7110/av7110.h
@@ -483,7 +483,7 @@ typedef struct av7110_s {
struct dvb_device dvb_dev;
dvb_net_t dvb_net;
- struct video_device video;
+ struct video_device vd;
struct saa7146_dev *dev;