From patchwork Sat Jul 4 00:40:24 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 8599 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 7CC2FBFFE2 for ; Sat, 4 Jul 2020 00:40:44 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 4B23760DE2; Sat, 4 Jul 2020 02:40:44 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="vhKBleKD"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 253C460DC9 for ; Sat, 4 Jul 2020 02:40:40 +0200 (CEST) Received: from pendragon.bb.dnainternet.fi (81-175-216-236.bb.dnainternet.fi [81.175.216.236]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id A610129E; Sat, 4 Jul 2020 02:40:39 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1593823239; bh=A1KZolLjwP3OO3E1Njd3pbwnQzM87JrFs3FmDDmJM2M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vhKBleKDd9l1aS5rBzKCtGbKFq72p58RkjA7yZDDB3jrqlxGfCen5QVFmAR0805pK gNpFKQZ3dDGguOTEFIdhocWwPQdqneT1iaaFGwDKihBqkp1/26kTFCCrt2E20Iag4E rXNs+veMYgYqCpWQK7/RFlKhp4A5SkukWlI687MI= From: Laurent Pinchart To: Dave Stevenson Date: Sat, 4 Jul 2020 03:40:24 +0300 Message-Id: <20200704004028.21153-9-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200704004028.21153-1-laurent.pinchart@ideasonboard.com> References: <20200704004028.21153-1-laurent.pinchart@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 08/12] media: i2c: ov5647: 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: , Cc: libcamera-devel@lists.libcamera.org Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Parse device properties and register controls for them using the V4L2 fwnode properties helpers. Signed-off-by: Laurent Pinchart --- drivers/media/i2c/ov5647.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/drivers/media/i2c/ov5647.c b/drivers/media/i2c/ov5647.c index 6d84d2785f74..86a821a172b3 100644 --- a/drivers/media/i2c/ov5647.c +++ b/drivers/media/i2c/ov5647.c @@ -1501,6 +1501,7 @@ static int ov5647_probe(struct i2c_client *client) struct device_node *np = client->dev.of_node; u32 xclk_freq; int hblank, exposure_max, exposure_def; + struct v4l2_fwnode_device_properties props; sensor = devm_kzalloc(dev, sizeof(*sensor), GFP_KERNEL); if (!sensor) @@ -1534,7 +1535,7 @@ static int ov5647_probe(struct i2c_client *client) mutex_init(&sensor->lock); /* Initialise controls. */ - v4l2_ctrl_handler_init(&sensor->ctrls, 7); + v4l2_ctrl_handler_init(&sensor->ctrls, 9); v4l2_ctrl_new_std(&sensor->ctrls, &ov5647_ctrl_ops, V4L2_CID_AUTOGAIN, 0, /* min */ @@ -1598,6 +1599,16 @@ static int ov5647_probe(struct i2c_client *client) __func__, ret); goto error; } + + ret = v4l2_fwnode_device_parse(&client->dev, &props); + if (ret) + goto error; + + ret = v4l2_ctrl_new_fwnode_properties(&sensor->ctrls, &ov5647_ctrl_ops, + &props); + if (ret) + goto error; + sensor->sd.ctrl_handler = &sensor->ctrls; /* Write out the register set over I2C on stream-on. */