[PATCH] media: imx: Round line size to 4 bytes

From: Dorota Czaplejewicz
Date: Wed Oct 06 2021 - 07:06:33 EST


Section 13.7.6.13 "CSI Image Parameter Register" of the
i.MX 8M Quad Applications Processors Reference Manual
states that the line size should be divisible by 8 bytes.
However, the hardware also accepts sizes divisible by 4 bytes.

This patch accepts line sizes divisible 4-bytes in non-planar mode.

Signed-off-by: Dorota Czaplejewicz <dorota.czaplejewicz@xxxxxxx>
---

Hello,

my previous patch identified something that was not a problem,
so I'm sending a different one.

This has been tested on the Librem 5.

Cheers,
Dorota

drivers/staging/media/imx/imx-media-utils.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/media/imx/imx-media-utils.c b/drivers/staging/media/imx/imx-media-utils.c
index 5128915a5d6f..a303003929e3 100644
--- a/drivers/staging/media/imx/imx-media-utils.c
+++ b/drivers/staging/media/imx/imx-media-utils.c
@@ -545,13 +545,13 @@ int imx_media_mbus_fmt_to_pix_fmt(struct v4l2_pix_format *pix,
}

/* Round up width for minimum burst size */
- width = round_up(mbus->width, 8);
+ width = round_up(mbus->width, 4);

/* Round up stride for IDMAC line start address alignment */
if (cc->planar)
stride = round_up(width, 16);
else
- stride = round_up((width * cc->bpp) >> 3, 8);
+ stride = round_up((width * cc->bpp) >> 3, 4);

pix->width = width;
pix->height = mbus->height;
--
2.31.1

Attachment: pgpLesrY_oaHK.pgp
Description: OpenPGP digital signature