Jetson Nano with external camera sensor

Hello, I’m trying to connect external camera sensor OPN6001 to Nano CSI interface.
So far, I have seen /dev/video0, means that the device and driver have successfully probed. But the kernel log shows error below:
[ 53.489646] opn6001: loading out-of-tree module taints kernel.
[ 53.495931] vi 54080000.vi: subdev opn6001-preisp bound
[ 53.496372] Internal error: Accessing user space memory outside uaccess.h routines: 96000005 [#1] PREEMPT SMP
[ 53.506276] Modules linked in: opn6001(O+) bnep fuse overlay zram spidev userspace_alert nvgpu bluedroid_pm ip_tables x_tables
[ 53.517992] CPU: 0 PID: 6901 Comm: insmod Tainted: G O 4.9.140-tegra #1
[ 53.525767] Hardware name: NVIDIA Jetson Nano Developer Kit (DT)
[ 53.531803] task: ffffffc0c6815400 task.stack: ffffffc0d045c000
[ 53.537781] PC is at tegra_channel_set_interlace_mode+0x6c/0xa8
[ 53.543736] LR is at tegra_channel_set_interlace_mode+0x30/0xa8
[ 53.549686] pc : [] lr : [] pstate: a0400045
[ 53.557105] sp : ffffffc0d045f720
[ 53.560447] x29: ffffffc0d045f720 x28: 0000000000000018
[ 53.565837] x27: 0000000000000065 x26: 0000000000000002
[ 53.571223] x25: 0000000000000038 x24: ffffff80090716dc
[ 53.576605] x23: 00000000000002d0 x22: 0000000000000140
[ 53.581985] x21: ffffffc0f96bbc20 x20: ffffffc0f79f5018
[ 53.587363] x19: ffffffc0d590cc18 x18: 0000000000000001
[ 53.592741] x17: 0000000000000002 x16: 0000000000000000
[ 53.598115] x15: ffffffffffffffff x14: ffffffc0d045f720
[ 53.603487] x13: ffffffc0d045f625 x12: ffffffffffffffff
[ 53.608862] x11: ffffffc0d045f5e0 x10: ffffffc0d045f5e0
[ 53.614235] x9 : 0000000000000002 x8 : 0000000000000002
[ 53.619610] x7 : ffffff8008fc6e88 x6 : 0000000000000090
[ 53.624983] x5 : 000000000000008d x4 : 0000000000000001
[ 53.630358] x3 : 0000000000000000 x2 : 0000000000000158
[ 53.635733] x1 : 0000000000000000 x0 : 0000000000000000

[ 53.642633] Process insmod (pid: 6901, stack limit = 0xffffffc0d045c000)
[ 53.649356] Call trace:
[ 53.651854] [] tegra_channel_set_interlace_mode+0x6c/0xa8
[ 53.658853] [] tegra_channel_update_format+0xec/0x168
[ 53.665505] [] tegra_channel_fmts_bitmap_init+0x228/0x268
[ 53.672504] [] tegra_channel_init_subdevices+0x17c/0x790
[ 53.679416] [] tegra_vi_graph_notify_complete+0x2e8/0x6e0
[ 53.686415] [] v4l2_async_test_notify+0x104/0x120
[ 53.692715] [] v4l2_async_register_subdev+0x88/0x100
[ 53.699298] [] opn6001_probe+0x160/0x200 [opn6001]
[ 53.705689] [] i2c_device_probe+0x144/0x258
[ 53.711476] [] driver_probe_device+0xd8/0x408
[ 53.717426] [] __driver_attach+0xdc/0x128
[ 53.723032] [] bus_for_each_dev+0x5c/0xa8
[ 53.728633] [] driver_attach+0x30/0x40
[ 53.733974] [] bus_add_driver+0x20c/0x2a8
[ 53.739580] [] driver_register+0x6c/0x110
[ 53.745184] [] i2c_register_driver+0x4c/0xb0
[ 53.751062] [] preisp_mod_init+0x14/0x30 [opn6001]
[ 53.757454] [] do_one_initcall+0x44/0x130
[ 53.763068] [] do_init_module+0x64/0x1a8
[ 53.768590] [] load_module+0x10a4/0x12d8
[ 53.774106] [] SyS_finit_module+0xd8/0xf0
[ 53.779708] [] el0_svc_naked+0x34/0x38
[ 53.785059] —[ end trace b987bb3ff35ce24f ]—

The device tree and sensor driver are here:
tegra210-p3448-0000-p3449-0000-b00-user-custom.dts (322.2 KB)
opn6001.c (9.7 KB)

I viewed many topics about camera sensor on forum, but none had the same problem like mine. Hoping for your help, thanks!

Why those status are disable?

		modules {

			module0 {
				badge = "porg_front_RBPCV2";
				position = "front";
				orientation = [31 00];
				status = "disabled";
				linux,phandle = <0xbf>;
				phandle = <0xbf>;

				drivernode0 {
					pcl_id = "v4l2_sensor";
					devname = "opn6001 7-0010";
					proc-device-tree = "/proc/device-tree/cam_i2cmux/i2c@1/rbpcv2_opn6001_a@10";
					status = "disabled";
					linux,phandle = <0xc0>;
					phandle = <0xc0>;
				};

				drivernode1 {
					pcl_id = "v4l2_lens";
					proc-device-tree = "/proc/device-tree/lens_opn6001@RBPCV2/";
					status = "disabled";
					linux,phandle = <0xc1>;
					phandle = <0xc1>;
				};
			};
			
			module1 {
				badge = "porg_rear_RBPCV2";
				position = "rear";
				orientation = [31 00];
				status = "disabled";
				linux,phandle = <0xca>;
				phandle = <0xca>;

				drivernode0 {
					pcl_id = "v4l2_sensor";
					devname = "opn6001 8-0010";
					proc-device-tree = "/proc/device-tree/cam_i2cmux/i2c@1/rbpcv2_opn6001_e@10";
					status = "disabled";
					linux,phandle = <0xcd>;
					phandle = <0xcd>;
				};

				drivernode1 {
					pcl_id = "v4l2_lens";
					proc-device-tree = "/proc/device-tree/lens_opn6001@RBPCV2/";
					status = "disabled";
					linux,phandle = <0xce>;
					phandle = <0xce>;
				};
			};
		};
	};

Also have a check below doc for sensor driver implement.

https://docs.nvidia.com/jetson/l4t/index.html#page/Tegra%20Linux%20Driver%20Package%20Development%20Guide/camera_sensor_prog.html#wwpID0E0Q50HA

I used jetson-io to enable SPI on nano board, so the device tree is modified into “tegra210-p3448-0000-p3449-0000-b00-user-custom.dts”.
I don’t know why the device tree disabled them, but when I turned them into “okay”, everything is just the same.

I would suggest use imx219 as template to implement OPN6001

Actually, I do modified the OPN6001 device tree from imx219. I have a imx219 sensor and it works well on Nano board with the original device tree.

Please also implement the sensor kernel driver follow imx219.c