[PATCH v3 2/2] media: nxp: Add i.MX9 CSI pixel formatter v4l2 driver
G.N. Zhou
guoniu.zhou at nxp.com
Sun Dec 21 19:29:10 PST 2025
Hi Frank,
Thanks for your review.
> -----Original Message-----
> From: Frank Li <frank.li at nxp.com>
> Sent: Saturday, December 20, 2025 12:08 AM
> To: G.N. Zhou (OSS) <guoniu.zhou at oss.nxp.com>
> Cc: Mauro Carvalho Chehab <mchehab at kernel.org>; Rob Herring
> <robh at kernel.org>; Krzysztof Kozlowski <krzk+dt at kernel.org>; Conor Dooley
> <conor+dt at kernel.org>; Shawn Guo <shawnguo at kernel.org>; Sascha Hauer
> <s.hauer at pengutronix.de>; Pengutronix Kernel Team
> <kernel at pengutronix.de>; Fabio Estevam <festevam at gmail.com>; Laurent
> Pinchart <laurent.pinchart at ideasonboard.com>; imx at lists.linux.dev; linux-
> media at vger.kernel.org; devicetree at vger.kernel.org; linux-arm-
> kernel at lists.infradead.org; linux-kernel at vger.kernel.org; G.N. Zhou
> <guoniu.zhou at nxp.com>
> Subject: Re: [PATCH v3 2/2] media: nxp: Add i.MX9 CSI pixel formatter v4l2
> driver
>
> On Fri, Dec 19, 2025 at 09:50:58AM +0800, Guoniu Zhou wrote:
> > From: Guoniu Zhou <guoniu.zhou at nxp.com>
> >
> > The CSI pixel formatter is a module found on i.MX95 used to reformat
> > packet info, pixel and non-pixel data from CSI-2 host controller to
> > match Pixel Link(PL) definition.
> >
> > Add data formatting support.
> >
> > Signed-off-by: Guoniu Zhou <guoniu.zhou at nxp.com>
> > ---
> > MAINTAINERS | 8 +
> > drivers/media/platform/nxp/Kconfig | 14 +
> > drivers/media/platform/nxp/Makefile | 1 +
> > drivers/media/platform/nxp/imx9-csi-formatter.c | 880
> > ++++++++++++++++++++++++
> > 4 files changed, 903 insertions(+)
> >
> > diff --git a/MAINTAINERS b/MAINTAINERS index
> >
> 4205ca007e076f869613032b51e8cc5bff06b98e..3878957b81156e5cb41da26
> 99b2f
> > 588e49521724 100644
> > --- a/MAINTAINERS
> > +++ b/MAINTAINERS
> > @@ -18626,6 +18626,14 @@ S: Maintained
> > F: Documentation/devicetree/bindings/media/nxp,imx8-jpeg.yaml
> > F: drivers/media/platform/nxp/imx-jpeg
> >
> > +NXP i.MX 9 CSI PIXEL FORMATTER V4L2 DRIVER
> > +M: Guoniu Zhou <guoniu.zhou at nxp.com>
> > +L: imx at lists.linux.dev
> > +L: linux-media at vger.kernel.org
> > +S: Maintained
> > +F: Documentation/devicetree/bindings/media/fsl,imx9-csi-formatter.yaml
> > +F: drivers/media/platform/nxp/imx9-csi-formatter.c
> > +
> > NXP i.MX CLOCK DRIVERS
> > M: Abel Vesa <abelvesa at kernel.org>
> > R: Peng Fan <peng.fan at nxp.com>
> > diff --git a/drivers/media/platform/nxp/Kconfig
> > b/drivers/media/platform/nxp/Kconfig
> > index
> >
> 40e3436669e213fdc5da70821dc0b420e1821f4f..a7bb62a2b0249659ffdfeac50
> fa4
> > 88aee9590a87 100644
> > --- a/drivers/media/platform/nxp/Kconfig
> > +++ b/drivers/media/platform/nxp/Kconfig
> > @@ -28,6 +28,20 @@ config VIDEO_IMX8MQ_MIPI_CSI2
> > Video4Linux2 driver for the MIPI CSI-2 receiver found on the i.MX8MQ
> > SoC.
> >
> > +config VIDEO_IMX9_CSI_FORMATTER
> > + tristate "NXP i.MX9 CSI Pixel Formatter driver"
> > + depends on ARCH_MXC || COMPILE_TEST
> > + depends on VIDEO_DEV
> > + select MEDIA_CONTROLLER
> > + select V4L2_FWNODE
> > + select VIDEO_V4L2_SUBDEV_API
> > + help
> > + This driver provides support for the CSI Pixel Formatter found on
> > + i.MX9 series SoC. This module unpacks the pixels received by the
> > + formatter and reformats them to meet the pixel link format
> requirement.
> > +
> > + Say Y here to enable CSI Pixel Formater module for i.MX9 SoC.
> > +
> > config VIDEO_IMX_MIPI_CSIS
> > tristate "NXP MIPI CSI-2 CSIS receiver found on i.MX7 and i.MX8
> models"
> > depends on ARCH_MXC || COMPILE_TEST
> > diff --git a/drivers/media/platform/nxp/Makefile
> > b/drivers/media/platform/nxp/Makefile
> > index
> >
> 4d90eb71365259ebdda84ea58483e1c4131d3ac7..39ba5660ba923141e7637b
> 01b5b3
> > 4a021dad7bb3 100644
> > --- a/drivers/media/platform/nxp/Makefile
> > +++ b/drivers/media/platform/nxp/Makefile
> > @@ -6,6 +6,7 @@ obj-y += imx8-isi/
> >
> > obj-$(CONFIG_VIDEO_IMX7_CSI) += imx7-media-csi.o
> > obj-$(CONFIG_VIDEO_IMX8MQ_MIPI_CSI2) += imx8mq-mipi-csi2.o
> > +obj-$(CONFIG_VIDEO_IMX9_CSI_FORMATTER) += imx9-csi-formatter.o
> > obj-$(CONFIG_VIDEO_IMX_MIPI_CSIS) += imx-mipi-csis.o
> > obj-$(CONFIG_VIDEO_IMX_PXP) += imx-pxp.o
> > obj-$(CONFIG_VIDEO_MX2_EMMAPRP) += mx2_emmaprp.o diff --git
> > a/drivers/media/platform/nxp/imx9-csi-formatter.c
> > b/drivers/media/platform/nxp/imx9-csi-formatter.c
> > new file mode 100644
> > index
> >
> 0000000000000000000000000000000000000000..5786e4690e31ee471caf82
> 01329c
> > 8e02a2cc0ee6
> > --- /dev/null
> > +++ b/drivers/media/platform/nxp/imx9-csi-formatter.c
> > @@ -0,0 +1,880 @@
> > +// SPDX-License-Identifier: GPL-2.0
> > +/*
> > + * Copyright 2025 NXP
> > + */
> > +
> ...
> > +
> > +static const struct dt_index formatter_dt_to_index_map[] = {
> > + { .dtype = MIPI_CSI2_DT_YUV420_8B, .index = 0 },
> > + { .dtype = MIPI_CSI2_DT_YUV420_8B_LEGACY, .index = 2 },
> > + { .dtype = MIPI_CSI2_DT_YUV422_8B, .index = 6 },
> > + { .dtype = MIPI_CSI2_DT_RGB444, .index = 8 },
> > + { .dtype = MIPI_CSI2_DT_RGB555, .index = 9 },
> > + { .dtype = MIPI_CSI2_DT_RGB565, .index = 10 },
> > + { .dtype = MIPI_CSI2_DT_RGB666, .index = 11 },
> > + { .dtype = MIPI_CSI2_DT_RGB888, .index = 12 },
> > + { .dtype = MIPI_CSI2_DT_RAW6, .index = 16 },
> > + { .dtype = MIPI_CSI2_DT_RAW7, .index = 17 },
> > + { .dtype = MIPI_CSI2_DT_RAW8, .index = 18 },
> > + { .dtype = MIPI_CSI2_DT_RAW10, .index = 19 },
> > + { .dtype = MIPI_CSI2_DT_RAW12, .index = 20 },
> > + { .dtype = MIPI_CSI2_DT_RAW14, .index = 21 },
> > + { .dtype = MIPI_CSI2_DT_RAW16, .index = 22 },
>
> what's these index value from? register bit?
Yes, they represent pixel data type for each virtual channel. You could refer to
i.MX95 RM Rev2 section "142.5.1.55 Table 913" for more details.
Best Regards
G.N Zhou
>
> Frank
> > +
> > +static u8 get_index_by_dt(u8 data_type) {
> > + unsigned int i;
> > +
> > + for (i = 0; i < ARRAY_SIZE(formatter_dt_to_index_map); ++i)
> > + if (data_type == formatter_dt_to_index_map[i].dtype)
> > + break;
> > +
> > + if (i == ARRAY_SIZE(formatter_dt_to_index_map))
> > + return formatter_dt_to_index_map[0].index;
> > +
> > + return formatter_dt_to_index_map[i].index;
> > +}
> > +
> ...
> >
> > --
> > 2.34.1
> >
More information about the linux-arm-kernel
mailing list