From patchwork Mon Mar 29 09:53:06 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kamil Debski X-Patchwork-Id: 88936 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o2TA3LhC006908 for ; Mon, 29 Mar 2010 10:03:21 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754131Ab0C2KDT (ORCPT ); Mon, 29 Mar 2010 06:03:19 -0400 Received: from mailout3.w1.samsung.com ([210.118.77.13]:8566 "EHLO mailout3.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751658Ab0C2KDS (ORCPT ); Mon, 29 Mar 2010 06:03:18 -0400 X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Mon, 29 Mar 2010 10:03:21 +0000 (UTC) X-Greylist: delayed 601 seconds by postgrey-1.27 at vger.kernel.org; Mon, 29 Mar 2010 06:03:17 EDT MIME-version: 1.0 Content-transfer-encoding: 7BIT Content-type: TEXT/PLAIN Received: from eu_spt1 ([210.118.77.13]) by mailout3.w1.samsung.com (Sun Java(tm) System Messaging Server 6.3-8.04 (built Jul 29 2009; 32bit)) with ESMTP id <0L0100DG9FGP1W00@mailout3.w1.samsung.com> for linux-media@vger.kernel.org; Mon, 29 Mar 2010 10:53:14 +0100 (BST) Received: from linux.samsung.com ([106.116.38.10]) by spt1.w1.samsung.com (iPlanet Messaging Server 5.2 Patch 2 (built Jul 14 2004)) with ESMTPA id <0L0100LOQFGPQ8@spt1.w1.samsung.com> for linux-media@vger.kernel.org; Mon, 29 Mar 2010 10:53:13 +0100 (BST) Received: from localhost.localdomain (unknown [106.116.37.23]) by linux.samsung.com (Postfix) with ESMTP id 175F527004B; Mon, 29 Mar 2010 11:18:02 +0200 (CEST) Date: Mon, 29 Mar 2010 11:53:06 +0200 From: Kamil Debski Subject: [PATCH/RFC 1/1] v4l: Add support for binary controls In-reply-to: <1269856386-29557-1-git-send-email-k.debski@samsung.com> To: linux-media@vger.kernel.org Cc: p.osciak@samsung.com, k.debski@samsung.com, kyungmin.park@samsung.com Message-id: <1269856386-29557-2-git-send-email-k.debski@samsung.com> X-Mailer: git-send-email 1.7.0 References: <1269856386-29557-1-git-send-email-k.debski@samsung.com> Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org diff --git a/Documentation/DocBook/v4l/compat.xml b/Documentation/DocBook/v4l/compat.xml index b9dbdf9..83b8b64 100644 --- a/Documentation/DocBook/v4l/compat.xml +++ b/Documentation/DocBook/v4l/compat.xml @@ -2333,6 +2333,15 @@ more information. +
+ V4L2 in Linux 2.6.35 + + + Added support for binary data controls via new type V4L2_CTRL_TYPE_BINARY. + + +
+
Relation of V4L2 to other Linux multimedia APIs diff --git a/Documentation/DocBook/v4l/videodev2.h.xml b/Documentation/DocBook/v4l/videodev2.h.xml index 0683259..c552134 100644 --- a/Documentation/DocBook/v4l/videodev2.h.xml +++ b/Documentation/DocBook/v4l/videodev2.h.xml @@ -169,6 +169,7 @@ enum v4l2_ctrl_type { V4L2_CTRL_TYPE_INTEGER64 = 5, V4L2_CTRL_TYPE_CTRL_CLASS = 6, V4L2_CTRL_TYPE_STRING = 7, + V4L2_CTRL_TYPE_BINARY = 8, }; enum v4l2_tuner_type { @@ -913,6 +914,7 @@ struct v4l2_ext_control { __s32 value; __s64 value64; char *string; + unsigned char *blob; }; } __attribute__ ((packed)); diff --git a/Documentation/DocBook/v4l/vidioc-g-ext-ctrls.xml b/Documentation/DocBook/v4l/vidioc-g-ext-ctrls.xml index 3aa7f8f..ab4f1c9 100644 --- a/Documentation/DocBook/v4l/vidioc-g-ext-ctrls.xml +++ b/Documentation/DocBook/v4l/vidioc-g-ext-ctrls.xml @@ -170,6 +170,12 @@ applications must set the array to zero. string A pointer to a string. + + + unsigned char * + blob + A pointer to a blob. + diff --git a/Documentation/DocBook/v4l/vidioc-queryctrl.xml b/Documentation/DocBook/v4l/vidioc-queryctrl.xml index 4876ff1..d1cd5ee 100644 --- a/Documentation/DocBook/v4l/vidioc-queryctrl.xml +++ b/Documentation/DocBook/v4l/vidioc-queryctrl.xml @@ -142,9 +142,10 @@ bound for V4L2_CTRL_TYPE_INTEGER controls and the lowest valid index (always 0) for V4L2_CTRL_TYPE_MENU controls. For V4L2_CTRL_TYPE_STRING controls the minimum value gives the minimum length of the string. This length does not include the terminating -zero. It may not be valid for any other type of control, including -V4L2_CTRL_TYPE_INTEGER64 controls. Note that this is a -signed value. +zero. For V4L2_CTRL_TYPE_BINARY controls this value +gives the minimum length of the binary data. It may not be valid for any other type of + control, including V4L2_CTRL_TYPE_INTEGER64 controls. Note that + this is a signed value. __s32 @@ -155,7 +156,8 @@ highest valid index for V4L2_CTRL_TYPE_MENU controls. For V4L2_CTRL_TYPE_STRING controls the maximum value gives the maximum length of the string. This length does not include the terminating -zero. It may not be valid for any other type of control, including +zero. For V4L2_CTRL_TYPE_BINARY controls this value +gives the maximum length of the binary data. It may not be valid for any other type of control, including V4L2_CTRL_TYPE_INTEGER64 controls. Note that this is a signed value. @@ -166,8 +168,8 @@ signed value. V4L2_CTRL_TYPE_INTEGER controls. For V4L2_CTRL_TYPE_STRING controls this field refers to the string length that has to be a multiple of this step size. -It may not be valid for any other type of control, including -V4L2_CTRL_TYPE_INTEGER64 +For V4L2_CTRL_TYPE_BINARY controls the size of the binary data has to be a multiple of this step size. It may not be valid for any other type of +control, including V4L2_CTRL_TYPE_INTEGER64 controls.Generally drivers should not scale hardware control values. It may be necessary for example when the name or id imply @@ -319,6 +321,15 @@ Which character encoding is used will depend on the string control itself and should be part of the control documentation. + V4L2_CTRL_TYPE_BINARY + ≥ 0 + ≥ 1 + ≥ 0 + The minimum and maximum of the binary data length. The step size +means that the length must be (minimum + N * step) characters long for +N ≥ 0. + + V4L2_CTRL_TYPE_CTRL_CLASS n/a n/a diff --git a/drivers/media/video/v4l2-common.c b/drivers/media/video/v4l2-common.c index 36b5cb8..cbd770e 100644 --- a/drivers/media/video/v4l2-common.c +++ b/drivers/media/video/v4l2-common.c @@ -158,6 +158,8 @@ int v4l2_ctrl_check(struct v4l2_ext_control *ctrl, struct v4l2_queryctrl *qctrl, return -EBUSY; if (qctrl->type == V4L2_CTRL_TYPE_STRING) return 0; + if (qctrl->type == V4L2_CTRL_TYPE_BINARY) + return 0; if (qctrl->type == V4L2_CTRL_TYPE_BUTTON || qctrl->type == V4L2_CTRL_TYPE_INTEGER64 || qctrl->type == V4L2_CTRL_TYPE_CTRL_CLASS) diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h index 3793d16..5a62c9a 100644 --- a/include/linux/videodev2.h +++ b/include/linux/videodev2.h @@ -168,6 +168,7 @@ enum v4l2_ctrl_type { V4L2_CTRL_TYPE_INTEGER64 = 5, V4L2_CTRL_TYPE_CTRL_CLASS = 6, V4L2_CTRL_TYPE_STRING = 7, + V4L2_CTRL_TYPE_BINARY = 8, }; enum v4l2_tuner_type { @@ -918,6 +919,7 @@ struct v4l2_ext_control { __s32 value; __s64 value64; char *string; + unsigned char *blob; }; } __attribute__ ((packed));