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.

AM57xx SDK 2.00.01.07: Camera driver rebuild issue

Other Parts Discussed in Thread: AM5728

Hi,

using the SDK 2.00.01.07 on an AM57xx EVM, I am seeing a failure of the camera driver.

[] Prebuild images on sdcard work. I can run the yavta application on /dev/video1 fine. No issue there, see here.

root@am57xx-evm:~# dmesg |grep vip
[ 5.795317] vip 48990000.vip: loading firmware vpdma-1b8.bin
[ 5.818308] vip 48990000.vip: VPDMA firmware loaded
[ 5.823306] vip2-s0: Port A: Using subdev mt9t11x for capture
[ 5.830852] vip2-s0: device registered as video1

root@am57xx-evm:~# yavta -c2 -p -F --skip 0 -f NV24 -s 1280x720 /dev/video1
Device /dev/video1 opened.
Device `vip' on `platform:vip' is a video output (without mplanes) device.
Video format set: NV24 (3432564e) 1280x720 (stride 1280) field none buffer size 1843200
Video format: NV24 (3432564e) 1280x720 (stride 1280) field none buffer size 1843200
8 buffers requested.
length: 1843200 offset: 0 timestamp type/source: mono/EoF
Buffer 0/0 mapped at address 0xb6c87000.
length: 1843200 offset: 1843200 timestamp type/source: mono/EoF
Buffer 1/0 mapped at address 0xb6ac5000.
length: 1843200 offset: 3686400 timestamp type/source: mono/EoF
Buffer 2/0 mapped at address 0xb6903000.
length: 1843200 offset: 5529600 timestamp type/source: mono/EoF
Buffer 3/0 mapped at address 0xb6741000.
length: 1843200 offset: 7372800 timestamp type/source: mono/EoF
Buffer 4/0 mapped at address 0xb657f000.
length: 1843200 offset: 9216000 timestamp type/source: mono/EoF
Buffer 5/0 mapped at address 0xb63bd000.
length: 1843200 offset: 11059200 timestamp type/source: mono/EoF
Buffer 6/0 mapped at address 0xb61fb000.
length: 1843200 offset: 12902400 timestamp type/source: mono/EoF
Buffer 7/0 mapped at address 0xb6039000.
Press enter to start capture

0 (0) [-] top 0 1843200 B 368.743962 368.743992 11.818 fps ts mono/EoF
1 (1) [-] top 1 1843200 B 368.771152 368.825314 36.778 fps ts mono/EoF
Captured 2 frames in 0.165969 seconds (12.050422 fps, 22211338.414679 B/s).
8 buffers released.

[] Rebuild linux kernel, dtbs, modules from toplevel Makefile and install in sdcard with make linux_clean, make linux, make linux_install. Now the /dev/video1 driver does not work anymore.

root@am57xx-evm:~# dmesg |grep vip
[ 4.999454] vip 48990000.vip: loading firmware vpdma-1b8.bin
[ 5.028339] vip 48990000.vip: VPDMA firmware loaded
[ 5.234788] vip2-s0: Port A: Using subdev mt9t11x for capture
[ 5.257330] vip2-s0: device registered as video1

root@am57xx-evm:~# ls /dev/video*
/dev/video0 /dev/video1 /dev/video10

root@am57xx-evm:~# yavta -c2 -p -F --skip 0 -f NV24 -s 1280x720 /dev/video1

Error opening device /dev/video1: No such device (19).

I will check further into this.

Regards,

--Gunter

  • Hi Gunter,

    Do you see some error or warning messages related to video input in the log of rebuild linux kernel, dtbs and modules?

    BR
    Tsvetolin Shulev
  • Hi,

             I am also facing same type of issue while interfacing adv7180 video decoder with vin1a  port  am5728 sitara processor.

    Can you please tell me what is the reason of this error and what is the solution?

  • Hi Abhishek,

    Could you give more details about your issue? Could you post the console output. Then when see an error message execute the 'dmesg' command which shows Linux kernel log. Attach this log as file to the post.

    BR
    Tsvetolin Shulev
  • Hi Tsvetolin Shulev

    Thanks For your kind response.

      We are using vina port  of am5728 processor to capture  8bit data from adv7180 video decoder. My initial problem was adv7180 driver in our SDK is not compatible with device tree structure. I solve that  by applying patch from kernel 4.4 (we are using 4.1) .

    My current dts entries are as follows

    &i2c1{
                    status = "okay";
                    clock-frequency = <400000>;
                   adv7180@20 {
                            compatible = "adi,adv7180";
                            reg = <0x20>;

                            
                            port {
                                    adv7180_1: endpoint{
                                            
                                                    remote-endpoint=<&vin1a>;
                                                 
                                                                                     

                                                    };

                    };
         };
    };

    &vin1a {
            status = "okay";
            endpoint@0 {
                   slave-mode;
                   remote-endpoint = <&adv7180_1>;
            };
    };

    I also made some changes in adv7180 and vip driver while debugging  to create the /dev/video0 node (without these changes i was not able to create capture node ).

    1. Change in adv7180.c file since default fmt->code is not supported by vin port.

    static int adv7180_mbus_fmt(struct v4l2_subdev *sd,
                                struct v4l2_mbus_framefmt *fmt)
    {
            struct adv7180_state *state = to_state(sd);

            /*fmt->code = MEDIA_BUS_FMT_YUYV8_2X8;*/ //default
            fmt->code = MEDIA_BUS_FMT_UYVY8_2X8;    //changed
            fmt->colorspace = V4L2_COLORSPACE_SMPTE170M;
            fmt->field = V4L2_FIELD_INTERLACED;
            fmt->width = 720;
            fmt->height = state->curr_norm & V4L2_STD_525_60 ? 480 : 576;

            return 0;
    }

    2. I also hardcoded bustype of endpoint of  following function in driver/media/platform/ti-vpe/vip.c

    static int vip_create_streams(struct vip_port *port,
                                  struct v4l2_subdev *subdev)
    {
            struct v4l2_of_bus_parallel *bus;
            int i;

            for (i = 0; i < VIP_CAP_STREAMS_PER_PORT; i++)
                    free_stream(port->cap_streams[i]);

            if (get_subdev_active_format(port, subdev))
                    return -ENODEV;

                    port->endpoint->bus_type = V4L2_MBUS_PARALLEL; //hardcoded to make the below condition true
        
            if (port->endpoint->bus_type == V4L2_MBUS_PARALLEL)
             {
                    port->flags |= FLAG_MULT_PORT;
                    alloc_stream(port, 0, VFL_TYPE_GRABBER);
            } else if (port->endpoint->bus_type == V4L2_MBUS_BT656)
            {
                    port->flags |= FLAG_MULT_PORT;
                    bus = &port->endpoint->bus.parallel;
                    for (i = 0; i < bus->num_channels; i++) {
                            if (bus->channels[i] >= 16)
                                    continue;
                            alloc_stream(port, bus->channels[i], VFL_TYPE_GRABBER);
                    }
            }
            printk("end of vip reate stream\n");
            return 0;
    }

    /*Loading drivers debug logs are enabled  */

    root@am57xx-evm:~/video# insmod ti-vpdma.ko
    root@am57xx-evm:~/video#
    root@am57xx-evm:~/video#
    root@am57xx-evm:~/video#
    root@am57xx-evm:~/video# insmod ti-vip.ko
    [   71.102958] vip 48970000.vip: loading firmware vpdma-1b8.bin
    root@am57xx-evm:~/video# [   71.127090] vip 48970000.vip: VPDMA firmware loaded
    [   71.132077] vip1-s0: can't get next endpoint: loop: 1
    [   71.137197] vip1-s0: register async notifier for 1 subdevs

    root@am57xx-evm:~/video#
    root@am57xx-evm:~/video#
    root@am57xx-evm:~/video#
    root@am57xx-evm:~/video# insmod adv7180.ko
    [   85.520709] probing adv7180 driver
    [   85.524136] adv7180 0-0020: chip found @ 0x20 (OMAP I2C adapter)
    [   85.530204] platform data entry 0
    [   85.533534] platform data entry -286761940
    [   85.537666] v4l2 sub device init
    [   85.540908] init control state
    [   85.558053] adv7180_init_controls done
    [   85.561819] media_entity_init done
    [   85.565230] device init
    [   85.577553] init_device done
    [   85.580445] v4l2 async register subdev
    [   85.584208] vip1-s0: vip_async_bound
    [   85.588099] vip1-s0: Port A: Using subdev adv7180 0-0020 for capture
    [   85.594529] return from subdev call 0
    [   85.598360] return code  2006
    [   85.601377] vip1-s0: subdev adv7180 0-0020: code: 2006 idx: 0
    [   85.607282] vip1-s0: matched fourcc: NV24: code: 2006 idx: 0
    [   85.612966] vip1-s0: matched fourcc: NV16: code: 2006 idx: 1
    [   85.618789] vip1-s0: matched fourcc: NV12: code: 2006 idx: 2
    [   85.624471] vip1-s0: matched fourcc: UYVY: code: 2006 idx: 3
    [   85.630183] vip1-s0: matched fourcc: YUYV: code: 2006 idx: 4
    [   85.635937] vip1-s0: matched fourcc: VYUY: code: 2006 idx: 5
    [   85.641640] vip1-s0: matched fourcc: YVYU: code: 2006 idx: 6
    [   85.647415] return from subdev call -22
    [   85.651293] return code  0
    [   85.654054] format matched
    [   85.658297] vip1-s0: device registered as video0
    [   85.660059] vip1-s0: vip_open
    [   85.660066] vip1-s0: init_port get_fmt failed in subdev
    [   85.660070] vip1-s0: subdev default mbus_fmt ee58c5c8 is not matched.
    [   85.660072] vip1-s0: init_port set_fmt failed in subdev
    [   85.660076] vip1-s0: vip_init_port: g_mbus_fmt subdev mbus_code: 2006 fourcc:NV24 size: 0x24
    [   85.691411] end of vip reate stream
    [   85.694911] returning from bound
    [   85.698180] vip -async complete
    [   85.701334] vip1-s0: vip_async_complete
    [   85.705182] v4l2_async_register_subdev done

    Please find attached boot and dmesg files 2543.dmesg.txt5811.boot.txt

    Kindly let me know if you require anything else.

  • Hi,
    Now i am not facing the above problem.
  • Hi Abhishek

    Would you mind share what did you do to solve your problem? I am facing same problem.

  • Hi Aidin,

                     There can be multiple issue regarding this problem, Enable debug log in your kernel and try to track the problem. Can you try it by assigning subdev structure to port structure before vip_create_stream function called in vip.c file, as below mentioned code.

    port->subdev = subdev;
            ret = vip_create_streams(port, subdev);
            if (ret)
                    return ret;
            /*abhishek commented write two line before*/
            /*port->subdev = subdev;*/

    Thanks & Regards

    Abhishek

  • Hi Abhishek

    Thanks a lot for your answer. There were bugs in the decoder driver file and vip.c file. No I can communicate with the decoder. But I get no output from yavta , capturevpedisplay , dmabuftest !
    I am continuing to debug it with manisha here: e2e.ti.com/.../1990402
    I would be thankful if you could share your tests experiences.
  • Hi Aidin,
    I used v4l2 capture application and gstreamer pipeline for testing.
  • Hi Abhishek

    Thanks a lot for sharing information. I am not able to run simple tests like yavta. Would you mind please share the dts entries you use? It seems it maybe a dts entry issue. I could not find any user guide for addressing BT656 decoder in the dts file.
    The vip communicates with the decoder now. If I put the line pclk-sample = <0> in the dts file, the decoder registers as /dev/video1 but the vip get it as V4L2_MBUS_PARALLEL device and none of tests would run and I got no output. If I remove pclk-sample = <0> from dts file as TI suggested, the vip get it as V4L2_MBUS_BT656 but there is NO /dev/video1.
    Any suggestions would help me.

    Thanks a lot.