[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20200215194136.10131-5-slongerbeam@gmail.com>
Date: Sat, 15 Feb 2020 11:41:23 -0800
From: Steve Longerbeam <slongerbeam@...il.com>
To: linux-media@...r.kernel.org
Cc: Steve Longerbeam <slongerbeam@...il.com>,
Philipp Zabel <p.zabel@...gutronix.de>,
Mauro Carvalho Chehab <mchehab@...nel.org>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Shawn Guo <shawnguo@...nel.org>,
Sascha Hauer <s.hauer@...gutronix.de>,
Pengutronix Kernel Team <kernel@...gutronix.de>,
Fabio Estevam <festevam@...il.com>,
NXP Linux Team <linux-imx@....com>,
devel@...verdev.osuosl.org (open list:STAGING SUBSYSTEM),
linux-arm-kernel@...ts.infradead.org (moderated list:ARM/FREESCALE IMX
/ MXC ARM ARCHITECTURE), linux-kernel@...r.kernel.org (open list)
Subject: [RESEND PATCH v3 04/17] media: imx: mipi csi-2: Implement get_fwnode_pad op
Implement get_fwnode_pad operation. If the endpoint is owned by the MIPI
CSI-2 receiver, return the endpoint's port number. The MIPI CSI-2 receiver
maps port numbers and pad indexes 1:1.
Signed-off-by: Steve Longerbeam <slongerbeam@...il.com>
---
drivers/staging/media/imx/imx6-mipi-csi2.c | 28 ++++++++++++++++++++++
1 file changed, 28 insertions(+)
diff --git a/drivers/staging/media/imx/imx6-mipi-csi2.c b/drivers/staging/media/imx/imx6-mipi-csi2.c
index c1d1afeea53a..e27a342751fc 100644
--- a/drivers/staging/media/imx/imx6-mipi-csi2.c
+++ b/drivers/staging/media/imx/imx6-mipi-csi2.c
@@ -507,9 +507,37 @@ static int csi2_registered(struct v4l2_subdev *sd)
640, 480, 0, V4L2_FIELD_NONE, NULL);
}
+static int csi2_get_fwnode_pad(struct media_entity *entity,
+ struct fwnode_endpoint *endpoint)
+{
+ struct v4l2_subdev *sd = media_entity_to_v4l2_subdev(entity);
+ struct csi2_dev *csi2 = sd_to_dev(sd);
+ struct fwnode_handle *csi2_ep;
+
+ /*
+ * If the endpoint is one of ours, return the endpoint's port
+ * number. This device maps port numbers and pad indexes 1:1.
+ */
+ fwnode_graph_for_each_endpoint(dev_fwnode(csi2->dev), csi2_ep) {
+ if (endpoint->local_fwnode == csi2_ep) {
+ struct fwnode_endpoint fwep;
+ int ret;
+
+ ret = fwnode_graph_parse_endpoint(csi2_ep, &fwep);
+
+ fwnode_handle_put(csi2_ep);
+
+ return ret ? ret : fwep.port;
+ }
+ }
+
+ return -ENXIO;
+}
+
static const struct media_entity_operations csi2_entity_ops = {
.link_setup = csi2_link_setup,
.link_validate = v4l2_subdev_link_validate,
+ .get_fwnode_pad = csi2_get_fwnode_pad,
};
static const struct v4l2_subdev_video_ops csi2_video_ops = {
--
2.17.1
Powered by blists - more mailing lists