Commit 62105006 authored by Akinobu Mita's avatar Akinobu Mita Committed by Mauro Carvalho Chehab

media: ov2640: add V4L2_CID_TEST_PATTERN control

The ov2640 has the test pattern generator features.  This makes use of
it through V4L2_CID_TEST_PATTERN control.

[Sakari Ailus: Use "Eight Vertical Colour Bars" as the second manu entry]
Signed-off-by: default avatarAkinobu Mita <akinobu.mita@gmail.com>
Signed-off-by: default avatarSakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+samsung@kernel.org>
parent dde64f72
...@@ -705,6 +705,11 @@ static int ov2640_reset(struct i2c_client *client) ...@@ -705,6 +705,11 @@ static int ov2640_reset(struct i2c_client *client)
return ret; return ret;
} }
static const char * const ov2640_test_pattern_menu[] = {
"Disabled",
"Eight Vertical Colour Bars",
};
/* /*
* functions * functions
*/ */
...@@ -740,6 +745,9 @@ static int ov2640_s_ctrl(struct v4l2_ctrl *ctrl) ...@@ -740,6 +745,9 @@ static int ov2640_s_ctrl(struct v4l2_ctrl *ctrl)
case V4L2_CID_HFLIP: case V4L2_CID_HFLIP:
val = ctrl->val ? REG04_HFLIP_IMG : 0x00; val = ctrl->val ? REG04_HFLIP_IMG : 0x00;
return ov2640_mask_set(client, REG04, REG04_HFLIP_IMG, val); return ov2640_mask_set(client, REG04, REG04_HFLIP_IMG, val);
case V4L2_CID_TEST_PATTERN:
val = ctrl->val ? COM7_COLOR_BAR_TEST : 0x00;
return ov2640_mask_set(client, COM7, COM7_COLOR_BAR_TEST, val);
} }
return -EINVAL; return -EINVAL;
...@@ -1184,12 +1192,16 @@ static int ov2640_probe(struct i2c_client *client, ...@@ -1184,12 +1192,16 @@ static int ov2640_probe(struct i2c_client *client,
v4l2_i2c_subdev_init(&priv->subdev, client, &ov2640_subdev_ops); v4l2_i2c_subdev_init(&priv->subdev, client, &ov2640_subdev_ops);
priv->subdev.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE; priv->subdev.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE;
mutex_init(&priv->lock); mutex_init(&priv->lock);
v4l2_ctrl_handler_init(&priv->hdl, 2); v4l2_ctrl_handler_init(&priv->hdl, 3);
priv->hdl.lock = &priv->lock; priv->hdl.lock = &priv->lock;
v4l2_ctrl_new_std(&priv->hdl, &ov2640_ctrl_ops, v4l2_ctrl_new_std(&priv->hdl, &ov2640_ctrl_ops,
V4L2_CID_VFLIP, 0, 1, 1, 0); V4L2_CID_VFLIP, 0, 1, 1, 0);
v4l2_ctrl_new_std(&priv->hdl, &ov2640_ctrl_ops, v4l2_ctrl_new_std(&priv->hdl, &ov2640_ctrl_ops,
V4L2_CID_HFLIP, 0, 1, 1, 0); V4L2_CID_HFLIP, 0, 1, 1, 0);
v4l2_ctrl_new_std_menu_items(&priv->hdl, &ov2640_ctrl_ops,
V4L2_CID_TEST_PATTERN,
ARRAY_SIZE(ov2640_test_pattern_menu) - 1, 0, 0,
ov2640_test_pattern_menu);
priv->subdev.ctrl_handler = &priv->hdl; priv->subdev.ctrl_handler = &priv->hdl;
if (priv->hdl.error) { if (priv->hdl.error) {
ret = priv->hdl.error; ret = priv->hdl.error;
......
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