I am developing a MIPI camera driver on Jetson AGX Orin. However I fail to capture any frame by ioctl()
interface and the trace log reports VIFALC_TDSTATE
error.
Environment
kernel version:
Jetpack 5.1.1 [L4T 35.3.1]
device link:
OX01F10 —> max96701 —> LI-MAX9296-IPX-DESER —> LI-JXAV-MIPI-ADPT-4CAM —> Orin
The boards LI-MAX9296-IPX-DESER and LI-JXAV-MIPI-ADPT-4CAM are from Leopard.
The OX01F10 sensor and max96701 are integrated into a single camera device from Mitsubishi.
drivers:
I write the driver codes for max96701 and OX01F10, and I reuse the driver codes for max9296 provided by Jetpack with a little modification.
My test code is like
enum v4l2_buf_type v4l2buftype = V4L2_BUF_TYPE_VIDEO_CAPTURE;
struct v4l2_requestbuffers v4l2reqbuf = {
.count = 1,
.type = V4L2_BUF_TYPE_VIDEO_CAPTURE,
.memory = V4L2_MEMORY_MMAP,
};
struct v4l2_buffer v4l2buf = {
.index = 0,
.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
.memory = V4L2_MEMORY_MMAP;
};
int fd = open("/dev/video0", O_RDWR);
ioctl(fd, VIDIOC_REQBUFS, &v4l2reqbuf);
ioctl(fd, VIDIOC_QUERYBUF, &v4l2buf);
ioctl(fd, VIDIOC_STREAMON, &v4l2buftype);
ioctl(fd, VIDIOC_QBUF, &v4l2buf);
ioctl(fd, VIDIOC_DQBUF, &v4l2buf);
ioctl(fd, VIDIOC_STREAMOFF, &v4l2buftype);
close(fd);
The dmesg
shows timeout error
[ 199.041247] mitsubishi_max9296 30-0048: [MAX9296]: probing GMSL Deserializer
[ 199.041367] mitsubishi_max9296 30-0048: mitsubishi_max9296_probe: success
[ 202.529930] mitsubishi_max96701 30-0060: [MAX96701]: probing GMSL Serializer
[ 202.529938] mitsubishi_max96701 30-0060: [MAX96701]: probing success
[ 207.897696] mitsubishi_gen2_cam 30-001b: [Mitsubushi Gen2 Camera]: probing camera
[ 207.898011] mitsubishi_gen2_cam 30-001b: tegracam sensor driver:mitsubishi_gen2_cam_v2.0.6
[ 208.141514] tegra-camrtc-capture-vi tegra-capture-vi: subdev mitsubishi_gen2_cam 30-0 bound
[ 208.143291] mitsubishi_gen2_cam 30-001b: [Mitsubushi Gen2 Camera]: probing success
[ 252.314472] bwmgr API not supported
[ 252.346734] mitsubishi_gen2_cam 30-001b: mitsubishi_gen2_cam_start_streaming : camera has started streaming.
[ 254.918368] tegra-camrtc-capture-vi tegra-capture-vi: uncorr_err: request timed out after 2500 ms
[ 254.927556] tegra-camrtc-capture-vi tegra-capture-vi: err_rec: attempting to reset the capture channel
[ 254.938164] (NULL device *): vi_capture_control_message: NULL VI channel received
[ 254.945894] t194-nvcsi 13e40000.host1x:nvcsi@15a00000: csi5_stream_close: Error in closing stream_id=0, csi_port=0
[ 254.956540] (NULL device *): vi_capture_control_message: NULL VI channel received
[ 254.964252] t194-nvcsi 13e40000.host1x:nvcsi@15a00000: csi5_stream_open: VI channel not found for stream- 0 vc- 0
[ 254.975034] tegra-camrtc-capture-vi tegra-capture-vi: err_rec: successfully reset the capture channel
The trace log shows VIFALC_TDSTATE
error
# tracer: nop
#
# entries-in-buffer/entries-written: 25/25 #P:12
#
# _-----=> irqs-off
# / _----=> need-resched
# | / _---=> hardirq/softirq
# || / _--=> preempt-depth
# ||| / delay
# TASK-PID CPU# |||| TIMESTAMP FUNCTION
# | | | |||| | |
kworker/4:2-143 [004] .... 178.069619: rtcpu_string: tstamp:6437016911 id:0x04010000 str:"VM0 deactivating."
simple_test-3669 [004] .... 178.852725: tegra_channel_open: vi-output, mitsubishi_gen2_cam
simple_test-3669 [004] .... 178.854123: tegra_channel_set_power: mitsubishi_gen2_cam 30-0 : 0x1
simple_test-3669 [004] .... 178.854147: camera_common_s_power: status : 0x1
simple_test-3669 [004] .... 178.854161: tegra_channel_set_power: 13e40000.host1x:nvcsi@15a00000- : 0x1
simple_test-3669 [004] .... 178.854166: csi_s_power: enable : 0x1
simple_test-3669 [000] .... 178.855018: tegra_channel_capture_setup: vnc_id 0 W 1280 H 964 fmt 13
kworker/4:2-143 [004] .... 178.858034: rtcpu_string: tstamp:6462874854 id:0x04010000 str:"VM0 activating."
simple_test-3669 [002] .... 178.863424: tegra_channel_set_stream: enable : 0x1
simple_test-3669 [002] .... 178.877521: tegra_channel_set_stream: 13e40000.host1x:nvcsi@15a00000- : 0x1
simple_test-3669 [002] .... 178.877524: csi_s_stream: enable : 0x1
simple_test-3669 [002] .... 178.877893: tegra_channel_set_stream: mitsubishi_gen2_cam 30-0 : 0x1
kworker/4:2-143 [004] .... 178.917367: rtcpu_vinotify_event: tstamp:6464281677 cch:0 vi:0 tag:VIFALC_TDSTATE channel:0x23 frame:0 vi_tstamp:206855944032 data:0x399d580010000000
kworker/4:2-143 [004] .... 178.917369: rtcpu_vinotify_event: tstamp:6464281816 cch:0 vi:0 tag:VIFALC_TDSTATE channel:0x23 frame:0 vi_tstamp:206855950464 data:0x0000000031000001
vi-output, forv-3671 [001] .... 181.522024: tegra_channel_capture_setup: vnc_id 0 W 1280 H 964 fmt 13
simple_test-3669 [002] .... 181.531752: tegra_channel_set_stream: enable : 0x0
simple_test-3669 [002] .... 181.531754: tegra_channel_set_stream: mitsubishi_gen2_cam 30-0 : 0x0
simple_test-3669 [002] .... 181.531780: tegra_channel_set_stream: 13e40000.host1x:nvcsi@15a00000- : 0x0
simple_test-3669 [002] .... 181.531781: csi_s_stream: enable : 0x0
simple_test-3669 [003] .... 181.545192: tegra_channel_set_power: mitsubishi_gen2_cam 30-0 : 0x0
simple_test-3669 [003] .... 181.545211: camera_common_s_power: status : 0x0
simple_test-3669 [003] .... 181.545265: tegra_channel_set_power: 13e40000.host1x:nvcsi@15a00000- : 0x0
simple_test-3669 [003] .... 181.545270: csi_s_power: enable : 0x0
simple_test-3669 [003] .... 181.545396: tegra_channel_close: vi-output, mitsubishi_gen2_cam
kworker/4:2-143 [004] .... 187.561710: rtcpu_string: tstamp:6734171612 id:0x04010000 str:"VM0 deactivating."
My device tree overlay for test
#include <dt-common/jetson/tegra234-p3737-0000-p3701-0000.h>
/dts-v1/;
/plugin/;
/ {
overlay-name = "1MP Mitsubishi Gen 2 Camera";
jetson-header-name = "Jetson AGX CSI Connector";
compatible = JETSON_COMPATIBLE;
};
&capture_vi_base {
status = "okay";
num-channels = <0x08>;
};
&vi_port0 {
status = "okay";
};
&vi_in0 {
status = "okay";
port-index = <0x00>;
vc-id = <0x00>;
bus-width = <0x04>;
};
&csi_chan0 {
status = "okay";
};
&csi_chan0_port0 {
status = "okay";
};
&csi_in0 {
status = "okay";
remote-endpoint = <&mitsubishi_gen2_cam_0_out>;
};
&csi_chan0_port1 {
status = "okay";
};
&csi_out0 {
status = "okay";
};
&{/i2c@3180000/tca9546@70} {
status = "okay";
};
&{/i2c@3180000/tca9546@70/i2c@0} {
i2c-mux,deselect-on-exit;
#address-cells = <0x01>;
#size-cells = <0x00>;
status = "okay";
reg = <0x00>;
max9296@48 {
compatible = "maxim,mitsubishi_max9296";
reg = <0x48>;
status = "okay";
csi-mode = "2x4";
max-src = <0x02>;
reset-gpios = <&tegra_main_gpio TEGRA234_MAIN_GPIO(H, 3) GPIO_ACTIVE_HIGH>;
};
max96701_0_a:max96701_a@40 {
compatible = "maxim,mitsubishi_max96701";
status = "okay";
reg = <0x40>;
maxim,gmsl-dser-device = <&max9296_dser>;
};
mitsubishi_gen2_cam_0@36 {
compatible = "mitsubishi,gen2_cam";
status = "okay";
reg = <0x36>;
use_sensor_mode_id = "false";
gmsl-link {
maxim,gmsl-ser-device = <&max96701_0_a>;
maxim,gmsl-dser-device = <&max9296_dser>;
dst-csi-port = "a";
serdes-csi-link = "a";
csi-mode = "1x4";
st-vc = <0x00>;
vc-id = <0x0>;
num-csi-lanes = <0x04>;
streams = "yuv8";
};
ports {
#address-cells = <0x1>;
#size-cells = <0x0>;
port@0 {
reg = <0x00>;
mitsubishi_gen2_cam_0_out: endpoint {
vc-id = <0x00>;
port-index = <0x00>;
bus-width = <0x04>;
remote-endpoint = <&csi_in0>;
};
};
};
mode0 {
num_lanes = "4";
pix_clk_hz = "42420000";
serdes_pix_clk_hz = "175000000"; /* output frequency = 700 MHz */
csi_pixel_bit_depth = "16";
cil_settletime = "0";
discontinuous_clk = "no";
dpcm_enable = "false";
tegra_sinterface = "serial_a";
active_w = "1280";
active_h = "964";
line_length = "2560";
embedded_metadata_height = "0";
pixel_phase = "uyvy";
mode_type = "yuv";
};
};
};
The camera used here has internal clock so I think no need to set mclk and mclk_khz properties.