[libcamera-devel] [PATCH 39/50] staging: media: imx: imx7-media-csi: Define macro for default mbus code
Laurent Pinchart
laurent.pinchart at ideasonboard.com
Tue May 10 13:51:36 CEST 2022
Define a macro for the default media bus code and use it through the
driver to replace a hardcoded value and a dynamic query from the
pixel_formats table.
Signed-off-by: Laurent Pinchart <laurent.pinchart at ideasonboard.com>
---
drivers/staging/media/imx/imx7-media-csi.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/staging/media/imx/imx7-media-csi.c b/drivers/staging/media/imx/imx7-media-csi.c
index bcf57aff3572..f2e85e9851e4 100644
--- a/drivers/staging/media/imx/imx7-media-csi.c
+++ b/drivers/staging/media/imx/imx7-media-csi.c
@@ -167,6 +167,7 @@
#define IMX7_CSI_VIDEO_MEM_LIMIT SZ_64M
#define IMX7_CSI_VIDEO_EOF_TIMEOUT 2000
+#define IMX7_CSI_DEF_MBUS_CODE MEDIA_BUS_FMT_UYVY8_2X8
#define IMX7_CSI_DEF_PIX_WIDTH 640
#define IMX7_CSI_DEF_PIX_HEIGHT 480
@@ -1096,7 +1097,7 @@ static int imx7_csi_init_mbus_fmt(struct v4l2_mbus_framefmt *mbus,
mbus->field = field;
if (code == 0)
- imx7_csi_enum_mbus_formats(&code, 0, IMX7_CSI_PIXFMT_SEL_YUV);
+ code = IMX7_CSI_DEF_MBUS_CODE;
lcc = imx7_csi_find_mbus_format(code, IMX7_CSI_PIXFMT_SEL_ANY);
if (!lcc)
@@ -1629,7 +1630,7 @@ static int imx7_csi_video_init_format(struct imx7_csi *csi)
.pad = IMX7_CSI_PAD_SRC,
.which = V4L2_SUBDEV_FORMAT_ACTIVE,
};
- fmt_src.format.code = MEDIA_BUS_FMT_UYVY8_2X8;
+ fmt_src.format.code = IMX7_CSI_DEF_MBUS_CODE;
fmt_src.format.width = IMX7_CSI_DEF_PIX_WIDTH;
fmt_src.format.height = IMX7_CSI_DEF_PIX_HEIGHT;
--
Regards,
Laurent Pinchart
More information about the libcamera-devel
mailing list