From patchwork Fri Jun 16 13:59:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomi Valkeinen X-Patchwork-Id: 109156 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp1368033vqr; Fri, 16 Jun 2023 07:05:53 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4qDXy6svx3D3u/aU7qEDePB9HO7/9C+23XQRxy35t+mOGOXIHW6POXec4GalOT9LXMhdiX X-Received: by 2002:a17:902:aa02:b0:1b1:a2c3:29c0 with SMTP id be2-20020a170902aa0200b001b1a2c329c0mr1642493plb.24.1686924353211; Fri, 16 Jun 2023 07:05:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686924353; cv=none; d=google.com; s=arc-20160816; b=KKOSVwXEIAWaDY9b/nGPYxz3ez5zum0Y2TFY3wRgnRDS2vHfv8zFOvHlxExiaCyD9B MBRRdO/9xbhaoWADYhU1mvvogpmHu383e1lPOrsr5NycWpxHTdOzVrPyOxPk5rtzcPZ3 IxPPsL15Bk5ngZ2KLhnOPXN+8B10JYLSm4RQ63HaXcDEUQzuMK1sc5i5ldtuIOxCblud zXoCIK0YJSpGpjrCVbqA9D27YV5g3F8Z2uvX+7/n0hxxJXprNcWSI8EqhPm4PINBEYZT pxFTXkg5m9W1ZRC8ZmJQrumcvzmfS4BsBIOqGUrUw80m+s1BxQvYSKaD+PahMl6E1plp 98qw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=NL2QyWJ7DNVyxx2pD6LbnPmsclCaZKHQPxkDgY8MXWY=; b=TWkyfosDsIFjlUGmae2M4ul+Pwx7g62Aa9gGOCVJfjbtlb41FintxbpFyxi6Xg9KpZ 1sLHgs+hp5SBRc2KHRIjvyJzj3faEAlL+TfWjXpsI7sjPIlnUaAjj5J1bKEmEdqI0gRZ PXjPf9PCT8f+i4oK1l8YlICfaVPxNLx1jdZQuhsxb2xGg65wFvzQBp7tkBaY2fxwNsPt CcwAyAOlkt6oEM6RlBVS1UFRoWLNak8j4cYnzPUtG1lnL8fV5QrtFlpG3KGyUFYvoPjB dyT8wkTPFTI4cHJxgejTPVUjOxYq7TrCaxk7AqKxI+20W2p/Bzz3zbbnQoEi/gn/Mdi5 qgEA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=iskhj8Zg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y7-20020a17090322c700b001b53ac59347si350100plg.417.2023.06.16.07.05.39; Fri, 16 Jun 2023 07:05:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=iskhj8Zg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344902AbjFPOCG (ORCPT + 99 others); Fri, 16 Jun 2023 10:02:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52228 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345427AbjFPOB2 (ORCPT ); Fri, 16 Jun 2023 10:01:28 -0400 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DC5AA4217; Fri, 16 Jun 2023 07:00:58 -0700 (PDT) Received: from desky.lan (91-154-35-171.elisa-laajakaista.fi [91.154.35.171]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 957C013C5; Fri, 16 Jun 2023 15:59:57 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1686923999; bh=FoGdEyjowh4KoMU7bekORi82avpRc1q3afQLZLU30b4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iskhj8ZgwLQplODwjp9qmAk6HekEdJcsQbtzW8zRHuBM0387UbXUdmHHLg2NubObK qk3bXXIdISXY4U9mxuvrXJyidUlGWPyllyurNkM7EX3lMy/p6nqMsutVI3xZUYz747 hdpCsu/XlkuJrWtJ2bv8OCBID6n65oUM3VsI6W/0= From: Tomi Valkeinen To: linux-media@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-i2c@vger.kernel.org, Luca Ceresoli , Andy Shevchenko , Matti Vaittinen , Laurent Pinchart , Sakari Ailus Cc: Wolfram Sang , Rob Herring , Krzysztof Kozlowski , Mauro Carvalho Chehab , Peter Rosin , Liam Girdwood , Mark Brown , Michael Tretter , Hans Verkuil , Mike Pagano , =?utf-8?q?Krzysztof_Ha=C5=82asa?= , Marek Vasut , Satish Nagireddy , Tomi Valkeinen Subject: [PATCH v14 13/18] media: i2c: ds90ub953: Use v4l2_fwnode_endpoint_parse() Date: Fri, 16 Jun 2023 16:59:17 +0300 Message-Id: <20230616135922.442979-14-tomi.valkeinen@ideasonboard.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230616135922.442979-1-tomi.valkeinen@ideasonboard.com> References: <20230616135922.442979-1-tomi.valkeinen@ideasonboard.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_PASS,SPF_PASS, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1768868390719229097?= X-GMAIL-MSGID: =?utf-8?q?1768868390719229097?= Use v4l2_fwnode_endpoint_parse() to parse the sink endpoint parameters. Signed-off-by: Tomi Valkeinen --- drivers/media/i2c/ds90ub953.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/drivers/media/i2c/ds90ub953.c b/drivers/media/i2c/ds90ub953.c index 1e3827a60029..5b586855c77b 100644 --- a/drivers/media/i2c/ds90ub953.c +++ b/drivers/media/i2c/ds90ub953.c @@ -25,6 +25,8 @@ #include #include #include +#include +#include #include #define UB953_PAD_SINK 0 @@ -1111,7 +1113,9 @@ static const struct regmap_config ub953_regmap_config = { static int ub953_parse_dt(struct ub953_data *priv) { struct device *dev = &priv->client->dev; + struct v4l2_fwnode_endpoint vep = {}; struct fwnode_handle *ep_fwnode; + unsigned char nlanes; int ret; ep_fwnode = fwnode_graph_get_endpoint_by_id(dev_fwnode(dev), @@ -1119,19 +1123,22 @@ static int ub953_parse_dt(struct ub953_data *priv) if (!ep_fwnode) return dev_err_probe(dev, -ENOENT, "no endpoint found\n"); - ret = fwnode_property_count_u32(ep_fwnode, "data-lanes"); + vep.bus_type = V4L2_MBUS_CSI2_DPHY; + ret = v4l2_fwnode_endpoint_parse(ep_fwnode, &vep); fwnode_handle_put(ep_fwnode); - if (ret < 0) + if (ret) return dev_err_probe(dev, ret, - "failed to parse property 'data-lanes'\n"); + "failed to parse sink endpoint data\n"); + + nlanes = vep.bus.mipi_csi2.num_data_lanes; - if (ret != 1 && ret != 2 && ret != 4) + if (nlanes != 1 && nlanes != 2 && nlanes != 4) return dev_err_probe(dev, -EINVAL, - "bad number of data-lanes: %d\n", ret); + "bad number of data-lanes: %d\n", nlanes); - priv->num_data_lanes = ret; + priv->num_data_lanes = nlanes; return 0; }