Commit 43cb9fe3 authored by Mauro Carvalho Chehab's avatar Mauro Carvalho Chehab

V4L/DVB (12139): em28xx: add other video formats

Add suppport for the teste RGB565 format (16 bits/pixel).
Currently, webcam support works only at RGB565, at 640x480.
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent 02e7804b
...@@ -94,6 +94,11 @@ static struct em28xx_fmt format[] = { ...@@ -94,6 +94,11 @@ static struct em28xx_fmt format[] = {
.fourcc = V4L2_PIX_FMT_YUYV, .fourcc = V4L2_PIX_FMT_YUYV,
.depth = 16, .depth = 16,
.reg = EM28XX_OUTFMT_YUV422_Y0UY1V, .reg = EM28XX_OUTFMT_YUV422_Y0UY1V,
}, {
.name = "16 bpp RGB, le",
.fourcc = V4L2_PIX_FMT_RGB565,
.depth = 16,
.reg = EM28XX_OUTFMT_YUV211,
}, },
}; };
...@@ -694,6 +699,10 @@ static int vidioc_try_fmt_vid_cap(struct file *file, void *priv, ...@@ -694,6 +699,10 @@ static int vidioc_try_fmt_vid_cap(struct file *file, void *priv,
unsigned int hscale, vscale; unsigned int hscale, vscale;
struct em28xx_fmt *fmt; struct em28xx_fmt *fmt;
/* FIXME: This is the only supported fmt */
if (dev->board.is_27xx)
f->fmt.pix.pixelformat = V4L2_PIX_FMT_RGB565;
fmt = format_by_fourcc(f->fmt.pix.pixelformat); fmt = format_by_fourcc(f->fmt.pix.pixelformat);
if (!fmt) { if (!fmt) {
em28xx_videodbg("Fourcc format (%08x) invalid.\n", em28xx_videodbg("Fourcc format (%08x) invalid.\n",
...@@ -701,7 +710,11 @@ static int vidioc_try_fmt_vid_cap(struct file *file, void *priv, ...@@ -701,7 +710,11 @@ static int vidioc_try_fmt_vid_cap(struct file *file, void *priv,
return -EINVAL; return -EINVAL;
} }
if (dev->board.is_em2800) { if (dev->board.is_27xx) {
/* FIXME: This is the only supported fmt */
width = 640;
height = 480;
} else if (dev->board.is_em2800) {
/* the em2800 can only scale down to 50% */ /* the em2800 can only scale down to 50% */
height = height > (3 * maxh / 4) ? maxh : maxh / 2; height = height > (3 * maxh / 4) ? maxh : maxh / 2;
width = width > (3 * maxw / 4) ? maxw : maxw / 2; width = width > (3 * maxw / 4) ? maxw : maxw / 2;
...@@ -747,6 +760,10 @@ static int vidioc_s_fmt_vid_cap(struct file *file, void *priv, ...@@ -747,6 +760,10 @@ static int vidioc_s_fmt_vid_cap(struct file *file, void *priv,
mutex_lock(&dev->lock); mutex_lock(&dev->lock);
/* FIXME: This is the only supported fmt */
if (dev->board.is_27xx)
f->fmt.pix.pixelformat = V4L2_PIX_FMT_RGB565;
vidioc_try_fmt_vid_cap(file, priv, f); vidioc_try_fmt_vid_cap(file, priv, f);
fmt = format_by_fourcc(f->fmt.pix.pixelformat); fmt = format_by_fourcc(f->fmt.pix.pixelformat);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment