aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSakari Ailus <sakari.ailus@linux.intel.com>2023-08-31 15:40:07 +0300
committerSakari Ailus <sakari.ailus@linux.intel.com>2024-04-24 14:37:58 +0300
commit47120f3da814440058a9823bf9ac3a660b2ce9c0 (patch)
tree53708a4a55aa7386108f9daab612b8aaba429b63
parent578830edd921485bf58b767834c0586c5574739b (diff)
downloadlinux-rpi/v6.9/metadata/v10/base.tar.gz
media: v4l: subdev: Add trivial set_routing supportrpi/v6.9/metadata/v10/base
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 <sakari.ailus@linux.intel.com> Co-developed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Julien Massot <julien.massot@collabora.com>
-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 1e27a6a901022..21f16f297f3fb 100644
--- a/drivers/media/v4l2-core/v4l2-subdev.c
+++ b/drivers/media/v4l2-core/v4l2-subdev.c
@@ -990,6 +990,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;