Spaces:

arjun.a
range data
5aefcf4
raw
history blame
15.7 kB
Ticket Name: Linux/TDA2-17: Camera Capture
Query Text:
Part Number: TDA2-17 Other Parts Discussed in Thread: TVP5150, TVP5158, TVP5151 Tool/software: Linux Hi, I have been working the past few days to get camera data streaming into my system. I am capturing from a pair of TVP5151s on a shared I2C bus and pulling data in to VIN1A and VIN3A. I have worked through some device tree issues and have both the VIP and 5151 recognized but my yavta commands fail to detect the presence of /dev/video*. I am using Vision SDK 3.05 for building linux. root@dra7xx-evm:~# dmesg | grep vip [ 2.151977] vip 48970000.vip: loading firmware vpdma-1b8.bin [ 2.158793] vip 48990000.vip: loading firmware vpdma-1b8.bin [ 2.176102] vip 48970000.vip: VPDMA firmware loaded [ 2.181071] vip1-s0: Port A: Using subdev tvp5150 3-005d for capture [ 2.187709] vip 48990000.vip: VPDMA firmware loaded [ 2.192847] vip1-s0: device registered as video0 [ 2.197526] vip2-s0: Port A: Using subdev tvp5150 3-005c for capture [ 2.204066] vip2-s0: device registered as video1 root@dra7xx-evm:~# ls /dev/video ls: /dev/video: No such file or directory root@dra7xx-evm:~# dmesg | grep vip [ 2.151977] vip 48970000.vip: loading firmware vpdma-1b8.bin [ 2.158793] vip 48990000.vip: loading firmware vpdma-1b8.bin [ 2.176102] vip 48970000.vip: VPDMA firmware loaded [ 2.181071] vip1-s0: Port A: Using subdev tvp5150 3-005d for capture [ 2.187709] vip 48990000.vip: VPDMA firmware loaded [ 2.192847] vip1-s0: device registered as video0 [ 2.197526] vip2-s0: Port A: Using subdev tvp5150 3-005c for capture [ 2.204066] vip2-s0: device registered as video1 root@dra7xx-evm:~# ls /dev/video0 /dev/video0 root@dra7xx-evm:~# ls /dev/video1 /dev/video1 root@dra7xx-evm:~# yavta /dev/video0 Error opening device /dev/video0: No such device (19). root@dra7xx-evm:~# yavta /dev/video1 Error opening device /dev/video1: No such device (19). My device tree entries are as follows: /* modules used by BIOS, disable from Linux */ //DISABLE_COMPLETE(vip1); //DISABLE_COMPLETE(vip2); //DISABLE_COMPLETE(vip3); &i2c4 { status = "okay"; clock-frequency = <400000>; tvp5150@5c { compatible = "ti,tvp5150"; reg = <0x5c>; //pdn-gpios = <&gpio4 12 GPIO_ACTIVE_LOW>; //reset-gpios = <&gpio4 31 GPIO_ACTIVE_LOW>; //hysnc-active=<0>; //vsync-active=<0>; port { tvp5150_2: endpoint { remote-endpoint = <&vin3a>; channels = <0>; //bus-width = <8>; }; }; }; tvp5150@5d { compatible = "ti,tvp5150"; reg = <0x5d>; //pdn-gpios = <&gpio3 16 GPIO_ACTIVE_LOW>; //reset-gpios = <&gpio3 17 GPIO_ACTIVE_LOW>; //hysnc-active=<0>; //vsync-active=<0>; port { tvp5150_1: endpoint { remote-endpoint = <&vin1a>; channels = <0>; //bus-width = <8>; }; }; }; }; &vip1 { status = "okay"; }; &vip2 { status = "okay"; }; &vin1a { status = "okay"; endpoint { slave-mode; remote-endpoint = <&tvp5150_1>; }; }; &vin3a { status = "okay"; endpoint { slave-mode; remote-endpoint = <&tvp5150_2>; }; }; Thanks for any help. Please let me know if there is additional information I need to contribute to help the process.
Responses:
Hi Joseph, I have pinged the V4L2 experts to help. Meanwhile you can try this script: git.ti.com/.../vip_diagnostic.sh and those commands: processors.wiki.ti.com/.../Linux_Core_VIP_User's_Guide to see if they can give you some directions. Regards, Yordan
HI Joseph, The error "No such file or directory" is because the driver is returning failure error ENODEV. Of course the video device /dev/video0 or /dev/video1 exist. You have confirmed it by running ls /dev/video* When you open the device, corresponding V4L2 subdevice driver (TVP driver) returns ENODEV and hence the failure. From the tvp5158.c driver, I can tell that the ENODEV is returned when the TVP device video detect status is not active. Make sure that the video decoder is able to detect the video correctly when the device is open. Please check return values from the subdevice driver ops Regards, Nikhil D
Hi Nikhil, Thank you for the help. I am reviewing your feedback. Admittedly, this work falls outside of my area of expertise (I'm a hardware engineer) but I'm not seeing any obvious issues nor do I understand why the TVP5158 driver would be getting calls when my device is a TVP5151 running the TVP5150 driver. Can you clarify that your statements regarding opening of the device? Are you suggesting that the NTSC stream needs to be active before the TVP5151 is registered? My first i2cdump immediately after boot is as follows: i2cdump -f -y 3 0x5d No size specified (using byte-data access) 0 1 2 3 4 5 6 7 8 9 a b c d e f 0123456789abcdef 00: 02 15 00 6f 00 00 10 60 00 80 80 00 80 47 00 02 ??.o..?`.??.?G.? 10: 00 00 00 00 00 01 80 00 00 00 0c 54 00 00 00 00 .....??...?T.... 20: 00 00 00 00 00 00 00 20 02 00 00 00 77 55 0f 01 ....... ?...wU?? 30: 00 0f 00 00 00 00 00 00 00 98 01 00 19 00 00 00 .?.......??.?... 40: 4e 00 00 00 5f 00 00 00 40 00 00 00 4f 00 00 00 [email protected]... 50: 5e 00 00 00 2a 00 00 00 5a 00 00 00 45 00 00 00 ^...*...Z...E... 60: 47 00 00 00 68 00 00 00 4e 00 00 00 66 00 00 00 G...h...N...f... 70: 32 00 00 00 42 00 00 00 4b 00 00 00 3f 00 00 00 2...B...K...?... 80: 51 51 01 00 00 02 80 00 10 10 00 00 81 01 02 01 QQ?..??.??..???? 90: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ a0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ b0: 71 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 q............... c0: 40 00 04 67 20 00 40 00 80 00 00 4e 00 01 01 00 @.?g .@.?..N.??. d0: 00 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ................ e0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ................ f0: ff ff ff ff ff ff ff ff ff ff ff ff 7f 00 00 00 ............?... Running i2cdump a second time yields this: root@dra7xx-evm:~# i2cdump -f -y 3 0x5d No size specified (using byte-data access) 0 1 2 3 4 5 6 7 8 9 a b c d e f 0123456789abcdef 00: 00 15 00 00 dc 00 10 60 00 80 80 00 80 47 00 00 .?..?.?`.??.?G.. 10: 00 00 00 00 00 01 80 00 00 00 0c 14 00 00 00 00 .....??...??.... 20: 00 00 00 00 00 00 00 00 00 00 00 00 ab 7a 0f 01 ............?z?? 30: 00 0f 00 00 00 00 00 00 00 98 01 00 84 84 46 84 .?.......??.??F? 40: 84 84 f5 84 84 84 bf 84 84 84 f2 84 84 84 f7 84 ???????????????? 50: 84 84 4d 84 84 84 8d 84 84 84 38 84 84 84 41 84 ??M???????8???A? 60: 84 84 b1 84 84 84 ed 00 00 00 8b 00 00 00 85 00 ???????...?...?. 70: 00 84 80 84 84 84 34 84 84 84 01 84 84 84 84 84 .?????4????????? 80: 51 51 01 00 00 02 80 00 10 10 00 00 81 01 02 01 QQ?..??.??..???? 90: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ a0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ b0: 71 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 q............... c0: 40 00 04 67 20 00 40 00 80 00 00 4e 00 01 01 00 @.?g .@.?..N.??. d0: 00 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ................ e0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ................ f0: ff ff ff ff ff ff ff ff ff ff ff ff 7f 00 00 00 ............?... I don't understand why the initial I2C dump gives different output than subsequent runs but it does seem strange to me. Here's the output of the vip_diagnostic script. I modified the i2cbus, desaddr, and basebus values to match my configuration. =====================VIP diagnostic script=================== Basic tests to debug capture issues quickly VIP 1 Slice 0 Port A <--> LVDS cam1 => Check if the DE-SERIALIZER is accessible FAIL => Check if the SERIALIZER is connected FAIL Error: Read failed => Check if the SERIALIZER is accessible./vip_diagnostic.sh: line 257: [: 0xb0: unary operator expected FAIL Error: Read failed => Check if the CAMERA clock is present./vip_diagnostic.sh: line 257: [: 0x15: unary operator expected FAIL Error: Write failed Error: Read failed => Check if the CAMERA is accessible./vip_diagnostic.sh: line 257: [: 0x35: unary operator expected FAIL => Check if the parser is configured PASS => Check if the port is detecting the frame size FAIL VPDMA descriptor dump |----------------------------| | Address (hex) | Data (hex) | |----------------------------| | 0xAE9A0000 | 0xEE9A6000 | | 0xAE9A0004 | 0x000D5148 | | 0xAE9A0008 | 0x00000000 | | 0xAE9A000C | 0x00000000 | | 0xAE9A0010 | 0x65642F2E | | 0xAE9A0014 | 0x65636976 | | 0xAE9A0018 | 0x69762F73 | | 0xAE9A001C | 0x61757472 | | 0xAE9A0020 | 0x74742F6C | | 0xAE9A0024 | 0x74702F79 | | 0xAE9A0028 | 0x2F356379 | | 0xAE9A002C | 0x65776F70 | | 0xAE9A0030 | 0x00000072 | | 0xAE9A0034 | 0x6F72006D | | 0xAE9A0038 | 0x75735F65 | | 0xAE9A003C | 0x6E657073 | | 0xAE9A0040 | 0x5F646564 | |----------------------------| VPDMA data type:- 0x3b VPDMA channel number used:- 0 VPDMA write descriptor dump |----------------------------| | Address (hex) | Data (hex) | |----------------------------| | 0x65642F28 | 0x25428601 | | 0x65642F2C | 0x43410240 | | 0x65642F30 | 0x30CB518A | | 0x65642F34 | 0x80733CC0 | | 0x65642F38 | 0x8DD852CF | | 0x65642F3C | 0x0500824F | | 0x65642F40 | 0x05E947C0 | | 0x65642F44 | 0x0208A81C | | 0x65642F48 | 0x4EB14422 | |----------------------------| Frame size written:- 36312 x 207 Crossbar mapping:- | 80 | 0x4A002ADC | 351 | VIP1_IRQ_1 | VIP1 | VIP1 interrupt 1 | Crossbar source 351 VIP1_IRQ_1 mapped to MPU GIC 112 Interrupt count:- =============================END============================= If all of these tests PASS and still there is a problem, go home :) I'm still working on debugging this problem would but appreciate some extra hand-holding. To the best I can tell, I seem to be getting a good NTSC signal into the AIN1A port on the TVP5151 and am getting good looking 27MHz SCLK and data signals at its output. When reading register 0x88, I also get varying values (mostly 0x0e, some 0x8e and 0x1e) which indicates to me that the TVP5151 is receiving the NTSC signal just fine. For some additional info, I added "ti_vip.debug=3" to my boot string: root@dra7xx-evm:~# dmesg | grep vip [ 0.000000] Kernel command line: console=ttyO0,115200n8 vram=16M root=PARTUUID=1de6a7a1-02 rw rootwait ip=none mem=1024M cma=64M ti_vip.debug=3 [ 2.101313] vip1-s0: vip_set_slice_path: [ 2.101324] vip1-s0: vip_set_slice_path: DATA_PATH_SELECT(0000010C): 80008000 [ 2.101695] vip1-s1: vip_set_slice_path: [ 2.101706] vip1-s1: vip_set_slice_path: DATA_PATH_SELECT(00000110): 80008000 [ 2.101740] vip 48970000.vip: loading firmware vpdma-1b8.bin [ 2.108152] vip2-s0: vip_set_slice_path: [ 2.108162] vip2-s0: vip_set_slice_path: DATA_PATH_SELECT(0000010C): 80008000 [ 2.108528] vip2-s1: vip_set_slice_path: [ 2.108538] vip2-s1: vip_set_slice_path: DATA_PATH_SELECT(00000110): 80008000 [ 2.108571] vip 48990000.vip: loading firmware vpdma-1b8.bin [ 2.126127] vip 48970000.vip: VPDMA firmware loaded [ 2.131097] vip1-s0: can't get next endpoint: loop: 1 [ 2.131104] vip1-s0: register async notifier for 1 subdevs [ 2.131113] vip1-s0: vip_async_bound [ 2.131121] vip1-s0: Port A: Using subdev tvp5150 3-005d for capture [ 2.137759] vip 48990000.vip: VPDMA firmware loaded [ 2.142718] vip2-s0: can't get next endpoint: loop: 1 [ 2.142726] vip2-s0: register async notifier for 1 subdevs [ 2.142742] vip1-s0: subdev tvp5150 3-005d: code: 2006 idx: 0 [ 2.142750] vip1-s0: matched fourcc: NV12: code: 2006 idx: 0 [ 2.142757] vip1-s0: matched fourcc: UYVY: code: 2006 idx: 1 [ 2.142764] vip1-s0: matched fourcc: YUYV: code: 2006 idx: 2 [ 2.142770] vip1-s0: matched fourcc: VYUY: code: 2006 idx: 3 [ 2.142776] vip1-s0: matched fourcc: YVYU: code: 2006 idx: 4 [ 2.142782] vip1-s0: matched fourcc: RGB3: code: 2006 idx: 5 [ 2.142788] vip1-s0: matched fourcc: RGB4: code: 2006 idx: 6 [ 2.142794] vip1-s0: matched fourcc: BGR3: code: 2006 idx: 7 [ 2.142800] vip1-s0: matched fourcc: BGR4: code: 2006 idx: 8 [ 2.142980] vip1-s0: device registered as video0 [ 2.147647] vip1-s0: vip_async_complete [ 2.147667] vip2-s0: vip_async_bound [ 2.147674] vip2-s0: Port A: Using subdev tvp5150 3-005c for capture [ 2.154053] vip2-s0: subdev tvp5150 3-005c: code: 2006 idx: 0 [ 2.154062] vip2-s0: matched fourcc: NV12: code: 2006 idx: 0 [ 2.154069] vip2-s0: matched fourcc: UYVY: code: 2006 idx: 1 [ 2.154075] vip2-s0: matched fourcc: YUYV: code: 2006 idx: 2 [ 2.154081] vip2-s0: matched fourcc: VYUY: code: 2006 idx: 3 [ 2.154087] vip2-s0: matched fourcc: YVYU: code: 2006 idx: 4 [ 2.154093] vip2-s0: matched fourcc: RGB3: code: 2006 idx: 5 [ 2.154098] vip2-s0: matched fourcc: RGB4: code: 2006 idx: 6 [ 2.154104] vip2-s0: matched fourcc: BGR3: code: 2006 idx: 7 [ 2.154110] vip2-s0: matched fourcc: BGR4: code: 2006 idx: 8 [ 2.154266] vip2-s0: device registered as video1 [ 2.158959] vip2-s0: vip_async_complete [ 6.584181] vip1-s0: vip_open [ 6.584184] vip2-s0: vip_open [ 6.677117] vip2-s0: vip_init_port: g_mbus_fmt subdev mbus_code: 2006 fourcc:NV12 size: 720x480 [ 6.677296] vip1-s0: vip_init_port: g_mbus_fmt subdev mbus_code: 2006 fourcc:NV12 size: 720x480 Thanks!
Hi, Sorry for the confusion on TVP5158. Can you point me to which subdevice driver you are using for the camera? Also, just to confirm my suspicia, just try to open the device and see if you get similar error. Run following on the commnad line cat /dev/video1 If this also gives you 'No such file or directory' error, then the problem is due to ENODEV getting returned from open. Regards, Nikhil D
Hi Nikhil, Is the TVP5151 not the subdevice? cat /dev/video0 and cat /dev/video1 are yielding the same "No such file or directory" error. Strangely though, grep ENODEV returns no results in the tvp5150 driver so I don't even see where that return is coming from. How do I get past this ENODEV error when it appears that I have valid NTSC data coming into the 5151? Thanks, Joe
Hi Joseph, Please provide details on which Processor SDK release you are using, kernel version and details of the subdevice driver being used Regards, Nikhil D
Vision SDK 3.05 with its included kernel. I am using the tvp5150 driver included with the VSDK with a patch to the 5150_probe function to detect the 5151 /* ITU-T BT.656.4 timing */ tvp5150_write(sd, TVP5150_REV_SELECT, 0); } else if (tvp5150_id[0] == 0x51 && tvp5150_id[1] == 0x51) { /* TVP5151 */ v4l2_info(sd, "tvp5151 detected.\n"); } else { I haven't changed much. Device tree updates for my board in u-boot and kernel, pinmuxing in u-boot, adding CONFIG_VIDEO_TVP5150=y to my audio_display.cfg ti_config_fragments. It seems to me like I'm missing a critical step here due to my inexperience. Is the issue that I need a secondary driver for my camera beyond the driver needed for the TVP5151? As it stands, and for my immediate need, I am most interested in just capturing the data that I already have streaming into the 5151. For my device, I can simply apply power and it works. Assuming this is my problem, is there a way to do that with a generic driver that just registers without doing anything? Thanks, Joe
Hi Joe, Here is the problem: The Linux VIP driver is a generic capture driver which can capture from any video source. Its responsible for configuring the video parser and DMA. For this to work, all the camera configuration is to be done by the subdevice driver. VIP driver calls few subdev calls to understand the capabilities of the video to be captured from subdevice (camera, video source, etc) If some of the subdev calls called from open fail, the VIP driver returns -ENODEV. So you have to make sure that the subdev driver implements the standard operations that the VIP driver calls. Since you don't have these ops implemented or possibly the formats reported do not match into supported format. That's why you are facing this issue. The solution is to track down all the subdev calls that are being called by VIP and implement them correctly. You can refer to tvp5158 driver as reference of how this is done. Regards, Nikhil D