[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20190805233505.21167-7-slongerbeam@gmail.com>
Date: Mon, 5 Aug 2019 16:34:49 -0700
From: Steve Longerbeam <slongerbeam@...il.com>
To: linux-media@...r.kernel.org
Cc: Steve Longerbeam <slongerbeam@...il.com>,
Kieran Bingham <kieran.bingham@...asonboard.com>,
Mauro Carvalho Chehab <mchehab@...nel.org>,
linux-kernel@...r.kernel.org (open list)
Subject: [PATCH 06/22] media: adv748x: csi2: Implement get_fwnode_pad
If the given endpoint fwnode passed to the .get_fwnode_pad() op is
the adv748x-csi2 TXA/TXB source endpoint, return the associated media
pad index ADV748X_CSI2_SOURCE. The adv748x-csi2 has no other media pads
that are associated with fwnode endpoints.
Signed-off-by: Steve Longerbeam <slongerbeam@...il.com>
---
drivers/media/i2c/adv748x/adv748x-csi2.c | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
diff --git a/drivers/media/i2c/adv748x/adv748x-csi2.c b/drivers/media/i2c/adv748x/adv748x-csi2.c
index 2091cda50935..810085a1f2f0 100644
--- a/drivers/media/i2c/adv748x/adv748x-csi2.c
+++ b/drivers/media/i2c/adv748x/adv748x-csi2.c
@@ -228,6 +228,24 @@ static const struct v4l2_subdev_ops adv748x_csi2_ops = {
.pad = &adv748x_csi2_pad_ops,
};
+/* -----------------------------------------------------------------------------
+ * media_entity_operations
+ */
+
+static int adv748x_csi2_get_fwnode_pad(struct media_entity *entity,
+ struct fwnode_endpoint *endpoint)
+{
+ struct v4l2_subdev *sd = media_entity_to_v4l2_subdev(entity);
+ struct adv748x_csi2 *tx = adv748x_sd_to_csi2(sd);
+
+ return endpoint->local_fwnode == tx->sd.fwnode ?
+ ADV748X_CSI2_SOURCE : -ENXIO;
+}
+
+static const struct media_entity_operations adv748x_csi2_entity_ops = {
+ .get_fwnode_pad = adv748x_csi2_get_fwnode_pad,
+};
+
/* -----------------------------------------------------------------------------
* Subdev module and controls
*/
@@ -295,6 +313,9 @@ int adv748x_csi2_init(struct adv748x_state *state, struct adv748x_csi2 *tx)
/* Register internal ops for incremental subdev registration */
tx->sd.internal_ops = &adv748x_csi2_internal_ops;
+ /* Register media_entity ops */
+ tx->sd.entity.ops = &adv748x_csi2_entity_ops;
+
tx->pads[ADV748X_CSI2_SINK].flags = MEDIA_PAD_FL_SINK;
tx->pads[ADV748X_CSI2_SOURCE].flags = MEDIA_PAD_FL_SOURCE;
--
2.17.1
Powered by blists - more mailing lists