Hello,
We are building a camera sensor board and interfacing to the CSI port of the TX2 mother board from a third party. In our custom board we are using ADV7604 decoder for converting analog video to the parallel RGB888 1x24 format and then using FPGA which is converting that parallel RGB data into CSI format and interfacing that with CSI of the mother board from the third party. Our FPGA is not configurable.
So We modified the ADV7604 driver and compiled as a loadable module. Updated the device tree accordingly. After flashing the kernel video0 node is getting created but kernel is getting panicked at following point:
[ 10.815844] adv7604 30-0020: adv7604 found @ 0x40 (i2c-2-mux (chan_id 0))
[ 10.815853] VD: Before v4l2_async_register_subdev
[ 10.815853] tegra-vi4 15700000.vi: subdev adv7604 30-0020 bound
[ 10.816126] VD: Group Id is 1
[ 10.816126] VD: Inside tegra_channel_init_subdevices function and after snprintf call
[ 10.816128] VD: Inside whileloop
[ 10.816128] VD: Before media_entity_remote_pad function call
[ 10.816188] VD: pad = null
[ 10.816189] VD: inside tegra_channel_fmt_align
[ 10.816199] VD: inside tegra_channel_fmt_align
[ 10.816199] Internal error: Accessing user space memory outside uaccess.h routines: 96000005 [#1] PREEMPT SMP
[ 10.816206] Modules linked in: adv7604(+) nvgpu bluedroid_pm ip_tables x_tables
[ 10.816210] CPU: 5 PID: 3221 Comm: systemd-udevd Not tainted 4.9.140-tegra-tegra #4
[ 10.816211] Hardware name: quill (DT)
[ 10.816213] task: ffffffc1d61fe200 task.stack: ffffffc1d62d0000
[ 10.816221] PC is at tegra_channel_populate_dev_info+0x60/0x1c0
[ 10.816223] LR is at tegra_channel_populate_dev_info+0x50/0x1c0
[ 10.816225] pc : [] lr : [] pstate: 40400045
[ 10.816226] sp : ffffffc1d62d3780
[ 10.816229] x29: ffffffc1d62d3780 x28: 0000000000000000
[ 10.816231] x27: ffffff80094b6000 x26: ffffff80094b6000
[ 10.816234] x25: 00000000009a2065 x24: ffffffc1e5294050
[ 10.816236] x23: 000000000000000a x22: ffffffc1ebbfa770
[ 10.816238] x21: ffffffc1ebbfa018 x20: ffffffc1d62d3838
[ 10.816240] x19: ffffffc1eb6b8c10 x18: 0000000000000001
[ 10.816242] x17: 0000000000000002 x16: 0000000000000000
[ 10.816244] x15: ffffffffffffffff x14: ffffffc1d62d3780
[ 10.816246] x13: ffffffc1d62d3685 x12: ffffffffffffffff
[ 10.816248] x11: ffffffc1d62d3640 x10: ffffffc1d62d3640
[ 10.816250] x9 : 0000000000000042 x8 : 0000000000000002
[ 10.816252] x7 : ffffff8008fb6dc8 x6 : 0000000000000083
[ 10.816254] x5 : 000000000000008d x4 : 0000000000000001
[ 10.816256] x3 : 0000000000000000 x2 : 0000000000000000
[ 10.816257] x1 : 0000000000000000 x0 : 0000000000000000
[ 10.816260] Process systemd-udevd (pid: 3221, stack limit = 0xffffffc1d62d0000)
[ 10.816261] Call trace:
[ 10.816265] [] tegra_channel_populate_dev_info+0x60/0x1c0
[ 10.816267] [] tegra_channel_init_subdevices+0x25c/0x850
[ 10.816269] [] tegra_vi_graph_notify_complete+0x328/0x6d8
[ 10.816273] [] v4l2_async_test_notify+0x104/0x120
[ 10.816275] [] v4l2_async_register_subdev+0x88/0x100
[ 10.816286] [] adv76xx_probe.part.6+0xce4/0xea0 [adv7604]
[ 10.816294] [] adv76xx_probe+0x60/0x70 [adv7604]
[ 10.816297] [] i2c_device_probe+0x144/0x258
[ 10.816301] [] driver_probe_device+0xd8/0x408
[ 10.816303] [] __driver_attach+0xdc/0x128
[ 10.816306] [] bus_for_each_dev+0x5c/0xa8
[ 10.816308] [] driver_attach+0x30/0x40
[ 10.816310] [] bus_add_driver+0x20c/0x2a8
[ 10.816312] [] driver_register+0x6c/0x110
[ 10.816314] [] i2c_register_driver+0x4c/0xb0
[ 10.816322] [] adv76xx_driver_init+0x14/0x30 [adv7604]
[ 10.816325] [] do_one_initcall+0x44/0x130
[ 10.816329] [] do_init_module+0x64/0x1a8
[ 10.816332] [] load_module+0x10a4/0x12d8
[ 10.816334] [] SyS_finit_module+0xd8/0xf0
[ 10.816336] [] __sys_trace_return+0x0/0x4
[ 10.816340] —[ end trace 4440dd5658edb83d ]—
[ 10.860624] CAN device driver interface
I tried to trace the problem area by printk() and came up with conclusion that problem is in sources/kernel/nvidia/drivers/media/platform/tegra/camera/vi/channel.c file . Inside this file there is a function tegra_channel_init_subdevices() in which there is function call:
pad = media_entity_remote_pad(pad);
which return value is NULL; that is creating the problem. As shown in the log: Internal error: Accessing user space memory outside uaccess.h routines it is because of this NULL return.
I referred this link Media Controller framework and understand the meaning as mentioned below:
struct media_pad * media_entity_remote_pad(const struct media_pad * pad)
Find the pad at the remote end of a link
Parameters
const struct media_pad * pad
Pad at the local end of the link
Description
Search for a remote pad connected to the given pad by iterating over all links originating or terminating at that pad until an enabled link is found.
Return
returns a pointer to the pad at the remote end of the first found enabled link, or NULL if no enabled link has been found.
So as per my understanding VI is trying to search for enabled link but not getting anyone of it. Here is my pad initialisation code snippet:
state->source_pad = state->info->num_dv_ports
+ (state->info->has_afe ? 2 : 0);
for (i = 0; i < state->source_pad; ++i){
state->pads[i].flags = MEDIA_PAD_FL_SINK;
printk(" VD: Inside the for loop counting MEDIA_PAD_FL_SINK ");
}
state->pads[state->source_pad].flags = MEDIA_PAD_FL_SOURCE;
sd->entity.obj_type = MEDIA_ENTITY_TYPE_V4L2_SUBDEV;
sd->entity.function = MEDIA_ENT_F_CAM_HW;
err = media_entity_pads_init(&sd->entity, state->source_pad + 1,
state->pads);
Could you please explain me why VI is not able to find any enable link as I enabled the source pad in the AV7604 driver? What the parameters is there VI is looking for? Please find the attached device tree and tell us if any changes is required.
vikas.txt (6.5 KB)
Thanks and Regards,
Vikas Dwivedi