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.

V4L2 support for 8148 EVM

Other Parts Discussed in Thread: TVP7002, PCF8575, TVP5147

Howdy.

In the release notes for PSP 04.01.06.patch2, it is written: 

7)V4L2 capture support is available from PSP04.01.00.06_patch2 release only

  • Please note that V4L2 capture driver requires I2C2 instance to be controlled from Linux side. So any of the application/driver trying to access I2C2 from any other processor wont work.
  • Only one instance of V4L2 capture driver is supported with TVP7002 decoder

That's hopeful, but I am mystified regarding how one is to setup and use the 7002 as the video-in device. It would seem that

% modprobe ti81xxvin

would enable and setup the pipeline nicely on my 8148 EVM, but when I do that, I get:

i2c i2c-3: i2c_new_device.0: 0x5d
i2c i2c-3: i2c_new_device.1: I2C address 0x5d status 0
tvp7002 3-005d: tvp7002 found @ 0x5d (OMAP I2C adapter)
omap_i2c omap_i2c.3: controller timed out
omap_i2c omap_i2c.3: controller timed out
omap_i2c omap_i2c.3: controller timed out
omap_i2c omap_i2c.3: controller timed out
omap_i2c omap_i2c.3: controller timed out
tvp7002 3-005d: TVP7002 read error -110
tvp7002: probe of 3-005d failed with error -110
i2c i2c-3: i2c_new_device.2: [tvp7002] I2C address 0x5d
i2c i2c-3: i2c_new_device.3 client [tvp7002] registered with bus id 3-005d
which, when digested, is really saying that the probe routine for the 7002 was called and was unable to read a revision register on the 7002. It's not a happy day when a revision register is unreadable. 
For grins, I modified the kernel's board-ti8148evm.c file which does some early probing of the I2C busses in the function ti814x_evm_i2c_init(), and added the fact that the 7002 was there (not sure why the 7002 is not mentioned in this file) to the ti814x_i2c_boardinfo1 array. That init code called the 7002 probe code which was happily able to read the revision register. However, when I then later do
  % modprobe ti81xxvin
that does not work as the addition of the ti81xxvin module very much wants to do a probe for the 7002 and, well, that probe cannot succeed as the 7002's name is already in the /sys tree, so the 7002 probe fails and, thus, so does the setup of ti81xxvin.
I think the end result I am hoping for is the appearance of the name /dev/video0 so I can open that device under v4l2 as my video input device and then do interesting things. Maybe I should be thinking of looking for some other device name?
Any help you can give me for using the 7002 within the v4l2 library on the 8148 EVM is much appreciated.
  • Hi,

    It seems that you are loading EZSDK M3 vpss binary. EZSDK binary uses I2C from M3 so ezsdk binary wont work here. You need to load VPSS binary provided with PSP release.

    Regards,

    Hardik Shah

  • Hardik,

    Thanks for the prompt reply. I am not sure what "binary" you refer to...do you mean the .ko file or something else? If it's the .ko file, the only vpss.ko I can see in my tree is under the linux-2.6.37-psp04.01.00.06.patch2 directory...so I would tend to think that I am already using the PSP version of the module. (I don't even see a vpss.ko file in my EZSDK tree that's not also in my PSP tree.)

    If you're thinking of a binary that is not the .ko file, what would you be referring to?

    Thanks again.

    bob

  • The Capure Video User Guide, at http://processors.wiki.ti.com/index.php/DM81xx_AM38xx_Video_Capture_Driver_User_Guide , tells us:

    DM814x/AM387x platforms share the same M3 firmware t8i14x_hdvpss_1G_debug.xem3

    That's nice, except that no file of the above name exists in either the host-side distribution or what ends up on the target file system. Any idea on either where I might find that file or which file I do have that I should use instead?

    (The User Guide also advises us to use t8i14x_hdvpss_1G.xem3, but that file also is nowhere to be found.)

    Thanks much.

    bob

  • You should be using PSP 04.01.00.07, not the .06 patches. You want the DM814x HDVPSS Binary package available here:

    http://software-dl.ti.com/dsps/dsps_public_sw/psp/LinuxPSP/DM814x_04_01/04_01_00_07/index_FDS.html

     

    Here are the release notes you should be using:

    http://processors.wiki.ti.com/index.php/DM814x_AM387x_PSP_04.01.00.07_Release_Notes

    They tell you the HDVPSS Binary isn't in the tar ball, and to get it at the page above.

     

    -Herb

     

     

  • Most helpful. Thanks.

    bob

  • Hi,

    You can use both PSP04.01.00.06_patch2 or PSP04.01.00.07 releases. With PSP04.01.00.07 being the latest one. Please follow steps in userGuide to load all the .ko modules and binaries before running the sample V4L2 capture driver application.

    User guides for V4L2 display and V4L2 capture are at

    http://processors.wiki.ti.com/index.php/DM81xx_AM38xx_Video_Capture_Driver_User_Guide

    http://processors.wiki.ti.com/index.php/DM814X_AM387X_VPSS_Video_Driver_User_Guide_PSP_04.01.00.06

    Regards,

    Hardik Shah

  • Again, Hardik, much obliged for timely response.

    I am using the .07 PSP and am getting further...just not far enough.

    I have tried using both .ko images I have generated through my own builds and also the .ko images available through the PSP Software Download Page (referenced in http://processors.wiki.ti.com/index.php/DM814x_AM387x_PSP_04.01.00.07_Release_Notes). In either case, when I boot and run and then follow the instructions on http://processors.wiki.ti.com/index.php/DM81xx_AM38xx_Video_Capture_Driver_User_Guide, I get, upon the insmod of the ti81xxvin module,  a kernel Oops. The details:

    # insmod ./kernel/drivers/media/video/ti81xx/ti81xxvin.ko
    tvp7002 3-005d: tvp7002 found @ 0x5d (OMAP I2C adapter)
    tvp7002 3-005d: Rev. 02 detected.
    Unable to handle kernel NULL pointer dereference at virtual address 00000002
    pgd = cb3dc000
    [00000002] *pgd=8b3cd031, *pte=00000000, *ppte=00000000
    Internal error: Oops: 17 [#1]
    last sysfs file: /sys/module/tvp7002/initstate
    Modules linked in: ti81xxvin(+) tvp7002 bufferclass_ti omaplfb pvrsrvkm tlc59108
    ti81xxhdmi ti81xxfb vpss syslink ipv6
    CPU: 0 Not tainted (2.6.37 #1)
    PC is at vps_ti814x_select_video_decoder+0x28/0xac
    LR is at ti81xxvin_probe+0x3e4/0x50c [ti81xxvin]
    ....stuff deleted for brevity...
    Backtrace:
    [<c005c9d0>] (vps_ti814x_select_video_decoder+0x0/0xac) from [<bf213fc8>] (ti81xxvin_probe+0x3e4/0x50c [ti81xxvin])
    r6:00000000 r5:bf215250 r4:c9dcd400
    [<bf213be4>] (ti81xxvin_probe+0x0/0x50c [ti81xxvin]) from [<c0202f34>] (platform_drv_probe+0x20/0x24)
    [<c0202f14>] (platform_drv_probe+0x0/0x24) from [<c0201ea0>] (driver_probe_device+0xd0/0x190)
    [<c0201dd0>] (driver_probe_device+0x0/0x190) from [<c0201fc8>] (__driver_attach+0x68/0x8c)
    r7:cb3d8200 r6:bf215090 r5:c04fa534 r4:c04fa500
    [<c0201f60>] (__driver_attach+0x0/0x8c) from [<c020164c>] (bus_for_each_dev+0x50/0x84)
    r7:cb3d8200 r6:bf215090 r5:c0201f60 r4:00000000
    [<c02015fc>] (bus_for_each_dev+0x0/0x84) from [<c0201cc4>] (driver_attach+0x20/0x28)
    r6:bf215090 r5:bf21512c r4:00000000
    [<c0201ca4>] (driver_attach+0x0/0x28) from [<c0200f24>] (bus_add_driver+0xb4/0x234)
    [<c0200e70>] (bus_add_driver+0x0/0x234) from [<c0202300>] (driver_register+0xb0/0x13c)
    [<c0202250>] (driver_register+0x0/0x13c) from [<c02033d8>] (platform_driver_register+0x4c/0x60)
    r9:cb3f4000 r8:bf219000 r7:00012018 r6:00012008 r5:bf21512c r4:00000000
    [<c020338c>] (platform_driver_register+0x0/0x60) from [<bf219014>] (ti81xxvin_init+0x14/0x1c [ti81xxvin])
    [<bf219000>] (ti81xxvin_init+0x0/0x1c [ti81xxvin]) from [<c003a42c>] (do_one_initcall+0xd0/0x1a4)
    [<c003a35c>] (do_one_initcall+0x0/0x1a4) from [<c0097c80>] (sys_init_module+0x9c/0x1bc)
    [<c0097be4>] (sys_init_module+0x0/0x1bc) from [<c0044e00>] (ret_fast_syscall+0x0/0x30)
    r7:00000080 r6:00000003 r5:00010000 r4:00000000
    Code: e3a01000 e3a0200c e24b0028 e5935000 (e1d560b2)
    ---[ end trace b6728b1a81aea6bf ]---
    Segmentation fault
    I guess I'll go peel into the kernel source base and see what I can turn up.
    bob

  • Bob,

    Is this over DM814X EVM + IO EXPANSION Board?

    Could you list all the steps you done?

    Could you enable the debug option of the modules by adding debug=1 when loading and provide the log file after crash/

    Regards,,

    yihe

  • Yihe,

    Thanks for your help

    Yes, this is on a DM8148 EVM with an expansion board.

    The quick recap here is: I would like /dev/video0 to appear in the name space so I can open it using the v4l2 library and then slurp in captured video and do stuff with the captured stream. My efforts right now are concentrated on getting /dev/video0 to appear.

    The steps were:

    1. bring up 04.01.00.06.patch2 environment. This did not work well for getting video. I was able to edit kernel sources and rebuild...but that didn't get me close enough to a solution.
    2. brought up 04.01.00.07 environment. Am able to edit kernel sources and rebuild in this environment. I built the slaveloader tool in this environment.
    3. <From this point on all discussion will be in the .07 environment.>
    4. Followed the steps in the DM814x AM387x PSP 04.01.00.07 Release Notes, and pulled in the HDVPSS binaries from the PSP Software Download Page. This is where my .xem3 file came from.
    5. Followed the steps in the DM81xx AM38xx Video Capture Driver User Guide, and did the following: 
    6. ...tried to insmod syslink.ko: couldn't do it as it was already automagically loaded by the time I had a command prompt
    7. ...slaveloade'd the ti814x_hdvpss_1G.xem3 just fine
    8. ...tried to insmod vpss.ko but couldn't do it as this module was also aleady automagically loaded
    9. ...insmod'd tvp7002.ko without incident
    10. ...I then insmod'd ti81xxvin.ko and got the above Oops.
    I did add the "debug=1" when I did the insmod's but no extra output appeared on the console. I looked around in the file system (in /var and /sys), but did not see anything resembling a logfile for extra debug output. Did I miss something?
    Does that help? Is there anything else I can add which would help?
    Thanks much.
    bob

  • Yihe,

    I've done a bit of digging into the Oops and here's what I've found.

    The Oops is directly the result of the pointer named pcf8575_client being referenced while it has a NULL value in the function vps_ti814x_select_video_decoder().

    The reason pcf8575_client is NULL is that it is never initialized to a non-NULL value. It is initialized to a non-NULL value in the function pcf8575_video_probe(). This function is only called if two conditions are met: we're on a 8148 board and a variable named def_i2cmode has a zero value (def_i2cmode is set up to reflect the value of the VPSS module's parameter named i2c_mode).

    The script which loads the VPSS module, load-hd-firmware.sh, as distributed by TI, explicitly sets the i2c_mode parameter to a value of one. This effectively ensures the Oops will happen as pcf8575_client is never init'd and yet it is referenced as if it were. 

    For grins, I tried changing the setup of i2c_mode from one to zero in the  load-hd-firmware.sh script and starting the system. Nahhh. Apparently because of the value of i2c_mode, the I2C bus was unavailable for some transactions during the setup of the VPSS module. Not good.

    I suspect I am close...but still unaware of the special chant I need to invoke.

    Hope this helps.

    Thanks.

    bob

  • Hi,

    You are absolutely on perfect track. You should not be using load-firmware.sh. You should be using command on the VPSS videodriver userguide and capture user guide commands at

    http://processors.wiki.ti.com/index.php/DM814X_AM387X_VPSS_Video_Driver_User_Guide and http://processors.wiki.ti.com/index.php/DM81xx_AM38xx_Video_Capture_Driver_User_Guide to load vpss.ko and other kos. Please load vpss.ko without any arguments. I think you will be able to load vin.ko without any problems.

    Regards,

    Hardik Shah

  • Hardik,

    I can run  with that. Thanks. Apparently, the missing secret sauce is the (missing) statement in the referenced docs that the recommended actions (insmod's and so on) should occur at boot up time and replace actions taking place in existing scripts. I was thinking they could occur afterwards.

    I appreciate the help,

    bob

  • OK. Now I've run and stumbled.

    The script load-hd-firmware.sh now does a quick exit and nothing more.

    Once Linux comes up and I can login on my 8148EVM running 04.01.00.07, I do:

    # prcm_config_app s
    DM814X prcm_config_app version: 2.0.0.1
    Doing PRCM settings...
    PRCM for IVHD0 is in Progress, Please wait.....
    BW Phy Addr : 0x48180600 Data : 0x00000001
    AW Phy Addr : 0x48180600 Data : 0x00000002
    Phy Addr : 0x48180c04 Data : 0x00000037
    BW Phy Addr : 0x48180620 Data : 0x00070000
    AW Phy Addr : 0x48180620 Data : 0x00070002
    BW Phy Addr : 0x48180624 Data : 0x00030000
    AW Phy Addr : 0x48180624 Data : 0x00010002
    Phy Addr : 0x48180600 Data : 0x00000102
    BW Phy Addr : 0x48180c10 Data : 0x00000007
    AW Phy Addr : 0x48180c10 Data : 0x00000003
    Phy Addr : 0x48180c14 Data : 0x00000004
    BW Phy Addr : 0x58088000 Data : 0x8d30ef5c
    AW Phy Addr : 0x58088000 Data : 0xeafffffe
    BW Phy Addr : 0x58098000 Data : 0x26d2cfe1
    AW Phy Addr : 0x58098000 Data : 0xeafffffe
    BW Phy Addr : 0x48180c10 Data : 0x00000003
    AW Phy Addr : 0x48180c10 Data : 0x00000000
    Phy Addr : 0x48180c14 Data : 0x00000007
    PRCM for IVHD0 is Done Successfully
    PRCM Initialization completed
    # insmod /lib/modules/2.6.37/kernel/drivers/dsp/syslink.ko
    SysLink version : 2.00.05.85
    SysLink module created on Date:Jan 6 2012 Time:09:32:03
    # slaveloader startup VPSS-M3 /home/bob/ti814x_hdvpss_1G.xem3
    Attached to slave procId 2.
    Loaded file /home/bob/ti814x_hdvpss_1G.xem3 on slave procId 2.
    Started slave procId 2.
    # insmod /lib/modules/2.6.37/kernel/drivers/video/ti81xx/vpss/vpss.ko
    notify_shm_drv_sendevent failed! status = 0xfffffff0
    notify_send_event failed! status = 0xfffffff0
    And then I get a bunch of repeats of the notify_shm_drv_sendevent and notify_send_event messages.
    My boot parms are: console=ttyO0,115200n8 rootwait rw mem=256M earlyprintk notifyk.vpssm3_sva=0xBF900000 vram=50M ti814xfb.vram=0:16M,1:16M,2:6M root=/dev/nfs nfsroot=192.168.1.253:/home/bob/jupiter/targetfs ip=dhcp
    and I also tried adding a setting of the sbufaddr parameter to the vpss module to 0xbf900000 and also to 0xbfb00000 (I rebooted the system for each of these attempts). Setting sbufaddr to these values did not change the results at all.
    Hints and tips greatly appreciated.
    Thanks.
    bob
  • Bob,

    since you are using ti814x_hdvpss.xem3, the notifyk.vpssm3_sva should be 0xA0000000, and the sbufaddr of vpss.ko should be 0xA0200000.

    0xBF900000 and 0xBFB00000 are memory used by the SDK M3 firmware not PSP.

    please review VPSS Video User Guide.

    http://processors.wiki.ti.com/index.php/DM814X_AM387X_VPSS_Video_Driver_User_Guide#Read_This_First

    Regards,

     

    yihe

  • Yihe,

    Thanks for the very quick response.

    Yup. Got that and made the changes. Thanks for the pointer. I'd seen the reference to 0xa0000000 in other places in the docs and my memory was that that constant was for 8168's and the 8148...that's why I hadn't tried it.

    So I did try it...changed the boot parm and the module parm for vpss...but no dice. The results remain the same...a bunch of notify...failed! messages.

    I did also turn off the matrix-gui-e and pvr-init scripts so they wouldn't make any potentially bothersome state changes to the hw.

    Any hints or tips or ideas of rocks I should be looking under?

    Thanks again.

    bob

  • Bob,

    how any notify failed message did you get? Besides the notify failed message, did you get any other error message?

    if there were 2-3 notify failed message, it was quite normal since M3 is still booting. but if 20 such message were printed out, most like it iwas due to that address of notify.vpssm3_sva and sbufaddr did not match the M3 firmware.

    Could you provide your bootargs and all steps to load M3 firware and modules?

    Regards,

    yihe

  • Yihe,

    You're very prompt...that's appreciated.

    I received 20 pairs of the notify/failed messages. So I guess it's a mismatch booboo.

    The bootargs are: console=ttyO0,115200n8 rootwait rw mem=256M earlyprintk notifyk.vpssm3_sva=0xa0000000 vram=50M ti814xfb.vram=0:16M,1:16M,2:6M root=/dev/nfs nfsroot=192.168.1.253:/home/bob/jupiter/targetfs ip=dhcp

    The steps I follow to load the M3 firmware and modules are:

    prcm_config_app s 
    insmod /lib/modules/2.6.37/kernel/drivers/dsp/syslink.ko
    slaveloader startup VPSS-M3 /home/bob/ti814x_hdvpss_1G.xem3
    insmod /lib/modules/2.6.37/kernel/drivers/video/ti81xx/vpss/vpss.ko sbufaddr=0xa0000000
    Hope that's everything you need. I don't see the mismatch. What else might it be?
    Thanks.
    bob
  • Bob

    The below is wrong it should be 0xa0200000.

    insmod /lib/modules/2.6.37/kernel/drivers/video/ti81xx/vpss/vpss.ko sbufaddr=0xa0000000

    Regards,

    yihe

  • Yihe,

    Yes, indeed. The bootline now specifies 0xa0000000 and the insmod command now specifies 0xa0200000 and all appears well as, when I add the ti81xxvin module, /dev/video0 appears! I like that.

    Thanks a bunch.

    bob

  • Bob,

    Just be aware one thing, the V4L2 example provided in the PSP package assumes that ti81xxvo.ko should be loaded before ti81xxvin.ko as the below.

    /dev/vide0, /dev/video4-6 are v4l2 capture

    /dev/video1-3 are v4l2 display.

    Regards,

    yihe

  • Yihe ,

    Hey ,

    I have dm8148-evm , and i succeed to do capture from tvp7002 (streaming it out (eth) with GStreamer) .

    I did the capture from /dev/video0 .

    Now , i want to do capture from tvp5147 .

    how can i do that ?

    i tried to change the ti81xxvin_main.c to work with tvp5147 without success .

    in the user guide it says that /dev/video0 is connected to tvp7002 

    if i will try and do capture for /dev/video 4-6 , 

    it take the video from tvp5147 ?

    please help me .. 

    thanks 

  • When I insert ti81xxvin driver, it always on omap_i2c.1. Coudle you tell me how can insert tvp7002 driver on omap_i2c.3?