Commit 1112fb68 authored by Jaime Velasco Juan's avatar Jaime Velasco Juan Committed by Mauro Carvalho Chehab

V4L/DVB (7088): V4L: stkwebcam: Add support for YUYV format

Signed-off-by: default avatarJaime Velasco Juan <jsagarribay@gmail.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@infradead.org>
parent 0ed464e1
...@@ -380,7 +380,7 @@ int stk_sensor_init(struct stk_camera *dev) ...@@ -380,7 +380,7 @@ int stk_sensor_init(struct stk_camera *dev)
STK_ERROR("Strange error reading sensor ID\n"); STK_ERROR("Strange error reading sensor ID\n");
return -ENODEV; return -ENODEV;
} }
if (idh != 0x7F || idl != 0xA2) { if (idh != 0x7f || idl != 0xa2) {
STK_ERROR("Huh? you don't have a sensor from ovt\n"); STK_ERROR("Huh? you don't have a sensor from ovt\n");
return -ENODEV; return -ENODEV;
} }
...@@ -409,6 +409,19 @@ static struct regval ov_fmt_uyvy[] = { ...@@ -409,6 +409,19 @@ static struct regval ov_fmt_uyvy[] = {
{REG_COM15, COM15_R00FF }, {REG_COM15, COM15_R00FF },
{0xff, 0xff}, /* END MARKER */ {0xff, 0xff}, /* END MARKER */
}; };
/* V4L2_PIX_FMT_YUYV */
static struct regval ov_fmt_yuyv[] = {
{REG_TSLB, 0 },
{ 0x4f, 0x80 }, /* "matrix coefficient 1" */
{ 0x50, 0x80 }, /* "matrix coefficient 2" */
{ 0x51, 0 }, /* vb */
{ 0x52, 0x22 }, /* "matrix coefficient 4" */
{ 0x53, 0x5e }, /* "matrix coefficient 5" */
{ 0x54, 0x80 }, /* "matrix coefficient 6" */
{REG_COM13, COM13_UVSAT|COM13_CMATRIX},
{REG_COM15, COM15_R00FF },
{0xff, 0xff}, /* END MARKER */
};
/* V4L2_PIX_FMT_RGB565X rrrrrggg gggbbbbb */ /* V4L2_PIX_FMT_RGB565X rrrrrggg gggbbbbb */
static struct regval ov_fmt_rgbr[] = { static struct regval ov_fmt_rgbr[] = {
...@@ -519,6 +532,10 @@ int stk_sensor_configure(struct stk_camera *dev) ...@@ -519,6 +532,10 @@ int stk_sensor_configure(struct stk_camera *dev)
com7 |= COM7_YUV; com7 |= COM7_YUV;
rv = ov_fmt_uyvy; rv = ov_fmt_uyvy;
break; break;
case V4L2_PIX_FMT_YUYV:
com7 |= COM7_YUV;
rv = ov_fmt_yuyv;
break;
case V4L2_PIX_FMT_RGB565: case V4L2_PIX_FMT_RGB565:
com7 |= COM7_RGB; com7 |= COM7_RGB;
rv = ov_fmt_rgbp; rv = ov_fmt_rgbp;
......
...@@ -993,6 +993,10 @@ static int stk_vidioc_enum_fmt_cap(struct file *filp, ...@@ -993,6 +993,10 @@ static int stk_vidioc_enum_fmt_cap(struct file *filp,
fmtd->pixelformat = V4L2_PIX_FMT_SBGGR8; fmtd->pixelformat = V4L2_PIX_FMT_SBGGR8;
strcpy(fmtd->description, "Raw bayer"); strcpy(fmtd->description, "Raw bayer");
break; break;
case 4:
fmtd->pixelformat = V4L2_PIX_FMT_YUYV;
strcpy(fmtd->description, "yuv4:2:2");
break;
default: default:
return -EINVAL; return -EINVAL;
} }
...@@ -1048,6 +1052,7 @@ static int stk_vidioc_try_fmt_cap(struct file *filp, ...@@ -1048,6 +1052,7 @@ static int stk_vidioc_try_fmt_cap(struct file *filp,
case V4L2_PIX_FMT_RGB565: case V4L2_PIX_FMT_RGB565:
case V4L2_PIX_FMT_RGB565X: case V4L2_PIX_FMT_RGB565X:
case V4L2_PIX_FMT_UYVY: case V4L2_PIX_FMT_UYVY:
case V4L2_PIX_FMT_YUYV:
case V4L2_PIX_FMT_SBGGR8: case V4L2_PIX_FMT_SBGGR8:
break; break;
default: default:
...@@ -1403,7 +1408,7 @@ static int stk_camera_probe(struct usb_interface *interface, ...@@ -1403,7 +1408,7 @@ static int stk_camera_probe(struct usb_interface *interface,
dev->vsettings.brightness = 0x7fff; dev->vsettings.brightness = 0x7fff;
dev->vsettings.palette = V4L2_PIX_FMT_RGB565; dev->vsettings.palette = V4L2_PIX_FMT_RGB565;
dev->vsettings.mode = MODE_VGA; dev->vsettings.mode = MODE_VGA;
dev->frame_size = 640*480*2; dev->frame_size = 640 * 480 * 2;
INIT_LIST_HEAD(&dev->sio_avail); INIT_LIST_HEAD(&dev->sio_avail);
INIT_LIST_HEAD(&dev->sio_full); INIT_LIST_HEAD(&dev->sio_full);
......
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