Driver adaptation for Orin - ko-file loaded but no debug output in the kernel log file

Hi there!

My problem is that none of the debug outputs seems to work for me:
printk
dev_err
dev_info

What am I trying to do:
Writing a driver to listen in on an existing CSI2 data stream.

What I can do:
the code compiles, links and creates a ko-file. I’ve modified the device tree, so that I can load it.
sudo insmod is working
sudo probemod is working
sudo lsmod is showing the module loaded
sudo rmmod is unloading it.
if I delete the module insmod is complaining, that the file is not found.

However it seems that all writing to the kernel log is not working / disabled.
Is there a central switch in the build scripts to enable/disable it?

I’m following NVIDIA Jetson Orin - Compiling Code (ridgerun.com)
to build the module.

Does it need a specific entry function?
nv_ovx1f.c (23.9 KB)

Try add pr_info() in probe() function to check if the driver was been loaded and register to system.

Thanks

It is not printing anything in the kernel log.
However lsmod is displaying it. I also added a probe_new function, but it didn’t change a thing.

Here’s nv_imx219.c probe message.

nvidia@tegra-ubuntu:~$ sudo modprobe nv_imx219
nvidia@tegra-ubuntu:~$ sudo dmesg
[609234.733367] imx219 9-0010: tegracam sensor driver:imx219_v2.0.6
[609234.749749] tegra-camrtc-capture-vi tegra-capture-vi: subdev imx219 9-0010 bound
[609234.755942] imx219 10-0010: tegracam sensor driver:imx219_v2.0.6
[609234.766706] imx219 10-0010: imx219_board_setup: error during i2c read probe (-121)
[609234.772191] imx219 10-0010: board setup failed
[609234.772419] imx219: probe of 10-0010 failed with error -121

not getting those either.

When I plug a USB drive, I get tons of messages. But for imx219 or my driver I get nothing.

Occasionally there is some entry:
“[timestamp] start_addr=(0x20000), end_address=(0x40000), buffer_size=(0x20000),smp_number_max=(16384)”
That seems to be related to the driver, but it is not always there.

Have you verify imx219 by enable it by device tree?

You mean in the tegra_defconfig? Checking…

It is set to “m”
CONFIG_NV_VIDEO_IMX219=m

No, I mean device tree. Like below to enable the imx219.

https://docs.nvidia.com/jetson/archives/r35.1/DeveloperGuide/text/SD/CameraDevelopment/SensorSoftwareDriverProgramming.html#using-the-main-platform-device-tree-file

Hi Shane!
Wouldn’t I need some dtsi include files for the imx219? Can’t find them in the Orin package.

In the tegra194 folders there are some imx219 files, but I’m not sure if I can use those for tegra234.

Orin can’t connect imx219, I post IMX219 to tell r35.1 on XNX without problem to print the message. You can use IMX219 as template to modify your driver.

But I don’t get any messages there either.

OK, you can reference to IMX274 on Orin.
You can modify the device tree to force loaded IMX274 for testing.

nvidia@tegra-ubuntu:~$ sudo dmesg | grep -i imx
[sudo] password for nvidia:
[   13.994205] imx274 30-001a: probing v4l2 sensor.
[   13.994992] imx274 30-001a: tegracam sensor driver:imx274_v2.0.6
[   14.015013] tegra-camrtc-capture-vi tegra-capture-vi: subdev imx274 30-001a bound
[   14.016606] imx274 30-001a: Detected IMX274 sensor
[   14.016774] imx274 31-001a: probing v4l2 sensor.
[   14.017210] imx274 31-001a: tegracam sensor driver:imx274_v2.0.6
[   14.034895] tegra-camrtc-capture-vi tegra-capture-vi: subdev imx274 31-001a bound
[   14.035356] imx274 31-001a: Detected IMX274 sensor

Here is what I get:
@tegra-ubuntu:/usr/lib/modules/5.10.104-tegra/kernel/drivers/media/i2c$ sudo dmesg -C
@tegra-ubuntu:/usr/lib/modules/5.10.104-tegra/kernel/drivers/media/i2c$ sudo insmod nv_imx274.ko
@tegra-ubuntu:/usr/lib/modules/5.10.104-tegra/kernel/drivers/media/i2c$ sudo dmesg | grep -i imx
@tegra-ubuntu:/usr/lib/modules/5.10.104-tegra/kernel/drivers/media/i2c$ sudo dmesg
[103430.807562] start_addr=(0x20000), end_addr=(0x40000), buffer_size=(0x20000), smp_number_max=(16384)
@tegra-ubuntu:/usr/lib/modules/5.10.104-tegra/kernel/drivers/media/i2c$ sudo rmmod nv_imx274

What might be relevant is that after a reboot, when I load my module for the first time, I get a message that the kernel is polluted or tainted. At first I thought I fixed this with “sudo depmod -a” because it didn’t show up again. But it seems to appear only once per reboot. I’ve found some articles that this can influence printk. I’m not yet sure how to fix it though.
Edit: the depmod -a is required for modprobe to find the module.