Camera driver does not work for the camera on port6 and port7

Hello,
I’m developping the isx021 camera driver for L4T R35.1 on Orin Devkit with LI-JXAV-MIPI-ADPT-4CAM by Leoprad imaging. The driver works fine for port 0 to port5(one fo the J1 to J3 connector is used) with virtual channel, but does not for port 6 and 7.

I’ve looked for the similar case in this forum, then I have found some threads that have only pointer to some documents and that don’t have helpful example working with more than 6 cameras in those answer.

Can anyone give me an example of Orin DevKit actually working with more than 6 cameras? please let me know what source code and DTS modifications are needed at that time.

Below are the dmesg logs and the DTS files for the overlay DTB.
Total two cameras are connected, one camera is connected to each of the GMSL port 6 and 7. (max9296 is connected J4 connector on LI-JXAV-MIPI-ADPT-4CAM board)

dmesg_port6_7.log (93.4 KB)

tier4-isx021-gmsl-device-tree-overlay-orin-r351.dts (47.3 KB)

tracelog_port6_7.txt (6.7 KB)

1 Like

Sorry for the late response, our team will do the investigation and provide suggestions soon. Thanks

1 Like

Thanks,

At first, I cheked the base DTB file /boot/dtb/kernel_tegra234-p3701-0000-p3737-0000.dtb
I found there is no description for the node or port 6 and 7 under tegra-capture-vi and nvcsi@15a00000. I added the descriptions for Port 6 and 7 in overlay DTBO, and overlay it with dtoverlay. The descriptions were in front of those for port0 to port 5 in the DTB generated by fdtoverlay command as below This caussed the issue of the gap between csi port number and VI channel.

port@6 {
 reg=<0x06>
 status=<okay>
 endpoint {
  port-index=<0x05>
  vc-id=<0x00>
  bus-width=<0x04>
  status=<okay>
 }
}

port@7 {
 reg=<0x07>
 status=<okay>
 endpoint {
  port-index=<0x05>
  vc-id=<0x00>
  bus-width=<0x04>
  status=<okay>
 }
}

port@0 {
.
.
}
.
.
.
port@5 {
.
.
}

I converted the base DTB to the DTS, then I put the node descriptions for port 6 and 7 under tegra-capture-vi and nvcsi@15a000000 nodes in the base DTB to solve this issue as below.

Eg.

tegra-capture-vi {
 .
 .
port@0 {

}
 .
 .
port@5 {

}

port@6 {
 reg=<0x06>
 status=<okay>
 endpoint {
  port-index=<0x05>
  vc-id=<0x00>
  bus-width=<0x04>
  status=<okay>
 }
}

port@7 {
 reg=<0x07>
 status=<okay>
 endpoint {
  port-index=<0x05>
  vc-id=<0x01>
  bus-width=<0x04>
  status=<okay>
 }
}

The issue was resolved. But I encountered next issue which the stream id for csi port 5 was 4.
Thes stream id = 4 is assigned to csi port 3 and 4, so the stream id for csi port 5 should be 5.
Sreams id is got from the function csi5_port_to_stream(u32 csi_port) as follows.

#define NVCSI_PORT_E		MK_U32(0x4)   // in nvidia\include\soc\tegra\camrtc-capture.h 

static inline u32 csi5_port_to_stream(u32 csi_port)  // in nvidia/drivers/media/platform/tegra/camera/nvcsi/csi5_fops.c.
{
     return (csi_port < (NVCSI_PORT_E)) ?
	          csi_port : (((csi_port - NVCSI_PORT_E) >> 1U) + NVCSI_PORT_E);
}

I tried two approach,

  1. Changing NVCSI_PORT_E to NVCSI_PORT_F(=5).
  2. Changing the port-index for port 6 and 7 from 5 to 6
    in this case, I also modified the base DTB as follows,

/* nvidia/drivers/media/platform/tegra/camera/fusa-capture/capture-vi.c */

#define MAX_NVCSI_STREAM_IDS  U32_C(0x8)  
/*  base DTB */
	tegra-capture-vi {
		compatible = "nvidia,tegra-camrtc-capture-vi";
		nvidia,vi-devices = <0x248 0x24a>;
		nvidia,vi-mapping-size = **<0x07>**;
		nvidia,vi-mapping = <0x00 0x00 0x01 0x00 0x02 0x01 0x03 0x01 0x04 0x00 0x05 0x01 0x06 0x01>;
		nvidia,vi-mapping-names = "csi-stream-id\0vi-unit-id";
		nvidia,vi-max-channels = <0x48>;
		num-channels = <0x08>;
		phandle = <0x44d>;

Certainly the stream id was changed from 4 to 5, but I still have been getting the following issue.

[   64.301186] t194-nvcsi 13e40000.host1x:nvcsi@15a00000: csi5_stop_streaming: csi_pt=5, st_id=4, vc_id=0, pg_mode=0x0
[   64.301188] (NULL device *): vi_capture_control_message: NULL VI channel received
[   64.308919] t194-nvcsi 13e40000.host1x:nvcsi@15a00000: csi5_stream_close: Error in closing stream_id=4, csi_port=5

I am stuck with this issue.

We discovered that the base DTB file for L4T R35.2.1 (included in Jetpack 5.1) may fix the issue. It looks “unfinished”…

Regards,

1 Like

@k.iwasaki
Could you provide the patches to us? Our SW team will check them.

1 Like

Hi,

I have already migrated my development environment to that of L4T R35.2.1, I found the base DTB file /boot/dtb/kernel_tegra234-p3701-0000-p3737-0000.dtb in Jetpack 5.1 (L4T R35.2.1) which ccontained the node descriptions for port 6 & 7. Though the result was the same as R35.1, most of errors I got on R35.1 disappears on R35.2.1. So I think you should use the base DTB file instead of that of mine. So I think you should migrate your environment to R35.2.1.

And I modfied only one function csi5_port_to_stream(u32 csi_port) in nvidia/drivers/media/platform/tegra/camera/nvcsi/csi5_fops.c as bellow

This modification is needed only when you use “port-index = 5” for port 6 and 7.

If you use “port-index = 6” for port 6 and 7,

  1. You don’t need above modification.
  2. You will need to modify the other source codes regarding CSI and VI, I’m not sure how much codes would need to be modified.
static inline u32 csi5_port_to_stream(u32 csi_port) 
{
-	return (csi_port < (NVCSI_PORT_E)) ?
-		csi_port : (((csi_port - NVCSI_PORT_E) >> 1U) + NVCSI_PORT_E);

+	return (csi_port < (NVCSI_PORT_F)) ?
+		csi_port : (((csi_port - NVCSI_PORT_F) >> 1U) + NVCSI_PORT_F);
}

Thanks,

1 Like

I have not resolved this issue yet.

Is there any progress regarding this issue ?

ROScube(RQX-58G) with L4T R32.5.x works fine for 8 cameras. it works well upto 6 cameras on the ROScube with L4T R35.1 , but does not with 7 or 8 cameras.

ROScube-X(RQX-58G) works fine with 8 cameras on L4T R32.5.X. And it works well upto 6 cameras on L4T R35.1. But it does not for 7 and 8 cameras. I think there are some differences between Vi or NVCSI codes in R32.5.x and those in R35.1. and I think the difference are contributing to the cause of this issue.

Hi,

Any update there? I met the same issue.
I am using L4T R35.1. I have configured the port-index of stream to <5> for port6 and port7. Also the vc-id 0 and 1 to port6 and port7.

The 8 cameras with x2 lanes all work well.
But if I change to x4 lanes, only port6 and port7 not work!

How can I solve this issue?

Hi,
It sounds good.
Though I have never tried x2 lanes on Orin DevKit with any L4T revision, I tried x4 lane on R35.2.1 then the cameras work on port 6 and 7.

The parameters to be modified in DTB iare below,
In camera sensor and NVCSI nodes for port 6 & 7, port-index = 6
In tegra-capture-vi node for port 6 & 7, port-index = 5
For port 6, vc-id = 0
For port 7, vc-id =1

I think the solution is that you move to R35.2.1 environment.