From patchwork Tue Apr 7 16:38:24 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 3419 X-Patchwork-Delegate: jacopo@jmondi.org Return-Path: Received: from relay2-d.mail.gandi.net (relay2-d.mail.gandi.net [217.70.183.194]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 3FF0F62826 for ; Tue, 7 Apr 2020 18:35:49 +0200 (CEST) X-Originating-IP: 2.224.242.101 Received: from localhost.localdomain (2-224-242-101.ip172.fastwebnet.it [2.224.242.101]) (Authenticated sender: jacopo@jmondi.org) by relay2-d.mail.gandi.net (Postfix) with ESMTPSA id 9172940008; Tue, 7 Apr 2020 16:35:47 +0000 (UTC) From: Jacopo Mondi To: Mauro Carvalho Chehab , Hans Verkuil , Sakari Ailus , Laurent Pinchart , tfiga@google.com, pavel@ucw.cz Cc: Jacopo Mondi , linux-media@vger.kernel.org (open list:MEDIA INPUT INFRASTRUCTURE (V4L/DVB)), libcamera-devel@lists.libcamera.org Date: Tue, 7 Apr 2020 18:38:24 +0200 Message-Id: <20200407163825.1766483-11-jacopo@jmondi.org> X-Mailer: git-send-email 2.26.0 In-Reply-To: <20200407163825.1766483-1-jacopo@jmondi.org> References: <20200407163825.1766483-1-jacopo@jmondi.org> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v8 10/11] media: i2c: ov5670: Parse and register properties X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Apr 2020 16:35:49 -0000 Parse device properties and register controls for them using the newly introduced helpers. Signed-off-by: Jacopo Mondi --- drivers/media/i2c/ov5670.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/drivers/media/i2c/ov5670.c b/drivers/media/i2c/ov5670.c index 041fcbb4eebd..f118d44b0889 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,8 @@ 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_fwnode_device_properties props; struct v4l2_ctrl_handler *ctrl_hdlr; s64 vblank_max; s64 vblank_def; @@ -2129,6 +2132,15 @@ static int ov5670_init_controls(struct ov5670 *ov5670) goto error; } + ret = v4l2_fwnode_device_parse(&client->dev, &props); + if (ret) + return ret; + + ret = v4l2_ctrl_new_fwnode_properties(ctrl_hdlr, &ov5670_ctrl_ops, + &props); + if (ret) + return ret; + ov5670->sd.ctrl_handler = ctrl_hdlr; return 0;