diff options
author | Mauro Carvalho Chehab <mchehab@infradead.org> | 2007-01-20 14:58:33 -0200 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2007-01-20 14:58:33 -0200 |
commit | e3e5913c556520dce469afd75cf17f43479c2e27 (patch) | |
tree | 984c2acbe89d8e66395dc7a12643ca02ac2698d2 /linux/drivers/media/video/cx88/cx88-video.c | |
parent | 8d0b0d47bd35938d37c80461e9adc9407be5d5c6 (diff) | |
download | mediapointer-dvb-s2-e3e5913c556520dce469afd75cf17f43479c2e27.tar.gz mediapointer-dvb-s2-e3e5913c556520dce469afd75cf17f43479c2e27.tar.bz2 |
Removed v4l2_tvnorm and made videodev to auto-generate standards
From: Mauro Carvalho Chehab <mchehab@infradead.org>
v4l2_tvnorm were meant to describe video standards and its names to V4L2 API.
However, this were meaning several static structures at the driver.
This patch changes the internals in a way that, at the driver, only a
v4l2_tvnorm (a 32 bit integer) should be filled, with all supported
parameters. videodev will dynamically generate the proper API array
based on supported standards.
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'linux/drivers/media/video/cx88/cx88-video.c')
-rw-r--r-- | linux/drivers/media/video/cx88/cx88-video.c | 71 |
1 files changed, 10 insertions, 61 deletions
diff --git a/linux/drivers/media/video/cx88/cx88-video.c b/linux/drivers/media/video/cx88/cx88-video.c index 2936d9e30..5f43b5174 100644 --- a/linux/drivers/media/video/cx88/cx88-video.c +++ b/linux/drivers/media/video/cx88/cx88-video.c @@ -102,56 +102,7 @@ static LIST_HEAD(cx8800_devlist); /* ------------------------------------------------------------------- */ /* static data */ -struct v4l2_tvnorm cx88_tvnorms[] = { - { - .name = "NTSC-M", - .id = V4L2_STD_NTSC_M, - },{ - .name = "NTSC-JP", - .id = V4L2_STD_NTSC_M_JP, - },{ - .name = "NTSC-4.43", - .id = V4L2_STD_NTSC_443, - },{ - .name = "PAL-BG", - .id = V4L2_STD_PAL_BG, - },{ - .name = "PAL-DK", - .id = V4L2_STD_PAL_DK, - },{ - .name = "PAL-I", - .id = V4L2_STD_PAL_I, - },{ - .name = "PAL-M", - .id = V4L2_STD_PAL_M, - },{ - .name = "PAL-N", - .id = V4L2_STD_PAL_N, - },{ - .name = "PAL-Nc", - .id = V4L2_STD_PAL_Nc, - },{ - .name = "PAL-60", - .id = V4L2_STD_PAL_60, - },{ - .name = "SECAM-L", - .id = V4L2_STD_SECAM_L, - },{ - .name = "SECAM-DK", - .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[] = { - { - .name = "RADIO", - .id = 0, - } -}; +v4l2_std_id radionorms[] = { 0 }; static struct cx8800_fmt formats[] = { { @@ -1248,7 +1199,7 @@ int cx88_set_control(struct cx88_core *core, struct v4l2_control *ctl) value = ((ctl->value - c->off) << c->shift) & c->mask; - if (core->tvnorm->id & V4L2_STD_SECAM) { + if (core->tvnorm & V4L2_STD_SECAM) { /* For SECAM, both U and V sat should be equal */ value=value<<8|value; } else { @@ -1494,13 +1445,14 @@ static int vidioc_streamoff(struct file *file, void *priv, enum v4l2_buf_type i) return 0; } -static int vidioc_s_std (struct file *file, void *priv, unsigned int i) +static int vidioc_s_std (struct file *file, void *priv, v4l2_std_id *tvnorms) { struct cx88_core *core = ((struct cx8800_fh *)priv)->dev->core; mutex_lock(&core->lock); - cx88_set_tvnorm(core,&cx88_tvnorms[i]); + cx88_set_tvnorm(core,*tvnorms); mutex_unlock(&core->lock); + return 0; } @@ -1532,8 +1484,7 @@ int cx88_enum_input (struct cx88_core *core,struct v4l2_input *i) 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(cx88_tvnorms); n++) - i->std |= cx88_tvnorms[n].id; + i->std = CX88_NORMS; return 0; } EXPORT_SYMBOL(cx88_enum_input); @@ -2013,8 +1964,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 = cx88_tvnorms, - .tvnormsize = ARRAY_SIZE(cx88_tvnorms), + .tvnorms = CX88_NORMS, + .current_norm = V4L2_STD_PAL_BG, }; static struct file_operations radio_fops = @@ -2048,8 +1999,6 @@ static struct video_device cx8800_radio_template = .vidioc_s_ctrl = vidioc_s_ctrl, .vidioc_g_frequency = vidioc_g_frequency, .vidioc_s_frequency = vidioc_s_frequency, - .tvnorms = radionorms, - .tvnormsize = ARRAY_SIZE(radionorms), }; /* ----------------------------------------------------------- */ @@ -2131,7 +2080,7 @@ static int __devinit cx8800_initdev(struct pci_dev *pci_dev, init_MUTEX(&dev->lock); #endif spin_lock_init(&dev->slock); - core->tvnorm = cx88_tvnorms; + core->tvnorm = cx8800_video_template.current_norm; /* init video dma queues */ INIT_LIST_HEAD(&dev->vidq.active); @@ -2212,7 +2161,7 @@ static int __devinit cx8800_initdev(struct pci_dev *pci_dev, /* initial device configuration */ mutex_lock(&core->lock); - cx88_set_tvnorm(core,cx88_tvnorms); + cx88_set_tvnorm(core,core->tvnorm); init_controls(core); cx88_video_mux(core,0); mutex_unlock(&core->lock); |