Hi all! First post!
I'm trying to get the Sony IMX219 sensor to work with the iMX 8M Nano EVK.
I used bitbake linux-imx -c menuconfig to set the IMX219 driver to "built-in," disabled the OV5640 driver and built the latest kernel v5.10.9-1.0.0. I then used that kernel image in a fresh imx-image-multimedia.
For some reason, the auto-generated .dtb file did not have a node for the IMX219, yet still had one for the OV5640. I adapted the OV5640 node for my purposes by changing the device name, pointing to the correct i2c bus address, using named &links to connect the camera endpoint to the csi endpoint and adding a "link-frequencies" property as I've seen others do on these forums. Here's what the modified parts of my DTB look like:
csi@32e30000 {
compatible = "fsl,imx8mn-mipi-csi";
reg = <0x0 0x32e30000 0x0 0x10000>;
interrupts = <0x0 0x11 0x4>;
clock-frequency = <0x13d92d40>;
clocks = <0x2 0x81 0x2 0xb8 0x2 0xb9>;
clock-names = "mipi_clk", "disp_axi", "disp_apb";
assigned-clocks = <0x2 0x81>;
assigned-clock-parents = <0x2 0x41>;
assigned-clock-rates = <0x13d92d40>;
bus-width = <0x4>;
csi-gpr = <0x14>;
power-domains = <0x15>;
resets = <0x16>;
status = "okay";
#address-cells = <0x1>;
#size-cells = <0x0>;
port@0 {
reg = <0x0>;
csi0_1: endpoint {
remote-endpoint = <&imx219_1>;
data-lanes = <0x2>;
csis-hs-settle = <0xd>;
csis-clk-settle = <0x2>;
csis-wclk;
};
};
};
.........
imx219@10 {
compatible = "sony,imx219";
reg = <0x10>;
pinctrl-names = "default";
pinctrl-0 = <0x3a 0x3b>;
clocks = <0x2 0x7b>;
clock-names = "xclk";
assigned-clocks = <0x2 0x7b>;
assigned-clock-parents = <0x2 0x2>;
assigned-clock-rates = <0x16e3600>;
csi_id = <0x0>;
powerdown-gpios = <0x2e 0x7 0x0>;
reset-gpios = <0x2e 0x6 0x1>;
mclk = <0x16e3600>;
mclk_source = <0x0>;
mipi_csi;
status = "okay";
port {
imx219_1: endpoint {
remote-endpoint = <&csi0_1>;
data-lanes = <0x1 0x2>;
clocks-lanes = <0x0>;
link-frequencies = /bits/ 64 <456000000>;
};
};
};
I recompiled and replaced the DTB on the boot partition of my SD card. The image boots successfully, and I can see UU on register 10 on I2C2 with i2cdetect. However, /dev/video0 does not register. Looking at boot logs, I see the following kernel oops error:
[ 5.573945] imx219 2-0010: supply VDIG not found, using dummy regulator
[ 5.583143] bd718xx-clk bd71847-clk.2.auto: No parent clk found
socket.
[ 5.592300] caam 30900000.crypto: job rings = 2, qi = 0
[ 5.593749] bd718xx-clk: probe of bd71847-clk.2.auto failed with error -22
[ 5.608096] imx219 2-0010: supply VDDL not found, using dummy regulator
[ 5.648374] mx8-img-md: Registered sensor subdevice: imx219 2-0010 (1)
[ 5.657399] ------------[ cut here ]------------
[ 5.662177] WARNING: CPU: 0 PID: 215 at drivers/media/mc/mc-entity.c:665 media_create_pad_link+0x190/0x210
[ 5.671838] Modules linked in: clk_bd718x7 imx219(+) caam secvio imx8_media_dev(C) error gpio_ir_recv rc_core
[ 5.681784] CPU: 0 PID: 215 Comm: systemd-udevd Tainted: G C 5.10.9-1.0.0+g32513c25d8c7 #1
[ 5.691349] Hardware name: NXP i.MX8MNano DDR4 EVK board (DT)
[ 5.697102] pstate: 40000005 (nZcv daif -PAN -UAO -TCO BTYPE=--)
[ 5.703110] pc : media_create_pad_link+0x190/0x210
[ 5.707905] lr : subdev_notifier_complete+0x128/0x850 [imx8_media_dev]
[ 5.714432] sp : ffff8000121f3760
[ 5.717745] x29: ffff8000121f3760 x28: ffff00000593c884
[ 5.723058] x27: ffff00000593c6e0 x26: ffff800009136530
[ 5.728370] x25: ffff00000593c080 x24: ffff00000593c0a4
[ 5.733683] x23: ffff00000593c8e0 x22: ffff00000593c0c4
[ 5.738995] x21: 000000000000000c x20: 0000000000000000
[ 5.744307] x19: 0000000000000000 x18: 0000000000000000
[ 5.749619] x17: 0000000000000000 x16: 0000000000000000
[ 5.754930] x15: 00008c25633332d6 x14: 0000000000000140
[ 5.760242] x13: 0000000000000140 x12: 0000000000000000
[ 5.765554] x11: 0000000000000007 x10: 0101010101010101
[ 5.770865] x9 : 0000000000000004 x8 : 0000000000000004
[ 5.776177] x7 : 0000000000000008 x6 : dead000000000100
[ 5.781489] x5 : ffff000005f0d190 x4 : 0000000000000001
[ 5.786801] x3 : 0000000000000000 x2 : 0000000000000000
[ 5.792112] x1 : 000000000000000c x0 : 0000000000000000
[ 5.797424] Call trace:
[ 5.799873] media_create_pad_link+0x190/0x210
[ 5.804316] v4l2_async_notifier_try_complete.part.0+0x58/0x64
[ 5.810148] v4l2_async_register_subdev+0x100/0x1c0
[ 5.815025] v4l2_async_register_subdev_sensor_common+0x6c/0xf0
[ 5.820948] imx219_probe+0x5c8/0x7ac [imx219]
[ 5.825392] i2c_device_probe+0x118/0x300
[ 5.829403] really_probe+0xe4/0x490
[ 5.832977] driver_probe_device+0x58/0xc0
[ 5.837073] device_driver_attach+0xc0/0xd0
[ 5.841254] __driver_attach+0x84/0x124
[ 5.845090] bus_for_each_dev+0x70/0xc0
[ 5.848924] driver_attach+0x24/0x30
[ 5.852498] bus_add_driver+0x104/0x1ec
[ 5.856331] driver_register+0x78/0x130
[ 5.860165] i2c_register_driver+0x50/0xd0
[ 5.864264] imx219_i2c_driver_init+0x24/0x1000 [imx219]
[ 5.869576] do_one_initcall+0x54/0x1bc
[ 5.873411] do_init_module+0x54/0x250
[ 5.877158] load_module+0x1ea8/0x25c0
[ 5.880905] __do_sys_finit_module+0xb8/0x100
[ 5.885259] __arm64_sys_finit_module+0x24/0x30
[ 5.889790] el0_svc_common.constprop.0+0x78/0x1a0
[ 5.894578] do_el0_svc+0x24/0x90
[ 5.897893] el0_svc+0x14/0x20
[ 5.900946] el0_sync_handler+0x1a4/0x1b0
[ 5.904953] el0_sync+0x174/0x180
[ 5.908266] ---[ end trace 66170a6aebb9ae21 ]---
[ 5.913219] Unable to handle kernel NULL pointer dereference at virtual address 0000000000000020
[ 5.922234] Mem abort info:
[ 5.925143] ESR = 0x96000004
[ 5.928275] EC = 0x25: DABT (current EL), IL = 32 bits
[ 5.933651] SET = 0, FnV = 0
[ 5.936802] EA = 0, S1PTW = 0
[ 5.939962] Data abort info:
[ 5.942967] ISV = 0, ISS = 0x00000004
[ 5.946893] CM = 0, WnR = 0
[ 5.949907] user pgtable: 4k pages, 48-bit VAs, pgdp=0000000045c1f000
[ 5.956414] [0000000000000020] pgd=0000000000000000, p4d=0000000000000000
[ 5.963312] Internal error: Oops: 96000004 [#1] PREEMPT SMP
[ 5.968889] Modules linked in: clk_bd718x7 imx219(+) caam secvio imx8_media_dev(C) error gpio_ir_recv rc_core
[ 5.978832] CPU: 0 PID: 215 Comm: systemd-udevd Tainted: G WC 5.10.9-1.0.0+g32513c25d8c7 #1
[ 5.988394] Hardware name: NXP i.MX8MNano DDR4 EVK board (DT)
[ 5.994140] pstate: 40000005 (nZcv daif -PAN -UAO -TCO BTYPE=--)
[ 6.000149] pc : subdev_notifier_complete+0x5b4/0x850 [imx8_media_dev]
[ 6.006676] lr : subdev_notifier_complete+0x128/0x850 [imx8_media_dev]
[ 6.013200] sp : ffff8000121f3760
[ 6.016512] x29: ffff8000121f3760 x28: ffff00000593c884
[ 6.021824] x27: ffff00000593c6e0 x26: ffff800009136530
[ 6.027137] x25: ffff00000593c080 x24: ffff00000593c0a4
[ 6.032448] x23: ffff00000593c8e0 x22: ffff00000593c0c4
[ 6.037760] x21: 000000000000000c x20: 0000000000000000
[ 6.043072] x19: 0000000000000000 x18: 0000000000000000
[ 6.048383] x17: 0000000000000000 x16: 0000000000000000
[ 6.053695] x15: 00008c25633332d6 x14: 0000000000000140
[ 6.059006] x13: 0000000000000140 x12: 0000000000000000
[ 6.064318] x11: 0000000000000007 x10: 0101010101010101
[ 6.069629] x9 : 0000000000000004 x8 : 0000000000000004
[ 6.074941] x7 : 0000000000000008 x6 : dead000000000100
[ 6.080253] x5 : ffff000005f0d190 x4 : 0000000000000001
[ 6.085565] x3 : 0000000000000000 x2 : 0000000000000000
[ 6.090876] x1 : 000000000000000c x0 : 00000000ffffffea
[ 6.096189] Call trace:
[ 6.098636] subdev_notifier_complete+0x5b4/0x850 [imx8_media_dev]
[ 6.104819] v4l2_async_notifier_try_complete.part.0+0x58/0x64
[ 6.110650] v4l2_async_register_subdev+0x100/0x1c0
[ 6.115528] v4l2_async_register_subdev_sensor_common+0x6c/0xf0
[ 6.121450] imx219_probe+0x5c8/0x7ac [imx219]
[ 6.125893] i2c_device_probe+0x118/0x300
[ 6.129904] really_probe+0xe4/0x490
[ 6.133478] driver_probe_device+0x58/0xc0
[ 6.137573] device_driver_attach+0xc0/0xd0
[ 6.141754] __driver_attach+0x84/0x124
[ 6.145589] bus_for_each_dev+0x70/0xc0
[ 6.149423] driver_attach+0x24/0x30
[ 6.152998] bus_add_driver+0x104/0x1ec
[ 6.156831] driver_register+0x78/0x130
[ 6.160665] i2c_register_driver+0x50/0xd0
[ 6.164762] imx219_i2c_driver_init+0x24/0x1000 [imx219]
[ 6.170074] do_one_initcall+0x54/0x1bc
[ 6.173909] do_init_module+0x54/0x250
[ 6.177657] load_module+0x1ea8/0x25c0
[ 6.181404] __do_sys_finit_module+0xb8/0x100
[ 6.185758] __arm64_sys_finit_module+0x24/0x30
[ 6.190289] el0_svc_common.constprop.0+0x78/0x1a0
[ 6.195080] do_el0_svc+0x24/0x90
[ 6.198394] el0_svc+0x14/0x20
[ 6.201447] el0_sync_handler+0x1a4/0x1b0
[ 6.205454] el0_sync+0x174/0x180
[ 6.208772] Code: d0000000 9114c000 f90047e0 17ffffe5 (f9401262)
[ 6.214866] ---[ end trace 66170a6aebb9ae22 ]---
I don't have the skills to debug this, so I was hoping I could get some help!
@igorpadykov