aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/v4l2-core
diff options
context:
space:
mode:
authorSylwester Nawrocki <s.nawrocki@samsung.com>2013-07-09 00:24:40 -0400
committerMauro Carvalho Chehab <m.chehab@samsung.com>2013-08-18 06:12:59 -0400
commitd1e9b7c12b745af715101578a677e4a6b16c09e4 (patch)
tree6ccfe5745fc9bdc28c14fbab746f973608b39f8d /drivers/media/v4l2-core
parentdebe6267b718526ee9715501b8f52a0295e3712a (diff)
[media] V4L: Add support for integer menu controls with standard menu items
The patch modifies the helper function v4l2_ctrl_new_std_menu to accept integer menu controls with standard menu items. Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com> Signed-off-by: Arun Kumar K <arun.kk@samsung.com> Acked-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Kamil Debski <k.debski@samsung.com> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Diffstat (limited to 'drivers/media/v4l2-core')
-rw-r--r--drivers/media/v4l2-core/v4l2-ctrls.c28
1 files changed, 25 insertions, 3 deletions
diff --git a/drivers/media/v4l2-core/v4l2-ctrls.c b/drivers/media/v4l2-core/v4l2-ctrls.c
index fccd08b66d1a..e03a2e852143 100644
--- a/drivers/media/v4l2-core/v4l2-ctrls.c
+++ b/drivers/media/v4l2-core/v4l2-ctrls.c
@@ -552,6 +552,20 @@ const char * const *v4l2_ctrl_get_menu(u32 id)
552} 552}
553EXPORT_SYMBOL(v4l2_ctrl_get_menu); 553EXPORT_SYMBOL(v4l2_ctrl_get_menu);
554 554
555/*
556 * Returns NULL or an s64 type array containing the menu for given
557 * control ID. The total number of the menu items is returned in @len.
558 */
559const s64 const *v4l2_ctrl_get_int_menu(u32 id, u32 *len)
560{
561 switch (id) {
562 default:
563 *len = 0;
564 return NULL;
565 };
566}
567EXPORT_SYMBOL(v4l2_ctrl_get_int_menu);
568
555/* Return the control name. */ 569/* Return the control name. */
556const char *v4l2_ctrl_get_name(u32 id) 570const char *v4l2_ctrl_get_name(u32 id)
557{ 571{
@@ -1712,20 +1726,28 @@ struct v4l2_ctrl *v4l2_ctrl_new_std_menu(struct v4l2_ctrl_handler *hdl,
1712 const struct v4l2_ctrl_ops *ops, 1726 const struct v4l2_ctrl_ops *ops,
1713 u32 id, s32 max, s32 mask, s32 def) 1727 u32 id, s32 max, s32 mask, s32 def)
1714{ 1728{
1715 const char * const *qmenu = v4l2_ctrl_get_menu(id); 1729 const char * const *qmenu = NULL;
1730 const s64 *qmenu_int = NULL;
1716 const char *name; 1731 const char *name;
1717 enum v4l2_ctrl_type type; 1732 enum v4l2_ctrl_type type;
1733 unsigned int qmenu_int_len;
1718 s32 min; 1734 s32 min;
1719 s32 step; 1735 s32 step;
1720 u32 flags; 1736 u32 flags;
1721 1737
1722 v4l2_ctrl_fill(id, &name, &type, &min, &max, &step, &def, &flags); 1738 v4l2_ctrl_fill(id, &name, &type, &min, &max, &step, &def, &flags);
1723 if (type != V4L2_CTRL_TYPE_MENU) { 1739
1740 if (type == V4L2_CTRL_TYPE_MENU)
1741 qmenu = v4l2_ctrl_get_menu(id);
1742 else if (type == V4L2_CTRL_TYPE_INTEGER_MENU)
1743 qmenu_int = v4l2_ctrl_get_int_menu(id, &qmenu_int_len);
1744
1745 if ((!qmenu && !qmenu_int) || (qmenu_int && max > qmenu_int_len)) {
1724 handler_set_err(hdl, -EINVAL); 1746 handler_set_err(hdl, -EINVAL);
1725 return NULL; 1747 return NULL;
1726 } 1748 }
1727 return v4l2_ctrl_new(hdl, ops, id, name, type, 1749 return v4l2_ctrl_new(hdl, ops, id, name, type,
1728 0, max, mask, def, flags, qmenu, NULL, NULL); 1750 0, max, mask, def, flags, qmenu, qmenu_int, NULL);
1729} 1751}
1730EXPORT_SYMBOL(v4l2_ctrl_new_std_menu); 1752EXPORT_SYMBOL(v4l2_ctrl_new_std_menu);
1731 1753