Hello Laurent, Am Dienstag, 10. Mai 2022, 13:58:48 CEST schrieb Laurent Pinchart: > 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@xxxxxxxxxxxxxxxx> > --- > 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; This change assumes, like before, that MEDIA_BUS_FMT_UYVY8_2X8 is the 1st code in the 1st entry in pixel_formats. Maybe a comment is helpful to indicate that. Regards, Alexander