media: ti: j721e-csi2rx: add support for RGB formats

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"

Link: https://www.ti.com/lit/pdf/spruiv7
Signed-off-by: Jai Luthra <j-luthra@ti.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
This commit is contained in:
Jai Luthra 2024-01-05 10:00:25 +01:00 committed by Hans Verkuil
parent 77759eb0b8
commit 5eb0ad467c

View File

@ -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. */