diff mbox series

[15/18] media: rcar-csi2: Add more stream support to rcsi2_calc_mbps()

Message ID 20250219-rcar-streams-v1-15-f1b93e370aab@ideasonboard.com (mailing list archive)
State New
Delegated to: Kieran Bingham
Headers show
Series media: rcar: Streams support | expand

Commit Message

Tomi Valkeinen Feb. 19, 2025, 1:49 p.m. UTC
In the case where V4L2_CID_LINK_FREQ is not available, make sure we fail
if there are more than one stream configured, and also use the correct
stream number for that single stream.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen+renesas@ideasonboard.com>
---
 drivers/media/platform/renesas/rcar-csi2.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/drivers/media/platform/renesas/rcar-csi2.c b/drivers/media/platform/renesas/rcar-csi2.c
index 17ded37d5ca7..3608437b72cd 100644
--- a/drivers/media/platform/renesas/rcar-csi2.c
+++ b/drivers/media/platform/renesas/rcar-csi2.c
@@ -1016,15 +1016,20 @@  static int rcsi2_calc_mbps(struct rcar_csi2 *priv,
 		bpp = 0;
 		lanes = 0;
 	} else {
+		struct v4l2_subdev_route *route = &state->routing.routes[0];
 		const struct rcar_csi2_format *format;
 		struct v4l2_mbus_framefmt *fmt;
 		int ret;
 
+		if (state->routing.num_routes > 1)
+			return -EINVAL;
+
 		ret = rcsi2_get_active_lanes(priv, &lanes);
 		if (ret)
 			return ret;
 
-		fmt = v4l2_subdev_state_get_format(state, RCAR_CSI2_SINK, 0);
+		fmt = v4l2_subdev_state_get_format(state, route->sink_pad,
+						   route->sink_stream);
 		if (!fmt)
 			return -EINVAL;