Received: by 2002:ab2:6857:0:b0:1ef:ffd0:ce49 with SMTP id l23csp374779lqp; Thu, 21 Mar 2024 04:13:44 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCV3ipNUKRmEkgdJ7yUWC+eKsqg+4OBxwDmqnf78gBTZWsFVOBbI7+94ixXG/iQnOsUyVkDJSVjJnSSie99D9IBC5k01gkQNsC9KcFEj0Q== X-Google-Smtp-Source: AGHT+IFykRPO2++HthhvaVQAEVaSkFOi6lxtCLT9JmTNy2nlC4Qm2hSMqur7/aZPYMzXH97E7VdB X-Received: by 2002:a05:6a00:4fd2:b0:6e6:b4e5:d878 with SMTP id le18-20020a056a004fd200b006e6b4e5d878mr10276272pfb.1.1711019624107; Thu, 21 Mar 2024 04:13:44 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711019624; cv=pass; d=google.com; s=arc-20160816; b=o87rlc+8FF7omhIBVmO9meudze/bReTb8emU/wgnDff0aB+QsrJaqJYw0GgOtLBY0s RX6leXu2jX31VzFduJDzOmumoulbNHKmQ3n/XCjzX9cGmatt07MIujq0zl8+EddOsAxe wDLJv3GO+BK7KsTGiAiHF9UuQjLXZSf/6GrmDB9ZsDoUWBLk2abB3u1m1wH6khZdeMfa yMd5A82yYzATAlHHkJ28i6G8yVlnE02eL57b79ZjihBHHlvspYb4hUwgl2R96VdiCVwX A8NkvZ/mGbjUcPXw42SrEHW+tFWAMEqZu3FhIwXdmmB55LWuI2atsHwTnEmjtnED4QYd EVhw== 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=VB0zLWcJHcVCx9ooleiQvfkeE/C63ypkfsdq7dQrK5s=; b=WmE0bMbMo5cD7hPGA3XXGUJXcPsSkbR0EOtlH+VUn9aasB/4gS1/CTmbM5CxHzFS3b qb76jlAWKW/jkjGhdU/LVQl08z7HkBHXveS+lDfLy43oadnUwv4yr1T+RgjpFxyYAwKA loR+W8DfoZ7Yo9c+EnO4XXa1HPPVS/PwNTEBLWVy5w47zJJnVImrZEF/dKHVh0s3kXJq WQU8Qemciu5IUrsSvLmQXp30hGW6tlvXLlyzQEvXoojyMW25pMAsLqOYA88HgDyX34Gr ONCN+2tv92A1N8KvK1+imqO/k83Z+p3DYI1puTJXPJWehs86e4PLkmDiOM/x8q5g7vM/ 99sg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=skWcKhL5; arc=pass (i=1 spf=pass spfdomain=ideasonboard.com dkim=pass dkdomain=ideasonboard.com); spf=pass (google.com: domain of linux-kernel+bounces-109926-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-109926-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id g6-20020a056a0023c600b006e782a300d8si3615648pfc.304.2024.03.21.04.13.43 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Mar 2024 04:13:44 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-109926-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=skWcKhL5; arc=pass (i=1 spf=pass spfdomain=ideasonboard.com dkim=pass dkdomain=ideasonboard.com); spf=pass (google.com: domain of linux-kernel+bounces-109926-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-109926-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 32AA22825F4 for ; Thu, 21 Mar 2024 11:13:37 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 78B5458ADD; Thu, 21 Mar 2024 11:13:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="skWcKhL5" 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 2CF1158AD6; Thu, 21 Mar 2024 11:13:02 +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=1711019584; cv=none; b=FWEwBAc/bDtBPMFC4iL1yy4EfDbpMpy9SgUIckC6A7SHe3kuZTkx1ZOKeeIugIoJx8HoDjgp7FUfAUi/mnTwPGkQtk6JC681FxLeJXxHPv6BQWfxzhfw6cJDYjCY0Y1NGpKdOxpqCG7nDytsY6vw8fst+v2T8mxwdnNj8oVgBRU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711019584; c=relaxed/simple; bh=QiWGhNyPclP30U/OSfPGoQv0ru4Y4LDzmV4Byhyje2A=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=sTWowwU+3dZIbewT/VsfudLFkYYKGtNjeIb3VFCMhk7cdM6IFw+S00+tPG589oC4/AiI3Wi0aa84aBHi+PMsBYaNiaqLjD5TIBK1Wlg8f7D6XSjKT+tDY75u7nVB90AYQmd3Puh4MACc5CFrtNhzr9niemr6boX4Pbd8Pbt98mQ= 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=skWcKhL5; 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.138]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 970B2CC8; Thu, 21 Mar 2024 12:12:30 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1711019553; bh=QiWGhNyPclP30U/OSfPGoQv0ru4Y4LDzmV4Byhyje2A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=skWcKhL5FTO72n4hV63ONM76CjUEByftfx7+VOHrXZUuI5FtIfIdSTbYoxcHCh3qs iN5jNge8jQFT42HrKZ2JREiYDVNNH2RniTrrjUfNjqTIp3uMny/2e8W84KJyIeosm9 wcX6tQqkAH/jXiQdctBiJBHsE+UU1BQTfCPGN1Bo= From: Umang Jain To: linux-media@vger.kernel.org Cc: Alexander Shiyan , Sakari Ailus , Kieran Bingham , open list , Umang Jain Subject: [PATCH v3 2/6] media: imx335: Parse fwnode properties Date: Thu, 21 Mar 2024 16:42:35 +0530 Message-ID: <20240321111239.808735-3-umang.jain@ideasonboard.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240321111239.808735-1-umang.jain@ideasonboard.com> References: <20240321111239.808735-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