Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4758EC2BB1D for ; Tue, 14 Apr 2020 23:02:50 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1770D2051A for ; Tue, 14 Apr 2020 23:02:50 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="YOT0WFsY" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2634341AbgDNXCt (ORCPT ); Tue, 14 Apr 2020 19:02:49 -0400 Received: from perceval.ideasonboard.com ([213.167.242.64]:37528 "EHLO perceval.ideasonboard.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731135AbgDNXCr (ORCPT ); Tue, 14 Apr 2020 19:02:47 -0400 Received: from pendragon.ideasonboard.com (81-175-216-236.bb.dnainternet.fi [81.175.216.236]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 31E60521; Wed, 15 Apr 2020 01:02:44 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1586905364; bh=D4oCYP094HHf7bhKII0QzkqJxN5ZMqr345CEafRo9Y4=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=YOT0WFsYw8kdefJhiiEbqkAlrcl2jP2N99jDrF2XhCjrhC3ANr3H9Hj1lTzrCeVXJ aso75zC4/OoSfXw87DUAMpI4XyHv1Zsj5RcMACsqVQ2AU913Hs5tSuDjPeICheOVdF q1V/psjcfK0Ky2J6jpKGIc4eQcBpfTUdR7JwinGM= Date: Wed, 15 Apr 2020 02:02:32 +0300 From: Laurent Pinchart To: Steve Longerbeam Cc: linux-media@vger.kernel.org, Sakari Ailus , Mauro Carvalho Chehab , Hans Verkuil , Rui Miguel Silva , Philipp Zabel Subject: Re: [PATCH v4 05/17] media: imx: csi: Implement get_fwnode_pad op Message-ID: <20200414230232.GB27621@pendragon.ideasonboard.com> References: <20200303234256.8928-1-slongerbeam@gmail.com> <20200303234256.8928-6-slongerbeam@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20200303234256.8928-6-slongerbeam@gmail.com> Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Hi Steve, Thank you for the patch. On Tue, Mar 03, 2020 at 03:42:44PM -0800, Steve Longerbeam wrote: > The CSI does not have a 1:1 relationship between fwnode port numbers and > pad indexes. In fact the CSI fwnode device is itself a port which is the > sink, containing only a single fwnode endpoint. Implement media_entity > operation get_fwnode_pad to first verify the given endpoint is the CSI's > sink endpoint, and if so return the CSI sink pad index. > > Signed-off-by: Steve Longerbeam Reviewed-by: Laurent Pinchart > --- > drivers/staging/media/imx/imx-media-csi.c | 23 +++++++++++++++++++++++ > 1 file changed, 23 insertions(+) > > diff --git a/drivers/staging/media/imx/imx-media-csi.c b/drivers/staging/media/imx/imx-media-csi.c > index f409fca88dcf..35f2512ed2a9 100644 > --- a/drivers/staging/media/imx/imx-media-csi.c > +++ b/drivers/staging/media/imx/imx-media-csi.c > @@ -1827,9 +1827,32 @@ static void csi_unregistered(struct v4l2_subdev *sd) > ipu_csi_put(priv->csi); > } > > +/* > + * The CSI has only one fwnode endpoint, at the sink pad. Verify the > + * endpoint belongs to us, and return CSI_SINK_PAD. > + */ > +static int csi_get_fwnode_pad(struct media_entity *entity, > + struct fwnode_endpoint *endpoint) > +{ > + struct v4l2_subdev *sd = media_entity_to_v4l2_subdev(entity); > + struct csi_priv *priv = v4l2_get_subdevdata(sd); > + struct fwnode_handle *csi_port = dev_fwnode(priv->dev); > + struct fwnode_handle *csi_ep; > + int ret; > + > + csi_ep = fwnode_get_next_child_node(csi_port, NULL); > + > + ret = endpoint->local_fwnode == csi_ep ? CSI_SINK_PAD : -ENXIO; > + > + fwnode_handle_put(csi_ep); > + > + return ret; > +} > + > static const struct media_entity_operations csi_entity_ops = { > .link_setup = csi_link_setup, > .link_validate = v4l2_subdev_link_validate, > + .get_fwnode_pad = csi_get_fwnode_pad, > }; > > static const struct v4l2_subdev_core_ops csi_core_ops = { -- Regards, Laurent Pinchart