Tool/software:
Hello all,
I developed a MAX96716/ MAX96717 driver by referencing ds90ub960/ds90ub953. The drivers all works as expected and passes their probes, and writes their registers. I created a media-ctl setup script by referencing `setup_cameras.sh` script, please see below:
```
#!/bin/bash
setup_ov2311(){
OV2311_CAM_FMT='[fmt:Y8_1X8/1280x800]'
i=0
for media_id in {0..0}; do
# MAX96717 FORMATS
MAX96716_FMT_STR="["
CSI2RX_FMT_STR="["
for name in `media-ctl -d $media_id -p | grep entity | grep ov2311_mipi | cut -d ' ' -f 5`; do
CAM_SUBDEV=`media-ctl -d $media_id -p -e "ov2311_mipi $name" | grep v4l-subdev | awk '{print $4}'`
MAX96717_NAME=`media-ctl -d $media_id -p -e "ov2311_mipi $name" | grep max96717 | cut -d "\"" -f 2`
media-ctl -d $media_id -V "'$MAX96717_NAME':0 $OV2311_CAM_FMT"
MAX96716_NAME=`media-ctl -d $media_id -p -e "$MAX96717_NAME" | grep max96716 | cut -d "\"" -f 2`
MAX96716_PAD=`media-ctl -d $media_id -p -e "$MAX96717_NAME" | grep max96716 | cut -d : -f 2 | awk '{print $1}'`
CSI_BRIDGE_NAME=`media-ctl -d $media_id -p -e "$MAX96716_NAME" | grep csi-bridge | cut -d "\"" -f 2`
CSI2RX_NAME=`media-ctl -d $media_id -p -e "$CSI_BRIDGE_NAME" | grep "ticsi2rx\"" | cut -d "\"" -f 2`
CSI2RX_CONTEXT_NAME="$CSI2RX_NAME context $MAX96716_PAD"
if [ "$MAX96716_FMT_STR" != "[" ]; then
MAX96716_FMT_STR="${MAX96716_FMT_STR}, "
CSI2RX_FMT_STR="${CSI2RX_FMT_STR}, "
fi
MAX96716_FMT_STR="${MAX96716_FMT_STR}${MAX96716_PAD}/0 -> $(($MAX96716_PAD + 2))/0 [1]"
CSI2RX_FMT_STR="${CSI2RX_FMT_STR}0/${MAX96716_PAD} -> $(($MAX96716_PAD+1))/0 [1]"
echo "OV2311 Camera $i detected"
echo " device = "`media-ctl -d $media_id -p -e "$CSI2RX_CONTEXT_NAME" | grep video | awk '{print $4}'`
echo " name = ov2311"
echo " format = $OV2311_CAM_FMT"
echo " subdev_id = $CAM_SUBDEV"
echo " isp_required = yes"
echo " ldc_required = no"
((i++))
done
MAX96716_FMT_STR="${MAX96716_FMT_STR}]"
CSI2RX_FMT_STR="${CSI2RX_FMT_STR}]"
media-ctl -d $media_id -p | grep entity | grep ov2311_mipi -q
if [ "$?" == "0" ]; then
# MAX96716 ROUTING & FORMATS
echo $MAX96716_NAME $MAX96716_FMT_STR
media-ctl -d $media_id -R "'$MAX96716_NAME' $MAX96716_FMT_STR"
for name in `media-ctl -d $media_id -p | grep entity | grep ov2311_mipi | cut -d ' ' -f 5`; do
MAX96717_NAME=`media-ctl -d $media_id -p -e "ov2311_mipi $name" | grep max96717 | cut -d "\"" -f 2`
MAX96716_NAME=`media-ctl -d $media_id -p -e "$MAX96717_NAME" | grep max96716 | cut -d "\"" -f 2`
MAX96716_PAD=`media-ctl -d $media_id -p -e "$MAX96717_NAME" | grep max96716 | cut -d : -f 2 | awk '{print $1}'`
media-ctl -d $media_id -V "'$MAX96716_NAME':$MAX96716_PAD $OV2311_CAM_FMT"
done
# CSI2RX ROUTING
media-ctl -d $media_id -R "'$CSI2RX_NAME' $CSI2RX_FMT_STR"
fi
done
}
#setup_isx021
setup_ov2311
```
And here is the media-ctl -p output:
```
root@myd-am62x:~# media-ctl -p
Media controller API version 6.1.46
Media device information
------------------------
driver j721e-csi2rx
model TI-CSI2RX
serial
bus info platform:30102000.ticsi2rx
hw revision 0x1
driver version 6.1.46
Device topology
- entity 1: 30102000.ticsi2rx (5 pads, 5 links, 1 route)
type V4L2 subdev subtype Unknown flags 0
device node name /dev/v4l-subdev0
routes:
0/0 -> 1/0 [ACTIVE]
pad0: Sink
[stream:0 fmt:UYVY8_1X16/640x480 field:none colorspace:srgb xfer:srgb ycbcr:601 quantization:lim-range]
<- "cdns_csi2rx.30101000.csi-bridge":1 [ENABLED,IMMUTABLE]
pad1: Source
[stream:0 fmt:UYVY8_1X16/640x480 field:none colorspace:srgb xfer:srgb ycbcr:601 quantization:lim-range]
-> "30102000.ticsi2rx context 0":0 [ENABLED,IMMUTABLE]
pad2: Source
-> "30102000.ticsi2rx context 1":0 [ENABLED,IMMUTABLE]
pad3: Source
-> "30102000.ticsi2rx context 2":0 [ENABLED,IMMUTABLE]
pad4: Source
-> "30102000.ticsi2rx context 3":0 [ENABLED,IMMUTABLE]
- entity 7: cdns_csi2rx.30101000.csi-bridge (5 pads, 2 links, 1 route)
type V4L2 subdev subtype Unknown flags 0
device node name /dev/v4l-subdev1
routes:
0/0 -> 1/0 [ACTIVE]
pad0: Sink
[stream:0 fmt:UYVY8_1X16/640x480 field:none colorspace:srgb xfer:srgb ycbcr:601 quantization:lim-range]
<- "max96716 1-004c":2 [ENABLED,IMMUTABLE]
pad1: Source
[stream:0 fmt:UYVY8_1X16/640x480 field:none colorspace:srgb xfer:srgb ycbcr:601 quantization:lim-range]
-> "30102000.ticsi2rx":0 [ENABLED,IMMUTABLE]
pad2: Source
pad3: Source
pad4: Source
- entity 13: max96716 1-004c (4 pads, 2 links, 1 route)
type V4L2 subdev subtype Unknown flags 0
device node name /dev/v4l-subdev2
routes:
0/0 -> 2/0 [ACTIVE]
pad0: Sink
[stream:0 fmt:Y8_1X8/1280x800]
<- "max96717 1-0040":1 [ENABLED,IMMUTABLE]
pad1: Sink
pad2: Source
[stream:0 fmt:Y8_1X8/1280x800]
-> "cdns_csi2rx.30101000.csi-bridge":0 [ENABLED,IMMUTABLE]
pad3: Source
- entity 20: max96717 1-0040 (2 pads, 2 links, 1 route)
type V4L2 subdev subtype Unknown flags 0
device node name /dev/v4l-subdev3
routes:
0/0 -> 1/0 [ACTIVE]
pad0: Sink
[stream:0 fmt:Y8_1X8/1280x800]
<- "ov2311_mipi 1-0010":0 [ENABLED,IMMUTABLE]
pad1: Source
[stream:0 fmt:Y8_1X8/1280x800]
-> "max96716 1-004c":0 [ENABLED,IMMUTABLE]
- entity 25: ov2311_mipi 1-0010 (1 pad, 1 link, 0 route)
type V4L2 subdev subtype Sensor flags 0
device node name /dev/v4l-subdev4
pad0: Source
[stream:0 fmt:Y8_1X8/1280x800 field:none colorspace:srgb]
-> "max96717 1-0040":0 [ENABLED,IMMUTABLE]
- entity 31: 30102000.ticsi2rx context 0 (1 pad, 1 link, 0 route)
type Node subtype V4L flags 0
device node name /dev/video0
pad0: Sink
<- "30102000.ticsi2rx":1 [ENABLED,IMMUTABLE]
- entity 37: 30102000.ticsi2rx context 1 (1 pad, 1 link, 0 route)
type Node subtype V4L flags 0
device node name /dev/video1
pad0: Sink
<- "30102000.ticsi2rx":2 [ENABLED,IMMUTABLE]
- entity 43: 30102000.ticsi2rx context 2 (1 pad, 1 link, 0 route)
type Node subtype V4L flags 0
device node name /dev/video2
pad0: Sink
<- "30102000.ticsi2rx":3 [ENABLED,IMMUTABLE]
- entity 49: 30102000.ticsi2rx context 3 (1 pad, 1 link, 0 route)
type Node subtype V4L flags 0
device node name /dev/video3
pad0: Sink
<- "30102000.ticsi2rx":4 [ENABLED,IMMUTABLE]
```
When I try to get a stream, using the below code I get an error:
root@myd-am62x:~# v4l2-ctl --device /dev/video0 --set-fmt-video=width=1280,height=800,pixelformat=BA81 --stream-mmap --stream-to=frame.raw --stream-count=1
VIDIOC_STREAMON returned -1 (Broken pipe)
Did I do something wrong with my media-ctl script ? Or this issue is more like driver related ?
Thanks.