From patchwork Fri Jun 7 11:25:22 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrzej Hajda X-Patchwork-Id: 18809 Received: from mail.tu-berlin.de ([130.149.7.33]) by www.linuxtv.org with esmtp (Exim 4.72) (envelope-from ) id 1Ukuo6-0000bi-Ad; Fri, 07 Jun 2013 13:26:10 +0200 X-tubIT-Incoming-IP: 209.132.180.67 Received: from vger.kernel.org ([209.132.180.67]) by mail.tu-berlin.de (exim-4.72/mailfrontend-8) with esmtp id 1Ukuo4-0000Xx-jF; Fri, 07 Jun 2013 13:26:10 +0200 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755436Ab3FGL0F (ORCPT + 1 other); Fri, 7 Jun 2013 07:26:05 -0400 Received: from mailout3.w1.samsung.com ([210.118.77.13]:44352 "EHLO mailout3.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755159Ab3FGL0D (ORCPT ); Fri, 7 Jun 2013 07:26:03 -0400 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 <0MO000JGPT2W81A0@mailout3.w1.samsung.com> for linux-media@vger.kernel.org; Fri, 07 Jun 2013 12:26:01 +0100 (BST) X-AuditID: cbfec7f4-b7fd76d0000035e1-79-51b1c349c8c3 Received: from eusync3.samsung.com ( [203.254.199.213]) by eucpsbgm1.samsung.com (EUCPMTA) with SMTP id CD.AC.13793.943C1B15; Fri, 07 Jun 2013 12:26:01 +0100 (BST) Received: from AMDC1061.digital.local ([106.116.147.88]) by eusync3.samsung.com (Oracle Communications Messaging Server 7u4-23.01 (7.0.4.23.0) 64bit (built Aug 10 2011)) with ESMTPA id <0MO000CRNT2SW8B0@eusync3.samsung.com>; Fri, 07 Jun 2013 12:26:01 +0100 (BST) From: Andrzej Hajda To: linux-media@vger.kernel.org Cc: Andrzej Hajda , Kyungmin Park , Seung-Woo Kim , Sakari Ailus , Sylwester Nawrocki , HyungJun Choi Subject: [PATCH 2/2] V4L: Add V4L2_CID_AUTO_FOCUS_AREA control Date: Fri, 07 Jun 2013 13:25:22 +0200 Message-id: <1370604322-15476-3-git-send-email-a.hajda@samsung.com> X-Mailer: git-send-email 1.8.1.2 In-reply-to: <1370604322-15476-1-git-send-email-a.hajda@samsung.com> References: <1370604322-15476-1-git-send-email-a.hajda@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrDJMWRmVeSWpSXmKPExsVy+t/xq7qehzcGGhzYb2xxa905VovHG68x W5xtesNu0bNhK6vF4TftrBZn9q9ks5gx+SWbA7vH4a8LWTz6tqxi9Pi8SS6AOYrLJiU1J7Ms tUjfLoEr4/aPRvaCne4Vm19tZWxg7LTuYuTkkBAwkbjUep0VwhaTuHBvPVsXIxeHkMBSRonJ b88xQTh9TBJX5k4Eq2IT0JT4u/kmG4gtIiAv8aT3BpjNLPCbUeLsXDUQW1jATuL0ybdgcRYB VYntK68wgti8As4SBzfPZYbYpiDx8/IJsBpOAReJUw0fweJCQDWf5t5knMDIu4CRYRWjaGpp ckFxUnquoV5xYm5xaV66XnJ+7iZGSAh92cG4+JjVIUYBDkYlHt6fqzYECrEmlhVX5h5ilOBg VhLhbdy0MVCINyWxsiq1KD++qDQntfgQIxMHp1QDY2VN/BTbBXKmuj/cTe4WCVxoStA1Wq+s rJj4NZZfdn99w4xdJRXsd+/pRhU98Vx8Yr/JpJP6F8+9WWOxv+pjk63iNFaTmQaeggtLdgoc lTgounH3F/6comjj5359m2b8efnsieqyYLNeX/4ecYm8RfvqSlgWnHWVPM3V+Lryq4LIgy1y ygEPlFiKMxINtZiLihMB62UtBv8BAAA= Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-PMX-Version: 6.0.0.2142326, Antispam-Engine: 2.7.2.2107409, Antispam-Data: 2013.6.7.111522 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, __IN_REP_TO 0, __MIME_TEXT_ONLY 0, __MULTIPLE_RCPTS_CC_X2 0, __SANE_MSGID 0, __SUBJ_ALPHA_END 0, __TO_MALFORMED_2 0, __TO_NO_NAME 0, __URI_NO_WWW 0, __URI_NS ' 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 --- v2: - V4L2_CID_AUTO_FOCUS_START also applies AF changes in case of continuous AF, - AF range and AF area are applied only by (re-)starting AF, - V4L2_AUTO_FOCUS_AREA_ALL replaced with V4L2_AUTO_FOCUS_AREA_AUTO with modified description, - indendation fixes, - enums V4L2_AUTO_FOCUS_AREA_* replaced by macros --- Documentation/DocBook/media/v4l/compat.xml | 9 +++- Documentation/DocBook/media/v4l/controls.xml | 62 ++++++++++++++++++++++++---- Documentation/DocBook/media/v4l/v4l2.xml | 7 ++++ drivers/media/v4l2-core/v4l2-ctrls.c | 10 +++++ include/uapi/linux/v4l2-controls.h | 4 ++ 5 files changed, 83 insertions(+), 9 deletions(-) diff --git a/Documentation/DocBook/media/v4l/compat.xml b/Documentation/DocBook/media/v4l/compat.xml index f43542a..d041573 100644 --- a/Documentation/DocBook/media/v4l/compat.xml +++ b/Documentation/DocBook/media/v4l/compat.xml @@ -2455,8 +2455,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. @@ -2629,6 +2630,10 @@ ioctls. Exporting DMABUF files using &VIDIOC-EXPBUF; ioctl. + + + V4L2_CID_AUTO_FOCUS_AREA control. + diff --git a/Documentation/DocBook/media/v4l/controls.xml b/Documentation/DocBook/media/v4l/controls.xml index 8d7a779..384d323 100644 --- a/Documentation/DocBook/media/v4l/controls.xml +++ b/Documentation/DocBook/media/v4l/controls.xml @@ -3246,10 +3246,11 @@ is enabled is undefined, drivers should ignore such requests. V4L2_CID_AUTO_FOCUS_START  button - Starts single auto focus process. -The effect of setting this control when V4L2_CID_FOCUS_AUTO -is set to TRUE (1) is undefined, drivers should ignore -such requests. + Starts single autofocus process or + restarts continuous autofocus with current settings. In case + continuous autofocus is enabled the control is used to apply to the + hardware changes of other autofocus controls and related selection + rectangles. @@ -3308,8 +3309,13 @@ control value. V4L2_CID_AUTO_FOCUS_RANGE  enum v4l2_auto_focus_range - Determines auto focus distance range -for which lens may be adjusted. + Determines auto focus distance range for + which lens may be adjusted. + The change shall be applied to the hardware only by (re-)starting + autofocus process (V4L2_CID_AUTO_FOCUS_START) + or by starting continuous autofocus + (V4L2_CID_FOCUS_AUTO). + @@ -3337,6 +3343,48 @@ 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 using the selection + API - &VIDIOC-SUBDEV-S-SELECTION; or &VIDIOC-S-SELECTION; ioctl. + The change shall be applied to the hardware only by (re-)starting + autofocus process (V4L2_CID_AUTO_FOCUS_START) + or by starting continuous autofocus + (V4L2_CID_FOCUS_AUTO). + + + + + + + V4L2_AUTO_FOCUS_AREA_AUTO  + The camera automatically selects the focus area. + + + 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 @@ -3976,7 +4024,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 bfc93cd..02c454a 100644 --- a/Documentation/DocBook/media/v4l/v4l2.xml +++ b/Documentation/DocBook/media/v4l/v4l2.xml @@ -141,6 +141,13 @@ structs, ioctls) must be noted in more detail in the history chapter applications. --> + 3.11 + 2013-04-30 + sn, ah + Added V4L2_CID_AUTO_FOCUS_AREA control. + + + 3.10 2013-03-25 hv diff --git a/drivers/media/v4l2-core/v4l2-ctrls.c b/drivers/media/v4l2-core/v4l2-ctrls.c index ebb8e48..e2b3cd2 100644 --- a/drivers/media/v4l2-core/v4l2-ctrls.c +++ b/drivers/media/v4l2-core/v4l2-ctrls.c @@ -237,6 +237,12 @@ const char * const *v4l2_ctrl_get_menu(u32 id) "Matrix", NULL }; + static const char * const camera_auto_focus_area[] = { + "Auto", + "Rectangle", + "Object Detection", + NULL + }; static const char * const camera_auto_focus_range[] = { "Auto", "Normal", @@ -498,6 +504,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: @@ -734,6 +742,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! */ @@ -888,6 +897,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 69bd5bb..3581e91 100644 --- a/include/uapi/linux/v4l2-controls.h +++ b/include/uapi/linux/v4l2-controls.h @@ -700,6 +700,10 @@ enum v4l2_auto_focus_range { V4L2_AUTO_FOCUS_RANGE_INFINITY = 3, }; +#define V4L2_CID_AUTO_FOCUS_AREA (V4L2_CID_CAMERA_CLASS_BASE+32) +#define V4L2_AUTO_FOCUS_AREA_AUTO 0 +#define V4L2_AUTO_FOCUS_AREA_RECTANGLE 1 +#define V4L2_AUTO_FOCUS_AREA_OBJECT_DETECTION 2 /* FM Modulator class control IDs */