Max9295 + max9296 + imx390 serdes camera v4l2 status is no power

Hi all~
i tested custom board and that using max9295 + max9296 + imx390 serdes with two cameras

Screenshot from 2021-01-07 14-27-12

almost same but different thing is Link A is YUV and LINK B is RGB.

first camera is /dev/video0 and modified to YUV and it is works well
2nd camera is /dev/video1 and RG12 as same as reference setting.
but not work and v4l2 status printed ‘no power’
and i teseting gstreamer with v4l2src but it got Internal data stream error.

gst-launch-1.0 v4l2src device=/dev/video0 ! fakesink 
// ...
ERROR: from element /GstPipeline:pipeline0/GstV4l2Src:v4l2src0: Internal data stream error.
Additional debug info:
../libs/gst/base/gstbasesrc.c(3127): gst_base_src_loop (): /GstPipeline:pipeline0/GstV4l2Src:v4l2src0:
streaming stopped, reason not-negotiated (-4)
ERROR: pipeline doesn't want to preroll.

so i checking v4l2-ctl but /dev/video1 status is (no power)

test@test-desktop:~$ v4l2-ctl -d /dev/video1 --all
Driver Info (not using libv4l2):
	Driver name   : tegra-video
	Card type     : vi-output, imx390 2-001c
	Bus info      : platform:15700000.vi:0
	Driver version: 4.9.140
	Capabilities  : 0x84200001
		Video Capture
		Streaming
		Extended Pix Format
		Device Capabilities
	Device Caps   : 0x04200001
		Video Capture
		Streaming
		Extended Pix Format
Priority: 2
Video input : 0 (Camera 0: no power)
Format Video Capture:
	Width/Height      : 1920/720
	Pixel Format      : 'RG12'
	Field             : None
	Bytes per Line    : 3840
	Size Image        : 2764800
	Colorspace        : sRGB
	Transfer Function : Default (maps to sRGB)
	YCbCr/HSV Encoding: Default (maps to ITU-R 601)
	Quantization      : Default (maps to Full Range)

but /dev/video0 is works well

test@test-desktop:~$ v4l2-ctl -d /dev/video0 --all
Driver Info (not using libv4l2):
	Driver name   : tegra-video
	Card type     : vi-output, imx390 2-001b
	Bus info      : platform:15700000.vi:0
	Driver version: 4.9.140
	Capabilities  : 0x84200001
		Video Capture
		Streaming
		Extended Pix Format
		Device Capabilities
	Device Caps   : 0x04200001
		Video Capture
		Streaming
		Extended Pix Format
Priority: 2
Video input : 0 (Camera 0: ok)
Format Video Capture:
	Width/Height      : 1920/720
	Pixel Format      : 'YUYV'
	Field             : None
	Bytes per Line    : 3840
	Size Image        : 2764800
	Colorspace        : sRGB
	Transfer Function : Default (maps to sRGB)
	YCbCr/HSV Encoding: Default (maps to ITU-R 601)
	Quantization      : Default (maps to Limited Range)            : 
// ...

i checked vi4_power_on or off function and dmesg, i2c … but i cant find error or different msg even
not different. and two port are works well when i set only /dev/video0 but /dev/video1 is not work.

what is am i missing?

You can ignore the string “no power” from v4l2-ctl query.
Using below command to capture and get the trace log for analysis.

v4l2-ctl -d /dev/video0 --set-fmt-video=width=1920,height=720,pixelformat=RG12 --set-ctrl bypass_mode=0 --stream-mmap --stream-count=5

cam device has works good but my device has still not work
and i found weird things

root@test-desktop:/sys/kernel/debug# ls | grep imx
imx390_a

imx390_b is not exist and boot log and

 24 02:47:43 test-desktop kernel: [   12.979481] tegra-vi4 15700000.vi: subdev imx390 2-001b bound
Jun 24 02:47:43 test-desktop kernel: [   12.981760] imx390 2-001b: Detected IMX390 sensor
Jun 24 02:47:43 test-desktop kernel: [   12.982280] imx390 2-001c: probing v4l2 sensor.
Jun 24 02:47:43 test-desktop kernel: [   12.982450] imx390 2-001c: couldn't create debugfs
Jun 24 02:47:43 test-desktop kernel: [   12.982454] imx390 2-001c: tegracam sensor driver:imx390_v2.0.6
Jun 24 02:47:43 test-desktop kernel: [   12.982458]  imx390_board_setup reg = 0x1c
Jun 24 02:47:43 test-desktop kernel: [   12.982492]  imx390_board_setup def-addr = 0x1a

// ... 

Jun 24 02:47:43 test-desktop kernel: [   13.939465] tegra-vi4 15700000.vi: subdev imx390 2-001c bound
Jun 24 02:47:43 test-desktop kernel: [   13.940161] imx390 2-001c: Detected IMX390 sensor
Jun 24 02:47:43 test-desktop kernel: [   13.942497] vi4_power_on
Jun 24 02:47:43 test-desktop kernel: [   13.943481] vi4_power_on, ret = 0
Jun 24 02:47:43 test-desktop kernel: [   13.943483] vi4_power_on, cnt = 0
Jun 24 02:47:43 test-desktop kernel: [   13.943485] [tegra_channel_set_power] imx390 2-001c
Jun 24 02:47:43 test-desktop kernel: [   13.943491] camera_common_s_power status = 1
Jun 24 02:47:43 test-desktop kernel: [   13.944159] [tegra_channel_set_power] 150c0000.nvcsi--1
Jun 24 02:47:43 test-desktop kernel: [   13.945875] vi4_power_off
Jun 24 02:47:43 test-desktop kernel: [   13.945878] [tegra_channel_set_power] imx390 2-001c
Jun 24 02:47:43 test-desktop kernel: [   13.945883] camera_common_s_power status = 0
Jun 24 02:47:43 test-desktop kernel: [   13.945979] [tegra_channel_set_power] 150c0000.nvcsi--1

Jun 24 02:47:43 test-desktop kernel: [ 12.982450] imx390 2-001c: couldn’t create debugfs
is something wrong .
other logs cant see that

You have to check the driver to know what cause the debugfs created failed. However if both of the register video node successfully maybe can ignore this message.
BTW what do you mean “cam device has works good but my device has still not work”

That means cam devices has own encoder and it dont need a specific setup kinds.
and i checked max9296 sio pins and transferring data from cam devices. too
but i can not checking details kinds of clk or data yet because cam devices have something problem and i will fix that next week.

anyway i checked device driver and DT .

imx390 2-001b: imx390_probe: debugfs name imx390_a
imx390 2-001c: imx390_probe: debugfs name imx390_a

debugfs problem is it tried to make a same path.

- camera_common.c 
sprintf(debugfs_name, "%s_%c", dev_name, s_data->csi_port + 'a');

what is csi_port ?

i check tegra186-camera-imx390-a00.dtsi and
imx390_a, b’s dst_csi_port, src-csi-port are same.

This board design is for virtual channel support that tell both of imx390_a/imx390_b connect to the same CSI port but gmsl output different vcid for different sensor.

thx a lot shane~

i will change port-index in DT

- camera_common.c 
int camera_common_parse_ports(struct device *dev,
			      struct camera_common_data *s_data)
// ..
	err = of_property_read_u32(ep, "port-index", &port);
	if (err) {
		dev_err(dev,
			"Failed to find port index\n");
		return err;
	}
	s_data->csi_port = port;
// ...

i fixed debugfs but still have problem.
/dev/video1 is still no power and gstreamer cant find device .

test@test-desktop:~$ v4l2-ctl -d /dev/video1 -n
ioctl: VIDIOC_ENUMINPUT
	Input       : 0
	Name        : Camera 0
	Type        : 0x00000002 (Camera)
	Audioset    : 0x00000000
	Tuner       : 0x00000000
	Standard    : 0x0000000000000000 ()
	Status      : 0x00000001 (no power)
	Capabilities: 0x00000000 (not defined)


//  gst-device-monitor-1.0
Device found:
        name  : vi-output, imx390 2-001b
        class : Video/Source
        caps  : video/x-raw, format=YUY2, width=1920, height=720, framerate=30/1

 // ...
Device found:
        name  : tegra-snd-t186ref-mobile-rt565x
        class : Audio/Sink

i tried to ACTIVE_HIGH and RESET

#define CAM0_PWR	TEGRA_MAIN_GPIO(R, 1) 
#define CAM0_RST	TEGRA_MAIN_GPIO(R, 5) 
#define CAM1_PST	TEGRA_MAIN_GPIO(R, 1) 
#define CAM1_PWD	TEGRA_MAIN_GPIO(N, 2)

pwdn-gpios = <&tegra_main_gpio CAM0_PWDN GPIO_ACTIVE_HIGH>,
           			   <&tegra_main_gpio CAM1_PWDN GPIO_ACTIVE_HIGH>;

no power isnt changing

where can i on power or how to gstreamer can find device /dev/video1 ?

i want to force to power on that device .

Please ignore the no power from the v4l2 query.
Get the trace log to check.

Jetson TX2/28.1 Camera BringUp - eLinux.org

i tested both port already and works well but always /dev/video0 works but video1 is not. so i too concerned that

my last goal is gstreamer and v4l2 and i want to know that SW or HW problem.

From your have verified one sensor working well at least the Max9296 → NVCSI without problem.
I think it could be the senor configure problem. You can dedicate on video1 to get the trace log for checking.

if using /dev/video0

     kworker/0:2-1172  [000] ....   261.747338: rtcpu_vinotify_event: tstamp:8323520421 tag:ATOMP_FE channel:0x00 frame:0 vi_tstamp:8323519969 data:0x00000000
     kworker/0:2-1172  [000] ....   261.747339: rtcpu_vinotify_event: tstamp:8323530327 tag:CHANSEL_PXL_SOF channel:0x00 frame:0 vi_tstamp:8323529833 data:0x00000001
     kworker/0:2-1172  [000] ....   261.747340: rtcpu_vinotify_event: tstamp:8323530492 tag:ATOMP_FS channel:0x00 frame:0 vi_tstamp:8323529851 data:0x00000000
     kworker/0:2-1172  [000] ....   261.747341: rtcpu_vinotify_event: tstamp:8323535835 tag:CHANSEL_LOAD_FRAMED channel:0x01 frame:0 vi_tstamp:8323535469 data:0x08000000
  gst-launch-1.0-8675  [004] ....   261.799047: tegra_channel_capture_done: eof:257.541383648
  gst-launch-1.0-8675  [000] ....   261.799694: tegra_channel_set_stream: enable : 0x0
  gst-launch-1.0-8675  [000] ....   261.799699: tegra_channel_set_stream: imx390 2-001b : 0x0
  gst-launch-1.0-8675  [000] ....   261.799754: tegra_channel_set_stream: 150c0000.nvcsi--2 : 0x0
  gst-launch-1.0-8675  [000] ....   261.799759: csi_s_stream: enable : 0x0
     kworker/0:2-1172  [000] ....   261.803457: rtcpu_vinotify_event: tstamp:8324551406 tag:CHANSEL_PXL_EOF channel:0x00 frame:0 vi_tstamp:8324550983 data:0x02cf0002
     kworker/0:2-1172  [000] ....   261.803462: rtcpu_vinotify_event: tstamp:8324555958 tag:ATOMP_FE channel:0x00 frame:0 vi_tstamp:8324555517 data:0x00000000
     kworker/0:2-1172  [000] ....   261.803464: rtcpu_vinotify_event: tstamp:8324565895 tag:CHANSEL_PXL_SOF channel:0x00 frame:0 vi_tstamp:8324565400 data:0x00000001
     kworker/0:2-1172  [000] ....   261.803466: rtcpu_vinotify_event: tstamp:8324566076 tag:ATOMP_FS channel:0x00 frame:0 vi_tstamp:8324565418 data:0x00000000
     kworker/0:2-1172  [000] ....   261.803468: rtcpu_vinotify_event: tstamp:8325586966 tag:CHANSEL_PXL_EOF channel:0x00 frame:0 vi_tstamp:8325586550 data:0x02cf0002

looks well and gstreamer works too but i cant understand why /dev/video1 is not work and v4l cant finding.

even no errors on boot log and call same function


- gst-device-monitor-1.0
root@test-desktop:/home/test# v4l2-ctl -d 1 -n
ioctl: VIDIOC_ENUMINPUT
	Input       : 0
	Name        : Camera 0
	Type        : 0x00000002 (Camera)
	Audioset    : 0x00000000
	Tuner       : 0x00000000
	Standard    : 0x0000000000000000 ()
	Status      : 0x00000001 (no power)
	Capabilities: 0x00000000 (not defined)

Device found:

        name  : vi-output, imx390 2-001b
        class : Video/Source
        caps  : video/x-raw, format=YUY2, width=1920, height=720, framerate=30/1
                video/x-raw, format=YUY2, width=1920, height=720, framerate=30/1
        properties:
                udev-probed = true
                device.bus_path = platform-15700000.vi
                sysfs.path = /sys/devices/13e10000.host1x/15700000.vi/video4linux/video0
                device.subsystem = video4linux
                device.product.name = "vi-output\,\ imx390\ 2-001b"
                device.capabilities = :capture:
                device.api = v4l2
                device.path = /dev/video0
                v4l2.device.driver = tegra-video
                v4l2.device.card = "vi-output\,\ imx390\ 2-001b"
                v4l2.device.bus_info = platform:15700000.vi:0
                v4l2.device.version = 264588 (0x0004098c)
                v4l2.device.capabilities = 2216689665 (0x84200001)
                v4l2.device.device_caps = 69206017 (0x04200001)
        gst-launch-1.0 v4l2src ! ...
//... 
Device found:
        name  : tegra-snd-t186ref-mobile-rt565x

i think that problem is senor configure problem. because i changed YUV → RGB on DT for /dev/video0.
gst-device-monitor-1.0 can’t discover devices. but i changed /dev/video0 and /dev/video1 to YUV.
gst find both but problem is RGB setting is jetpack 4.4 reference.

What do you mean can’t discover devices. What’s gstreamer command?

i mean gstremear kinds of gst-device-monitor-1.0 and

gst-launch-1.0 v4l2src device=/dev/video0 ! fakesink  
ERROR: from element /GstPipeline:pipeline0/GstV4l2Src:v4l2src0: Internal data stream error.

i tested other options but results are always v4l2src0 error

I would suggest stay with v4l2-ctl command to capture and check the trace log when failed.
You may need to modify the width/height/pixelformat

v4l2-ctl -d /dev/video0 --set-fmt-video=width=1920,height=1080,pixelformat=RG10 --set-ctrl bypass_mode=0 --stream-mmap --stream-count=1

i fixed RGB fpga chips and fixing wrong codes and enabled rgb888

root@test-desktop:/home/test# v4l2-ctl -d 1 --all
Driver Info (not using libv4l2):
	Driver name   : tegra-video
	Card type     : vi-output, imx390 2-001c
	Bus info      : platform:15700000.vi:0
	Driver version: 4.9.140
	Capabilities  : 0x84200001
		Video Capture
		Streaming
		Extended Pix Format
		Device Capabilities
	Device Caps   : 0x04200001
		Video Capture
		Streaming
		Extended Pix Format
Priority: 2
Video input : 0 (Camera 0: no power)
Format Video Capture:
	Width/Height      : 1920/720
	Pixel Format      : 'AR24'
	Field             : None
	Bytes per Line    : 7680
	Size Image        : 5529600
	Colorspace        : sRGB
	Transfer Function : Default (maps to sRGB)
	YCbCr/HSV Encoding: Default (maps to ITU-R 601)
	Quantization      : Default (maps to Full Range)
	Flags             : 

but video data isnt coming from max9296 or fpga

v4l2-ctl --verbose -w -d /dev/video1 --set-fmt-video=width=1920,height=720,pixelformat=AR24 --set-ctrl bypass_mode=0 --stream-mmap --stream-count=1

 vi-output, imx3-9082  [005] ....  1235.640002: tegra_channel_capture_setup: vnc_id 0 W 1920 H 720 fmt 41
 vi-output, imx3-9082  [005] ....  1235.640052: tegra_channel_capture_frame: sof:-549619122596.-268048213696
     kworker/5:1-8840  [005] ....  1235.659062: rtos_queue_send_from_isr_failed: tstamp:38757929673 queue:0x0b4a7258
     kworker/5:1-8840  [005] ....  1235.659068: rtos_queue_send_from_isr_failed: tstamp:38757929818 queue:0x0b4aad68
     kworker/5:1-8840  [005] ....  1235.659070: rtos_queue_send_from_isr_failed: tstamp:38757929962 queue:0x0b4ac998
     kworker/5:1-8840  [005] ....  1235.659073: rtos_queue_send_from_isr_failed: tstamp:38757930101 queue:0x0b4ae518
     kworker/5:1-8840  [005] ....  1235.659075: rtos_queue_send_from_isr_failed: tstamp:38757930237 queue:0x0b4af2d8
     kworker/5:1-8840  [005] ....  1235.659078: rtos_queue_send_from_isr_failed: tstamp:38757930396 queue:0x0b4b0098
     kworker/5:1-8840  [005] ....  1235.659080: rtos_queue_send_from_isr_failed: tstamp:38757930534 queue:0x0b4b0e58
     kworker/5:1-8840  [005] ....  1235.659083: rtos_queue_send_from_isr_failed: tstamp:38757930678 queue:0x0b4b1c18

I asked that and the FPGA sides answered that ’ we got nothing to wrong and check your SW settings’.
The HW and FPGA said video data is sending and serdes registers setting is works.
but data isnt coming. so i want to check DT for CSI and MIPI settings.

Anyway i have questions about serdes and csi .

my question is

  • Can I using Virtual Channel?
    reference using vc and i had same setting too. but my custom device is get yuvu and rgb888 data from serdes (max9296, max9295) .
    YUV is 16 bit and RGB is 24 bits so is it have to using different csi port on gmsl-link ?
    and how to changing that?

// remains for others
i read threads and changed Device tree and added rgb888.
RGB : [ Connecting RGB888 format camera device to TX2 ]

//  tegra186-camera-imx390-a00.dtsi
/*
					dynamic_pixel_bit_depth = "12";
					csi_pixel_bit_depth = "12";
					mode_type = "bayer";
					pixel_phase = "rggb";
*/

// imx390_a@1b 
					dynamic_pixel_bit_depth = "16";
					csi_pixel_bit_depth = "16";
					mode_type = "yuv";
					pixel_phase = "yuyv";
// ....
// imx390_b@1c 
					dynamic_pixel_bit_depth = "24";
					csi_pixel_bit_depth = "24";
					mode_type = "bayer"; 
					pixel_phase = "rgb";
// sensor_common.c
#if 1
	else if (strncmp(pixel_t, "bayer_rgb24", size) == 0) {
		printk("[%s : %d checking \n", __func__, __LINE__);
		*format = V4L2_PIX_FMT_RGB24;
	}
#endif 

// camera_common.c
// ...
	{
		MEDIA_BUS_FMT_RGB888_1X24,
		V4L2_COLORSPACE_RAW, 
		V4L2_PIX_FMT_RGB24,
	},	
	{ 
		MEDIA_BUS_FMT_RGB888_1X24,
		V4L2_COLORSPACE_ADOBERGB,
		V4L2_PIX_FMT_RGB24,
	},

Right you can reference to imx390 for virtual channel design.
RGB888 is should be like below.

					dynamic_pixel_bit_depth = "24";
					csi_pixel_bit_depth = "24";
					mode_type = "rgb"; 
					pixel_phase = "rgb888";

i have question with fourcc
mipi still not work and i checking channel .

chan->fmtinfo->fourcc = 875713089 and it means V4L2_PIX_FMT_ABGR32
but i set V4L2_PIX_FMT_RGB24.

is it ignored?


[   62.393242] [__tegra_channel_try_format : 1893 ] fmtinfo  fourcc  : 875713089  
[   62.393245] [__tegra_channel_try_format : 1894 ] fmtinfo  tegra_vf_code : 9  // RGB888
[   62.393247] [__tegra_channel_try_format : 1895 ] fmtinfo  code : 4106  
[   62.393249] [__tegra_channel_try_format : 1896 ] fmtinfo  img_dt : 36  // RGB888
[   62.393252] [__tegra_channel_try_format : 1897 ] fmtinfo  bpp : deno : 1  : numerator : 4 
[   62.393254] [__tegra_channel_try_format : 1898 ] fmtinfo  desc : BGRA-8-8-8-8

	TEGRA_VIDEO_FORMAT(RGB888, 24, RGB888_1X24, 4, 1, T_A8R8G8B8,
				RGB888, ABGR32, "BGRA-8-8-8-8"),

Looks fine due to VI memory layout didn’t support 24bit.
Have check the Table 357 from TRM.