aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/v4l2-core/v4l2-subdev.c
diff options
context:
space:
mode:
authorSakari Ailus <[email protected]>2023-08-31 12:40:07 +0000
committerHans Verkuil <[email protected]>2024-04-29 12:56:37 +0000
commit1bfef49741fde3fa4a4d3276352e25a6a2a86499 (patch)
tree10a69a59ef0ccd87283f467f6da52a467739e1dc /drivers/media/v4l2-core/v4l2-subdev.c
parentmedia: v4l: subdev: Return routes set using S_ROUTING (diff)
downloadkernel-1bfef49741fde3fa4a4d3276352e25a6a2a86499.tar.gz
kernel-1bfef49741fde3fa4a4d3276352e25a6a2a86499.zip
media: v4l: subdev: Add trivial set_routing support
Add trivial S_ROUTING IOCTL support for drivers where routing is static. Essentially this means returning the same information G_ROUTING call would have done. Signed-off-by: Sakari Ailus <[email protected]> Co-developed-by: Laurent Pinchart <[email protected]> Signed-off-by: Laurent Pinchart <[email protected]> Reviewed-by: Julien Massot <[email protected]> Signed-off-by: Hans Verkuil <[email protected]>
Diffstat (limited to 'drivers/media/v4l2-core/v4l2-subdev.c')
-rw-r--r--drivers/media/v4l2-core/v4l2-subdev.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/drivers/media/v4l2-core/v4l2-subdev.c b/drivers/media/v4l2-core/v4l2-subdev.c
index 3d1ed8ab5229..8470d6eda9a3 100644
--- a/drivers/media/v4l2-core/v4l2-subdev.c
+++ b/drivers/media/v4l2-core/v4l2-subdev.c
@@ -1013,6 +1013,20 @@ static long subdev_do_ioctl(struct file *file, unsigned int cmd, void *arg,
return -EINVAL;
}
+ /*
+ * If the driver doesn't support setting routing, just return
+ * the routing table.
+ */
+ if (!v4l2_subdev_has_op(sd, pad, set_routing)) {
+ memcpy((struct v4l2_subdev_route *)(uintptr_t)routing->routes,
+ state->routing.routes,
+ min(state->routing.num_routes, routing->len_routes) *
+ sizeof(*state->routing.routes));
+ routing->num_routes = state->routing.num_routes;
+
+ return 0;
+ }
+
krouting.num_routes = routing->num_routes;
krouting.len_routes = routing->len_routes;
krouting.routes = routes;