Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp4500567pxk; Wed, 30 Sep 2020 04:47:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxuzRWBNn5SpfZ6eWAzS82WAC0Ihdpf0KKy440lfxIn3tCPiVaUVu1UZZ9g/FPgBcFwpN3h X-Received: by 2002:a17:906:70d4:: with SMTP id g20mr2457729ejk.413.1601466459960; Wed, 30 Sep 2020 04:47:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1601466459; cv=none; d=google.com; s=arc-20160816; b=O25nl3RZaPmy9f5I7SO+qUsNoeHWOPb0NcMrlYpmh1y0MO6tpY98ly7neuJH5PZnnX 3Z8UB+xPUdzDELAtweic5JtEfpiQeV54ZBceOe4DLzXoiW7UPvH3HvnkmRKDtqvI2Z91 KULIE8bFSmwDFhLymHcsqduMkS0MuxpCWZT7wqIIv9R4EROBlEs6Xv0Da7pVvEaqpSx/ A4DzVsRoKZmI96Bk0uoEdg9D0jq5A0T6jVvLrPdgkF0VhkmQlWfTf7XDu/ErAv2AmmBf 24KK/1xDB6ItLk2TuLSJQFmChwVRLJ7qECXl96/M5pXXa0K3dnuPeekNGNzK9G/CBngP 6sjQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :ironport-sdr:ironport-sdr; bh=v78sYHNRc3KyRZFvwHVLwTzBissHBlMrxYpCQzdx/Fg=; b=DyiYeora5BmLUIHinm8klcBMaVNNq+Ncd44X8af6Hn/E4xaRF1ISc1HSaqh/xJp4o9 3iQoDLCuYegSmjPrexlrs7glsUp025RLL7ofkc/11uCmSghY5Ju0BRlZoWjl+z5HqoHe kvJ+lwqCZbNoCrLhyp9Ffy0rW5BtGaJWxPbjqs5jQnrZPhWDggnaT50Iebnj7KGcHmPI sc9FrNUjvd4j+77aeDwHVV/sfpubW0vVUDRtm3RokS/H/0m8TPiXAN1vakRcWdlxXGVJ RNjJn5uz7+wU2/COmyWkbrJm1VPbtY1XXP6Xw3CXJxrojgFctgtcGgwvzh1CerAnlAEy h31Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id gj3si999086ejb.728.2020.09.30.04.47.16; Wed, 30 Sep 2020 04:47:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729379AbgI3Lpo (ORCPT + 99 others); Wed, 30 Sep 2020 07:45:44 -0400 Received: from mga07.intel.com ([134.134.136.100]:57312 "EHLO mga07.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725776AbgI3Lpk (ORCPT ); Wed, 30 Sep 2020 07:45:40 -0400 IronPort-SDR: jSf/wI54As06nlC8Y7nN1NQgQ0CFcfvX00a7DUwMEw8psTxJPhMi2hV/x8/dlmmKxlJLz4bdGn KVSLuA9wVhDg== X-IronPort-AV: E=McAfee;i="6000,8403,9759"; a="226572529" X-IronPort-AV: E=Sophos;i="5.77,322,1596524400"; d="scan'208";a="226572529" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Sep 2020 04:45:34 -0700 IronPort-SDR: uxqs9CHThJukvG6Ul9PCkD+sHZL+L4tNH90Neuemx0IqnR9TY2Ult9AxGr9cEeRtH9k4hbwVO9 IOo2JlEjfDhg== X-IronPort-AV: E=Sophos;i="5.77,322,1596524400"; d="scan'208";a="415692174" Received: from paasikivi.fi.intel.com ([10.237.72.42]) by fmsmga001-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Sep 2020 04:45:31 -0700 Received: by paasikivi.fi.intel.com (Postfix, from userid 1000) id 78C8120330; Wed, 30 Sep 2020 14:45:29 +0300 (EEST) Date: Wed, 30 Sep 2020 14:45:29 +0300 From: Sakari Ailus To: Lad Prabhakar Cc: Jacopo Mondi , Hans Verkuil , Laurent Pinchart , Mauro Carvalho Chehab , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-renesas-soc@vger.kernel.org, Biju Das , "Lad, Prabhakar" Subject: Re: [PATCH v6 1/3] media: i2c: ov772x: Parse endpoint properties Message-ID: <20200930114529.GM26842@paasikivi.fi.intel.com> References: <20200917174224.11430-1-prabhakar.mahadev-lad.rj@bp.renesas.com> <20200917174224.11430-2-prabhakar.mahadev-lad.rj@bp.renesas.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200917174224.11430-2-prabhakar.mahadev-lad.rj@bp.renesas.com> User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Prabhakar, On Thu, Sep 17, 2020 at 06:42:22PM +0100, Lad Prabhakar wrote: > Parse endpoint properties using v4l2_fwnode_endpoint_alloc_parse() > to determine the bus type and store it in the driver structure. > > Set bus_type to V4L2_MBUS_PARALLEL as it's the only supported one > > Signed-off-by: Lad Prabhakar > --- > drivers/media/i2c/ov772x.c | 34 ++++++++++++++++++++++++++++++++++ > 1 file changed, 34 insertions(+) > > diff --git a/drivers/media/i2c/ov772x.c b/drivers/media/i2c/ov772x.c > index 2cc6a678069a..f61a3f09ad64 100644 > --- a/drivers/media/i2c/ov772x.c > +++ b/drivers/media/i2c/ov772x.c > @@ -31,6 +31,7 @@ > #include > #include > #include > +#include > #include > #include > > @@ -434,6 +435,7 @@ struct ov772x_priv { > #ifdef CONFIG_MEDIA_CONTROLLER > struct media_pad pad; > #endif > + enum v4l2_mbus_type bus_type; > }; > > /* > @@ -1348,6 +1350,34 @@ static const struct v4l2_subdev_ops ov772x_subdev_ops = { > .pad = &ov772x_subdev_pad_ops, > }; > > +static int ov772x_parse_dt(struct i2c_client *client, > + struct ov772x_priv *priv) > +{ > + struct v4l2_fwnode_endpoint bus_cfg; > + struct fwnode_handle *ep; > + int ret; > + > + ep = fwnode_graph_get_next_endpoint(dev_fwnode(&client->dev), > + NULL); > + if (!ep) { > + dev_err(&client->dev, "Endpoint node not found\n"); > + return -EINVAL; > + } > + > + bus_cfg.bus_type = V4L2_MBUS_PARALLEL; Please zero the entire struct, i.e. do this assignment in the declaration. You can also use v4l2_fwnode_endpoint_parse() if you're not using the link frequencies --- sensor drivers generally should but you could only add them as optional at this point (out of scope of this patch). > + ret = v4l2_fwnode_endpoint_alloc_parse(ep, &bus_cfg); > + if (ret) > + goto error_fwnode_put; > + > + priv->bus_type = bus_cfg.bus_type; > + v4l2_fwnode_endpoint_free(&bus_cfg); > + > +error_fwnode_put: > + fwnode_handle_put(ep); > + > + return ret; > +} > + > /* > * i2c_driver function > */ > @@ -1415,6 +1445,10 @@ static int ov772x_probe(struct i2c_client *client) > goto error_clk_put; > } > > + ret = ov772x_parse_dt(client, priv); > + if (ret) > + goto error_clk_put; > + > ret = ov772x_video_probe(priv); > if (ret < 0) > goto error_gpio_put; > -- > 2.17.1 > -- Sakari Ailus