summaryrefslogtreecommitdiff
path: root/linux/drivers/media/video/cx88/cx88-video.c
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@infradead.org>2007-01-20 14:58:26 -0200
committerMauro Carvalho Chehab <mchehab@infradead.org>2007-01-20 14:58:26 -0200
commitfa401a7a602778f320280012833475f52912c9cf (patch)
treeaa5065673824d1844e9eda360cb6684c7dcbdba1 /linux/drivers/media/video/cx88/cx88-video.c
parente4cfb2ea99e55915a0cc39e7a5b3ff73e51df482 (diff)
downloadmediapointer-dvb-s2-fa401a7a602778f320280012833475f52912c9cf.tar.gz
mediapointer-dvb-s2-fa401a7a602778f320280012833475f52912c9cf.tar.bz2
Make cx88-blackbird to work again
From: Mauro Carvalho Chehab <mchehab@infradead.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org> --- linux/drivers/media/video/cx88/cx88-video.c | 84 ++- linux/drivers/media/video/cx88/cx88.h | 12 3 files changed, 421 insertions(+), 238 deletions(-)
Diffstat (limited to 'linux/drivers/media/video/cx88/cx88-video.c')
-rw-r--r--linux/drivers/media/video/cx88/cx88-video.c84
1 files changed, 54 insertions, 30 deletions
diff --git a/linux/drivers/media/video/cx88/cx88-video.c b/linux/drivers/media/video/cx88/cx88-video.c
index e31437f5e..f51c58e04 100644
--- a/linux/drivers/media/video/cx88/cx88-video.c
+++ b/linux/drivers/media/video/cx88/cx88-video.c
@@ -102,7 +102,7 @@ static LIST_HEAD(cx8800_devlist);
/* ------------------------------------------------------------------- */
/* static data */
-static struct v4l2_tvnorm tvnorms[] = {
+struct v4l2_tvnorm cx88_tvnorms[] = {
{
.name = "NTSC-M",
.id = V4L2_STD_NTSC_M,
@@ -141,6 +141,10 @@ static struct v4l2_tvnorm tvnorms[] = {
.id = V4L2_STD_SECAM_DK,
}
};
+EXPORT_SYMBOL(cx88_tvnorms);
+
+unsigned int cx88_tvnormsize=ARRAY_SIZE(cx88_tvnorms);
+EXPORT_SYMBOL(cx88_tvnormsize);
static struct v4l2_tvnorm radionorms[] = {
{
@@ -1173,10 +1177,8 @@ video_mmap(struct file *file, struct vm_area_struct * vma)
/* ------------------------------------------------------------------ */
/* VIDEO CTRL IOCTLS */
-static int vidioc_g_ctrl (struct file *file, void *priv,
- struct v4l2_control *ctl)
+int cx88_get_control (struct cx88_core *core, struct v4l2_control *ctl)
{
- struct cx88_core *core = ((struct cx8800_fh *)priv)->dev->core;
struct cx88_ctrl *c = NULL;
u32 value;
int i;
@@ -1205,8 +1207,9 @@ static int vidioc_g_ctrl (struct file *file, void *priv,
value,c->mask, c->sreg ? " [shadowed]" : "");
return 0;
}
+EXPORT_SYMBOL(cx88_get_control);
-static int set_control(struct cx88_core *core, struct v4l2_control *ctl)
+int cx88_set_control(struct cx88_core *core, struct v4l2_control *ctl)
{
struct cx88_ctrl *c = NULL;
u32 value,mask;
@@ -1268,6 +1271,7 @@ static int set_control(struct cx88_core *core, struct v4l2_control *ctl)
}
return 0;
}
+EXPORT_SYMBOL(cx88_set_control);
static void init_controls(struct cx88_core *core)
{
@@ -1278,7 +1282,7 @@ static void init_controls(struct cx88_core *core)
ctrl.id=cx8800_ctls[i].v.id;
ctrl.value=cx8800_ctls[i].v.default_value;
- set_control(core, &ctrl);
+ cx88_set_control(core, &ctrl);
}
}
@@ -1431,7 +1435,6 @@ static int vidiocgmbuf (struct file *file, void *priv, struct video_mbuf *mbuf)
}
#endif
-
static int vidioc_reqbufs (struct file *file, void *priv, struct v4l2_requestbuffers *p)
{
struct cx8800_fh *fh = priv;
@@ -1496,17 +1499,14 @@ static int vidioc_s_std (struct file *file, void *priv, unsigned int i)
struct cx88_core *core = ((struct cx8800_fh *)priv)->dev->core;
mutex_lock(&core->lock);
- cx88_set_tvnorm(core,&tvnorms[i]);
+ cx88_set_tvnorm(core,&cx88_tvnorms[i]);
mutex_unlock(&core->lock);
return 0;
}
/* only one input in this sample driver */
-static int vidioc_enum_input (struct file *file, void *priv,
- struct v4l2_input *i)
+int cx88_enum_input (struct cx88_core *core,struct v4l2_input *i)
{
- struct cx88_core *core = ((struct cx8800_fh *)priv)->dev->core;
-
static const char *iname[] = {
[ CX88_VMUX_COMPOSITE1 ] = "Composite1",
[ CX88_VMUX_COMPOSITE2 ] = "Composite2",
@@ -1532,10 +1532,18 @@ static int vidioc_enum_input (struct file *file, void *priv,
if ((CX88_VMUX_TELEVISION == INPUT(n)->type) ||
(CX88_VMUX_CABLE == INPUT(n)->type))
i->type = V4L2_INPUT_TYPE_TUNER;
- for (n = 0; n < ARRAY_SIZE(tvnorms); n++)
- i->std |= tvnorms[n].id;
+ for (n = 0; n < ARRAY_SIZE(cx88_tvnorms); n++)
+ i->std |= cx88_tvnorms[n].id;
return 0;
}
+EXPORT_SYMBOL(cx88_enum_input);
+
+static int vidioc_enum_input (struct file *file, void *priv,
+ struct v4l2_input *i)
+{
+ struct cx88_core *core = ((struct cx8800_fh *)priv)->dev->core;
+ return cx88_enum_input (core,i);
+}
static int vidioc_g_input (struct file *file, void *priv, unsigned int *i)
{
@@ -1599,13 +1607,20 @@ static int vidioc_queryctrl (struct file *file, void *priv,
return cx8800_ctrl_query(qctrl);
}
-static int vidioc_s_ctrl (struct file *file, void *priv,
+static int vidioc_g_ctrl (struct file *file, void *priv,
struct v4l2_control *ctl)
{
struct cx88_core *core = ((struct cx8800_fh *)priv)->dev->core;
+ return
+ cx88_get_control(core,ctl);
+}
+static int vidioc_s_ctrl (struct file *file, void *priv,
+ struct v4l2_control *ctl)
+{
+ struct cx88_core *core = ((struct cx8800_fh *)priv)->dev->core;
return
- set_control(core,ctl);
+ cx88_set_control(core,ctl);
}
static int vidioc_g_tuner (struct file *file, void *priv,
@@ -1660,20 +1675,14 @@ static int vidioc_g_frequency (struct file *file, void *priv,
return 0;
}
-static int vidioc_s_frequency (struct file *file, void *priv,
+int cx88_set_freq (struct cx88_core *core,
struct v4l2_frequency *f)
{
- struct cx8800_fh *fh = priv;
- struct cx88_core *core = fh->dev->core;
-
if (unlikely(UNSET == core->tuner_type))
return -EINVAL;
if (unlikely(f->tuner != 0))
return -EINVAL;
- if (unlikely(0 == fh->radio && f->type != V4L2_TUNER_ANALOG_TV))
- return -EINVAL;
- if (unlikely(1 == fh->radio && f->type != V4L2_TUNER_RADIO))
- return -EINVAL;
+
mutex_lock(&core->lock);
core->freq = f->frequency;
cx88_newstation(core);
@@ -1684,8 +1693,25 @@ static int vidioc_s_frequency (struct file *file, void *priv,
cx88_set_tvaudio(core);
mutex_unlock(&core->lock);
+
return 0;
}
+EXPORT_SYMBOL(cx88_set_freq);
+
+static int vidioc_s_frequency (struct file *file, void *priv,
+ struct v4l2_frequency *f)
+{
+ struct cx8800_fh *fh = priv;
+ struct cx88_core *core = fh->dev->core;
+
+ if (unlikely(0 == fh->radio && f->type != V4L2_TUNER_ANALOG_TV))
+ return -EINVAL;
+ if (unlikely(1 == fh->radio && f->type != V4L2_TUNER_RADIO))
+ return -EINVAL;
+
+ return
+ cx88_set_freq (core,f);
+}
#if 0 //ifdef CONFIG_VIDEO_ADV_DEBUG
static int vidioc_g_register (struct file *file, void *priv,
@@ -1987,8 +2013,8 @@ static struct video_device cx8800_video_template =
.vidioc_s_tuner = vidioc_s_tuner,
.vidioc_g_frequency = vidioc_g_frequency,
.vidioc_s_frequency = vidioc_s_frequency,
- .tvnorms = tvnorms,
- .tvnormsize = ARRAY_SIZE(tvnorms),
+ .tvnorms = cx88_tvnorms,
+ .tvnormsize = ARRAY_SIZE(cx88_tvnorms),
};
static struct file_operations radio_fops =
@@ -2105,7 +2131,7 @@ static int __devinit cx8800_initdev(struct pci_dev *pci_dev,
init_MUTEX(&dev->lock);
#endif
spin_lock_init(&dev->slock);
- core->tvnorm = tvnorms;
+ core->tvnorm = cx88_tvnorms;
/* init video dma queues */
INIT_LIST_HEAD(&dev->vidq.active);
@@ -2186,7 +2212,7 @@ static int __devinit cx8800_initdev(struct pci_dev *pci_dev,
/* initial device configuration */
mutex_lock(&core->lock);
- cx88_set_tvnorm(core,tvnorms);
+ cx88_set_tvnorm(core,cx88_tvnorms);
init_controls(core);
video_mux(core,0);
mutex_unlock(&core->lock);
@@ -2377,8 +2403,6 @@ static void cx8800_fini(void)
module_init(cx8800_init);
module_exit(cx8800_fini);
-EXPORT_SYMBOL(cx88_do_ioctl);
-
/* ----------------------------------------------------------- */
/*
* Local variables: