Porting TC358840 to Jetson TX2i Jetpack4.2

Hi every one.

I tried to port TC358840 to Jetson TX2i install Jetpack4.2 and it seems to be success when it appears /dev/video0 and /dev/video1. But kernel crash right after i tried to read video from /dev/video1.

[   43.196150] Unable to handle kernel read from unreadable memory at virtual address 000000a0
[   43.204611] Mem abort info:
[   43.207404]   ESR = 0x96000005
[   43.210499]   Exception class = DABT (current EL), IL = 32 bits
[   43.216464]   SET = 0, FnV = 0
[   43.219552]   EA = 0, S1PTW = 0
[   43.222732] Data abort info:
[   43.225658]   ISV = 0, ISS = 0x00000005
[   43.229530]   CM = 0, WnR = 0
[   43.232497] user pgtable: 4k pages, 39-bit VAs, pgd = ffffffc19bf79000
[   43.239057] [00000000000000a0] *pgd=0000000000000000, *pud=0000000000000000
[   43.246090] Internal error: Oops: 96000005 [#1] PREEMPT SMP
[   43.251652] Modules linked in: bnep fuse nvs_bmi160 nvs nvgpu bluedroid_pm ip_tables x_tables
[   43.260246] CPU: 5 PID: 7236 Comm: vi-output, tc35 Tainted: G        W       4.9.140 #1
[   43.268233] Hardware name: storm (DT)
[   43.271886] task: ffffffc19dc82a00 task.stack: ffffffc19efac000
[   43.277800] PC is at tegra_camera_update_clknbw+0x2c/0x2a8
[   43.283277] LR is at tegra_channel_set_stream+0x194/0x4b0
[   43.288662] pc : [<ffffff800851b5f4>] lr : [<ffffff8008b0e51c>] pstate: 80400045
[   43.296040] sp : ffffffc19efafcd0
[   43.299346] x29: ffffffc19efafcd0 x28: ffffffc1ab3fceb4 
[   43.304663] x27: ffffffc19dc82a00 x26: ffffffc1ab3fcb08 
[   43.309978] x25: 0000000000000001 x24: 0000000000000001 
[   43.315292] x23: ffffff800a142000 x22: 0000000000000000 
[   43.320606] x21: ffffffc1ab3fcda0 x20: ffffffc1ab3fc018 
[   43.325921] x19: ffffffc1ab3fc018 x18: 0000007fb3ce7a70 
[   43.331234] x17: 0000000000000002 x16: 0000000000000000 
[   43.336548] x15: 0000335210000000 x14: 0000000000000004 
[   43.341860] x13: 00000000000000cf x12: 00000000000001d2 
[   43.347175] x11: 00000000023ee898 x10: 0000000000000a20 
[   43.352489] x9 : ffffffc19efafd70 x8 : ffffffc19dc83480 
[   43.357805] x7 : 0000000000000000 x6 : 00000000000002e1 
[   43.363118] x5 : 0000000000000000 x4 : ffffff8011d00000 
[   43.368433] x3 : ffffff8011d00000 x2 : 0000000000010100 
[   43.373747] x1 : 0000000000000001 x0 : 0000000000000000 

[   43.380545] Process vi-output, tc35 (pid: 7236, stack limit = 0xffffffc19efac000)
[   43.388011] Call trace:
[   43.390452] [<ffffff800851b5f4>] tegra_camera_update_clknbw+0x2c/0x2a8
[   43.396967] [<ffffff8008b0e51c>] tegra_channel_set_stream+0x194/0x4b0
[   43.403395] [<ffffff8008b147e0>] tegra_channel_kthread_capture_start+0x468/0x4d0
[   43.410776] [<ffffff80080dbb28>] kthread+0xd8/0xf0
[   43.415557] [<ffffff8008083850>] ret_from_fork+0x10/0x40
[   43.420857] ---[ end trace 708149bdd3672963 ]---
[   47.544554] Internal error: Accessing user space memory outside uaccess.h routines: 96000005 [#2] PREEMPT SMP
[   47.554481] Modules linked in: bnep fuse nvs_bmi160 nvs nvgpu bluedroid_pm ip_tables x_tables
[   47.563129] CPU: 0 PID: 7214 Comm: gst-launch-1.0 Tainted: G      D W       4.9.140 #1
[   47.571044] Hardware name: storm (DT)
[   47.574714] task: ffffffc18183b800 task.stack: ffffffc155cdc000
[   47.580644] PC is at __ll_sc_atomic_sub_return+0x4/0x20
[   47.585874] LR is at exit_creds+0x2c/0x80
[   47.589885] pc : [<ffffff800844d67c>] lr : [<ffffff80080deba4>] pstate: 60400045
[   47.597275] sp : ffffffc155cdfa10
[   47.600591] x29: ffffffc155cdfa10 x28: ffffffc1945cb800 
[   47.605925] x27: 0000000000000001 x26: ffffffc155cdfd10 
[   47.611258] x25: ffffff8009fc12b8 x24: 0000000000000000 
[   47.616591] x23: ffffffc1a455a100 x22: ffffffc1ab3fcb58 
[   47.621921] x21: ffffffc19dc82a30 x20: 000000000000000b 
[   47.627253] x19: ffffffc19dc82a00 x18: 00000000000003c5 
[   47.632584] x17: 0000000000000000 x16: 00000000000000bf 
[   47.637914] x15: 0000007faef07348 x14: 0000007faef12400 
[   47.643244] x13: 0000000000000000 x12: 0000000000000000 
[   47.648574] x11: 0000000000000000 x10: 0101010101010101 
[   47.653903] x9 : 0000007faf1fc140 x8 : 000000000000001d 
[   47.659236] x7 : 0000000145600000 x6 : ffffffc155cdfd14 
[   47.664567] x5 : 0000000000000400 x4 : 0000000000000000 
[   47.669900] x3 : 00000000000000bf x2 : 0000000000000000 
[   47.675228] x1 : 0000000000000000 x0 : 0000000000000001 

[   47.682058] Process gst-launch-1.0 (pid: 7214, stack limit = 0xffffffc155cdc000)
[   47.689449] Call trace:
[   47.691907] [<ffffff800844d67c>] __ll_sc_atomic_sub_return+0x4/0x20
[   47.698178] [<ffffff80080b069c>] __put_task_struct+0x4c/0x148
[   47.703925] [<ffffff80080dc6b0>] kthread_stop+0x1e0/0x1e8
[   47.709331] [<ffffff8008b14a50>] vi4_channel_stop_streaming+0xf0/0x480
[   47.715858] [<ffffff8008b0b1a4>] tegra_channel_stop_streaming+0x34/0x48
[   47.722475] [<ffffff8008b035fc>] __vb2_queue_cancel+0x3c/0x170
[   47.728310] [<ffffff8008b039b0>] vb2_core_streamoff+0x58/0xc0
[   47.734055] [<ffffff8008b07cac>] vb2_streamoff+0x54/0x78
[   47.739366] [<ffffff8008b07d28>] vb2_ioctl_streamoff+0x58/0x68
[   47.745201] [<ffffff8008ae2844>] v4l_streamoff+0x3c/0x50
[   47.750516] [<ffffff8008ae762c>] __video_do_ioctl+0x1bc/0x288
[   47.756262] [<ffffff8008ae7044>] video_usercopy+0x2cc/0x6a8
[   47.761836] [<ffffff8008ae745c>] video_ioctl2+0x3c/0x50
[   47.767061] [<ffffff8008ae12f0>] v4l2_ioctl+0xf8/0x128
[   47.772203] [<ffffff800826c760>] do_vfs_ioctl+0xb0/0x8f8
[   47.777514] [<ffffff800826d03c>] SyS_ioctl+0x94/0xa8
[   47.782481] [<ffffff80080838c0>] el0_svc_naked+0x34/0x38
[   47.787795] ---[ end trace 708149bdd3672964 ]---

Have anyone success in porting TC358840 to Jetson TX2i install Jetpack4.2?
Please tell me how to fix it!

Thanks.

hello haihoangsoftware,

you kernel call stack failure seems like invalid device tree property access.
suggest you access Sensor Software Driver Programming Guide, and check the [Port Index] session for the port bindings.
thanks

Hi Jerry.

I dont think you understand the problem and kernel can not crash because of device tree.
Your guideline document is not enough information for us.
We have to solve errors by digging to the kernel code.
So we need the right answer, not “seems” answer.

Thanks.

hello haihoangsoftware,

please dig into VI drivers, you should check which paragraph caused the kernel crash.
for example,
$l4t-r32.2/kernel_src/kernel/nvidia/drivers/video/tegra/camera/tegra_camera_platform.c
$l4t-r32.2/kernel_src/kernel/nvidia/drivers/media/platform/tegra/camera/vi/channel.c

Hi JerryChang.

That’s the anwser.
I’ll check it.

Thanks.

Hi haihoangsoftware,

have you found a solution for your problem? I’m probably facing the same problem in the next days with my TX2 4GB Module.

Thanks!

Hi Andik.

I could only port the driver to Jetpack 3.3 based on what zhaw guided.

Hi haihoangsoftware,

okay thanks!

I have found that zhaw is working on kernel 4.9, maybe also interesting for you -> https://github.com/InES-HPMM/linux-l4t-4.9

In the post of D3_grove it is also mentioned how to adapt the driver -> https://devtalk.nvidia.com/default/topic/1055191/jetson-tx2/hdmi2csi-port-from-28-2-1-to-32-1/post/5358945/#reply