diff options
author | Lad, Prabhakar <prabhakar.lad@ti.com> | 2012-09-18 14:54:38 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2012-10-05 20:48:03 -0400 |
commit | 117a711a2c37a0309a3e39fbd13486642b63453b (patch) | |
tree | 27fc0524ae0d20d5280a42d391ec36cc93036acb /drivers/media/v4l2-core | |
parent | 5ebef0fbe0f72fa911088800c5d0bc7a872c35de (diff) |
[media] media: v4l2-ctrl: add a helper function to add standard control with driver specific menu
Add helper function v4l2_ctrl_new_std_menu_items(), which adds
a standard menu control, with driver specific menu.
Signed-off-by: Lad, Prabhakar <prabhakar.lad@ti.com>
Signed-off-by: Manjunath Hadli <manjunath.hadli@ti.com>
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/v4l2-core')
-rw-r--r-- | drivers/media/v4l2-core/v4l2-ctrls.c | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/drivers/media/v4l2-core/v4l2-ctrls.c b/drivers/media/v4l2-core/v4l2-ctrls.c index 0bcef2b52cb1..207bcd8dee11 100644 --- a/drivers/media/v4l2-core/v4l2-ctrls.c +++ b/drivers/media/v4l2-core/v4l2-ctrls.c | |||
@@ -1650,6 +1650,36 @@ struct v4l2_ctrl *v4l2_ctrl_new_std_menu(struct v4l2_ctrl_handler *hdl, | |||
1650 | } | 1650 | } |
1651 | EXPORT_SYMBOL(v4l2_ctrl_new_std_menu); | 1651 | EXPORT_SYMBOL(v4l2_ctrl_new_std_menu); |
1652 | 1652 | ||
1653 | /* Helper function for standard menu controls with driver defined menu */ | ||
1654 | struct v4l2_ctrl *v4l2_ctrl_new_std_menu_items(struct v4l2_ctrl_handler *hdl, | ||
1655 | const struct v4l2_ctrl_ops *ops, u32 id, s32 max, | ||
1656 | s32 mask, s32 def, const char * const *qmenu) | ||
1657 | { | ||
1658 | enum v4l2_ctrl_type type; | ||
1659 | const char *name; | ||
1660 | u32 flags; | ||
1661 | s32 step; | ||
1662 | s32 min; | ||
1663 | |||
1664 | /* v4l2_ctrl_new_std_menu_items() should only be called for | ||
1665 | * standard controls without a standard menu. | ||
1666 | */ | ||
1667 | if (v4l2_ctrl_get_menu(id)) { | ||
1668 | handler_set_err(hdl, -EINVAL); | ||
1669 | return NULL; | ||
1670 | } | ||
1671 | |||
1672 | v4l2_ctrl_fill(id, &name, &type, &min, &max, &step, &def, &flags); | ||
1673 | if (type != V4L2_CTRL_TYPE_MENU || qmenu == NULL) { | ||
1674 | handler_set_err(hdl, -EINVAL); | ||
1675 | return NULL; | ||
1676 | } | ||
1677 | return v4l2_ctrl_new(hdl, ops, id, name, type, 0, max, mask, def, | ||
1678 | flags, qmenu, NULL, NULL); | ||
1679 | |||
1680 | } | ||
1681 | EXPORT_SYMBOL(v4l2_ctrl_new_std_menu_items); | ||
1682 | |||
1653 | /* Helper function for standard integer menu controls */ | 1683 | /* Helper function for standard integer menu controls */ |
1654 | struct v4l2_ctrl *v4l2_ctrl_new_int_menu(struct v4l2_ctrl_handler *hdl, | 1684 | struct v4l2_ctrl *v4l2_ctrl_new_int_menu(struct v4l2_ctrl_handler *hdl, |
1655 | const struct v4l2_ctrl_ops *ops, | 1685 | const struct v4l2_ctrl_ops *ops, |