analogdevicesinc / aditof_sdk

Analog Devices 3D ToF software suite
https://analogdevicesinc.github.io/aditof_sdk/
BSD 3-Clause "New" or "Revised" License
72 stars 49 forks source link

What options are used when building Analog Devices Kernel for RPI? #758

Open abhimanyuarora opened 2 years ago

abhimanyuarora commented 2 years ago

I've been trying to compile the Analog Devices Kernel so that I can use it with my own image, by following this: https://github.com/analogdevicesinc/aditof_sdk/blob/master/doc/raspberrypi3/raspberrypi_firmware_build.md. I was initially compiling it from the rpi-5.10.y branch, but after booting dmesg showed I ran into this error: failed to apply overlay '0_rpi-addi9036' (kernel).

So I scrapped it and used rpi-4.19.y as written in the guide. I enabled VIDEO_ADDI9036 and EEPROM_AT24 in 'make menuconfig' as well. This worked, and the driver was able to identify the camera. The problem I faced though was that the device path for the EEPROM was slightly different. While the SDK expected /sys/bus/i2c/devices/10-0056/eeprom, mine showed /sys/bus/i2c/devices/0-0056/eeprom. The temperature sensor was also not detected.

I have also tested the prebuilt image, which is has a kernel version 5.10.60. This worked perfectly; I saw the correct device path and the temperature sensor also worked. I'm curious as to what other changes I need to make when building my kernel to get it to work properly, and how the 5.10.60 kernel was able to work in the image but mine couldn't.

AkshayKurhade commented 2 years ago

It has to do with changes made by raspberry pi, The change in 5.x kernel is the addition of an I2C multiplexer - a means of sharing I2C0 between mutiple (2 in this case) sets of GPIOs under control of the kernel. The two I2C buses appear as separate /dev/i2c-* entries, but only one can be used at any time. The "i2c_vc" node corresponds to the bus on GPIOs 0 & 1, which is made available through /dev/i2c-0, while "i2c_csi_dsi" is on GPIOs 44 & 45 and /dev/i2c-10. If you look at the overlay, its configured for i2c_csi_dsi for 5.x kernels Which results in the eeprom showing up on i2c-10 on 5.x kernels