diff options
author | Mauro Carvalho Chehab <mchehab@infradead.org> | 2007-01-20 14:59:22 -0200 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2007-01-20 14:59:22 -0200 |
commit | 12858f895c978c0b291e7b913d961dff226bd4d1 (patch) | |
tree | fb305985460a23998690a3dae294aa6ceb7f3d27 | |
parent | 89d9de0025495bd6ecb59b90b522461928f3d505 (diff) | |
download | mediapointer-dvb-s2-12858f895c978c0b291e7b913d961dff226bd4d1.tar.gz mediapointer-dvb-s2-12858f895c978c0b291e7b913d961dff226bd4d1.tar.bz2 |
changeset: 4899:0e0da8488f6b6ca379cf012987bd37237dfbab25
tag: tip
user: Mauro Carvalho Chehab <mchehab@infradead.org>
date: Mon Nov 27 21:28:04 2006 -0200
files: linux/drivers/media/video/cx88/cx88-blackbird.c
description:
Reorder some ioctl handlers to make easy to convert to video_ioctl2
From: Mauro Carvalho Chehab <mchehab@infradead.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
-rw-r--r-- | linux/drivers/media/video/cx88/cx88-blackbird.c | 210 |
1 files changed, 110 insertions, 100 deletions
diff --git a/linux/drivers/media/video/cx88/cx88-blackbird.c b/linux/drivers/media/video/cx88/cx88-blackbird.c index ce1b3bcf7..3b15b7606 100644 --- a/linux/drivers/media/video/cx88/cx88-blackbird.c +++ b/linux/drivers/media/video/cx88/cx88-blackbird.c @@ -840,14 +840,13 @@ static int mpeg_do_ioctl(struct inode *inode, struct file *file, sprintf(cap->bus_info,"PCI:%s",pci_name(dev->pci)); cap->version = CX88_VERSION_CODE; cap->capabilities = - V4L2_CAP_VIDEO_CAPTURE | - V4L2_CAP_READWRITE | - V4L2_CAP_STREAMING | #if 0 V4L2_CAP_VBI_CAPTURE | V4L2_CAP_VIDEO_OVERLAY | #endif - 0; + V4L2_CAP_VIDEO_CAPTURE | + V4L2_CAP_READWRITE | + V4L2_CAP_STREAMING; if (UNSET != core->tuner_type) cap->capabilities |= V4L2_CAP_TUNER; @@ -968,7 +967,6 @@ static int mpeg_do_ioctl(struct inode *inode, struct file *file, return cx2341x_ext_ctrls(&dev->params, f, cmd); } case VIDIOC_S_EXT_CTRLS: - case VIDIOC_TRY_EXT_CTRLS: { struct v4l2_ext_controls *f = arg; struct cx2341x_mpeg_params p; @@ -977,13 +975,25 @@ static int mpeg_do_ioctl(struct inode *inode, struct file *file, if (f->ctrl_class != V4L2_CTRL_CLASS_MPEG) return -EINVAL; p = dev->params; - err = cx2341x_ext_ctrls(&p, f, cmd); + err = cx2341x_ext_ctrls(&p, VIDIOC_S_EXT_CTRLS, cmd); if (err == 0 && cmd == VIDIOC_S_EXT_CTRLS) { err = cx2341x_update(dev, blackbird_mbox_func, &dev->params, &p); dev->params = p; } return err; } + case VIDIOC_TRY_EXT_CTRLS: + { + struct v4l2_ext_controls *f = arg; + struct cx2341x_mpeg_params p; + int err; + + if (f->ctrl_class != V4L2_CTRL_CLASS_MPEG) + return -EINVAL; + p = dev->params; + err = cx2341x_ext_ctrls(&p, VIDIOC_TRY_EXT_CTRLS, cmd); + return err; + } case VIDIOC_S_FREQUENCY: { blackbird_api_cmd(fh->dev, CX2341X_ENC_STOP_CAPTURE, 3, 0, @@ -1046,46 +1056,6 @@ int cx88_do_ioctl(struct inode *inode, struct file *file, int radio, } switch (cmd) { - /* ---------- tv norms ---------- */ - case VIDIOC_ENUMSTD: - { - struct v4l2_standard *e = arg; - unsigned int i; - - i = e->index; - if (i >= ARRAY_SIZE(tvnorms)) - return -EINVAL; - err = v4l2_video_std_construct(e, tvnorms[e->index].id, - tvnorms[e->index].name); - e->index = i; - if (err < 0) - return err; - return 0; - } - case VIDIOC_G_STD: - { - v4l2_std_id *id = arg; - - *id = core->tvnorm; - return 0; - } - case VIDIOC_S_STD: - { - v4l2_std_id *id = arg; - unsigned int i; - - for(i = 0; i < ARRAY_SIZE(tvnorms); i++) - if (*id & tvnorms[i].id) - break; - if (i == ARRAY_SIZE(tvnorms)) - return -EINVAL; - - mutex_lock(&core->lock); - cx88_set_tvnorm(core,tvnorms[i].id); - mutex_unlock(&core->lock); - return 0; - } - /* ------ input switching ---------- */ case VIDIOC_ENUMINPUT: { @@ -1119,6 +1089,28 @@ int cx88_do_ioctl(struct inode *inode, struct file *file, int radio, i->std |= tvnorms[n].id; return 0; } + case VIDIOC_G_CTRL: + return cx88_get_control(core,arg); + case VIDIOC_S_CTRL: + return cx88_set_control(core,arg); + + case VIDIOC_G_FREQUENCY: + { + struct v4l2_frequency *f = arg; + + memset(f,0,sizeof(*f)); + + if (UNSET == core->tuner_type) + return -EINVAL; + + /* f->type = fh->radio ? V4L2_TUNER_RADIO : V4L2_TUNER_ANALOG_TV; */ + f->type = radio ? V4L2_TUNER_RADIO : V4L2_TUNER_ANALOG_TV; + f->frequency = core->freq; + + cx88_call_i2c_clients(core,VIDIOC_G_FREQUENCY,f); + + return 0; + } case VIDIOC_G_INPUT: { unsigned int *i = arg; @@ -1140,6 +1132,78 @@ int cx88_do_ioctl(struct inode *inode, struct file *file, int radio, } + case VIDIOC_G_TUNER: + { + struct v4l2_tuner *t = arg; + u32 reg; + + if (UNSET == core->tuner_type) + return -EINVAL; + if (0 != t->index) + return -EINVAL; + + memset(t,0,sizeof(*t)); + strcpy(t->name, "Television"); + t->type = V4L2_TUNER_ANALOG_TV; + t->capability = V4L2_TUNER_CAP_NORM; + t->rangehigh = 0xffffffffUL; + + cx88_get_stereo(core ,t); + reg = cx_read(MO_DEVICE_STATUS); + t->signal = (reg & (1<<5)) ? 0xffff : 0x0000; + return 0; + } + case VIDIOC_S_TUNER: + { + struct v4l2_tuner *t = arg; + + if (UNSET == core->tuner_type) + return -EINVAL; + if (0 != t->index) + return -EINVAL; + cx88_set_stereo(core, t->audmode, 1); + return 0; + } + /* ---------- tv norms ---------- */ + case VIDIOC_S_STD: + { + v4l2_std_id *id = arg; + unsigned int i; + + for(i = 0; i < ARRAY_SIZE(tvnorms); i++) + if (*id & tvnorms[i].id) + break; + if (i == ARRAY_SIZE(tvnorms)) + return -EINVAL; + + mutex_lock(&core->lock); + cx88_set_tvnorm(core,tvnorms[i].id); + mutex_unlock(&core->lock); + return 0; + } + case VIDIOC_ENUMSTD: + { + struct v4l2_standard *e = arg; + unsigned int i; + + i = e->index; + if (i >= ARRAY_SIZE(tvnorms)) + return -EINVAL; + err = v4l2_video_std_construct(e, tvnorms[e->index].id, + tvnorms[e->index].name); + e->index = i; + if (err < 0) + return err; + return 0; + } + case VIDIOC_G_STD: + { + v4l2_std_id *id = arg; + + *id = core->tvnorm; + return 0; + } + #if 0 /* needs review */ case VIDIOC_G_AUDIO: @@ -1181,61 +1245,7 @@ int cx88_do_ioctl(struct inode *inode, struct file *file, int radio, return -EINVAL; return cx8800_ctrl_query(qctrl); } - case VIDIOC_G_CTRL: - return cx88_get_control(core,arg); - case VIDIOC_S_CTRL: - return cx88_set_control(core,arg); - /* --- tuner ioctls ------------------------------------------ */ - case VIDIOC_G_TUNER: - { - struct v4l2_tuner *t = arg; - u32 reg; - - if (UNSET == core->tuner_type) - return -EINVAL; - if (0 != t->index) - return -EINVAL; - - memset(t,0,sizeof(*t)); - strcpy(t->name, "Television"); - t->type = V4L2_TUNER_ANALOG_TV; - t->capability = V4L2_TUNER_CAP_NORM; - t->rangehigh = 0xffffffffUL; - - cx88_get_stereo(core ,t); - reg = cx_read(MO_DEVICE_STATUS); - t->signal = (reg & (1<<5)) ? 0xffff : 0x0000; - return 0; - } - case VIDIOC_S_TUNER: - { - struct v4l2_tuner *t = arg; - - if (UNSET == core->tuner_type) - return -EINVAL; - if (0 != t->index) - return -EINVAL; - cx88_set_stereo(core, t->audmode, 1); - return 0; - } - case VIDIOC_G_FREQUENCY: - { - struct v4l2_frequency *f = arg; - - memset(f,0,sizeof(*f)); - - if (UNSET == core->tuner_type) - return -EINVAL; - - /* f->type = fh->radio ? V4L2_TUNER_RADIO : V4L2_TUNER_ANALOG_TV; */ - f->type = radio ? V4L2_TUNER_RADIO : V4L2_TUNER_ANALOG_TV; - f->frequency = core->freq; - - cx88_call_i2c_clients(core,VIDIOC_G_FREQUENCY,f); - - return 0; - } case VIDIOC_S_FREQUENCY: { struct v4l2_frequency *f = arg; |