Commit 88dd3454 authored by Mauro Carvalho Chehab's avatar Mauro Carvalho Chehab Committed by Martin Kepplinger
Browse files

media: imx: imx7-media-csi: Set TWO_8BIT_SENSOR for >= 10-bit formats



This is an automatic generated email to let you know that the following patch were queued:

Subject: media: imx: imx7-media-csi: Set TWO_8BIT_SENSOR for >= 10-bit formats
Author:  Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Date:    Wed Feb 3 04:08:19 2021 +0100

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: default avatarLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Tested-by: Martin Kepplinger's avatarMartin Kepplinger <martin.kepplinger@puri.sm>
Reviewed-by: default avatarRui Miguel Silva <rmfrfs@gmail.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+huawei@kernel.org>

 drivers/staging/media/imx/imx7-media-csi.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
parent c7d9cdf3
...@@ -423,6 +423,7 @@ static void imx7_csi_configure(struct imx7_csi *csi) ...@@ -423,6 +423,7 @@ static void imx7_csi_configure(struct imx7_csi *csi)
struct v4l2_pix_format *out_pix = &vdev->fmt; struct v4l2_pix_format *out_pix = &vdev->fmt;
int width = out_pix->width; int width = out_pix->width;
u32 stride = 0; u32 stride = 0;
u32 cr3 = BIT_FRMCNT_RST;
u32 cr1, cr18; u32 cr1, cr18;
cr18 = imx7_csi_reg_read(csi, CSI_CSICR18); cr18 = imx7_csi_reg_read(csi, CSI_CSICR18);
...@@ -466,6 +467,7 @@ static void imx7_csi_configure(struct imx7_csi *csi) ...@@ -466,6 +467,7 @@ static void imx7_csi_configure(struct imx7_csi *csi)
case MEDIA_BUS_FMT_SGBRG10_1X10: case MEDIA_BUS_FMT_SGBRG10_1X10:
case MEDIA_BUS_FMT_SGRBG10_1X10: case MEDIA_BUS_FMT_SGRBG10_1X10:
case MEDIA_BUS_FMT_SRGGB10_1X10: case MEDIA_BUS_FMT_SRGGB10_1X10:
cr3 |= BIT_TWO_8BIT_SENSOR;
cr18 |= BIT_MIPI_DATA_FORMAT_RAW10; cr18 |= BIT_MIPI_DATA_FORMAT_RAW10;
break; break;
case MEDIA_BUS_FMT_Y12_1X12: case MEDIA_BUS_FMT_Y12_1X12:
...@@ -473,6 +475,7 @@ static void imx7_csi_configure(struct imx7_csi *csi) ...@@ -473,6 +475,7 @@ static void imx7_csi_configure(struct imx7_csi *csi)
case MEDIA_BUS_FMT_SGBRG12_1X12: case MEDIA_BUS_FMT_SGBRG12_1X12:
case MEDIA_BUS_FMT_SGRBG12_1X12: case MEDIA_BUS_FMT_SGRBG12_1X12:
case MEDIA_BUS_FMT_SRGGB12_1X12: case MEDIA_BUS_FMT_SRGGB12_1X12:
cr3 |= BIT_TWO_8BIT_SENSOR;
cr18 |= BIT_MIPI_DATA_FORMAT_RAW12; cr18 |= BIT_MIPI_DATA_FORMAT_RAW12;
break; break;
case MEDIA_BUS_FMT_Y14_1X14: case MEDIA_BUS_FMT_Y14_1X14:
...@@ -480,6 +483,7 @@ static void imx7_csi_configure(struct imx7_csi *csi) ...@@ -480,6 +483,7 @@ static void imx7_csi_configure(struct imx7_csi *csi)
case MEDIA_BUS_FMT_SGBRG14_1X14: case MEDIA_BUS_FMT_SGBRG14_1X14:
case MEDIA_BUS_FMT_SGRBG14_1X14: case MEDIA_BUS_FMT_SGRBG14_1X14:
case MEDIA_BUS_FMT_SRGGB14_1X14: case MEDIA_BUS_FMT_SRGGB14_1X14:
cr3 |= BIT_TWO_8BIT_SENSOR;
cr18 |= BIT_MIPI_DATA_FORMAT_RAW14; cr18 |= BIT_MIPI_DATA_FORMAT_RAW14;
break; break;
/* /*
...@@ -497,7 +501,7 @@ static void imx7_csi_configure(struct imx7_csi *csi) ...@@ -497,7 +501,7 @@ static void imx7_csi_configure(struct imx7_csi *csi)
imx7_csi_reg_write(csi, cr1, CSI_CSICR1); 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_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, cr18, CSI_CSICR18);
imx7_csi_reg_write(csi, (width * out_pix->height) >> 2, CSI_CSIRXCNT); imx7_csi_reg_write(csi, (width * out_pix->height) >> 2, CSI_CSIRXCNT);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment