lkml.org 
[lkml]   [2020]   [Feb]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[RESEND PATCH v3 05/17] media: video-mux: Implement get_fwnode_pad op
Date
Implement get_fwnode_pad operation. If the endpoint is owned by the video
mux, return the endpoint's port number. The video mux maps fwnode port
numbers and pad indexes 1:1.

Signed-off-by: Steve Longerbeam <slongerbeam@gmail.com>
---
drivers/media/platform/video-mux.c | 29 +++++++++++++++++++++++++++++
1 file changed, 29 insertions(+)

diff --git a/drivers/media/platform/video-mux.c b/drivers/media/platform/video-mux.c
index 3d2a5c2b4c08..c1c477e4e33f 100644
--- a/drivers/media/platform/video-mux.c
+++ b/drivers/media/platform/video-mux.c
@@ -94,9 +94,38 @@ static int video_mux_link_setup(struct media_entity *entity,
return ret;
}

+static int video_mux_get_fwnode_pad(struct media_entity *entity,
+ struct fwnode_endpoint *endpoint)
+{
+ struct v4l2_subdev *sd = media_entity_to_v4l2_subdev(entity);
+ struct video_mux *vmux = v4l2_subdev_to_video_mux(sd);
+ struct fwnode_handle *vmux_fwnode = dev_fwnode(vmux->subdev.dev);
+ struct fwnode_handle *vmux_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(vmux_fwnode, vmux_ep) {
+ if (endpoint->local_fwnode == vmux_ep) {
+ struct fwnode_endpoint fwep;
+ int ret;
+
+ ret = fwnode_graph_parse_endpoint(vmux_ep, &fwep);
+
+ fwnode_handle_put(vmux_ep);
+
+ return ret ? ret : fwep.port;
+ }
+ }
+
+ return -ENXIO;
+}
+
static const struct media_entity_operations video_mux_ops = {
.link_setup = video_mux_link_setup,
.link_validate = v4l2_subdev_link_validate,
+ .get_fwnode_pad = video_mux_get_fwnode_pad,
};

static int video_mux_s_stream(struct v4l2_subdev *sd, int enable)
--
2.17.1
\
 
 \ /
  Last update: 2020-02-15 20:43    [W:0.033 / U:5.264 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site