diff mbox series

[RFC] media: imx.rst: Fix the links/pads configuration for imx6qsabresd

Message ID 20200407180534.2871-1-festevam@gmail.com (mailing list archive)
State New, archived
Headers show
Series [RFC] media: imx.rst: Fix the links/pads configuration for imx6qsabresd | expand

Commit Message

Fabio Estevam April 7, 2020, 6:05 p.m. UTC
The current instructions do not lead to functional capture on
a i.MX6Q sabresd board.

Fix the instructions so that users can get the OV5640 camera to
work by default.

Tested by two methods:

1. Using v4l2-ctl:

# v4l2-ctl --stream-mmap -d /dev/video0

2. Using a Gstreamer pipeline that captures from the camera and direct
the image to the display:

# gst-launch-1.0 v4l2src ! kmssink

Signed-off-by: Fabio Estevam <festevam@gmail.com>
---
Hi Steve,

Were the instructions written based on a i.MX6DL sabresd?

I don't have access to a i.MX6DL sabresd board to confirm if they
are still working, but I noticed that these instructions do not work on
a i.MX6Q sabresd board, so that's why I modified it and now the capture
works fine here.

Please advise.

Thanks

 Documentation/media/v4l-drivers/imx.rst | 24 ++++++++++--------------
 1 file changed, 10 insertions(+), 14 deletions(-)

Comments

Steve Longerbeam April 7, 2020, 11:01 p.m. UTC | #1
Hi Fabio,

I do believe the problem you're having is that the OV5640 by default 
transmits on virtual channel 0, not channel 1 as is given in the 
instructions in imx.rst.

But I do agree the instructions are now misleading because of the OV5640 
defaults, and probably should be changed for the virtual channel 0 pipeline.

Can you try the virtual channel 0 pipeline:

     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':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]"

     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':0 [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':0 [fmt:AYUV32/640x480]"
     media-ctl -V "'ipu1_ic_prpenc':1 [fmt:AYUV32/640x480]"

     vdev=`media-ctl -e "ipu1_ic_prpenc capture"`

     v4l2-ctl -d $vdev --set-fmt-video=width=640,height=480


You can also try changing the ov5640 module parameter virtual_channel to 
channel 1:

     echo "options ov5640 virtual_channel=1" > /etc/modprobe.d/ov5640.conf

then reboot and try the instructions again.


On 4/7/20 11:05 AM, Fabio Estevam wrote:
> The current instructions do not lead to functional capture on
> a i.MX6Q sabresd board.
>
> Fix the instructions so that users can get the OV5640 camera to
> work by default.
>
> Tested by two methods:
>
> 1. Using v4l2-ctl:
>
> # v4l2-ctl --stream-mmap -d /dev/video0
>
> 2. Using a Gstreamer pipeline that captures from the camera and direct
> the image to the display:
>
> # gst-launch-1.0 v4l2src ! kmssink
>
> Signed-off-by: Fabio Estevam <festevam@gmail.com>
> ---
> Hi Steve,
>
> Were the instructions written based on a i.MX6DL sabresd?

No the instructions are for the i.MX6Q. I have a patch pending that 
clarifies that.

Steve


>
> I don't have access to a i.MX6DL sabresd board to confirm if they
> are still working, but I noticed that these instructions do not work on
> a i.MX6Q sabresd board, so that's why I modified it and now the capture
> works fine here.
>
> Please advise.
>
> Thanks
>
>   Documentation/media/v4l-drivers/imx.rst | 24 ++++++++++--------------
>   1 file changed, 10 insertions(+), 14 deletions(-)
>
> diff --git a/Documentation/media/v4l-drivers/imx.rst b/Documentation/media/v4l-drivers/imx.rst
> index 1246573c1019..0588060ead27 100644
> --- a/Documentation/media/v4l-drivers/imx.rst
> +++ b/Documentation/media/v4l-drivers/imx.rst
> @@ -645,27 +645,23 @@ 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 1:
>   
>   .. 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 "'ipu1_ic_prp':1 -> 'ipu1_ic_prpenc':0[1]"
> -   media-ctl -l "'ipu1_ic_prpenc':1 -> 'ipu1_ic_prpenc capture':0[1]"
> +   media-ctl -l "'imx6-mipi-csi2':1 -> 'ipu1_csi0_mux':[1]"
> +   media-ctl -l "'ipu1_csi0_mux':2 -> 'ipu1_csi0':[1]"
> +   media-ctl -l "'ipu1_csi0':2 -> 'ipu1_csi0 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]"
> +   media-ctl -V "'ov5640 1-003c':0 [fmt:UYVY2X8/640x480 field:none]"
> +   media-ctl -V "'imx6-mipi-csi2':2 [fmt:UYVY2X8/640x480 field:none]"
> +   media-ctl -V "'ipu1_csi0_mux':0[fmt:UYVY2X8/640x480]"
> +   media-ctl -V "'ipu1_csi0':0[fmt:UYVY2X8/640x480]"
>   
> -Streaming can then begin on "ipu1_ic_prpenc capture" node. The v4l2-ctl
> +Streaming can then begin on "ipu1_csi0 capture" node. The v4l2-ctl
>   tool can be used to select any supported YUV or RGB pixelformat on the
>   capture device node.
>
Fabio Estevam April 7, 2020, 11:18 p.m. UTC | #2
Hi Steve,

On Tue, Apr 7, 2020 at 8:01 PM Steve Longerbeam <slongerbeam@gmail.com> wrote:
>
> Hi Fabio,
>
> I do believe the problem you're having is that the OV5640 by default
> transmits on virtual channel 0, not channel 1 as is given in the
> instructions in imx.rst.
>
> But I do agree the instructions are now misleading because of the OV5640
> defaults, and probably should be changed for the virtual channel 0 pipeline.
>
> Can you try the virtual channel 0 pipeline:
>
>      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':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]"
>
>      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':0 [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':0 [fmt:AYUV32/640x480]"
>      media-ctl -V "'ipu1_ic_prpenc':1 [fmt:AYUV32/640x480]"

Thanks! By running the lines above I can get the streaming to work
successfully with:

v4l2-ctl --stream-mmap -d /dev/video1

and also:

gst-launch-1.0 v4l2src device=/dev/video1! kmssink

I will submit a formal patch with these instructions.

Thanks for your help.
diff mbox series

Patch

diff --git a/Documentation/media/v4l-drivers/imx.rst b/Documentation/media/v4l-drivers/imx.rst
index 1246573c1019..0588060ead27 100644
--- a/Documentation/media/v4l-drivers/imx.rst
+++ b/Documentation/media/v4l-drivers/imx.rst
@@ -645,27 +645,23 @@  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 1:
 
 .. 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 "'ipu1_ic_prp':1 -> 'ipu1_ic_prpenc':0[1]"
-   media-ctl -l "'ipu1_ic_prpenc':1 -> 'ipu1_ic_prpenc capture':0[1]"
+   media-ctl -l "'imx6-mipi-csi2':1 -> 'ipu1_csi0_mux':[1]"
+   media-ctl -l "'ipu1_csi0_mux':2 -> 'ipu1_csi0':[1]"
+   media-ctl -l "'ipu1_csi0':2 -> 'ipu1_csi0 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]"
+   media-ctl -V "'ov5640 1-003c':0 [fmt:UYVY2X8/640x480 field:none]"
+   media-ctl -V "'imx6-mipi-csi2':2 [fmt:UYVY2X8/640x480 field:none]"
+   media-ctl -V "'ipu1_csi0_mux':0[fmt:UYVY2X8/640x480]"
+   media-ctl -V "'ipu1_csi0':0[fmt:UYVY2X8/640x480]"
 
-Streaming can then begin on "ipu1_ic_prpenc capture" node. The v4l2-ctl
+Streaming can then begin on "ipu1_csi0 capture" node. The v4l2-ctl
 tool can be used to select any supported YUV or RGB pixelformat on the
 capture device node.