media: imx: imx7-media-csi: Fix applying format constraints
authorFabio Estevam <festevam@denx.de>
Tue, 25 Jul 2023 19:14:45 +0000 (21:14 +0200)
committerMauro Carvalho Chehab <mchehab@kernel.org>
Wed, 9 Aug 2023 11:31:37 +0000 (13:31 +0200)
commit2908042a37b56d6a9a595eca946e187e9d2df39a
treebbb8461c8d7fa99735d6d9832a9513176b70307b
parent6d00f4ec1205a01a6aac1fe3ce04d53a6b2ede59
media: imx: imx7-media-csi: Fix applying format constraints

v4l_bound_align_image() aligns to a multiple of 2 to the power of
walign, not to walign. Depending on the pixel format, this causes the
image width to be aligned to 16 or 256 pixels instead of 4 or 8 as
required by the hardware. Fix it by rounding and clamping the width and
height manually.

Closes: https://lore.kernel.org/linux-media/CAJ+vNU0BOVLTL17ofgHwtexbpuMYwH_aGUC==EXABUtHHiv_ag@mail.gmail.com

Reported-by: Tim Harvey <tharvey@gateworks.com>
Fixes: 6f482c4729d9 ("media: imx: imx7-media-csi: Get rid of superfluous call to imx7_csi_mbus_fmt_to_pix_fmt")
Co-developed-by: Alexander Stein <alexander.stein@ew.tq-group.com>
Signed-off-by: Alexander Stein <alexander.stein@ew.tq-group.com>
Signed-off-by: Fabio Estevam <festevam@denx.de>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
drivers/media/platform/nxp/imx7-media-csi.c