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.

AM572x VIN4a V4L2 interface with TVP5158 analog video decoder

Other Parts Discussed in Thread: TVP5158, AM5728

Hi,

TI,there is a tvp5158 on the vin4a port of my am5728 board,and I use the kernel from origin/processor-sdk-linux-03.01.00 branch.I got a tvp5158 driver from p-ti-lsk-linux-4.4.y-next branch.The dts file configuration like that:

Now the problem is that I can not capture the video.When I run the test software,it will show me that:

[  513.941189] vip2-s1: vip_open

[  513.941650] tvp5158 3-005f: NTSC video detected

[  513.946205] vip2-s1: vip_init_port: g_mbus_fmt subdev mbus_code: 2006 fourcc:NV12 size: 720x240

[  513.946219] vip2-s1: calc_format_size: fourcc:NV12 size: 720x240 bpl:720 img_size:259200

[  513.946228] vip2-s1: init_stream fourcc:NV12 size: 720x240 bpl:720 img_size:259200

[  513.946235] vip2-s1: init_stream vpdma data type: 0x02

[  513.946244] vip2-s1: vip_init_stream: stream instance 0x00000001ed34e800

[  513.946272] vip2-s1: cropped (0,0)/720x240 of 720x240

[  513.946283] drivers/media/platform/ti-vpe/vip.c vip_s_fmt_vid_cap

[  513.958866] vip2-s1: s_fmt input fourcc:VYUY size: 720x480

[  513.958877] s_fmt input fourcc:VYUY size: 720x480

[  513.963621] vip2-s1: try_fmt fourcc:VYUY size: 720x480

[  513.963630] vip2-s1: try_fmt loop:0 fourcc:VYUY size: 720x480

[  513.963638] vip2-s1: try_fmt loop:0 found new larger: 720x480

[  513.963645] vip2-s1: try_fmt loop:0 found at least larger: 720x480

[  513.963651] vip2-s1: try_fmt loop:0 found new best: 720x480

[  513.963658] vip2-s1: try_fmt loop:0 found direct match: 720x480

[  513.963666] vip2-s1: calc_format_size: fourcc:VYUY size: 720x480 bpl:1440 img_size:691200

[  513.963673] vip2-s1: s_fmt try_fmt fourcc:VYUY size: 720x480

[  513.963681] vip2-s1: s_fmt fourcc:VYUY size: 720x480 bpl:1440 img_size:691200

[  513.963688] vip2-s1: s_fmt pix_to_mbus mbus_code: 2006 size: 720x480

[  513.964136] tvp5158 3-005f: NTSC video detected

[  513.968688] vip2-s1: s_fmt subdev fmt mbus_code: 2006 size: 720x240

[  513.968695] vip2-s1: s_fmt vpdma data type: 0x37

[  513.968701] v4l_s_fmt line = 1459 ret = 0

[  513.973115] vip2-s1: get 4 buffer(s) of size 691200 each.

[  513.976056] vip2-s1: vip_set_slice_path:

[  513.976069] vip2-s1: vip_set_slice_path: DATA_PATH_SELECT(00000110): 00008000

[  513.976355] vip2-s1: start_streaming: buf 0xee156e00 4

[  513.976594] vip2-s1: start_streaming: start_dma buf 0xee156e00

[  513.976604] vip2-s1: start_dma: buf:0xee156e00, vb:0xee156e00, dma_addr:0xbe600000

[  513.976623] vip2-s1: IRQ 373 VIP_INT1_STATUS0 0x1

[  513.976631] vip2-s1: IRQ 1: handling LIST0_COMPLETE

[  513.976637] vip2-s1: added next buffer

[  513.976645] vip2-s1: start_dma: buf:0xee157c00, vb:0xee157c00, dma_addr:0xbe700000

[  513.976661] vip2-s1: IRQ 373 VIP_INT1_STATUS0 0x1

[  513.976668] vip2-s1: IRQ 1: handling LIST0_COMPLETE

[  513.976674] vip2-s1: added next buffer

[  513.976682] vip2-s1: start_dma: buf:0xef21bc00, vb:0xef21bc00, dma_addr:0xbe800000

It seems like the driver only go into the vip_irq  function (locate in drivers\media\platform\ti-vpe\vip.c) twice.What is the problem?

If it got the video, I think it will go into the vip_irq  function again and again.But it not!

What happens will the interrupt occur?

BR,

vefone



  • The video experts have been notified. They will respond here.
  • Vefone,

    Please remove the pclk-sample = <0> line from your dts file and also share the v4l2 logs. You can enable v4l2 frameworks logs as follows before running your application - Here X in VideoX is your device number.
    echo 3 > /sys/class/video4linux/videoX/dev_debug
  • Hi,

    manisha,after run "echo 3 > /sys/class/video4linux/video1/dev_debug", I run "yavta -c2 -p -F/home/root/5158.yuv --skip 0 -t 1/25 -f NV12 -s 720x480 /dev/video1" to capture.Here are the debug log:

    [ 122.613346] vip2-s1: vip_open
    [ 122.613365] tvp5158_get_fmt
    [ 122.616172] tvp5158_get_video_std
    [ 122.619938] tvp5158 3-005f: NTSC video detected
    [ 122.624890] REG_AVD_CTRL_1 = 0xa0
    [ 122.628324] vip2-s1: vip_init_port: g_mbus_fmt subdev mbus_code: 2006 fourcc:NV12 size: 720x480
    [ 122.628339] vip2-s1: calc_format_size: fourcc:NV12 size: 720x480 bpl:720 img_size:518400
    [ 122.628348] vip2-s1: init_stream fourcc:NV12 size: 720x480 bpl:720 img_size:518400
    [ 122.628355] vip2-s1: init_stream vpdma data type: 0x02
    [ 122.628365] vip2-s1: vip_init_stream: stream instance 0x00000001ed008800
    [ 122.628484] video1: VIDIOC_QUERYCAP: driver=vip, card=vip, bus=platform:vip, version=0x00040413, capabilities=0x85200001, device_caps=0x05200001
    [ 122.628532] drivers/media/platform/ti-vpe/vip.c vip_s_fmt_vid_cap
    [ 122.643755] vip2-s1: s_fmt input fourcc:NV12 size: 720x480
    [ 122.643763] s_fmt input fourcc:NV12 size: 720x480
    [ 122.648614] vip2-s1: try_fmt fourcc:NV12 size: 720x480
    [ 122.648622] tvp5158_enum_frame_size
    [ 122.652312] vip2-s1: try_fmt loop:0 fourcc:NV12 size: 720x240
    [ 122.652321] vip2-s1: try_fmt loop:0 found new larger: 720x240
    [ 122.652327] tvp5158_enum_frame_size
    [ 122.655907] vip2-s1: try_fmt best subdev size: 720x480
    [ 122.655916] vip2-s1: Scaler active on Port A: requesting 720x480
    [ 122.655923] vip2-s1: Scaler: got 720x480
    [ 122.655931] vip2-s1: calc_format_size: fourcc:NV12 size: 720x480 bpl:720 img_size:518400
    [ 122.655938] vip2-s1: s_fmt try_fmt fourcc:NV12 size: 720x480
    [ 122.655946] vip2-s1: s_fmt fourcc:NV12 size: 720x480 bpl:720 img_size:518400
    [ 122.655953] vip2-s1: s_fmt pix_to_mbus mbus_code: 2006 size: 720x480
    [ 122.655959] tvp5158_set_fmt
    [ 122.658761] tvp5158_get_fmt
    [ 122.661864] tvp5158_get_video_std
    [ 122.665769] tvp5158 3-005f: NTSC video detected
    [ 122.670658] REG_AVD_CTRL_1 = 0xa0
    [ 122.674043] vip2-s1: s_fmt subdev fmt mbus_code: 2006 size: 720x480
    [ 122.674051] vip2-s1: s_fmt vpdma data type: 0x02
    [ 122.674059] v4l_s_fmt line = 1459 ret = 0
    [ 122.678082] video1: VIDIOC_S_FMT: type=vid-cap, width=720, height=480, pixelformat=NV12, field=none, bytesperline=720, sizeimage=518400, colorspace=1, flags=0x0, ycbcr_enc=0, quantization=0, xfer_func=0
    [ 122.678147] vip2-s1: g_fmt fourcc:NV12 code: 2006 size: 720x480 bpl:720 img_size:518400
    [ 122.678154] vip2-s1: g_fmt vpdma data type: 0x02
    [ 122.678160] video1: VIDIOC_G_FMT: type=vid-cap, width=720, height=480, pixelformat=NV12, field=none, bytesperline=720, sizeimage=518400, colorspace=1, flags=0x0, ycbcr_enc=0, quantization=0, xfer_func=0
    [ 122.678203] video1: VIDIOC_G_PARM: type=vid-cap, capability=0x1000, capturemode=0x0, timeperframe=1/30, extendedmode=0, readbuffers=4
    [ 122.678247] video1: VIDIOC_S_PARM: type=vid-cap, capability=0x1000, capturemode=0x0, timeperframe=1/30, extendedmode=0, readbuffers=4
    [ 122.678270] video1: VIDIOC_G_PARM: type=vid-cap, capability=0x1000, capturemode=0x0, timeperframe=1/30, extendedmode=0, readbuffers=4
    [ 122.678308] vip2-s1: get 8 buffer(s) of size 518400 each.
    [ 122.681945] video1: VIDIOC_REQBUFS: count=8, type=vid-cap, memory=mmap
    [ 122.682112] video1: VIDIOC_QUERYBUF: 00:00:00.00000000 index=0, type=vid-cap, flags=0x00002000, field=any, sequence=0, memory=mmap, bytesused=0, offset/userptr=0x0, length=518400
    [ 122.682143] timecode=00:00:00 type=0, flags=0x00000000, frames=0, userbits=0x00000000
    [ 122.682206] video1: VIDIOC_QUERYBUF: 00:00:00.00000000 index=1, type=vid-cap, flags=0x00002000, field=any, sequence=0, memory=mmap, bytesused=0, offset/userptr=0x7f000, length=518400
    [ 122.682233] timecode=00:00:00 type=0, flags=0x00000000, frames=0, userbits=0x00000000
    [ 122.682279] video1: VIDIOC_QUERYBUF: 00:00:00.00000000 index=2, type=vid-cap, flags=0x00002000, field=any, sequence=0, memory=mmap, bytesused=0, offset/userptr=0xfe000, length=518400
    [ 122.682306] timecode=00:00:00 type=0, flags=0x00000000, frames=0, userbits=0x00000000
    [ 122.682400] video1: VIDIOC_QUERYBUF: 00:00:00.00000000 index=3, type=vid-cap, flags=0x00002000, field=any, sequence=0, memory=mmap, bytesused=0, offset/userptr=0x17d000, length=518400
    [ 122.682427] timecode=00:00:00 type=0, flags=0x00000000, frames=0, userbits=0x00000000
    [ 122.682472] video1: VIDIOC_QUERYBUF: 00:00:00.00000000 index=4, type=vid-cap, flags=0x00002000, field=any, sequence=0, memory=mmap, bytesused=0, offset/userptr=0x1fc000, length=518400
    [ 122.682497] timecode=00:00:00 type=0, flags=0x00000000, frames=0, userbits=0x00000000
    [ 122.682545] video1: VIDIOC_QUERYBUF: 00:00:00.00000000 index=5, type=vid-cap, flags=0x00002000, field=any, sequence=0, memory=mmap, bytesused=0, offset/userptr=0x27b000, length=518400
    [ 122.682570] timecode=00:00:00 type=0, flags=0x00000000, frames=0, userbits=0x00000000
    [ 122.682613] video1: VIDIOC_QUERYBUF: 00:00:00.00000000 index=6, type=vid-cap, flags=0x00002000, field=any, sequence=0, memory=mmap, bytesused=0, offset/userptr=0x2fa000, length=518400
    [ 122.682637] timecode=00:00:00 type=0, flags=0x00000000, frames=0, userbits=0x00000000
    [ 122.682680] video1: VIDIOC_QUERYBUF: 00:00:00.00000000 index=7, type=vid-cap, flags=0x00002000, field=any, sequence=0, memory=mmap, bytesused=0, offset/userptr=0x379000, length=518400
    [ 122.682705] timecode=00:00:00 type=0, flags=0x00000000, frames=0, userbits=0x00000000
    [ 123.326183] vip2-s1: vip_set_slice_path:
    [ 123.326195] vip2-s1: vip_set_slice_path: DATA_PATH_SELECT(00000110): 00004600
    [ 123.326472] endpoint->bus_type == V4L2_MBUS_BT656
    [ 123.331332] endpoint->bus.parallel.num_channels = 1 sync_type = 3
    [ 123.337531] vip2-s1: start_streaming: buf 0xd56ae600 8
    [ 123.337539] tvp5158_s_stream
    [ 123.340429] tvp5158_init_gpios
    [ 123.343659] tvp5158_start_streaming
    [ 123.347576] vip2-s1: start_streaming: start_dma buf 0xd56ae600
    [ 123.347586] vip2-s1: start_dma: buf:0xd56ae600, vb:0xd56ae600, dma_addr:0xbe600000
    [ 123.347598] video1:
    [ 123.347605] vip_irq
    [ 123.347616] VIDIOC_STREAMON: type=vid-cap
    [ 123.353737] vip2-s1: IRQ 373 VIP_INT1_STATUS0 0x1
    [ 123.353746] vip2-s1: IRQ 1: handling LIST0_COMPLETE
    [ 123.353753] vip2-s1: added next buffer
    [ 123.353762] vip2-s1: start_dma: buf:0xd56afa00, vb:0xd56afa00, dma_addr:0xbe680000
    [ 123.353803] vip_irq
    [ 123.355915] vip2-s1: IRQ 373 VIP_INT1_STATUS0 0x1
    [ 123.355922] vip2-s1: IRQ 1: handling LIST0_COMPLETE
    [ 123.355929] vip2-s1: added next buffer
    [ 123.355937] vip2-s1: start_dma: buf:0xd56afe00, vb:0xd56afe00, dma_addr:0xbe700000

    BR,

    vefone

  • Hi,

    change the NV12 to YUYV,then I got the video.

    yavta -c60 -p -F/home/root/5158.yuv --skip 0 -t 1/30 -f YUYV -s 720x480 /dev/video1

  • With multiplexed source the NV12 output mode won't work. VIP can accept input source as YUV 422 interleaved or RGB24 format (RAW formats also accepted). VIP internally has scaler, color format conversion, up sampling and down-sampling processing blocks. These processing blocks buffers couple of lines of input captured image for filtering need to do on the fly processing. When VIP input source is multiplexed, these processing blocks (chroma down sampling in your specific case) cannot process on the fly multi-channel input source as they do not have mechanism to line buffer separate channels. Multiplexed captured data is demultiplexed by the Parser and then directly passed to VIP DMA engine named VPDMA for the data to be written to memory as separate channels.
  • Hi,

    manisha,thank you! i got it.

    vefone