media: ti: j721e-csi2rx: add support for RGB formats
authorJai Luthra <j-luthra@ti.com>
Fri, 5 Jan 2024 09:00:25 +0000 (10:00 +0100)
committerHans Verkuil <hverkuil-cisco@xs4all.nl>
Mon, 22 Jan 2024 16:23:59 +0000 (17:23 +0100)
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>
drivers/media/platform/ti/j721e-csi2rx/j721e-csi2rx.c

index 4048b2bd38854747894514d1beda562a3c68aa98..2b078c5d7f5d23d86f437068b7e5ef36a15fb925 100644 (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. */