summaryrefslogtreecommitdiff
path: root/linux/drivers
diff options
context:
space:
mode:
authorMichael Hunold <devnull@localhost>2003-07-07 11:28:54 +0000
committerMichael Hunold <devnull@localhost>2003-07-07 11:28:54 +0000
commite841743cf89630b111efa5feccde7ded4d96c5f7 (patch)
tree9ecfc993bb338715e37bcce2694a41a0f5ad5b68 /linux/drivers
parent424b720a5ac042b07b0b1045f36c915b617ebaf1 (diff)
downloadmediapointer-dvb-s2-e841743cf89630b111efa5feccde7ded4d96c5f7.tar.gz
mediapointer-dvb-s2-e841743cf89630b111efa5feccde7ded4d96c5f7.tar.bz2
Make the "ext_vv_data" informations a per-device information instead
of a per-extension information. This is needed for the DVB-C cards, which seem to have swapped field order and need to propagate some video4linux specific stuff for the analog module to work.
Diffstat (limited to 'linux/drivers')
-rw-r--r--linux/drivers/media/common/saa7146_core.c8
-rw-r--r--linux/drivers/media/common/saa7146_fops.c7
-rw-r--r--linux/drivers/media/common/saa7146_hlp.c4
-rw-r--r--linux/drivers/media/common/saa7146_video.c34
-rw-r--r--linux/drivers/media/dvb/ttpci/av7110.c34
-rw-r--r--linux/drivers/media/dvb/ttpci/budget-av.c15
-rw-r--r--linux/drivers/media/dvb/ttpci/budget-ci.c1
-rw-r--r--linux/drivers/media/dvb/ttpci/budget-patch.c1
-rw-r--r--linux/drivers/media/dvb/ttpci/budget.c1
-rw-r--r--linux/drivers/media/video/hexium_gemini.c5
-rw-r--r--linux/drivers/media/video/hexium_orion.c5
11 files changed, 75 insertions, 40 deletions
diff --git a/linux/drivers/media/common/saa7146_core.c b/linux/drivers/media/common/saa7146_core.c
index 51013c6b9..0bc053a2e 100644
--- a/linux/drivers/media/common/saa7146_core.c
+++ b/linux/drivers/media/common/saa7146_core.c
@@ -153,7 +153,7 @@ void saa7146_pgtable_build_single(struct pci_dev *pci, struct saa7146_pgtable *p
ptr = pt->cpu;
for (i = 0; i < length; i++, list++) {
for (p = 0; p * 4096 < list->length; p++, ptr++) {
- *ptr = sg_dma_address(list) - list->offset;
+ *ptr = sg_dma_address(list) - list->offset; // + p
}
}
@@ -372,6 +372,9 @@ static int saa7146_init_one(struct pci_dev *pci, const struct pci_device_id *ent
dev->module = THIS_MODULE;
init_waitqueue_head(&dev->i2c_wq);
+ /* set some default values */
+ saa7146_write(dev, BCS_CTRL, 0x80400040);
+
if( 0 != ext->probe) {
if( 0 != ext->probe(dev) ) {
DEB_D(("ext->probe() failed for %p. skipping device.\n",dev));
@@ -390,9 +393,6 @@ static int saa7146_init_one(struct pci_dev *pci, const struct pci_device_id *ent
list_add_tail(&dev->item,&saa7146_devices);
saa7146_num++;
- /* set some default values */
- saa7146_write(dev, BCS_CTRL, 0x80400040);
-
err = 0;
goto out;
attach_error:
diff --git a/linux/drivers/media/common/saa7146_fops.c b/linux/drivers/media/common/saa7146_fops.c
index 73d39004b..5562f93c0 100644
--- a/linux/drivers/media/common/saa7146_fops.c
+++ b/linux/drivers/media/common/saa7146_fops.c
@@ -385,7 +385,7 @@ static struct video_device device_template =
.minor = -1,
};
-int saa7146_vv_init(struct saa7146_dev* dev)
+int saa7146_vv_init(struct saa7146_dev* dev, struct saa7146_ext_vv *ext_vv)
{
struct saa7146_vv *vv = kmalloc (sizeof(struct saa7146_vv),GFP_KERNEL);
if( NULL == vv ) {
@@ -395,6 +395,11 @@ int saa7146_vv_init(struct saa7146_dev* dev)
memset(vv, 0x0, sizeof(*vv));
DEB_EE(("dev:%p\n",dev));
+
+ /* save per-device extension data (one extension can
+ handle different devices that might need different
+ configuration data) */
+ dev->ext_vv_data = ext_vv;
vv->video_minor = -1;
vv->vbi_minor = -1;
diff --git a/linux/drivers/media/common/saa7146_hlp.c b/linux/drivers/media/common/saa7146_hlp.c
index 76ac43cfe..32cc90748 100644
--- a/linux/drivers/media/common/saa7146_hlp.c
+++ b/linux/drivers/media/common/saa7146_hlp.c
@@ -710,7 +710,7 @@ void saa7146_write_out_dma(struct saa7146_dev* dev, int which, struct saa7146_vi
/* calculate starting address */
where = (which-1)*0x18;
- if( 0 != (dev->ext->ext_vv_data->flags & SAA7146_EXT_SWAP_ODD_EVEN)) {
+ if( 0 != (dev->ext_vv_data->flags & SAA7146_EXT_SWAP_ODD_EVEN)) {
saa7146_write(dev, where, vdma->base_even);
saa7146_write(dev, where+0x04, vdma->base_odd);
} else {
@@ -962,7 +962,7 @@ static void program_capture_engine(struct saa7146_dev *dev, int planar)
unsigned long e_wait = vv->current_hps_sync == SAA7146_HPS_SYNC_PORT_A ? CMD_E_FID_A : CMD_E_FID_B;
unsigned long o_wait = vv->current_hps_sync == SAA7146_HPS_SYNC_PORT_A ? CMD_O_FID_A : CMD_O_FID_B;
- if( 0 != (dev->ext->ext_vv_data->flags & SAA7146_EXT_SWAP_ODD_EVEN)) {
+ if( 0 != (dev->ext_vv_data->flags & SAA7146_EXT_SWAP_ODD_EVEN)) {
unsigned long tmp = e_wait;
e_wait = o_wait;
o_wait = tmp;
diff --git a/linux/drivers/media/common/saa7146_video.c b/linux/drivers/media/common/saa7146_video.c
index ef443426e..502ffbc2c 100644
--- a/linux/drivers/media/common/saa7146_video.c
+++ b/linux/drivers/media/common/saa7146_video.c
@@ -748,19 +748,19 @@ int saa7146_video_do_ioctl(struct inode *inode, struct file *file, unsigned int
struct videobuf_queue *q;
/* check if extension handles the command */
- for(ee = 0; dev->ext->ext_vv_data->ioctls[ee].flags != 0; ee++) {
- if( cmd == dev->ext->ext_vv_data->ioctls[ee].cmd )
+ for(ee = 0; dev->ext_vv_data->ioctls[ee].flags != 0; ee++) {
+ if( cmd == dev->ext_vv_data->ioctls[ee].cmd )
break;
}
- if( 0 != (dev->ext->ext_vv_data->ioctls[ee].flags & SAA7146_EXCLUSIVE) ) {
+ if( 0 != (dev->ext_vv_data->ioctls[ee].flags & SAA7146_EXCLUSIVE) ) {
DEB_D(("extension handles ioctl exclusive.\n"));
- result = dev->ext->ext_vv_data->ioctl(fh, cmd, arg);
+ result = dev->ext_vv_data->ioctl(fh, cmd, arg);
return result;
}
- if( 0 != (dev->ext->ext_vv_data->ioctls[ee].flags & SAA7146_BEFORE) ) {
+ if( 0 != (dev->ext_vv_data->ioctls[ee].flags & SAA7146_BEFORE) ) {
DEB_D(("extension handles ioctl before.\n"));
- result = dev->ext->ext_vv_data->ioctl(fh, cmd, arg);
+ result = dev->ext_vv_data->ioctl(fh, cmd, arg);
if( -EAGAIN != result ) {
return result;
}
@@ -801,7 +801,7 @@ int saa7146_video_do_ioctl(struct inode *inode, struct file *file, unsigned int
V4L2_CAP_VIDEO_OVERLAY |
V4L2_CAP_READWRITE |
V4L2_CAP_STREAMING;
- cap->capabilities |= dev->ext->ext_vv_data->capabilities;
+ cap->capabilities |= dev->ext_vv_data->capabilities;
return 0;
}
case VIDIOC_G_FBUF:
@@ -950,9 +950,9 @@ int saa7146_video_do_ioctl(struct inode *inode, struct file *file, unsigned int
struct v4l2_standard *e = arg;
if (e->index < 0 )
return -EINVAL;
- if( e->index < dev->ext->ext_vv_data->num_stds ) {
+ if( e->index < dev->ext_vv_data->num_stds ) {
DEB_EE(("VIDIOC_ENUMSTD: index:%d\n",e->index));
- v4l2_video_std_construct(e, dev->ext->ext_vv_data->stds[e->index].id, dev->ext->ext_vv_data->stds[e->index].name);
+ v4l2_video_std_construct(e, dev->ext_vv_data->stds[e->index].id, dev->ext_vv_data->stds[e->index].name);
return 0;
}
return -EINVAL;
@@ -981,13 +981,13 @@ int saa7146_video_do_ioctl(struct inode *inode, struct file *file, unsigned int
restart_overlay = 1;
}
- for(i = 0; i < dev->ext->ext_vv_data->num_stds; i++)
- if (*id & dev->ext->ext_vv_data->stds[i].id)
+ for(i = 0; i < dev->ext_vv_data->num_stds; i++)
+ if (*id & dev->ext_vv_data->stds[i].id)
break;
- if (i != dev->ext->ext_vv_data->num_stds) {
- vv->standard = &dev->ext->ext_vv_data->stds[i];
- if( NULL != dev->ext->ext_vv_data->std_callback )
- dev->ext->ext_vv_data->std_callback(dev, vv->standard);
+ if (i != dev->ext_vv_data->num_stds) {
+ vv->standard = &dev->ext_vv_data->stds[i];
+ if( NULL != dev->ext_vv_data->std_callback )
+ dev->ext_vv_data->std_callback(dev, vv->standard);
found = 1;
}
@@ -1084,7 +1084,7 @@ int saa7146_video_do_ioctl(struct inode *inode, struct file *file, unsigned int
q = &fh->video_q;
down(&q->lock);
- err = videobuf_mmap_setup(file,q,gbuffers,gbufsize);
+ err = videobuf_mmap_setup(file,q,gbuffers,gbufsize); // ,V4L2_MEMORY_MMAP);
if (err < 0) {
up(&q->lock);
return err;
@@ -1259,7 +1259,7 @@ static void video_init(struct saa7146_dev *dev, struct saa7146_vv *vv)
vv->video_q.dev = dev;
/* set some default values */
- vv->standard = &dev->ext->ext_vv_data->stds[0];
+ vv->standard = &dev->ext_vv_data->stds[0];
/* FIXME: what's this? */
vv->current_hps_source = SAA7146_HPS_SOURCE_PORT_A;
diff --git a/linux/drivers/media/dvb/ttpci/av7110.c b/linux/drivers/media/dvb/ttpci/av7110.c
index 941ea7c78..2a6f2be9e 100644
--- a/linux/drivers/media/dvb/ttpci/av7110.c
+++ b/linux/drivers/media/dvb/ttpci/av7110.c
@@ -4328,6 +4328,9 @@ struct saa7146_extension_ioctls ioctls[] = {
{ 0, 0 }
};
+static struct saa7146_ext_vv av7110_vv_data_st;
+static struct saa7146_ext_vv av7110_vv_data_c;
+
static int av7110_attach (struct saa7146_dev* dev, struct saa7146_pci_extension_data *pci_ext)
{
struct av7110 *av7110 = NULL;
@@ -4345,7 +4348,16 @@ static int av7110_attach (struct saa7146_dev* dev, struct saa7146_pci_extension_
DEB_EE(("dev: %p, av7110: %p\n",dev,av7110));
- if (saa7146_vv_init(dev)) {
+ /* special case DVB-C: these cards have an analog tuner
+ plus need some special handling, so we have separate
+ saa7146_ext_vv data for these... */
+ if (dev->pci->subsystem_vendor == 0x110a) {
+ ret = saa7146_vv_init(dev, &av7110_vv_data_c);
+ } else {
+ ret = saa7146_vv_init(dev, &av7110_vv_data_st);
+ }
+
+ if ( 0 != ret) {
ERR(("cannot init capture device. skipping.\n"));
kfree(av7110);
return -1;
@@ -4690,10 +4702,10 @@ static int std_callback(struct saa7146_dev* dev, struct saa7146_standard *std)
}
-static struct saa7146_ext_vv av7110_vv_data = {
+static struct saa7146_ext_vv av7110_vv_data_st = {
.inputs = 1,
.audios = 1,
- .capabilities = V4L2_CAP_TUNER,
+ .capabilities = 0,
.flags = SAA7146_EXT_SWAP_ODD_EVEN,
.stds = &standard[0],
@@ -4704,9 +4716,23 @@ static struct saa7146_ext_vv av7110_vv_data = {
.ioctl = av7110_ioctl,
};
+static struct saa7146_ext_vv av7110_vv_data_c = {
+ .inputs = 1,
+ .audios = 1,
+ .capabilities = V4L2_CAP_TUNER,
+ .flags = 0,
+
+ .stds = &standard[0],
+ .num_stds = sizeof(standard)/sizeof(struct saa7146_standard),
+ .std_callback = &std_callback,
+
+ .ioctls = &ioctls[0],
+ .ioctl = av7110_ioctl,
+};
+
+
static struct saa7146_extension av7110_extension = {
.name = "dvb\0",
- .ext_vv_data = &av7110_vv_data,
.module = THIS_MODULE,
.pci_tbl = &pci_tbl[0],
diff --git a/linux/drivers/media/dvb/ttpci/budget-av.c b/linux/drivers/media/dvb/ttpci/budget-av.c
index 36f1fa796..82816933c 100644
--- a/linux/drivers/media/dvb/ttpci/budget-av.c
+++ b/linux/drivers/media/dvb/ttpci/budget-av.c
@@ -170,6 +170,7 @@ static int budget_av_detach (struct saa7146_dev *dev)
return err;
}
+static struct saa7146_ext_vv vv_data;
static int budget_av_attach (struct saa7146_dev* dev,
struct saa7146_pci_extension_data *info)
@@ -207,16 +208,22 @@ static int budget_av_attach (struct saa7146_dev* dev,
dvb_delay(500);
if ((err = saa7113_init (budget_av))) {
- budget_av_detach(dev);
+ /* fixme: proper cleanup here */
+ ERR(("cannot init saa7113.\n"));
return err;
}
- saa7146_vv_init(dev);
+ if ( 0 != saa7146_vv_init(dev,&vv_data)) {
+ /* fixme: proper cleanup here */
+ ERR(("cannot init vv subsystem.\n"));
+ return err;
+ }
+
if ((err = saa7146_register_device(&budget_av->vd, dev, "knc1",
VFL_TYPE_GRABBER)))
{
+ /* fixme: proper cleanup here */
ERR(("cannot register capture v4l2 device.\n"));
- budget_av_detach(dev);
return err;
}
@@ -347,8 +354,6 @@ static struct saa7146_extension budget_extension = {
.attach = budget_av_attach,
.detach = budget_av_detach,
- .ext_vv_data = &vv_data,
-
.irq_mask = MASK_10,
.irq_func = ttpci_budget_irq10_handler,
};
diff --git a/linux/drivers/media/dvb/ttpci/budget-ci.c b/linux/drivers/media/dvb/ttpci/budget-ci.c
index fb5347ace..62971fbc6 100644
--- a/linux/drivers/media/dvb/ttpci/budget-ci.c
+++ b/linux/drivers/media/dvb/ttpci/budget-ci.c
@@ -377,7 +377,6 @@ MODULE_DEVICE_TABLE(pci, pci_tbl);
static struct saa7146_extension budget_extension = {
.name = "budget_ci dvb\0",
.flags = 0,
- .ext_vv_data = NULL,
.module = THIS_MODULE,
.pci_tbl = &pci_tbl[0],
diff --git a/linux/drivers/media/dvb/ttpci/budget-patch.c b/linux/drivers/media/dvb/ttpci/budget-patch.c
index 0eb9c8eae..2673d6042 100644
--- a/linux/drivers/media/dvb/ttpci/budget-patch.c
+++ b/linux/drivers/media/dvb/ttpci/budget-patch.c
@@ -264,7 +264,6 @@ static void __exit budget_patch_exit(void)
static struct saa7146_extension budget_extension = {
.name = "budget_patch dvb\0",
.flags = 0,
- .ext_vv_data = NULL,
.module = THIS_MODULE,
.pci_tbl = pci_tbl,
diff --git a/linux/drivers/media/dvb/ttpci/budget.c b/linux/drivers/media/dvb/ttpci/budget.c
index d3e17a84e..f3e6a05c6 100644
--- a/linux/drivers/media/dvb/ttpci/budget.c
+++ b/linux/drivers/media/dvb/ttpci/budget.c
@@ -215,7 +215,6 @@ MODULE_DEVICE_TABLE(pci, pci_tbl);
static struct saa7146_extension budget_extension = {
.name = "budget dvb\0",
.flags = 0,
- .ext_vv_data = NULL,
.module = THIS_MODULE,
.pci_tbl = pci_tbl,
diff --git a/linux/drivers/media/video/hexium_gemini.c b/linux/drivers/media/video/hexium_gemini.c
index 088e277f2..a82de4752 100644
--- a/linux/drivers/media/video/hexium_gemini.c
+++ b/linux/drivers/media/video/hexium_gemini.c
@@ -89,6 +89,8 @@ static int hexium_set_standard(struct hexium* hexium, struct hexium_data *vdec)
return 0;
}
+static struct saa7146_ext_vv vv_data;
+
/* this function only gets called when the probing was successful */
static int hexium_attach(struct saa7146_dev* dev, struct saa7146_pci_extension_data *info)
{
@@ -132,7 +134,7 @@ static int hexium_attach(struct saa7146_dev* dev, struct saa7146_pci_extension_d
hexium_set_input(hexium, 0);
hexium->cur_input = 0;
- saa7146_vv_init(dev);
+ saa7146_vv_init(dev,&vv_data);
if( 0 != saa7146_register_device(&hexium->video_dev, dev, "hexium", VFL_TYPE_GRABBER)) {
ERR(("cannot register capture v4l2 device. skipping.\n"));
return -1;
@@ -383,7 +385,6 @@ struct saa7146_extension hexium_extension = {
.pci_tbl = &pci_tbl[0],
.module = THIS_MODULE,
- .ext_vv_data = &vv_data,
.attach = hexium_attach,
.detach = hexium_detach,
diff --git a/linux/drivers/media/video/hexium_orion.c b/linux/drivers/media/video/hexium_orion.c
index 2030e8200..8482741ab 100644
--- a/linux/drivers/media/video/hexium_orion.c
+++ b/linux/drivers/media/video/hexium_orion.c
@@ -135,6 +135,8 @@ static int hexium_init_done(struct saa7146_dev* dev)
return 0;
}
+static struct saa7146_ext_vv vv_data;
+
/* this function only gets called when the probing was successful */
static int hexium_attach(struct saa7146_dev* dev, struct saa7146_pci_extension_data *info)
{
@@ -142,7 +144,7 @@ static int hexium_attach(struct saa7146_dev* dev, struct saa7146_pci_extension_d
DEB_EE((".\n"));
- saa7146_vv_init(dev);
+ saa7146_vv_init(dev,&vv_data);
if( 0 != saa7146_register_device(&hexium->video_dev, dev, "hexium", VFL_TYPE_GRABBER)) {
ERR(("cannot register capture v4l2 device. skipping.\n"));
return -1;
@@ -301,7 +303,6 @@ struct saa7146_extension extension = {
.pci_tbl = &pci_tbl[0],
.module = THIS_MODULE,
- .ext_vv_data = &vv_data,
.probe = hexium_probe,
.attach = hexium_attach,