utils: rkisp1: Support optional CSI-2 receiver subdev
The media graph may include a CSI-2 receiver entity between the sensor and the ISP for platforms that have a CSI-2 receiver external to the ISP. Support this by configuring the pipeline accordingly. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
This commit is contained in:
parent
4d3a118c11
commit
a5877e0307
1 changed files with 55 additions and 1 deletions
|
@ -14,6 +14,37 @@
|
||||||
# - raw2rgbpnm (from git://git.retiisi.org.uk/~sailus/raw2rgbpnm.git)
|
# - raw2rgbpnm (from git://git.retiisi.org.uk/~sailus/raw2rgbpnm.git)
|
||||||
# - yavta (from git://git.ideasonboard.org/yavta.git)
|
# - yavta (from git://git.ideasonboard.org/yavta.git)
|
||||||
|
|
||||||
|
# Return the entity connected to a given pad
|
||||||
|
# $1: The pad, expressed as "entity":index
|
||||||
|
mc_remote_entity() {
|
||||||
|
local entity="${1%:*}"
|
||||||
|
local pad="${1#*:}"
|
||||||
|
|
||||||
|
${mediactl} -p | awk '
|
||||||
|
/^- entity / {
|
||||||
|
in_entity=0
|
||||||
|
}
|
||||||
|
|
||||||
|
/^- entity [0-9]+: '"${entity}"' / {
|
||||||
|
in_entity=1
|
||||||
|
}
|
||||||
|
|
||||||
|
/^[ \t]+pad/ {
|
||||||
|
in_pad=0
|
||||||
|
}
|
||||||
|
|
||||||
|
/^[ \t]+pad'"${pad}"': / {
|
||||||
|
in_pad=1
|
||||||
|
}
|
||||||
|
|
||||||
|
/^[ \t]+(<-|->) "[^"]+"/ {
|
||||||
|
if (in_entity && in_pad) {
|
||||||
|
print gensub(/^[^"]+"([^"]+)":([0-9]+).*$/, "\\1", "g")
|
||||||
|
exit
|
||||||
|
}
|
||||||
|
}'
|
||||||
|
}
|
||||||
|
|
||||||
# Locate the sensor entity
|
# Locate the sensor entity
|
||||||
find_sensor() {
|
find_sensor() {
|
||||||
local bus
|
local bus
|
||||||
|
@ -28,6 +59,17 @@ find_sensor() {
|
||||||
echo "$sensor_name $bus"
|
echo "$sensor_name $bus"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Locate the CSI-2 receiver
|
||||||
|
find_csi2_rx() {
|
||||||
|
local sensor_name=$1
|
||||||
|
local csi2_rx
|
||||||
|
|
||||||
|
csi2_rx=$(mc_remote_entity "$sensor_name:0")
|
||||||
|
if [ "$csi2_rx" != rkisp1_isp ] ; then
|
||||||
|
echo "$csi2_rx"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
# Locate the media device
|
# Locate the media device
|
||||||
find_media_device() {
|
find_media_device() {
|
||||||
local mdev
|
local mdev
|
||||||
|
@ -63,15 +105,27 @@ configure_pipeline() {
|
||||||
local format="fmt:$sensor_mbus_code/$sensor_size"
|
local format="fmt:$sensor_mbus_code/$sensor_size"
|
||||||
local capture_mbus_code=$1
|
local capture_mbus_code=$1
|
||||||
local capture_size=$2
|
local capture_size=$2
|
||||||
|
local csi2_rx
|
||||||
|
|
||||||
echo "Configuring pipeline for $sensor in $format"
|
echo "Configuring pipeline for $sensor in $format"
|
||||||
|
|
||||||
|
csi2_rx=$(find_csi2_rx "$sensor")
|
||||||
|
|
||||||
$mediactl -r
|
$mediactl -r
|
||||||
|
|
||||||
$mediactl -l "'$sensor':0 -> 'rkisp1_isp':0 [1]"
|
if [ -n "$csi2_rx" ] ; then
|
||||||
|
$mediactl -l "'$sensor':0 -> '$csi2_rx':0 [1]"
|
||||||
|
$mediactl -l "'$csi2_rx':1 -> 'rkisp1_isp':0 [1]"
|
||||||
|
else
|
||||||
|
$mediactl -l "'$sensor':0 -> 'rkisp1_isp':0 [1]"
|
||||||
|
fi
|
||||||
$mediactl -l "'rkisp1_isp':2 -> 'rkisp1_resizer_mainpath':0 [1]"
|
$mediactl -l "'rkisp1_isp':2 -> 'rkisp1_resizer_mainpath':0 [1]"
|
||||||
|
|
||||||
$mediactl -V "\"$sensor\":0 [$format]"
|
$mediactl -V "\"$sensor\":0 [$format]"
|
||||||
|
if [ -n "$csi2_rx" ] ; then
|
||||||
|
$mediactl -V "'$csi2_rx':0 [$format]"
|
||||||
|
$mediactl -V "'$csi2_rx':1 [$format]"
|
||||||
|
fi
|
||||||
$mediactl -V "'rkisp1_isp':0 [$format crop:(0,0)/$sensor_size]"
|
$mediactl -V "'rkisp1_isp':0 [$format crop:(0,0)/$sensor_size]"
|
||||||
$mediactl -V "'rkisp1_isp':2 [fmt:$capture_mbus_code/$sensor_size crop:(0,0)/$sensor_size]"
|
$mediactl -V "'rkisp1_isp':2 [fmt:$capture_mbus_code/$sensor_size crop:(0,0)/$sensor_size]"
|
||||||
$mediactl -V "'rkisp1_resizer_mainpath':0 [fmt:$capture_mbus_code/$sensor_size crop:(0,0)/$sensor_size]"
|
$mediactl -V "'rkisp1_resizer_mainpath':0 [fmt:$capture_mbus_code/$sensor_size crop:(0,0)/$sensor_size]"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue