On 16/03/2022 12:50, Jacopo Mondi wrote:
Hi Tomi,
On Tue, Mar 01, 2022 at 06:11:48PM +0200, Tomi Valkeinen wrote:
Add two helper functions to make dealing with streams easier:
v4l2_subdev_routing_find_opposite_end - given a routing table and a pad
+ stream, return the pad + stream on the opposite side of the subdev.
v4l2_subdev_state_get_opposite_stream_format - return a pointer to the
format on the pad + stream on the opposite side from the given pad +
stream.
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@xxxxxxxxxxxxxxxx>
Reviewed-by: Hans Verkuil <hverkuil-cisco@xxxxxxxxx>
---
drivers/media/v4l2-core/v4l2-subdev.c | 48 +++++++++++++++++++++++++++
include/media/v4l2-subdev.h | 36 ++++++++++++++++++++
2 files changed, 84 insertions(+)
diff --git a/drivers/media/v4l2-core/v4l2-subdev.c b/drivers/media/v4l2-core/v4l2-subdev.c
index 091b854e00d0..e65f802fe2aa 100644
--- a/drivers/media/v4l2-core/v4l2-subdev.c
+++ b/drivers/media/v4l2-core/v4l2-subdev.c
@@ -1459,6 +1459,54 @@ v4l2_subdev_state_get_stream_format(struct v4l2_subdev_state *state,
}
EXPORT_SYMBOL_GPL(v4l2_subdev_state_get_stream_format);
+int v4l2_subdev_routing_find_opposite_end(const struct v4l2_subdev_krouting *routing,
+ u32 pad, u32 stream, u32 *other_pad,
+ u32 *other_stream)
+{
+ unsigned int i;
+
+ for (i = 0; i < routing->num_routes; ++i) {
+ struct v4l2_subdev_route *route = &routing->routes[i];
+
Is it intentional to include routes that might be active ?
You mean not active? I don't see why this function should only consider
active routes. So yes, I guess you could call it intentional.
Tomi