`VIFALC_TDSTATE` during Orin module camera bringup

Hello,

I am working on bringing up the Orin industrial module on a custom carrier board (L4T 35.1). My camera driver, which works well on the Orin devkit, does not work on the module. Our camera system comprises:

  • Sony IMX490 sensor
  • TI953 FPDLinkIII serializer
  • TI954 FPDLinkIII deserializer

Here’s a devicetree excerpt for one of our camera nodes:

        imx490_a@1b { 
            clock-names = "extperiph1", "pllp_grtba"; 
            clocks = <0x02 0x24>, < 0x02 0x24>; 
            compatible = "nvidia,imx490"; 
            def-addr = <0x1a>; 
            devnode = "video0"; 
            mclk = "extperiph1"; 
            physical_h = "12.5"; 
            physical_w = "15.0"; 
            post_crop_frame_drop = "0"; 
            reg = <0x1b>; 
            sensor_model = "imx490"; 
            use_decibel_gain = "true"; 
            use_sensor_mode_id = "true"; 
            mode0 { 
                active_h = "1860"; 
                active_w = "2880"; 
                cil_settletime = "0"; 
                control_point_x_0 = "0"; 
                control_point_x_1 = "800"; 
                control_point_x_2 = "1600"; 
                control_point_x_3 = "4400"; 
                control_point_x_4 = "13000"; 
                control_point_x_5 = "40000"; 
                control_point_x_6 = "120000"; 
                control_point_x_7 = "350080"; 
                control_point_x_8 = "1048576"; 
                control_point_y_0 = "0"; 
                control_point_y_1 = "400"; 
                control_point_y_2 = "600"; 
                control_point_y_3 = "950"; 
                control_point_y_4 = "1380"; 
                control_point_y_5 = "1920"; 
                control_point_y_6 = "2545"; 
                control_point_y_7 = "3264"; 
                control_point_y_8 = "4080"; 
                csi_pixel_bit_depth = "12"; 
                default_exp_time = "11000"; 
                default_framerate = "20000000"; 
                default_gain = "1800"; 
                discontinuous_clk = "no"; 
                dpcm_enable = "false"; 
                dynamic_pixel_bit_depth = "20"; 
                embedded_metadata_height = "1"; 
                exposure_factor = "1000000"; 
                framerate_factor = "1000000"; 
                gain_factor = "100"; 
                inherent_gain = "1"; 
                line_length = "3330"; 
                max_exp_time = "30000"; 
                max_framerate = "20000000"; 
                max_gain_val = "1800"; 
                max_hdr_ratio = "64.0"; 
                mclk_khz = "24000"; 
                mclk_multiplier = "14.58"; 
                min_exp_time = "2"; 
                min_framerate = "20000000"; 
                min_gain_val = "1800"; 
                min_hdr_ratio = "64.0"; 
                mode_type = "bayer_wdr_pwl"; 
                num_control_point = "9"; 
                num_lanes = "2"; 
                pix_clk_hz = "133200000"; 
                pixel_phase = "rggb"; 
                readout_orientation = "0"; 
                serdes_pix_clk_hz = "133333333"; 
                step_exp_time = "1"; 
                step_framerate = "1"; 
                step_gain_val = "1"; 
                tegra_sinterface = "serial_a"; 
                vc_id = "0"; 
            }; 
            ports { 
                #address-cells = <0x01>; 
                #size-cells = <0x00>; 
                port@0 { 
                    reg = <0x00>; 
                    imx490_imx490_out0: endpoint { 
                        bus-width = <0x02>; 
                        phandle = <0x2a0>; 
                        port-index = <0x00>; 
                        remote-endpoint = <0x06>; 
                        vc-id = <0x00>; 
                    }; 
                }; 
            }; 
        };

I can generate error with this command (which does not return):

2023-09-14T19:42:49+0000 root@JETSON:~ $ v4l2-ctl -d /dev/video0 --set-fmt-video=width=2880,height=1860,pixelformat=RG12 --stream-count=1 --stream-mmap --stream-to=csi.raw --verbose
VIDIOC_QUERYCAP: ok
VIDIOC_G_FMT: ok
VIDIOC_S_FMT: ok
Format Video Capture:
	Width/Height      : 2880/1860
	Pixel Format      : 'RG12' (12-bit Bayer RGRG/GBGB)
	Field             : None
	Bytes per Line    : 5760
	Size Image        : 10713600
	Colorspace        : sRGB
	Transfer Function : Default (maps to sRGB)
	YCbCr/HSV Encoding: Default (maps to ITU-R 601)
	Quantization      : Default (maps to Full Range)
	Flags             :
		VIDIOC_REQBUFS returned 0 (Success)
		VIDIOC_QUERYBUF returned 0 (Success)
		VIDIOC_QUERYBUF returned 0 (Success)
		VIDIOC_QUERYBUF returned 0 (Success)
		VIDIOC_QUERYBUF returned 0 (Success)
		VIDIOC_QBUF returned 0 (Success)
		VIDIOC_QBUF returned 0 (Success)
		VIDIOC_QBUF returned 0 (Success)
		VIDIOC_QBUF returned 0 (Success)
		VIDIOC_STREAMON returned 0 (Success)
cap dqbuf: 0 seq:      0 bytesused: 10713600 ts: 0.000000 (error, ts-monotonic, ts-src-eof)
cap dqbuf: 0 seq:      0 bytesused: 10713600 ts: 0.000000 (error, ts-monotonic, ts-src-eof)
cap dqbuf: 1 seq:      1 bytesused: 10713600 ts: 0.000000 (error, ts-monotonic, ts-src-eof)
cap dqbuf: 2 seq:      2 bytesused: 10713600 ts: 0.000000 (error, ts-monotonic, ts-src-eof)
cap dqbuf: 3 seq:      3 bytesused: 10713600 ts: 0.000000 (error, ts-monotonic, ts-src-eof)
cap dqbuf: 0 seq:      0 bytesused: 10713600 ts: 0.000000 (error, ts-monotonic, ts-src-eof)
cap dqbuf: 0 seq:      0 bytesused: 10713600 ts: 0.000000 (error, ts-monotonic, ts-src-eof)
cap dqbuf: 1 seq:      1 bytesused: 10713600 ts: 0.000000 (error, ts-monotonic, ts-src-eof)
cap dqbuf: 2 seq:      2 bytesused: 10713600 ts: 0.000000 (error, ts-monotonic, ts-src-eof)
cap dqbuf: 3 seq:      3 bytesused: 10713600 ts: 0.000000 (error, ts-monotonic, ts-src-eof)
^C

Here’s trace:

2023-09-14T19:42:41+0000 root@JETSON:~ $ cat /sys/kernel/debug/tracing/trace
# tracer: nop
#
# entries-in-buffer/entries-written: 37/37   #P:12
#
#                                _-----=> irqs-off
#                               / _----=> need-resched
#                              | / _---=> hardirq/softirq
#                              || / _--=> preempt-depth
#                              ||| /     delay
#           TASK-PID     CPU#  ||||   TIMESTAMP  FUNCTION
#              | |         |   ||||      |         |
     kworker/4:0-2242    [004] ....  2956.288819: rtcpu_string: tstamp:93076672123 id:0x04010000 str:"VM0 deactivating."
        v4l2-ctl-5260    [004] ....  2996.466235: tegra_channel_open: vi-output, imx490 0-001b
        v4l2-ctl-5260    [004] ....  2996.477647: tegra_channel_set_power: imx490 0-001b : 0x1
        v4l2-ctl-5260    [004] ....  2996.477659: camera_common_s_power: status : 0x1
        v4l2-ctl-5260    [004] ....  2996.500226: tegra_channel_set_power: 13e40000.host1x:nvcsi@15a00000- : 0x1
        v4l2-ctl-5260    [004] ....  2996.500229: csi_s_power: enable : 0x1
        v4l2-ctl-5260    [004] ....  2996.501310: tegra_channel_capture_setup: vnc_id 0 W 2880 H 1860 fmt c4
     kworker/4:0-2242    [004] ....  2996.507676: rtcpu_string: tstamp:94335069078 id:0x04010000 str:"VM0 activating."
        v4l2-ctl-5260    [005] ....  2996.514776: tegra_channel_set_stream: enable : 0x1
        v4l2-ctl-5260    [005] ....  2996.530467: tegra_channel_set_stream: 13e40000.host1x:nvcsi@15a00000- : 0x1
        v4l2-ctl-5260    [005] ....  2996.530472: csi_s_stream: enable : 0x1
        v4l2-ctl-5260    [005] ....  2996.530775: tegra_channel_set_stream: imx490 0-001b : 0x1
     kworker/4:0-2242    [004] ....  2996.563686: rtcpu_vinotify_event: tstamp:94335619795 cch:0 vi:0 tag:VIFALC_TDSTATE channel:0x23 frame:0 vi_tstamp:3018730945792 data:0x359d580010000000
     kworker/4:0-2242    [004] ....  2996.563688: rtcpu_vinotify_event: tstamp:94335619974 cch:0 vi:0 tag:VIFALC_TDSTATE channel:0x23 frame:0 vi_tstamp:3018730951168 data:0x0000000031000001
     kworker/4:0-2242    [004] ....  2996.563688: rtcpu_vinotify_event: tstamp:94335620167 cch:0 vi:0 tag:VIFALC_TDSTATE channel:0x23 frame:0 vi_tstamp:3018731005824 data:0x359d550010000000
     kworker/4:0-2242    [004] ....  2996.563689: rtcpu_vinotify_event: tstamp:94335620333 cch:0 vi:0 tag:VIFALC_TDSTATE channel:0x23 frame:0 vi_tstamp:3018731011264 data:0x0000000031000002
 vi-output, imx4-5262    [004] ....  2999.221013: tegra_channel_capture_setup: vnc_id 0 W 2880 H 1860 fmt c4
     kworker/4:0-2242    [004] ....  2999.251616: rtcpu_vinotify_event: tstamp:94420130957 cch:0 vi:0 tag:VIFALC_TDSTATE channel:0x23 frame:0 vi_tstamp:3021437822752 data:0x359d580010000000
     kworker/4:0-2242    [004] ....  2999.251617: rtcpu_vinotify_event: tstamp:94420131095 cch:0 vi:0 tag:VIFALC_TDSTATE channel:0x23 frame:0 vi_tstamp:3021437828128 data:0x0000000031000001
     kworker/4:0-2242    [004] ....  2999.251617: rtcpu_vinotify_event: tstamp:94420131249 cch:0 vi:0 tag:VIFALC_TDSTATE channel:0x23 frame:0 vi_tstamp:3021437870368 data:0x359d550010000000
     kworker/4:0-2242    [004] ....  2999.251618: rtcpu_vinotify_event: tstamp:94420131381 cch:0 vi:0 tag:VIFALC_TDSTATE channel:0x23 frame:0 vi_tstamp:3021437875840 data:0x0000000031000002
 vi-output, imx4-5262    [004] ....  3001.765866: tegra_channel_capture_setup: vnc_id 0 W 2880 H 1860 fmt c4
     kworker/4:0-2242    [004] ....  3001.827556: rtcpu_vinotify_event: tstamp:94499633855 cch:0 vi:0 tag:VIFALC_TDSTATE channel:0x23 frame:0 vi_tstamp:3023982810528 data:0x359d580010000000
     kworker/4:0-2242    [004] ....  3001.827557: rtcpu_vinotify_event: tstamp:94499633997 cch:0 vi:0 tag:VIFALC_TDSTATE channel:0x23 frame:0 vi_tstamp:3023982815872 data:0x0000000031000001
     kworker/4:0-2242    [004] ....  3001.827557: rtcpu_vinotify_event: tstamp:94499634152 cch:0 vi:0 tag:VIFALC_TDSTATE channel:0x23 frame:0 vi_tstamp:3023982858144 data:0x359d550010000000
     kworker/4:0-2242    [004] ....  3001.827557: rtcpu_vinotify_event: tstamp:94499634284 cch:0 vi:0 tag:VIFALC_TDSTATE channel:0x23 frame:0 vi_tstamp:3023982863584 data:0x0000000031000002
        v4l2-ctl-5260    [005] ....  3002.635779: tegra_channel_close: vi-output, imx490 0-001b
 vi-output, imx4-5262    [001] ....  3004.294006: tegra_channel_capture_setup: vnc_id 0 W 2880 H 1860 fmt c4
        v4l2-ctl-5260    [005] ....  3004.294608: tegra_channel_set_stream: enable : 0x0
        v4l2-ctl-5260    [005] ....  3004.294612: tegra_channel_set_stream: imx490 0-001b : 0x0
        v4l2-ctl-5260    [005] ....  3004.295216: tegra_channel_set_stream: 13e40000.host1x:nvcsi@15a00000- : 0x0
        v4l2-ctl-5260    [005] ....  3004.295221: csi_s_stream: enable : 0x0
        v4l2-ctl-5260    [000] ....  3004.307593: tegra_channel_set_power: imx490 0-001b : 0x0
        v4l2-ctl-5260    [000] ....  3004.307606: camera_common_s_power: status : 0x0
        v4l2-ctl-5260    [000] ....  3004.307850: tegra_channel_set_power: 13e40000.host1x:nvcsi@15a00000- : 0x0
        v4l2-ctl-5260    [000] ....  3004.307852: csi_s_power: enable : 0x0
     kworker/4:0-2242    [004] ....  3010.343380: rtcpu_string: tstamp:94767163821 id:0x04010000 str:"VM0 deactivating."

Kernel ringbuf:

...
[ 3350.172526] bwmgr API not supported
[ 3352.732676] tegra-camrtc-capture-vi tegra-capture-vi: uncorr_err: request timed out after 2500 ms
[ 3352.733089] tegra-camrtc-capture-vi tegra-capture-vi: err_rec: attempting to reset the capture channel
[ 3352.748698] (NULL device *): vi_capture_control_message: NULL VI channel received
[ 3352.748925] t194-nvcsi 13e40000.host1x:nvcsi@15a00000: csi5_stream_close: Error in closing stream_id=0, csi_port=0
[ 3352.749224] (NULL device *): vi_capture_control_message: NULL VI channel received
[ 3352.749435] t194-nvcsi 13e40000.host1x:nvcsi@15a00000: csi5_stream_open: VI channel not found for stream- 0 vc- 0
[ 3352.749907] tegra-camrtc-capture-vi tegra-capture-vi: err_rec: successfully reset the capture channel
[ 3355.260627] tegra-camrtc-capture-vi tegra-capture-vi: uncorr_err: request timed out after 2500 ms
[ 3355.260931] tegra-camrtc-capture-vi tegra-capture-vi: err_rec: attempting to reset the capture channel
[ 3355.261614] (NULL device *): vi_capture_control_message: NULL VI channel received
[ 3355.261846] t194-nvcsi 13e40000.host1x:nvcsi@15a00000: csi5_stream_close: Error in closing stream_id=0, csi_port=0
[ 3355.262161] (NULL device *): vi_capture_control_message: NULL VI channel received
[ 3355.262387] t194-nvcsi 13e40000.host1x:nvcsi@15a00000: csi5_stream_open: VI channel not found for stream- 0 vc- 0
[ 3355.263077] tegra-camrtc-capture-vi tegra-capture-vi: err_rec: successfully reset the capture channel

media-ctl outputs:

2023-09-14T19:49:14+0000 root@JETSON:~ $ media-ctl -p -d /dev/media0
Media controller API version 5.10.120

Media device information
------------------------
driver          tegra-camrtc-ca
model           NVIDIA Tegra Video Input Device
serial
bus info
hw revision     0x3
driver version  5.10.120

Device topology
- entity 1: 13e40000.host1x:nvcsi@15a00000- (2 pads, 2 links)
            type V4L2 subdev subtype Unknown flags 0
            device node name /dev/v4l-subdev0
	pad0: Sink
		<- "imx490 0-001b":0 [ENABLED]
	pad1: Source
		-> "vi-output, imx490 0-001b":0 [ENABLED]

- entity 4: 13e40000.host1x:nvcsi@15a00000- (2 pads, 2 links)
            type V4L2 subdev subtype Unknown flags 0
            device node name /dev/v4l-subdev1
	pad0: Sink
		<- "imx490 0-001c":0 [ENABLED]
	pad1: Source
		-> "vi-output, imx490 0-001c":0 [ENABLED]

- entity 7: 13e40000.host1x:nvcsi@15a00000- (2 pads, 2 links)
            type V4L2 subdev subtype Unknown flags 0
            device node name /dev/v4l-subdev2
	pad0: Sink
		<- "imx490 1-001b":0 [ENABLED]
	pad1: Source
		-> "vi-output, imx490 1-001b":0 [ENABLED]

- entity 10: 13e40000.host1x:nvcsi@15a00000- (2 pads, 2 links)
             type V4L2 subdev subtype Unknown flags 0
             device node name /dev/v4l-subdev3
	pad0: Sink
		<- "imx490 1-001c":0 [ENABLED]
	pad1: Source
		-> "vi-output, imx490 1-001c":0 [ENABLED]

- entity 13: 13e40000.host1x:nvcsi@15a00000- (2 pads, 2 links)
             type V4L2 subdev subtype Unknown flags 0
             device node name /dev/v4l-subdev4
	pad0: Sink
		<- "imx490 2-001b":0 [ENABLED]
	pad1: Source
		-> "vi-output, imx490 2-001b":0 [ENABLED]

- entity 16: 13e40000.host1x:nvcsi@15a00000- (2 pads, 2 links)
             type V4L2 subdev subtype Unknown flags 0
             device node name /dev/v4l-subdev5
	pad0: Sink
		<- "imx490 2-001c":0 [ENABLED]
	pad1: Source
		-> "vi-output, imx490 2-001c":0 [ENABLED]

- entity 19: imx490 0-001b (1 pad, 1 link)
             type V4L2 subdev subtype Sensor flags 0
             device node name /dev/v4l-subdev6
	pad0: Source
		[fmt:SRGGB12_1X12/2880x1860 field:none colorspace:srgb]
		-> "13e40000.host1x:nvcsi@15a00000-":0 [ENABLED]

- entity 21: vi-output, imx490 0-001b (1 pad, 1 link)
             type Node subtype V4L flags 0
             device node name /dev/video0
	pad0: Sink
		<- "13e40000.host1x:nvcsi@15a00000-":1 [ENABLED]

- entity 43: imx490 0-001c (1 pad, 1 link)
             type V4L2 subdev subtype Sensor flags 0
             device node name /dev/v4l-subdev7
	pad0: Source
		[fmt:SRGGB12_1X12/2880x1860 field:none colorspace:srgb]
		-> "13e40000.host1x:nvcsi@15a00000-":0 [ENABLED]

- entity 45: vi-output, imx490 0-001c (1 pad, 1 link)
             type Node subtype V4L flags 0
             device node name /dev/video1
	pad0: Sink
		<- "13e40000.host1x:nvcsi@15a00000-":1 [ENABLED]

- entity 55: imx490 1-001b (1 pad, 1 link)
             type V4L2 subdev subtype Sensor flags 0
             device node name /dev/v4l-subdev8
	pad0: Source
		[fmt:SRGGB12_1X12/2880x1860 field:none colorspace:srgb]
		-> "13e40000.host1x:nvcsi@15a00000-":0 [ENABLED]

- entity 57: vi-output, imx490 1-001b (1 pad, 1 link)
             type Node subtype V4L flags 0
             device node name /dev/video2
	pad0: Sink
		<- "13e40000.host1x:nvcsi@15a00000-":1 [ENABLED]

- entity 67: imx490 1-001c (1 pad, 1 link)
             type V4L2 subdev subtype Sensor flags 0
             device node name /dev/v4l-subdev9
	pad0: Source
		[fmt:SRGGB12_1X12/2880x1860 field:none colorspace:srgb]
		-> "13e40000.host1x:nvcsi@15a00000-":0 [ENABLED]

- entity 69: vi-output, imx490 1-001c (1 pad, 1 link)
             type Node subtype V4L flags 0
             device node name /dev/video3
	pad0: Sink
		<- "13e40000.host1x:nvcsi@15a00000-":1 [ENABLED]

- entity 79: imx490 2-001b (1 pad, 1 link)
             type V4L2 subdev subtype Sensor flags 0
             device node name /dev/v4l-subdev10
	pad0: Source
		[fmt:SRGGB12_1X12/2880x1860 field:none colorspace:srgb]
		-> "13e40000.host1x:nvcsi@15a00000-":0 [ENABLED]

- entity 81: vi-output, imx490 2-001b (1 pad, 1 link)
             type Node subtype V4L flags 0
             device node name /dev/video4
	pad0: Sink
		<- "13e40000.host1x:nvcsi@15a00000-":1 [ENABLED]

- entity 91: imx490 2-001c (1 pad, 1 link)
             type V4L2 subdev subtype Sensor flags 0
             device node name /dev/v4l-subdev11
	pad0: Source
		[fmt:SRGGB12_1X12/2880x1860 field:none colorspace:srgb]
		-> "13e40000.host1x:nvcsi@15a00000-":0 [ENABLED]

- entity 93: vi-output, imx490 2-001c (1 pad, 1 link)
             type Node subtype V4L flags 0
             device node name /dev/video5
	pad0: Sink
		<- "13e40000.host1x:nvcsi@15a00000-":1 [ENABLED]

hello jack31,

FYI,
20-bit dynamic range of the PWL signal is not supported, the maximum is 16-bit.