]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
media: imx: imx7-media-csi: Set TWO_8BIT_SENSOR for >= 10-bit formats
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Wed, 3 Feb 2021 03:08:19 +0000 (04:08 +0100)
committerMauro Carvalho Chehab <mchehab+huawei@kernel.org>
Wed, 4 Aug 2021 12:43:51 +0000 (14:43 +0200)
Sample code from NXP, as well as experiments on i.MX8MM with RAW10
capture with an OV5640 sensor connected over CSI-2, showed that the
TWO_8BIT_SENSOR field of the CSICR3 register needs to be set for formats
larger than 8 bits. Do so, even if the reference manual doesn't clearly
describe the effect of the field.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Tested-by: Martin Kepplinger <martin.kepplinger@puri.sm>
Reviewed-by: Rui Miguel Silva <rmfrfs@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
drivers/staging/media/imx/imx7-media-csi.c

index 894c4de31790e00d3f01dc8e5ba148946577930b..8aefcf0e219f3d923976ae8987da73bf515ee1a5 100644 (file)
@@ -421,6 +421,7 @@ static void imx7_csi_configure(struct imx7_csi *csi)
        struct v4l2_pix_format *out_pix = &vdev->fmt;
        int width = out_pix->width;
        u32 stride = 0;
+       u32 cr3 = BIT_FRMCNT_RST;
        u32 cr1, cr18;
 
        cr18 = imx7_csi_reg_read(csi, CSI_CSICR18);
@@ -464,6 +465,7 @@ static void imx7_csi_configure(struct imx7_csi *csi)
                case MEDIA_BUS_FMT_SGBRG10_1X10:
                case MEDIA_BUS_FMT_SGRBG10_1X10:
                case MEDIA_BUS_FMT_SRGGB10_1X10:
+                       cr3 |= BIT_TWO_8BIT_SENSOR;
                        cr18 |= BIT_MIPI_DATA_FORMAT_RAW10;
                        break;
                case MEDIA_BUS_FMT_Y12_1X12:
@@ -471,6 +473,7 @@ static void imx7_csi_configure(struct imx7_csi *csi)
                case MEDIA_BUS_FMT_SGBRG12_1X12:
                case MEDIA_BUS_FMT_SGRBG12_1X12:
                case MEDIA_BUS_FMT_SRGGB12_1X12:
+                       cr3 |= BIT_TWO_8BIT_SENSOR;
                        cr18 |= BIT_MIPI_DATA_FORMAT_RAW12;
                        break;
                case MEDIA_BUS_FMT_Y14_1X14:
@@ -478,6 +481,7 @@ static void imx7_csi_configure(struct imx7_csi *csi)
                case MEDIA_BUS_FMT_SGBRG14_1X14:
                case MEDIA_BUS_FMT_SGRBG14_1X14:
                case MEDIA_BUS_FMT_SRGGB14_1X14:
+                       cr3 |= BIT_TWO_8BIT_SENSOR;
                        cr18 |= BIT_MIPI_DATA_FORMAT_RAW14;
                        break;
                /*
@@ -510,7 +514,7 @@ static void imx7_csi_configure(struct imx7_csi *csi)
 
        imx7_csi_reg_write(csi, cr1, CSI_CSICR1);
        imx7_csi_reg_write(csi, BIT_DMA_BURST_TYPE_RFF_INCR16, CSI_CSICR2);
-       imx7_csi_reg_write(csi, BIT_FRMCNT_RST, CSI_CSICR3);
+       imx7_csi_reg_write(csi, cr3, CSI_CSICR3);
        imx7_csi_reg_write(csi, cr18, CSI_CSICR18);
 
        imx7_csi_reg_write(csi, (width * out_pix->height) >> 2, CSI_CSIRXCNT);