Video driver port from TX2 NX (JP4.6.4) to Orin NX (JP5.1.3)

Hi,
I am trying to port a driver for AWR2243 chip. I have it working as expected on Jetson TX2 NX (JetPack 4.6.4) but I have problems on Jetson Orin NX (JP 5.1.3).
Moving to JetPack 6 is not an option at the moment, unless it is the only option.

Driver has been inspired by IMX204 driver.

My first issue was with calling v4l2_async_register_subdev() in the last step of probing.
It caused kernel panic on target startup. I traced the issue to __v4l2_ctrl_handler_setup in v4l2-ctrls.c file.
For some reason “Bypass Mode” control did not have cluster member set and it cause null pointer dereference.
What might be the reason for that?

Then I’ve added a check if cluster pointer is set and if not just to skip the control.
NOTE: I’ve added some debug logs and only “Bypass Mode” has the issue, other controls have cluster member set.
That worked and the driver successfully probed device.

Boot log looks fine:

$ sudo dmesg | grep tegra-c 
[    6.285424] t19x_cache tegra-cache: probed
[    7.231386] tegra-camrtc-capture-vi tegra-capture-vi: subdev 13e40000.host1x:nvcsi@15a00000- bound
[    7.240601] tegra-camrtc-capture-vi tegra-capture-vi: subdev 13e40000.host1x:nvcsi@15a00000- bound
[    7.249821] tegra-camrtc-capture-vi tegra-capture-vi: subdev 13e40000.host1x:nvcsi@15a00000- bound
[    7.259032] tegra-camrtc-capture-vi tegra-capture-vi: subdev 13e40000.host1x:nvcsi@15a00000- bound
[   13.609177] tegra-camrtc-capture-vi tegra-capture-vi: subdev awr2243 spi1.0 bound
[   13.610833] [AWR2243]: get format tegra-camrtc-capture-vi tegra-captu->awr2243 spi1.0 == 0
[   13.988237] tegra-camrtc-capture-vi tegra-capture-vi: subdev awr2243 spi1.1 bound
[   13.989229] [AWR2243]: get format tegra-camrtc-capture-vi tegra-captu->awr2243 spi1.1 == 0
[   13.991542] tegra-camrtc-capture-vi tegra-capture-vi: subdev awr2243 spi1.2 bound
[   13.993009] [AWR2243]: get format tegra-camrtc-capture-vi tegra-captu->awr2243 spi1.2 == 0
[   13.994248] tegra-camrtc-capture-vi tegra-capture-vi: subdev awr2243 spi1.3 bound
[   13.995250] [AWR2243]: get format tegra-camrtc-capture-vi tegra-captu->awr2243 spi1.3 == 0
[   22.603259] [AWR2243]: input status tegra-camrtc-capture-vi tegra-captu->awr2243 spi1.0
[   22.608443] [AWR2243]: input status tegra-camrtc-capture-vi tegra-captu->awr2243 spi1.1
[   22.613283] [AWR2243]: input status tegra-camrtc-capture-vi tegra-captu->awr2243 spi1.2
[   22.618133] [AWR2243]: input status tegra-camrtc-capture-vi tegra-captu->awr2243 spi1.3

Video devices (/dev/video) are created.

I’ve run media-ctl to verify port binding as suggested in SensorSoftwareDriverProgramming:

$ media-ctl -p
Media controller API version 5.10.192

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

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
		<- "awr2243 spi1.0":0 [ENABLED]
	pad1: Source
		-> "vi-output, awr2243 spi1.0":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
		<- "awr2243 spi1.1":0 [ENABLED]
	pad1: Source
		-> "vi-output, awr2243 spi1.1":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
		<- "awr2243 spi1.2":0 [ENABLED]
	pad1: Source
		-> "vi-output, awr2243 spi1.2":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
		<- "awr2243 spi1.3":0 [ENABLED]
	pad1: Source
		-> "vi-output, awr2243 spi1.3":0 [ENABLED]

- entity 13: awr2243 spi1.0 (1 pad, 1 link)
             type V4L2 subdev subtype Sensor flags 0
             device node name /dev/v4l-subdev4
	pad0: Source
		[fmt:SRGGB8_1X8/2048x32 field:none colorspace:srgb]
		-> "13e40000.host1x:nvcsi@15a00000-":0 [ENABLED]

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

- entity 33: awr2243 spi1.1 (1 pad, 1 link)
             type V4L2 subdev subtype Sensor flags 0
             device node name /dev/v4l-subdev5
	pad0: Source
		[fmt:SRGGB8_1X8/2048x32 field:none colorspace:srgb]
		-> "13e40000.host1x:nvcsi@15a00000-":0 [ENABLED]

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

- entity 45: awr2243 spi1.2 (1 pad, 1 link)
             type V4L2 subdev subtype Sensor flags 0
             device node name /dev/v4l-subdev6
	pad0: Source
		[fmt:SRGGB8_1X8/2048x32 field:none colorspace:srgb]
		-> "13e40000.host1x:nvcsi@15a00000-":0 [ENABLED]

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

- entity 57: awr2243 spi1.3 (1 pad, 1 link)
             type V4L2 subdev subtype Sensor flags 0
             device node name /dev/v4l-subdev7
	pad0: Source
		[fmt:SRGGB8_1X8/2048x32 field:none colorspace:srgb]
		-> "13e40000.host1x:nvcsi@15a00000-":0 [ENABLED]

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

Next problem I have is when running v4l2-complience:

v4l2-compliance 
v4l2-compliance SHA: not available, 64 bits

Compliance test for tegra-video device /dev/video0:

Driver Info:
	Driver name      : tegra-video
	Card type        : vi-output, awr2243 spi1.0
	Bus info         : platform:tegra-capture-vi:0
	Driver version   : 5.10.192
	Capabilities     : 0x84200001
		Video Capture
		Streaming
		Extended Pix Format
		Device Capabilities
	Device Caps      : 0x04200001
		Video Capture
		Streaming
		Extended Pix Format
Media Driver Info:
	Driver name      : tegra-camrtc-ca
	Model            : NVIDIA Tegra Video Input Device
	Serial           : 
	Bus info         : 
	Media version    : 5.10.192
	Hardware revision: 0x00000003 (3)
	Driver version   : 5.10.192
Interface Info:
	ID               : 0x03000011
	Type             : V4L Video
Entity Info:
	ID               : 0x0000000f (15)
	Name             : vi-output, awr2243 spi1.0
	Function         : V4L2 I/O
	Pad 0x01000010   : 0: Sink
	  Link 0x02000015: from remote pad 0x1000003 of entity '13e40000.host1x:nvcsi@15a00000-': Data, Enabled

Required ioctls:
	test MC information (see 'Media Driver Info' above): OK
	test VIDIOC_QUERYCAP: OK

Allow for multiple opens:
	test second /dev/video0 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)

Control ioctls (Input 0):
	test VIDIOC_QUERY_EXT_CTRL/QUERYMENU: OK
	test VIDIOC_QUERYCTRL: OK
	test VIDIOC_G/S_CTRL: OK
		fail: v4l2-test-controls.cpp(663): g_ext_ctrls returned an error (22)
	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: 20

Format ioctls (Input 0):
	test VIDIOC_ENUM_FMT/FRAMESIZES/FRAMEINTERVALS: OK
		fail: v4l2-test-formats.cpp(1280): ret && node->has_frmintervals
	test VIDIOC_G/S_PARM: FAIL
	test VIDIOC_G_FBUF: OK (Not Supported)
	test VIDIOC_G_FMT: OK
	test VIDIOC_TRY_FMT: OK
	test VIDIOC_S_FMT: OK
	test VIDIOC_G_SLICED_VBI_CAP: OK (Not Supported)
	test Cropping: OK (Not Supported)
	test Composing: OK (Not Supported)
	test Scaling: OK (Not Supported)

Codec ioctls (Input 0):
	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 (Input 0):
		fail: v4l2-test-buffers.cpp(715): q.create_bufs(node, 1, &fmt) != EINVAL
	test VIDIOC_REQBUFS/CREATE_BUFS/QUERYBUF: FAIL
	test VIDIOC_EXPBUF: OK
	test Requests: OK (Not Supported)

Total for tegra-video device /dev/video0: 45, Succeeded: 42, Failed: 3, Warnings: 0

I don’t care about VIDIOC_G/S_PARM because that one failed on TX2 NX and capturing still worked, but VIDIOC_G/S/TRY_EXT_CTRLS: and especially VIDIOC_REQBUFS/CREATE_BUFS/QUERYBUF have to pass.

Output of v4l2-ctl:

v4l2-ctl --all
Driver Info:
	Driver name      : tegra-video
	Card type        : vi-output, awr2243 spi1.0
	Bus info         : platform:tegra-capture-vi:0
	Driver version   : 5.10.192
	Capabilities     : 0x84200001
		Video Capture
		Streaming
		Extended Pix Format
		Device Capabilities
	Device Caps      : 0x04200001
		Video Capture
		Streaming
		Extended Pix Format
Media Driver Info:
	Driver name      : tegra-camrtc-ca
	Model            : NVIDIA Tegra Video Input Device
	Serial           : 
	Bus info         : 
	Media version    : 5.10.192
	Hardware revision: 0x00000003 (3)
	Driver version   : 5.10.192
Interface Info:
	ID               : 0x03000011
	Type             : V4L Video
Entity Info:
	ID               : 0x0000000f (15)
	Name             : vi-output, awr2243 spi1.0
	Function         : V4L2 I/O
	Pad 0x01000010   : 0: Sink
	  Link 0x02000015: from remote pad 0x1000003 of entity '13e40000.host1x:nvcsi@15a00000-': Data, Enabled
Priority: 2
Video input : 0 (Camera 0: no power)
Format Video Capture:
	Width/Height      : 2048/32
	Pixel Format      : 'RGGB' (8-bit Bayer RGRG/GBGB)
	Field             : None
	Bytes per Line    : 2048
	Size Image        : 65536
	Colorspace        : sRGB
	Transfer Function : Default (maps to sRGB)
	YCbCr/HSV Encoding: Default (maps to ITU-R 601)
	Quantization      : Default (maps to Full Range)
	Flags             : 

Camera Controls

                   frame_length 0x009a2000 (int)    : min=0 max=65535 step=1 default=3665 value=3665 flags=slider
                    coarse_time 0x009a2001 (int)    : min=1 max=65525 step=1 default=3655 value=3655 flags=slider
                     group_hold 0x009a2003 (intmenu): min=0 max=1 default=0 value=0
				0: 0 (0x0)
				1: 1 (0x1)
                     hdr_enable 0x009a2004 (intmenu): min=0 max=1 default=0 value=0
				0: 0 (0x0)
				1: 1 (0x1)
                           gain 0x009a2009 (int)    : min=256 max=5888 step=1 default=256 value=256 flags=slider
           sensor_configuration 0x009a2032 (u32)    : min=0 max=4294967295 step=1 default=0 [22] flags=read-only, volatile, has-payload
         sensor_mode_i2c_packet 0x009a2033 (u32)    : min=0 max=4294967295 step=1 default=0 [1026] flags=read-only, volatile, has-payload
      sensor_control_i2c_packet 0x009a2034 (u32)    : min=0 max=4294967295 step=1 default=0 [1026] flags=read-only, volatile, has-payload
                 vi_bypass_mode 0x009a2064 (int)    : min=0 max=1 step=1 default=1 value=1 flags=slider
                override_enable 0x009a2065 (intmenu): min=0 max=1 default=0 value=0
				0: 0 (0x0)
				1: 1 (0x1)
                   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
				0: 1 (0x1)
				1: 65536 (0x10000)
				2: 131072 (0x20000)
               write_isp_format 0x009a2068 (int)    : min=1 max=1 step=1 default=1 value=1
       sensor_signal_properties 0x009a2069 (u32)    : min=0 max=4294967295 step=1 default=0 [30][18] flags=read-only, has-payload
        sensor_image_properties 0x009a206a (u32)    : min=0 max=4294967295 step=1 default=0 [30][16] flags=read-only, has-payload
      sensor_control_properties 0x009a206b (u32)    : min=0 max=4294967295 step=1 default=0 [30][36] flags=read-only, has-payload
              sensor_dv_timings 0x009a206c (u32)    : min=0 max=4294967295 step=1 default=0 [30][16] 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=26 flags=read-only

When I try to capture with our app I get these errors:

Required memory if buffer gets full: 2013.27 MB
Available memory: 14799.2 MB
Required storage for capture: 2516.58 MB
Available storage: 445887 MB
Device 0 is /dev/awr4
Device 1 is /dev/awr1
Device 2 is /dev/awr3
Device 3 is /dev/awr2

[NOTICE] /home/provizio/development/apt_radar/src/libv4l2cpp/src/V4l2MmapDevice.cpp:49
VIDIOC_REQBUFS: Inappropriate ioctl for device
	Device /dev/awr4
[NOTICE] /home/provizio/development/apt_radar/src/libv4l2cpp/src/V4l2MmapDevice.cpp:141
VIDIOC_STREAMOFF: Inappropriate ioctl for device
VIDIOC_REQBUFS: Inappropriate ioctl for device
	Device /dev/awr4
[NOTICE] /home/provizio/development/apt_radar/src/libv4l2cpp/src/V4l2MmapDevice.cpp:49
VIDIOC_REQBUFS: Inappropriate ioctl for device
	Device /dev/awr1
[NOTICE] /home/provizio/development/apt_radar/src/libv4l2cpp/src/V4l2MmapDevice.cpp:141
VIDIOC_STREAMOFF: Inappropriate ioctl for device
VIDIOC_REQBUFS: Inappropriate ioctl for device
	Device /dev/awr1
[NOTICE] /home/provizio/development/apt_radar/src/libv4l2cpp/src/V4l2MmapDevice.cpp:49
VIDIOC_REQBUFS: Inappropriate ioctl for device
	Device /dev/awr3
[NOTICE] /home/provizio/development/apt_radar/src/libv4l2cpp/src/V4l2MmapDevice.cpp:141
VIDIOC_STREAMOFF: Inappropriate ioctl for device
VIDIOC_REQBUFS: Inappropriate ioctl for device
	Device /dev/awr3
[NOTICE] /home/provizio/development/apt_radar/src/libv4l2cpp/src/V4l2MmapDevice.cpp:49
VIDIOC_REQBUFS: Inappropriate ioctl for device
	Device /dev/awr2
[NOTICE] /home/provizio/development/apt_radar/src/libv4l2cpp/src/V4l2MmapDevice.cpp:141
VIDIOC_STREAMOFF: Inappropriate ioctl for device
VIDIOC_REQBUFS: Inappropriate ioctl for device
	Device /dev/awr2a v4l2 device == nullptr, can't start
Generating report file...
Exiting...

After that running dmesg I get:

...
[   18.925272] NVRM: Try unloading the conflicting kernel module (and/or
               NVRM: reconfigure your kernel without the conflicting
               NVRM: driver(s)), then try loading the NVIDIA kernel module
               NVRM: again.
[   18.925274] NVRM: No NVIDIA devices probed.
[   19.934961] igb 0001:01:00.0 eth0: igb: eth0 NIC Link is Up 1000 Mbps Full Duplex, Flow Control: RX/TX
[   20.258718] IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready
[   22.926173] [AWR2243]: open
[   22.926239] [AWR2243]: open
[   22.926337] [AWR2243]: open
[   22.926408] [AWR2243]: open
[   22.929836] [AWR2243]: input status tegra-camrtc-capture-vi tegra-captu->awr2243 spi1.0
[   22.935119] [AWR2243]: input status tegra-camrtc-capture-vi tegra-captu->awr2243 spi1.1
[   22.940120] [AWR2243]: input status tegra-camrtc-capture-vi tegra-captu->awr2243 spi1.2
[   22.945079] [AWR2243]: input status tegra-camrtc-capture-vi tegra-captu->awr2243 spi1.3

What might be the reason for this issue?

Appreciate the help.

Maybe use JP5.x sensor driver as template to implement a new one to try.

Below is my v4l2-complie result and capture without problem.

nvidia@nvidia-desktop:~$ v4l2-compliance
v4l2-compliance SHA: not available, 64 bits

Compliance test for tegra-video device /dev/video0:

Driver Info:
        Driver name      : tegra-video
        Card type        : vi-output, imx477 9-001a
        Bus info         : platform:tegra-capture-vi:1
        Driver version   : 5.10.120
        Capabilities     : 0x84200001
                Video Capture
                Streaming
                Extended Pix Format
                Device Capabilities
        Device Caps      : 0x04200001
                Video Capture
                Streaming
                Extended Pix Format
Media Driver Info:
        Driver name      : tegra-camrtc-ca
        Model            : NVIDIA Tegra Video Input Device
        Serial           :
        Bus info         :
        Media version    : 5.10.120
        Hardware revision: 0x00000003 (3)
        Driver version   : 5.10.120
Interface Info:
        ID               : 0x0300000b
        Type             : V4L Video
Entity Info:
        ID               : 0x00000009 (9)
        Name             : vi-output, imx477 9-001a
        Function         : V4L2 I/O
        Pad 0x0100000a   : 0: Sink
          Link 0x0200000f: from remote pad 0x1000003 of entity '13e40000.host1x:nvcsi@15a00000-': Data, Enabled

Required ioctls:
        test MC information (see 'Media Driver Info' above): OK
        test VIDIOC_QUERYCAP: OK

Allow for multiple opens:
        test second /dev/video0 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)

Control ioctls (Input 0):
        test VIDIOC_QUERY_EXT_CTRL/QUERYMENU: OK
        test VIDIOC_QUERYCTRL: OK
        test VIDIOC_G/S_CTRL: OK
        test VIDIOC_G/S/TRY_EXT_CTRLS: OK
        test VIDIOC_(UN)SUBSCRIBE_EVENT/DQEVENT: OK
        test VIDIOC_G/S_JPEGCOMP: OK (Not Supported)
        Standard Controls: 1 Private Controls: 20

Format ioctls (Input 0):
        test VIDIOC_ENUM_FMT/FRAMESIZES/FRAMEINTERVALS: OK
                fail: v4l2-test-formats.cpp(1280): ret && node->has_frmintervals
        test VIDIOC_G/S_PARM: FAIL
        test VIDIOC_G_FBUF: OK (Not Supported)
        test VIDIOC_G_FMT: OK
        test VIDIOC_TRY_FMT: OK
        test VIDIOC_S_FMT: OK
        test VIDIOC_G_SLICED_VBI_CAP: OK (Not Supported)
        test Cropping: OK (Not Supported)
        test Composing: OK (Not Supported)
        test Scaling: OK (Not Supported)

Codec ioctls (Input 0):
        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 (Input 0):
                fail: v4l2-test-buffers.cpp(715): q.create_bufs(node, 1, &fmt) != EINVAL
        test VIDIOC_REQBUFS/CREATE_BUFS/QUERYBUF: FAIL
        test VIDIOC_EXPBUF: OK
        test Requests: OK (Not Supported)

Total for tegra-video device /dev/video0: 45, Succeeded: 43, Failed: 2, Warnings: 0

Hi ShaneCCC.

As I mentioned in my first post drivers has been written using driver template, just not for IMX477 but IMX204 because IMX477 uses I2C and IMX204 uses SPI. (kernel/nvidia/drivers/media/spi/imx204.c)
Driver for IMX204 exists in both JP versions.

That said I did try to make a driver based on IMX477 just to see what wold happen and actually nothing happened.
Driver’s probe function was never executed, which to me made sense since there is no MUX on I2C bus.

Do you have any other suggestions?

Suppose imx204 didn’t update to V2.x but nv_imx477/nv_imx219/nv_ov5693 are the newest.

For the I2C device tree configuration. You can just use the one from J4.x

Is it a problem if v4l v1 driver is being used in JP5? Do I have to switch to v2 driver?

I never used I2C device tree configuration. Only SPI.

I would suggest migrate to v2, current we don’t maintain and verify the v1.

I mean you can keep apply the JP4.x SPI device tree to JP5.x

Thank you for the clarification.

Are you sure v2 driver supports SPI devices?
I am asking because when I was looking into imx477 and other v2 drivers they all use I2C and tegra_cam_device structure used in probe functions has member pointer to i2c_client structure.
Is there a working and verified v2 driver that uses SPI I can use as a baseline?

Sorry I can’t promise it. May need your help to clarify it.

Thanks

Hi Shane,

not sure how I can help you since I am asking for help but if there is something I can do please let me know.

I mean need you help try to migrate to v2 for the SPI case.

Thanks

Ok, let me make a summary, hopefully it will help someone else in the similar situation.
What I understand so far:

  1. NVidia doesn’t maintain and verify v1 of the v4l drivers.
  2. Only driver that can be used as a template for SPI based driver is imx204 and it is v1 and therefore not verified and should not be used as a template.
  3. If someone needs v2 v4l SPI based driver they should write it themselves without access to any template or instructions provided by NVidia.

Did I get everything correct? Please correct me if I am wrong.
Thank you.

Hi ShaneCCC

I think there was enough time to answer. I’ll take the silence as confirmation.

In the mean time I made some progress with the driver.
IOCTL issues seem to be resolved.

Now I have issues capturing the frames.
I’ve attached full logs.
log_debug.txt (81.7 KB)
log_grabbing.txt (9.2 KB)
Summary:

[  235.271844] bwmgr API not supported
[  235.301385] bwmgr API not supported
[  235.321648] bwmgr API not supported
[  235.341840] bwmgr API not supported
[  235.357176] tegra-camrtc-capture-vi tegra-capture-vi: corr_err: discarding frame 0, flags: 0, err_data 262144
[  235.357195] tegra-camrtc-capture-vi tegra-capture-vi: corr_err: discarding frame 0, flags: 0, err_data 262144
[  235.457241] tegra-camrtc-capture-vi tegra-capture-vi: corr_err: discarding frame 0, flags: 0, err_data 262144
[  235.457395] tegra-camrtc-capture-vi tegra-capture-vi: corr_err: discarding frame 0, flags: 0, err_data 262144
[  238.006627] tegra-camrtc-capture-vi tegra-capture-vi: uncorr_err: request timed out after 2500 ms
[  238.006634] tegra-camrtc-capture-vi tegra-capture-vi: uncorr_err: request timed out after 2500 ms
[  238.006645] tegra-camrtc-capture-vi tegra-capture-vi: err_rec: attempting to reset the capture channel
[  238.006685] tegra-camrtc-capture-vi tegra-capture-vi: uncorr_err: request timed out after 2500 ms
[  238.006690] tegra-camrtc-capture-vi tegra-capture-vi: err_rec: attempting to reset the capture channel
[  238.006705] (NULL device *): vi_capture_control_message: NULL VI channel received
[  238.006708] t194-nvcsi 13e40000.host1x:nvcsi@15a00000: csi5_stream_close: Error in closing stream_id=0, csi_port=0
[  238.006711] (NULL device *): vi_capture_control_message: NULL VI channel received
[  238.006779] tegra-camrtc-capture-vi tegra-capture-vi: uncorr_err: request timed out after 2500 ms
[  238.006787] tegra-camrtc-capture-vi tegra-capture-vi: err_rec: attempting to reset the capture channel
[  238.006803] (NULL device *): vi_capture_control_message: NULL VI channel received
[  238.006807] t194-nvcsi 13e40000.host1x:nvcsi@15a00000: csi5_stream_close: Error in closing stream_id=1, csi_port=1
[  238.006810] (NULL device *): vi_capture_control_message: NULL VI channel received
[  238.007653] tegra-camrtc-capture-vi tegra-capture-vi: err_rec: successfully reset the capture channel
[  238.007677] tegra-camrtc-capture-vi tegra-capture-vi: err_rec: successfully reset the capture channel
[  238.015817] tegra-camrtc-capture-vi tegra-capture-vi: err_rec: attempting to reset the capture channel

After few reset tries kernel panic happens and system crashes. (see attached logs for full info).

Any suggestions on how to debug the issue?

Get the trace log to check if more clue.

https://elinux.org/Jetson/l4t/Camera_BringUp#Steps_to_enable_more_debug_messages

Thank you Shane.

I’ve attached the trace log.
log_trace.txt (5.5 MB)

The error tell SOT(Start Of Transfer) multiple bits error.
It could be the MIPI timing issue.

     kworker/4:2-184     [004] ....   265.277258: rtcpu_nvcsi_intr: tstamp:8794892489 class:GLOBAL type:PHY_INTR0 phy:1 cil:1 st:0 vc:0 status:0x00000044

We are still working on the driver so I am keeping the topic open.
Thank you Shane for the previous suggestion.

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