Commit bef1bb62 authored by Alexander Stein's avatar Alexander Stein Committed by Hans Verkuil
Browse files

media: imx: imx7-media-csi: Relax width constraints for non-8bpp formats



The driver unconditionally aligns the image width to multiples of 8
pixels. The real alignment constraint is 8 bytes, as indicated by the
CSI_IMAG_PARA.IMAGE_WIDTH documentation that calls for 8 pixel alignment
for 8bpp formats and 4 pixel alignment for other formats.

Signed-off-by: default avatarAlexander Stein <alexander.stein@ew.tq-group.com>
Reviewed-by: default avatarLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: default avatarSakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: default avatarHans Verkuil <hverkuil-cisco@xs4all.nl>
parent 79bb4c7d
Loading
Loading
Loading
Loading
+6 −4
Original line number Diff line number Diff line
@@ -1146,6 +1146,7 @@ __imx7_csi_video_try_fmt(struct v4l2_pix_format *pixfmt,
			 struct v4l2_rect *compose)
{
	const struct imx7_csi_pixfmt *cc;
	u32 walign;

	if (compose) {
		compose->width = pixfmt->width;
@@ -1163,12 +1164,13 @@ __imx7_csi_video_try_fmt(struct v4l2_pix_format *pixfmt,
	}

	/*
	 * Round up width for minimum burst size.
	 * The width alignment is 8 bytes as indicated by the
	 * CSI_IMAG_PARA.IMAGE_WIDTH documentation. Convert it to pixels.
	 *
	 * TODO: Implement configurable stride support, and check what the real
	 * hardware alignment constraint on the width is.
	 * TODO: Implement configurable stride support.
	 */
	v4l_bound_align_image(&pixfmt->width, 1, 0xffff, 8,
	walign = 8 * 8 / cc->bpp;
	v4l_bound_align_image(&pixfmt->width, 1, 0xffff, walign,
			      &pixfmt->height, 1, 0xffff, 1, 0);

	pixfmt->bytesperline = pixfmt->width * cc->bpp / 8;