aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSakari Ailus <sakari.ailus@iki.fi>2011-08-05 05:38:05 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2012-04-10 13:59:59 -0400
commitc520331a52094182d6682fa7d6f630bdfbfc2974 (patch)
tree003a60b89f6e1c0bfee3c91ef98eefe201f6223e
parent6ec299f3dc86b59c1787d3541dcb52b934c901f0 (diff)
[media] vivi: Add an integer menu test control
Add an integer menu test control for the vivi driver. Signed-off-by: Sakari Ailus <sakari.ailus@iki.fi> Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
-rw-r--r--drivers/media/video/vivi.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/drivers/media/video/vivi.c b/drivers/media/video/vivi.c
index b456d3ed1197..ff39eb2f2d7b 100644
--- a/drivers/media/video/vivi.c
+++ b/drivers/media/video/vivi.c
@@ -177,6 +177,7 @@ struct vivi_dev {
177 struct v4l2_ctrl *menu; 177 struct v4l2_ctrl *menu;
178 struct v4l2_ctrl *string; 178 struct v4l2_ctrl *string;
179 struct v4l2_ctrl *bitmask; 179 struct v4l2_ctrl *bitmask;
180 struct v4l2_ctrl *int_menu;
180 181
181 spinlock_t slock; 182 spinlock_t slock;
182 struct mutex mutex; 183 struct mutex mutex;
@@ -503,6 +504,10 @@ static void vivi_fillbuff(struct vivi_dev *dev, struct vivi_buffer *buf)
503 dev->boolean->cur.val, 504 dev->boolean->cur.val,
504 dev->menu->qmenu[dev->menu->cur.val], 505 dev->menu->qmenu[dev->menu->cur.val],
505 dev->string->cur.string); 506 dev->string->cur.string);
507 snprintf(str, sizeof(str), " integer_menu %lld, value %d ",
508 dev->int_menu->qmenu_int[dev->int_menu->cur.val],
509 dev->int_menu->cur.val);
510 gen_text(dev, vbuf, line++ * 16, 16, str);
506 mutex_unlock(&dev->ctrl_handler.lock); 511 mutex_unlock(&dev->ctrl_handler.lock);
507 gen_text(dev, vbuf, line++ * 16, 16, str); 512 gen_text(dev, vbuf, line++ * 16, 16, str);
508 if (dev->button_pressed) { 513 if (dev->button_pressed) {
@@ -1158,6 +1163,22 @@ static const struct v4l2_ctrl_config vivi_ctrl_bitmask = {
1158 .step = 0, 1163 .step = 0,
1159}; 1164};
1160 1165
1166static const s64 vivi_ctrl_int_menu_values[] = {
1167 1, 1, 2, 3, 5, 8, 13, 21, 42,
1168};
1169
1170static const struct v4l2_ctrl_config vivi_ctrl_int_menu = {
1171 .ops = &vivi_ctrl_ops,
1172 .id = VIVI_CID_CUSTOM_BASE + 7,
1173 .name = "Integer menu",
1174 .type = V4L2_CTRL_TYPE_INTEGER_MENU,
1175 .min = 1,
1176 .max = 8,
1177 .def = 4,
1178 .menu_skip_mask = 0x02,
1179 .qmenu_int = vivi_ctrl_int_menu_values,
1180};
1181
1161static const struct v4l2_file_operations vivi_fops = { 1182static const struct v4l2_file_operations vivi_fops = {
1162 .owner = THIS_MODULE, 1183 .owner = THIS_MODULE,
1163 .open = v4l2_fh_open, 1184 .open = v4l2_fh_open,
@@ -1268,6 +1289,7 @@ static int __init vivi_create_instance(int inst)
1268 dev->menu = v4l2_ctrl_new_custom(hdl, &vivi_ctrl_menu, NULL); 1289 dev->menu = v4l2_ctrl_new_custom(hdl, &vivi_ctrl_menu, NULL);
1269 dev->string = v4l2_ctrl_new_custom(hdl, &vivi_ctrl_string, NULL); 1290 dev->string = v4l2_ctrl_new_custom(hdl, &vivi_ctrl_string, NULL);
1270 dev->bitmask = v4l2_ctrl_new_custom(hdl, &vivi_ctrl_bitmask, NULL); 1291 dev->bitmask = v4l2_ctrl_new_custom(hdl, &vivi_ctrl_bitmask, NULL);
1292 dev->int_menu = v4l2_ctrl_new_custom(hdl, &vivi_ctrl_int_menu, NULL);
1271 if (hdl->error) { 1293 if (hdl->error) {
1272 ret = hdl->error; 1294 ret = hdl->error;
1273 goto unreg_dev; 1295 goto unreg_dev;