From 54da49f5a4c739cf8de7838e049d0f9f548008d8 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Sat, 20 Jan 2007 13:58:26 -0300 Subject: V4L/DVB (5100): Make cx88-blackbird to work again Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/cx88/cx88-video.c | 84 ++++++++++++++++++++++------------- drivers/media/video/cx88/cx88.h | 12 +++-- 2 files changed, 62 insertions(+), 34 deletions(-) (limited to 'drivers/media/video/cx88') diff --git a/drivers/media/video/cx88/cx88-video.c b/drivers/media/video/cx88/cx88-video.c index 6fd15839ddf..d226eb1d38f 100644 --- a/drivers/media/video/cx88/cx88-video.c +++ b/drivers/media/video/cx88/cx88-video.c @@ -86,7 +86,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, @@ -125,6 +125,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[] = { { @@ -932,10 +936,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; @@ -964,8 +966,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; @@ -1019,6 +1022,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) { @@ -1029,7 +1033,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); } } @@ -1179,7 +1183,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; @@ -1244,17 +1247,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", @@ -1280,10 +1280,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) { @@ -1318,13 +1326,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, @@ -1379,20 +1394,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); @@ -1403,8 +1412,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); +} /* ----------------------------------------------------------- */ @@ -1677,8 +1703,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 const struct file_operations radio_fops = @@ -1789,7 +1815,7 @@ static int __devinit cx8800_initdev(struct pci_dev *pci_dev, /* initialize driver struct */ spin_lock_init(&dev->slock); - core->tvnorm = tvnorms; + core->tvnorm = cx88_tvnorms; /* init video dma queues */ INIT_LIST_HEAD(&dev->vidq.active); @@ -1870,7 +1896,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); @@ -2041,8 +2067,6 @@ static void cx8800_fini(void) module_init(cx8800_init); module_exit(cx8800_fini); -EXPORT_SYMBOL(cx88_do_ioctl); - /* ----------------------------------------------------------- */ /* * Local variables: diff --git a/drivers/media/video/cx88/cx88.h b/drivers/media/video/cx88/cx88.h index 97177c0d022..5d2f40fe5b7 100644 --- a/drivers/media/video/cx88/cx88.h +++ b/drivers/media/video/cx88/cx88.h @@ -629,12 +629,16 @@ int cx8802_suspend_common(struct pci_dev *pci_dev, pm_message_t state); int cx8802_resume_common(struct pci_dev *pci_dev); /* ----------------------------------------------------------- */ -/* cx88-video.c */ -extern int cx88_do_ioctl(struct inode *inode, struct file *file, int radio, - struct cx88_core *core, unsigned int cmd, - void *arg, v4l2_kioctl driver_ioctl); +/* cx88-video.c*/ +extern unsigned int cx88_tvnormsize; +extern struct v4l2_tvnorm cx88_tvnorms[]; extern const u32 cx88_user_ctrls[]; extern int cx8800_ctrl_query(struct v4l2_queryctrl *qctrl); +int cx88_enum_input (struct cx88_core *core,struct v4l2_input *i); +int cx88_set_freq (struct cx88_core *core,struct v4l2_frequency *f); +int cx88_get_control(struct cx88_core *core, struct v4l2_control *ctl); +int cx88_set_control(struct cx88_core *core, struct v4l2_control *ctl); +int cx88_video_mux(struct cx88_core *core, unsigned int input); /* ----------------------------------------------------------- */ /* cx88-blackbird.c */ -- cgit v1.2.3