summaryrefslogtreecommitdiff
path: root/linux
diff options
context:
space:
mode:
Diffstat (limited to 'linux')
-rw-r--r--linux/drivers/media/common/Kconfig2
-rw-r--r--linux/drivers/media/common/saa7146.h23
-rw-r--r--linux/drivers/media/common/saa7146_core.c284
-rw-r--r--linux/drivers/media/dvb/ttpci-budget/Makefile4
-rw-r--r--linux/drivers/media/dvb/ttpci-budget/budget-av.c60
-rw-r--r--linux/drivers/media/dvb/ttpci-budget/budget.c626
-rw-r--r--linux/drivers/media/dvb/ttpci-budget/budget.h11
-rw-r--r--linux/drivers/media/dvb/ttpci/av7110.c201
8 files changed, 311 insertions, 900 deletions
diff --git a/linux/drivers/media/common/Kconfig b/linux/drivers/media/common/Kconfig
index 87edcbb98..206ab6ea0 100644
--- a/linux/drivers/media/common/Kconfig
+++ b/linux/drivers/media/common/Kconfig
@@ -1,7 +1,7 @@
config VIDEO_SAA7146
tristate
default y if DVB_AV7110=y || DVB_BUDGET=y || DVB_BUDGET_AV=y || VIDEO_MXB=y
- default m if DVB_AV7110=y || DVB_BUDGET=m || DVB_BUDGET_AV=m || VIDEO_MXB=m
+ default m if DVB_AV7110=m || DVB_BUDGET=m || DVB_BUDGET_AV=m || VIDEO_MXB=m
depends on VIDEO_DEV && PCI
config VIDEO_VIDEOBUF
diff --git a/linux/drivers/media/common/saa7146.h b/linux/drivers/media/common/saa7146.h
index 39ecdda33..2b1329f89 100644
--- a/linux/drivers/media/common/saa7146.h
+++ b/linux/drivers/media/common/saa7146.h
@@ -54,13 +54,6 @@ struct saa7146_dev;
struct saa7146_extension;
struct saa7146_vv;
-struct saa7146_sub_info {
- unsigned int subvendor;
- unsigned int subdevice;
- char **name;
- int type;
-};
-
/* saa7146 page table */
struct saa7146_pgtable {
unsigned int size;
@@ -70,6 +63,11 @@ struct saa7146_pgtable {
unsigned long offset;
};
+struct saa7146_pci_extension_data {
+ struct saa7146_extension *ext;
+ void *ext_priv; /* most likely a name string */
+};
+
struct saa7146_extension
{
char name[32]; /* name of the device */
@@ -78,21 +76,20 @@ struct saa7146_extension
struct saa7146_ext_vv *ext_vv_data;
- struct list_head item;
-
/* pairs of subvendor and subdevice ids for
supported devices, last entry 0xffff, 0xfff */
- struct saa7146_sub_info *devices;
struct module *module;
-
+ struct pci_driver driver;
+ struct pci_device_id *pci_tbl;
+
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,51)
void (*inc_use)(struct saa7146_dev*);
void (*dec_use)(struct saa7146_dev*);
#endif
/* extension functions */
- int (*probe)(struct saa7146_dev*, unsigned int subvendor, unsigned int subdevice);
- int (*attach)(struct saa7146_dev *, struct saa7146_sub_info *);
+ int (*probe)(struct saa7146_dev *);
+ int (*attach)(struct saa7146_dev *, struct saa7146_pci_extension_data *);
int (*detach)(struct saa7146_dev*);
u32 irq_mask; /* mask to indicate, which irq-events are handled by the extension */
diff --git a/linux/drivers/media/common/saa7146_core.c b/linux/drivers/media/common/saa7146_core.c
index f45830613..67f2d3734 100644
--- a/linux/drivers/media/common/saa7146_core.c
+++ b/linux/drivers/media/common/saa7146_core.c
@@ -193,153 +193,18 @@ static void interrupt_hw(int irq, void *dev_id, struct pt_regs *regs)
}
/*********************************************************************************/
-/* extension handling functions */
-
-void try_attach_extension_and_device(struct saa7146_dev *dev, struct saa7146_extension *ext)
-{
- int i = 0;
- int found = 0;
-
- DEB_EE(("dev:%p, ext:%p, num:%d\n",dev,ext,saa7146_num));
-
- /* check if already handled by extension */
- if( 0 != dev->ext ) {
- return;
- }
-
- DEB_S(("Trying device %p...\n",dev));
-
- /* first check the subvendor and subdevice ids */
- for(i = 0;;i++) {
- if( 0xffff == ext->devices[i].subvendor
- && 0xffff == ext->devices[i].subdevice ) {
- break;
- }
- if( ext->devices[i].subvendor == dev->pci->subsystem_vendor
- && ext->devices[i].subdevice == dev->pci->subsystem_device ) {
- found = 1;
- break;
- }
- }
- if( 0 == found ) {
- DEB_S(("extension %p does not handle this device. skipping.\n",ext));
- return;
- }
-
- dev->ext = ext;
- if( 0 != ext->probe) {
- if( 0 != ext->probe(dev, dev->pci->subsystem_vendor, dev->pci->subsystem_device) ) {
- DEB_D(("ext->probe() failed for %p. skipping device.\n",dev));
- dev->ext = NULL;
- return;
- }
- }
-
- if( 0 != ext->attach(dev, &ext->devices[i]) ) {
- DEB_D(("ext->attach() failed for %p. skipping device.\n",dev));
- dev->ext = NULL;
- return;
- }
-}
-
-static int try_match_device_to_extension(struct saa7146_dev *dev)
-{
- struct list_head *list = NULL;
-
- DEB_EE(("dev:%p\n",dev));
-
- if (down_interruptible(&saa7146_devices_lock))
- return -ERESTARTSYS;
-
- list_for_each(list,&extensions) {
- struct saa7146_extension *ext = list_entry(list, struct saa7146_extension, item);
- try_attach_extension_and_device(dev,ext);
- }
-
- up(&saa7146_devices_lock);
- return 0;
-}
-
-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));
-
- if( 0 == saa7146_num ) {
- return 0;
- }
-
- if (down_interruptible(&saa7146_devices_lock))
- return -ERESTARTSYS;
-
- list_for_each(list,&saa7146_devices) {
- dev = list_entry(list, struct saa7146_dev, item);
- try_attach_extension_and_device(dev,ext);
- }
-
- up(&saa7146_devices_lock);
- return 0;
-}
-
-int saa7146_register_extension(struct saa7146_extension* ext)
-{
- DEB_EE(("ext:%p\n",ext));
-
- if( 0 == initialized ) {
- INIT_LIST_HEAD(&saa7146_devices);
- init_MUTEX(&saa7146_devices_lock);
- INIT_LIST_HEAD(&extensions);
- initialized = 1;
- }
-
- INIT_LIST_HEAD(&ext->item);
- list_add_tail(&ext->item,&extensions);
-
- return try_match_extension_to_device(ext);
-}
-
-int saa7146_unregister_extension(struct saa7146_extension* ext)
-{
- struct saa7146_dev *dev = NULL;
- struct list_head *list = NULL;;
-
- DEB_EE(("ext:%p\n",ext));
-
- down(&saa7146_devices_lock);
-
- list_for_each(list,&saa7146_devices) {
- dev = list_entry(list, struct saa7146_dev, item);
-
- /* check if handled by this extension */
- if( ext != dev->ext ) {
- continue;
- }
-
- if( 0 != ext->detach(dev) ) {
- DEB_D(("ext->detach() failed. ignoring.\n"));
- }
-
- dump_registers(dev);
- dev->ext = NULL;
-
- }
- list_del(&ext->item);
-
- up(&saa7146_devices_lock);
-
- return 0;
-}
-
-/*********************************************************************************/
/* configuration-functions */
-static int config_a_device(struct pci_dev *pci)
+static
+int saa7146_init_one(struct pci_dev *pci, const struct pci_device_id *ent)
{
unsigned long adr = 0, len = 0;
struct saa7146_dev* dev = kmalloc (sizeof(struct saa7146_dev),GFP_KERNEL);
-
+
+ struct saa7146_pci_extension_data *pci_ext = (struct saa7146_pci_extension_data *)ent->driver_data;
+ struct saa7146_extension* ext = pci_ext->ext;
+ int err = 0;
+
if (!(dev = kmalloc (sizeof(struct saa7146_dev),GFP_KERNEL))) {
ERR(("out of memory.\n"));
return -ENOMEM;
@@ -352,8 +217,8 @@ static int config_a_device(struct pci_dev *pci)
if (pci_enable_device(pci)) {
ERR(("pci_enable_device() failed.\n"));
- kfree(dev);
- return -EIO;
+ err = -EIO;
+ goto pci_error;
}
/* enable bus-mastering */
@@ -363,8 +228,8 @@ static int config_a_device(struct pci_dev *pci)
/* get chip-revision; this is needed to enable bug-fixes */
if( 0 > pci_read_config_dword(dev->pci, PCI_CLASS_REVISION, &dev->revision)) {
ERR(("pci_read_config_dword() failed.\n"));
- kfree(dev);
- return -ENODEV;
+ err = -ENODEV;
+ goto pci_error;
}
dev->revision &= 0xf;
@@ -374,15 +239,14 @@ static int config_a_device(struct pci_dev *pci)
if (!request_mem_region(pci_resource_start(pci,0), pci_resource_len(pci,0), "saa7146")) {
ERR(("request_mem_region() failed.\n"));
- kfree(dev);
- return -ENODEV;
+ err = -ENODEV;
+ goto pci_error;
}
if (!(dev->mem = ioremap(adr,len))) {
ERR(("ioremap() failed.\n"));
- release_mem_region(adr,len);
- kfree(dev);
- return -ENODEV;
+ err = -ENODEV;
+ goto ioremap_error;
}
/* we don't do a master reset here anymore, it screws up
@@ -406,26 +270,30 @@ static int config_a_device(struct pci_dev *pci)
dev->name, dev))
{
ERR(("request_irq() failed.\n"));
- iounmap(dev->mem);
- release_mem_region(adr,len);
- kfree(dev);
- return -EINVAL;
+ err = -ENODEV;
+ goto irq_error;
}
/* get memory for various stuff */
dev->rps0 = (u32*)kmalloc(SAA7146_RPS_MEM, GFP_KERNEL);
- if( NULL == dev->rps0 )
+ if( NULL == dev->rps0 ) {
+ err = -ENOMEM;
goto kmalloc_error_1;
+ }
memset(dev->rps0, 0x0, SAA7146_RPS_MEM);
dev->rps1 = (u32*)kmalloc(SAA7146_RPS_MEM, GFP_KERNEL);
- if( NULL == dev->rps1 )
+ if( NULL == dev->rps1 ) {
+ err = -ENOMEM;
goto kmalloc_error_2;
+ }
memset(dev->rps1, 0x0, SAA7146_RPS_MEM);
dev->i2c_mem = (u32*)kmalloc(SAA7146_I2C_MEM, GFP_KERNEL);
- if( NULL == dev->i2c_mem )
+ if( NULL == dev->i2c_mem ) {
+ err = -ENOMEM;
goto kmalloc_error_3;
+ }
memset(dev->i2c_mem, 0x00, SAA7146_I2C_MEM);
/* the rest + print status message */
@@ -434,7 +302,7 @@ static int config_a_device(struct pci_dev *pci)
sprintf(&dev->name[0], "saa7146 (%d)",saa7146_num);
INFO(("found saa7146 @ mem 0x%08x (revision %d, irq %d) (0x%04x,0x%04x).\n", (unsigned int)dev->mem, dev->revision,dev->pci->irq,dev->pci->subsystem_vendor,dev->pci->subsystem_device));
- dev->ext = NULL;
+ dev->ext = ext;
pci_set_drvdata(pci,dev);
@@ -451,25 +319,49 @@ static int config_a_device(struct pci_dev *pci)
dev->module = THIS_MODULE;
init_waitqueue_head(&dev->i2c_wq);
- return try_match_device_to_extension(dev);
+ if( 0 != ext->probe) {
+ if( 0 != ext->probe(dev) ) {
+ DEB_D(("ext->probe() failed for %p. skipping device.\n",dev));
+ err = -ENODEV;
+ goto probe_error;
+ }
+ }
+ if( 0 != ext->attach(dev,pci_ext) ) {
+ DEB_D(("ext->attach() failed for %p. skipping device.\n",dev));
+ err = -ENODEV;
+ goto attach_error;
+ }
+ err = 0;
+ goto out;
+attach_error:
+probe_error:
+ pci_set_drvdata(pci,NULL);
+ kfree( dev->i2c_mem );
kmalloc_error_3:
kfree( dev->rps1 );
kmalloc_error_2:
kfree( dev->rps0 );
kmalloc_error_1:
- ERR(("kmalloc() failed.\n"));
+ free_irq(dev->pci->irq, (void *)dev);
+irq_error:
iounmap(dev->mem);
+ioremap_error:
release_mem_region(adr,len);
+pci_error:
kfree(dev);
-
- return -ENOMEM;
+out:
+ return err;
}
-static void unconfig_a_device(struct saa7146_dev* dev)
+static
+void saa7146_remove_one(struct pci_dev *pdev)
{
+ struct saa7146_dev* dev = (struct saa7146_dev*) pci_get_drvdata(pdev);
DEB_EE(("dev:%p\n",dev));
+ dev->ext->detach(dev);
+
/* shut down all video dma transfers */
saa7146_write(dev, MC1, 0x00ff0000);
@@ -492,68 +384,51 @@ static void unconfig_a_device(struct saa7146_dev* dev)
saa7146_num--;
}
+/*********************************************************************************/
+/* extension handling functions */
-static
-int __devinit saa7146_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
+int saa7146_register_extension(struct saa7146_extension* ext)
{
- DEB_EE(("pdev:%p\n",pdev));
+ DEB_EE(("ext:%p\n",ext));
- if (config_a_device(pdev))
- return -EINVAL;
+ if( 0 == initialized ) {
+ INIT_LIST_HEAD(&saa7146_devices);
+ init_MUTEX(&saa7146_devices_lock);
+ INIT_LIST_HEAD(&extensions);
+ initialized = 1;
+ }
- return 0;
+ ext->driver.name = "saa7146";
+ ext->driver.id_table = ext->pci_tbl;
+ ext->driver.probe = saa7146_init_one;
+ ext->driver.remove = saa7146_remove_one;
+
+ return pci_module_init(&ext->driver);
}
-
-static
-void __devexit saa7146_remove_one(struct pci_dev *pdev)
+int saa7146_unregister_extension(struct saa7146_extension* ext)
{
- struct saa7146_dev* dev = (struct saa7146_dev*) pci_get_drvdata(pdev);
-
- DEB_EE(("pdev:%p\n",pdev));
- unconfig_a_device(dev);
+ DEB_EE(("ext:%p\n",ext));
+ pci_unregister_driver(&ext->driver);
+ return 0;
}
-
-static
-struct pci_device_id saa7146_pci_tbl[] __devinitdata = {
- {
- .vendor = PCI_VENDOR_ID_PHILIPS,
- .device = PCI_DEVICE_ID_PHILIPS_SAA7146,
- } , {
- .vendor = 0,
- }
-};
-
-MODULE_DEVICE_TABLE(pci, saa7146_pci_tbl);
-
-static
-struct pci_driver saa7146_driver = {
- .name = "saa7146",
- .id_table = saa7146_pci_tbl,
- .probe = saa7146_init_one,
- .remove = __devexit_p(saa7146_remove_one)
-};
-
-
static
-int __init saa7146_init_module(void)
+int saa7146_init_module(void)
{
+ printk("saa7146_init_module()\n");
if( 0 == initialized ) {
INIT_LIST_HEAD(&saa7146_devices);
init_MUTEX(&saa7146_devices_lock);
INIT_LIST_HEAD(&extensions);
initialized = 1;
}
-
- return pci_module_init(&saa7146_driver);
+ return 0;
}
-
static
void __exit saa7146_cleanup_module(void)
{
- pci_unregister_driver(&saa7146_driver);
}
module_init(saa7146_init_module);
@@ -579,4 +454,3 @@ EXPORT_SYMBOL_GPL(saa7146_devices_lock);
MODULE_AUTHOR("Michael Hunold <michael@mihu.de>");
MODULE_DESCRIPTION("driver for generic saa7146-based hardware");
MODULE_LICENSE("GPL");
-
diff --git a/linux/drivers/media/dvb/ttpci-budget/Makefile b/linux/drivers/media/dvb/ttpci-budget/Makefile
index 10c075828..efa90b4d6 100644
--- a/linux/drivers/media/dvb/ttpci-budget/Makefile
+++ b/linux/drivers/media/dvb/ttpci-budget/Makefile
@@ -2,8 +2,8 @@
# Makefile for the kernel AV7110 DVB device driver
#
-dvb-ttpci-budget-objs := budget.o
-dvb-ttpci-budget-av-objs := budget-av.o
+dvb-ttpci-budget-objs := budget-core.o budget.o
+dvb-ttpci-budget-av-objs := budget-core.o budget-av.o
obj-$(CONFIG_DVB_BUDGET) += dvb-ttpci-budget.o
obj-$(CONFIG_DVB_BUDGET_AV) += dvb-ttpci-budget-av.o
diff --git a/linux/drivers/media/dvb/ttpci-budget/budget-av.c b/linux/drivers/media/dvb/ttpci-budget/budget-av.c
index 729ac0b35..ea5f16615 100644
--- a/linux/drivers/media/dvb/ttpci-budget/budget-av.c
+++ b/linux/drivers/media/dvb/ttpci-budget/budget-av.c
@@ -31,26 +31,35 @@
*/
#include "budget.h"
+#include "saa7146_vv.h"
+
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,51)
#define KBUILD_MODNAME budget_av
#endif
-#include "saa7146_vv.h"
+static struct saa7146_extension budget_extension;
-static int budget_debug = 0;
-static char *knc1 = "KNC1 DVB-S";
+struct budget_info knc1_info = {
+ .name = "KNC1 DVB-S",
+ .type = DVB_CARD_KNC1,
+};
-static struct saa7146_sub_info sub_data[] = {
+static
+struct saa7146_pci_extension_data knc1 = {
+ .ext_priv = &knc1_info,
+ .ext = &budget_extension,
+};
+
+static
+struct pci_device_id devices[] = {
{
+ .vendor = PCI_VENDOR_ID_PHILIPS,
+ .device = PCI_DEVICE_ID_PHILIPS_SAA7146,
.subvendor = 0x1131,
.subdevice = 0x4f56,
- .name = &knc1,
- .type = DVB_CARD_KNC1
+ .driver_data = (unsigned long)&knc1,
}, {
- .subvendor = 0xffff,
- .subdevice = 0xffff,
- .name = NULL,
- .type = 0
+ .vendor = 0,
}
};
@@ -185,13 +194,14 @@ void knc1_setinput(struct budget_s *budget, int i)
}
static
-int av_attach (struct saa7146_dev* dev, struct saa7146_sub_info *info)
+int av_attach (struct saa7146_dev* dev, struct saa7146_pci_extension_data *info)
{
struct budget_s *budget = NULL;
struct budget_av_data *data = NULL;
+ struct budget_info *bi = info->ext_priv;
DEB_EE(("dev: %p\n",dev));
- if (info->type != DVB_CARD_KNC1) {
+ if (bi->type != DVB_CARD_KNC1) {
return -1;
}
@@ -245,7 +255,7 @@ int av_attach (struct saa7146_dev* dev, struct saa7146_sub_info *info)
// FIXME: cope with error here!
budget_register(budget);
- printk(KERN_INFO "budget: found budget card w/ video-in '%s'.\n",*budget->card->name);
+ printk(KERN_INFO "budget-av: found budget card w/ video-in '%s'.\n",budget->card->name);
return 0;
}
@@ -253,7 +263,7 @@ int av_attach (struct saa7146_dev* dev, struct saa7146_sub_info *info)
#define KNC1_INPUTS 2
static struct v4l2_input knc1_inputs[KNC1_INPUTS] = {
{ 0, "Composite", V4L2_INPUT_TYPE_TUNER, 1, 0, V4L2_STD_PAL_BG|V4L2_STD_NTSC_M, 0 },
- { 1, "S_Video", V4L2_INPUT_TYPE_CAMERA, 2, 0, V4L2_STD_PAL_BG|V4L2_STD_NTSC_M, 0 },
+ { 1, "S-Video", V4L2_INPUT_TYPE_CAMERA, 2, 0, V4L2_STD_PAL_BG|V4L2_STD_NTSC_M, 0 },
};
static struct saa7146_extension_ioctls ioctls[] = {
@@ -340,30 +350,12 @@ struct saa7146_ext_vv vv_data = {
.ioctl = av_ioctl,
};
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,51)
-static
-void budget_inc_use(struct saa7146_dev* adap)
-{
- MOD_INC_USE_COUNT;
-}
-
-static
-void budget_dec_use(struct saa7146_dev* adap)
-{
- MOD_DEC_USE_COUNT;
-}
-#endif
-
static
struct saa7146_extension budget_extension = {
.name = "budget dvb /w video in\0",
- .devices = &sub_data[0],
+ .pci_tbl = &devices[0],
.module = THIS_MODULE,
.ext_vv_data = &vv_data,
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,51)
- .inc_use = budget_inc_use,
- .dec_use = budget_dec_use,
-#endif
.attach = av_attach,
.detach = av_detach,
.irq_mask = MASK_07,
@@ -397,5 +389,3 @@ MODULE_DESCRIPTION("driver for the SAA7146 based so-called budget PCI DVB cards
"Siemens, Technotrend, Hauppauge");
MODULE_AUTHOR("Ralph Metzler, Marcus Metzler, others");
MODULE_LICENSE("GPL");
-
-MODULE_PARM(budget_debug,"i");
diff --git a/linux/drivers/media/dvb/ttpci-budget/budget.c b/linux/drivers/media/dvb/ttpci-budget/budget.c
index 2334b2222..550936044 100644
--- a/linux/drivers/media/dvb/ttpci-budget/budget.c
+++ b/linux/drivers/media/dvb/ttpci-budget/budget.c
@@ -34,450 +34,101 @@
#define KBUILD_MODNAME budget
#endif
-static int budget_debug = 0;
+static struct saa7146_extension budget_extension;
-/****************************************************************************
- * General helper functions
- ****************************************************************************/
-
-/* this is videobuf_vmalloc_to_sg() from video-buf.c */
-struct scatterlist*
-vmalloc_to_sg(unsigned char *virt, int nr_pages)
-{
- struct scatterlist *sglist;
- struct page *pg;
- int i;
-
- sglist = kmalloc(sizeof(struct scatterlist)*nr_pages, GFP_KERNEL);
- if (NULL == sglist)
- return NULL;
- memset(sglist,0,sizeof(struct scatterlist)*nr_pages);
- for (i = 0; i < nr_pages; i++, virt += PAGE_SIZE) {
- pg = vmalloc_to_page(virt);
- if (NULL == pg)
- goto err;
- if (PageHighMem(pg))
- BUG();
- sglist[i].page = pg;
- sglist[i].length = PAGE_SIZE;
- }
- return sglist;
-
- err:
- kfree(sglist);
- return NULL;
-}
-
-
-static inline void ddelay(int i)
-{
- current->state=TASK_INTERRUPTIBLE;
- schedule_timeout((HZ*i)/100);
-}
-
-/****************************************************************************
- * TT budget / WinTV Nova
- ****************************************************************************/
-
-static int
-TTBStop(struct budget_s *budget)
-{
- DEB_EE(("budget: %p\n",budget));
-
- if (--budget->feeding)
- return budget->feeding;
-
- saa7146_write(budget->dev, MC1, MASK_20); // DMA3 off
- IER_DISABLE(budget->dev, MASK_07);
- return 0;
-}
-
-static int
-TTBStart(struct budget_s *budget)
-{
- struct saa7146_dev *dev=budget->dev;
-
- DEB_EE(("budget: %p\n",budget));
-
- if (budget->feeding)
- return ++budget->feeding;
-
- saa7146_write(dev, MC1, MASK_20); // DMA3 off
-
- memset(budget->grabbing, 0x00, TS_HEIGHT*TS_WIDTH);
-
- saa7146_write(dev, PCI_BT_V1, 0x001c0000);
-
- budget->tsf=0;
- budget->ttbp=0;
- saa7146_write(dev, DD1_INIT, 0x02000680);
- saa7146_write(dev, MC2, (MASK_09 | MASK_25 | MASK_10 | MASK_26));
-
- saa7146_write(dev, BRS_CTRL, 0x60000000);
- saa7146_write(dev, MC2, (MASK_08 | MASK_24));
- mdelay(10);
-
- saa7146_write(dev, BASE_ODD3, 0);
- saa7146_write(dev, BASE_EVEN3, TS_WIDTH*TS_HEIGHT/2);
- saa7146_write(dev, PROT_ADDR3, TS_WIDTH*TS_HEIGHT);
- saa7146_write(dev, BASE_PAGE3, budget->pt.dma |ME1|0xb0);
- saa7146_write(dev, PITCH3, TS_WIDTH);
-
- saa7146_write(dev, NUM_LINE_BYTE3, ((TS_HEIGHT/2)<<16)|TS_WIDTH);
- saa7146_write(dev, MC2, (MASK_04 | MASK_20));
-
- saa7146_write(dev, MC1, (MASK_04 | MASK_20)); // DMA3 on
-
- // FIDB
- IER_ENABLE(budget->dev, MASK_07);
-
- return ++budget->feeding;
-}
+struct budget_info ttbs_info = {
+ .name = "TT-Budget/WinTV-NOVA-S PCI",
+ .type = DVB_CARD_TT_BUDGET,
+};
+struct budget_info ttbc_info = {
+ .name = "TT-Budget/WinTV-NOVA-C PCI",
+ .type = DVB_CARD_TT_BUDGET,
+};
+struct budget_info ttbt_info = {
+ .name = "TT-Budget/WinTV-NOVA-T PCI",
+ .type = DVB_CARD_TT_BUDGET,
+};
+struct budget_info ttbci_info = {
+ .name = "TT-Budget/WinTV-NOVA-CI PCI",
+ .type = DVB_CARD_TT_BUDGET,
+};
+struct budget_info satel_info = {
+ .name = "SATELCO Multimedia PCI",
+ .type = DVB_CARD_TT_BUDGET_CI,
+};
static
-void fidbirq (unsigned long data)
-{
- struct budget_s *budget = (struct budget_s*) data;
- u8 *mem=(u8 *)(budget->grabbing);
- int num;
- u32 dmapos;
-
- DEB_EE(("budget: %p\n",budget));
-
- dmapos=saa7146_read(budget->dev, PCI_VDP3);
- dmapos-=(dmapos%188);
-
- if (dmapos>=TS_BUFLEN) {
- DEB_S(("bogus dmapos value ignored, budget: %p\n",budget));
- return;
- }
-
- if (budget->tsf) {
- mem+=budget->ttbp;
- if (dmapos<0x20000) {
- num=1024-budget->ttbp/188;
- budget->ttbp=0;
- } else {
- num=(dmapos - budget->ttbp)/188;
- budget->ttbp=dmapos;
- }
- } else {
- if (budget->ttbp>1000*188 && budget->ttbp<1024*188) {
- if (budget->feeding)
- dvb_dmx_swfilter_packets(&budget->demux,
- mem+budget->ttbp,
- 1024- budget->ttbp / 188);
- }
- num=dmapos/188;
- budget->ttbp=dmapos;
- }
-
- budget->tsf^=1;
- saa7146_write(budget->dev, DD1_INIT, 0x02000600|(budget->tsf ? 0x40:0x80));
- saa7146_write(budget->dev, MC2,
- (MASK_09 | MASK_25 | MASK_10 | MASK_26));
-
- // FIXME: use bottom half or tasklet
- if (budget->feeding && mem[0]==0x47)
- dvb_dmx_swfilter_packets(&budget->demux, mem, num);
-}
-
-inline static void
-Set22K(struct budget_s *budget, int state)
-{
- struct saa7146_dev *dev=budget->dev;
- DEB_EE(("budget: %p\n",budget));
- saa7146_setgpio(dev, 3, (state ? SAA7146_GPIO_OUTHI : SAA7146_GPIO_OUTLO));
-}
-
-
-/* Diseqc functions only for TT Budget card */
-/* taken from the Skyvision DVB driver by
- Ralph Metzler <rjkm@metzlerbros.de> */
-
-inline static void
-DiseqcSendBit(struct budget_s *budget, int data)
-{
- struct saa7146_dev *dev=budget->dev;
- DEB_EE(("budget: %p\n",budget));
-
- saa7146_setgpio(dev, 3, SAA7146_GPIO_OUTHI);
- udelay(data ? 500 : 1000);
- saa7146_setgpio(dev, 3, SAA7146_GPIO_OUTLO);
- udelay(data ? 1000 : 500);
-}
-
-static void
-DiseqcSendByte(struct budget_s *budget, int data)
-{
- int i, par=1, d;
-
- DEB_EE(("budget: %p\n",budget));
-
- for (i=7; i>=0; i--)
- {
- d=(data>>i)&1;
- par^=d;
- DiseqcSendBit(budget, d);
- }
- DiseqcSendBit(budget, par);
-}
-
-inline static int
-SendDiSEqCMsg(struct budget_s *budget, int len, u8 *msg, int burst)
-{
- struct saa7146_dev *dev=budget->dev;
- int i;
-
- DEB_EE(("budget: %p\n",budget));
-
- saa7146_setgpio(dev, 3, SAA7146_GPIO_OUTLO);
- mdelay(16);
-
- for (i=0; i<len; i++)
- DiseqcSendByte(budget, msg[i]);
-
- mdelay(16);
-
- if (burst!=-1) {
- if (burst)
- DiseqcSendByte(budget, 0xff);
- else {
- saa7146_setgpio(dev, 3, SAA7146_GPIO_OUTHI);
- udelay(12500);
- saa7146_setgpio(dev, 3, SAA7146_GPIO_OUTLO);
- }
- ddelay(2);
- }
-
- return 0;
-}
-
-/****************************************************************************
- * DVB API SECTION
- ****************************************************************************/
-
-static int
-budget_start_feed(struct dvb_demux_feed *feed)
-{
- struct dvb_demux *demux = feed->demux;
- struct budget_s *budget = (struct budget_s *) demux->priv;
-
- DEB_EE(("budget: %p\n",budget));
-
- if (!demux->dmx.frontend)
- return -EINVAL;
-
- return TTBStart(budget);
-}
-
-static int
-budget_stop_feed(struct dvb_demux_feed *feed)
-{
- struct dvb_demux *demux = feed->demux;
- struct budget_s *budget = (struct budget_s *) demux->priv;
-
- DEB_EE(("budget: %p\n",budget));
-
- return TTBStop(budget);
-}
-
-/******************************************************************************
- * SEC device file operations
- ******************************************************************************/
-
+struct saa7146_pci_extension_data ttbs = {
+ .ext_priv = &ttbs_info,
+ .ext = &budget_extension,
+};
static
-int budget_diseqc_ioctl (struct dvb_frontend *fe, unsigned int cmd, void *arg)
-{
- struct budget_s *budget = fe->before_after_data;
-
- DEB_EE(("budget: %p\n",budget));
-
- switch (cmd) {
- case FE_SET_TONE:
- switch ((fe_sec_tone_mode_t) arg) {
- case SEC_TONE_ON:
- Set22K (budget, 1);
- break;
- case SEC_TONE_OFF:
- Set22K (budget, 0);
- break;
- default:
- return -EINVAL;
- };
- break;
-
- case FE_DISEQC_SEND_MASTER_CMD:
- {
- struct dvb_diseqc_master_cmd *cmd = arg;
-
- SendDiSEqCMsg (budget, cmd->msg_len, cmd->msg, 0);
- break;
- }
-
- case FE_DISEQC_SEND_BURST:
- SendDiSEqCMsg (budget, 0, NULL, (int) arg);
- break;
-
- default:
- return -EOPNOTSUPP;
- };
-
- return 0;
-}
-
-int budget_register(struct budget_s *budget)
-{
- int ret;
- dmx_frontend_t *dvbfront=&budget->hw_frontend;
- struct dvb_demux *dvbdemux=&budget->demux;
-
- DEB_EE(("budget: %p\n",budget));
-
- if (budget->registered)
- return -1;
-
- budget->registered=1;
-
- /* init DiSEqC stuff */
- dvb_add_frontend_ioctls (budget->dvb_adapter, budget_diseqc_ioctl, NULL, budget);
-
- memcpy(budget->demux_id, "demux0_0", 9);
- budget->demux_id[7]=budget->dvb_adapter->num+0x30;
- dvbdemux->priv=(void *) budget;
-
- dvbdemux->filternum=256;
- dvbdemux->feednum=256;
- dvbdemux->start_feed=budget_start_feed;
- dvbdemux->stop_feed=budget_stop_feed;
- dvbdemux->write_to_decoder=NULL;
-
- dvbdemux->dmx.vendor="CIM";
- dvbdemux->dmx.model="sw";
- dvbdemux->dmx.id=budget->demux_id;
- dvbdemux->dmx.capabilities=(DMX_TS_FILTERING|
- DMX_SECTION_FILTERING|
- DMX_MEMORY_BASED_FILTERING);
-
- dvb_dmx_init(&budget->demux);
-
- dvbfront->id="hw_frontend";
- dvbfront->vendor="VLSI";
- dvbfront->model="DVB Frontend";
- dvbfront->source=DMX_FRONTEND_0;
-
- budget->dmxdev.filternum=256;
- budget->dmxdev.demux=&dvbdemux->dmx;
- budget->dmxdev.capabilities=0;
-
- dvb_dmxdev_init(&budget->dmxdev, budget->dvb_adapter);
-
- ret=dvbdemux->dmx.add_frontend(&dvbdemux->dmx,
- &budget->hw_frontend);
- if (ret<0)
- return ret;
-
- budget->mem_frontend.id="mem_frontend";
- budget->mem_frontend.vendor="memory";
- budget->mem_frontend.model="sw";
- budget->mem_frontend.source=DMX_MEMORY_FE;
- ret=dvbdemux->dmx.add_frontend(&dvbdemux->dmx,
- &budget->mem_frontend);
- if (ret<0)
- return ret;
-
- ret=dvbdemux->dmx.connect_frontend(&dvbdemux->dmx,
- &budget->hw_frontend);
- if (ret<0)
- return ret;
-
- budget->dvb_net.card_num=budget->dvb_adapter->num;
- dvb_net_init(budget->dvb_adapter, &budget->dvb_net, &dvbdemux->dmx);
-
- return 0;
-}
-
-
-static void
-dvb_unregister(struct budget_s *budget)
-{
- struct dvb_demux *dvbdemux=&budget->demux;
-
- DEB_EE(("budget: %p\n",budget));
-
- if (!budget->registered)
- return;
-
- dvb_net_release(&budget->dvb_net);
-
- dvbdemux->dmx.close(&dvbdemux->dmx);
- dvbdemux->dmx.remove_frontend(&dvbdemux->dmx, &budget->hw_frontend);
- dvbdemux->dmx.remove_frontend(&dvbdemux->dmx, &budget->mem_frontend);
-
- dvb_dmxdev_release(&budget->dmxdev);
- dvb_dmx_release(&budget->demux);
- dvb_remove_frontend_ioctls (budget->dvb_adapter, budget_diseqc_ioctl, NULL);
-}
-
+struct saa7146_pci_extension_data ttbc = {
+ .ext_priv = &ttbc_info,
+ .ext = &budget_extension,
+};
static
-int master_xfer (struct dvb_i2c_bus *i2c, const struct i2c_msg msgs[], int num)
-{
- struct saa7146_dev *dev = i2c->data;
- return saa7146_i2c_transfer(dev, msgs, num, 6);
-}
-
-/****************************************************************************
- * INITIALIZATION
- ****************************************************************************/
-
-static char *ttbs = "TT-Budget/WinTV-NOVA-S PCI";
-static char *ttbc = "TT-Budget/WinTV-NOVA-C PCI";
-static char *ttbt = "TT-Budget/WinTV-NOVA-T PCI";
-static char *ttbci = "TT-Budget/WinTV-NOVA-CI PCI";
-static char *satel = "SATELCO Multimedia PCI";
+struct saa7146_pci_extension_data ttbt = {
+ .ext_priv = &ttbt_info,
+ .ext = &budget_extension,
+};
+static
+struct saa7146_pci_extension_data ttbci = {
+ .ext_priv = &ttbci_info,
+ .ext = &budget_extension,
+};
+static
+struct saa7146_pci_extension_data satel = {
+ .ext_priv = &satel_info,
+ .ext = &budget_extension,
+};
-static struct saa7146_sub_info sub_data[] = {
+static
+struct pci_device_id pci_tbl[] = {
{
+ .vendor = PCI_VENDOR_ID_PHILIPS,
+ .device = PCI_DEVICE_ID_PHILIPS_SAA7146,
.subvendor = 0x13c2,
.subdevice = 0x1003,
- .name = &ttbs,
- .type = DVB_CARD_TT_BUDGET
+ .driver_data = (unsigned long)&ttbs,
}, {
+ .vendor = PCI_VENDOR_ID_PHILIPS,
+ .device = PCI_DEVICE_ID_PHILIPS_SAA7146,
.subvendor = 0x13c2,
.subdevice = 0x1004,
- .name = &ttbc,
- .type = DVB_CARD_TT_BUDGET
+ .driver_data = (unsigned long)&ttbc,
}, {
+ .vendor = PCI_VENDOR_ID_PHILIPS,
+ .device = PCI_DEVICE_ID_PHILIPS_SAA7146,
.subvendor = 0x13c2,
.subdevice = 0x1005,
- .name = &ttbt,
- .type = DVB_CARD_TT_BUDGET
- }, {
- .subvendor = 0x13c2,
- .subdevice = 0x100c,
- .name = &ttbci,
- .type = DVB_CARD_TT_BUDGET_CI
+ .driver_data = (unsigned long)&ttbt,
}, {
+ .vendor = PCI_VENDOR_ID_PHILIPS,
+ .device = PCI_DEVICE_ID_PHILIPS_SAA7146,
/* TT_BUDGET_CI without CI (connector not soldered in) */
.subvendor = 0x13c2,
.subdevice = 0x100f,
- .name = &ttbci,
- .type = DVB_CARD_TT_BUDGET_CI
+ .driver_data = (unsigned long)&ttbci,
+ }, {
+ .vendor = PCI_VENDOR_ID_PHILIPS,
+ .device = PCI_DEVICE_ID_PHILIPS_SAA7146,
+ .subvendor = 0x13c2,
+ .subdevice = 0x100c,
+ .driver_data = (unsigned long)&ttbci,
}, {
+ .vendor = PCI_VENDOR_ID_PHILIPS,
+ .device = PCI_DEVICE_ID_PHILIPS_SAA7146,
.subvendor = 0x13c2,
.subdevice = 0x1013,
- .name = &satel,
- .type = DVB_CARD_TT_BUDGET
+ .driver_data = (unsigned long)&satel,
}, {
- .subvendor = 0xffff,
- .subdevice = 0xffff,
- .name = NULL,
- .type = 0
+ .vendor = 0,
}
};
static
-int this_budget_attach (struct saa7146_dev* dev, struct saa7146_sub_info *info)
+int this_budget_attach (struct saa7146_dev* dev, struct saa7146_pci_extension_data *info)
{
struct budget_s *budget = NULL;
DEB_EE(("budget: %p\n",budget));
@@ -494,141 +145,19 @@ int this_budget_attach (struct saa7146_dev* dev, struct saa7146_sub_info *info)
// FIXME: cope with error here!
budget_register(budget);
- printk(KERN_INFO "budget: found budget card '%s'.\n",*budget->card->name);
+ printk(KERN_INFO "budget: found budget card '%s'.\n",budget->card->name);
return 0;
}
-int budget_attach (struct saa7146_dev* dev, struct saa7146_sub_info *info)
-{
- struct budget_s *budget = NULL;
- struct scatterlist *slist = NULL;
- int slen = 0;
- int length = TS_WIDTH*TS_HEIGHT;
- int pages = (length+PAGE_SIZE-1)/PAGE_SIZE;
- int ret = 0;
-
- if (!(budget = kmalloc (sizeof (struct budget_s), GFP_KERNEL))) {
- printk ("%s: out of memory!\n", __FUNCTION__);
- return -ENOMEM;
- }
- memset(budget, 0, sizeof(struct budget_s));
-
- DEB_EE(("dev: %p, budget: %p\n",dev,budget));
-
- budget->card = info;
- budget->dev=(struct saa7146_dev *)dev;
- (struct budget_s*)dev->ext_priv = budget;
-
- dvb_register_adapter(&budget->dvb_adapter, *budget->card->name);
-
- saa7146_i2c_adapter_prepare(dev, NULL, SAA7146_I2C_BUS_BIT_RATE_3200);
- budget->i2c_bus = dvb_register_i2c_bus (master_xfer, dev, budget->dvb_adapter, 0);
-
- if (!budget->i2c_bus) {
- dvb_unregister_adapter (budget->dvb_adapter);
- kfree(budget);
- return -ENOMEM;
- }
-
- budget->grabbing = vmalloc(length);
- if (!budget->grabbing) {
- printk(KERN_ERR "dvb: vmalloc() failed.\n");
- ret = -ENOMEM;
- goto err;
- }
-
- if (!(slist = vmalloc_to_sg(budget->grabbing, pages))) {
- printk(KERN_ERR "dvb: vmalloc_to_sg() failed.\n");
- ret = -ENOMEM;
- goto err;
- }
-
- if (saa7146_pgtable_alloc(dev->pci, &budget->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, &budget->pt, slist, slen);
-
- saa7146_write(dev, PCI_BT_V1, 0x1c00101f);
- /* upload all */
- saa7146_write(dev, MC2, 0x077c077c);
- saa7146_write(dev, GPIO_CTRL, 0x000000);
-
- tasklet_init (&budget->fidb_tasklet, fidbirq, (unsigned long) budget);
-
- saa7146_setgpio(dev, 2, SAA7146_GPIO_OUTHI); /* frontend power on */
- return 0;
-
-err:
- if( NULL != budget->grabbing ) {
- vfree(budget->grabbing);
- }
- if( NULL != slist ) {
- kfree(slist);
- }
- dvb_unregister_i2c_bus (master_xfer,budget->i2c_bus->adapter, budget->i2c_bus->id);
- dvb_unregister_adapter (budget->dvb_adapter);
- if( NULL != budget ) {
- kfree(budget);
- }
- return ret;
-}
-
-int budget_detach (struct saa7146_dev* saa)
-{
- struct budget_s *budget = (struct budget_s*)saa->ext_priv;
- DEB_EE(("budget: %p\n",budget));
-
- dvb_unregister(budget);
- dvb_unregister_i2c_bus (master_xfer,budget->i2c_bus->adapter, budget->i2c_bus->id);
- dvb_unregister_adapter (budget->dvb_adapter);
-
- saa7146_pgtable_free(saa->pci, &budget->pt);
- vfree(budget->grabbing);
- kfree (budget);
-
- saa->ext_priv = NULL;
-
- return 0;
-}
-
-void budget_irq(struct saa7146_dev* dev, u32 *isr)
-{
- struct budget_s *budget = (struct budget_s*)dev->ext_priv;
-
- DEB_EE(("dev: %p, budget: %p\n",dev,budget));
-
- if (*isr & MASK_07)
- tasklet_schedule (&budget->fidb_tasklet);
-}
-
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,51)
-static
-void budget_inc_use(struct saa7146_dev* adap)
-{
- MOD_INC_USE_COUNT;
-}
-
-static
-void budget_dec_use(struct saa7146_dev* adap)
-{
- MOD_DEC_USE_COUNT;
-}
-#endif
-
static
struct saa7146_extension budget_extension = {
.name = "budget dvb\0",
- .devices = &sub_data[0],
+ .flags = 0,
+ .ext_vv_data = NULL,
+
.module = THIS_MODULE,
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,51)
- .inc_use = budget_inc_use,
- .dec_use = budget_dec_use,
-#endif
+ .pci_tbl = &pci_tbl[0],
.attach = this_budget_attach,
.detach = budget_detach,
@@ -640,8 +169,6 @@ struct saa7146_extension budget_extension = {
static
int __init budget_init(void)
{
- DEB_EE((".\n"));
-
if (saa7146_register_extension(&budget_extension))
return -ENODEV;
@@ -663,10 +190,3 @@ MODULE_DESCRIPTION("driver for the SAA7146 based so-called budget PCI DVB cards
"Siemens, Technotrend, Hauppauge");
MODULE_AUTHOR("Ralph Metzler, Marcus Metzler, others");
MODULE_LICENSE("GPL");
-
-MODULE_PARM(budget_debug,"i");
-
-EXPORT_SYMBOL_GPL(budget_register);
-EXPORT_SYMBOL_GPL(budget_irq);
-EXPORT_SYMBOL_GPL(budget_attach);
-EXPORT_SYMBOL_GPL(budget_detach);
diff --git a/linux/drivers/media/dvb/ttpci-budget/budget.h b/linux/drivers/media/dvb/ttpci-budget/budget.h
index 57cfcc22c..d22f9391c 100644
--- a/linux/drivers/media/dvb/ttpci-budget/budget.h
+++ b/linux/drivers/media/dvb/ttpci-budget/budget.h
@@ -22,6 +22,13 @@
#define DEB_EE(x)
#endif
+extern int budget_debug;
+
+struct budget_info {
+ char *name;
+ int type;
+};
+
/* place to store all the necessary device information */
struct budget_s {
@@ -32,7 +39,7 @@ struct budget_s {
struct saa7146_dev *dev;
struct dvb_i2c_bus *i2c_bus;
- struct saa7146_sub_info *card;
+ struct budget_info *card;
unsigned char *grabbing;
struct saa7146_pgtable pt;
@@ -69,7 +76,7 @@ struct budget_s {
int budget_probe(struct saa7146_dev *, unsigned int subvendor, unsigned int subdevice);
void budget_irq(struct saa7146_dev *, u32 *isr);
-int budget_attach (struct saa7146_dev* dev, struct saa7146_sub_info *info);
+int budget_attach (struct saa7146_dev* dev, struct saa7146_pci_extension_data *info);
int budget_detach (struct saa7146_dev *);
int budget_register(struct budget_s *budget);
diff --git a/linux/drivers/media/dvb/ttpci/av7110.c b/linux/drivers/media/dvb/ttpci/av7110.c
index 4c09c2eba..fbc0606e9 100644
--- a/linux/drivers/media/dvb/ttpci/av7110.c
+++ b/linux/drivers/media/dvb/ttpci/av7110.c
@@ -4124,67 +4124,8 @@ struct saa7146_extension_ioctls ioctls[] = {
{ 0, 0 }
};
-static char *fs_1_5 = { "Siemens cable card PCI rev1.5" };
-static char *fs_1_3 = { "Siemens/Technotrend/Hauppauge PCI rev1.3" };
-static char *unkwn = { "Technotrend/Hauppauge PCI rev?(unknown0)?"};
-static char *tt_1_6 = { "Technotrend/Hauppauge PCI rev1.3 or 1.6" };
-static char *tt_2_1 = { "Technotrend/Hauppauge PCI rev2.1" };
-static char *tt_t = { "Technotrend/Hauppauge PCI DVB-T" };
-
-static struct saa7146_sub_info sub_data[] = {
- {
- .subvendor = 0x110a,
- .subdevice = 0xffff,
- .name = &fs_1_5
- }, {
- .subvendor = 0x110a,
- .subdevice = 0x0000,
- .name = &fs_1_5
- }, {
- .subvendor = 0x13c2,
- .subdevice = 0x0000,
- .name = &fs_1_3
- }, {
- .subvendor = 0x13c2,
- .subdevice = 0x1002,
- .name = &unkwn
- }, {
- .subvendor = 0x13c2,
- .subdevice = 0x0001,
- .name = &tt_1_6
- }, {
- .subvendor = 0x13c2,
- .subdevice = 0x0002,
- .name = &tt_2_1
- }, {
- .subvendor = 0x13c2,
- .subdevice = 0x0003,
- .name = &tt_2_1
- }, {
- .subvendor = 0x13c2,
- .subdevice = 0x0004,
- .name = &tt_2_1
- }, {
- .subvendor = 0x13c2,
- .subdevice = 0x0006,
- .name = &tt_1_6
- }, {
- .subvendor = 0x13c2,
- .subdevice = 0x0008,
- .name = &tt_t
- }, {
- .subvendor = 0xffc2,
- .subdevice = 0x0000,
- .name = &unkwn
- }, {
- .subvendor = 0xffff,
- .subdevice = 0xffff,
- .name = NULL
- }
-};
-
static
-int av7110_attach (struct saa7146_dev* dev, struct saa7146_sub_info *info)
+int av7110_attach (struct saa7146_dev* dev, struct saa7146_pci_extension_data *pci_ext)
{
av7110_t *av7110 = NULL;
int ret = 0;
@@ -4195,7 +4136,7 @@ int av7110_attach (struct saa7146_dev* dev, struct saa7146_sub_info *info)
}
memset(av7110, 0, sizeof(av7110_t));
- av7110->card_name = *info->name;
+ av7110->card_name = (char*)pci_ext->ext_priv;
(av7110_t*)dev->ext_priv = av7110;
DEB_EE(("dev: %p, av7110: %p\n",dev,av7110));
@@ -4431,21 +4372,6 @@ void av7110_irq(struct saa7146_dev* dev, u32 *isr)
}
}
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,51)
-static
-void av7110_inc_use(struct saa7146_dev* adap)
-{
- MOD_INC_USE_COUNT;
-}
-
-static
-void av7110_dec_use(struct saa7146_dev* adap)
-{
- MOD_DEC_USE_COUNT;
-}
-#endif
-
-
/* FIXME: these values are experimental values that look better than the
values from the latest "official" driver -- at least for me... (MiHu) */
static
@@ -4456,6 +4382,113 @@ struct saa7146_standard standard[] = {
};
static
+struct saa7146_extension av7110_extension;
+
+static
+struct saa7146_pci_extension_data fs_1_5 = {
+ .ext_priv = "Siemens cable card PCI rev1.5",
+ .ext = &av7110_extension,
+};
+static
+struct saa7146_pci_extension_data fs_1_3 = {
+ .ext_priv = "Siemens/Technotrend/Hauppauge PCI rev1.3",
+ .ext = &av7110_extension,
+};
+static
+struct saa7146_pci_extension_data unkwn = {
+ .ext_priv = "Technotrend/Hauppauge PCI rev?(unknown0)?",
+ .ext = &av7110_extension,
+};
+static
+struct saa7146_pci_extension_data tt_1_6 = {
+ .ext_priv = "Technotrend/Hauppauge PCI rev1.3 or 1.6",
+ .ext = &av7110_extension,
+};
+static
+struct saa7146_pci_extension_data tt_2_1 = {
+ .ext_priv = "Technotrend/Hauppauge PCI rev2.1",
+ .ext = &av7110_extension,
+};
+static
+struct saa7146_pci_extension_data tt_t = {
+ .ext_priv = "Technotrend/Hauppauge PCI DVB-T",
+ .ext = &av7110_extension,
+};
+
+static
+struct pci_device_id pci_tbl[] = {
+ {
+ .vendor = PCI_VENDOR_ID_PHILIPS,
+ .device = PCI_DEVICE_ID_PHILIPS_SAA7146,
+ .subvendor = 0x110a,
+ .subdevice = 0xffff,
+ .driver_data = (unsigned long)&fs_1_5
+ }, {
+ .vendor = PCI_VENDOR_ID_PHILIPS,
+ .device = PCI_DEVICE_ID_PHILIPS_SAA7146,
+ .subvendor = 0x110a,
+ .subdevice = 0x0000,
+ .driver_data = (unsigned long)&fs_1_5
+ }, {
+ .vendor = PCI_VENDOR_ID_PHILIPS,
+ .device = PCI_DEVICE_ID_PHILIPS_SAA7146,
+ .subvendor = 0x13c2,
+ .subdevice = 0x0000,
+ .driver_data = (unsigned long)&fs_1_3
+ }, {
+ .vendor = PCI_VENDOR_ID_PHILIPS,
+ .device = PCI_DEVICE_ID_PHILIPS_SAA7146,
+ .subvendor = 0x13c2,
+ .subdevice = 0x1002,
+ .driver_data = (unsigned long)&unkwn
+ }, {
+ .vendor = PCI_VENDOR_ID_PHILIPS,
+ .device = PCI_DEVICE_ID_PHILIPS_SAA7146,
+ .subvendor = 0x13c2,
+ .subdevice = 0x0001,
+ .driver_data = (unsigned long)&tt_1_6
+ }, {
+ .vendor = PCI_VENDOR_ID_PHILIPS,
+ .device = PCI_DEVICE_ID_PHILIPS_SAA7146,
+ .subvendor = 0x13c2,
+ .subdevice = 0x0002,
+ .driver_data = (unsigned long)&tt_2_1
+ }, {
+ .vendor = PCI_VENDOR_ID_PHILIPS,
+ .device = PCI_DEVICE_ID_PHILIPS_SAA7146,
+ .subvendor = 0x13c2,
+ .subdevice = 0x0003,
+ .driver_data = (unsigned long)&tt_2_1
+ }, {
+ .vendor = PCI_VENDOR_ID_PHILIPS,
+ .device = PCI_DEVICE_ID_PHILIPS_SAA7146,
+ .subvendor = 0x13c2,
+ .subdevice = 0x0004,
+ .driver_data = (unsigned long)&tt_2_1
+ }, {
+ .vendor = PCI_VENDOR_ID_PHILIPS,
+ .device = PCI_DEVICE_ID_PHILIPS_SAA7146,
+ .subvendor = 0x13c2,
+ .subdevice = 0x0006,
+ .driver_data = (unsigned long)&tt_1_6
+ }, {
+ .vendor = PCI_VENDOR_ID_PHILIPS,
+ .device = PCI_DEVICE_ID_PHILIPS_SAA7146,
+ .subvendor = 0x13c2,
+ .subdevice = 0x0008,
+ .driver_data = (unsigned long)&tt_t
+ }, {
+ .vendor = PCI_VENDOR_ID_PHILIPS,
+ .device = PCI_DEVICE_ID_PHILIPS_SAA7146,
+ .subvendor = 0xffc2,
+ .subdevice = 0x0000,
+ .driver_data = (unsigned long)&unkwn
+ }, {
+ .vendor = 0,
+ }
+};
+
+static
struct saa7146_ext_vv av7110_vv_data = {
.inputs = 1,
.audios = 1,
@@ -4473,15 +4506,10 @@ struct saa7146_ext_vv av7110_vv_data = {
static
struct saa7146_extension av7110_extension = {
.name = "dvb\0",
- .flags = 0,
+ .ext_vv_data = &av7110_vv_data,
- .devices = &sub_data[0],
.module = THIS_MODULE,
- .ext_vv_data = &av7110_vv_data,
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,51)
- .inc_use = av7110_inc_use,
- .dec_use = av7110_dec_use,
-#endif
+ .pci_tbl = &pci_tbl[0],
.attach = av7110_attach,
.detach = av7110_detach,
@@ -4493,8 +4521,6 @@ struct saa7146_extension av7110_extension = {
static
int __init av7110_init(void)
{
- DEB_EE((".\n"));
-
if (saa7146_register_extension(&av7110_extension))
return -ENODEV;
@@ -4505,10 +4531,7 @@ int __init av7110_init(void)
static
void __exit av7110_exit(void)
{
- DEB_EE((".\n"));
-
- if (saa7146_unregister_extension(&av7110_extension))
- printk(KERN_ERR "dvb: extension deregistration failed.\n");
+ saa7146_unregister_extension(&av7110_extension);
}
module_init(av7110_init);