Received: by 2002:ab2:1149:0:b0:1f3:1f8c:d0c6 with SMTP id z9csp2112436lqz; Tue, 2 Apr 2024 07:35:36 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWAb5zjjkSufbEjCIhQCNOg4PgaSLqDzjholUFiIWFGeJN9ETlzsOFG6uy/5pqB0QHUa1sEq3JJeTscyhzUXTgUrhVNIrksCgZ71HRR0A== X-Google-Smtp-Source: AGHT+IFck9cuKBhro3ARh6MHlt8D4QdtC9prdnkBJDGRyluGEr4tLESaWAJuMO+vTR9kD0+CAG5b X-Received: by 2002:a05:6358:12a8:b0:183:9dcc:5bfb with SMTP id e40-20020a05635812a800b001839dcc5bfbmr6173277rwi.26.1712068536424; Tue, 02 Apr 2024 07:35:36 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712068536; cv=pass; d=google.com; s=arc-20160816; b=xJQkyx7jqck6ukbbqX8icjMONOuxQ1zV8oiDIC2KztYIKsZD08yunhaRSRJP5kuz4M raB2ZuagNw4G2sdo6F7fTPmlooi3mgoXoIL4oExn0u6LmaggREu8IBbuEsK/P687iqCu DHjWZRQ5Off1/XKiIZU+j0VYJeERFemr5HdMRI/sSXWxZZxkmkJPGS1cTPR38UQ7xIbf Qh1wn8Wb022iRB3ojsCa6KFk9d6uQolASoS6MG7Fiz5HqP4F4jdT9Ou6EEjUDDgJZYt0 iPf1H41IG8FysSls573tcY6HfjtuHmstHsE0B/PF6P7OM+8JlJptr7gc3LygJYpRl8xM Li3A== 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=80G5A822Gz+cMNFoUTJH26Vff/C0lFPecfmQMIa+v1w=; fh=oMnFP44GZn5KSs5vtdAIvSX6p76oFoh48gPvpU1naKQ=; b=ETuB6GJSph8VVLAH9AtgcuBhnBRqwZDkwJcRkPhkXEPr05qOXsjQnDxGK8HCWpM8e5 UxYnPpux+ForVgvpv7VdoF/if0jJJLqaauncV8x9P1s5k6nZIflA8pO3TDAop9exL1Ss cpcj1xEWs7Jff3GFLA1q3LFUib/WxOCjnK/KIgkyoGlkuyZ7KBXe7A53zVEe2YSFupoq kYRPB45vzIJlU7Oj6XeJtQGfnponBw8xD8rAPKqLjR6o2yEiI3wir/hFs1lxOV2KiGJY A0hd9DwMHl2UuT6jcSzgRbeoiRSCZXGh65dBmpkTdQqS3JX/XKkGU6aMsIlBdwX5asmt c0cA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=U2BqdYqH; arc=pass (i=1 spf=pass spfdomain=ideasonboard.com dkim=pass dkdomain=ideasonboard.com); spf=pass (google.com: domain of linux-kernel+bounces-128110-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-128110-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 p17-20020a637411000000b005dc4eb22ed9si11572211pgc.166.2024.04.02.07.35.35 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Apr 2024 07:35:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-128110-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=U2BqdYqH; arc=pass (i=1 spf=pass spfdomain=ideasonboard.com dkim=pass dkdomain=ideasonboard.com); spf=pass (google.com: domain of linux-kernel+bounces-128110-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-128110-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 BE013B24473 for ; Tue, 2 Apr 2024 14:10:09 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C552E1292CF; Tue, 2 Apr 2024 14:09:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="U2BqdYqH" 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 EC1D286647; Tue, 2 Apr 2024 14:09:40 +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=1712066982; cv=none; b=anrf5Erf18AIFLTYcpXKZBwSSJ26od/UjPhRP+XmHjXnu6RWx+DMSbGQFE5WQMh2X39z46bQymMJK/72c8EeXgCKv6rUHEWjtrkU6rK50Ca6K31TTFbPAP3ZZTQcPDLLsf585roslJLd6aaacWbuuLwoiqZMqLS2dRt8YzPTBq4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712066982; c=relaxed/simple; bh=QiWGhNyPclP30U/OSfPGoQv0ru4Y4LDzmV4Byhyje2A=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=opqwCGEjcM1rSk11d+L4mlDR5B/lc8e5AdHOucnvcq6eqf4goCmXVKjcezzhxEn2wA/cnXFJN87PU8+v4wPO4Bp0skx2PAGFEe3cDi4T0pwR0jKrotpQxGHk1sa1APmxHh2ThYpyOMALVPouOyw+4/Uz7pb10+qtEj9xSwnOiX4= 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=U2BqdYqH; 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.86.18.232]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id D0E428E1; Tue, 2 Apr 2024 16:09:00 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1712066943; bh=QiWGhNyPclP30U/OSfPGoQv0ru4Y4LDzmV4Byhyje2A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=U2BqdYqHjuQfgz5dpug8jXQCAFddfWPj8SE5KqVr6fhALLvGMocDR9oUN9grl6PuS iBqSGCak+OVnXITfJEHqSQHQPZbLr0oGdibyBhk+vakcAce/x5Ek+4xyjyDLRWE6Et L2OzWngexZfXClmzFwYKM1nfxiOUTb3F2zF68+mU= From: Umang Jain To: linux-media@vger.kernel.org Cc: Alexander Shiyan , Kieran Bingham , Sakari Ailus , open list , Dave Stevenson , Umang Jain Subject: [PATCH v4 2/6] media: imx335: Parse fwnode properties Date: Tue, 2 Apr 2024 19:39:20 +0530 Message-ID: <20240402140924.10009-3-umang.jain@ideasonboard.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240402140924.10009-1-umang.jain@ideasonboard.com> References: <20240402140924.10009-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 | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/drivers/media/i2c/imx335.c b/drivers/media/i2c/imx335.c index c633ea1380e7..b8cf85984127 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; @@ -1296,15 +1298,27 @@ static int imx335_init_controls(struct imx335 *imx335) 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); - v4l2_ctrl_handler_free(ctrl_hdlr); - return ctrl_hdlr->error; + ret = ctrl_hdlr->error; + dev_err(imx335->dev, "control init failed: %d\n", ret); + goto free_ctrl_hdlr; } + ret = v4l2_fwnode_device_parse(imx335->dev, &props); + if (ret) + goto free_ctrl_hdlr; + + ret = v4l2_ctrl_new_fwnode_properties(ctrl_hdlr, &imx335_ctrl_ops, + &props); + if (ret) + goto free_ctrl_hdlr; + imx335->sd.ctrl_handler = ctrl_hdlr; return 0; + +free_ctrl_hdlr: + v4l2_ctrl_handler_free(ctrl_hdlr); + return ret; } /** -- 2.43.0