diff options
author | Mauro Carvalho Chehab <mchehab@infradead.org> | 2007-10-26 17:51:47 -0200 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2007-10-26 17:51:47 -0200 |
commit | f7d8cfd0cd4b120216f408c6f2bf8137eafbb8ce (patch) | |
tree | d460beef51af99f6435e813aac4d819d7e22655d /linux/drivers/media/video/bt8xx/bttv-driver.c | |
parent | bbb2775af14dc145fe9434e8e34ebd4cf0c8499c (diff) | |
download | mediapointer-dvb-s2-f7d8cfd0cd4b120216f408c6f2bf8137eafbb8ce.tar.gz mediapointer-dvb-s2-f7d8cfd0cd4b120216f408c6f2bf8137eafbb8ce.tar.bz2 |
remove V4L1 from being compiled when V4L2 only is selected
From: Mauro Carvalho Chehab <mchehab@infradead.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
---
linux/drivers/media/video/bt8xx/bttv-driver.c | 95 ++++++--------------------
linux/drivers/media/video/bt8xx/bttvp.h | 1
2 files changed, 24 insertions(+), 72 deletions(-)
Diffstat (limited to 'linux/drivers/media/video/bt8xx/bttv-driver.c')
-rw-r--r-- | linux/drivers/media/video/bt8xx/bttv-driver.c | 95 |
1 files changed, 24 insertions, 71 deletions
diff --git a/linux/drivers/media/video/bt8xx/bttv-driver.c b/linux/drivers/media/video/bt8xx/bttv-driver.c index fce6c5324..bddcbf620 100644 --- a/linux/drivers/media/video/bt8xx/bttv-driver.c +++ b/linux/drivers/media/video/bt8xx/bttv-driver.c @@ -12,6 +12,9 @@ V4L1 removal from: (c) 2005-2006 Nickolay V. Shmyrev <nshmyrev@yandex.ru> + Fixes to be fully V4L2 compliant by + (c) 2006 Mauro Carvalho Chehab <mchehab@infradead.org> + Cropping and overscan support Copyright (C) 2005, 2006 Michael H. Schimek <mschimek@gmx.at> Sponsored by OPQ Systems AB @@ -176,7 +179,7 @@ static ssize_t show_card(struct device *cd, static ssize_t show_card(struct class_device *cd, char *buf) #endif { - struct video_device *vfd = to_video_device(cd); + struct video_device *vfd = container_of(cd, struct video_device, class_dev); struct bttv *btv = dev_get_drvdata(vfd->dev); return sprintf(buf, "%d\n", btv ? btv->c.type : UNSET); } @@ -505,28 +508,24 @@ static const unsigned int BTTV_TVNORMS = ARRAY_SIZE(bttv_tvnorms); static const struct bttv_format bttv_formats[] = { { .name = "8 bpp, gray", - .palette = VIDEO_PALETTE_GREY, .fourcc = V4L2_PIX_FMT_GREY, .btformat = BT848_COLOR_FMT_Y8, .depth = 8, .flags = FORMAT_FLAGS_PACKED, },{ .name = "8 bpp, dithered color", - .palette = VIDEO_PALETTE_HI240, .fourcc = V4L2_PIX_FMT_HI240, .btformat = BT848_COLOR_FMT_RGB8, .depth = 8, .flags = FORMAT_FLAGS_PACKED | FORMAT_FLAGS_DITHER, },{ .name = "15 bpp RGB, le", - .palette = VIDEO_PALETTE_RGB555, .fourcc = V4L2_PIX_FMT_RGB555, .btformat = BT848_COLOR_FMT_RGB15, .depth = 16, .flags = FORMAT_FLAGS_PACKED, },{ .name = "15 bpp RGB, be", - .palette = -1, .fourcc = V4L2_PIX_FMT_RGB555X, .btformat = BT848_COLOR_FMT_RGB15, .btswap = 0x03, /* byteswap */ @@ -534,14 +533,12 @@ static const struct bttv_format bttv_formats[] = { .flags = FORMAT_FLAGS_PACKED, },{ .name = "16 bpp RGB, le", - .palette = VIDEO_PALETTE_RGB565, .fourcc = V4L2_PIX_FMT_RGB565, .btformat = BT848_COLOR_FMT_RGB16, .depth = 16, .flags = FORMAT_FLAGS_PACKED, },{ .name = "16 bpp RGB, be", - .palette = -1, .fourcc = V4L2_PIX_FMT_RGB565X, .btformat = BT848_COLOR_FMT_RGB16, .btswap = 0x03, /* byteswap */ @@ -549,21 +546,18 @@ static const struct bttv_format bttv_formats[] = { .flags = FORMAT_FLAGS_PACKED, },{ .name = "24 bpp RGB, le", - .palette = VIDEO_PALETTE_RGB24, .fourcc = V4L2_PIX_FMT_BGR24, .btformat = BT848_COLOR_FMT_RGB24, .depth = 24, .flags = FORMAT_FLAGS_PACKED, },{ .name = "32 bpp RGB, le", - .palette = VIDEO_PALETTE_RGB32, .fourcc = V4L2_PIX_FMT_BGR32, .btformat = BT848_COLOR_FMT_RGB32, .depth = 32, .flags = FORMAT_FLAGS_PACKED, },{ .name = "32 bpp RGB, be", - .palette = -1, .fourcc = V4L2_PIX_FMT_RGB32, .btformat = BT848_COLOR_FMT_RGB32, .btswap = 0x0f, /* byte+word swap */ @@ -571,21 +565,18 @@ static const struct bttv_format bttv_formats[] = { .flags = FORMAT_FLAGS_PACKED, },{ .name = "4:2:2, packed, YUYV", - .palette = VIDEO_PALETTE_YUV422, .fourcc = V4L2_PIX_FMT_YUYV, .btformat = BT848_COLOR_FMT_YUY2, .depth = 16, .flags = FORMAT_FLAGS_PACKED, },{ .name = "4:2:2, packed, YUYV", - .palette = VIDEO_PALETTE_YUYV, .fourcc = V4L2_PIX_FMT_YUYV, .btformat = BT848_COLOR_FMT_YUY2, .depth = 16, .flags = FORMAT_FLAGS_PACKED, },{ .name = "4:2:2, packed, UYVY", - .palette = VIDEO_PALETTE_UYVY, .fourcc = V4L2_PIX_FMT_UYVY, .btformat = BT848_COLOR_FMT_YUY2, .btswap = 0x03, /* byteswap */ @@ -593,7 +584,6 @@ static const struct bttv_format bttv_formats[] = { .flags = FORMAT_FLAGS_PACKED, },{ .name = "4:2:2, planar, Y-Cb-Cr", - .palette = VIDEO_PALETTE_YUV422P, .fourcc = V4L2_PIX_FMT_YUV422P, .btformat = BT848_COLOR_FMT_YCrCb422, .depth = 16, @@ -602,7 +592,6 @@ static const struct bttv_format bttv_formats[] = { .vshift = 0, },{ .name = "4:2:0, planar, Y-Cb-Cr", - .palette = VIDEO_PALETTE_YUV420P, .fourcc = V4L2_PIX_FMT_YUV420, .btformat = BT848_COLOR_FMT_YCrCb422, .depth = 12, @@ -611,7 +600,6 @@ static const struct bttv_format bttv_formats[] = { .vshift = 1, },{ .name = "4:2:0, planar, Y-Cr-Cb", - .palette = -1, .fourcc = V4L2_PIX_FMT_YVU420, .btformat = BT848_COLOR_FMT_YCrCb422, .depth = 12, @@ -620,7 +608,6 @@ static const struct bttv_format bttv_formats[] = { .vshift = 1, },{ .name = "4:1:1, planar, Y-Cb-Cr", - .palette = VIDEO_PALETTE_YUV411P, .fourcc = V4L2_PIX_FMT_YUV411P, .btformat = BT848_COLOR_FMT_YCrCb411, .depth = 12, @@ -629,7 +616,6 @@ static const struct bttv_format bttv_formats[] = { .vshift = 0, },{ .name = "4:1:0, planar, Y-Cb-Cr", - .palette = VIDEO_PALETTE_YUV410P, .fourcc = V4L2_PIX_FMT_YUV410, .btformat = BT848_COLOR_FMT_YCrCb411, .depth = 9, @@ -638,7 +624,6 @@ static const struct bttv_format bttv_formats[] = { .vshift = 2, },{ .name = "4:1:0, planar, Y-Cr-Cb", - .palette = -1, .fourcc = V4L2_PIX_FMT_YVU410, .btformat = BT848_COLOR_FMT_YCrCb411, .depth = 9, @@ -647,7 +632,6 @@ static const struct bttv_format bttv_formats[] = { .vshift = 2, },{ .name = "raw scanlines", - .palette = VIDEO_PALETTE_RAW, .fourcc = -1, .btformat = BT848_COLOR_FMT_RAW, .depth = 8, @@ -1491,7 +1475,6 @@ static void bttv_reinit_bt848(struct bttv *btv) static int get_control(struct bttv *btv, struct v4l2_control *c) { - struct video_audio va; int i; for (i = 0; i < BTTV_CTLS; i++) @@ -1499,7 +1482,10 @@ static int get_control(struct bttv *btv, struct v4l2_control *c) break; if (i == BTTV_CTLS) return -EINVAL; +#ifdef CONFIG_VIDEO_V4L1 if (btv->audio_hook && i >= 4 && i <= 8) { + struct video_audio va; + memset(&va,0,sizeof(va)); btv->audio_hook(btv,&va,0); switch (c->id) { @@ -1521,6 +1507,7 @@ static int get_control(struct bttv *btv, struct v4l2_control *c) } return 0; } +#endif switch (c->id) { case V4L2_CID_BRIGHTNESS: c->value = btv->bright; @@ -1584,7 +1571,6 @@ static int get_control(struct bttv *btv, struct v4l2_control *c) static int set_control(struct bttv *btv, struct v4l2_control *c) { - struct video_audio va; int i,val; for (i = 0; i < BTTV_CTLS; i++) @@ -1592,7 +1578,10 @@ static int set_control(struct bttv *btv, struct v4l2_control *c) break; if (i == BTTV_CTLS) return -EINVAL; +#ifdef CONFIG_VIDEO_V4L1 if (btv->audio_hook && i >= 4 && i <= 8) { + struct video_audio va; + memset(&va,0,sizeof(va)); btv->audio_hook(btv,&va,0); switch (c->id) { @@ -1622,6 +1611,7 @@ static int set_control(struct bttv *btv, struct v4l2_control *c) btv->audio_hook(btv,&va,1); return 0; } +#endif switch (c->id) { case V4L2_CID_BRIGHTNESS: bt848_bright(btv,c->value); @@ -1730,20 +1720,6 @@ static void bttv_field_count(struct bttv *btv) } static const struct bttv_format* -format_by_palette(int palette) -{ - unsigned int i; - - for (i = 0; i < BTTV_FORMATS; i++) { - if (-1 == bttv_formats[i].palette) - continue; - if (bttv_formats[i].palette == palette) - return bttv_formats+i; - } - return NULL; -} - -static const struct bttv_format* format_by_fourcc(int fourcc) { unsigned int i; @@ -1956,6 +1932,7 @@ static struct videobuf_queue_ops bttv_video_qops = { static int bttv_common_ioctls(struct bttv *btv, unsigned int cmd, void *arg) { switch (cmd) { +#ifdef CONFIG_VIDEO_V4L1 case VIDIOCGAUDIO: { struct video_audio *v = arg; @@ -1994,7 +1971,7 @@ static int bttv_common_ioctls(struct bttv *btv, unsigned int cmd, void *arg) mutex_unlock(&btv->lock); return 0; } - +#endif /* *** v4l2 *** ************************************************ */ case VIDIOC_ENUMSTD: { @@ -2101,6 +2078,7 @@ static int bttv_common_ioctls(struct bttv *btv, unsigned int cmd, void *arg) return -EINVAL; mutex_lock(&btv->lock); bttv_call_i2c_clients(btv, VIDIOC_S_TUNER, t); +#ifdef CONFIG_VIDEO_V4L1 if (btv->audio_hook) { struct video_audio va; memset(&va, 0, sizeof(struct video_audio)); @@ -2115,6 +2093,7 @@ static int bttv_common_ioctls(struct bttv *btv, unsigned int cmd, void *arg) va.mode = VIDEO_SOUND_LANG2; btv->audio_hook(btv,&va,1); } +#endif mutex_unlock(&btv->lock); return 0; } @@ -2741,28 +2720,6 @@ static int bttv_do_ioctl(struct inode *inode, struct file *file, return 0; } #endif - case VIDIOCGVBIFMT: - case VIDIOCSVBIFMT: - case VIDIOCSYNC: - case VIDIOCMCAPTURE: - case VIDIOCCAPTURE: - case VIDIOCGFBUF: - case VIDIOCSFBUF: - case VIDIOCGWIN: - case VIDIOCSWIN: - case VIDIOCGCAP: - case VIDIOCGPICT: - case VIDIOCSPICT: - case VIDIOCGFREQ: - case VIDIOCSFREQ: - case VIDIOCGTUNER: - case VIDIOCSTUNER: - case VIDIOCGCHAN: - case VIDIOCSCHAN: - case VIDIOCGAUDIO: - case VIDIOCSAUDIO: - return v4l_compat_translate_ioctl(inode,file,cmd,arg, - bttv_do_ioctl); /* *** v4l2 *** ************************************************ */ case VIDIOC_QUERYCAP: @@ -3016,6 +2973,7 @@ static int bttv_do_ioctl(struct inode *inode, struct file *file, return 0; } *c = bttv_ctls[i]; +#ifdef CONFIG_VIDEO_V4L1 if (btv->audio_hook && i >= 4 && i <= 8) { struct video_audio va; memset(&va,0,sizeof(va)); @@ -3039,6 +2997,7 @@ static int bttv_do_ioctl(struct inode *inode, struct file *file, break; } } +#endif return 0; } case VIDIOC_G_PARM: @@ -3070,7 +3029,7 @@ static int bttv_do_ioctl(struct inode *inode, struct file *file, t->type = V4L2_TUNER_ANALOG_TV; if (btread(BT848_DSTATUS)&BT848_DSTATUS_HLOC) t->signal = 0xffff; - +#ifdef CONFIG_VIDEO_V4L1 if (btv->audio_hook) { /* Hmmm ... */ struct video_audio va; @@ -3088,6 +3047,7 @@ static int bttv_do_ioctl(struct inode *inode, struct file *file, | V4L2_TUNER_SUB_LANG2; } } +#endif /* FIXME: fill capability+audmode */ mutex_unlock(&btv->lock); return 0; @@ -3239,7 +3199,8 @@ static int bttv_do_ioctl(struct inode *inode, struct file *file, case VIDIOC_DBG_S_REGISTER: return bttv_common_ioctls(btv,cmd,arg); default: - return -ENOIOCTLCMD; + return v4l_compat_translate_ioctl(inode,file,cmd,arg, + bttv_do_ioctl); } return 0; @@ -3599,17 +3560,9 @@ static int radio_do_ioctl(struct inode *inode, struct file *file, case VIDIOC_DBG_G_REGISTER: case VIDIOC_DBG_S_REGISTER: return bttv_common_ioctls(btv,cmd,arg); - case VIDIOCGCAP: - case VIDIOCGFREQ: - case VIDIOCSFREQ: - case VIDIOCGTUNER: - case VIDIOCSTUNER: - case VIDIOCGAUDIO: - case VIDIOCSAUDIO: + default: return v4l_compat_translate_ioctl(inode,file,cmd,arg, radio_do_ioctl); - default: - return -ENOIOCTLCMD; } return 0; } @@ -4419,7 +4372,7 @@ static int __devinit bttv_probe(struct pci_dev *dev, btv->init.btv = btv; btv->init.ov.w.width = 320; btv->init.ov.w.height = 240; - btv->init.fmt = format_by_palette(VIDEO_PALETTE_RGB24); + btv->init.fmt = format_by_fourcc(V4L2_PIX_FMT_BGR24); btv->init.width = 320; btv->init.height = 240; btv->input = 0; |