Received: by 2002:ab2:7041:0:b0:1f4:bcc8:f211 with SMTP id x1csp110471lql; Fri, 12 Apr 2024 05:32:05 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCW4t92Bbk8g/EfswnP4My0L4gj7pOPzTPJ70MFU0qOZoaQn5fZLQ0OP9XrdopjbUbZ/g8Im+6R0Jflq8oiU+0LQlRfveaFxy/9HOcOqxA== X-Google-Smtp-Source: AGHT+IHHm05mDp9LPpyeNp7Pg2wKaTeJy7mfak3iUieWETUOZpzU2S+OcmtNur9xzZkMVa9K5Pfq X-Received: by 2002:a05:6e02:1985:b0:36a:23b8:de8c with SMTP id g5-20020a056e02198500b0036a23b8de8cmr2785703ilf.16.1712925125294; Fri, 12 Apr 2024 05:32:05 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712925125; cv=pass; d=google.com; s=arc-20160816; b=Sl5WjDScNy6si/tsiuRrhjk/YVM3AaFxLryQ4z/LiXyQOnLwQYfQ4a8SikuxkjbglV Jh2qnIGWH2vylgZDpWroWJtTcHao2sn3swdHXXjPsaqPGuU9P3Bf1SGbth07LuUGwX+7 v5yD1Uo0db0C0S8tuj+ZA3aW4ocW4OX0TunqXOdSgt5cKa622VrNr58TO/20X23V4fO4 Lr/AIL0EE/FJ1XdgxrTHoZltHPXVTYbsQlvp+kAdhzSsHMiyA3eJtsv21qNYfsu/6QgP y2qrFNP7/Z+VExuZ23wx2l4pP8E7EfoO2923gc3Eh3zDpvnVU6KyLmLsGlBYgRcKGGGs Yesg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=HLn6umXG+qEknY/d7/nYO3O3c5S/gWeLk0eB2yIQ0VM=; fh=ubgSGivyX1a6nEb6mxS2lPUzB/FQ53Lzp2BE7D6lOQ4=; b=H9TMWcN2G0bAmJVH/AOlnODZ+2XbZoLRrZ8Yk0YoPstV0t2KjQfYHQ3qtOIU2FTvgc vt55fWlhd2qKz+nf8x8aVGeY0cn9dRSL8Z5DE3RfTYS4ptZOK9mQ6zN7ftccAc/obgmM 1VQZCMQwW7rC8Pl0FLm36ED9JHxtKPmOHmqhhpmdLOeG3aE3PLIUfXCixmvY/E0B1CSU 5bbEHMxVIpa/zCG7YqpegtkWYYsXFXcpw0Z5H2kWjdYwVG0rHBx6u5vCqhCBkifEoJnd 3hzw9tb4DtKJvNpZsKXip5zFNI8jueJLI8K9WD1Di5DNHx31Dm3eH42d3pBPlDI2lktF dQfQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=npW1HRQB; arc=pass (i=1 spf=pass spfdomain=ideasonboard.com dkim=pass dkdomain=ideasonboard.com); spf=pass (google.com: domain of linux-kernel+bounces-142646-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-142646-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id z19-20020a63c053000000b005f3c84f05easi3104886pgi.133.2024.04.12.05.32.04 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Apr 2024 05:32:05 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-142646-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=npW1HRQB; arc=pass (i=1 spf=pass spfdomain=ideasonboard.com dkim=pass dkdomain=ideasonboard.com); spf=pass (google.com: domain of linux-kernel+bounces-142646-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-142646-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id F3CB1B22790 for ; Fri, 12 Apr 2024 12:29:44 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7075958138; Fri, 12 Apr 2024 12:28:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="npW1HRQB" Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 16B1057321; Fri, 12 Apr 2024 12:28:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.167.242.64 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712924936; cv=none; b=obxxr7NeNjuqP1o69KgDbYYCs8S9uhmnj4aeQbu29gO8d5RrtRuUi9dA0C1SPA6wqTAn5cMxapPsrzZwtChiXhrrTM/SiG6bMr5XPw4n1iMIzUV4TTzgeXJke4HusS4j89BpbBBQL2YpIOoiwsca5bxgNQGsLmektU02WJ/HAMw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712924936; c=relaxed/simple; bh=2h6WEboiVr0pnc/sy1Hd1sz7AyQj7EENcv/yL7xPOJE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=DE+1Mv9iUVqIPZ14Fbc3SKW8zfH4qSiEfWvEey8cQW2Rosusz10PpE5sBiQPLE7khlUFvQaIZHbb6CJhjoCmbQtrEVGMxkN9TieqcwSk5l8k3v/xn11m2PVEiJbx6Zx9e5JGJ80/+Mmnuom5PIMeNPxrbcDIo8zeSb6nlM3EnqY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ideasonboard.com; spf=pass smtp.mailfrom=ideasonboard.com; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b=npW1HRQB; arc=none smtp.client-ip=213.167.242.64 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ideasonboard.com Received: from umang.jain (unknown [103.251.226.65]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id DB943B0E; Fri, 12 Apr 2024 14:28:07 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1712924889; bh=2h6WEboiVr0pnc/sy1Hd1sz7AyQj7EENcv/yL7xPOJE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=npW1HRQBdFI5eN3dz0Xs4SRpU3lSIi7Tfv2nqM21ScLNnh2zGfN33raJf8sNrcfGC oZFgeVV7aCU9iWOD6S3HJcgkhB46TviUTuiiLHGZs5G7aREsbkGD++q+88aYlto2we yc3Vfcc37vLw6/p+tnMMF09uVOexPsdknTGqaKns= From: Umang Jain To: linux-media@vger.kernel.org Cc: Alexander Shiyan , Kieran Bingham , Sakari Ailus , open list , Umang Jain Subject: [PATCH v5 2/6] media: imx335: Parse fwnode properties Date: Fri, 12 Apr 2024 17:58:38 +0530 Message-ID: <20240412122842.193713-3-umang.jain@ideasonboard.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240412122842.193713-1-umang.jain@ideasonboard.com> References: <20240412122842.193713-1-umang.jain@ideasonboard.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: Kieran Bingham Call the V4L2 fwnode device parser to handle controls that are standardised by the framework. Signed-off-by: Kieran Bingham Signed-off-by: Umang Jain --- drivers/media/i2c/imx335.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/drivers/media/i2c/imx335.c b/drivers/media/i2c/imx335.c index c633ea1380e7..3ea9c0ebe278 100644 --- a/drivers/media/i2c/imx335.c +++ b/drivers/media/i2c/imx335.c @@ -1227,10 +1227,12 @@ static int imx335_init_controls(struct imx335 *imx335) { struct v4l2_ctrl_handler *ctrl_hdlr = &imx335->ctrl_handler; const struct imx335_mode *mode = imx335->cur_mode; + struct v4l2_fwnode_device_properties props; u32 lpfr; int ret; - ret = v4l2_ctrl_handler_init(ctrl_hdlr, 7); + /* v4l2_fwnode_device_properties can add two more controls */ + ret = v4l2_ctrl_handler_init(ctrl_hdlr, 9); if (ret) return ret; @@ -1295,9 +1297,15 @@ static int imx335_init_controls(struct imx335 *imx335) if (imx335->hblank_ctrl) imx335->hblank_ctrl->flags |= V4L2_CTRL_FLAG_READ_ONLY; - if (ctrl_hdlr->error) { - dev_err(imx335->dev, "control init failed: %d\n", - ctrl_hdlr->error); + ret = v4l2_fwnode_device_parse(imx335->dev, &props); + if (!ret) { + /* Failure sets ctrl_hdlr->error, which we check afterwards anyway */ + v4l2_ctrl_new_fwnode_properties(ctrl_hdlr, &imx335_ctrl_ops, + &props); + } + + if (ctrl_hdlr->error || ret) { + dev_err(imx335->dev, "control init failed: %d\n", ctrl_hdlr->error); v4l2_ctrl_handler_free(ctrl_hdlr); return ctrl_hdlr->error; } -- 2.43.0