aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSakari Ailus <sakari.ailus@linux.intel.com>2024-04-16 22:32:50 +0300
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2024-04-23 16:05:04 +0300
commit97e2316ce615b4a3e39fd16bce2e4111332c2e9a (patch)
tree067d4adc1bb74b996a568d7eb1103176b83efe9f
parent864419790004e92312df7c86dc5e27e2a418a88d (diff)
downloadlinux-rpi/v6.9/metadata/v9/base.tar.gz
media: v4l: subdev: Add trivial set_routing supportrpi/v6.9/metadata/v9/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> Reviewed-by: Julien Massot <julien.massot@collabora.com> Link: https://lore.kernel.org/r/20240416193319.778192-18-sakari.ailus@linux.intel.com Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.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 36b2f78cd5511..e68f16a7c0418 100644
--- a/drivers/media/v4l2-core/v4l2-subdev.c
+++ b/drivers/media/v4l2-core/v4l2-subdev.c
@@ -955,6 +955,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;