RE: i.MX53 using imx-media to capture analog video through ADV7180

2018-02-19 Thread Matthew Starr
On 02/16/2018 07:03 PM, Steve Longerbeam wrote:
> On 02/14/2018 07:44 AM, Fabio Estevam wrote:
> > [Adding Steve and Philipp in case they could provide some suggestions]
> >
> > On Wed, Feb 14, 2018 at 1:21 PM, Matthew Starr 
> wrote:
> >> I have successfully modified device tree files in the mainline 4.15.1 
> >> kernel
> to get a display product using the i.MX53 processor to initialize the 
> imx-media
> drivers.  I think up to this point they have only been tested on i.MX6
> processors.
> 
> Yes that's correct. I have not tested imx-media driver on any i.MX5 targets.
> There are likely issues with i.MX5 support.
> 
> >>I am using two ADV7180 analog capture chips, one per CSI port, on this
> display product.
> >>
> >> I have everything initialize successfully at boot, but I am unable to get 
> >> the
> media-ctl command to link the ADV7180 devices to the CSI ports.  I used the
> following website as guidance of how to setup the links between media
> devices:
> >> https://linuxtv.org/downloads/v4l-dvb-apis/v4l-drivers/imx.html
> >>
> >> When trying to link the ADV7180 chip to a CSI port, I use the following
> command and get the result below:
> >>
> >>  media-ctl -v -l "'adv7180 1-0021':0->'ipu1_csi0':0[1]"
> >>
> >>  No link between "adv7180 1-0021":0 and "ipu1_csi0":0
> >>  media_parse_setup_link: Unable to parse link
> >>  Unable to parse link: Invalid argument (22)
> >>
> >> How do I get the ADV7180 and CSI port on the i.MX53 processor to link?
> >>
> >> The difference for the i.MX53 compared to the i.MX6 processor is that
> there is only one IPU and no mipi support, so my device tree does not use
> any video-mux or mux devices.  Could this have something to do with why I
> can't link the ADV7180 to the CSI port?
> 
> It probably does. Clearly there was no media link defined from the adv7180
> to any of the CSI ports, which can also be seen from the media topology you
> printed below.
> 
> As long as the OF graph is correct, I don't see why this would have happened.
> Please send two things:
> 
> 1. Your patches to DT files
> 2. dmesg output.
> 
> There could be more issues with i.MX5 support in imx-media, but it should be
> figured out why the media links from adv7180 to the CSI ports were not
> established first.
> 
> 
> Steve
> 

Steve,

I figured out the linking issue with modifying the imx-media-of.c file in an 
attached patch (imx-media-of-support-imx53-sensor-links.patch). This change 
allowed the linking directly from the ADV7180 to the CSI port.

I also had to make some changes to the imx53.dtsi file to get the imx-capture 
driver to initially work and those changes are also in another attached patch 
(imx53-add-imx-capture-support.patch).  This included adding an alias for ipu0, 
adding the imx-capture-subsystem device, and creating CSI port endpoints.

Additionally I attached my device's shared .dtsi file (pm-041.dtsi) and .dts 
file (cl-711.dts).  In these files you can see I attached CSI0 to ADV7180_0 and 
CSI1 to ADV7180_1.  I am not sure if the imx53 can support two simultaneous 
parallel sensors on both CSI ports at the same time (although this is what I 
would really like), but at this time I would like to get at least one capture 
stream working to start with.

I attached the dmesg output as an attachment after applying my patches 
(dmesg.txt).

I am used to an old 2.6.35 Freescale kernel that supports imx53 video capture 
and I am not familiar with the updated V4L2 media linking and capture of the 
4.15 kernel.  I setup all the links with media-ctl commands and printed the 
topology in the media-ctl_imx53_adv7180.txt file that is attached 
(media-ctl_imx53_adv7180.txt).

I can't seem to get the capture to work, as I always get errors of some sort.  
There are never any errors in dmesg though so the drivers are not throwing 
errors.  Here is the output from gstreamer:
# gst-launch-1.0 -v v4l2src device=/dev/video7 ! autovideosink
Setting pipeline to PAUSED ...
Pipeline is live and does not need PREROLL ...
Setting pipeline to PLAYING ...
New clock: GstSystemClock
ERROR: from element /GstPipeline:pipeline0/GstV4l2Src:v4l2src0: Internal data 
stream error.
Additional debug info:
gstbasesrc.c(2939): gst_base_src_loop (): 
/GstPipeline:pipeline0/GstV4l2Src:v4l2src0:
streaming stopped, reason not-negotiated (-4)
Execution ended after 0:00:00.007445670
Setting pipeline to PAUSED ...
Setting pipeline to READY ...
Setting pipeline to NULL ...
Freeing pipeline ...

Any idea what could be wrong with the capture stream?

Regards,
Matt


imx53-add-imx-capture-support.patch
Description: imx53-add-imx-capture-support.patch


imx-media-of-support-imx53-sensor-links.patch
Description: imx-media-of-support-imx53-sensor-links.patch


pm-041.dtsi
Description: pm-041.dtsi


cl-711.dts
Description: cl-711.dts
# media-ctl -l "'adv7180 1-0020':0->'ipu1_csi0':0[1]"
# media-ctl -l "'ipu1_csi0':1->'ipu1_vdic':0[1]"
# media-ctl -l "'ipu1_vdic':2->'ipu1_ic_prp':0[1]"
# media-

Re: i.MX53 using imx-media to capture analog video through ADV7180

2018-02-16 Thread Steve Longerbeam

Hi Mathew,


On 02/14/2018 07:44 AM, Fabio Estevam wrote:

[Adding Steve and Philipp in case they could provide some suggestions]

On Wed, Feb 14, 2018 at 1:21 PM, Matthew Starr  wrote:

I have successfully modified device tree files in the mainline 4.15.1 kernel to 
get a display product using the i.MX53 processor to initialize the imx-media 
drivers.  I think up to this point they have only been tested on i.MX6 
processors.


Yes that's correct. I have not tested imx-media driver on any i.MX5 targets.
There are likely issues with i.MX5 support.


   I am using two ADV7180 analog capture chips, one per CSI port, on this 
display product.

I have everything initialize successfully at boot, but I am unable to get the 
media-ctl command to link the ADV7180 devices to the CSI ports.  I used the 
following website as guidance of how to setup the links between media devices:
https://linuxtv.org/downloads/v4l-dvb-apis/v4l-drivers/imx.html

When trying to link the ADV7180 chip to a CSI port, I use the following command 
and get the result below:

 media-ctl -v -l "'adv7180 1-0021':0->'ipu1_csi0':0[1]"

 No link between "adv7180 1-0021":0 and "ipu1_csi0":0
 media_parse_setup_link: Unable to parse link
 Unable to parse link: Invalid argument (22)

How do I get the ADV7180 and CSI port on the i.MX53 processor to link?

The difference for the i.MX53 compared to the i.MX6 processor is that there is 
only one IPU and no mipi support, so my device tree does not use any video-mux 
or mux devices.  Could this have something to do with why I can't link the 
ADV7180 to the CSI port?


It probably does. Clearly there was no media link defined from
the adv7180 to any of the CSI ports, which can also be seen from
the media topology you printed below.

As long as the OF graph is correct, I don't see why this would have
happened. Please send two things:

1. Your patches to DT files
2. dmesg output.

There could be more issues with i.MX5 support in imx-media, but
it should be figured out why the media links from adv7180 to the CSI
ports were not established first.


Steve



Here is the output of the "media-ctl -p -v" command:

Opening media device /dev/media0
Enumerating entities
looking up device: 81:10
looking up device: 81:11
looking up device: 81:12
looking up device: 81:4
looking up device: 81:13
looking up device: 81:5
looking up device: 81:14
looking up device: 81:15
looking up device: 81:16
looking up device: 81:17
looking up device: 81:6
looking up device: 81:18
looking up device: 81:7
looking up device: 81:19
looking up device: 81:20
looking up device: 81:8
looking up device: 81:21
looking up device: 81:9
Found 18 entities
Enumerating pads and links
Media controller API version 4.15.1

Media device information

driver  imx-media
model   imx-media
serial
bus info
hw revision 0x0
driver version  4.15.1

Device topology
- entity 1: adv7180 1-0021 (1 pad, 0 link)
 type V4L2 subdev subtype Unknown flags 20004
 device node name /dev/v4l-subdev0
 pad0: Source
 [fmt:UYVY8_2X8/720x480 field:interlaced]

- entity 3: adv7180 1-0020 (1 pad, 0 link)
 type V4L2 subdev subtype Unknown flags 20004
 device node name /dev/v4l-subdev1
 pad0: Source
 [fmt:UYVY8_2X8/720x480 field:interlaced]

- entity 5: ipu1_csi1 (3 pads, 3 links)
 type V4L2 subdev subtype Unknown flags 0
 device node name /dev/v4l-subdev2
 pad0: Sink
 [fmt:UYVY8_2X8/640x480 field:none
  crop.bounds:(0,0)/640x480
  crop:(0,0)/640x480
  compose.bounds:(0,0)/640x480
  compose:(0,0)/640x480]
 pad1: Source
 [fmt:AYUV8_1X32/640x480 field:none]
 -> "ipu1_ic_prp":0 []
 -> "ipu1_vdic":0 []
 pad2: Source
 [fmt:AYUV8_1X32/640x480 field:none]
 -> "ipu1_csi1 capture":0 []

- entity 9: ipu1_csi1 capture (1 pad, 1 link)
 type Node subtype V4L flags 0
 device node name /dev/video4
 pad0: Sink
 <- "ipu1_csi1":2 []

- entity 15: ipu1_csi0 (3 pads, 3 links)
  type V4L2 subdev subtype Unknown flags 0
  device node name /dev/v4l-subdev3
 pad0: Sink
 [fmt:UYVY8_2X8/640x480 field:none
  crop.bounds:(0,0)/640x480
  crop:(0,0)/640x480
  compose.bounds:(0,0)/640x480
  compose:(0,0)/640x480]
 pad1: Source
 [fmt:AYUV8_1X32/640x480 field:none]
 -> "ipu1_ic_prp":0 []
 -> "ipu1_vdic":0 [ENABLED]
 pad2: Source
 [fmt:AYUV8_1X32/640x480 field:none]
 -> "ipu1_csi0 capture":0 []

- entity 19: ipu1_csi0 capture (1 pad, 1 link)
  type Node subtype V4L flags 0

Re: i.MX53 using imx-media to capture analog video through ADV7180

2018-02-14 Thread Fabio Estevam
[Adding Steve and Philipp in case they could provide some suggestions]

On Wed, Feb 14, 2018 at 1:21 PM, Matthew Starr  wrote:
> I have successfully modified device tree files in the mainline 4.15.1 kernel 
> to get a display product using the i.MX53 processor to initialize the 
> imx-media drivers.  I think up to this point they have only been tested on 
> i.MX6 processors.  I am using two ADV7180 analog capture chips, one per CSI 
> port, on this display product.
>
> I have everything initialize successfully at boot, but I am unable to get the 
> media-ctl command to link the ADV7180 devices to the CSI ports.  I used the 
> following website as guidance of how to setup the links between media devices:
> https://linuxtv.org/downloads/v4l-dvb-apis/v4l-drivers/imx.html
>
> When trying to link the ADV7180 chip to a CSI port, I use the following 
> command and get the result below:
>
> media-ctl -v -l "'adv7180 1-0021':0->'ipu1_csi0':0[1]"
>
> No link between "adv7180 1-0021":0 and "ipu1_csi0":0
> media_parse_setup_link: Unable to parse link
> Unable to parse link: Invalid argument (22)
>
> How do I get the ADV7180 and CSI port on the i.MX53 processor to link?
>
> The difference for the i.MX53 compared to the i.MX6 processor is that there 
> is only one IPU and no mipi support, so my device tree does not use any 
> video-mux or mux devices.  Could this have something to do with why I can't 
> link the ADV7180 to the CSI port?
>
> Here is the output of the "media-ctl -p -v" command:
>
> Opening media device /dev/media0
> Enumerating entities
> looking up device: 81:10
> looking up device: 81:11
> looking up device: 81:12
> looking up device: 81:4
> looking up device: 81:13
> looking up device: 81:5
> looking up device: 81:14
> looking up device: 81:15
> looking up device: 81:16
> looking up device: 81:17
> looking up device: 81:6
> looking up device: 81:18
> looking up device: 81:7
> looking up device: 81:19
> looking up device: 81:20
> looking up device: 81:8
> looking up device: 81:21
> looking up device: 81:9
> Found 18 entities
> Enumerating pads and links
> Media controller API version 4.15.1
>
> Media device information
> 
> driver  imx-media
> model   imx-media
> serial
> bus info
> hw revision 0x0
> driver version  4.15.1
>
> Device topology
> - entity 1: adv7180 1-0021 (1 pad, 0 link)
> type V4L2 subdev subtype Unknown flags 20004
> device node name /dev/v4l-subdev0
> pad0: Source
> [fmt:UYVY8_2X8/720x480 field:interlaced]
>
> - entity 3: adv7180 1-0020 (1 pad, 0 link)
> type V4L2 subdev subtype Unknown flags 20004
> device node name /dev/v4l-subdev1
> pad0: Source
> [fmt:UYVY8_2X8/720x480 field:interlaced]
>
> - entity 5: ipu1_csi1 (3 pads, 3 links)
> type V4L2 subdev subtype Unknown flags 0
> device node name /dev/v4l-subdev2
> pad0: Sink
> [fmt:UYVY8_2X8/640x480 field:none
>  crop.bounds:(0,0)/640x480
>  crop:(0,0)/640x480
>  compose.bounds:(0,0)/640x480
>  compose:(0,0)/640x480]
> pad1: Source
> [fmt:AYUV8_1X32/640x480 field:none]
> -> "ipu1_ic_prp":0 []
> -> "ipu1_vdic":0 []
> pad2: Source
> [fmt:AYUV8_1X32/640x480 field:none]
> -> "ipu1_csi1 capture":0 []
>
> - entity 9: ipu1_csi1 capture (1 pad, 1 link)
> type Node subtype V4L flags 0
> device node name /dev/video4
> pad0: Sink
> <- "ipu1_csi1":2 []
>
> - entity 15: ipu1_csi0 (3 pads, 3 links)
>  type V4L2 subdev subtype Unknown flags 0
>  device node name /dev/v4l-subdev3
> pad0: Sink
> [fmt:UYVY8_2X8/640x480 field:none
>  crop.bounds:(0,0)/640x480
>  crop:(0,0)/640x480
>  compose.bounds:(0,0)/640x480
>  compose:(0,0)/640x480]
> pad1: Source
> [fmt:AYUV8_1X32/640x480 field:none]
> -> "ipu1_ic_prp":0 []
> -> "ipu1_vdic":0 [ENABLED]
> pad2: Source
> [fmt:AYUV8_1X32/640x480 field:none]
> -> "ipu1_csi0 capture":0 []
>
> - entity 19: ipu1_csi0 capture (1 pad, 1 link)
>  type Node subtype V4L flags 0
>  device node name /dev/video5
> pad0: Sink
> <- "ipu1_csi0":2 []
>
> - entity 25: ipu1_ic_prp (3 pads, 5 links)
>  type V4L2 subdev subtype Unknown flags 0
>  device node name /dev/v4l-subdev4
> pad0: Sink
> [fmt:AYUV8_1X32/640x480 field:none]
> <- "ipu1_csi1":1 []
> <- "ipu1_csi0":1 []
> <- "ipu1_vdic":2 [ENABLED]
> pad1: Source
> [fmt:AYUV8_1X32/640x480 field:n