[PATCH v2 3/7] media: imx: imx7-media-csi: Use dual sampling for YUV 1X16

Jacopo Mondi jacopo at jmondi.org
Fri Feb 18 10:34:17 PST 2022


The CSI bridge should operate in dual pixel sampling mode when it is
connected to a pixel transmitter that transfers two pixel samples (16
bits) at the time in YUYV formats.

Use the image format variants to determine if single or dual pixel mode
should be used.

Add a note to the TODO file to record that the list of supported formats
should be restricted to the SoC model the CSI bridge is integrated on
to avoid potential pipeline mis-configurations.

Signed-off-by: Jacopo Mondi <jacopo at jmondi.org>
---
 drivers/staging/media/imx/TODO             | 26 ++++++++++++++++++++++
 drivers/staging/media/imx/imx7-media-csi.c |  8 +++++--
 2 files changed, 32 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/media/imx/TODO b/drivers/staging/media/imx/TODO
index 06c94f20ecf8..e15eba32cc94 100644
--- a/drivers/staging/media/imx/TODO
+++ b/drivers/staging/media/imx/TODO
@@ -27,3 +27,29 @@
 - i.MX7: all of the above, since it uses the imx media core

 - i.MX7: use Frame Interval Monitor
+
+- imx7-media-csi: Restrict the supported formats list to the SoC version.
+
+  The imx7 CSI bridge can be configured to sample pixel components from the Rx
+  queue in single  (8bpp) or double (16bpp) modes. Image format variations with
+  different sample sizes (ie YUYV_2X8 vs YUYV_1X16) determine the sampling size
+  (see imx7_csi_configure()).
+
+  As the imx7 CSI bridge can be interfaced with different IP blocks depending on
+  the SoC model it is integrated on, the Rx queue sampling size should match
+  the size of samples transferred by the transmitting IP block.
+
+  To avoid mis-configurations of the capture pipeline, the enumeration of the
+  supported formats should be restricted to match the pixel source
+  transmitting mode.
+
+  Examples: i.MX8MM SoC integrates the CSI bridge with the Samsung CSIS CSI-2
+  receiver which operates in dual pixel sampling mode. The CSI bridge should
+  only expose the 1X16 formats variant which instructs it to operate in dual
+  pixel sampling mode. When the CSI bridge is instead integrated on an i.MX8MQ
+  SoC, which features a CSI-2 receiver that operates in single sampling mode, it
+  should only expose the 2X8 formats variant which instruct it to operate in
+  single sampling mode.
+
+  This currently only applies to YUYV formats, but other formats might need
+  to be treated in the same way.
diff --git a/drivers/staging/media/imx/imx7-media-csi.c b/drivers/staging/media/imx/imx7-media-csi.c
index 32311fc0e2a4..108360ae3710 100644
--- a/drivers/staging/media/imx/imx7-media-csi.c
+++ b/drivers/staging/media/imx/imx7-media-csi.c
@@ -503,11 +503,15 @@ static void imx7_csi_configure(struct imx7_csi *csi)
 		 * all of them comply. Support both variants.
 		 */
 		case MEDIA_BUS_FMT_UYVY8_2X8:
-		case MEDIA_BUS_FMT_UYVY8_1X16:
 		case MEDIA_BUS_FMT_YUYV8_2X8:
-		case MEDIA_BUS_FMT_YUYV8_1X16:
 			cr18 |= BIT_MIPI_DATA_FORMAT_YUV422_8B;
 			break;
+		case MEDIA_BUS_FMT_UYVY8_1X16:
+		case MEDIA_BUS_FMT_YUYV8_1X16:
+			cr3 |= BIT_TWO_8BIT_SENSOR;
+			cr18 |= BIT_MIPI_DATA_FORMAT_YUV422_8B |
+				BIT_MIPI_DOUBLE_CMPNT;
+			break;
 		}
 	}

--
2.35.0




More information about the linux-arm-kernel mailing list