Skip to contentSkip to conversation

media: imx.rst: Fix the MIPI CSI-2 virtual channel

PATCH In review Fabio Estevam 2 participants 6 messages Apr 9, 2020

Subsystems (3)
lore
Share & tools
lore

Fabio Estevam

author reviewer
#0 lore raw

PATCH v2 1/4 media: imx.rst: Fix the MIPI CSI-2 virtual channel

The current instructions for imx6q-sabresd do not lead to functional capture on OV5640 MIPI CSI-2.

The reason for this, as explained by Steve Longerbeam, is that OV5640 by default transmits on virtual channel 0, not channel 1 as is given in the instructions.

Adapt the instructions to use virtual channel 0 so that a working camera setup can be achieved on imx6q-sabresd.

Also, since we are using an IC direct conversion pipeline, improve the example by demonstrating colorspace and scaling.

---
Changes since v1:
- Demonstrate colorspace and scaling. (Steve)

 Documentation/media/v4l-drivers/imx.rst | 31 ++++++++++++-------------
 1 file changed, 15 insertions(+), 16 deletions(-)
Documentation/media/v4l-drivers/imx.rst +15 -16
index 1246573c1019..b8df91f83f14 100644
@@ -645,30 +645,29 @@ The OV5640 module connects to MIPI connector J5 (sorry I don't have the
 compatible module part number or URL).
 
 The following example configures a direct conversion pipeline to capture
-from the OV5640, transmitting on MIPI CSI-2 virtual channel 1. $sensorfmt
-can be any format supported by the OV5640. $sensordim is the frame
-dimension part of $sensorfmt (minus the mbus pixel code). $outputfmt can
-be any format supported by the ipu1_ic_prpenc entity at its output pad:
+from the OV5640, transmitting on MIPI CSI-2 virtual channel 0. It also
+shows colorspace conversion and scaling at IC output.
 
 .. code-block:: none
 
    # Setup links
    media-ctl -l "'ov5640 1-003c':0 -> 'imx6-mipi-csi2':0[1]"
-   media-ctl -l "'imx6-mipi-csi2':2 -> 'ipu1_csi1':0[1]"
-   media-ctl -l "'ipu1_csi1':1 -> 'ipu1_ic_prp':0[1]"
+   media-ctl -l "'imx6-mipi-csi2':1 -> 'ipu1_csi0_mux':0[1]"
+   media-ctl -l "'ipu1_csi0_mux':2 -> 'ipu1_csi0':0[1]"
+   media-ctl -l "'ipu1_csi0':1 -> 'ipu1_ic_prp':0[1]"
    media-ctl -l "'ipu1_ic_prp':1 -> 'ipu1_ic_prpenc':0[1]"
    media-ctl -l "'ipu1_ic_prpenc':1 -> 'ipu1_ic_prpenc capture':0[1]"
    # Configure pads
-   media-ctl -V "'ov5640 1-003c':0 [fmt:$sensorfmt field:none]"
-   media-ctl -V "'imx6-mipi-csi2':2 [fmt:$sensorfmt field:none]"
-   media-ctl -V "'ipu1_csi1':1 [fmt:AYUV32/$sensordim field:none]"
-   media-ctl -V "'ipu1_ic_prp':1 [fmt:AYUV32/$sensordim field:none]"
-   media-ctl -V "'ipu1_ic_prpenc':1 [fmt:$outputfmt field:none]"
-
-Streaming can then begin on "ipu1_ic_prpenc capture" node. The v4l2-ctl
-tool can be used to select any supported YUV or RGB pixelformat on the
-capture device node.
-
+   media-ctl -V "'ov5640 1-003c':0 [fmt:UYVY2X8/640x480]"
+   media-ctl -V "'imx6-mipi-csi2':1 [fmt:UYVY2X8/640x480]"
+   media-ctl -V "'ipu1_csi0_mux':2 [fmt:UYVY2X8/640x480]"
+   media-ctl -V "'ipu1_csi0':1 [fmt:AYUV32/640x480]"
+   media-ctl -V "'ipu1_ic_prp':1 [fmt:AYUV32/640x480]"
+   media-ctl -V "'ipu1_ic_prpenc':1 [fmt:ARGB8888_1X32/800x600]"
+   # Set a format at the capture interface
+   v4l2-ctl -d /dev/video1 --set-fmt-video=pixelformat=RGB3
+
+Streaming can then begin on "ipu1_ic_prpenc capture" node.
 
 Known Issues
 ------------
Signature · 1 line
2.17.1
author reviewer
#1 lore raw

PATCH v2 2/4 media: imx.rst: Provide an example for unprocessed video capture

The current example for imx6q-sabresd is for a direct conversion pipeline.

Provide an extra example using unprocessed video capture for completeness.

---
Changes since v1:
- None

 Documentation/media/v4l-drivers/imx.rst | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)
Documentation/media/v4l-drivers/imx.rst +20 -0
index b8df91f83f14..fb6e01976254 100644
@@ -644,6 +644,26 @@ CSI-2 OV5640 has been tested, so the OV5642 node is currently disabled.
 The OV5640 module connects to MIPI connector J5 (sorry I don't have the
 compatible module part number or URL).
 
+The following example configures unprocessed video capture pipeline to
+capture from the OV5640, transmitting on MIPI CSI-2 virtual channel 0:
+
+.. code-block:: none
+
+   # Setup links
+   media-ctl -l "'ov5640 1-003c':0 -> 'imx6-mipi-csi2':0[1]"
+   media-ctl -l "'imx6-mipi-csi2':1 -> 'ipu1_csi0_mux':0[1]"
+   media-ctl -l "'ipu1_csi0_mux':2 -> 'ipu1_csi0':0[1]"
+   media-ctl -l "'ipu1_csi0':2 -> 'ipu1_csi0 capture':0[1]"
+   # Configure pads
+   media-ctl -V "'ov5640 1-003c':0 [fmt:UYVY2X8/640x480]"
+   media-ctl -V "'imx6-mipi-csi2':1 [fmt:UYVY2X8/640x480]"
+   media-ctl -V "'ipu1_csi0_mux':0 [fmt:UYVY2X8/640x480]"
+   media-ctl -V "'ipu1_csi0':0 [fmt:AYUV32/640x480]"
+
+Streaming can then begin on "ipu1_csi0 capture" node. The v4l2-ctl
+tool can be used to select any supported pixelformat on the capture
+device node.
+
 The following example configures a direct conversion pipeline to capture
 from the OV5640, transmitting on MIPI CSI-2 virtual channel 0. It also
 shows colorspace conversion and scaling at IC output.
Signature · 1 line
2.17.1
author reviewer
#2 lore raw

PATCH v2 3/4 media: imx.rst: Provide the OV560 module part number

In reply to Fabio Estevam

In order to improve the documentation, provide the OV5640 MIPI module part number that is used on the imx6q-sabresd board.

---
Changes since v1:
- None

 Documentation/media/v4l-drivers/imx.rst | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
Documentation/media/v4l-drivers/imx.rst +2 -2
index fb6e01976254..955d27582e10 100644
@@ -641,8 +641,8 @@ connects to i2c bus 1 and the OV5640 to i2c bus 2.
 The device tree for SabreSD includes OF graphs for both the parallel
 OV5642 and the MIPI CSI-2 OV5640, but as of this writing only the MIPI
 CSI-2 OV5640 has been tested, so the OV5642 node is currently disabled.
-The OV5640 module connects to MIPI connector J5 (sorry I don't have the
-compatible module part number or URL).
+The OV5640 module connects to MIPI connector J5. The NXP part number
+for the OV5640 module that connects to the SabreSD board is H120729.
 
 The following example configures unprocessed video capture pipeline to
 capture from the OV5640, transmitting on MIPI CSI-2 virtual channel 0:
Signature · 1 line
2.17.1
author reviewer
#3 lore raw

PATCH v2 4/4 media: imx.rst: Provide streaming examples for imx6q-sabresd

In reply to Fabio Estevam

Improve the documentation by providing examples on how to test camera capture on imx6q-sabresd via v4l2-ctl and Gstreamer.

---
Changes since v1:
- Use media-ctl -e to determine the video node. (Steve)

 Documentation/media/v4l-drivers/imx.rst | 45 +++++++++++++++++++++++++
 1 file changed, 45 insertions(+)
Documentation/media/v4l-drivers/imx.rst +45 -0
index 955d27582e10..025f21def7dc 100644
@@ -664,6 +664,28 @@ Streaming can then begin on "ipu1_csi0 capture" node. The v4l2-ctl
 tool can be used to select any supported pixelformat on the capture
 device node.
 
+To determine what is the /dev/video node correspondent to
+"ipu1_csi0 capture":
+
+.. code-block:: none
+
+   media-ctl -e "ipu1_csi0 capture"
+   /dev/video0
+
+/dev/video0 is the streaming element in this case.
+
+Starting the streaming via v4l2-ctl:
+
+.. code-block:: none
+
+   v4l2-ctl --stream-mmap -d /dev/video0
+
+Starting the streaming via Gstreamer and sending the content to the display:
+
+.. code-block:: none
+
+   gst-launch-1.0 v4l2src device=/dev/video0 ! kmssink
+
 The following example configures a direct conversion pipeline to capture
 from the OV5640, transmitting on MIPI CSI-2 virtual channel 0. It also
 shows colorspace conversion and scaling at IC output.
@@ -689,6 +711,29 @@ shows colorspace conversion and scaling at IC output.
 
 Streaming can then begin on "ipu1_ic_prpenc capture" node.
 
+To determine what is the /dev/video node correspondent to
+"ipu1_ic_prpenc capture":
+
+.. code-block:: none
+
+   media-ctl -e "ipu1_ic_prpenc capture"
+   /dev/video1
+
+
+/dev/video1 is the streaming element in this case.
+
+Starting the streaming via v4l2-ctl:
+
+.. code-block:: none
+
+   v4l2-ctl --stream-mmap -d /dev/video1
+
+Starting the streaming via Gstreamer and sending the content to the display:
+
+.. code-block:: none
+
+   gst-launch-1.0 v4l2src device=/dev/video1 ! kmssink
+
 Known Issues
 ------------
 
Signature · 1 line
2.17.1
Reviewed-by on v2 4/4
#4 lore raw

Re: [PATCH v2 4/4] media: imx.rst: Provide streaming examples for imx6q-sabresd

Quoted 4 lines · Fabio Estevam

Improve the documentation by providing examples on how to test camera capture on imx6q-sabresd via v4l2-ctl and Gstreamer.

Quoted 70 lines

---
Changes since v1:
- Use media-ctl -e to determine the video node. (Steve)

  Documentation/media/v4l-drivers/imx.rst | 45 +++++++++++++++++++++++++
  1 file changed, 45 insertions(+)
Documentation/media/v4l-drivers/imx.rst +45 -0
index 955d27582e10..025f21def7dc 100644
@@ -664,6 +664,28 @@ Streaming can then begin on "ipu1_csi0 capture" node. The v4l2-ctl
  tool can be used to select any supported pixelformat on the capture
  device node.
 
+To determine what is the /dev/video node correspondent to
+"ipu1_csi0 capture":
+
+.. code-block:: none
+
+   media-ctl -e "ipu1_csi0 capture"
+   /dev/video0
+
+/dev/video0 is the streaming element in this case.
+
+Starting the streaming via v4l2-ctl:
+
+.. code-block:: none
+
+   v4l2-ctl --stream-mmap -d /dev/video0
+
+Starting the streaming via Gstreamer and sending the content to the display:
+
+.. code-block:: none
+
+   gst-launch-1.0 v4l2src device=/dev/video0 ! kmssink
+
  The following example configures a direct conversion pipeline to capture
  from the OV5640, transmitting on MIPI CSI-2 virtual channel 0. It also
  shows colorspace conversion and scaling at IC output.
@@ -689,6 +711,29 @@ shows colorspace conversion and scaling at IC output.
 
  Streaming can then begin on "ipu1_ic_prpenc capture" node.
 
+To determine what is the /dev/video node correspondent to
+"ipu1_ic_prpenc capture":
+
+.. code-block:: none
+
+   media-ctl -e "ipu1_ic_prpenc capture"
+   /dev/video1
+
+
+/dev/video1 is the streaming element in this case.
+
+Starting the streaming via v4l2-ctl:
+
+.. code-block:: none
+
+   v4l2-ctl --stream-mmap -d /dev/video1
+
+Starting the streaming via Gstreamer and sending the content to the display:
+
+.. code-block:: none
+
+   gst-launch-1.0 v4l2src device=/dev/video1 ! kmssink
+
  Known Issues
  ------------
 
Reviewed-by on v2 1/4
#5 lore raw
In reply to Fabio Estevam
Quoted 7 lines · Fabio Estevam

The current instructions for imx6q-sabresd do not lead to functional capture on OV5640 MIPI CSI-2.

The reason for this, as explained by Steve Longerbeam, is that OV5640 by default transmits on virtual channel 0, not channel 1 as is given in the instructions.

Quoted 7 lines

Adapt the instructions to use virtual channel 0 so that a working camera setup can be achieved on imx6q-sabresd.

Also, since we are using an IC direct conversion pipeline, improve the example by demonstrating colorspace and scaling.

Quoted 57 lines

---
Changes since v1:
- Demonstrate colorspace and scaling. (Steve)

  Documentation/media/v4l-drivers/imx.rst | 31 ++++++++++++-------------
  1 file changed, 15 insertions(+), 16 deletions(-)
Documentation/media/v4l-drivers/imx.rst +15 -16
index 1246573c1019..b8df91f83f14 100644
@@ -645,30 +645,29 @@ The OV5640 module connects to MIPI connector J5 (sorry I don't have the
  compatible module part number or URL).
 
  The following example configures a direct conversion pipeline to capture
-from the OV5640, transmitting on MIPI CSI-2 virtual channel 1. $sensorfmt
-can be any format supported by the OV5640. $sensordim is the frame
-dimension part of $sensorfmt (minus the mbus pixel code). $outputfmt can
-be any format supported by the ipu1_ic_prpenc entity at its output pad:
+from the OV5640, transmitting on MIPI CSI-2 virtual channel 0. It also
+shows colorspace conversion and scaling at IC output.
 
  .. code-block:: none
 
     # Setup links
     media-ctl -l "'ov5640 1-003c':0 -> 'imx6-mipi-csi2':0[1]"
-   media-ctl -l "'imx6-mipi-csi2':2 -> 'ipu1_csi1':0[1]"
-   media-ctl -l "'ipu1_csi1':1 -> 'ipu1_ic_prp':0[1]"
+   media-ctl -l "'imx6-mipi-csi2':1 -> 'ipu1_csi0_mux':0[1]"
+   media-ctl -l "'ipu1_csi0_mux':2 -> 'ipu1_csi0':0[1]"
+   media-ctl -l "'ipu1_csi0':1 -> 'ipu1_ic_prp':0[1]"
     media-ctl -l "'ipu1_ic_prp':1 -> 'ipu1_ic_prpenc':0[1]"
     media-ctl -l "'ipu1_ic_prpenc':1 -> 'ipu1_ic_prpenc capture':0[1]"
     # Configure pads
-   media-ctl -V "'ov5640 1-003c':0 [fmt:$sensorfmt field:none]"
-   media-ctl -V "'imx6-mipi-csi2':2 [fmt:$sensorfmt field:none]"
-   media-ctl -V "'ipu1_csi1':1 [fmt:AYUV32/$sensordim field:none]"
-   media-ctl -V "'ipu1_ic_prp':1 [fmt:AYUV32/$sensordim field:none]"
-   media-ctl -V "'ipu1_ic_prpenc':1 [fmt:$outputfmt field:none]"
-
-Streaming can then begin on "ipu1_ic_prpenc capture" node. The v4l2-ctl
-tool can be used to select any supported YUV or RGB pixelformat on the
-capture device node.
-
+   media-ctl -V "'ov5640 1-003c':0 [fmt:UYVY2X8/640x480]"
+   media-ctl -V "'imx6-mipi-csi2':1 [fmt:UYVY2X8/640x480]"
+   media-ctl -V "'ipu1_csi0_mux':2 [fmt:UYVY2X8/640x480]"
+   media-ctl -V "'ipu1_csi0':1 [fmt:AYUV32/640x480]"
+   media-ctl -V "'ipu1_ic_prp':1 [fmt:AYUV32/640x480]"
+   media-ctl -V "'ipu1_ic_prpenc':1 [fmt:ARGB8888_1X32/800x600]"
+   # Set a format at the capture interface
+   v4l2-ctl -d /dev/video1 --set-fmt-video=pixelformat=RGB3
+
+Streaming can then begin on "ipu1_ic_prpenc capture" node.
 
  Known Issues
  ------------