I process bayer data using a separate SW pipeline. My goal is only to capture and save 12-bit bayer data using i.MX8M. There are forum posts confirming support for receiving 10-bit bayer but it seems so far no one has confirmed success with receiving 12-bit bayer through 4-lane CSI sensor on i.MX8M (referred to as RAW12 in Reference Manual). My main concern is this post here : https://community.nxp.com/thread/498568 in which the user was unable to successfully receive 12-bit data in a 2- or 4-lane CSI configuration.
Could you confirm that RAW12 format is indeed supported in the latest i.MX8M firmware release for a 4-lane CSI sensor, and that the following source code changes are all that is required (based on 4.14.98_2.0.0 linux release):
diff --git a/drivers/media/platform/mxc/capture/mx6s_capture.c b/drivers/media/platform/mxc/capture/mx6s_capture.c
index 9cfdbdc..99534ae 100644
--- a/drivers/media/platform/mxc/capture/mx6s_capture.c
+++ b/drivers/media/platform/mxc/capture/mx6s_capture.c
@@ -138,6 +138,7 @@
#define BIT_CSI_ENABLE (0x1 << 31)
#define BIT_MIPI_DATA_FORMAT_RAW8 (0x2a << 25)
#define BIT_MIPI_DATA_FORMAT_RAW10 (0x2b << 25)
+#define BIT_MIPI_DATA_FORMAT_RAW12 (0x2c << 25)
#define BIT_MIPI_DATA_FORMAT_YUV422_8B (0x1e << 25)
#define BIT_MIPI_DATA_FORMAT_MASK (0x3F << 25)
#define BIT_MIPI_DATA_FORMAT_OFFSET 25
@@ -279,6 +280,18 @@ static struct mx6s_fmt formats[] = {
.pixelformat = V4L2_PIX_FMT_SBGGR8,
.mbus_code = MEDIA_BUS_FMT_SBGGR8_1X8,
.bpp = 1,
+ }, {
+ .name = "RAWRGB10 (SRGGB10)",
+ .fourcc = V4L2_PIX_FMT_SRGGB10,
+ .pixelformat = V4L2_PIX_FMT_SRGGB10,
+ .mbus_code = MEDIA_BUS_FMT_SRGGB10_1X10,
+ .bpp = 2,
+ }, {
+ .name = "RAWRGB12 (SRGGB12)",
+ .fourcc = V4L2_PIX_FMT_SRGGB12,
+ .pixelformat = V4L2_PIX_FMT_SRGGB12,
+ .mbus_code = MEDIA_BUS_FMT_SRGGB12_1X12,
+ .bpp = 2,
}
};
@@ -861,6 +874,10 @@ static int mx6s_configure_csi(struct mx6s_csi_dev *csi_dev)
/* For parallel 8-bit sensor input */
width = pix->width * 2;
break;
+ case V4L2_PIX_FMT_SRGGB10:
+ case V4L2_PIX_FMT_SRGGB12:
+ width = pix->width * 2;
+ break;
default:
pr_debug(" case not supported\n");
return -EINVAL;
@@ -885,6 +902,12 @@ static int mx6s_configure_csi(struct mx6s_csi_dev *csi_dev)
case V4L2_PIX_FMT_SBGGR8:
cr18 |= BIT_MIPI_DATA_FORMAT_RAW8;
break;
+ case V4L2_PIX_FMT_SRGGB10:
+ cr18 |= BIT_MIPI_DATA_FORMAT_RAW10;
+ break;
+ case V4L2_PIX_FMT_SRGGB12:
+ cr18 |= BIT_MIPI_DATA_FORMAT_RAW12;
+ break;
default:
pr_debug(" fmt not supported\n");
return -EINVAL;
Thank you for your time