From patchwork Mon Dec 10 13:43:39 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrzej Hajda X-Patchwork-Id: 15834 Received: from mail.tu-berlin.de ([130.149.7.33]) by www.linuxtv.org with esmtp (Exim 4.72) (envelope-from ) id 1Ti3eL-0004uH-KK for patchwork@linuxtv.org; Mon, 10 Dec 2012 14:44:01 +0100 X-tubIT-Incoming-IP: 209.132.180.67 Received: from vger.kernel.org ([209.132.180.67]) by mail.tu-berlin.de (exim-4.75/mailfrontend-3) with esmtp for id 1Ti3eL-0003pX-DC; Mon, 10 Dec 2012 14:44:01 +0100 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751674Ab2LJNnz (ORCPT ); Mon, 10 Dec 2012 08:43:55 -0500 Received: from mailout3.w1.samsung.com ([210.118.77.13]:31574 "EHLO mailout3.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751046Ab2LJNnx (ORCPT ); Mon, 10 Dec 2012 08:43:53 -0500 Received: from eucpsbgm1.samsung.com (unknown [203.254.199.244]) by mailout3.w1.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0MET00B4GI832T80@mailout3.w1.samsung.com> for linux-media@vger.kernel.org; Mon, 10 Dec 2012 13:46:28 +0000 (GMT) X-AuditID: cbfec7f4-b7f6d6d000001620-c8-50c5e717a647 Received: from eusync1.samsung.com ( [203.254.199.211]) by eucpsbgm1.samsung.com (EUCPMTA) with SMTP id 30.C2.05664.717E5C05; Mon, 10 Dec 2012 13:43:51 +0000 (GMT) Received: from AMDC1061.digital.local ([106.116.147.88]) by eusync1.samsung.com (Oracle Communications Messaging Server 7u4-23.01 (7.0.4.23.0) 64bit (built Aug 10 2011)) with ESMTPA id <0MET00JXCI4V1O40@eusync1.samsung.com> for linux-media@vger.kernel.org; Mon, 10 Dec 2012 13:43:50 +0000 (GMT) From: Andrzej Hajda To: linux-media@vger.kernel.org, Kyungmin Park , Seung-Woo Kim , Sakari Ailus , Sylwester Nawrocki Cc: Andrzej Hajda Subject: [PATCH RFC 2/2] V4L: Add V4L2_CID_AUTO_FOCUS_AREA control Date: Mon, 10 Dec 2012 14:43:39 +0100 Message-id: <1355147019-25375-3-git-send-email-a.hajda@samsung.com> X-Mailer: git-send-email 1.7.10.4 In-reply-to: <1355147019-25375-1-git-send-email-a.hajda@samsung.com> References: <1355147019-25375-1-git-send-email-a.hajda@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrMJMWRmVeSWpSXmKPExsVy+t/xy7riz48GGLxdwmjRs2ErqwOjx+dN cgGMUVw2Kak5mWWpRfp2CVwZf9d/Zinot6lY+3EpUwPjFKMuRk4OCQETib1f9rBD2GISF+6t Z+ti5OIQEljKKPGuazmUs45J4kP7QhaQKjYBTYm/m2+CJUQEjjNK3Dv/Acjh4GAWUJc4eEwV pEZYwEni8cKZrCA2i4CqxIbVv5lAbF4BZ4kZn7uYILYpSnQ/m8AGYnMKuEhcPfmJFWSMEFDN pks+Exh5FzAyrGIUTS1NLihOSs811CtOzC0uzUvXS87P3cQI8fiXHYyLj1kdYhTgYFTi4Q1Q PBogxJpYVlyZe4hRgoNZSYRX7CRQiDclsbIqtSg/vqg0J7X4ECMTB6dUA2NO3s5ftxteeCYI GMR3ZqbtC1LO/H0vraK95FzVSz29zY4b6i/NUJ/5lstGPmbKagWX+MjsW8s+s9vP5mNU9989 /dbTj5zBr27xRWbc+M/bZnZ6/3ajrxnLWio9r3Ofn7nrpObLE4ZGbzfNuK+83ftg8LZTAlxM IjHzigXmnb5uufnhNP/kF95KLMUZiYZazEXFiQC4Pwrf1gEAAA== Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-PMX-Version: 5.6.1.2065439, Antispam-Engine: 2.7.2.376379, Antispam-Data: 2012.12.10.133316 X-PMX-Spam: Gauge=IIIIIIII, Probability=8%, Report=' HTML_NO_HTTP 0.1, MULTIPLE_RCPTS 0.1, URI_ENDS_IN_HTML 0, __ANY_URI 0, __CP_URI_IN_BODY 0, __HAS_FROM 0, __HAS_HTML 0, __HAS_MSGID 0, __HAS_X_MAILER 0, __HAS_X_MAILING_LIST 0, __MIME_TEXT_ONLY 0, __MULTIPLE_RCPTS_TO_X5 0, __SANE_MSGID 0, __SUBJ_ALPHA_END 0, __TO_MALFORMED_2 0, __TO_NO_NAME 0, __URI_NO_WWW 0, __URI_NS ' From: Sylwester Nawrocki Add control for automatic focus area selection. This control determines the area of the frame that the camera uses for automatic focus. Signed-off-by: Sylwester Nawrocki Signed-off-by: Andrzej Hajda Signed-off-by: Kyungmin Park --- Documentation/DocBook/media/v4l/compat.xml | 9 +++-- Documentation/DocBook/media/v4l/controls.xml | 47 +++++++++++++++++++++++++- Documentation/DocBook/media/v4l/v4l2.xml | 7 ++++ drivers/media/v4l2-core/v4l2-ctrls.c | 10 ++++++ include/uapi/linux/v4l2-controls.h | 6 ++++ 5 files changed, 76 insertions(+), 3 deletions(-) diff --git a/Documentation/DocBook/media/v4l/compat.xml b/Documentation/DocBook/media/v4l/compat.xml index 4fdf6b5..e8b53da 100644 --- a/Documentation/DocBook/media/v4l/compat.xml +++ b/Documentation/DocBook/media/v4l/compat.xml @@ -2452,8 +2452,9 @@ that used it. It was originally scheduled for removal in 2.6.35. V4L2_CID_3A_LOCK, V4L2_CID_AUTO_FOCUS_START, V4L2_CID_AUTO_FOCUS_STOP, - V4L2_CID_AUTO_FOCUS_STATUS and - V4L2_CID_AUTO_FOCUS_RANGE. + V4L2_CID_AUTO_FOCUS_STATUS, + V4L2_CID_AUTO_FOCUS_RANGE and + V4L2_CID_AUTO_FOCUS_AREA. @@ -2586,6 +2587,10 @@ ioctls. Vendor and device specific media bus pixel formats. . + + + V4L2_CID_AUTO_FOCUS_AREA control. + diff --git a/Documentation/DocBook/media/v4l/controls.xml b/Documentation/DocBook/media/v4l/controls.xml index 7fe5be1..9d4af8a 100644 --- a/Documentation/DocBook/media/v4l/controls.xml +++ b/Documentation/DocBook/media/v4l/controls.xml @@ -3347,6 +3347,51 @@ use its minimum possible distance for auto focus. + + + V4L2_CID_AUTO_FOCUS_AREA  + enum v4l2_auto_focus_area + + Determines the area of the frame that +the camera uses for automatic focus. The corresponding coordinates of the +focusing spot or rectangle can be specified and queried using the selection API. +To change the auto focus region of interest applications first select required +mode of this control and then set the rectangle or spot coordinates by means +of the &VIDIOC-SUBDEV-S-SELECTION; or &VIDIOC-S-SELECTION; ioctl. In order to +trigger again a one shot auto focus with same coordinates applications should +use the V4L2_CID_AUTO_FOCUS_START control. Or alternatively +invoke a &VIDIOC-SUBDEV-S-SELECTION; or a &VIDIOC-S-SELECTION; ioctl again. +In the latter case the new pixel coordinates are applied to hardware only when +the focus area control was set to +V4L2_AUTO_FOCUS_AREA_RECTANGLE. + + + + + + V4L2_AUTO_FOCUS_AREA_ALL  + Normal auto focus, the focusing area extends over the +entire frame. + + + V4L2_AUTO_FOCUS_AREA_RECTANGLE  + The auto focus region of interest is determined by the +V4L2_SEL_TGT_AUTO_FOCUS selection rectangle. + + + V4L2_AUTO_FOCUS_AREA_OBJECT_DETECTION  + The auto focus region of interest is determined +by an object (e.g. face) detection engine. + + + + + + This is an experimental +control and may change in the future. + + + V4L2_CID_ZOOM_ABSOLUTE  integer @@ -3986,7 +4031,7 @@ interface and may change in the future. Flash Control IDs - + diff --git a/Documentation/DocBook/media/v4l/v4l2.xml b/Documentation/DocBook/media/v4l/v4l2.xml index 10ccde9..1477540 100644 --- a/Documentation/DocBook/media/v4l/v4l2.xml +++ b/Documentation/DocBook/media/v4l/v4l2.xml @@ -140,6 +140,13 @@ structs, ioctls) must be noted in more detail in the history chapter applications. --> + 3.9 + 2012-12-10 + sn + Added V4L2_CID_AUTO_FOCUS_AREA control. + + + 3.6 2012-07-02 hv diff --git a/drivers/media/v4l2-core/v4l2-ctrls.c b/drivers/media/v4l2-core/v4l2-ctrls.c index f6ee201..9cdf4b8 100644 --- a/drivers/media/v4l2-core/v4l2-ctrls.c +++ b/drivers/media/v4l2-core/v4l2-ctrls.c @@ -236,6 +236,12 @@ const char * const *v4l2_ctrl_get_menu(u32 id) "Spot", NULL }; + static const char * const camera_auto_focus_area[] = { + "All", + "Rectangle", + "Object Detection", + NULL + }; static const char * const camera_auto_focus_range[] = { "Auto", "Normal", @@ -497,6 +503,8 @@ const char * const *v4l2_ctrl_get_menu(u32 id) return camera_exposure_auto; case V4L2_CID_EXPOSURE_METERING: return camera_exposure_metering; + case V4L2_CID_AUTO_FOCUS_AREA: + return camera_auto_focus_area; case V4L2_CID_AUTO_FOCUS_RANGE: return camera_auto_focus_range; case V4L2_CID_COLORFX: @@ -732,6 +740,7 @@ const char *v4l2_ctrl_get_name(u32 id) case V4L2_CID_AUTO_FOCUS_STOP: return "Auto Focus, Stop"; case V4L2_CID_AUTO_FOCUS_STATUS: return "Auto Focus, Status"; case V4L2_CID_AUTO_FOCUS_RANGE: return "Auto Focus, Range"; + case V4L2_CID_AUTO_FOCUS_AREA: return "Auto Focus, Area"; /* FM Radio Modulator control */ /* Keep the order of the 'case's the same as in videodev2.h! */ @@ -881,6 +890,7 @@ void v4l2_ctrl_fill(u32 id, const char **name, enum v4l2_ctrl_type *type, case V4L2_CID_MPEG_STREAM_TYPE: case V4L2_CID_MPEG_STREAM_VBI_FMT: case V4L2_CID_EXPOSURE_AUTO: + case V4L2_CID_AUTO_FOCUS_AREA: case V4L2_CID_AUTO_FOCUS_RANGE: case V4L2_CID_COLORFX: case V4L2_CID_AUTO_N_PRESET_WHITE_BALANCE: diff --git a/include/uapi/linux/v4l2-controls.h b/include/uapi/linux/v4l2-controls.h index f56c945..0eb1c1a 100644 --- a/include/uapi/linux/v4l2-controls.h +++ b/include/uapi/linux/v4l2-controls.h @@ -683,6 +683,12 @@ enum v4l2_auto_focus_range { V4L2_AUTO_FOCUS_RANGE_INFINITY = 3, }; +#define V4L2_CID_AUTO_FOCUS_AREA (V4L2_CID_CAMERA_CLASS_BASE+32) +enum v4l2_auto_focus_area { + V4L2_AUTO_FOCUS_AREA_ALL = 0, + V4L2_AUTO_FOCUS_AREA_RECTANGLE = 1, + V4L2_AUTO_FOCUS_AREA_OBJECT_DETECTION = 2, +}; /* FM Modulator class control IDs */