[PATCH 04/19] media: adv748x: Propagate format to opposite stream

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Now that the adv748x-csi2 driver supports streams and routing, when a
format is set on the sink pad, it gets propagated to the connected stream
on the source pad.

Signed-off-by: Jacopo Mondi <jacopo.mondi@xxxxxxxxxxxxxxxx>
---
 drivers/media/i2c/adv748x/adv748x-csi2.c | 23 ++++++++++++-----------
 1 file changed, 12 insertions(+), 11 deletions(-)

diff --git a/drivers/media/i2c/adv748x/adv748x-csi2.c b/drivers/media/i2c/adv748x/adv748x-csi2.c
index d929db7e8ef2..ace4e1d904d9 100644
--- a/drivers/media/i2c/adv748x/adv748x-csi2.c
+++ b/drivers/media/i2c/adv748x/adv748x-csi2.c
@@ -167,20 +167,21 @@ static int adv748x_csi2_set_format(struct v4l2_subdev *sd,
 				   struct v4l2_subdev_state *sd_state,
 				   struct v4l2_subdev_format *sdformat)
 {
-	struct v4l2_mbus_framefmt *mbusformat;
+	struct v4l2_mbus_framefmt *fmt;
 
-	mbusformat = v4l2_subdev_state_get_format(sd_state, sdformat->pad);
-
-	/* Format on the source pad is always copied from the sink one. */
-	if (sdformat->pad == ADV748X_CSI2_SOURCE) {
-		const struct v4l2_mbus_framefmt *sink_fmt;
+	/*
+	 * The format set on the sink pad is propagated to the other end
+	 * of the active route.
+	 */
+	if (sdformat->pad == ADV748X_CSI2_SOURCE)
+		return -EINVAL;
 
-		sink_fmt = v4l2_subdev_state_get_format(sd_state,
-							ADV748X_CSI2_SINK);
-		sdformat->format = *sink_fmt;
-	}
+	fmt = v4l2_subdev_state_get_format(sd_state, sdformat->pad);
+	*fmt = sdformat->format;
 
-	*mbusformat = sdformat->format;
+	fmt = v4l2_subdev_state_get_opposite_stream_format(sd_state,
+							   sdformat->pad, 0);
+	*fmt = sdformat->format;
 
 	return 0;
 }
-- 
2.44.0





[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]

  Powered by Linux