Skip to contentSkip to conversation

misc improvements for j721e-csi2rx

PATCH New Julien Massot 1 participant 6 messages Jan 5, 2024

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

v3 cover misc improvements for j721e-csi2rx

Change in V3:
- patch 1/5 change the Fixes tag and commit message as suggested by Sakari

RGB patches 4, 5 have been tested with the MAX96714F pattern generator.

This small series:
- Fix media link issue when the remote subdevice has multiple output ports
- add support for Grey format patch 2 and 3
- add support for RGB formats patch 4 and 5

Jai Luthra (2):
media: cadence: csi2rx: add support for RGB formats
media: ti: j721e-csi2rx: add support for RGB formats

Julien Massot (3):
media: cadence: csi2rx: use match fwnode for media link
media: cadence: csi2rx: add Y8_1X8 format
media: ti: j721e-csi2rx: add GREY format

 drivers/media/platform/cadence/cdns-csi2rx.c  |  6 ++++-
 .../platform/ti/j721e-csi2rx/j721e-csi2rx.c   | 24 +++++++++++++++++++
 2 files changed, 29 insertions(+), 1 deletion(-)
Signature · 1 line
2.43.0
#1 lore raw

PATCH v3 1/5 media: cadence: csi2rx: use match fwnode for media link

Since commit 1029939b3782 ("media: v4l: async: Simplify async sub-device fwnode matching"), async connections are matched using the async sub-device fwnode, not that
of the endpoint. Fix this by using the fwnode of the connection match to find the pad.

Fixes 1029939b3782 ("media: v4l: async: Simplify async sub-device fwnode matching")
---
 drivers/media/platform/cadence/cdns-csi2rx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/platform/cadence/cdns-csi2rx.c +1 -1
index 91ef22e9109a..e83b877c48da 100644
@@ -467,7 +467,7 @@ static int csi2rx_async_bound(struct v4l2_async_notifier *notifier,
 	struct csi2rx_priv *csi2rx = v4l2_subdev_to_csi2rx(subdev);
 
 	csi2rx->source_pad = media_entity_get_fwnode_pad(&s_subdev->entity,
-							 s_subdev->fwnode,
+							 asd->match.fwnode,
 							 MEDIA_PAD_FL_SOURCE);
 	if (csi2rx->source_pad < 0) {
 		dev_err(csi2rx->dev, "Couldn't find output pad for subdev %s\n",
Signature · 1 line
2.43.0
#2 lore raw

PATCH v3 2/5 media: cadence: csi2rx: add Y8_1X8 format

In reply to Julien Massot

Add support for MEDIA_BUS_FMT_Y8_1X8 format.

---
 drivers/media/platform/cadence/cdns-csi2rx.c | 1 +
 1 file changed, 1 insertion(+)
drivers/media/platform/cadence/cdns-csi2rx.c +1 -0
index e83b877c48da..2ca4a8cde75e 100644
@@ -114,6 +114,7 @@ static const struct csi2rx_fmt formats[] = {
 	{ .code	= MEDIA_BUS_FMT_SGBRG8_1X8, .bpp = 8, },
 	{ .code	= MEDIA_BUS_FMT_SGRBG8_1X8, .bpp = 8, },
 	{ .code	= MEDIA_BUS_FMT_SRGGB8_1X8, .bpp = 8, },
+	{ .code	= MEDIA_BUS_FMT_Y8_1X8,     .bpp = 8, },
 	{ .code	= MEDIA_BUS_FMT_SBGGR10_1X10, .bpp = 10, },
 	{ .code	= MEDIA_BUS_FMT_SGBRG10_1X10, .bpp = 10, },
 	{ .code	= MEDIA_BUS_FMT_SGRBG10_1X10, .bpp = 10, },
Signature · 1 line
2.43.0
#3 lore raw

PATCH v3 3/5 media: ti: j721e-csi2rx: add GREY format

In reply to Julien Massot

Add Grey format to properly select RAW8 data type.

Tested with a ST VG5661 sensor.

---
 drivers/media/platform/ti/j721e-csi2rx/j721e-csi2rx.c | 6 ++++++
 1 file changed, 6 insertions(+)
drivers/media/platform/ti/j721e-csi2rx/j721e-csi2rx.c +6 -0
index 9518c78cee4a..6e58112957ce 100644
@@ -158,6 +158,12 @@ static const struct ti_csi2rx_fmt ti_csi2rx_formats[] = {
 		.csi_dt			= MIPI_CSI2_DT_RAW8,
 		.bpp			= 8,
 		.size			= SHIM_DMACNTX_SIZE_8,
+	}, {
+		.fourcc			= V4L2_PIX_FMT_GREY,
+		.code			= MEDIA_BUS_FMT_Y8_1X8,
+		.csi_dt			= MIPI_CSI2_DT_RAW8,
+		.bpp			= 8,
+		.size			= SHIM_DMACNTX_SIZE_8,
 	}, {
 		.fourcc			= V4L2_PIX_FMT_SBGGR10,
 		.code			= MEDIA_BUS_FMT_SBGGR10_1X10,
Signature · 1 line
2.43.0
#4 lore raw

PATCH v3 4/5 media: cadence: csi2rx: add support for RGB formats

In reply to Julien Massot

From: Jai Luthra <[email protected]>

Add support for RGB565, RGB888 and BGR888 media bus formats.

---
 drivers/media/platform/cadence/cdns-csi2rx.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/media/platform/cadence/cdns-csi2rx.c +3 -0
index 2ca4a8cde75e..aa08733172a5 100644
@@ -119,6 +119,9 @@ static const struct csi2rx_fmt formats[] = {
 	{ .code	= MEDIA_BUS_FMT_SGBRG10_1X10, .bpp = 10, },
 	{ .code	= MEDIA_BUS_FMT_SGRBG10_1X10, .bpp = 10, },
 	{ .code	= MEDIA_BUS_FMT_SRGGB10_1X10, .bpp = 10, },
+	{ .code	= MEDIA_BUS_FMT_RGB565_1X16,  .bpp = 16, },
+	{ .code	= MEDIA_BUS_FMT_RGB888_1X24,  .bpp = 24, },
+	{ .code	= MEDIA_BUS_FMT_BGR888_1X24,  .bpp = 24, },
 };
 
 static const struct csi2rx_fmt *csi2rx_get_fmt_by_code(u32 code)
Signature · 1 line
2.43.0
#5 lore raw

PATCH v3 5/5 media: ti: j721e-csi2rx: add support for RGB formats

In reply to Julien Massot

From: Jai Luthra <[email protected]>

Add support for RGB565, RGB888 and BGR888 media bus formats.

The pixel formats for these have a different byte-order than the MIPI bus formats, given the SHIM IP [1] unpacks them into memory as follows:

MIPI RGB888 unpacks to:
BYTE3 BYTE2 BYTE1 BYTE0
00000000 RRRRRRRR GGGGGGGG BBBBBBBB

MIPI RGB565 unpacks to:
BIT 15-11 BIT 10-5 BIT 4-0
RRRRR GGGGGG BBBBB

[1]: AM62x TRM: 12.6.1.4.5 "CSI_RX_IF Data Memory Organization Details"

---
 .../platform/ti/j721e-csi2rx/j721e-csi2rx.c    | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)
drivers/media/platform/ti/j721e-csi2rx/j721e-csi2rx.c +18 -0
index 6e58112957ce..15ddc851737a 100644
@@ -188,6 +188,24 @@ static const struct ti_csi2rx_fmt ti_csi2rx_formats[] = {
 		.csi_dt			= MIPI_CSI2_DT_RAW10,
 		.bpp			= 16,
 		.size			= SHIM_DMACNTX_SIZE_16,
+	}, {
+		.fourcc			= V4L2_PIX_FMT_RGB565X,
+		.code			= MEDIA_BUS_FMT_RGB565_1X16,
+		.csi_dt			= MIPI_CSI2_DT_RGB565,
+		.bpp			= 16,
+		.size			= SHIM_DMACNTX_SIZE_16,
+	}, {
+		.fourcc			= V4L2_PIX_FMT_XBGR32,
+		.code			= MEDIA_BUS_FMT_RGB888_1X24,
+		.csi_dt			= MIPI_CSI2_DT_RGB888,
+		.bpp			= 32,
+		.size			= SHIM_DMACNTX_SIZE_32,
+	}, {
+		.fourcc			= V4L2_PIX_FMT_RGBX32,
+		.code			= MEDIA_BUS_FMT_BGR888_1X24,
+		.csi_dt			= MIPI_CSI2_DT_RGB888,
+		.bpp			= 32,
+		.size			= SHIM_DMACNTX_SIZE_32,
 	},
 
 	/* More formats can be supported but they are not listed for now. */
Signature · 1 line
2.43.0