To support multiplexed streams the internal routing between the
adv748x sink pad and its source pad needs to be described.

Signed-off-by: Niklas Söderlund <niklas.soderlund+rene...@ragnatech.se>
---
 drivers/media/i2c/adv748x/adv748x-csi2.c | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/drivers/media/i2c/adv748x/adv748x-csi2.c 
b/drivers/media/i2c/adv748x/adv748x-csi2.c
index 291b35bef49d41fb..dbefb53f5b8c414d 100644
--- a/drivers/media/i2c/adv748x/adv748x-csi2.c
+++ b/drivers/media/i2c/adv748x/adv748x-csi2.c
@@ -262,10 +262,32 @@ static int adv748x_csi2_get_frame_desc(struct v4l2_subdev 
*sd, unsigned int pad,
        return 0;
 }
 
+static int adv748x_csi2_get_routing(struct v4l2_subdev *subdev,
+                                   struct v4l2_subdev_routing *routing)
+{
+       struct v4l2_subdev_route *r = routing->routes;
+
+       if (routing->num_routes < 1) {
+               routing->num_routes = 1;
+               return -ENOSPC;
+       }
+
+       routing->num_routes = 1;
+
+       r->sink_pad = ADV748X_CSI2_SINK;
+       r->sink_stream = 0;
+       r->source_pad = ADV748X_CSI2_SOURCE;
+       r->source_stream = 0;
+       r->flags = V4L2_SUBDEV_ROUTE_FL_ACTIVE | V4L2_SUBDEV_ROUTE_FL_IMMUTABLE;
+
+       return 0;
+}
+
 static const struct v4l2_subdev_pad_ops adv748x_csi2_pad_ops = {
        .get_fmt = adv748x_csi2_get_format,
        .set_fmt = adv748x_csi2_set_format,
        .get_frame_desc = adv748x_csi2_get_frame_desc,
+       .get_routing = adv748x_csi2_get_routing,
        .s_stream = adv748x_csi2_s_stream,
 };
 
-- 
2.15.1

Reply via email to