[PATCH 1/3] media: v4l: subdev: add v4l2_subdev_routing_xlate_streams()
Cosmin Tanislav
demonsingur at gmail.com
Wed Feb 19 11:11:30 PST 2025
Currently, the v4l2_subdev_state_xlate_streams() function is used
to translate streams from one pad to another.
This function takes the entire subdev state as argument, but only makes
use of the routing.
Introduce a v4l2_subdev_routing_xlate_streams() function which can be
used without the entire subdev state, to avoid passing the entire state
around when not needed.
Signed-off-by: Cosmin Tanislav <demonsingur at gmail.com>
---
drivers/media/v4l2-core/v4l2-subdev.c | 12 +++++++++---
include/media/v4l2-subdev.h | 18 ++++++++++++++++--
2 files changed, 25 insertions(+), 5 deletions(-)
diff --git a/drivers/media/v4l2-core/v4l2-subdev.c b/drivers/media/v4l2-core/v4l2-subdev.c
index cde1774c9098d..d1581f1036487 100644
--- a/drivers/media/v4l2-core/v4l2-subdev.c
+++ b/drivers/media/v4l2-core/v4l2-subdev.c
@@ -2042,10 +2042,9 @@ v4l2_subdev_state_get_opposite_stream_format(struct v4l2_subdev_state *state,
}
EXPORT_SYMBOL_GPL(v4l2_subdev_state_get_opposite_stream_format);
-u64 v4l2_subdev_state_xlate_streams(const struct v4l2_subdev_state *state,
- u32 pad0, u32 pad1, u64 *streams)
+u64 v4l2_subdev_routing_xlate_streams(const struct v4l2_subdev_krouting *routing,
+ u32 pad0, u32 pad1, u64 *streams)
{
- const struct v4l2_subdev_krouting *routing = &state->routing;
struct v4l2_subdev_route *route;
u64 streams0 = 0;
u64 streams1 = 0;
@@ -2066,6 +2065,13 @@ u64 v4l2_subdev_state_xlate_streams(const struct v4l2_subdev_state *state,
*streams = streams0;
return streams1;
}
+EXPORT_SYMBOL_GPL(v4l2_subdev_routing_xlate_streams);
+
+u64 v4l2_subdev_state_xlate_streams(const struct v4l2_subdev_state *state,
+ u32 pad0, u32 pad1, u64 *streams)
+{
+ return v4l2_subdev_routing_xlate_streams(&state->routing, pad0, pad1, streams);
+}
EXPORT_SYMBOL_GPL(v4l2_subdev_state_xlate_streams);
int v4l2_subdev_routing_validate(struct v4l2_subdev *sd,
diff --git a/include/media/v4l2-subdev.h b/include/media/v4l2-subdev.h
index 2f2200875b038..90d08e13e016b 100644
--- a/include/media/v4l2-subdev.h
+++ b/include/media/v4l2-subdev.h
@@ -1582,9 +1582,9 @@ v4l2_subdev_state_get_opposite_stream_format(struct v4l2_subdev_state *state,
u32 pad, u32 stream);
/**
- * v4l2_subdev_state_xlate_streams() - Translate streams from one pad to another
+ * v4l2_subdev_routing_xlate_streams() - Translate streams from one pad to another
*
- * @state: Subdevice state
+ * @state: Routing used to translate streams from one pad to another
* @pad0: The first pad
* @pad1: The second pad
* @streams: Streams bitmask on the first pad
@@ -1601,6 +1601,20 @@ v4l2_subdev_state_get_opposite_stream_format(struct v4l2_subdev_state *state,
*
* Return: The bitmask of streams of @pad1 that are routed to @streams on @pad0.
*/
+u64 v4l2_subdev_routing_xlate_streams(const struct v4l2_subdev_krouting *routing,
+ u32 pad0, u32 pad1, u64 *streams);
+
+/**
+ * v4l2_subdev_state_xlate_streams() - Translate streams from one pad to another
+ *
+ * @state: Subdevice state
+ * @pad0: The first pad
+ * @pad1: The second pad
+ * @streams: Streams bitmask on the first pad
+ *
+ * This is the same as v4l2_subdev_routing_xlate_streams, but takes subdevice
+ * state as parameter
+ */
u64 v4l2_subdev_state_xlate_streams(const struct v4l2_subdev_state *state,
u32 pad0, u32 pad1, u64 *streams);
--
2.48.1
More information about the linux-arm-kernel
mailing list