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

Alexander Stein alexander.stein at ew.tq-group.com
Tue Apr 18 00:14:39 PDT 2023


For 8-bit formats the image_width just needs to be a multiple of 4 pixels.

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

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);
-- 
2.34.1




More information about the linux-arm-kernel mailing list