diff mbox series

[v2,3/3] media: imx: imx7-media-csi: Lift width constraints for 8bpp formats

Message ID 20230418071439.197735-4-alexander.stein@ew.tq-group.com
State New
Headers show
Series Fix imx7-media-csi format settings | expand

Commit Message

Alexander Stein April 18, 2023, 7:14 a.m. UTC
For 8-bit formats the image_width just needs to be a multiple of 4 pixels.

Signed-off-by: Alexander Stein <alexander.stein@ew.tq-group.com>
---
 drivers/media/platform/nxp/imx7-media-csi.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/drivers/media/platform/nxp/imx7-media-csi.c b/drivers/media/platform/nxp/imx7-media-csi.c
index 1508f6ba20e91..5240670476b2b 100644
--- a/drivers/media/platform/nxp/imx7-media-csi.c
+++ b/drivers/media/platform/nxp/imx7-media-csi.c
@@ -1147,6 +1147,7 @@  __imx7_csi_video_try_fmt(struct v4l2_pix_format *pixfmt,
 {
 	const struct imx7_csi_pixfmt *cc;
 	u32 stride;
+	u32 walign;
 
 	/*
 	 * Find the pixel format, default to the first supported format if not
@@ -1172,7 +1173,13 @@  __imx7_csi_video_try_fmt(struct v4l2_pix_format *pixfmt,
 		}
 	}
 
-	v4l_bound_align_image(&pixfmt->width, 1, 0xffff, 8,
+	/* Refer to CSI_IMAG_PARA.IMAGE_WIDTH description */
+	if (cc->bpp == 8)
+		walign = 8;
+	else
+		walign = 4;
+
+	v4l_bound_align_image(&pixfmt->width, 1, 0xffff, walign,
 			      &pixfmt->height, 1, 0xffff, 1, 0);
 
 	stride = round_up((pixfmt->width * cc->bpp) / 8, 8);