This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Linux/AM5728: ADV7842 Linux Driver

Part Number: AM5728

Tool/software: Linux

Hello,

we connected the adv7842 to the vip on the EVM572x Evaboard. Via kernel config we included the adv7842 driver which is included in the kernel sources. Adv 7842 is included as loadable module. The device tree looks like this:

&i2c5 {
status = "okay";
clock-frequency = <400000>;

adv7842@20 {
compatible = "adi,adv7842";
reg = <0x20>;

port {
adv7842_1: endpoint {
remote-endpoint = <&vin3a>;
hsync-active = <1>;
vsync-active = <1>;
data-active = <1>;
pclk-sample = <0>;
bus-width = <16>;
};
};
};
};

&vin3a {
status = "okay";
endpoint {
slave-mode;
remote-endpoint = <&adv7842_1>;
};
};

When we do an insmod of the adv7842.ko file we get the following error message:

root@am57xx-evm:/lib/modules/4.4.19-gdb0b54cdad/kernel/drivers/media/i2c# dmesg
[ 250.749130] adv7842 4-0020: No platform data!

root@am57xx-evm:/lib/modules/4.4.19-gdb0b54cdad/kernel/drivers/media/i2c# modinfo adv7842
filename: /lib/modules/4.4.19-gdb0b54cdad/kernel/drivers/media/i2c/adv7842.ko
license: GPL
author: Martin Bugge <marbugge@cisco.com>
author: Hans Verkuil <hans.verkuil@cisco.com>
description: Analog Devices ADV7842 video decoder driver
srcversion: 4F006C2154452E099328C17
alias: i2c:adv7842
depends:
intree: Y
vermagic: 4.4.19-gdb0b54cdad SMP preempt mod_unload modversions ARMv7 p2v8
parm: debug:debug level (0-2) (int)

What could be the reason for that?

Thanks for your help

Marc

  • I realized that the included version of the adv7842 driver doesn't support device tree bindings. Do you have an updated version which supports device tree?

  • Hi Marc,

    You can check the ADV7842 linux driver in the latest PSDK 3.03 (kernel 4.4.41).

    You can also check the latest driver in mainline linux (4.11):
    elixir.free-electrons.com/.../adv7842.c

    See also if the below wiiki pages will be in help:

    processors.wiki.ti.com/.../Linux_Core_VIP_User's_Guide
    processors.wiki.ti.com/.../Processor_SDK_VIP_Driver

    Regards,
    Pavel
  • Hello,

    I modified the adv7842 driver so that minimum device tree support is available and all needed interfaces for vip are implemented. vip and adv7842 driver are bound and /dev/video1 device is created. HSync, Vsync and pixel clock are output.


    When I run the dmabuftest, the following output is produced.


    root@am57xx-evm:~# dmabuftest -s 32:640x480 -c 1280x800@YUYV -d /dev/video1
    Opening Display..
    using 1 connectors, 640x480 display, multiplanar: 1
    Opening V4L2..
    Exported buffer fd = 6

    Exported buffer fd = 8

    Exported buffer fd = 10

    Exported buffer fd = 12

    Exported buffer fd = 14

    Exported buffer fd = 16

    ^C
    root@am57xx-evm:~# dmesg
    [ 2705.123032] vip2-s0: vip_open
    [ 2705.123053] adv7842 4-0020: adv7842_get_format start
    [ 2705.128042] adv7842 4-0020: adv7842_get_format end
    [ 2705.133542] vip2-s0: vip_init_port: g_mbus_fmt subdev mbus_code: 100A fourcc:RGB3 size: 640x480
    [ 2705.133559] vip2-s0: calc_format_size: fourcc:RGB3 size: 640x480 bpl:1920 img_size:921600
    [ 2705.133570] vip2-s0: init_stream fourcc:RGB3 size: 640x480 bpl:1920 img_size:921600
    [ 2705.133579] vip2-s0: init_stream vpdma data type: 0x16
    [ 2705.133590] vip2-s0: vip_init_stream: stream instance 0x00000001ed442800
    [ 2705.133623] vip2-s0: g_fmt fourcc:RGB3 code: 100a size: 640x480 bpl:1920 img_size:921600
    [ 2705.133631] vip2-s0: g_fmt vpdma data type: 0x16
    [ 2705.133637] video1: VIDIOC_G_FMT: type=vid-cap, width=640, height=480, pixelformat=RGB3, field=none, bytesperline=1920, sizeimage=921600, colorspace=8, flags=0x0, ycbcr_enc=0, quantization=0, xfer_func=0
    [ 2705.133672] vip2-s0: s_fmt input fourcc:YUYV size: 1280x800
    [ 2705.133681] vip2-s0: try_fmt fourcc:YUYV size: 1280x800
    [ 2705.133688] vip2-s0: Fourcc format (0x56595559) not found.
    [ 2705.133697] adv7842 4-0020: adv7842_enum_frame_sizes:
    [ 2705.133705] adv7842 4-0020: fse->index = 0
    [ 2705.137875] adv7842 4-0020: fse->code = 4106
    [ 2705.142285] vip2-s0: try_fmt loop:0 fourcc:RGB3 size: 640x480
    [ 2705.142295] vip2-s0: try_fmt loop:0 found new larger: 640x480
    [ 2705.142301] adv7842 4-0020: adv7842_enum_frame_sizes:
    [ 2705.142307] adv7842 4-0020: fse->index = 1
    [ 2705.146525] adv7842 4-0020: fse->code = 4106
    [ 2705.150935] vip2-s0: try_fmt best subdev size: 640x480
    [ 2705.150946] vip2-s0: calc_format_size: fourcc:RGB3 size: 640x480 bpl:1920 img_size:921600
    [ 2705.150953] vip2-s0: s_fmt try_fmt fourcc:RGB3 size: 640x480
    [ 2705.150961] vip2-s0: s_fmt fourcc:RGB3 size: 640x480 bpl:1920 img_size:921600
    [ 2705.150978] vip2-s0: s_fmt pix_to_mbus mbus_code: 100A size: 640x480
    [ 2705.150985] adv7842 4-0020: adv7842_set_format start
    [ 2705.156074] adv7842 4-0020: format.code = 4106
    [ 2705.175704] adv7842 4-0020: adv7842_set_format end
    [ 2705.180540] vip2-s0: s_fmt subdev fmt mbus_code: 100A size: 640x480
    [ 2705.180547] vip2-s0: s_fmt vpdma data type: 0x16
    [ 2705.180553] video1: VIDIOC_S_FMT: type=vid-cap, width=640, height=480, pixelformat=RGB3, field=none, bytesperline=1920, sizeimage=921600, colorspace=8, flags=0x0, ycbcr_enc=0, quantization=0, xfer_func=0
    [ 2705.180933] vip2-s0: get 6 buffer(s) of size 921600 each.
    [ 2705.180948] vb2: __vb2_queue_alloc: allocated 6 buffers, 1 plane(s) each
    [ 2705.187677] video1: VIDIOC_REQBUFS: count=6, type=vid-cap, memory=dmabuf
    [ 2705.187764] video1: VIDIOC_QUERYBUF: 00:00:00.00000000 index=0, type=vid-cap, flags=0x00002000, field=any, sequence=0, memory=dmabuf, bytesused=0, offset/userptr=0x0, length=921600
    [ 2705.187796] timecode=00:00:00 type=0, flags=0x00000000, frames=0, userbits=0x00000000
    [ 2705.187839] video1: VIDIOC_QUERYBUF: 00:00:00.00000000 index=1, type=vid-cap, flags=0x00002000, field=any, sequence=0, memory=dmabuf, bytesused=0, offset/userptr=0x0, length=921600
    [ 2705.187872] timecode=00:00:00 type=0, flags=0x00000000, frames=0, userbits=0x00000000
    [ 2705.187914] video1: VIDIOC_QUERYBUF: 00:00:00.00000000 index=2, type=vid-cap, flags=0x00002000, field=any, sequence=0, memory=dmabuf, bytesused=0, offset/userptr=0x0, length=921600
    [ 2705.187939] timecode=00:00:00 type=0, flags=0x00000000, frames=0, userbits=0x00000000
    [ 2705.187976] video1: VIDIOC_QUERYBUF: 00:00:00.00000000 index=3, type=vid-cap, flags=0x00002000, field=any, sequence=0, memory=dmabuf, bytesused=0, offset/userptr=0x0, length=921600
    [ 2705.188001] timecode=00:00:00 type=0, flags=0x00000000, frames=0, userbits=0x00000000
    [ 2705.188037] video1: VIDIOC_QUERYBUF: 00:00:00.00000000 index=4, type=vid-cap, flags=0x00002000, field=any, sequence=0, memory=dmabuf, bytesused=0, offset/userptr=0x0, length=921600
    [ 2705.188063] timecode=00:00:00 type=0, flags=0x00000000, frames=0, userbits=0x00000000
    [ 2705.188098] video1: VIDIOC_QUERYBUF: 00:00:00.00000000 index=5, type=vid-cap, flags=0x00002000, field=any, sequence=0, memory=dmabuf, bytesused=0, offset/userptr=0x0, length=921600
    [ 2705.188123] timecode=00:00:00 type=0, flags=0x00000000, frames=0, userbits=0x00000000
    [ 2705.188184] vb2: __qbuf_dmabuf: buffer for plane 0 changed
    [ 2705.198651] vb2: vb2_core_qbuf: qbuf of buffer 0 succeeded
    [ 2705.204310] vb2: __qbuf_dmabuf: buffer for plane 0 changed
    [ 2705.212445] vb2: vb2_core_qbuf: qbuf of buffer 1 succeeded
    [ 2705.217973] vb2: __qbuf_dmabuf: buffer for plane 0 changed
    [ 2705.226008] vb2: vb2_core_qbuf: qbuf of buffer 2 succeeded
    [ 2705.231565] vb2: __qbuf_dmabuf: buffer for plane 0 changed
    [ 2705.239508] vb2: vb2_core_qbuf: qbuf of buffer 3 succeeded
    [ 2705.245030] vb2: __qbuf_dmabuf: buffer for plane 0 changed
    [ 2705.253054] vb2: vb2_core_qbuf: qbuf of buffer 4 succeeded
    [ 2705.258606] vb2: __qbuf_dmabuf: buffer for plane 0 changed
    [ 2705.266516] vb2: vb2_core_qbuf: qbuf of buffer 5 succeeded
    [ 2705.272076] vip2-s0: vip_set_slice_path:
    [ 2705.272088] vip2-s0: vip_set_slice_path: DATA_PATH_SELECT(0000010C): 40008080
    [ 2705.272099] vip2-s0: vip_set_slice_path:
    [ 2705.272112] vip2-s0: vip_set_slice_path: DATA_PATH_SELECT(0000010C): 00008000
    [ 2705.272397] vip2-s0: start_streaming: buf 0xed6ba000 6
    [ 2705.272406] adv7842 4-0020: adv7842_s_stream:
    [ 2705.272419] vip2-s0: start_streaming: start_dma buf 0xed6ba000
    [ 2705.272428] vip2-s0: start_dma: buf:0xed6ba000, vb:0xed6ba000, dma_addr:0x7f59c000
    [ 2705.272439] vb2: vb2_core_streamon: successful
    [ 2705.272445] vip2-s0: IRQ 366 VIP_INT0_STATUS0 0x1
    [ 2705.276909] vip2-s0: IRQ 0: handling LIST0_COMPLETE
    [ 2705.276916] vip2-s0: added next buffer
    [ 2705.276923] vip2-s0: start_dma: buf:0xed6baa00, vb:0xed6baa00, dma_addr:0x7f3a8000
    [ 2705.276942] vip2-s0: IRQ 366 VIP_INT0_STATUS0 0x1
    [ 2705.276950] vip2-s0: IRQ 0: handling LIST0_COMPLETE
    [ 2705.276956] vip2-s0: added next buffer
    [ 2705.276964] vip2-s0: start_dma: buf:0xed6ba600, vb:0xed6ba600, dma_addr:0x7f1b4000
    [ 2705.277063] video1: VIDIOC_STREAMON: type=vid-cap
    [ 2705.277086] vb2: __vb2_wait_for_done_vb: will sleep waiting for buffers
    [ 2706.768830] vb2: __vb2_wait_for_done_vb: sleep was interrupted
    [ 2706.775679] vip2-s0: vip_release
    [ 2706.775691] vip2-s0: vip_stop_streaming:
    [ 2706.775697] vip2-s0: vip_disable_sc_path:
    [ 2706.775705] adv7842 4-0020: adv7842_s_stream:
    [ 2706.775714] vip2-s0: Clear channel no: 38
    [ 2706.775931] vip2-s0: vip_release_stream: stream instance 0x00026698ed442800
    [ 2706.775941] vip2-s0: vip_release_port: port instance 0xed4f20c0ed64d010

    Check Interrupts:


    root@am57xx-evm:~# cat /proc/interrupts | grep vip
    366: 2 0 CBAR 352 Level vip2-s0
    367: 0 0 CBAR 393 Level vip2-s1
    root@am57xx-evm:~#
    root@am57xx-evm:~#
    root@am57xx-evm:~#

    Read Parser Size Register:

    root@am57xx-evm:~# devmem2 0x48995530
    /dev/mem opened.
    Memory mapped at address 0xb6f5a000.
    Read at address 0x48995530 (0xb6f5a530): 0x00000000
    root@am57xx-evm:~#


    Vip doesn't detect the sync and clock signals. How can I tell vip driver which polarity the sync and clocks have? What polarities does tzhe vip use by default?

    Thanks

    Marc

  • Hi Pavel,

    any update on this? The vip only generates the first two interrupts and is then waiting forever when I run the yavta dmabuftest. Hsync, vsync and pclk are running. Is there anything which must be enabled for the vip to start? Subdevice driver and /dev/video1 device are available.

    Thanks

    Marc
  • Marc48067 said:
    Vip doesn't detect the sync and clock signals. How can I tell vip driver which polarity the sync and clocks have? What polarities does tzhe vip use by default?

    Marc,

    To define a video interface, there are some predefined bindings like hsync/vsync/pclk polarity, bus-width, etc. Refer to linux documentation for more info about endpoint bindings lxr.free-electrons.com/.../video-interfaces.txt

    Different camera / video sources have different configuration parameters when interfacing with the VIP video ports. Common interfacing properties like Hsync, Vsync, Pclk polarities can be different across different devices. V4L2 endpoint allows to describe these as part of device tree definition. This makes the VIP driver generic enough to have no dependency on the camera device. It also provides the flexibility to work with new cameras by doing simple device tree modifications.