Hello,
I am trying to use the MIPI CSI interface on a Xavier AGX in a ‘raw’ mode, ignoring I2C (as our device is configured externally) and also not using the ISP (capturing directly from VI from /dev/video0), similar to what is discussed in these forum threads:
https://devtalk.nvidia.com/default/topic/1049476/jetson-tx1/tx1-csi-without-i2c/
https://devtalk.nvidia.com/default/topic/1025863/jetson-tx2/how-to-grab-pre-configured-csi-video-stream-without-i2c-/
I’m using JetPack 4.3 release, with L4T 32.3.1.
By putting together information from other forum threads and the sensor driver programming guide, I am working through the following steps, in an attempt to modify the imx185 v4l2 driver to talk to my device:
1 - Disable plugin manager, swap to main platform devicetree file, modify imx185 with mode parameters specific to my device
2 - Modify existing driver (either imx185 or ovf5693) to basically pass on initialization / probe steps
3 - get to the point of seeing a /dev/video0 device
4 - Probe the device with v4l2-ctl
Notes on this process so far:
1 - Disable plugin manager, swap to main platform devicetree file, modify imx185 with mode parameters specific to my device:
https://docs.nvidia.com/jetson/l4t/#page/Tegra%2520Linux%2520Driver%2520Package%2520Development%2520Guide%2Fcamera_sensor_prog.html%23wwpID0E01F0HA
The instructions in the sensor software development guide do not seem to match with the current L4T sources:
From the camera programmer’s guide:
1.Locate and edit the .dtsi file:
/hardware/nvidia/platform/t19x/common/kernel-dts/t19x-common-modules/tegra194-cvb-p2822-0000-a00.dtsi
2.Remove the following line from the file:
#include “tegra194-camera-plugin-manager.dtsi”
This file does not include tegra194-camera-plugin-manager.dtsi, but it does appear to instantiate the plugin-manager. I did not edit this file.
By grepping around the source tree, I commented out the #include “t19x-common-modules/tegra194-camera-plugin-manager.dtsi” in the following 4 files it shows up in (probably not all are needed but just wanted to be safe):
/hardware/nvidia/platform/t19x/galen/kernel-dts/tegra194-p2888-as-p3668-p2822-0000.dts /hardware/nvidia/platform/t19x/galen/kernel-dts/tegra194-p2888-as-0006-p2822-0000.dts /hardware/nvidia/platform/t19x/galen/kernel-dts/tegra194-p2888-0006-p2822-0000.dts /hardware/nvidia/platform/t19x/galen/kernel-dts/tegra194-p2888-0001-p2822-0000.dtsFrom the camera programmer’s guide:
3.Locate and edit the .dtsi file:
/hardware/nvidia/platform/t19x/galen/kernel-dts/common/t194-p2822-0000-a00.dtsi
4.Replace the following line:
#include “tegra194-p2822-camera-modules.dtsi”
With an #include statement specifying the DTSI file for your new device.
I just modified tegra194-p2822-camera-modules.dtsi directly, by changing the status fields in camera modules dtsi, to set status from “disabled” to “okay” for the imx185 and its parent, tca9546_70:
Next step will be to modify tegra194-p2822-0000-camera-imx185-a00.dtsi and change the parameters to match my device. I haven’t actually changed this file yet, as I wanted to get the /dev/video0 device to show up first.
When I boot with this modified devicetree, I can see the status fields are set to “okay”:
cat /proc/device-tree/i2c@3180000/tca9546@70/i2c@0/imx185_a@1a/status
okay
cat /proc/device-tree/i2c@3180000/tca9546@70/status
okay
2 - Modify existing driver (either imx185 or ovf5693) to basically pass on initialization / probe steps
Commented out regmap_read() and regmap_write() calls in imx185.c, added additional dev_info() prints inside imx185_probe().
3 - get to the point of seeing a /dev/video0 device
When I insmod my custom imx185.ko, I can see the messages from imx185_probe() show up in dmesg, and it appears that the probe is completing successfully:
[58857.939383] imx185 30-001a: probing v4l2 sensor
[58857.939780] imx185 30-001a: tegracam sensor driver:imx185_v2.0.6
[58857.940337] imx185 30-001a: passed imx185_board_setup successfully
[58857.940483] imx185 30-001a: Detected IMX185 sensor
However, neither /dev/video* nor /dev/v4l* devices show up in the system.
I also tried changing other parameters in /hardware/nvidia/platform/t19x/galen/kernel-dts/common/tegra194-p2822-camera-modules.dtsi from disabled to okay, as I can see the VI, CSI, and camera module0 are used in the imx185 DT:
- changed host1x port0 and port1 status=“okay”
- changed cam_module0 status=“okay”
- changed csi_base top-level status=“okay”; this causes the system to fail to boot
Some questions:
-
For /dev/video0 to show up, are actual MIPI signals required to be detected, or will it show up without any initial signals?
Our device will only output MIPI data when its FSYNC is pulsed, which is something I am doing with a userspace application. I can see signals coming out on a scope, but have not tried to ensure all the parameters match what is in the DT yet, as I was thinking I should be able to get /dev/video0 to show up first. -
Any suggestions on how to debug the initialization? I see references to v4l2_i2c_subdev_init() in the v4l documentation and other forum posts, but in imx185.c:imx185_probe(), the functions of interest appear to perhaps be: tegracam_device_register() and tegracam_v4l2subdev_register() - maybe this has changed with the most recent release of L4T. In my debugging so far these functions seem to return success values.
Another possible problem would be a mismatch between the DT’s devname/compatible, and driver’s of_device_id /compatible; but as I kept these value the same and they appear to match, I don’t think this is the issue:
323 tcp: tegra-camera-platform {
324 compatible = “nvidia, tegra-camera-platform”;
325 modules {
326 cam_module0: module0 {
327 status = “okay”;
328 cam_module0_drivernode0: drivernode0 {
329 status = “okay”;
330 };
331 cam_module0_drivernode1: drivernode1 {
332 status = “disabled”;
333 pcl_id = “v4l2_lens”;
334 };
335 };
imx185’s parameters are kept as-is:
63 static const struct of_device_id imx185_of_match[] = {
64 { .compatible = "nvidia,imx185",},
65 { },
66 };
…
848 MODULE_DEVICE_TABLE(i2c, imx185_id);
849
850 static struct i2c_driver imx185_i2c_driver = {
851 .driver = {
852 .name = “imx185”,
853 .owner = THIS_MODULE,
854 .of_match_table = of_match_ptr(imx185_of_match),
855 },
856 .probe = imx185_probe,
857 .remove = imx185_remove,
858 .id_table = imx185_id,
859 };
Any suggestions would be much appreciated.
Thank you,
Tom