imx.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
* [PATCH v4 0/4] media: imx8mq-mipi-csi2: Enhance the driver to meet more usage case
@ 2025-08-19  3:57 Guoniu Zhou
  2025-08-19  3:58 ` [PATCH v4 1/4] media: imx8mq-mipi-csi2: Remove width field in csi2_pix_format Guoniu Zhou
                   ` (4 more replies)
  0 siblings, 5 replies; 7+ messages in thread
From: Guoniu Zhou @ 2025-08-19  3:57 UTC (permalink / raw)
  To: Rui Miguel Silva, Laurent Pinchart, Martin Kepplinger,
	Purism Kernel Team, Mauro Carvalho Chehab, Shawn Guo,
	Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam
  Cc: linux-media, imx, linux-arm-kernel, linux-kernel, Frank Li,
	Guoniu Zhou

The bellow miscellaneous patches enhance the driver to meet more
usage case, such as i.MX8ULP.

Changes in v4:
- Remove patch 1 in v3.
- Add two new patches(patch 1 and 2).
- Use helper function media_bus_fmt_to_csi2_bpp() in patch 1.
- Use helper function media_bus_fmt_to_csi2_dt() in patch 4.
- Link to v3: https://lore.kernel.org/all/20250812091856.1036170-1-guoniu.zhou@oss.nxp.com

Changes in v3:
- Modify cover letter file to include history info.
- Link to v2: https://lore.kernel.org/all/20250812090843.1035800-1-guoniu.zhou@oss.nxp.com

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 (4):
  media: imx8mq-mipi-csi2: Remove width field in csi2_pix_format
  media: imx8mq-mipi-csi2: Add output filed in csi2_pix_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(+)

--
2.34.1

---
Guoniu Zhou (4):
      media: imx8mq-mipi-csi2: Remove width field in csi2_pix_format
      media: imx8mq-mipi-csi2: Add output filed in csi2_pix_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 | 94 ++++++++++++++++++++-------
 1 file changed, 70 insertions(+), 24 deletions(-)
---
base-commit: 8f5ae30d69d7543eee0d70083daf4de8fe15d585
change-id: 20250818-csi2_imx8mq-59464599858b
prerequisite-patch-id: 508b25bf601f2d069f16918ac44824ef2ee3cd45
prerequisite-patch-id: 8b40bfd4a8fa73b38acd53809f88508a5ad437f1

Best regards,
-- 
Guoniu Zhou <guoniu.zhou@nxp.com>


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH v4 1/4] media: imx8mq-mipi-csi2: Remove width field in csi2_pix_format
  2025-08-19  3:57 [PATCH v4 0/4] media: imx8mq-mipi-csi2: Enhance the driver to meet more usage case Guoniu Zhou
@ 2025-08-19  3:58 ` Guoniu Zhou
  2025-08-19  3:58 ` [PATCH v4 2/4] media: imx8mq-mipi-csi2: Add output filed " Guoniu Zhou
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 7+ messages in thread
From: Guoniu Zhou @ 2025-08-19  3:58 UTC (permalink / raw)
  To: Rui Miguel Silva, Laurent Pinchart, Martin Kepplinger,
	Purism Kernel Team, Mauro Carvalho Chehab, Shawn Guo,
	Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam
  Cc: linux-media, imx, linux-arm-kernel, linux-kernel, Frank Li,
	Guoniu Zhou

Simplify the code by using helper function media_bus_fmt_to_csi2_bpp()
to get width for supported format.

No functions changed.

Signed-off-by: Guoniu Zhou <guoniu.zhou@nxp.com>
---
 drivers/media/platform/nxp/imx8mq-mipi-csi2.c | 29 +++++----------------------
 1 file changed, 5 insertions(+), 24 deletions(-)

diff --git a/drivers/media/platform/nxp/imx8mq-mipi-csi2.c b/drivers/media/platform/nxp/imx8mq-mipi-csi2.c
index 3a4645f59a44028fdca82a4d8393e1a0a6ba88f0..85700655ecad334c61e9b5f9f073e10b6db2618f 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,7 +139,6 @@ struct csi_state {
 
 struct csi2_pix_format {
 	u32 code;
-	u8 width;
 };
 
 /* -----------------------------------------------------------------------------
@@ -262,70 +262,49 @@ static const struct csi2_pix_format imx8mq_mipi_csi_formats[] = {
 	/* RAW (Bayer and greyscale) formats. */
 	{
 		.code = MEDIA_BUS_FMT_SBGGR8_1X8,
-		.width = 8,
 	}, {
 		.code = MEDIA_BUS_FMT_SGBRG8_1X8,
-		.width = 8,
 	}, {
 		.code = MEDIA_BUS_FMT_SGRBG8_1X8,
-		.width = 8,
 	}, {
 		.code = MEDIA_BUS_FMT_SRGGB8_1X8,
-		.width = 8,
 	}, {
 		.code = MEDIA_BUS_FMT_Y8_1X8,
-		.width = 8,
 	}, {
 		.code = MEDIA_BUS_FMT_SBGGR10_1X10,
-		.width = 10,
 	}, {
 		.code = MEDIA_BUS_FMT_SGBRG10_1X10,
-		.width = 10,
 	}, {
 		.code = MEDIA_BUS_FMT_SGRBG10_1X10,
-		.width = 10,
 	}, {
 		.code = MEDIA_BUS_FMT_SRGGB10_1X10,
-		.width = 10,
 	}, {
 		.code = MEDIA_BUS_FMT_Y10_1X10,
-		.width = 10,
 	}, {
 		.code = MEDIA_BUS_FMT_SBGGR12_1X12,
-		.width = 12,
 	}, {
 		.code = MEDIA_BUS_FMT_SGBRG12_1X12,
-		.width = 12,
 	}, {
 		.code = MEDIA_BUS_FMT_SGRBG12_1X12,
-		.width = 12,
 	}, {
 		.code = MEDIA_BUS_FMT_SRGGB12_1X12,
-		.width = 12,
 	}, {
 		.code = MEDIA_BUS_FMT_Y12_1X12,
-		.width = 12,
 	}, {
 		.code = MEDIA_BUS_FMT_SBGGR14_1X14,
-		.width = 14,
 	}, {
 		.code = MEDIA_BUS_FMT_SGBRG14_1X14,
-		.width = 14,
 	}, {
 		.code = MEDIA_BUS_FMT_SGRBG14_1X14,
-		.width = 14,
 	}, {
 		.code = MEDIA_BUS_FMT_SRGGB14_1X14,
-		.width = 14,
 	},
 	/* YUV formats */
 	{
 		.code = MEDIA_BUS_FMT_YUYV8_1X16,
-		.width = 16,
 	}, {
 		.code = MEDIA_BUS_FMT_UYVY8_1X16,
-		.width = 16,
-	}
+	},
 };
 
 static const struct csi2_pix_format *find_csi2_format(u32 code)
@@ -415,6 +394,7 @@ static int imx8mq_mipi_csi_calc_hs_settle(struct csi_state *state,
 	u32 min_ths_settle, max_ths_settle, ths_settle_ns, esc_clk_period_ns;
 	const struct v4l2_mbus_framefmt *fmt;
 	const struct csi2_pix_format *csi2_fmt;
+	u32 bpp;
 
 	src_pad = media_entity_remote_source_pad_unique(&sd_state->sd->entity);
 	if (IS_ERR(src_pad)) {
@@ -427,8 +407,9 @@ static int imx8mq_mipi_csi_calc_hs_settle(struct csi_state *state,
 
 	fmt = v4l2_subdev_state_get_format(sd_state, MIPI_CSI2_PAD_SINK);
 	csi2_fmt = find_csi2_format(fmt->code);
+	bpp = media_bus_fmt_to_csi2_bpp(csi2_fmt->code);
 
-	link_freq = v4l2_get_link_freq(src_pad, csi2_fmt->width,
+	link_freq = v4l2_get_link_freq(src_pad, bpp,
 				       state->bus.num_data_lanes * 2);
 	if (link_freq < 0) {
 		dev_err(state->dev, "Unable to obtain link frequency: %d\n",

-- 
2.34.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH v4 2/4] media: imx8mq-mipi-csi2: Add output filed in csi2_pix_format
  2025-08-19  3:57 [PATCH v4 0/4] media: imx8mq-mipi-csi2: Enhance the driver to meet more usage case Guoniu Zhou
  2025-08-19  3:58 ` [PATCH v4 1/4] media: imx8mq-mipi-csi2: Remove width field in csi2_pix_format Guoniu Zhou
@ 2025-08-19  3:58 ` Guoniu Zhou
  2025-08-19 15:41   ` Frank Li
  2025-08-19  3:58 ` [PATCH v4 3/4] media: imx8mq-mipi-csi2: Add RGB format support Guoniu Zhou
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 7+ messages in thread
From: Guoniu Zhou @ 2025-08-19  3:58 UTC (permalink / raw)
  To: Rui Miguel Silva, Laurent Pinchart, Martin Kepplinger,
	Purism Kernel Team, Mauro Carvalho Chehab, Shawn Guo,
	Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam
  Cc: linux-media, imx, linux-arm-kernel, linux-kernel, Frank Li,
	Guoniu Zhou

Add output filed in csi2_pix_format since the format on the
source pad might change due to unpacking.

Signed-off-by: Guoniu Zhou <guoniu.zhou@nxp.com>
---
 drivers/media/platform/nxp/imx8mq-mipi-csi2.c | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)

diff --git a/drivers/media/platform/nxp/imx8mq-mipi-csi2.c b/drivers/media/platform/nxp/imx8mq-mipi-csi2.c
index 85700655ecad334c61e9b5f9f073e10b6db2618f..43d766b95eb42b21be893ddfda44119101c9afe3 100644
--- a/drivers/media/platform/nxp/imx8mq-mipi-csi2.c
+++ b/drivers/media/platform/nxp/imx8mq-mipi-csi2.c
@@ -139,6 +139,7 @@ struct csi_state {
 
 struct csi2_pix_format {
 	u32 code;
+	u32 output;
 };
 
 /* -----------------------------------------------------------------------------
@@ -262,48 +263,69 @@ static const struct csi2_pix_format imx8mq_mipi_csi_formats[] = {
 	/* RAW (Bayer and greyscale) formats. */
 	{
 		.code = MEDIA_BUS_FMT_SBGGR8_1X8,
+		.output = MEDIA_BUS_FMT_SBGGR8_1X8,
 	}, {
 		.code = MEDIA_BUS_FMT_SGBRG8_1X8,
+		.output = MEDIA_BUS_FMT_SGBRG8_1X8,
 	}, {
 		.code = MEDIA_BUS_FMT_SGRBG8_1X8,
+		.output = MEDIA_BUS_FMT_SGRBG8_1X8,
 	}, {
 		.code = MEDIA_BUS_FMT_SRGGB8_1X8,
+		.output = MEDIA_BUS_FMT_SRGGB8_1X8,
 	}, {
 		.code = MEDIA_BUS_FMT_Y8_1X8,
+		.output = MEDIA_BUS_FMT_Y8_1X8,
 	}, {
 		.code = MEDIA_BUS_FMT_SBGGR10_1X10,
+		.output = MEDIA_BUS_FMT_SBGGR10_1X10,
 	}, {
 		.code = MEDIA_BUS_FMT_SGBRG10_1X10,
+		.output = MEDIA_BUS_FMT_SGBRG10_1X10,
 	}, {
 		.code = MEDIA_BUS_FMT_SGRBG10_1X10,
+		.output = MEDIA_BUS_FMT_SGRBG10_1X10,
 	}, {
 		.code = MEDIA_BUS_FMT_SRGGB10_1X10,
+		.output = MEDIA_BUS_FMT_SRGGB10_1X10,
 	}, {
 		.code = MEDIA_BUS_FMT_Y10_1X10,
+		.output = MEDIA_BUS_FMT_Y10_1X10,
 	}, {
 		.code = MEDIA_BUS_FMT_SBGGR12_1X12,
+		.output = MEDIA_BUS_FMT_SBGGR12_1X12,
 	}, {
 		.code = MEDIA_BUS_FMT_SGBRG12_1X12,
+		.output = MEDIA_BUS_FMT_SGBRG12_1X12,
 	}, {
 		.code = MEDIA_BUS_FMT_SGRBG12_1X12,
+		.output = MEDIA_BUS_FMT_SGRBG12_1X12,
 	}, {
 		.code = MEDIA_BUS_FMT_SRGGB12_1X12,
+		.output = MEDIA_BUS_FMT_SRGGB12_1X12,
 	}, {
 		.code = MEDIA_BUS_FMT_Y12_1X12,
+		.output = MEDIA_BUS_FMT_Y12_1X12,
 	}, {
 		.code = MEDIA_BUS_FMT_SBGGR14_1X14,
+		.output = MEDIA_BUS_FMT_SBGGR14_1X14,
 	}, {
 		.code = MEDIA_BUS_FMT_SGBRG14_1X14,
+		.output = MEDIA_BUS_FMT_SGBRG14_1X14,
 	}, {
 		.code = MEDIA_BUS_FMT_SGRBG14_1X14,
+		.output = MEDIA_BUS_FMT_SGRBG14_1X14,
 	}, {
 		.code = MEDIA_BUS_FMT_SRGGB14_1X14,
+		.output = MEDIA_BUS_FMT_SRGGB14_1X14,
 	},
 	/* YUV formats */
 	{
 		.code = MEDIA_BUS_FMT_YUYV8_1X16,
+		.output = MEDIA_BUS_FMT_YUYV8_1X16,
 	}, {
 		.code = MEDIA_BUS_FMT_UYVY8_1X16,
+		.output = MEDIA_BUS_FMT_UYVY8_1X16,
 	},
 };
 
@@ -634,6 +656,9 @@ static int imx8mq_mipi_csi_set_fmt(struct v4l2_subdev *sd,
 	fmt = v4l2_subdev_state_get_format(sd_state, MIPI_CSI2_PAD_SOURCE);
 	*fmt = sdformat->format;
 
+	/* The format on the source pad might change due to unpacking. */
+	fmt->code = csi2_fmt->output;
+
 	return 0;
 }
 

-- 
2.34.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH v4 3/4] media: imx8mq-mipi-csi2: Add RGB format support
  2025-08-19  3:57 [PATCH v4 0/4] media: imx8mq-mipi-csi2: Enhance the driver to meet more usage case Guoniu Zhou
  2025-08-19  3:58 ` [PATCH v4 1/4] media: imx8mq-mipi-csi2: Remove width field in csi2_pix_format Guoniu Zhou
  2025-08-19  3:58 ` [PATCH v4 2/4] media: imx8mq-mipi-csi2: Add output filed " Guoniu Zhou
@ 2025-08-19  3:58 ` Guoniu Zhou
  2025-08-19  3:58 ` [PATCH v4 4/4] media: imx8mq-mipi-csi2: Implement .get_frame_desc subdev callback Guoniu Zhou
  2025-08-19 15:45 ` [PATCH v4 0/4] media: imx8mq-mipi-csi2: Enhance the driver to meet more usage case Frank Li
  4 siblings, 0 replies; 7+ messages in thread
From: Guoniu Zhou @ 2025-08-19  3:58 UTC (permalink / raw)
  To: Rui Miguel Silva, Laurent Pinchart, Martin Kepplinger,
	Purism Kernel Team, Mauro Carvalho Chehab, Shawn Guo,
	Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam
  Cc: linux-media, imx, linux-arm-kernel, linux-kernel, Frank Li,
	Guoniu Zhou

Add format RGB565 and RGB24 support.

Signed-off-by: Guoniu Zhou <guoniu.zhou@nxp.com>
---
 drivers/media/platform/nxp/imx8mq-mipi-csi2.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/media/platform/nxp/imx8mq-mipi-csi2.c b/drivers/media/platform/nxp/imx8mq-mipi-csi2.c
index 43d766b95eb42b21be893ddfda44119101c9afe3..79c8b56c051eb96cf45bff8803041b294b8c4f89 100644
--- a/drivers/media/platform/nxp/imx8mq-mipi-csi2.c
+++ b/drivers/media/platform/nxp/imx8mq-mipi-csi2.c
@@ -327,6 +327,14 @@ static const struct csi2_pix_format imx8mq_mipi_csi_formats[] = {
 		.code = MEDIA_BUS_FMT_UYVY8_1X16,
 		.output = MEDIA_BUS_FMT_UYVY8_1X16,
 	},
+	/* RGB formats */
+	{
+		.code = MEDIA_BUS_FMT_RGB565_1X16,
+		.output = MEDIA_BUS_FMT_RGB565_1X16,
+	}, {
+		.code = MEDIA_BUS_FMT_BGR888_1X24,
+		.output = MEDIA_BUS_FMT_RGB888_1X24,
+	},
 };
 
 static const struct csi2_pix_format *find_csi2_format(u32 code)

-- 
2.34.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH v4 4/4] media: imx8mq-mipi-csi2: Implement .get_frame_desc subdev callback
  2025-08-19  3:57 [PATCH v4 0/4] media: imx8mq-mipi-csi2: Enhance the driver to meet more usage case Guoniu Zhou
                   ` (2 preceding siblings ...)
  2025-08-19  3:58 ` [PATCH v4 3/4] media: imx8mq-mipi-csi2: Add RGB format support Guoniu Zhou
@ 2025-08-19  3:58 ` Guoniu Zhou
  2025-08-19 15:45 ` [PATCH v4 0/4] media: imx8mq-mipi-csi2: Enhance the driver to meet more usage case Frank Li
  4 siblings, 0 replies; 7+ messages in thread
From: Guoniu Zhou @ 2025-08-19  3:58 UTC (permalink / raw)
  To: Rui Miguel Silva, Laurent Pinchart, Martin Kepplinger,
	Purism Kernel Team, Mauro Carvalho Chehab, Shawn Guo,
	Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam
  Cc: linux-media, imx, linux-arm-kernel, linux-kernel, Frank Li,
	Guoniu Zhou

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 79c8b56c051eb96cf45bff8803041b294b8c4f89..bc30ba83fc97ee79e8fe87b58bf443e8aa4801fb 100644
--- a/drivers/media/platform/nxp/imx8mq-mipi-csi2.c
+++ b/drivers/media/platform/nxp/imx8mq-mipi-csi2.c
@@ -670,6 +670,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 = media_bus_fmt_to_csi2_dt(csi2_fmt->code);
+
+	return 0;
+}
+
 static const struct v4l2_subdev_video_ops imx8mq_mipi_csi_video_ops = {
 	.s_stream	= imx8mq_mipi_csi_s_stream,
 };
@@ -678,6 +709,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] 7+ messages in thread

* Re: [PATCH v4 2/4] media: imx8mq-mipi-csi2: Add output filed in csi2_pix_format
  2025-08-19  3:58 ` [PATCH v4 2/4] media: imx8mq-mipi-csi2: Add output filed " Guoniu Zhou
@ 2025-08-19 15:41   ` Frank Li
  0 siblings, 0 replies; 7+ messages in thread
From: Frank Li @ 2025-08-19 15:41 UTC (permalink / raw)
  To: Guoniu Zhou
  Cc: Rui Miguel Silva, Laurent Pinchart, Martin Kepplinger,
	Purism Kernel Team, Mauro Carvalho Chehab, Shawn Guo,
	Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam, linux-media,
	imx, linux-arm-kernel, linux-kernel

On Tue, Aug 19, 2025 at 11:58:01AM +0800, Guoniu Zhou wrote:
> Add output filed in csi2_pix_format since the format on the
> source pad might change due to unpacking.
>
> Signed-off-by: Guoniu Zhou <guoniu.zhou@nxp.com>
> ---
>  drivers/media/platform/nxp/imx8mq-mipi-csi2.c | 25 +++++++++++++++++++++++++
>  1 file changed, 25 insertions(+)
>
> diff --git a/drivers/media/platform/nxp/imx8mq-mipi-csi2.c b/drivers/media/platform/nxp/imx8mq-mipi-csi2.c
> index 85700655ecad334c61e9b5f9f073e10b6db2618f..43d766b95eb42b21be893ddfda44119101c9afe3 100644
> --- a/drivers/media/platform/nxp/imx8mq-mipi-csi2.c
> +++ b/drivers/media/platform/nxp/imx8mq-mipi-csi2.c
> @@ -139,6 +139,7 @@ struct csi_state {
>
>  struct csi2_pix_format {
>  	u32 code;
> +	u32 output;
>  };
>
>  /* -----------------------------------------------------------------------------
> @@ -262,48 +263,69 @@ static const struct csi2_pix_format imx8mq_mipi_csi_formats[] = {
>  	/* RAW (Bayer and greyscale) formats. */
>  	{
>  		.code = MEDIA_BUS_FMT_SBGGR8_1X8,
> +		.output = MEDIA_BUS_FMT_SBGGR8_1X8,
>  	}, {
>  		.code = MEDIA_BUS_FMT_SGBRG8_1X8,
> +		.output = MEDIA_BUS_FMT_SGBRG8_1X8,
>  	}, {
>  		.code = MEDIA_BUS_FMT_SGRBG8_1X8,
> +		.output = MEDIA_BUS_FMT_SGRBG8_1X8,
>  	}, {
>  		.code = MEDIA_BUS_FMT_SRGGB8_1X8,
> +		.output = MEDIA_BUS_FMT_SRGGB8_1X8,
>  	}, {
>  		.code = MEDIA_BUS_FMT_Y8_1X8,
> +		.output = MEDIA_BUS_FMT_Y8_1X8,
>  	}, {
>  		.code = MEDIA_BUS_FMT_SBGGR10_1X10,
> +		.output = MEDIA_BUS_FMT_SBGGR10_1X10,
>  	}, {
>  		.code = MEDIA_BUS_FMT_SGBRG10_1X10,
> +		.output = MEDIA_BUS_FMT_SGBRG10_1X10,
>  	}, {
>  		.code = MEDIA_BUS_FMT_SGRBG10_1X10,
> +		.output = MEDIA_BUS_FMT_SGRBG10_1X10,
>  	}, {
>  		.code = MEDIA_BUS_FMT_SRGGB10_1X10,
> +		.output = MEDIA_BUS_FMT_SRGGB10_1X10,
>  	}, {
>  		.code = MEDIA_BUS_FMT_Y10_1X10,
> +		.output = MEDIA_BUS_FMT_Y10_1X10,
>  	}, {
>  		.code = MEDIA_BUS_FMT_SBGGR12_1X12,
> +		.output = MEDIA_BUS_FMT_SBGGR12_1X12,
>  	}, {
>  		.code = MEDIA_BUS_FMT_SGBRG12_1X12,
> +		.output = MEDIA_BUS_FMT_SGBRG12_1X12,
>  	}, {
>  		.code = MEDIA_BUS_FMT_SGRBG12_1X12,
> +		.output = MEDIA_BUS_FMT_SGRBG12_1X12,
>  	}, {
>  		.code = MEDIA_BUS_FMT_SRGGB12_1X12,
> +		.output = MEDIA_BUS_FMT_SRGGB12_1X12,
>  	}, {
>  		.code = MEDIA_BUS_FMT_Y12_1X12,
> +		.output = MEDIA_BUS_FMT_Y12_1X12,
>  	}, {
>  		.code = MEDIA_BUS_FMT_SBGGR14_1X14,
> +		.output = MEDIA_BUS_FMT_SBGGR14_1X14,
>  	}, {
>  		.code = MEDIA_BUS_FMT_SGBRG14_1X14,
> +		.output = MEDIA_BUS_FMT_SGBRG14_1X14,
>  	}, {
>  		.code = MEDIA_BUS_FMT_SGRBG14_1X14,
> +		.output = MEDIA_BUS_FMT_SGRBG14_1X14,
>  	}, {
>  		.code = MEDIA_BUS_FMT_SRGGB14_1X14,
> +		.output = MEDIA_BUS_FMT_SRGGB14_1X14,
>  	},
>  	/* YUV formats */
>  	{
>  		.code = MEDIA_BUS_FMT_YUYV8_1X16,
> +		.output = MEDIA_BUS_FMT_YUYV8_1X16,
>  	}, {
>  		.code = MEDIA_BUS_FMT_UYVY8_1X16,
> +		.output = MEDIA_BUS_FMT_UYVY8_1X16,


All is the same, Can treat 0 as the same as .code to avoid dupicate these
data.

Frank

>  	},
>  };
>
> @@ -634,6 +656,9 @@ static int imx8mq_mipi_csi_set_fmt(struct v4l2_subdev *sd,
>  	fmt = v4l2_subdev_state_get_format(sd_state, MIPI_CSI2_PAD_SOURCE);
>  	*fmt = sdformat->format;
>
> +	/* The format on the source pad might change due to unpacking. */
> +	fmt->code = csi2_fmt->output;
> +
>  	return 0;
>  }
>
>
> --
> 2.34.1
>

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v4 0/4] media: imx8mq-mipi-csi2: Enhance the driver to meet more usage case
  2025-08-19  3:57 [PATCH v4 0/4] media: imx8mq-mipi-csi2: Enhance the driver to meet more usage case Guoniu Zhou
                   ` (3 preceding siblings ...)
  2025-08-19  3:58 ` [PATCH v4 4/4] media: imx8mq-mipi-csi2: Implement .get_frame_desc subdev callback Guoniu Zhou
@ 2025-08-19 15:45 ` Frank Li
  4 siblings, 0 replies; 7+ messages in thread
From: Frank Li @ 2025-08-19 15:45 UTC (permalink / raw)
  To: Guoniu Zhou
  Cc: Rui Miguel Silva, Laurent Pinchart, Martin Kepplinger,
	Purism Kernel Team, Mauro Carvalho Chehab, Shawn Guo,
	Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam, linux-media,
	imx, linux-arm-kernel, linux-kernel

On Tue, Aug 19, 2025 at 11:57:59AM +0800, Guoniu Zhou wrote:
> The bellow miscellaneous patches enhance the driver to meet more
> usage case, such as i.MX8ULP.
>
> Changes in v4:
> - Remove patch 1 in v3.
> - Add two new patches(patch 1 and 2).
> - Use helper function media_bus_fmt_to_csi2_bpp() in patch 1.
> - Use helper function media_bus_fmt_to_csi2_dt() in patch 4.

This functions are still under review, you should mention your patch depend
on my patch.

https://lore.kernel.org/imx/20250808-95_cam-v2-3-4b29fa6919a7@nxp.com/

Frank

> - Link to v3: https://lore.kernel.org/all/20250812091856.1036170-1-guoniu.zhou@oss.nxp.com
>
> Changes in v3:
> - Modify cover letter file to include history info.
> - Link to v2: https://lore.kernel.org/all/20250812090843.1035800-1-guoniu.zhou@oss.nxp.com
>
> 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 (4):
>   media: imx8mq-mipi-csi2: Remove width field in csi2_pix_format
>   media: imx8mq-mipi-csi2: Add output filed in csi2_pix_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(+)
>
> --
> 2.34.1
>
> ---
> Guoniu Zhou (4):
>       media: imx8mq-mipi-csi2: Remove width field in csi2_pix_format
>       media: imx8mq-mipi-csi2: Add output filed in csi2_pix_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 | 94 ++++++++++++++++++++-------
>  1 file changed, 70 insertions(+), 24 deletions(-)
> ---
> base-commit: 8f5ae30d69d7543eee0d70083daf4de8fe15d585
> change-id: 20250818-csi2_imx8mq-59464599858b
> prerequisite-patch-id: 508b25bf601f2d069f16918ac44824ef2ee3cd45
> prerequisite-patch-id: 8b40bfd4a8fa73b38acd53809f88508a5ad437f1
>
> Best regards,
> --
> Guoniu Zhou <guoniu.zhou@nxp.com>
>

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2025-08-19 15:45 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-19  3:57 [PATCH v4 0/4] media: imx8mq-mipi-csi2: Enhance the driver to meet more usage case Guoniu Zhou
2025-08-19  3:58 ` [PATCH v4 1/4] media: imx8mq-mipi-csi2: Remove width field in csi2_pix_format Guoniu Zhou
2025-08-19  3:58 ` [PATCH v4 2/4] media: imx8mq-mipi-csi2: Add output filed " Guoniu Zhou
2025-08-19 15:41   ` Frank Li
2025-08-19  3:58 ` [PATCH v4 3/4] media: imx8mq-mipi-csi2: Add RGB format support Guoniu Zhou
2025-08-19  3:58 ` [PATCH v4 4/4] media: imx8mq-mipi-csi2: Implement .get_frame_desc subdev callback Guoniu Zhou
2025-08-19 15:45 ` [PATCH v4 0/4] media: imx8mq-mipi-csi2: Enhance the driver to meet more usage case Frank Li

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).