Hi all,
I’m actually working on a driver that needs 2 video devices on a single device driver, the camera provides 2 videos with virtual channel on the same CSI port.
From previous experiences working on Jetson boards I have seen that one device driver enables 1 video device and the Device-tree follows the next structure:
/ {
i2c@xxxx{
device@xx {
...
ports {
#address-cells = <1>;
#size-cells = <0>;
port@0 {
reg = <0>;
dev_out: endpoint {
port-index = <0>;
bus-width = <2>;
vc-id = <1>;
remote-endpoint = <&csi_in0>;
};
};
};
};
};
host1x {
csi_base: nvcsi@15a00000 {
#address-cells = <0x1>;
#size-cells = <0x0>;
num-channels = <6>;
channel@0 {
reg = <0x0>;
status = "okay";
ports {
#address-cells = <0x1>;
#size-cells = <0x0>;
port@0 {
reg = <0>;
status = "okay";
endpoint@0 {
status = "okay";
port-index = <0>;
bus-width = <2>;
remote-endpoint = <&dev_out>;
};
};
port@1 {
reg = <1>;
status = "okay";
endpoint@1 {
status = "okay";
remote-endpoint = <&vi_in0>;
};
};
};
};
};
vi_base: vi@15c10000 {
num-channels = <6>;
ports {
#address-cells = <0x1>;
#size-cells = <0x0>;
port@0 {
reg = <0>;
status = "okay";
vi_in0: endpoint {
status = "okay";
port-index = <0>;
bus-width = <2>;
vc-id = <1>;
remote-endpoint = <&csi_out0>;
};
};
};
};
};
};
So I can seen in the system the following connection using media-ctl:
device-driver <-> nvcsi <-> vi (video0)
At the end of a driver’s initial configuration I have seen the call v4l2_async_register_subdev(&priv->subdev);
This enables the video node for the device driver.
So, my questions are:
-
Is it possible to use v4l2_async_register_subdev with different subdevices to enable multiple video nodes?
-
If so, could you please indicate to a sample code in kernel’s sources?
-
Since the device driver commonly enables only one video node per driver, what other changes are needed in the device tree to specify the second video node connection to nvcsi and vi nodes?
-
Is there a limitation to enable 2 video devices per driver? as example, the kernel only expects one v4l2_async_register_subdev per driver. I have seen that the file nvidia/drivers/media/platform/tegra/camera/vi/graph.c in the kernel parses the nvcsi and vi nodes and also links t subdevice in the device driver to create the video node but it isn’t clear to me if this only works with one subdevice (in one device driver) per camera.
Any clarification here will be appreciated.
Just in case, I’m working with Jetpack 4.5.1 on Xavier AGX.
Thanks.