From patchwork Fri Aug 16 14:18:17 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 11097811 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 EF84C5700 for ; Fri, 16 Aug 2019 14:17:07 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DDCCB209CD for ; Fri, 16 Aug 2019 14:17:07 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D1B1B28991; Fri, 16 Aug 2019 14:17:07 +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 408A4209CD for ; Fri, 16 Aug 2019 14:17:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727371AbfHPORG (ORCPT ); Fri, 16 Aug 2019 10:17:06 -0400 Received: from relay9-d.mail.gandi.net ([217.70.183.199]:50745 "EHLO relay9-d.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727291AbfHPORF (ORCPT ); Fri, 16 Aug 2019 10:17:05 -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 AFFDCFF80B; Fri, 16 Aug 2019 14:17:01 +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: [PATCH 1/6] media: dt-bindings: Document 'location' property Date: Fri, 16 Aug 2019 16:18:17 +0200 Message-Id: <20190816141822.7582-2-jacopo@jmondi.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190816141822.7582-1-jacopo@jmondi.org> References: <20190816141822.7582-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 --- .../devicetree/bindings/media/video-interfaces.txt | 10 ++++++++++ 1 file changed, 10 insertions(+) -- 2.22.0 diff --git a/Documentation/devicetree/bindings/media/video-interfaces.txt b/Documentation/devicetree/bindings/media/video-interfaces.txt index f884ada0bffc..865f4142f432 100644 --- a/Documentation/devicetree/bindings/media/video-interfaces.txt +++ b/Documentation/devicetree/bindings/media/video-interfaces.txt @@ -89,6 +89,16 @@ Optional properties but a number of degrees counter clockwise. Typical values are 0 and 180 (upside down). +- location: The camera sensor mounting location, expressed as a position + relative to the usage orientation of the device the sensor is installed on. + Possible values are: + 0 - Front. The image sensor is mounted on the front facing side of the device. + For mobile devices such as smartphones, tablets and laptops the front side is + the user facing side of the device. + 1 - Back. The image sensor is mounted on the back side of the device, which is + defined as the opposite side of the front facing one. + 2 - External. The image sensor is connected to the device by extension cables, + and can be freely moved, regardless of the device position. Optional endpoint properties ---------------------------- From patchwork Fri Aug 16 14:18:18 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 11097813 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 E03A91399 for ; Fri, 16 Aug 2019 14:17:10 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CF188209CD for ; Fri, 16 Aug 2019 14:17:10 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C2DD528991; Fri, 16 Aug 2019 14:17:10 +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 6A60E209CD for ; Fri, 16 Aug 2019 14:17:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727435AbfHPORJ (ORCPT ); Fri, 16 Aug 2019 10:17:09 -0400 Received: from relay9-d.mail.gandi.net ([217.70.183.199]:50555 "EHLO relay9-d.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727412AbfHPORI (ORCPT ); Fri, 16 Aug 2019 10:17:08 -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 EA7BDFF807; Fri, 16 Aug 2019 14:17:03 +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: [PATCH 2/6] media: v4l2-ctrl: Document V4L2_CID_LOCATION Date: Fri, 16 Aug 2019 16:18:18 +0200 Message-Id: <20190816141822.7582-3-jacopo@jmondi.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190816141822.7582-1-jacopo@jmondi.org> References: <20190816141822.7582-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 | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/Documentation/media/uapi/v4l/ext-ctrls-camera.rst b/Documentation/media/uapi/v4l/ext-ctrls-camera.rst index 51c1d5c9eb00..ecf151f3f0f4 100644 --- a/Documentation/media/uapi/v4l/ext-ctrls-camera.rst +++ b/Documentation/media/uapi/v4l/ext-ctrls-camera.rst @@ -510,6 +510,40 @@ 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_CAMERA_SENSOR_LOCATION (integer)`` + This read-only control describes the camera sensor location by + reporting its mounting position on the device where the camera is + installed. The control value is constant and not modifiable by software + and its value is retrieved from the firmware interface by parsing the + 'location' property. 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 orientation. In example, a camera + sensor installed on the user-facing side of a phone, a tablet or a + laptop device is said to be installed in the ``V4L2_LOCATION_FRONT`` + location while camera sensors installed on the side opposed to the + front one are said to be installed in the ``V4L2_LOCATION_BACK`` + location. Camera sensors connected to the device by extension cables + which are freely movable regardless of the device orientation, such as + webcams and digital cameras, are said to be have + ``V4L2_LOCATION_EXTERNAL`` location. + + + +.. flat-table:: + :header-rows: 0 + :stub-columns: 0 + + * - ``V4L2_LOCATION_FRONT`` + - The camera sensor is located on the front side of the device. + * - ``V4L2_LOCATION_BACK`` + - The camera sensor is located on the back side of the device. + * - ``V4L2_LOCATION_EXTERNAL`` + - The camera sensor is connected by extension cables to the device and + it's freely movable. + + + .. [#f1] This control may be changed to a menu control in the future, if more options are required. From patchwork Fri Aug 16 14:18:19 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 11097819 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 351BF13A0 for ; Fri, 16 Aug 2019 14:17:26 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 23BEC209CD for ; Fri, 16 Aug 2019 14:17:26 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 17BD028992; Fri, 16 Aug 2019 14:17:26 +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 B825D209CD for ; Fri, 16 Aug 2019 14:17:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727459AbfHPORL (ORCPT ); Fri, 16 Aug 2019 10:17:11 -0400 Received: from relay9-d.mail.gandi.net ([217.70.183.199]:51807 "EHLO relay9-d.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727291AbfHPORK (ORCPT ); Fri, 16 Aug 2019 10:17:10 -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 CAF53FF813; Fri, 16 Aug 2019 14:17:06 +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: [PATCH 3/6] media: v4l2-ctrls: Add support for V4L2_CID_LOCATION Date: Fri, 16 Aug 2019 16:18:19 +0200 Message-Id: <20190816141822.7582-4-jacopo@jmondi.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190816141822.7582-1-jacopo@jmondi.org> References: <20190816141822.7582-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 | 2 ++ include/uapi/linux/v4l2-controls.h | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/drivers/media/v4l2-core/v4l2-ctrls.c b/drivers/media/v4l2-core/v4l2-ctrls.c index cd1ae016706f..02b60fe02409 100644 --- a/drivers/media/v4l2-core/v4l2-ctrls.c +++ b/drivers/media/v4l2-core/v4l2-ctrls.c @@ -978,6 +978,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_CAMERA_SENSOR_LOCATION: return "Camera Sensor Location"; /* FM Radio Modulator controls */ /* Keep the order of the 'case's the same as in v4l2-controls.h! */ @@ -1300,6 +1301,7 @@ void v4l2_ctrl_fill(u32 id, const char **name, enum v4l2_ctrl_type *type, break; case V4L2_CID_MIN_BUFFERS_FOR_CAPTURE: case V4L2_CID_MIN_BUFFERS_FOR_OUTPUT: + case V4L2_CID_CAMERA_SENSOR_LOCATION: *type = V4L2_CTRL_TYPE_INTEGER; *flags |= V4L2_CTRL_FLAG_READ_ONLY; break; diff --git a/include/uapi/linux/v4l2-controls.h b/include/uapi/linux/v4l2-controls.h index a2669b79b294..387c2c8553cb 100644 --- a/include/uapi/linux/v4l2-controls.h +++ b/include/uapi/linux/v4l2-controls.h @@ -912,6 +912,11 @@ 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_CAMERA_SENSOR_LOCATION (V4L2_CID_CAMERA_CLASS_BASE+34) +#define V4L2_LOCATION_FRONT 0 +#define V4L2_LOCATION_BACK 1 +#define V4L2_LOCATION_EXTERNAL 2 + /* FM Modulator class control IDs */ #define V4L2_CID_FM_TX_CLASS_BASE (V4L2_CTRL_CLASS_FM_TX | 0x900) From patchwork Fri Aug 16 14:18:20 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 11097821 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 94AB81399 for ; Fri, 16 Aug 2019 14:17:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 838F8209CD for ; Fri, 16 Aug 2019 14:17:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7805028991; Fri, 16 Aug 2019 14:17: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 0CC87209CD for ; Fri, 16 Aug 2019 14:17:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727526AbfHPORZ (ORCPT ); Fri, 16 Aug 2019 10:17:25 -0400 Received: from relay9-d.mail.gandi.net ([217.70.183.199]:45161 "EHLO relay9-d.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727446AbfHPORL (ORCPT ); Fri, 16 Aug 2019 10:17:11 -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 7B039FF80E; Fri, 16 Aug 2019 14:17:08 +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: [PATCH 4/6] media: v4l2-fwnode: Add helper to register controls from fw Date: Fri, 16 Aug 2019 16:18:20 +0200 Message-Id: <20190816141822.7582-5-jacopo@jmondi.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190816141822.7582-1-jacopo@jmondi.org> References: <20190816141822.7582-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 'v4l2_fwnode_register_controls()' helper to v4l2-fwnode. The function parses the device node and endpoint firmware properties to which a v4l2 control is associated to and register the control with the provided handler. Currently, only V4L2_CID_CAMERA_LOCATION is supported. Signed-off-by: Jacopo Mondi --- drivers/media/v4l2-core/v4l2-fwnode.c | 40 +++++++++++++++++++++++++++ include/media/v4l2-fwnode.h | 29 +++++++++++++++++++ 2 files changed, 69 insertions(+) diff --git a/drivers/media/v4l2-core/v4l2-fwnode.c b/drivers/media/v4l2-core/v4l2-fwnode.c index 3bd1888787eb..8ad7f70aa2f1 100644 --- a/drivers/media/v4l2-core/v4l2-fwnode.c +++ b/drivers/media/v4l2-core/v4l2-fwnode.c @@ -25,6 +25,7 @@ #include #include +#include #include #include @@ -595,6 +596,45 @@ void v4l2_fwnode_put_link(struct v4l2_fwnode_link *link) } EXPORT_SYMBOL_GPL(v4l2_fwnode_put_link); +int v4l2_fwnode_register_controls(struct fwnode_handle *fwnode, + struct v4l2_ctrl_handler *hdl, + const struct v4l2_ctrl_ops *ctrl_ops) +{ + u32 val; + int ret; + + ret = fwnode_property_read_u32(fwnode, "location", &val); + if (ret) + return 0; + + switch (val) { + case V4L2_LOCATION_FRONT: + case V4L2_LOCATION_BACK: + case V4L2_LOCATION_EXTERNAL: + break; + default: + pr_warn("Unsupported location: %u\n", val); + return -EINVAL; + } + + if (v4l2_ctrl_find(hdl, V4L2_CID_CAMERA_SENSOR_LOCATION)) + pr_debug("Skip control '%s': already registered", + v4l2_ctrl_get_name(V4L2_CID_CAMERA_SENSOR_LOCATION)); + else + v4l2_ctrl_new_std(hdl, ctrl_ops, + V4L2_CID_CAMERA_SENSOR_LOCATION, + val, val, 1, val); + + if (hdl->error) { + pr_warn("Failed to register controls from firmware: %d\n", + hdl->error); + return hdl->error; + } + + return 0; +} +EXPORT_SYMBOL_GPL(v4l2_fwnode_register_controls); + static int v4l2_async_notifier_fwnode_parse_endpoint(struct device *dev, struct v4l2_async_notifier *notifier, diff --git a/include/media/v4l2-fwnode.h b/include/media/v4l2-fwnode.h index f6a7bcd13197..942c4c21080b 100644 --- a/include/media/v4l2-fwnode.h +++ b/include/media/v4l2-fwnode.h @@ -25,6 +25,8 @@ struct fwnode_handle; struct v4l2_async_notifier; struct v4l2_async_subdev; +struct v4l2_ctrl_handler; +struct v4l2_ctrl_ops; #define V4L2_FWNODE_CSI2_MAX_DATA_LANES 4 @@ -233,6 +235,33 @@ int v4l2_fwnode_parse_link(struct fwnode_handle *fwnode, */ void v4l2_fwnode_put_link(struct v4l2_fwnode_link *link); +/** + * v4l2_fwnode_register_controls() - parse device and endpoint fwnode + * properties and register a v4l2 control + * for each of them + * @fwnode: pointer to the device fwnode handle + * @hdl: pointer to the v4l2 control handler to register controls with + * @ctrl_ops: pointer to the v4l2 control operations to register with the handler + * + * Parse the @fwnode device and endpoint properties to which a v4l2 control + * is associated and register them with the provided handler @hdl. + * Currently the following v4l2 controls are parsed and registered: + * - V4L2_CID_CAMERA_SENSOR_LOCATION; + * + * Controls already registered by the caller with the @hdl control handler + * are not overwritten by this function. Callers should register the controls + * they want to handle themeselves before calling this function. + * + * NOTE: This function locks the @hdl control handler mutex, the caller shall + * not hold the lock when calling this function. + * + * Return: 0 on success, -EINVAL if the fwnode properties are not well + * specified. + */ +int v4l2_fwnode_register_controls(struct fwnode_handle *fwnode, + struct v4l2_ctrl_handler *hdl, + const struct v4l2_ctrl_ops *ctrl_ops); + /** * typedef parse_endpoint_func - Driver's callback function to be called on * each V4L2 fwnode endpoint. From patchwork Fri Aug 16 14:18:21 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 11097815 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 2962F5700 for ; Fri, 16 Aug 2019 14:17:18 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1701A28991 for ; Fri, 16 Aug 2019 14:17:18 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0B4DB2899E; Fri, 16 Aug 2019 14:17:18 +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 A6CF728991 for ; Fri, 16 Aug 2019 14:17:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727485AbfHPORO (ORCPT ); Fri, 16 Aug 2019 10:17:14 -0400 Received: from relay9-d.mail.gandi.net ([217.70.183.199]:33867 "EHLO relay9-d.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727469AbfHPORN (ORCPT ); Fri, 16 Aug 2019 10:17:13 -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 3D290FF80F; Fri, 16 Aug 2019 14:17:10 +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: [PATCH 5/6] media: i2c: ov5670: Register controls from firmware Date: Fri, 16 Aug 2019 16:18:21 +0200 Message-Id: <20190816141822.7582-6-jacopo@jmondi.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190816141822.7582-1-jacopo@jmondi.org> References: <20190816141822.7582-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 Use the newly introduced helper to parse properties from firmware and registerer the associated v4l2 control. Signed-off-by: Jacopo Mondi --- drivers/media/i2c/ov5670.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/media/i2c/ov5670.c b/drivers/media/i2c/ov5670.c index 041fcbb4eebd..2bc57e85f721 100644 --- a/drivers/media/i2c/ov5670.c +++ b/drivers/media/i2c/ov5670.c @@ -7,6 +7,7 @@ #include #include #include +#include #define OV5670_REG_CHIP_ID 0x300a #define OV5670_CHIP_ID 0x005670 @@ -2059,6 +2060,7 @@ 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; @@ -2129,6 +2131,11 @@ static int ov5670_init_controls(struct ov5670 *ov5670) goto error; } + ret = v4l2_fwnode_register_controls(dev_fwnode(&client->dev), + ctrl_hdlr, &ov5670_ctrl_ops); + if (ret) + goto error; + ov5670->sd.ctrl_handler = ctrl_hdlr; return 0; From patchwork Fri Aug 16 14:18:22 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 11097817 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 32AF613A0 for ; Fri, 16 Aug 2019 14:17:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2140128991 for ; Fri, 16 Aug 2019 14:17:20 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 131C128995; Fri, 16 Aug 2019 14:17:20 +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 A603128991 for ; Fri, 16 Aug 2019 14:17:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727502AbfHPORT (ORCPT ); Fri, 16 Aug 2019 10:17:19 -0400 Received: from relay9-d.mail.gandi.net ([217.70.183.199]:42373 "EHLO relay9-d.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727291AbfHPORO (ORCPT ); Fri, 16 Aug 2019 10:17: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 DDAAAFF812; Fri, 16 Aug 2019 14:17:11 +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: [PATCH 6/6] media: i2c: ov13858: Register controls from firmware Date: Fri, 16 Aug 2019 16:18:22 +0200 Message-Id: <20190816141822.7582-7-jacopo@jmondi.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190816141822.7582-1-jacopo@jmondi.org> References: <20190816141822.7582-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 Use the newly introduced helper to parse properties from firmware and registerer the associated v4l2 control. Signed-off-by: Jacopo Mondi --- drivers/media/i2c/ov13858.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/media/i2c/ov13858.c b/drivers/media/i2c/ov13858.c index aac6f77afa0f..aa239cc5a921 100644 --- a/drivers/media/i2c/ov13858.c +++ b/drivers/media/i2c/ov13858.c @@ -7,6 +7,7 @@ #include #include #include +#include #define OV13858_REG_VALUE_08BIT 1 #define OV13858_REG_VALUE_16BIT 2 @@ -1666,6 +1667,13 @@ static int ov13858_init_controls(struct ov13858 *ov13858) goto error; } + ret = v4l2_fwnode_register_controls(dev_fwnode(&client->dev), + ctrl_hdlr, &ov13858_ctrl_ops); + if (ret) + goto error; + + + ov13858->sd.ctrl_handler = ctrl_hdlr; return 0;