Hello Jerry,
I got past all the errors after I fixed device tree issues, but now I need clarification on how to proceed regarding video capture on CSI lanes. I am posting my most current device tree implementation, after which it creates /dev/media0 and 3 video devices 0,1 & 2. I haven’t even loaded the driver. Also there is no support for v4l2 in the driver, wherein the vendor (Lontium) has provided bare minimum functionalities (mainly support for hotplug detection, reset and interrupts, and i2c comm), Do I need to follow the sensor driver development guide to get a fully functional capture device and add this to the driver?
/ {
host1x {
/delete-node/ vi;
vi@15700000 {
num-channels = <4>;
status=“okay”;
ports {
status=“okay”;
#address-cells = <1>;
#size-cells = <0>;
vi_port0: port@0 {
status=“okay”;
reg = <0>;
hdmi2csi_vi_in0: endpoint {
status=“okay”;
//vc-id=<0>;
port-index = <0>;
bus-width = <2>;
remote-endpoint = <&hdmi2csi_csi_out0>;
};
};
vi_port1: port@1 {
status=“okay”;
reg = <1>;
hdmi2csi_vi_in1: endpoint {
status=“okay”;
//vc-id=<1>;
port-index = <2>;
bus-width = <2>;
remote-endpoint = <&hdmi2csi_csi_out1>;
};
};
vi_port2: port@2 {
status=“okay”;
reg = <2>;
hdmi2csi_vi_in2: endpoint {
status=“okay”;
//vc-id=<2>;
port-index = <4>;
bus-width = <1>;
remote-endpoint = <&hdmi2csi_csi_out2>;
};
};
vi_port3: port@3 {
status=“okay”;
reg = <3>;
hdmi2csi_vi_in3: endpoint {
status=“okay”;
//vc-id=<3>;
port-index = <5>;
bus-width = <1>;
remote-endpoint = <&hdmi2csi_csi_out3>;
};
};
};
};
nvcsi@150c0000 {
status="okay";
num-channels = <4>;
#address-cells = <1>;
#size-cells = <0>;
csi_chan0: channel@0 {
status="okay";
#address-cells = <1>;
#size-cells = <0>;
reg = <0>;
ports {
#address-cells = <1>;
#size-cells = <0>;
csi_chan0_port0: port@0 {
status="okay";
reg = <0>;
hdmi2csi_csi_in0: endpoint@0 {
port-index = <0>;
bus-width = <2>;
remote-endpoint = <&hdmi2csi_lt6911_out0>;
};
};
csi_chan0_port1: port@1 {
status="okay";
reg = <1>;
hdmi2csi_csi_out0: endpoint@1 {
status = "ok";
remote-endpoint = <&hdmi2csi_vi_in0>;
};
};
};
};
csi_chan1: channel@1 {
status="okay";
#address-cells = <1>;
#size-cells = <0>;
reg = <1>;
ports {
#address-cells = <1>;
#size-cells = <0>;
csi_chan1_port0: port@2 {
status="okay";
reg = <0>;
hdmi2csi_csi_in1: endpoint@2 {
port-index = <2>;
bus-width = <2>;
remote-endpoint = <&hdmi2csi_csi_out1>;
};
};
csi_chan1_port1: port@3 {
status="okay";
reg = <1>;
hdmi2csi_csi_out1: endpoint@3 {
remote-endpoint = <&hdmi2csi_vi_in1>;
};
};
};
};
csi_chan2: channel@2 {
#address-cells = <1>;
#size-cells = <0>;
reg = <2>;
status="okay";
ports {
#address-cells = <1>;
#size-cells = <0>;
csi_chan2_port0: port@4 {
status="okay";
reg = <0>;
hdmi2csi_csi_in2: endpoint@4 {
status="okay";
port-index = <4>;
bus-width = <1>;
remote-endpoint = <&hdmi2csi_csi_out2>;
};
};
csi_chan2_port1: port@5 {
status="okay";
reg = <1>;
hdmi2csi_csi_out2: endpoint@5 {
status="okay";
remote-endpoint = <&hdmi2csi_vi_in2>;
};
};
};
};
csi_chan3: channel@3 {
status="okay";
#address-cells = <1>;
#size-cells = <0>;
reg = <3>;
ports {
#address-cells = <1>;
#size-cells = <0>;
csi_chan3_port0: port@6 {
status="okay";
reg = <0>;
hdmi2csi_csi_in3: endpoint@6 {
status="okay";
port-index = <5>;
bus-width = <1>;
remote-endpoint = <&hdmi2csi_csi_out3>;
};
};
csi_chan3_port1: port@7 {
status="okay";
reg = <1>;
hdmi2csi_csi_out3: endpoint@7 {
status="okay";
remote-endpoint = <&hdmi2csi_vi_in3>;
};
};
};
};
};
};
i2c@3180000 {
status = "disabled";
};
i2c@3160000{
status = "okay";
};
i2c@c240000{
status = "okay";
//clock-frequency = <100000>;
lt6911uxe@2b {
#address-cells = <0x1>;
#size-cells = <0x4>;
compatible = "nvidia,lt6911uxe";
reg = <0x2b>;
status = "okay";
devnode = "video0";
power-gpios = <&tegra_main_gpio TEGRA_MAIN_GPIO(C, 2) GPIO_ACTIVE_HIGH>;
reset-gpios = <&tegra_main_gpio TEGRA_MAIN_GPIO(C, 4) GPIO_ACTIVE_HIGH>;
interrupt-gpios = <&tegra_main_gpio TEGRA_MAIN_GPIO(C, 1) GPIO_ACTIVE_LOW>;
set_mode_delay_ms = "5000";
mode0 { // IMX219_MODE_3264x2464_21FPS //
mclk_khz = "24000";
num_lanes = "2";
tegra_sinterface = "serial_c";
phy_mode = "DPHY";
discontinuous_clk = "yes";
dpcm_enable = "false";
cil_settletime = "0";
active_w = "3264";
active_h = "2464";
pixel_t = "bayer_rggb";
readout_orientation = "90";
line_length = "3448";
inherent_gain = "1";
mclk_multiplier = "9.33";
pix_clk_hz = "182400000";
gain_factor = "16";
framerate_factor = "1000000";
exposure_factor = "1000000";
min_gain_val = "16"; // 1.00x //
max_gain_val = "170"; // 10.66x //
step_gain_val = "1";
default_gain = "16"; // 1.00x //
min_hdr_ratio = "1";
max_hdr_ratio = "1";
min_framerate = "2000000"; // 2.0 fps //
max_framerate = "21000000"; // 21.0 fps //
step_framerate = "1";
default_framerate = "21000000"; // 21.0 fps //
min_exp_time = "13"; // us //
max_exp_time = "683709"; // us //
step_exp_time = "1";
default_exp_time = "2495"; // us //
embedded_metadata_height = "2";
};
mode1 { // MODE_3264x1848_28FPS //
mclk_khz = "24000";
num_lanes = "2";
tegra_sinterface = "serial_c";
phy_mode = "DPHY";
discontinuous_clk = "yes";
dpcm_enable = "false";
cil_settletime = "0";
active_w = "3264";
active_h = "1848";
pixel_t = "bayer_rggb";
readout_orientation = "90";
line_length = "3448";
inherent_gain = "1";
mclk_multiplier = "9.33";
pix_clk_hz = "182400000";
gain_factor = "16";
framerate_factor = "1000000";
exposure_factor = "1000000";
min_gain_val = "16"; // 1.00x //
max_gain_val = "170"; // 10.66x //
step_gain_val = "1";
default_gain = "16"; // 1.00x //
min_hdr_ratio = "1";
max_hdr_ratio = "1";
min_framerate = "2000000"; // 2.0 fps //
max_framerate = "28000000"; // 28.0 fps //
step_framerate = "1";
default_framerate = "28000000"; // 28.0 fps //
min_exp_time = "13"; // us //
max_exp_time = "683709"; // us //
step_exp_time = "1";
default_exp_time = "2495"; // us //
embedded_metadata_height = "2";
};
mode2 { // MODE_1920x1080_30FPS //
mclk_khz = "24000";
num_lanes = "2";
tegra_sinterface = "serial_c";
phy_mode = "DPHY";
discontinuous_clk = "yes";
dpcm_enable = "false";
cil_settletime = "0";
active_w = "1920";
active_h = "1080";
pixel_t = "bayer_rggb";
readout_orientation = "90";
line_length = "3448";
inherent_gain = "1";
mclk_multiplier = "9.33";
pix_clk_hz = "182400000";
gain_factor = "16";
framerate_factor = "1000000";
exposure_factor = "1000000";
min_gain_val = "16"; // 1.00x //
max_gain_val = "170"; // 10.66x //
step_gain_val = "1";
default_gain = "16"; // 1.00x //
min_hdr_ratio = "1";
max_hdr_ratio = "1";
min_framerate = "2000000"; // 2.0 fps //
max_framerate = "30000000"; // 30.0 fps //
step_framerate = "1";
default_framerate = "30000000"; // 30.0 fps //
min_exp_time = "13"; // us //
max_exp_time = "683709"; // us //
step_exp_time = "1";
default_exp_time = "2495"; // us //
embedded_metadata_height = "2";
};
mode3 {MODE_1640x1232_30FPS //
mclk_khz = "24000";
num_lanes = "2";
tegra_sinterface = "serial_c";
phy_mode = "DPHY";
discontinuous_clk = "yes";
dpcm_enable = "false";
cil_settletime = "0";
active_w = "1640";
active_h = "1232";
pixel_t = "bayer_rggb";
readout_orientation = "90";
line_length = "3448";
inherent_gain = "1";
mclk_multiplier = "9.33";
pix_clk_hz = "182400000";
gain_factor = "16";
framerate_factor = "1000000";
exposure_factor = "1000000";
min_gain_val = "16"; // 1.00x //
max_gain_val = "170"; // 10.66x //
step_gain_val = "1";
default_gain = "16"; // 1.00x //
min_hdr_ratio = "1";
max_hdr_ratio = "1";
min_framerate = "2000000"; // 2.0 fps //
max_framerate = "30000000"; // 60.0 fps //
step_framerate = "1";
default_framerate = "30000000"; // 60.0 fps //
min_exp_time = "13"; // us //
max_exp_time = "683709"; // us //
step_exp_time = "1";
default_exp_time = "2495"; // us //
embedded_metadata_height = "2";
};
mode4 { //MODE_1280x720_60FPS //
mclk_khz = "24000";
num_lanes = "2";
tegra_sinterface = "serial_c";
phy_mode = "DPHY";
discontinuous_clk = "yes";
dpcm_enable = "false";
cil_settletime = "0";
active_w = "1280";
active_h = "720";
pixel_t = "bayer_rggb";
readout_orientation = "90";
line_length = "3448";
inherent_gain = "1";
mclk_multiplier = "9.33";
pix_clk_hz = "182400000";
gain_factor = "16";
framerate_factor = "1000000";
exposure_factor = "1000000";
min_gain_val = "16"; // 1.00x //
max_gain_val = "170"; // 10.66x //
step_gain_val = "1";
default_gain = "16"; // 1.00x //
min_hdr_ratio = "1";
max_hdr_ratio = "1";
min_framerate = "2000000"; // 2.0 fps //
max_framerate = "60000000"; // 60.0 fps //
step_framerate = "1";
default_framerate = "60000000"; // 60.0 fps //
min_exp_time = "13"; // us //
max_exp_time = "683709"; // us //
step_exp_time = "1";
default_exp_time = "2495"; // us //
embedded_metadata_height = "2";
};
ports {
#address-cells = <1>;
#size-cells = <0>;
port@0 {
reg = <0>;
hdmi2csi_lt6911_out0: endpoint {
status = "okay";
port-index = <0>;
bus-width = <4>;
remote-endpoint = <&hdmi2csi_csi_in0>;
};
};
};
};
};
i2c@c250000{
status = "okay";
};
};
/ {
tcp: tegra-camera-platform {
compatible = “nvidia, tegra-camera-platform”;
num_csi_lanes = <8>;
max_lane_speed = <2500000>;
min_bits_per_pixel = <16>;
vi_peak_byte_per_pixel = <3>;
vi_bw_margin_pct = <25>;
max_pixel_rate = <240000>;
isp_peak_byte_per_pixel = <5>;
isp_bw_margin_pct = <25>;
status = "okay";
modules {
module0 {
status = "okay";
badge = "hdmi2csi_left_6911";
position = "left";
orientation = "1";
drivernode0 {
/* Declare PCL support driver (classically known as guid) */
pcl_id = "v4l2_sensor";
/* Driver v4l2 device name */
devname = "lt6911uxe 1-002b";
/* Declare the device-tree hierarchy to driver instance */
proc-device-tree = "/proc/device-tree/i2c@c240000/lt6911uxe@2b";
};
};
};
};
};
Output of media-ctl and v4l2-ctl
sudo media-ctl -p -d /dev/media0
Media controller API version 0.1.0
Media device information
driver tegra-vi4
model NVIDIA Tegra Video Input Device
serial
bus info
hw revision 0x3
driver version 0.0.0
Device topology
-
entity 1: 150c0000.nvcsi–4 (2 pads, 0 link)
type V4L2 subdev subtype Unknown flags 0
device node name /dev/v4l-subdev0
pad0: Sink
pad1: Source
-
entity 4: 150c0000.nvcsi–3 (2 pads, 1 link)
type V4L2 subdev subtype Unknown flags 0
device node name /dev/v4l-subdev1
pad0: Sink
pad1: Source
→ “vi-output, 150c0000.nvcsi–3”:0 [ENABLED]
-
entity 7: vi-output, 150c0000.nvcsi–3 (1 pad, 1 link)
type Node subtype V4L flags 0
device node name /dev/video0
pad0: Sink
← “150c0000.nvcsi–3”:1 [ENABLED]
-
entity 17: 150c0000.nvcsi–2 (2 pads, 1 link)
type V4L2 subdev subtype Unknown flags 0
device node name /dev/v4l-subdev2
pad0: Sink
pad1: Source
→ “vi-output, 150c0000.nvcsi–2”:0 [ENABLED]
-
entity 20: vi-output, 150c0000.nvcsi–2 (1 pad, 1 link)
type Node subtype V4L flags 0
device node name /dev/video1
pad0: Sink
← “150c0000.nvcsi–2”:1 [ENABLED]
-
entity 28: 150c0000.nvcsi–1 (2 pads, 1 link)
type V4L2 subdev subtype Unknown flags 0
device node name /dev/v4l-subdev3
pad0: Sink
pad1: Source
→ “vi-output, 150c0000.nvcsi–1”:0 [ENABLED]
-
entity 31: vi-output, 150c0000.nvcsi–1 (1 pad, 1 link)
type Node subtype V4L flags 0
device node name /dev/video2
pad0: Sink
← “150c0000.nvcsi–1”:1 [ENABLED]
v4l2-ctl --all
Driver Info (not using libv4l2):
Driver name : tegra-video
Card type : vi-output, 150c0000.nvcsi–3
Bus info : platform:15700000.vi:2
Driver version: 4.9.253
Capabilities : 0x84200001
Video Capture
Streaming
Extended Pix Format
Device Capabilities
Device Caps : 0x04200001
Video Capture
Streaming
Extended Pix Format
Priority: 2
Video input : 0 (Camera 2: ok)
Format Video Capture:
Width/Height : 1920/1080
Pixel Format : ‘RG10’
Field : Any
Bytes per Line : 3840
Size Image : 4147200
Colorspace : Default
Transfer Function : Default (maps to Rec. 709)
YCbCr/HSV Encoding: Default (maps to ITU-R 601)
Quantization : Default (maps to Full Range)
Flags :
Camera Controls
bypass_mode 0x009a2064 (intmenu): min=0 max=1 default=0 value=0
override_enable 0x009a2065 (intmenu): min=0 max=1 default=0 value=0
height_align 0x009a2066 (int) : min=1 max=16 step=1 default=1 value=1
size_align 0x009a2067 (intmenu): min=0 max=2 default=0 value=0
write_isp_format 0x009a2068 (int) : min=1 max=1 step=1 default=1 value=1
sensor_signal_properties 0x009a2069 (u32) : min=0 max=0 step=0 default=0 flags=read-only, has-payload
sensor_image_properties 0x009a206a (u32) : min=0 max=0 step=0 default=0 flags=read-only, has-payload
sensor_control_properties 0x009a206b (u32) : min=0 max=0 step=0 default=0 flags=read-only, has-payload
sensor_dv_timings 0x009a206c (u32) : min=0 max=0 step=0 default=0 flags=read-only, has-payload
low_latency_mode 0x009a206d (bool) : default=0 value=0
preferred_stride 0x009a206e (int) : min=0 max=65535 step=1 default=0 value=0
sensor_modes 0x009a2082 (int) : min=0 max=30 step=1 default=30 value=30 flags=read-only
v4l2-compliance
v4l2-compliance SHA : not available
Driver Info:
Driver name : tegra-video
Card type : vi-output, 150c0000.nvcsi–3
Bus info : platform:15700000.vi:2
Driver version: 4.9.253
Capabilities : 0x84200001
Video Capture
Streaming
Extended Pix Format
Device Capabilities
Device Caps : 0x04200001
Video Capture
Streaming
Extended Pix Format
Compliance test for device /dev/video0 (not using libv4l2):
Required ioctls:
test VIDIOC_QUERYCAP: OK
Allow for multiple opens:
test second video open: OK
test VIDIOC_QUERYCAP: OK
test VIDIOC_G/S_PRIORITY: OK
test for unlimited opens: OK
Debug ioctls:
test VIDIOC_DBG_G/S_REGISTER: OK (Not Supported)
test VIDIOC_LOG_STATUS: OK
Input ioctls:
test VIDIOC_G/S_TUNER/ENUM_FREQ_BANDS: OK (Not Supported)
test VIDIOC_G/S_FREQUENCY: OK (Not Supported)
test VIDIOC_S_HW_FREQ_SEEK: OK (Not Supported)
test VIDIOC_ENUMAUDIO: OK (Not Supported)
test VIDIOC_G/S/ENUMINPUT: OK
test VIDIOC_G/S_AUDIO: OK (Not Supported)
Inputs: 1 Audio Inputs: 0 Tuners: 0
Output ioctls:
test VIDIOC_G/S_MODULATOR: OK (Not Supported)
test VIDIOC_G/S_FREQUENCY: OK (Not Supported)
test VIDIOC_ENUMAUDOUT: OK (Not Supported)
test VIDIOC_G/S/ENUMOUTPUT: OK (Not Supported)
test VIDIOC_G/S_AUDOUT: OK (Not Supported)
Outputs: 0 Audio Outputs: 0 Modulators: 0
Input/Output configuration ioctls:
test VIDIOC_ENUM/G/S/QUERY_STD: OK (Not Supported)
test VIDIOC_ENUM/G/S/QUERY_DV_TIMINGS: OK (Not Supported)
test VIDIOC_DV_TIMINGS_CAP: OK (Not Supported)
test VIDIOC_G/S_EDID: OK (Not Supported)
Test input 0:
Control ioctls:
test VIDIOC_QUERY_EXT_CTRL/QUERYMENU: OK
test VIDIOC_QUERYCTRL: OK
test VIDIOC_G/S_CTRL: OK
fail: v4l2-test-controls.cpp(633): did not check against size
test VIDIOC_G/S/TRY_EXT_CTRLS: FAIL
test VIDIOC_(UN)SUBSCRIBE_EVENT/DQEVENT: OK
test VIDIOC_G/S_JPEGCOMP: OK (Not Supported)
Standard Controls: 1 Private Controls: 12
Format ioctls:
test VIDIOC_ENUM_FMT/FRAMESIZES/FRAMEINTERVALS: OK
test VIDIOC_G/S_PARM: OK (Not Supported)
test VIDIOC_G_FBUF: OK (Not Supported)
fail: v4l2-test-formats.cpp(330): !colorspace
fail: v4l2-test-formats.cpp(439): testColorspace(pix.pixelformat, pix.colorspace, pix.ycbcr_enc, pix.quantization)
test VIDIOC_G_FMT: FAIL
test VIDIOC_TRY_FMT: OK (Not Supported)
test VIDIOC_S_FMT: OK (Not Supported)
test VIDIOC_G_SLICED_VBI_CAP: OK (Not Supported)
test Cropping: OK (Not Supported)
test Composing: OK (Not Supported)
fail: v4l2-test-formats.cpp(1550): doioctl(node, VIDIOC_S_FMT, &fmt)
fail: v4l2-test-formats.cpp(1647): doioctl(node, VIDIOC_S_FMT, &fmt)
test Scaling: FAIL
Codec ioctls:
test VIDIOC_(TRY_)ENCODER_CMD: OK (Not Supported)
test VIDIOC_G_ENC_INDEX: OK (Not Supported)
test VIDIOC_(TRY_)DECODER_CMD: OK (Not Supported)
Buffer ioctls:
test VIDIOC_REQBUFS/CREATE_BUFS/QUERYBUF: OK
fail: v4l2-test-buffers.cpp(574): VIDIOC_EXPBUF is supported, but the V4L2_MEMORY_MMAP support is missing, probably due to earlier failing format tests.
test VIDIOC_EXPBUF: OK (Not Supported)
Test input 0:
Total: 43, Succeeded: 40, Failed: 3, Warnings: 0
v4l2-ctl --list-devices
vi-output, 150c0000.nvcsi–3 (platform:15700000.vi:2):
/dev/video0
vi-output, 150c0000.nvcsi–2 (platform:15700000.vi:4):
/dev/video1
vi-output, 150c0000.nvcsi–1 (platform:15700000.vi:5):
/dev/video2
Without the driver being loaded, the devices are already created, who creates them? Isn’t the driver supposed to create the video device.
Also if I just keep channel = 1 and bus-width = 4, and modify the dtsi with just one port mapping, it doesn’t create video device at all.
Based on connection diagram i posted earlier, we have connected total 8 CSI lanes in two 4 lane camera configuration to the Lontium chip. Out of which I am using the first 4 lanes only currently, and Lontium claims we can achieve 4kp60 in YUV422 format using 4 lanes. For RGB888 we will need to use all 8 lanes, but that’s for future.
Camera 0/1
(4-Lane)
Only CSI 0
Clock Used
Camera 2/3
(4-Lane)
Only CSI 2
Clock Used
Please any help or useful guidance will be greatly appreciated.
Thanks