Error compiling ov5693 driver as module on L4T 24.2

Hi everyone!

I am trying to compile the ov5693 driver as module on L4T 24.2, but I got an error when I run “make modules” command. If I compile this driver as built-in, it compiles successfully with no errors. So, I don´t know the cause of this error. Does anyone has any clue about what this happen and how to resolve it?

Error Log:

MODPOST 23 modules
ERROR: “camera_common_parse_ports” [drivers/media/i2c/ov5693.ko] undefined!
ERROR: “camera_common_parse_clocks” [drivers/media/i2c/ov5693.ko] undefined!
make[1]: *** [__modpost] Error 1
make: *** [modules] Error 2

This is the driver used with the camera that came in the standard Jetson TX1 Kit, I was able to used the camera and verify that it is recognized and configured correctly by the system, so the driver works fine when it is configured as built-in.

Thanks in advance!

I have not compiled this as a module, but if a dependency feature is missing, I’m wondering what the exact method is that you used for changing this feature to a module? For example, “make menuconfig” would understand dependencies, but directly editing “.config” would not. Should a dependency be missing after using a method which takes into account dependencies, then you probably found a bug.

Hi linuxdev,

I used “make menuconfig” to set this driver as a module in kernel configuration. The ov5693.ko file do not get built when I set this configuration.

Thanks

Hi everyone!

I was able to successfully compile the ov5693 driver as a module after doing the following changes to the drivers/media/platform/tegra/camera/camera_common.c file and recompile the Kernel.

1) Add this line after camera_common_parse_clocks function definition (line 183):
EXPORT_SYMBOL(camera_common_parse_clocks);
2) Add this line after camera_common_parse_ports function definition (line 224):
EXPORT_SYMBOL(camera_common_parse_ports);

The error was caused because camera_common_parse_ports and camera_common_parse_clocks symbols aren’t available to modules. So it is necessary to export those symbols to be available for modules.

NEW ERROR:

Although ov5693 driver compilation as module was achieved, another error appears when the module is loaded. I don’t understand why this error appears when driver is compiled as a module, if when it is compiled as built-in no error appears and the driver works perfectly. Also, the driver is mounted automatically during boot process, even though the driver is compiled as a module.

Also, I can’t unmount the module with rmmod.

Error log:

ubuntu@tegra-ubuntu:~$ dmesg | grep -i ov5693
[    3.823797] vi vi: parsing node /host1x/i2c@546c0000/ov5693_c@36
[    3.823803] vi vi: handling endpoint /host1x/i2c@546c0000/ov5693_c@36/ports/port@0/endpoint
[   19.401369] [OV5693]: probing v4l2 sensor.
[   19.401733] ov5693 6-0036: Failed to allocate eeprom reg map: -22
[   20.211995] vi vi: subdev ov5693 6-0036 bound
ubuntu@tegra-ubuntu:~$ lsmod
Module                  Size  Used by
bnep                   14552  2
bcmdhd               7465122  0
cfg80211              449659  1 bcmdhd
ov5693                 25496  1
bluedroid_pm           11204  0
ubuntu@tegra-ubuntu:~$ sudo rmmod ov5693 
[sudo] password for ubuntu: 
rmmod: ERROR: Module ov5693 is in use
ubuntu@tegra-ubuntu:~$ sudo rmmod --force ov5693 
Segmentation fault
ubuntu@tegra-ubuntu:~$ lsmod
Module                  Size  Used by
bnep                   14552  2
bcmdhd               7465122  0
cfg80211              449659  1 bcmdhd
ov5693                 25496  0
bluedroid_pm           11204  0
ubuntu@tegra-ubuntu:~$ sudo rmmod --force ov5693 
rmmod: ERROR: ../libkmod/libkmod-module.c:793 kmod_module_remove_module() could not remove 'ov5693': Device or resource busy
rmmod: ERROR: could not remove module ov5693: Device or resource busy
ubuntu@tegra-ubuntu:~$ dmesg | grep -i ov5693
[    3.823797] vi vi: parsing node /host1x/i2c@546c0000/ov5693_c@36
[    3.823803] vi vi: handling endpoint /host1x/i2c@546c0000/ov5693_c@36/ports/port@0/endpoint
[   19.401369] [OV5693]: probing v4l2 sensor.
[   19.401733] ov5693 6-0036: Failed to allocate eeprom reg map: -22
[   20.211995] vi vi: subdev ov5693 6-0036 bound
[  346.338962] Modules linked in: bnep bcmdhd cfg80211 ov5693(-) bluedroid_pm
[  347.808439] [<ffffffbffc008f48>] $x+0x18/0x20 [ov5693]

The loadable module not been verified. Did you have any reason must build it as loadable module?

Ok, thanks for your answer!

I am developing a driver for ov5647 camera, so I took as a base the ov5693 driver. Because I am using an expansion custom board for camera ports, I needed the driver as module, so I could first run some commands to enable the cameras visibility on the I2C bus before loading the ov5647 driver. But, that was my first approach, so I changed the way I was setting up the camera expansion board, so now I can use the driver as built-in.

Now, my ov5647 driver works fine as built in. I am just debugging the video capture.