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 = {