aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@redhat.com>2009-07-03 01:54:18 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2009-07-05 18:21:22 -0400
commit58fc1ce37aba8e6371e1ec8a90d650b1965ee6c8 (patch)
tree7acb827b4e839ceb3023d4e110b16335d8be86da /drivers/media
parented5f1431ebeeba8cc6739e9cd905a7895b66184c (diff)
V4L/DVB (12171): em28xx: fix webcam usage with different output formats
Discovered the bug that were limiting the output format to just RGB565. Now, it is possible to output image at Bayer format (the original one, as generated by Silvercrest sensor, and two others), and also on YUY. Adds Bayer formats also to the driver. Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media')
-rw-r--r--drivers/media/video/em28xx/em28xx-core.c1
-rw-r--r--drivers/media/video/em28xx/em28xx-video.c46
2 files changed, 23 insertions, 24 deletions
diff --git a/drivers/media/video/em28xx/em28xx-core.c b/drivers/media/video/em28xx/em28xx-core.c
index dda2721ee5b0..079ab4d563a6 100644
--- a/drivers/media/video/em28xx/em28xx-core.c
+++ b/drivers/media/video/em28xx/em28xx-core.c
@@ -655,7 +655,6 @@ int em28xx_set_outfmt(struct em28xx *dev)
655 if (dev->board.is_27xx) { 655 if (dev->board.is_27xx) {
656 vinmode = 0x0d; 656 vinmode = 0x0d;
657 vinctl = 0x00; 657 vinctl = 0x00;
658 outfmt = 0x24;
659 } else { 658 } else {
660 vinmode = 0x10; 659 vinmode = 0x10;
661 vinctl = 0x11; 660 vinctl = 0x11;
diff --git a/drivers/media/video/em28xx/em28xx-video.c b/drivers/media/video/em28xx/em28xx-video.c
index 702fe8d6742e..14316c912179 100644
--- a/drivers/media/video/em28xx/em28xx-video.c
+++ b/drivers/media/video/em28xx/em28xx-video.c
@@ -90,15 +90,35 @@ MODULE_PARM_DESC(video_debug, "enable debug messages [video]");
90/* supported video standards */ 90/* supported video standards */
91static struct em28xx_fmt format[] = { 91static struct em28xx_fmt format[] = {
92 { 92 {
93 .name = "16bpp YUY2, 4:2:2, packed", 93 .name = "16 bpp YUY2, 4:2:2, packed",
94 .fourcc = V4L2_PIX_FMT_YUYV, 94 .fourcc = V4L2_PIX_FMT_YUYV,
95 .depth = 16, 95 .depth = 16,
96 .reg = EM28XX_OUTFMT_YUV422_Y0UY1V, 96 .reg = EM28XX_OUTFMT_YUV422_Y0UY1V,
97 }, { 97 }, {
98 .name = "16 bpp RGB, le", 98 .name = "16 bpp RGB 565, LE",
99 .fourcc = V4L2_PIX_FMT_RGB565, 99 .fourcc = V4L2_PIX_FMT_RGB565,
100 .depth = 16, 100 .depth = 16,
101 .reg = EM28XX_OUTFMT_YUV211, 101 .reg = EM28XX_OUTFMT_RGB_16_656,
102 }, {
103 .name = "8 bpp Bayer BGBG..GRGR",
104 .fourcc = V4L2_PIX_FMT_SBGGR8,
105 .depth = 8,
106 .reg = EM28XX_OUTFMT_RGB_8_BGBG,
107 }, {
108 .name = "8 bpp Bayer GRGR..BGBG",
109 .fourcc = V4L2_PIX_FMT_SGRBG8,
110 .depth = 8,
111 .reg = EM28XX_OUTFMT_RGB_8_GRGR,
112 }, {
113 .name = "8 bpp Bayer GBGB..RGRG",
114 .fourcc = V4L2_PIX_FMT_SGBRG8,
115 .depth = 8,
116 .reg = EM28XX_OUTFMT_RGB_8_GBGB,
117 }, {
118 .name = "12 bpp YUV411",
119 .fourcc = V4L2_PIX_FMT_YUV411P,
120 .depth = 12,
121 .reg = EM28XX_OUTFMT_YUV411,
102 }, 122 },
103}; 123};
104 124
@@ -699,10 +719,6 @@ static int vidioc_try_fmt_vid_cap(struct file *file, void *priv,
699 unsigned int hscale, vscale; 719 unsigned int hscale, vscale;
700 struct em28xx_fmt *fmt; 720 struct em28xx_fmt *fmt;
701 721
702 /* FIXME: This is the only supported fmt */
703 if (dev->board.is_27xx)
704 f->fmt.pix.pixelformat = V4L2_PIX_FMT_RGB565;
705
706 fmt = format_by_fourcc(f->fmt.pix.pixelformat); 722 fmt = format_by_fourcc(f->fmt.pix.pixelformat);
707 if (!fmt) { 723 if (!fmt) {
708 em28xx_videodbg("Fourcc format (%08x) invalid.\n", 724 em28xx_videodbg("Fourcc format (%08x) invalid.\n",
@@ -753,7 +769,6 @@ static int em28xx_set_video_format(struct em28xx *dev, unsigned int fourcc,
753 769
754 /* FIXME: This is the only supported fmt */ 770 /* FIXME: This is the only supported fmt */
755 if (dev->board.is_27xx) { 771 if (dev->board.is_27xx) {
756 fourcc = V4L2_PIX_FMT_RGB565;
757 width = 640; 772 width = 640;
758 height = 480; 773 height = 480;
759 } 774 }
@@ -1387,24 +1402,9 @@ static int vidioc_querycap(struct file *file, void *priv,
1387static int vidioc_enum_fmt_vid_cap(struct file *file, void *priv, 1402static int vidioc_enum_fmt_vid_cap(struct file *file, void *priv,
1388 struct v4l2_fmtdesc *f) 1403 struct v4l2_fmtdesc *f)
1389{ 1404{
1390 struct em28xx_fh *fh = priv;
1391 struct em28xx *dev = fh->dev;
1392
1393 if (unlikely(f->index >= ARRAY_SIZE(format))) 1405 if (unlikely(f->index >= ARRAY_SIZE(format)))
1394 return -EINVAL; 1406 return -EINVAL;
1395 1407
1396 if (dev->board.is_27xx) {
1397 struct em28xx_fmt *fmt;
1398 if (f->index)
1399 return -EINVAL;
1400
1401 f->pixelformat = V4L2_PIX_FMT_RGB565;
1402 fmt = format_by_fourcc(f->pixelformat);
1403 strlcpy(f->description, fmt->name, sizeof(f->description));
1404
1405 return 0;
1406 }
1407
1408 strlcpy(f->description, format[f->index].name, sizeof(f->description)); 1408 strlcpy(f->description, format[f->index].name, sizeof(f->description));
1409 f->pixelformat = format[f->index].fourcc; 1409 f->pixelformat = format[f->index].fourcc;
1410 1410