* [PATCH v3 0/3] media: imx8mq-mipi-csi2: Enhance the driver to meet more usage case @ 2025-08-12 9:18 guoniu.zhou 2025-08-12 9:18 ` [PATCH v3 1/3] media: imx8mq-mipi-csi2: Add data type field in pixel format guoniu.zhou ` (3 more replies) 0 siblings, 4 replies; 6+ messages in thread From: guoniu.zhou @ 2025-08-12 9:18 UTC (permalink / raw) To: linux-media, devicetree, imx, linux-arm-kernel, linux-kernel Cc: rmfrfs, laurent.pinchart, martink, kernel, mchehab, robh, krzk+dt, conor+dt, shawnguo, s.hauer, kernel, festevam, frank.li From: Guoniu Zhou <guoniu.zhou@nxp.com> The bellow miscellaneous patches enhance the driver to meet more usage case, such as i.MX8ULP. Changes in v3: - Modify cover letter file to include history info. Changes in v2: - Remove duplicated Signed-off-by tag. - Link to v1: https://lore.kernel.org/all/20250717071359.1910515-1-guoniu.zhou@oss.nxp.com Guoniu Zhou (3): media: imx8mq-mipi-csi2: Add data type field in pixel format media: imx8mq-mipi-csi2: Add RGB format support media: imx8mq-mipi-csi2: Implement .get_frame_desc subdev callback drivers/media/platform/nxp/imx8mq-mipi-csi2.c | 65 +++++++++++++++++++ 1 file changed, 65 insertions(+) -- base-commit: d968e50b5c26642754492dea23cbd3592bde62d8 -- 2.34.1 ^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH v3 1/3] media: imx8mq-mipi-csi2: Add data type field in pixel format 2025-08-12 9:18 [PATCH v3 0/3] media: imx8mq-mipi-csi2: Enhance the driver to meet more usage case guoniu.zhou @ 2025-08-12 9:18 ` guoniu.zhou 2025-08-12 16:13 ` Frank Li 2025-08-12 9:18 ` [PATCH v3 2/3] media: imx8mq-mipi-csi2: Add RGB format support guoniu.zhou ` (2 subsequent siblings) 3 siblings, 1 reply; 6+ messages in thread From: guoniu.zhou @ 2025-08-12 9:18 UTC (permalink / raw) To: linux-media, devicetree, imx, linux-arm-kernel, linux-kernel Cc: rmfrfs, laurent.pinchart, martink, kernel, mchehab, robh, krzk+dt, conor+dt, shawnguo, s.hauer, kernel, festevam, frank.li From: Guoniu Zhou <guoniu.zhou@nxp.com> Add data type field in CSI pixel format info since the downstream subdev in the pipeline need to know. Signed-off-by: Guoniu Zhou <guoniu.zhou@nxp.com> --- drivers/media/platform/nxp/imx8mq-mipi-csi2.c | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/drivers/media/platform/nxp/imx8mq-mipi-csi2.c b/drivers/media/platform/nxp/imx8mq-mipi-csi2.c index 3a4645f59a44..7495400adc22 100644 --- a/drivers/media/platform/nxp/imx8mq-mipi-csi2.c +++ b/drivers/media/platform/nxp/imx8mq-mipi-csi2.c @@ -25,6 +25,7 @@ #include <linux/reset.h> #include <linux/spinlock.h> +#include <media/mipi-csi2.h> #include <media/v4l2-common.h> #include <media/v4l2-device.h> #include <media/v4l2-fwnode.h> @@ -138,6 +139,7 @@ struct csi_state { struct csi2_pix_format { u32 code; + u32 data_type; u8 width; }; @@ -262,68 +264,89 @@ static const struct csi2_pix_format imx8mq_mipi_csi_formats[] = { /* RAW (Bayer and greyscale) formats. */ { .code = MEDIA_BUS_FMT_SBGGR8_1X8, + .data_type = MIPI_CSI2_DT_RAW8, .width = 8, }, { .code = MEDIA_BUS_FMT_SGBRG8_1X8, + .data_type = MIPI_CSI2_DT_RAW8, .width = 8, }, { .code = MEDIA_BUS_FMT_SGRBG8_1X8, + .data_type = MIPI_CSI2_DT_RAW8, .width = 8, }, { .code = MEDIA_BUS_FMT_SRGGB8_1X8, + .data_type = MIPI_CSI2_DT_RAW8, .width = 8, }, { .code = MEDIA_BUS_FMT_Y8_1X8, + .data_type = MIPI_CSI2_DT_RAW8, .width = 8, }, { .code = MEDIA_BUS_FMT_SBGGR10_1X10, + .data_type = MIPI_CSI2_DT_RAW10, .width = 10, }, { .code = MEDIA_BUS_FMT_SGBRG10_1X10, + .data_type = MIPI_CSI2_DT_RAW10, .width = 10, }, { .code = MEDIA_BUS_FMT_SGRBG10_1X10, + .data_type = MIPI_CSI2_DT_RAW10, .width = 10, }, { .code = MEDIA_BUS_FMT_SRGGB10_1X10, + .data_type = MIPI_CSI2_DT_RAW10, .width = 10, }, { .code = MEDIA_BUS_FMT_Y10_1X10, + .data_type = MIPI_CSI2_DT_RAW10, .width = 10, }, { .code = MEDIA_BUS_FMT_SBGGR12_1X12, + .data_type = MIPI_CSI2_DT_RAW12, .width = 12, }, { .code = MEDIA_BUS_FMT_SGBRG12_1X12, + .data_type = MIPI_CSI2_DT_RAW12, .width = 12, }, { .code = MEDIA_BUS_FMT_SGRBG12_1X12, + .data_type = MIPI_CSI2_DT_RAW12, .width = 12, }, { .code = MEDIA_BUS_FMT_SRGGB12_1X12, + .data_type = MIPI_CSI2_DT_RAW12, .width = 12, }, { .code = MEDIA_BUS_FMT_Y12_1X12, + .data_type = MIPI_CSI2_DT_RAW12, .width = 12, }, { .code = MEDIA_BUS_FMT_SBGGR14_1X14, + .data_type = MIPI_CSI2_DT_RAW14, .width = 14, }, { .code = MEDIA_BUS_FMT_SGBRG14_1X14, + .data_type = MIPI_CSI2_DT_RAW14, .width = 14, }, { .code = MEDIA_BUS_FMT_SGRBG14_1X14, + .data_type = MIPI_CSI2_DT_RAW14, .width = 14, }, { .code = MEDIA_BUS_FMT_SRGGB14_1X14, + .data_type = MIPI_CSI2_DT_RAW14, .width = 14, }, /* YUV formats */ { .code = MEDIA_BUS_FMT_YUYV8_1X16, + .data_type = MIPI_CSI2_DT_YUV422_8B, .width = 16, }, { .code = MEDIA_BUS_FMT_UYVY8_1X16, + .data_type = MIPI_CSI2_DT_YUV422_8B, .width = 16, } }; -- 2.34.1 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH v3 1/3] media: imx8mq-mipi-csi2: Add data type field in pixel format 2025-08-12 9:18 ` [PATCH v3 1/3] media: imx8mq-mipi-csi2: Add data type field in pixel format guoniu.zhou @ 2025-08-12 16:13 ` Frank Li 0 siblings, 0 replies; 6+ messages in thread From: Frank Li @ 2025-08-12 16:13 UTC (permalink / raw) To: guoniu.zhou Cc: linux-media, devicetree, imx, linux-arm-kernel, linux-kernel, rmfrfs, laurent.pinchart, martink, kernel, mchehab, robh, krzk+dt, conor+dt, shawnguo, s.hauer, kernel, festevam On Tue, Aug 12, 2025 at 05:18:55PM +0800, guoniu.zhou@oss.nxp.com wrote: > From: Guoniu Zhou <guoniu.zhou@nxp.com> > > Add data type field in CSI pixel format info since the downstream > subdev in the pipeline need to know. > > Signed-off-by: Guoniu Zhou <guoniu.zhou@nxp.com> > --- > drivers/media/platform/nxp/imx8mq-mipi-csi2.c | 23 +++++++++++++++++++ > 1 file changed, 23 insertions(+) > > diff --git a/drivers/media/platform/nxp/imx8mq-mipi-csi2.c b/drivers/media/platform/nxp/imx8mq-mipi-csi2.c > index 3a4645f59a44..7495400adc22 100644 > --- a/drivers/media/platform/nxp/imx8mq-mipi-csi2.c > +++ b/drivers/media/platform/nxp/imx8mq-mipi-csi2.c > @@ -25,6 +25,7 @@ > #include <linux/reset.h> > #include <linux/spinlock.h> > > +#include <media/mipi-csi2.h> > #include <media/v4l2-common.h> > #include <media/v4l2-device.h> > #include <media/v4l2-fwnode.h> > @@ -138,6 +139,7 @@ struct csi_state { > > struct csi2_pix_format { > u32 code; > + u32 data_type; > u8 width; > }; > > @@ -262,68 +264,89 @@ static const struct csi2_pix_format imx8mq_mipi_csi_formats[] = { > /* RAW (Bayer and greyscale) formats. */ > { > .code = MEDIA_BUS_FMT_SBGGR8_1X8, > + .data_type = MIPI_CSI2_DT_RAW8, CSI2 data type is well defined in MIPI CSI2 spec. so the convertion from media_bus_fmt to CSI2 DT is fixed patten for all CSI2 drivers. I post one patch at https://lore.kernel.org/imx/20250808-95_cam-v2-4-4b29fa6919a7@nxp.com/ helper funciton media_bus_fmt_to_csi2_dt(.code) to get CSI2 data type. Laurent Pinchart have not time to review patch until sept 8. I hope first 3 patches can be reviewed and merged soon if they agree this methods. also .width can be removed. Frank > .width = 8, > }, { > .code = MEDIA_BUS_FMT_SGBRG8_1X8, > + .data_type = MIPI_CSI2_DT_RAW8, > .width = 8, > }, { > .code = MEDIA_BUS_FMT_SGRBG8_1X8, > + .data_type = MIPI_CSI2_DT_RAW8, > .width = 8, > }, { > .code = MEDIA_BUS_FMT_SRGGB8_1X8, > + .data_type = MIPI_CSI2_DT_RAW8, > .width = 8, > }, { > .code = MEDIA_BUS_FMT_Y8_1X8, > + .data_type = MIPI_CSI2_DT_RAW8, > .width = 8, > }, { > .code = MEDIA_BUS_FMT_SBGGR10_1X10, > + .data_type = MIPI_CSI2_DT_RAW10, > .width = 10, > }, { > .code = MEDIA_BUS_FMT_SGBRG10_1X10, > + .data_type = MIPI_CSI2_DT_RAW10, > .width = 10, > }, { > .code = MEDIA_BUS_FMT_SGRBG10_1X10, > + .data_type = MIPI_CSI2_DT_RAW10, > .width = 10, > }, { > .code = MEDIA_BUS_FMT_SRGGB10_1X10, > + .data_type = MIPI_CSI2_DT_RAW10, > .width = 10, > }, { > .code = MEDIA_BUS_FMT_Y10_1X10, > + .data_type = MIPI_CSI2_DT_RAW10, > .width = 10, > }, { > .code = MEDIA_BUS_FMT_SBGGR12_1X12, > + .data_type = MIPI_CSI2_DT_RAW12, > .width = 12, > }, { > .code = MEDIA_BUS_FMT_SGBRG12_1X12, > + .data_type = MIPI_CSI2_DT_RAW12, > .width = 12, > }, { > .code = MEDIA_BUS_FMT_SGRBG12_1X12, > + .data_type = MIPI_CSI2_DT_RAW12, > .width = 12, > }, { > .code = MEDIA_BUS_FMT_SRGGB12_1X12, > + .data_type = MIPI_CSI2_DT_RAW12, > .width = 12, > }, { > .code = MEDIA_BUS_FMT_Y12_1X12, > + .data_type = MIPI_CSI2_DT_RAW12, > .width = 12, > }, { > .code = MEDIA_BUS_FMT_SBGGR14_1X14, > + .data_type = MIPI_CSI2_DT_RAW14, > .width = 14, > }, { > .code = MEDIA_BUS_FMT_SGBRG14_1X14, > + .data_type = MIPI_CSI2_DT_RAW14, > .width = 14, > }, { > .code = MEDIA_BUS_FMT_SGRBG14_1X14, > + .data_type = MIPI_CSI2_DT_RAW14, > .width = 14, > }, { > .code = MEDIA_BUS_FMT_SRGGB14_1X14, > + .data_type = MIPI_CSI2_DT_RAW14, > .width = 14, > }, > /* YUV formats */ > { > .code = MEDIA_BUS_FMT_YUYV8_1X16, > + .data_type = MIPI_CSI2_DT_YUV422_8B, > .width = 16, > }, { > .code = MEDIA_BUS_FMT_UYVY8_1X16, > + .data_type = MIPI_CSI2_DT_YUV422_8B, > .width = 16, > } > }; > -- > 2.34.1 > ^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH v3 2/3] media: imx8mq-mipi-csi2: Add RGB format support 2025-08-12 9:18 [PATCH v3 0/3] media: imx8mq-mipi-csi2: Enhance the driver to meet more usage case guoniu.zhou 2025-08-12 9:18 ` [PATCH v3 1/3] media: imx8mq-mipi-csi2: Add data type field in pixel format guoniu.zhou @ 2025-08-12 9:18 ` guoniu.zhou 2025-08-12 9:18 ` [PATCH v3 3/3] media: imx8mq-mipi-csi2: Implement .get_frame_desc subdev callback guoniu.zhou 2025-08-12 9:23 ` [PATCH v3 0/3] media: imx8mq-mipi-csi2: Enhance the driver to meet more usage case Krzysztof Kozlowski 3 siblings, 0 replies; 6+ messages in thread From: guoniu.zhou @ 2025-08-12 9:18 UTC (permalink / raw) To: linux-media, devicetree, imx, linux-arm-kernel, linux-kernel Cc: rmfrfs, laurent.pinchart, martink, kernel, mchehab, robh, krzk+dt, conor+dt, shawnguo, s.hauer, kernel, festevam, frank.li From: Guoniu Zhou <guoniu.zhou@nxp.com> Add format RGB565 and RGB24 support. Signed-off-by: Guoniu Zhou <guoniu.zhou@nxp.com> --- drivers/media/platform/nxp/imx8mq-mipi-csi2.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/drivers/media/platform/nxp/imx8mq-mipi-csi2.c b/drivers/media/platform/nxp/imx8mq-mipi-csi2.c index 7495400adc22..3de9007ad122 100644 --- a/drivers/media/platform/nxp/imx8mq-mipi-csi2.c +++ b/drivers/media/platform/nxp/imx8mq-mipi-csi2.c @@ -348,6 +348,16 @@ static const struct csi2_pix_format imx8mq_mipi_csi_formats[] = { .code = MEDIA_BUS_FMT_UYVY8_1X16, .data_type = MIPI_CSI2_DT_YUV422_8B, .width = 16, + }, + /* RGB formats. */ + { + .code = MEDIA_BUS_FMT_RGB565_1X16, + .data_type = MIPI_CSI2_DT_RGB565, + .width = 16, + }, { + .code = MEDIA_BUS_FMT_BGR888_1X24, + .data_type = MIPI_CSI2_DT_RGB888, + .width = 24, } }; -- 2.34.1 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH v3 3/3] media: imx8mq-mipi-csi2: Implement .get_frame_desc subdev callback 2025-08-12 9:18 [PATCH v3 0/3] media: imx8mq-mipi-csi2: Enhance the driver to meet more usage case guoniu.zhou 2025-08-12 9:18 ` [PATCH v3 1/3] media: imx8mq-mipi-csi2: Add data type field in pixel format guoniu.zhou 2025-08-12 9:18 ` [PATCH v3 2/3] media: imx8mq-mipi-csi2: Add RGB format support guoniu.zhou @ 2025-08-12 9:18 ` guoniu.zhou 2025-08-12 9:23 ` [PATCH v3 0/3] media: imx8mq-mipi-csi2: Enhance the driver to meet more usage case Krzysztof Kozlowski 3 siblings, 0 replies; 6+ messages in thread From: guoniu.zhou @ 2025-08-12 9:18 UTC (permalink / raw) To: linux-media, devicetree, imx, linux-arm-kernel, linux-kernel Cc: rmfrfs, laurent.pinchart, martink, kernel, mchehab, robh, krzk+dt, conor+dt, shawnguo, s.hauer, kernel, festevam, frank.li From: Guoniu Zhou <guoniu.zhou@nxp.com> Implement .get_frame_desc subdev callback since downstream subdev need to get frame description. Signed-off-by: Guoniu Zhou <guoniu.zhou@nxp.com> --- drivers/media/platform/nxp/imx8mq-mipi-csi2.c | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/drivers/media/platform/nxp/imx8mq-mipi-csi2.c b/drivers/media/platform/nxp/imx8mq-mipi-csi2.c index 3de9007ad122..ed6578f7f0f9 100644 --- a/drivers/media/platform/nxp/imx8mq-mipi-csi2.c +++ b/drivers/media/platform/nxp/imx8mq-mipi-csi2.c @@ -689,6 +689,37 @@ static int imx8mq_mipi_csi_set_fmt(struct v4l2_subdev *sd, return 0; } +static int imx8mq_mipi_csi_get_frame_desc(struct v4l2_subdev *sd, + unsigned int pad, + struct v4l2_mbus_frame_desc *fd) +{ + struct v4l2_mbus_frame_desc_entry *entry = &fd->entry[0]; + const struct csi2_pix_format *csi2_fmt; + const struct v4l2_mbus_framefmt *fmt; + struct v4l2_subdev_state *state; + + if (pad != MIPI_CSI2_PAD_SOURCE) + return -EINVAL; + + state = v4l2_subdev_lock_and_get_active_state(sd); + fmt = v4l2_subdev_state_get_format(state, MIPI_CSI2_PAD_SOURCE); + csi2_fmt = find_csi2_format(fmt->code); + v4l2_subdev_unlock_state(state); + + if (!csi2_fmt) + return -EPIPE; + + fd->type = V4L2_MBUS_FRAME_DESC_TYPE_CSI2; + fd->num_entries = 1; + + entry->flags = 0; + entry->pixelcode = csi2_fmt->code; + entry->bus.csi2.vc = 0; + entry->bus.csi2.dt = csi2_fmt->data_type; + + return 0; +} + static const struct v4l2_subdev_video_ops imx8mq_mipi_csi_video_ops = { .s_stream = imx8mq_mipi_csi_s_stream, }; @@ -697,6 +728,7 @@ static const struct v4l2_subdev_pad_ops imx8mq_mipi_csi_pad_ops = { .enum_mbus_code = imx8mq_mipi_csi_enum_mbus_code, .get_fmt = v4l2_subdev_get_fmt, .set_fmt = imx8mq_mipi_csi_set_fmt, + .get_frame_desc = imx8mq_mipi_csi_get_frame_desc, }; static const struct v4l2_subdev_ops imx8mq_mipi_csi_subdev_ops = { -- 2.34.1 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH v3 0/3] media: imx8mq-mipi-csi2: Enhance the driver to meet more usage case 2025-08-12 9:18 [PATCH v3 0/3] media: imx8mq-mipi-csi2: Enhance the driver to meet more usage case guoniu.zhou ` (2 preceding siblings ...) 2025-08-12 9:18 ` [PATCH v3 3/3] media: imx8mq-mipi-csi2: Implement .get_frame_desc subdev callback guoniu.zhou @ 2025-08-12 9:23 ` Krzysztof Kozlowski 3 siblings, 0 replies; 6+ messages in thread From: Krzysztof Kozlowski @ 2025-08-12 9:23 UTC (permalink / raw) To: guoniu.zhou, linux-media, devicetree, imx, linux-arm-kernel, linux-kernel Cc: rmfrfs, laurent.pinchart, martink, kernel, mchehab, robh, krzk+dt, conor+dt, shawnguo, s.hauer, kernel, festevam, frank.li On 12/08/2025 11:18, guoniu.zhou@oss.nxp.com wrote: > From: Guoniu Zhou <guoniu.zhou@nxp.com> > > The bellow miscellaneous patches enhance the driver to meet more > usage case, such as i.MX8ULP. > > Changes in v3: > - Modify cover letter file to include history info. > > Changes in v2: > - Remove duplicated Signed-off-by tag. > - Link to v1: https://lore.kernel.org/all/20250717071359.1910515-1-guoniu.zhou@oss.nxp.com Please slow down. You just sent it, I already replied in private, which you ignored, and send a v3. No. One patchset per day. Read the feedback you receive. Best regards, Krzysztof ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2025-08-12 16:13 UTC | newest] Thread overview: 6+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2025-08-12 9:18 [PATCH v3 0/3] media: imx8mq-mipi-csi2: Enhance the driver to meet more usage case guoniu.zhou 2025-08-12 9:18 ` [PATCH v3 1/3] media: imx8mq-mipi-csi2: Add data type field in pixel format guoniu.zhou 2025-08-12 16:13 ` Frank Li 2025-08-12 9:18 ` [PATCH v3 2/3] media: imx8mq-mipi-csi2: Add RGB format support guoniu.zhou 2025-08-12 9:18 ` [PATCH v3 3/3] media: imx8mq-mipi-csi2: Implement .get_frame_desc subdev callback guoniu.zhou 2025-08-12 9:23 ` [PATCH v3 0/3] media: imx8mq-mipi-csi2: Enhance the driver to meet more usage case Krzysztof Kozlowski
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).