Driver for AR0330CS camera sensor

Hi

I’m attempting to port the AR0330 V4L2 driver written for the Nvidia Jetson TK1 based Ardbeg platform (L4T 21.7) so it can be used for the Jetson TX2.

The final goal is to get this driver working on L4T 32.2, but right now I’m focusing my efforts on L4T 28.2. I back ported some changes that have been applied to other sensor drivers on the AR0330 driver and removed some Jetson TK1 specific parts. My driver can be found here:

https://github.com/productize/linux-tegra/blob/nobi-t4l-28.2/drivers/media/i2c/soc_camera/ar0330.c

and my device tree can be found here:

https://github.com/productize/tegra-devtree/blob/nobi-l4t-28.2/kernel-dts/tegra186-quill-p3310-1000-a00-00-nobi-camera-module.dts

The driver compiles and seems to load fine, but I get the following kernel error:

tegra-vi4 15700000.vi: all channel register failed

Coming from drivers/media/platform/tegra/camera/vi/channel.c:1799

What could explain this error? I followed the example device tree files to configure vi4 and NVCSI, and it looks like the problem is located there.

I would suggest to migrate to r32.2 and have reference to below doc to implement your driver.

[url]Welcome — Jetson Linux<br/>Developer Guide 34.1 documentation

Hello Shane

I originally followed this guide on L4T 32.2.1, but I wanted to use/port the existing AR0330 driver instead of starting a new driver from scratch. My attempts to do this can be found on the camera-ar0330 branch.

I quickly found out a lot of changes happend to the V4L2 system, causing the driver not to compile in the newer Linux 4.9 kernel used by L4T 32.2. I traced down these changes in the kernel history, and applied 2 patches: 717fd5b and ebcff5f. See abf8bd2 and e72ed6f of [url]https://github.com/productize/linux-tegra/commits/nobi-t4l-28.2[/url]

I was able to find these changes in the kernel history of the L4T 28.2 (kernel 4.4) kernel, but not in the kernel of L4T 3.2.1 (kernel 4.9). This was the main reason I started working on top of L4T 28.2, but I now realise this was because the entire history of the 4.9 kernel wasn’t fetched on my system. An other reason was that econ systems, the maker of an AR0330 based camera system supported by on the Jetson TX2 platform, only supports L4T 28.2, so I figured it was the safer option.

I will try to rebase my patches based on 28.2 to L4T 32.2 and see if this makes a difference.

However, based on the error message I assume the problem lies with the KDT configuration of the NVCSI system, not the driver. The driver loads successfully and I2C communication with the sensor seems to work.

It looks like the AR0330 driver I am using is dependent on nvc_image.h. This was removed somewhere between Linux 4.4 and Linux 4.9 and I have not figured out when or why.

The driver for the IMX274 on which I based myself was also removed, so I don’t know what patches are required to have the driver working without nvc_image.h.

You should reference to the driver at …/kernel/nvidia/drivers/media/i2c/
I believe the new imx274 should be there.