Orin camera Fail to parse port info by JetPack5.0.2

请使用原始代码,只修改 tegra234-p3737-camera-modules.dtsi 文件中的
i2c@3180000 {

tca9546_70: tca9546@70 {
status = “okay”;
i2c@0 {
pca9570_a_24: pca9570_a@24 {
status = “okay”;
};
imx274_cam0: imx274_a@1a {
status = “disabled”;
};
imx185_cam0: imx185_a@1a {
status = “disabled”;
};
e3331_cam0: imx318_a@10 {
status = “disable”;
};
max9296_dser: max9296@48 {
status = “okay”;
};
max9295_prim: max9295_prim@62 {
status = “okay”;
};
max9295_ser0: max9295_a@40 {
status = “okay”;
};
max9295_ser1: max9295_b@60 {
status = “okay”;
};
imx390_cam0: imx390_a@1b {
status = “okay”;
};
imx390_cam1: imx390_b@1c {
status = “okay”;
};
};


开机 kernel log 也同样有问题:
[2022/12/12 15:17:51] [ 4.398017] tegra-camrtc-capture-vi tegra-capture-vi: tegra_channel_csi_init:Fail to parse port info
[2022/12/12 15:17:51] [ 4.407382] tegra-camrtc-capture-vi tegra-capture-vi: channel init failed
[2022/12/12 15:17:51] [ 4.414349] tegra-camrtc-capture-vi tegra-capture-vi: tegra_channel_csi_init:Fail to parse port info
[2022/12/12 15:17:51] [ 4.423714] tegra-camrtc-capture-vi tegra-capture-vi: channel init failed
[2022/12/12 15:17:51] [ 4.430671] tegra-camrtc-capture-vi tegra-capture-vi: all channel init failed
[2022/12/12 15:17:51] [ 4.437994] tegra-camrtc-capture-vi tegra-capture-vi: Init channel failed
[2022/12/12 15:17:51] [ 4.444998] tegra-camrtc-capture-vi tegra-capture-vi: tegra_vi_media_controller_init_int: failed
[2022/12/12 15:17:51] [ 4.454013] tegra-camrtc-capture-vi tegra-capture-vi: media controller init failed
[2022/12/12 15:17:51] [ 4.462509] device-mapper: uevent: version 1.0.3
[2022/12/12 15:17:51] [ 4.467333] device-mapper: ioctl: 4.43.0-ioctl (2020-10-01) initialised: dm-devel@redhat.com

hello 305248199,

suggest you should dig into kernel driver, $public_sources/kernel_src/kernel/nvidia/drivers/media/platform/tegra/camera/vi/graph.c
there’s kernel function for checking port info,
for example, int tegra_vi_get_port_info(struct tegra_channel *chan, struct device_node *node, unsigned int index){...}

please review which paragraph causing such error,
then, you may check your device tree sources to revise the settings accordingly.
thanks

@JerryChang 请提供一个能被 tegra_vi_get_port_info 正确识别的 dtsi 文件,谢谢!

hello 305248199,

why? I don’t see this failure on reference board.

hello JerryChang:
我重新在 https://developer.nvidia.cn/embedded/jetson-linux 下载 kernel 代码 public_sources.tbz2;
1,修改 jetson-agx-orin-devkit.conf 文件中的
OVERLAY_DTB_FILE=“${OVERLAY_DTB_FILE},tegra234-p3737-camera-imx390-overlay.dtbo”;
2,修改 tegra234-p3737-camera-modules.dtsi 文件
去掉 除 #include “tegra234-p3737-0000-camera-imx390-a00.dtsi” 之外的设备,
以及:
i2c@3180000 {
status = “okay”; //lukgeeker add

tca9546_70: tca9546@70 {
// status = “disabled”;
status = “okay”; //lukgeeker add
i2c@0 {
pca9570_a_24: pca9570_a@24 {
status = “disabled”;
};
imx274_cam0: imx274_a@1a {
status = “disabled”;
};
imx185_cam0: imx185_a@1a {
status = “disabled”;
};
e3331_cam0: imx318_a@10 {
status = “disable”;
};
max9296_dser: max9296@48 {
// status = “disabled”;
status = “okay”; //lukgeeker add
};
max9295_prim: max9295_prim@62 {
// status = “disabled”;
status = “okay”; //lukgeeker add
};
max9295_ser0: max9295_a@40 {
// status = “disabled”;
status = “okay”; //lukgeeker add
};
max9295_ser1: max9295_b@60 {
// status = “disabled”;
status = “okay”; //lukgeeker add
};
imx390_cam0: imx390_a@1b {
// status = “disabled”;
status = “okay”; //lukgeeker add
};
imx390_cam1: imx390_b@1c {
// status = “disabled”;
status = “okay”; //lukgeeker add
};
};


}
3,确保 kernel defconfig 配置文件
CONFIG_NV_VIDEO_IMX390=y

重新完全编译替换 目标系统中的 /boot/Image 以及/boot/dtb/kernel_tegra234-p3701-0004-p3737-0000.dtb 文件。

问题依旧;完整的开机 log附上。
log (124.6 KB)

hello 305248199,

are you using a customize board?

also,
why you need to modify tegra234-p3737-camera-modules.dtsi?
there’s DTB overlay file, you can enable Jetson-IO to apply device tree overlay to apply IMX390 settings directly.

我们是客制化的板,使用 imx390 是为了测试现在这个 bug
our is a customize board,Use imx390 to test the current bug

如果一行代码都不改,那么开机 log :
[2022/12/15 17:56:38] [ 4.306006] tegra-camrtc-capture-vi tegra-capture-vi: ep of_device is not enabled endpoint.
[2022/12/15 17:56:38] [ 4.314593] tegra-camrtc-capture-vi tegra-capture-vi: ep of_device is not enabled endpoint.

hello 305248199,

you need to create a device-tree overlay file to register the camera module
please check developer guide, To Create and Apply a DTB Overlay File.

v4l2-compliance -d /dev/video0

vlc open /dev/video0

why?

hello 305248199,

you may ignore test failure of VIDIOC_G/S_PARM since that’s without implementation by default.
however, please look into test failure of VIDIOC_REQBUFS/CREATE_BUFS/QUERYBUF. those are standard controls for request capture buffers.

may I also know what’s the output data rate?
please refer to developer guide. SerDes Pixel Clock.

Skew calibration is required if sensor or deserializer is using DPHY, and the output data rate is > 1.5Gbps.

The orin platform does not support the YUV422 8-bit format?
This is for the Xavier platform parameter:
dynamic_pixel_bit_depth = “8”;
csi_pixel_bit_depth = “8”;
mode_type = “yuv”;
pixel_phase = “yuyv”;

                                    active_w = "1280";
                                    active_h = "960";
                                    readout_orientation = "0";
                                    line_length = "2560";
                                    inherent_gain = "1";
                                    pix_clk_hz = "742500000";
                                    serdes_pix_clk_hz = "833333333";

Supported formats ?
static int extract_pixel_format(
const char *pixel_t, u32 *format)
{

    size_t size = strnlen(pixel_t, OF_MAX_STR_LEN);

    if (strncmp(pixel_t, "bayer_bggr10", size) == 0)
            *format = V4L2_PIX_FMT_SBGGR10;
    else if (strncmp(pixel_t, "bayer_rggb10", size) == 0)
            *format = V4L2_PIX_FMT_SRGGB10;
    else if (strncmp(pixel_t, "bayer_grbg10", size) == 0)
            *format = V4L2_PIX_FMT_SGRBG10;
    else if (strncmp(pixel_t, "bayer_gbrg10", size) == 0)
            *format = V4L2_PIX_FMT_SGBRG10;
    else if (strncmp(pixel_t, "bayer_bggr12", size) == 0)
            *format = V4L2_PIX_FMT_SBGGR12;
    else if (strncmp(pixel_t, "bayer_rggb12", size) == 0)
            *format = V4L2_PIX_FMT_SRGGB12;
    else if (strncmp(pixel_t, "bayer_gbrg12", size) == 0)
            *format = V4L2_PIX_FMT_SGBRG12;
    else if (strncmp(pixel_t, "bayer_grbg12", size) == 0)
            *format = V4L2_PIX_FMT_SGRBG12;
    else if (strncmp(pixel_t, "rgb_rgb88824", size) == 0)
            *format = V4L2_PIX_FMT_RGB24;
    else if (strncmp(pixel_t, "bayer_wdr_pwl_rggb12", size) == 0)
            *format = V4L2_PIX_FMT_SRGGB12;
    else if (strncmp(pixel_t, "bayer_wdr_pwl_gbrg12", size) == 0)
            *format = V4L2_PIX_FMT_SGBRG12;
    else if (strncmp(pixel_t, "bayer_wdr_pwl_grbg12", size) == 0)
            *format = V4L2_PIX_FMT_SGRBG12;
    else if (strncmp(pixel_t, "bayer_wdr_dol_rggb10", size) == 0)
            *format = V4L2_PIX_FMT_SRGGB10;
    else if (strncmp(pixel_t, "bayer_xbggr10p", size) == 0)
            *format = V4L2_PIX_FMT_XBGGR10P;
    else if (strncmp(pixel_t, "bayer_xrggb10p", size) == 0)
            *format = V4L2_PIX_FMT_XRGGB10P;
    else if (strncmp(pixel_t, "yuv_yuyv16", size) == 0)
            *format = V4L2_PIX_FMT_YUYV;
    else if (strncmp(pixel_t, "yuv_yvyu16", size) == 0)
            *format = V4L2_PIX_FMT_YVYU;
    else if (strncmp(pixel_t, "yuv_uyvy16", size) == 0)
            *format = V4L2_PIX_FMT_UYVY;
    else if (strncmp(pixel_t, "yuv_vyuy16", size) == 0)
            *format = V4L2_PIX_FMT_VYUY;
    else {
            pr_err("%s: Need to extend format%s\n", __func__, pixel_t);
            return -EINVAL;
    }

    return 0;

}

YUV422 8-bit is not supported by default. you should have customize driver to enable this on Xavier series, right?

It can already be displayed. However, there are 4 lanes in csi0. Each lane is connected to a camera. I now display one image in all 4 lanes;
My vi device-tree is as follows:
已经可以显示了,但是,csi0 一共4 lanes,每一个 lanes 接一个camera,我现在4路都显示一路的图像;
我的 vi 部分 设备树如下:

    tegra-capture-vi {
                    num-channels = <4>;
                    ports {
                            #address-cells = <1>;
                            #size-cells = <0>;
                            port@0 {
                                    reg = <0>;
                                    ar0234_vi_in0: endpoint {
                                                    vc-id = <1>;
                                                    port-index = <0>;
                                                    bus-width = <4>;
                                                    remote-endpoint = <&ar0234_csi_out0>;
                                                    };
                                    };
                            port@1 {
                                    reg = <1>;
                                    ar0234_vi_in1: endpoint {
                                                    vc-id = <0>;
                                                    port-index = <0>;
                                                    bus-width = <4>;
                                                    remote-endpoint = <&ar0234_csi_out1>;
                                                    };
                                    };
                            port@2 {
                                    reg = <2>;
                                    ar0234_vi_in2: endpoint {
                                                    vc-id = <2>;
                                                    port-index = <0>;
                                                    bus-width = <4>;
                                                    remote-endpoint = <&ar0234_csi_out2>;
                                                    };
                                    };
                            port@3 {
                                    reg = <3>;
                                    ar0234_vi_in3: endpoint {
                                                    vc-id = <3>;
                                                    port-index = <0>;
                                                    bus-width = <4>;
                                                    remote-endpoint = <&ar0234_csi_out3>;
                                                    };
                                    };
                    };
    };

@JerryChang
我目前的情况,csi0 4 lanes 中的 0 和 1 lanes 可以正常显示图像了,但,后面的 2 和 3 lanes 不能显示,是不是 4lanes 的 csi0 ,后面 2 lanes(csi1 上的2lanes)需要特殊处理?

In my current situation, the 0 and 1 lanes in the csi0 and 4 lanes can display images normally, but the 2 and 3 lanes behind can’t be displayed. Is it the csi0 of the 4 lanes and the 2 lanes behind (the 2 lanes on the csi1) that need special processing?

hello 305248199,

according to the device tree settings in comment #36. it’s four 4-lane camera that entering CSI-0.
is it correct configuration? please update bus-width= <1>; if you’re actually using four 1-lane cameras.

all update tobus-width= <1> from bus-width= <4>, 4 channels cannot be displayed

hello 305248199,

hold-on, what’s the actual sensor configuration. you need to modify device tree settings accordingly.

上面有简单原理图
There is a simple schematic diagram above

It’s OK, thank you!