From patchwork Wed Aug 14 20:28:11 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 11094501 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id DDAC31395 for ; Wed, 14 Aug 2019 20:27:35 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CE15228833 for ; Wed, 14 Aug 2019 20:27:35 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C292628837; Wed, 14 Aug 2019 20:27:35 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 66E9128833 for ; Wed, 14 Aug 2019 20:27:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729438AbfHNU1O (ORCPT ); Wed, 14 Aug 2019 16:27:14 -0400 Received: from relay9-d.mail.gandi.net ([217.70.183.199]:42567 "EHLO relay9-d.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726490AbfHNU1O (ORCPT ); Wed, 14 Aug 2019 16:27:14 -0400 X-Originating-IP: 87.5.130.64 Received: from uno.homenet.telecomitalia.it (host64-130-dynamic.5-87-r.retail.telecomitalia.it [87.5.130.64]) (Authenticated sender: jacopo@jmondi.org) by relay9-d.mail.gandi.net (Postfix) with ESMTPSA id 09BD9FF803; Wed, 14 Aug 2019 20:27:10 +0000 (UTC) From: Jacopo Mondi To: Mauro Carvalho Chehab , Hans Verkuil , Sakari Ailus , Laurent Pinchart , Rob Herring Cc: Jacopo Mondi , linux-media@vger.kernel.org (open list:MEDIA INPUT INFRASTRUCTURE (V4L/DVB)), linux-kernel@vger.kernel.org (open list), devicetree@vger.kernel.org Subject: [RFC 1/5] media: dt-bindings: Document 'location' property Date: Wed, 14 Aug 2019 22:28:11 +0200 Message-Id: <20190814202815.32491-2-jacopo@jmondi.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190814202815.32491-1-jacopo@jmondi.org> References: <20190814202815.32491-1-jacopo@jmondi.org> MIME-Version: 1.0 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Add the 'location' device property, used to specify the camera device mounting position. The property is particularly meaningful for mobile devices with a well defined usage orientation. Signed-off-by: Jacopo Mondi --- Documentation/devicetree/bindings/media/video-interfaces.txt | 4 ++++ 1 file changed, 4 insertions(+) -- 2.22.0 diff --git a/Documentation/devicetree/bindings/media/video-interfaces.txt b/Documentation/devicetree/bindings/media/video-interfaces.txt index f884ada0bffc..819077b2649c 100644 --- a/Documentation/devicetree/bindings/media/video-interfaces.txt +++ b/Documentation/devicetree/bindings/media/video-interfaces.txt @@ -89,6 +89,10 @@ Optional properties but a number of degrees counter clockwise. Typical values are 0 and 180 (upside down). +- location: The camera device mounting position, relative to the device + usage orientation. Possible values are: + 0 - Front camera. The image sensor is mounted on the front side of the device. + 1 - Back camera. The image sensor is mounted on the back side of the device. Optional endpoint properties ---------------------------- From patchwork Wed Aug 14 20:28:12 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 11094499 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C2EEC1399 for ; Wed, 14 Aug 2019 20:27:33 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B2BC028833 for ; Wed, 14 Aug 2019 20:27:33 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A736128837; Wed, 14 Aug 2019 20:27:33 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4A24028833 for ; Wed, 14 Aug 2019 20:27:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729529AbfHNU1R (ORCPT ); Wed, 14 Aug 2019 16:27:17 -0400 Received: from relay9-d.mail.gandi.net ([217.70.183.199]:45043 "EHLO relay9-d.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726490AbfHNU1Q (ORCPT ); Wed, 14 Aug 2019 16:27:16 -0400 X-Originating-IP: 87.5.130.64 Received: from uno.homenet.telecomitalia.it (host64-130-dynamic.5-87-r.retail.telecomitalia.it [87.5.130.64]) (Authenticated sender: jacopo@jmondi.org) by relay9-d.mail.gandi.net (Postfix) with ESMTPSA id 4E018FF808; Wed, 14 Aug 2019 20:27:13 +0000 (UTC) From: Jacopo Mondi To: Mauro Carvalho Chehab , Hans Verkuil , Sakari Ailus , Laurent Pinchart Cc: Jacopo Mondi , linux-media@vger.kernel.org (open list:MEDIA INPUT INFRASTRUCTURE (V4L/DVB)), linux-kernel@vger.kernel.org (open list) Subject: [RFC 2/5] media: v4l2-ctrl: Document V4L2_CID_LOCATION Date: Wed, 14 Aug 2019 22:28:12 +0200 Message-Id: <20190814202815.32491-3-jacopo@jmondi.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190814202815.32491-1-jacopo@jmondi.org> References: <20190814202815.32491-1-jacopo@jmondi.org> MIME-Version: 1.0 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Add documentation for the V4L2_CID_LOCATION camera control. The newly added read-only control reports the camera device mounting position. Signed-off-by: Jacopo Mondi --- .../media/uapi/v4l/ext-ctrls-camera.rst | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) -- 2.22.0 diff --git a/Documentation/media/uapi/v4l/ext-ctrls-camera.rst b/Documentation/media/uapi/v4l/ext-ctrls-camera.rst index 51c1d5c9eb00..fc0a02eee6d4 100644 --- a/Documentation/media/uapi/v4l/ext-ctrls-camera.rst +++ b/Documentation/media/uapi/v4l/ext-ctrls-camera.rst @@ -510,6 +510,29 @@ enum v4l2_scene_mode - value down. A value of zero stops the motion if one is in progress and has no effect otherwise. +``V4L2_CID_LOCATION (integer)`` + This read-only control describes the camera location by reporting its + mounting position on the device where the camera is installed. This + control is particularly meaningful for devices which have a well defined + orientation, such as phones, laptops and portable devices as the camera + location is expressed as a position relative to the device intended + usage position. In example, a camera installed on the user-facing side + of a phone device is said to be installed in the ``V4L2_LOCATION_FRONT`` + position. + + + +.. flat-table:: + :header-rows: 0 + :stub-columns: 0 + + * - ``V4L2_LOCATION_FRONT`` + - The camera device is located on the front side of the device. + * - ``V4L2_LOCATION_BACK`` + - The camera device is located on the back side of the device. + + + .. [#f1] This control may be changed to a menu control in the future, if more options are required. From patchwork Wed Aug 14 20:28:13 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 11094497 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 7D1131399 for ; Wed, 14 Aug 2019 20:27:31 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6BA8D28833 for ; Wed, 14 Aug 2019 20:27:31 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5FFF128837; Wed, 14 Aug 2019 20:27:31 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 00DFB28833 for ; Wed, 14 Aug 2019 20:27:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729580AbfHNU1S (ORCPT ); Wed, 14 Aug 2019 16:27:18 -0400 Received: from relay9-d.mail.gandi.net ([217.70.183.199]:51427 "EHLO relay9-d.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729547AbfHNU1S (ORCPT ); Wed, 14 Aug 2019 16:27:18 -0400 X-Originating-IP: 87.5.130.64 Received: from uno.homenet.telecomitalia.it (host64-130-dynamic.5-87-r.retail.telecomitalia.it [87.5.130.64]) (Authenticated sender: jacopo@jmondi.org) by relay9-d.mail.gandi.net (Postfix) with ESMTPSA id 2636BFF804; Wed, 14 Aug 2019 20:27:14 +0000 (UTC) From: Jacopo Mondi To: Mauro Carvalho Chehab , Hans Verkuil , Sakari Ailus , Laurent Pinchart Cc: Jacopo Mondi , linux-media@vger.kernel.org (open list:MEDIA INPUT INFRASTRUCTURE (V4L/DVB)), linux-kernel@vger.kernel.org (open list) Subject: [RFC 3/5] media: v4l2-ctrls: Add support for V4L2_CID_LOCATION Date: Wed, 14 Aug 2019 22:28:13 +0200 Message-Id: <20190814202815.32491-4-jacopo@jmondi.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190814202815.32491-1-jacopo@jmondi.org> References: <20190814202815.32491-1-jacopo@jmondi.org> MIME-Version: 1.0 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Add support for the newly defined V4L2_CID_LOCATION read-only control used to report the camera device mounting position. Signed-off-by: Jacopo Mondi --- drivers/media/v4l2-core/v4l2-ctrls.c | 7 +++++++ include/uapi/linux/v4l2-controls.h | 4 ++++ 2 files changed, 11 insertions(+) diff --git a/drivers/media/v4l2-core/v4l2-ctrls.c b/drivers/media/v4l2-core/v4l2-ctrls.c index 7d3a33258748..8ab0857df59a 100644 --- a/drivers/media/v4l2-core/v4l2-ctrls.c +++ b/drivers/media/v4l2-core/v4l2-ctrls.c @@ -943,6 +943,7 @@ const char *v4l2_ctrl_get_name(u32 id) case V4L2_CID_AUTO_FOCUS_RANGE: return "Auto Focus, Range"; case V4L2_CID_PAN_SPEED: return "Pan, Speed"; case V4L2_CID_TILT_SPEED: return "Tilt, Speed"; + case V4L2_CID_LOCATION: return "Location"; /* FM Radio Modulator controls */ /* Keep the order of the 'case's the same as in v4l2-controls.h! */ @@ -1300,6 +1301,12 @@ void v4l2_ctrl_fill(u32 id, const char **name, enum v4l2_ctrl_type *type, break; case V4L2_CID_MPEG_VIDEO_FWHT_PARAMS: *type = V4L2_CTRL_TYPE_FWHT_PARAMS; + case V4L2_CID_LOCATION: + *type = V4L2_CTRL_TYPE_INTEGER; + *flags |= V4L2_CTRL_FLAG_READ_ONLY; + *min = V4L2_LOCATION_FRONT; + *max = V4L2_LOCATION_BACK; + *step = 1; break; default: *type = V4L2_CTRL_TYPE_INTEGER; diff --git a/include/uapi/linux/v4l2-controls.h b/include/uapi/linux/v4l2-controls.h index 37807f23231e..5c4c7b245921 100644 --- a/include/uapi/linux/v4l2-controls.h +++ b/include/uapi/linux/v4l2-controls.h @@ -889,6 +889,10 @@ enum v4l2_auto_focus_range { #define V4L2_CID_PAN_SPEED (V4L2_CID_CAMERA_CLASS_BASE+32) #define V4L2_CID_TILT_SPEED (V4L2_CID_CAMERA_CLASS_BASE+33) +#define V4L2_CID_LOCATION (V4L2_CID_CAMERA_CLASS_BASE+34) +#define V4L2_LOCATION_FRONT (0 << 0) +#define V4L2_LOCATION_BACK (1 << 0) + /* FM Modulator class control IDs */ #define V4L2_CID_FM_TX_CLASS_BASE (V4L2_CTRL_CLASS_FM_TX | 0x900) From patchwork Wed Aug 14 20:28:14 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 11094495 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 53CAD1395 for ; Wed, 14 Aug 2019 20:27:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 43DD428834 for ; Wed, 14 Aug 2019 20:27:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 383A22883B; Wed, 14 Aug 2019 20:27:29 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D5FD528834 for ; Wed, 14 Aug 2019 20:27:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729611AbfHNU1U (ORCPT ); Wed, 14 Aug 2019 16:27:20 -0400 Received: from relay9-d.mail.gandi.net ([217.70.183.199]:33645 "EHLO relay9-d.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729595AbfHNU1U (ORCPT ); Wed, 14 Aug 2019 16:27:20 -0400 X-Originating-IP: 87.5.130.64 Received: from uno.homenet.telecomitalia.it (host64-130-dynamic.5-87-r.retail.telecomitalia.it [87.5.130.64]) (Authenticated sender: jacopo@jmondi.org) by relay9-d.mail.gandi.net (Postfix) with ESMTPSA id 174B0FF803; Wed, 14 Aug 2019 20:27:16 +0000 (UTC) From: Jacopo Mondi To: Mauro Carvalho Chehab , Hans Verkuil , Sakari Ailus , Laurent Pinchart Cc: Jacopo Mondi , linux-media@vger.kernel.org (open list:MEDIA INPUT INFRASTRUCTURE (V4L/DVB)), linux-kernel@vger.kernel.org (open list) Subject: [RFC 4/5] media: i2c: ov5670: Report the camera location Date: Wed, 14 Aug 2019 22:28:14 +0200 Message-Id: <20190814202815.32491-5-jacopo@jmondi.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190814202815.32491-1-jacopo@jmondi.org> References: <20190814202815.32491-1-jacopo@jmondi.org> MIME-Version: 1.0 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The camera location is retrieved from the firmware interface parsing the "location" device property and reported through the read-only V4L2_CID_LOCATION control. Signed-off-by: Jacopo Mondi --- drivers/media/i2c/ov5670.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/drivers/media/i2c/ov5670.c b/drivers/media/i2c/ov5670.c index 041fcbb4eebd..1446aef1fc1e 100644 --- a/drivers/media/i2c/ov5670.c +++ b/drivers/media/i2c/ov5670.c @@ -2059,10 +2059,12 @@ static const struct v4l2_ctrl_ops ov5670_ctrl_ops = { /* Initialize control handlers */ static int ov5670_init_controls(struct ov5670 *ov5670) { + struct i2c_client *client = v4l2_get_subdevdata(&ov5670->sd); struct v4l2_ctrl_handler *ctrl_hdlr; s64 vblank_max; s64 vblank_def; s64 vblank_min; + u32 location; s64 exposure_max; int ret; @@ -2124,6 +2126,15 @@ static int ov5670_init_controls(struct ov5670 *ov5670) ARRAY_SIZE(ov5670_test_pattern_menu) - 1, 0, 0, ov5670_test_pattern_menu); + ret = device_property_read_u32(&client->dev, "location", &location); + if (!ret) { + v4l2_ctrl_new_std(ctrl_hdlr, &ov5670_ctrl_ops, + V4L2_CID_LOCATION, V4L2_LOCATION_FRONT, + V4L2_LOCATION_BACK, 1, + location == V4L2_LOCATION_FRONT ? + V4L2_LOCATION_FRONT : V4L2_LOCATION_BACK); + } + if (ctrl_hdlr->error) { ret = ctrl_hdlr->error; goto error; From patchwork Wed Aug 14 20:28:15 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 11094493 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 928FF1395 for ; Wed, 14 Aug 2019 20:27:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 82A3528837 for ; Wed, 14 Aug 2019 20:27:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7304528834; Wed, 14 Aug 2019 20:27:27 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2A1952883C for ; Wed, 14 Aug 2019 20:27:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729643AbfHNU1W (ORCPT ); Wed, 14 Aug 2019 16:27:22 -0400 Received: from relay9-d.mail.gandi.net ([217.70.183.199]:35937 "EHLO relay9-d.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729625AbfHNU1V (ORCPT ); Wed, 14 Aug 2019 16:27:21 -0400 X-Originating-IP: 87.5.130.64 Received: from uno.homenet.telecomitalia.it (host64-130-dynamic.5-87-r.retail.telecomitalia.it [87.5.130.64]) (Authenticated sender: jacopo@jmondi.org) by relay9-d.mail.gandi.net (Postfix) with ESMTPSA id D59F3FF807; Wed, 14 Aug 2019 20:27:18 +0000 (UTC) From: Jacopo Mondi To: Mauro Carvalho Chehab , Hans Verkuil , Sakari Ailus , Laurent Pinchart Cc: Jacopo Mondi , linux-media@vger.kernel.org (open list:MEDIA INPUT INFRASTRUCTURE (V4L/DVB)), linux-kernel@vger.kernel.org (open list) Subject: [RFC 5/5] media: i2c: ov13858: Report the camera location Date: Wed, 14 Aug 2019 22:28:15 +0200 Message-Id: <20190814202815.32491-6-jacopo@jmondi.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190814202815.32491-1-jacopo@jmondi.org> References: <20190814202815.32491-1-jacopo@jmondi.org> MIME-Version: 1.0 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The camera location is retrieved from the firmware interface parsing the "location" device property and reported through the read-only V4L2_CID_LOCATION control. Signed-off-by: Jacopo Mondi --- drivers/media/i2c/ov13858.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/drivers/media/i2c/ov13858.c b/drivers/media/i2c/ov13858.c index 45bb872db3c5..6baefc3083e1 100644 --- a/drivers/media/i2c/ov13858.c +++ b/drivers/media/i2c/ov13858.c @@ -1591,6 +1591,7 @@ static int ov13858_init_controls(struct ov13858 *ov13858) struct i2c_client *client = v4l2_get_subdevdata(&ov13858->sd); struct v4l2_ctrl_handler *ctrl_hdlr; s64 exposure_max; + u32 location; s64 vblank_def; s64 vblank_min; s64 hblank; @@ -1659,6 +1660,16 @@ static int ov13858_init_controls(struct ov13858 *ov13858) V4L2_CID_TEST_PATTERN, ARRAY_SIZE(ov13858_test_pattern_menu) - 1, 0, 0, ov13858_test_pattern_menu); + + ret = device_property_read_u32(&client->dev, "location", &location); + if (!ret) { + v4l2_ctrl_new_std(ctrl_hdlr, &ov13858_ctrl_ops, + V4L2_CID_LOCATION, V4L2_LOCATION_FRONT, + V4L2_LOCATION_BACK, 1, + location == V4L2_LOCATION_FRONT ? + V4L2_LOCATION_FRONT : V4L2_LOCATION_BACK); + } + if (ctrl_hdlr->error) { ret = ctrl_hdlr->error; dev_err(&client->dev, "%s control init failed (%d)\n",