summaryrefslogtreecommitdiffstats
path: root/drivers/media/platform/nxp
diff options
context:
space:
mode:
authorAlexander Stein <alexander.stein@ew.tq-group.com>2023-04-19 09:07:09 +0200
committerHans Verkuil <hverkuil-cisco@xs4all.nl>2023-05-25 16:21:23 +0200
commit6f482c4729d9040945f6d1e7ca1171eba9b5a5d6 (patch)
treef471fca32f86ea4a9b46f34514e37ba2d3931159 /drivers/media/platform/nxp
parentmedia: hi846: fix usage of pm_runtime_get_if_in_use() (diff)
downloadlinux-6f482c4729d9040945f6d1e7ca1171eba9b5a5d6.tar.xz
linux-6f482c4729d9040945f6d1e7ca1171eba9b5a5d6.zip
media: imx: imx7-media-csi: Get rid of superfluous call to imx7_csi_mbus_fmt_to_pix_fmt
There is no need to convert input pixformat to mbus_framefmt and back again. Instead apply pixformat width constrains directly. Assign compose values before adjusting pixformat height/width. Signed-off-by: Alexander Stein <alexander.stein@ew.tq-group.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Diffstat (limited to 'drivers/media/platform/nxp')
-rw-r--r--drivers/media/platform/nxp/imx7-media-csi.c22
1 files changed, 15 insertions, 7 deletions
diff --git a/drivers/media/platform/nxp/imx7-media-csi.c b/drivers/media/platform/nxp/imx7-media-csi.c
index b701e823436a..b149374b07ee 100644
--- a/drivers/media/platform/nxp/imx7-media-csi.c
+++ b/drivers/media/platform/nxp/imx7-media-csi.c
@@ -1145,9 +1145,13 @@ static const struct imx7_csi_pixfmt *
__imx7_csi_video_try_fmt(struct v4l2_pix_format *pixfmt,
struct v4l2_rect *compose)
{
- struct v4l2_mbus_framefmt fmt_src;
const struct imx7_csi_pixfmt *cc;
+ if (compose) {
+ compose->width = pixfmt->width;
+ compose->height = pixfmt->height;
+ }
+
/*
* Find the pixel format, default to the first supported format if not
* found.
@@ -1172,13 +1176,17 @@ __imx7_csi_video_try_fmt(struct v4l2_pix_format *pixfmt,
}
}
- v4l2_fill_mbus_format(&fmt_src, pixfmt, 0);
- imx7_csi_mbus_fmt_to_pix_fmt(pixfmt, &fmt_src, cc);
+ /*
+ * Round up width for minimum burst size.
+ *
+ * TODO: Implement configurable stride support, and check what the real
+ * hardware alignment constraint on the width is.
+ */
+ v4l_bound_align_image(&pixfmt->width, 1, 0xffff, 8,
+ &pixfmt->height, 1, 0xffff, 1, 0);
- if (compose) {
- compose->width = fmt_src.width;
- compose->height = fmt_src.height;
- }
+ pixfmt->bytesperline = pixfmt->width * cc->bpp / 8;
+ pixfmt->sizeimage = pixfmt->bytesperline * pixfmt->height;
return cc;
}