Six Camera initialized synchronous, when I open just /dev/video0

Dear,

We implemented six cameras on our carried board, i2c expander using tca9548 and io expander using tca9539, all six cameras can work successfully. (we refer to E3333 code to modify dtsi)
But I have a doubt, whenever I open one camera or two cameras , all the six cameras will be initialized by I2C.
What I want is when I open /dev/video0, just initialize camera0 by I2C? Can anyone give me an advice ?

What APP do you run?

Dear ShaneCCC,

I used python wrote by myself, and used this command to open camera0:
$ gst-launch-1.0 v4l2src device=/dev/video0 ! ‘video/x-raw,width=1280,height=720,format=(string)UYVY’ ! nvvidconv ! ‘video/x-raw(memory:NVMM),format=(string)NV12’ ! nvoverlaysink

This will initialize all six cameras by i2c.

Python code to open two cameras

import numpy as np
import cv2

gst_str_left =  "/dev/video0"
gst_str_right =  "/dev/video1"
cap_left = cv2.VideoCapture(gst_str_left);
cap_right = cv2.VideoCapture(gst_str_right);

while(True):
	# Capture frame-by-frame
	ret, frame1 = cap_left.read()
	ret, frame2 = cap_left.read()

	# Our operations on the frame come here
	gray = cv2.cvtColor(frame1, cv2.COLOR_BGR2GRAY)
	gray2 = cv2.cvtColor(frame2, cv2.COLOR_BGR2GRAY)

	# Display the resulting frame
	cv2.imshow('frame1',gray)
	cv2.imshow('frame2',gray2)
	if cv2.waitKey(1) & 0xFF == ord('q'):
		break

# When everything done, release the capture
cap_left.release()
cap_right.release()
cv2.destroyAllWindows()

How do you know all of the sensor was been initialized?
Does the v4l2-ctl like below have the same problem.

./v4l2-ctl -d /dev/video0 --set-ctrl bypass_mode=0 --stream-mmap --stream-count=100

Dear ShaneCCC,

I used your command, it still initialize all six cameras, we using six pr2000k(isp) ICs, through the dmesg log, I can see the six pr2000k initialize function is called and deinitalize function is called later.

Hear is I open /dev/video0

$v4l2-ctl -d /dev/video0 --set-ctrl bypass_mode=0 --stream-mmap --stream-count=100
<<<<<<<<<<<<<<<<<<<<<<<<<< 24.27 fps
<<<<<<<<<<<<<<<<<<<<<<<<< 24.63 fps
<<<<<<<<<<<<<<<<<<<<<<<<< 24.75 fps
<<<<<<<<<<<<<<<<<<<<<<<<
[23039.307320] pr2000k 30-005c: pr2000k write PR2000K_MODE_START_STREAM
[23039.341428] vi 54080000.vi: tegra_channel_error_status:error 20002 frame 0
[23043.462450] pr2000k 30-005c: pr2000k write STOP_STREAM
[23073.378984] pr2000k 30-005c: pr2000k s_stream mode:0
[23073.633093] pr2000k 30-005c: pr2000k write PR2000K_MODE_START_STREAM
[23073.667818] pr2000k 30-005c: pr2000k write STOP_STREAM
[23073.732810] pr2000k 31-005c: pr2000k s_stream mode:0
[23073.992291] pr2000k 31-005c: pr2000k write PR2000K_MODE_START_STREAM
[23074.027465] pr2000k 31-005c: pr2000k write STOP_STREAM
[23074.093302] pr2000k 32-005c: pr2000k s_stream mode:0
[23074.351344] pr2000k 32-005c: pr2000k write PR2000K_MODE_START_STREAM
[23074.388189] pr2000k 32-005c: pr2000k write STOP_STREAM
[23074.454757] pr2000k 33-005c: pr2000k s_stream mode:0
[23074.699119] pr2000k 33-005c: pr2000k write PR2000K_MODE_START_STREAM
[23074.735283] pr2000k 33-005c: pr2000k write STOP_STREAM
[23074.800958] pr2000k 34-005c: pr2000k s_stream mode:0
[23075.050676] pr2000k 34-005c: pr2000k write PR2000K_MODE_START_STREAM
[23075.086218] pr2000k 34-005c: pr2000k write STOP_STREAM
[23075.153126] pr2000k 35-005c: pr2000k s_stream mode:0
[23075.434231] pr2000k 35-005c: pr2000k write PR2000K_MODE_START_STREAM
[23075.468331] pr2000k 35-005c: pr2000k write STOP_STREAM

[23075.565544] pr2000k 30-005c: pr2000k s_stream mode:0
[23075.813653] pr2000k 30-005c: pr2000k write PR2000K_MODE_START_STREAM
[23075.849427] vi 54080000.vi: tegra_channel_error_status:error 20002 frame 0
[23075.973046] video4linux video5: MW_ACK_DONE syncpoint time out!0
[23075.973073] video4linux video5: frame start syncpt timeout!0
[23080.092301] pr2000k 30-005c: pr2000k write STOP_STREAM

That’s weird !!!
How about the xxx_open() in sensor driver? All 6 been opened?

Dear ShaneCCC,

xxx_open is not called, it just called pr2000k_s_stream to open the camera, so weird!

static struct v4l2_subdev_ops pr2000k_subdev_ops = {
.core = &pr2000k_subdev_core_ops,
.video = &pr2000k_subdev_video_ops,
.pad = &pr2000k_subdev_pad_ops,
};

static struct v4l2_subdev_video_ops pr2000k_subdev_video_ops = {
.s_stream = pr2000k_s_stream,
.g_mbus_config = camera_common_g_mbus_config,
.g_input_status = pr2000k_g_input_status,
};

Just try the e3333 with below command. The ov5693_open() won’t called however didn’t initial all of sensors.
Could check your driver if any different with ov5693.

v4l2-ctl -d /dev/video1 --set-ctrl bypass_mode=0 --stream-mmap --stream-count=100

[ 421.664917] ov5693 31-0036: ov5693_power_on: power on
[ 421.746053] ov5693 31-0036: ov5693_s_stream++
[ 421.796785] ov5693 31-0036: ov5693_s_stream–
[ 425.255011] ov5693 31-0036: ov5693_s_stream++
[ 425.273382] ov5693 31-0036: ov5693_power_off: power off