Hello,
I have written drivers for multiple different sensors, and I can connect two different sensors to the same carrier-board equipped with a TX2 running kernel 4.9 from l4t-32.3.1 (jetpack-4.3). Let’s say I have type A sensor, type B sensor and type C sensor. When I connect a type A sensor and a type B sensor, I can successfully run this simple acquisition test which test one sensor after the other :
for d in /dev/video*
do
echo $d
v4l2-ctl -d $d -C sensor_type
v4l2-ctl -d $d --list-framesizes=GREY | while read tag discrete size
do
if [ "$tag" != "Size:" ]
then
continue
fi
set -- $(echo $size | tr x ' ')
WIDTH=${1}
HEIGHT=${2}
FRAMERATE=$(v4l2-ctl -d $d --list-frameintervals=width=${WIDTH},height=${HEIGHT},pixelformat=GREY | sed -n \
-e 's,.*-\([0-9]*\)\.\([0-9]*\) fps.*,\1\2/1000,p')
echo WIDTH=$WIDTH
echo HEIGHT=$HEIGHT
echo FRAMERATE=$FRAMERATE
TRUNCATED_FRAMERATE=$(echo "scale=3; $FRAMERATE" | bc)
v4l2-ctl -d $d -p $TRUNCATED_FRAMERATE
sleep 1
v4l2-ctl -d $d --stream-mmap=3 --stream-count=256 --set-fmt-video=width=${WIDTH},height=${HEIGHT},pixelformat=GREY
done
done
When I connect a type A and a type B sensor, both answer perfectly, but if with exactly the same kernel and dtb I connect a type C and a type B sensor, type C sensor acquisition works perfectly, but type B acquisition fails with the following error messages :
[ 1718.801357] tegra-vi4 15700000.vi: PXL_SOF syncpt timeout! err = -11
[ 1718.807897] tegra-vi4 15700000.vi: tegra_channel_error_recovery: attempting to reset the capture channel
Here are the dtb properties of the different sensor types :
/* type A - only one mode */
csi_pixel_bit_depth = "12";
line_length = "4112";
active_w = "4112";
active_h = "3008";
pix_clk_hz = "539902310"; /* 4112 * 3008 * 29.1 * 12 / 8 */
max_framerate = "29.1";
/* type B - only one mode */
csi_pixel_bit_depth = "12";
line_length = "4112";
active_w = "4112";
active_h = "3008";
pix_clk_hz = "434148250"; /* 4112 * 3008 * 23.4 * 12 / 8 */
max_framerate = "23.4";
/* type C mode 0 */
csi_pixel_bit_depth = "12";
line_length = "1936";
active_w = "1936";
active_h = "1096";
pix_clk_hz = "190967040"; /* 1936 * 1096 * 60 * 12 / 8 */
max_framerate = "60";
/* type C mode 1 */
csi_pixel_bit_depth = "12";
line_length = "2464";
active_w = "2464";
active_h = "2056";
pix_clk_hz = "271283443"; /* 2464 * 2056 * 35.7 * 12 / 8 */
max_framerate = "35.7";
If I run the following script before running my test script, however, the test script succeeds
echo 1 > /sys/kernel/debug/bpmp/debug/clk/vi/mrq_rate_locked
echo 1 > /sys/kernel/debug/bpmp/debug/clk/isp/mrq_rate_locked
echo 1 > /sys/kernel/debug/bpmp/debug/clk/nvcsi/mrq_rate_locked
for f in vi isp nvcsi
do
max_rate=$(cat /sys/kernel/debug/bpmp/debug/clk/$f/max_rate)
current_rate=$(cat /sys/kernel/debug/bpmp/debug/clk/$f/rate)
echo $f current ${current_rate} max ${max_rate}
echo ${max_rate} > /sys/kernel/debug/bpmp/debug/clk/$f/rate
done
Is there something wrong in my device-tree, or is that rather a bug in the usage of the device-tree by the kernel ?