I’m using chip TL8918L(LVDS to CSI converter) to send MIPI CSI to TX2, but it’s not always working well, maybe V4L2 ioctl API returns error every 1 minute.
SDK version:
R28 (release), REVISION: 2.1, GCID: 11272647, BOARD: t186ref, EABI: aarch64, DATE: Thu May 17 07:29:06 UTC 2018
I have patched driver source code below:
0001-drivers-camera-fix-FE-syncpt-wait.patch
0002-media-tegra-fix-missing-timestamp-for-vi4.patch
0003-media-tegra-revert-two-thread-VI-improvements.patch
0004-media-tegra-camera-t18x-vi-mode-error-recovery.patch
I also disabled the ECC check:
diff --git a/drivers/media/platform/tegra/camera/csi/csi4_fops.c b/drivers/media/platform/tegra/camera/csi/csi4_fops.c
index 0377d7b..b3d01d3 100644
--- a/drivers/media/platform/tegra/camera/csi/csi4_fops.c
+++ b/drivers/media/platform/tegra/camera/csi/csi4_fops.c
@@ -76,8 +76,18 @@ static void csi4_stream_init(struct tegra_csi_channel *chan, int port_num)
csi4_stream_write(chan, port_num, INTR_STATUS, 0x3ffff);
csi4_stream_write(chan, port_num, ERR_INTR_STATUS, 0x7ffff);
csi4_stream_write(chan, port_num, ERROR_STATUS2VI_MASK, 0x0);
- csi4_stream_write(chan, port_num, INTR_MASK, 0x0);
- csi4_stream_write(chan, port_num, ERR_INTR_MASK, 0x0);
+
+ csi4_stream_write(chan, port_num, INTR_MASK, PH_ECC_MULTI_BIT_ERR |
+ PD_CRC_ERR_VC0 | PH_ECC_SINGLE_BIT_ERR_VC0);
+ csi4_stream_write(chan, port_num, ERR_INTR_MASK, PH_ECC_MULTI_BIT_ERR |
+ PD_CRC_ERR_VC0 | PH_ECC_SINGLE_BIT_ERR_VC0);
+ csi4_stream_write(chan, port_num, ERROR_STATUS2VI_MASK,
+ CFG_ERR_STATUS2VI_MASK_VC0 |
+ CFG_ERR_STATUS2VI_MASK_VC1 |
+ CFG_ERR_STATUS2VI_MASK_VC2 |
+ CFG_ERR_STATUS2VI_MASK_VC3);
}
But problem remains:
root@tegra-ubuntu:~# dmesg
[10214.702655] tegra-vi4 15700000.vi: PXL_SOF syncpt timeout! err = -11
[10214.709241] tegra-vi4 15700000.vi: tegra_channel_error_recovery: attempting to reset the capture channel
[10214.719104] nvcsi 150c0000.nvcsi: csi4_cil_check_status (2) CIL_INTR_STATUS 0x00000042
[10214.727200] nvcsi 150c0000.nvcsi: csi4_cil_check_status (2) CIL_ERR_INTR_STATUS 0x00000042
[10214.757763] nvcsi 150c0000.nvcsi: csi4_cil_check_status (2) CIL_INTR_STATUS 0x00000042
[10214.765929] nvcsi 150c0000.nvcsi: csi4_cil_check_status (2) CIL_ERR_INTR_STATUS 0x00000042
[10220.738681] tegra-vi4 15700000.vi: PXL_SOF syncpt timeout! err = -11
[10220.745256] tegra-vi4 15700000.vi: tegra_channel_error_recovery: attempting to reset the capture channel
[10220.755127] nvcsi 150c0000.nvcsi: csi4_cil_check_status (2) CIL_INTR_STATUS 0x0200015a
[10220.763220] nvcsi 150c0000.nvcsi: csi4_cil_check_status (2) CIL_ERR_INTR_STATUS 0x0200015a
[10220.793226] nvcsi 150c0000.nvcsi: csi4_cil_check_status (2) CIL_INTR_STATUS 0x060001de
[10220.801386] nvcsi 150c0000.nvcsi: csi4_cil_check_status (2) CIL_ERR_INTR_STATUS 0x060001de
root@tegra-ubuntu:~# cat /sys/kernel/debug/tracing/trace
# tracer: nop
#
# entries-in-buffer/entries-written: 83574/83574 #P:6
#
# _-----=> irqs-off
# / _----=> need-resched
# | / _---=> hardirq/softirq
# || / _--=> preempt-depth
# ||| / delay
# TASK-PID CPU# |||| TIMESTAMP FUNCTION
# | | | |||| | |
kworker/0:0-3659 [000] ...1 10213.687930: rtcpu_vinotify_handle_msg: tstamp:319357644128 tag:ATOMP_FE channel:0x00 frame:63409 vi_tstamp:1530063735 data:0x00000000
kworker/0:0-3659 [000] ...1 10213.687932: rtcpu_vinotify_handle_msg: tstamp:319357731104 tag:CHANSEL_PXL_SOF channel:0x00 frame:63410 vi_tstamp:1530150646 data:0x00000001
kworker/0:0-3659 [000] ...1 10213.687933: rtcpu_vinotify_handle_msg: tstamp:319357731297 tag:ATOMP_FS channel:0x00 frame:63410 vi_tstamp:1530150666 data:0x00000000
kworker/0:0-3659 [000] ...1 10213.687935: rtcpu_vinotify_handle_msg: tstamp:319357735151 tag:CHANSEL_LOAD_FRAMED channel:0x04 frame:63410 vi_tstamp:1530154805 data:0x08000000
kworker/0:0-3659 [000] ...1 10213.687936: rtcpu_vinotify_handle_msg: tstamp:319358124741 tag:CHANSEL_PXL_EOF channel:0x00 frame:63410 vi_tstamp:1530544161 data:0x01ff0002
kworker/0:0-3659 [000] ...1 10213.687937: rtcpu_vinotify_handle_msg: tstamp:319358124882 tag:ATOMP_FE channel:0x00 frame:63410 vi_tstamp:1530544492 data:0x00000000
kworker/0:0-3659 [000] ...1 10213.687939: rtcpu_vinotify_handle_msg: tstamp:319358211860 tag:CHANSEL_PXL_SOF channel:0x00 frame:63411 vi_tstamp:1530631401 data:0x00000001
kworker/0:0-3659 [000] ...1 10213.687940: rtcpu_vinotify_handle_msg: tstamp:319358212053 tag:ATOMP_FS channel:0x00 frame:63411 vi_tstamp:1530631421 data:0x00000000
kworker/0:0-3659 [000] ...1 10213.687942: rtcpu_vinotify_handle_msg: tstamp:319358215778 tag:CHANSEL_LOAD_FRAMED channel:0x04 frame:63411 vi_tstamp:1530635447 data:0x08000000
kworker/0:0-3659 [000] ...1 10213.739867: rtcpu_vinotify_handle_msg: tstamp:319358605473 tag:CHANSEL_PXL_EOF channel:0x00 frame:63411 vi_tstamp:1531024916 data:0x01ff0002
kworker/0:0-3659 [000] ...1 10213.739872: rtcpu_vinotify_handle_msg: tstamp:319358605576 tag:ATOMP_FE channel:0x00 frame:63411 vi_tstamp:1531025248 data:0x00000000
kworker/0:0-3659 [000] ...1 10213.739874: rtcpu_vinotify_handle_msg: tstamp:319358692597 tag:CHANSEL_PXL_SOF channel:0x00 frame:63412 vi_tstamp:1531112158 data:0x00000001
kworker/0:0-3659 [000] ...1 10213.739875: rtcpu_vinotify_handle_msg: tstamp:319358692737 tag:ATOMP_FS channel:0x00 frame:63412 vi_tstamp:1531112177 data:0x00000000
kworker/0:0-3659 [000] ...1 10213.739877: rtcpu_vinotify_handle_msg: tstamp:319358695404 tag:CHANSEL_LOAD_FRAMED channel:0x04 frame:63412 vi_tstamp:1531115092 data:0x08000000
kworker/0:0-3659 [000] ...1 10213.739878: rtcpu_vinotify_handle_msg: tstamp:319359403745 tag:CSIMUX_FRAME channel:0x00 frame:63412 vi_tstamp:1531823132 data:0x000000a2
kworker/0:0-3659 [000] ...1 10213.739880: rtcpu_vinotify_handle_msg: tstamp:319359403932 tag:CHANSEL_SHORT_FRAME channel:0x04 frame:63412 vi_tstamp:1531823132 data:0x00000001
kworker/0:0-3659 [000] ...1 10213.739881: rtcpu_vinotify_handle_msg: tstamp:319359404068 tag:ATOMP_FE channel:0x00 frame:63412 vi_tstamp:1531823136 data:0x00000000
kworker/0:0-3659 [000] ...1 10213.843915: rtos_queue_peek_from_isr_failed: tstamp:319362300979 queue:0x0b4a3c58
kworker/0:0-3659 [000] ...1 10213.999938: rtos_queue_peek_from_isr_failed: tstamp:319367301484 queue:0x0b4a3c58
kworker/0:0-3659 [000] ...1 10214.155957: rtos_queue_peek_from_isr_failed: tstamp:319372301994 queue:0x0b4a3c58
kworker/0:0-3659 [000] ...1 10214.311999: rtos_queue_peek_from_isr_failed: tstamp:319377302569 queue:0x0b4a3c58
kworker/0:0-3659 [000] ...1 10214.467957: rtos_queue_peek_from_isr_failed: tstamp:319382303077 queue:0x0b4a3c58
kworker/0:0-3659 [000] ...1 10214.623904: rtos_queue_peek_from_isr_failed: tstamp:319387303582 queue:0x0b4a3c58
kworker/0:0-3659 [000] ...1 10214.735904: rtos_queue_peek_from_isr_failed: tstamp:319390830879 queue:0x0b4a3c58
kworker/0:0-3659 [000] ...1 10214.787983: rtos_queue_peek_from_isr_failed: tstamp:319391213050 queue:0x0b4a3c58
kworker/0:0-3659 [000] ...1 10214.788003: rtcpu_start: tstamp:319391218325
kworker/0:0-3659 [000] ...1 10214.788012: rtos_queue_send_from_isr_failed: tstamp:319391225878 queue:0x0b4a2238
kworker/0:0-3659 [000] ...1 10214.788017: rtos_queue_send_from_isr_failed: tstamp:319391226176 queue:0x0b4a2f38
kworker/0:0-3659 [000] ...1 10214.788025: rtcpu_vinotify_handle_msg: tstamp:319391297094 tag:CSIMUX_FRAME channel:0x00 frame:63413 vi_tstamp:1563716668 data:0x00000222
kworker/0:0-3659 [000] ...1 10214.788031: rtcpu_vinotify_handle_msg: tstamp:319391384115 tag:CHANSEL_PXL_SOF channel:0x00 frame:63480 vi_tstamp:1563803580 data:0x00000001
kworker/0:0-3659 [000] ...1 10214.788036: rtcpu_vinotify_handle_msg: tstamp:319391384481 tag:ATOMP_FS channel:0x00 frame:63480 vi_tstamp:1563803600 data:0x00000000
kworker/0:0-3659 [000] ...1 10214.788041: rtcpu_vinotify_handle_msg: tstamp:319391391025 tag:CHANSEL_LOAD_FRAMED channel:0x04 frame:63480 vi_tstamp:1563810621 data:0x08000000
kworker/0:0-3659 [000] ...1 10214.788045: rtcpu_vinotify_handle_msg: tstamp:319391777760 tag:CHANSEL_PXL_EOF channel:0x00 frame:63480 vi_tstamp:1564197095 data:0x01ff0002
kworker/0:0-3659 [000] ...1 10214.788050: rtcpu_vinotify_handle_msg: tstamp:319391778029 tag:ATOMP_FE channel:0x00 frame:63480 vi_tstamp:1564197427 data:0x00000000
kworker/0:0-3659 [000] ...1 10214.788056: rtos_queue_peek_from_isr_failed: tstamp:319392040470 queue:0x0b4a3c58
kworker/0:0-3659 [000] ...1 10215.047858: rtos_queue_peek_from_isr_failed: tstamp:319400649462 queue:0x0b4a3c58
kworker/0:0-3659 [000] ...1 10215.047862: rtcpu_start: tstamp:319400652652
kworker/0:0-3659 [000] ...1 10215.047864: rtcpu_vinotify_handle_msg: tstamp:319400684436 tag:CSIMUX_STREAM channel:0xff frame:0 vi_tstamp:1573104103 data:0x00000100
kworker/0:0-3659 [000] ...1 10215.099918: rtcpu_vinotify_handle_msg: tstamp:319400999166 tag:CHANSEL_PXL_SOF channel:0x00 frame:63500 vi_tstamp:1573418706 data:0x00000001
kworker/0:0-3659 [000] ...1 10215.099923: rtcpu_vinotify_handle_msg: tstamp:319400999328 tag:ATOMP_FS channel:0x00 frame:63500 vi_tstamp:1573418725 data:0x00000000
kworker/0:0-3659 [000] ...1 10215.099925: rtcpu_vinotify_handle_msg: tstamp:319401005736 tag:CHANSEL_LOAD_FRAMED channel:0x04 frame:63500 vi_tstamp:1573425403 data:0x08000000
kworker/0:0-3659 [000] ...1 10215.099927: rtcpu_vinotify_handle_msg: tstamp:319401392796 tag:CHANSEL_PXL_EOF channel:0x00 frame:63500 vi_tstamp:1573812220 data:0x01ff0002
kworker/0:0-3659 [000] ...1 10215.099928: rtcpu_vinotify_handle_msg: tstamp:319401392897 tag:ATOMP_FE channel:0x00 frame:63500 vi_tstamp:1573812552 data:0x00000000
kworker/0:0-3659 [000] ...1 10215.099930: rtcpu_vinotify_handle_msg: tstamp:319401479918 tag:CHANSEL_PXL_SOF channel:0x00 frame:63501 vi_tstamp:1573899462 data:0x00000001
kworker/0:0-3659 [000] ...1 10215.099931: rtcpu_vinotify_handle_msg: tstamp:319401480075 tag:ATOMP_FS channel:0x00 frame:63501 vi_tstamp:1573899481 data:0x00000000
kworker/0:0-3659 [000] ...1 10215.099932: rtcpu_vinotify_handle_msg: tstamp:319401482618 tag:CHANSEL_LOAD_FRAMED channel:0x04 frame:63501 vi_tstamp:1573902307 data:0x08000000
kworker/0:0-3659 [000] ...1 10215.099934: rtcpu_vinotify_handle_msg: tstamp:319401873564 tag:CHANSEL_PXL_EOF channel:0x00 frame:63501 vi_tstamp:1574292977 data:0x01ff0002
kworker/0:0-3659 [000] ...1 10215.099935: rtcpu_vinotify_handle_msg: tstamp:319401873662 tag:ATOMP_FE channel:0x00 frame:63501 vi_tstamp:1574293308 data:0x00000000
kworker/0:0-3659 [000] ...1 10215.099937: rtcpu_vinotify_handle_msg: tstamp:319401960673 tag:CHANSEL_PXL_SOF channel:0x00 frame:63502 vi_tstamp:1574380218 data:0x00000001
kworker/0:0-3659 [000] ...1 10215.099938: rtcpu_vinotify_handle_msg: tstamp:319401960831 tag:ATOMP_FS channel:0x00 frame:63502 vi_tstamp:1574380236 data:0x00000000
NOTE:
The input of LT8918L is an FPGA, which may send incomplete signal, how can I let driver retry or wait more times, instead of return an error to application. I don’t want to reopen the /dev/video0 file, it takes too much time, and lost many frames.
Thanks !