Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp5046196iob; Mon, 9 May 2022 07:35:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwDngkAQc+wimdBi6CBrcQuucCqBUtbL6FOW05/j70dklk4nL+YilUQuONW+9hH/hIMxz0k X-Received: by 2002:a17:902:db12:b0:15e:acc0:ea84 with SMTP id m18-20020a170902db1200b0015eacc0ea84mr16401235plx.127.1652106906071; Mon, 09 May 2022 07:35:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652106906; cv=none; d=google.com; s=arc-20160816; b=O+04wMvX8ctk7bXBqiv+B1il0L0uS7urSLRl8tsEagzivk86rE5CS0bbMU79ney4Jd P4LwzsbIRkVzONCQbZ2CFY6qv1g/xT3Pqtgsrg3LFmXWcrbcfuhbdNJVBt9ylYfTIKOT DCPxq1uRIjeaKwXlLO1gHGN+jkT+wHeGVpQdqUbqABUf17zZiE7WSFp14c0XVXJRYo4W koqRbhNywa47p/EIUsmc9UHSws1FXNSaSG6mWv3HBkkxZb5FCwVaPNH1n+gi6FCawjn1 rqQar6n5cZ/xETQ1HTj2iE14deZM25Ejva/yTvlAeWFN8lUtZUUfczZej3giFyihKytl zNIw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:to:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:from; bh=2aWgpPsG5hrX8RwhTo0TRcnIvwOs7QhNGsSJUfkSotA=; b=ex3N1bPJoJf3NCzOWIPro2xFNT02zes+BF0BU8xC4u6gZtVkAJxVdWK/Jsij6Qpi9B vqGDRCyY5aJu7OjMM9YNrMbKpUzQjVZM87maUdtQTMD5NjpjExNzNk9DFpf995OJS70q HnlQH61Vrq95ugetM7B0ZYxYq7xvHyhBK5qJEjAI+YOSycE1AmvQEE738sBuy2T9wiUV i58SN1ib+V2cRY4o8SL6u+kZ0B3WMDLnir21HmNQ+kpx7kYAc0k1ME9i2HDaTXac9m9J QHXdZoUYVOqFP9HFKwG2eR3Musrz1QLTJFvHdfnowmpglAbmRRnVxEzzTAOge9UNIcVU RWqQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id l7-20020a170903120700b001586fbb2b6dsi14650079plh.566.2022.05.09.07.35.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 May 2022 07:35:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 4CAE52AA2CA; Mon, 9 May 2022 07:33:44 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237385AbiEIOgv (ORCPT + 99 others); Mon, 9 May 2022 10:36:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55578 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237325AbiEIOgo (ORCPT ); Mon, 9 May 2022 10:36:44 -0400 Received: from relay10.mail.gandi.net (relay10.mail.gandi.net [IPv6:2001:4b98:dc4:8::230]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9BBC41E3CB; Mon, 9 May 2022 07:32:49 -0700 (PDT) Received: (Authenticated sender: foss@0leil.net) by mail.gandi.net (Postfix) with ESMTPSA id 6D157240004; Mon, 9 May 2022 14:32:46 +0000 (UTC) From: Quentin Schulz Cc: shawnx.tu@intel.com, mchehab@kernel.org, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, linux-media@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, foss+kernel@0leil.net, Quentin Schulz Subject: [PATCH v3 3/4] media: i2c: ov5675: parse and register V4L2 device tree properties Date: Mon, 9 May 2022 16:32:25 +0200 Message-Id: <20220509143226.531117-3-foss+kernel@0leil.net> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20220509143226.531117-1-foss+kernel@0leil.net> References: <20220509143226.531117-1-foss+kernel@0leil.net> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net To: unlisted-recipients:; (no To-header on input) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Quentin Schulz Parse V4L2 device tree properties and register controls for them. Signed-off-by: Quentin Schulz --- drivers/media/i2c/ov5675.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/drivers/media/i2c/ov5675.c b/drivers/media/i2c/ov5675.c index cee380196774..5544e1ae444e 100644 --- a/drivers/media/i2c/ov5675.c +++ b/drivers/media/i2c/ov5675.c @@ -779,12 +779,14 @@ static const struct v4l2_ctrl_ops ov5675_ctrl_ops = { static int ov5675_init_controls(struct ov5675 *ov5675) { + struct i2c_client *client = v4l2_get_subdevdata(&ov5675->sd); struct v4l2_ctrl_handler *ctrl_hdlr; + struct v4l2_fwnode_device_properties props; s64 exposure_max, h_blank; int ret; ctrl_hdlr = &ov5675->ctrl_handler; - ret = v4l2_ctrl_handler_init(ctrl_hdlr, 8); + ret = v4l2_ctrl_handler_init(ctrl_hdlr, 10); if (ret) return ret; @@ -838,9 +840,23 @@ static int ov5675_init_controls(struct ov5675 *ov5675) if (ctrl_hdlr->error) return ctrl_hdlr->error; + ret = v4l2_fwnode_device_parse(&client->dev, &props); + if (ret) + goto error; + + ret = v4l2_ctrl_new_fwnode_properties(ctrl_hdlr, &ov5675_ctrl_ops, + &props); + if (ret) + goto error; + ov5675->sd.ctrl_handler = ctrl_hdlr; return 0; + +error: + v4l2_ctrl_handler_free(ctrl_hdlr); + + return ret; } static void ov5675_update_pad_format(const struct ov5675_mode *mode, -- 2.35.3