Light up a 1920x1300 yuv422 CSI camera, but when registered, it is recognized as 1920x1080

We wrote the following content under the tegra234-p3767-camera-p3768-ovx3c-isx031.dtbo device tree.

i2c@1 {
						status = "okay";
						reg = <1>;
						#address-cells = <1>;
						#size-cells = <0>;
						rbpcv2_ovx3c_c@10 {
							status = "disabled";
						};
						rbpcv3_isx031_c@1a {
							reset-gpios = <&gpio CAM1_PWDN GPIO_ACTIVE_HIGH>;
							compatible = "sony,isx031";
							/* I2C device address */
							reg = <0x1a>;
							/* V4L2 device node location */
							devnode = "video1";
							/* Physical dimensions of sensor */
							physical_w = "3.680";
							physical_h = "2.760";
							sensor_model = "isx031";
							use_sensor_mode_id = "true";
							mode0 { /* ISX031_MODE_1920x1080_raw12_30FPS */
								mclk_khz = "24000";
								num_lanes = "2";
								tegra_sinterface = "serial_c";
								lane_polarity = "0";
								phy_mode = "DPHY";
								discontinuous_clk = "yes";
								dpcm_enable = "false";
								cil_settletime = "0";
								active_w = "1920";
								active_h = "1300";
								mode_type = "yuv";
								pixel_phase = "uyvy";
								csi_pixel_bit_depth = "16";
								readout_orientation = "90";
								line_length = "3448";
								inherent_gain = "1";
								mclk_multiplier = "9.33";
								pix_clk_hz = "150000000";
								gain_factor = "16";
								framerate_factor = "1000000";
								exposure_factor = "1000000";
								min_gain_val = "16"; /* 1.00x */
								max_gain_val = "248"; /* 15.5x */
								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 = "33000"; /* us */
								step_exp_time = "1";
								default_exp_time = "11000"; /* us */
								embedded_metadata_height = "0";
							};
							ports {
								#address-cells = <1>;
								#size-cells = <0>;
								port@0 {
									reg = <0>;
									rbpcv3_isx031_out1: endpoint {
										port-index = <2>;
										bus-width = <2>;
										remote-endpoint = <&rbpcv3_isx031_csi_in1>;
									};
								};
							};
						};
					};

And the resolution displayed in the device tree inside the device is also 1920x1300, with only one mode0.

root@ubuntu:/sys/firmware/devicetree/base/bus@0/cam_i2cmux/i2c@1/rbpcv3_isx031_c@1a# ls compatible devnode mode0 name physical_h physical_w ports reg reset-gpios sensor_model use_sensor_mode_id root@ubuntu:/sys/firmware/devicetree/base/bus@0/cam_i2cmux/i2c@1/rbpcv3_isx031_c@1a# cat mode0/active_h 1300 root@ubuntu:/sys/firmware/devicetree/base/bus@0/cam_i2cmux/i2c@1/rbpcv3_isx031_c@1a# cat mode0/active_w 1920 root@ubuntu:/sys/firmware/devicetree/base/bus@0/cam_i2cmux/i2c@1/rbpcv3_isx031_c@1a#
However, using the v4l2-ctl command is abnormal: there are three modes, and the resolution is 1920x1080.

/dev/video0 is the device of the same device tree file, which matches the device tree.

`
root@ubuntu:/sys/firmware/devicetree/base/bus@0/cam_i2cmux/i2c@1/rbpcv3_isx031_c@1a# v4l2-ctl --list-formats-ext -d /dev/video1
ioctl: VIDIOC_ENUM_FMT
Type: Video Capture

    [0]: 'UYVY' (UYVY 4:2:2)
            Size: Discrete 1920x1080
                    Interval: Discrete 0.033s (30.000 fps)
    [1]: 'NV16' (Y/CbCr 4:2:2)
            Size: Discrete 1920x1080
                    Interval: Discrete 0.033s (30.000 fps)
    [2]: 'UYVY' (UYVY 4:2:2)
            Size: Discrete 1920x1080
                    Interval: Discrete 0.033s (30.000 fps)

root@ubuntu:/sys/firmware/devicetree/base/bus@0/cam_i2cmux/i2c@1/rbpcv3_isx031_c@1a# v4l2-ctl --list-formats-ext -d /dev/video0
ioctl: VIDIOC_ENUM_FMT
Type: Video Capture

    [0]: 'RG12' (12-bit Bayer RGRG/GBGB)
            Size: Discrete 1920x1080
                    Interval: Discrete 0.033s (30.000 fps)

`
When we use the v4l2 command to capture images, we are unable to get any images and receive the following error.

 v4l2-ctl -d /dev/video1 --set-fmt-video=width=1920,height=1300,pixelformat=UYVY --set-ctrl bypass_mode=0 --stream-mmap --stream-count=1
[ 2089.999930] tegra-camrtc-capture-vi tegra-capture-vi: corr_err: discarding frame 0, flags: 0, err_data 64
[ 2090.033299] tegra-camrtc-capture-vi tegra-capture-vi: corr_err: discarding frame 0, flags: 0, err_data 64
[ 2090.066604] tegra-camrtc-capture-vi tegra-capture-vi: corr_err: discarding frame 0, flags: 0, err_data 64
[ 2090.099951] tegra-camrtc-capture-vi tegra-capture-vi: corr_err: discarding frame 0, flags: 0, err_data 64
[ 2090.133287] tegra-camrtc-capture-vi tegra-capture-vi: corr_err: discarding frame 0, flags: 0, err_data 64
[ 2090.166620] tegra-camrtc-capture-vi tegra-capture-vi: corr_err: discarding frame 0, flags: 0, err_data 64
[ 2090.199932] tegra-camrtc-capture-vi tegra-capture-vi: corr_err: discarding frame 0, flags: 0, err_data 64
[ 2090.233279] tegra-camrtc-capture-vi tegra-capture-vi: corr_err: discarding frame 0, flags: 0, err_data 64
[ 2090.266612] tegra-camrtc-capture-vi tegra-capture-vi: corr_err: discarding frame 0, flags: 0, err_data 64
[ 2090.300149] tegra-camrtc-capture-vi tegra-capture-vi: corr_err: discarding frame 0, flags: 0, err_data 64
[ 2090.333280] tegra-camrtc-capture-vi tegra-capture-vi: corr_err: discarding frame 0, flags: 0, err_data 64
[ 2090.366801] tegra-camrtc-capture-vi tegra-capture-vi: corr_err: discarding frame 0, flags: 0, err_data 64
[ 2090.399918] tegra-camrtc-capture-vi tegra-capture-vi: corr_err: discarding frame 0, flags: 0, err_data 64
[ 2090.433455] tegra-camrtc-capture-vi tegra-capture-vi: corr_err: discarding frame 0, flags: 0, err_data 64
[ 2090.466610] tegra-camrtc-capture-vi tegra-capture-vi: corr_err: discarding frame 0, flags: 0, err_data 64
[ 2090.499935] tegra-camrtc-capture-vi tegra-capture-vi: corr_err: discarding frame 0, flags: 0, err_data 64

We also suspect that the device tree was registered incorrectly, but after checking the driver, it is consistent with the device tree configuration.
Could you please provide a solution? Thank you.

hello 1450072342,

v4l2-ctl --list-formats-ext it’s checking the supported formats from the sensor driver side.
you may examine the mode table from sensor driver.
let me taking IMX274 as an example,
./nvidia-oot/drivers/media/i2c/imx274_mode_tbls.h

static const struct camera_common_frmfmt imx274_frmfmt[] = { 
        {{3840, 2160}, imx274_60_fr, 1, 0, IMX274_MODE_3840X2160},
        {{1920, 1080}, imx274_60_fr, 1, 0, IMX274_MODE_1920X1080},
        {{3856, 4448}, imx274_30_fr, 1, 1, IMX274_MODE_3840X2160_DOL_30FPS},
        {{1936, 2264}, imx274_60_fr, 1, 1, IMX274_MODE_1920X1080_DOL_60FPS},

BTW,
you should working on Jetson Orin Nano instead of TX2, right?

1 Like

yes

I have modified it according to the reference, and there is only one mode. The resolution is set correctly, and I can obtain the image, but why are there still three modes?

I have another question. The devnode=video1 set on the device tree seems to not take effect. After loading the driver, it maps to /dev/video0. Is there any way to fix this device?

hello 1450072342,

in my experience, it only happened with YUV/USB cameras. I’ve not yet dig into the root cause.
this doesn’t reported with bayer raw image sensors anyways.
for instance,
this is what IMX274 sensor support format dumps, it’s identical with the sensor driver mode table.

$ v4l2-ctl -d /dev/video0 --list-formats-ext
ioctl: VIDIOC_ENUM_FMT
        Type: Video Capture

        [0]: 'RG10' (10-bit Bayer RGRG/GBGB)
                Size: Discrete 3840x2160
                        Interval: Discrete 0.017s (60.000 fps)
                Size: Discrete 1920x1080
                        Interval: Discrete 0.017s (60.000 fps)
                Size: Discrete 3856x4448
                        Interval: Discrete 0.033s (30.000 fps)
                Size: Discrete 1936x2264
                        Interval: Discrete 0.017s (60.000 fps)

you meant you have single camera device connected, and you would like to register it to /dev/video1?

I don’t understand why this cannot be fixed according to the device tree, whether it’s a single connection or multiple connections. I just want to fix the device based on the corresponding value in the device tree.

hello 1450072342,

please see-also below..
$public_sources/r36.4.3/Linux_for_Tegra/source/kernel_src/kernel/kernel-jammy-src/drivers/media/usb/uvc/uvc_driver.c

ret = video_register_device(vdev, VFL_TYPE_VIDEO, -1);

the value -1 means it’ll find a available number to register the video node automatically. (which always start from video0)
for your use-case, please try update the driver with a specific device node number is desired for your camera usage.

ok,thanks

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.