123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335 |
- #!/bin/sh
- # SPDX-License-Identifier: GPL-2.0
- #
- # Copyright (C) 2021 StarFive Technology Co., Ltd.
- #
- USAGE="Usage: media-ctl-pipeline -d /dev/media0 -i interface_type -s sensor_type -a {start|stop}"
- devname="/dev/media0"
- while getopts "d:i:s:a:" arg
- do
- case $arg in
- d)
- devname=$OPTARG
- echo "select dev name: $devname"
- ;;
- i)
- interface_type=$OPTARG
- echo "select interface_type: $interface_type"
- ;;
- s)
- sensor_type=$OPTARG
- echo "select sensor_type: $sensor_type"
- ;;
- a)
- action=$OPTARG
- echo "select action: $action"
- ;;
- ?)
- echo "unknow argument"
- exit 1
- ;;
- esac
- done
- if [ -z $devname]; then
- echo "unknow media device"
- echo $USAGE
- exit 1
- fi
- if [ -z $interface_type ]; then
- echo "unknow interface type"
- echo $USAGE
- exit 1
- fi
- if [ -z $sensor_type ]; then
- echo "unknow sensor type"
- echo $USAGE
- exit 1
- fi
- if [ -z $action ]; then
- echo "unknow action type"
- echo $USAGE
- exit 1
- fi
- echo "Pipeline -d $devname -i $interface_type -s $sensor_type -a $action"
- case $interface_type in
- dvp)
- case $action in
- start)
- # media-ctl -d $devname -vl "'sc2235 1-0030':0 -> 'stf_dvp0':0 [1]"
- # media-ctl -d $devname -vl "'ov5640 1-003c':0 -> 'stf_dvp0':0 [1]"
- case $sensor_type in
- VIN)
- echo "DVP vin enable pipeline:"
- media-ctl -d $devname -vl "'stf_dvp0':1 -> 'stf_vin0_wr':0 [1]"
- # media-ctl -d $devname -vl "'stf_vin0_wr':1 -> 'stf_vin0_wr_video0':0 [1]"
- ;;
- ISP0)
- echo "DVP ISP0 enable pipeline:"
- media-ctl -d $devname -vl "'stf_dvp0':1 -> 'stf_isp0':0 [1]"
- media-ctl -d $devname -vl "'stf_isp0':1 -> 'stf_vin0_isp0':0 [1]"
- # media-ctl -d $devname -vl "'stf_vin0_isp0':1 -> 'stf_vin0_isp0_video1':0 [1]"
- ;;
- ISP0RAW)
- echo "DVP ISP0RAW enable pipeline:"
- media-ctl -d $devname -vl "'stf_dvp0':1 -> 'stf_isp0':0 [1]"
- media-ctl -d $devname -vl "'stf_isp0':1 -> 'stf_vin0_isp0_raw':0 [1]"
- # media-ctl -d $devname -vl "'stf_vin0_isp0':1 -> 'stf_vin0_isp0_video1':0 [1]"
- ;;
- ISP1)
- echo "DVP ISP1 enable pipeline:"
- media-ctl -d $devname -vl "'stf_dvp0':1 -> 'stf_isp1':0 [1]"
- media-ctl -d $devname -vl "'stf_isp1':1 -> 'stf_vin0_isp1':0 [1]"
- # media-ctl -d $devname -vl "'stf_vin0_isp1':1 -> 'stf_vin0_isp1_video2':0 [1]"
- ;;
- ISP1RAW)
- echo "DVP ISP1RAW enable pipeline:"
- media-ctl -d $devname -vl "'stf_dvp0':1 -> 'stf_isp1':0 [1]"
- media-ctl -d $devname -vl "'stf_isp1':1 -> 'stf_vin0_isp1_raw':0 [1]"
- # media-ctl -d $devname -vl "'stf_vin0_isp1':1 -> 'stf_vin0_isp1_video2':0 [1]"
- ;;
- *)
- echo $USAGE
- exit 1
- ;;
- esac
- ;;
- stop)
- # media-ctl -d $devname -vl "'sc2235 1-0030':0 -> 'stf_dvp0':0 [0]"
- # media-ctl -d $devname -vl "'ov5640 1-003c':0 -> 'stf_dvp0':0 [0]"
- case $sensor_type in
- VIN)
- echo "DVP vin disable pipeline:"
- media-ctl -d $devname -vl "'stf_dvp0':1 -> 'stf_vin0_wr':0 [0]"
- # media-ctl -d $devname -vl "'stf_vin0_wr':1 -> 'stf_vin0_wr_video0':0 [0]"
- ;;
- ISP0)
- echo "DVP ISP0 disable pipeline:"
- media-ctl -d $devname -vl "'stf_dvp0':1 -> 'stf_isp0':0 [0]"
- media-ctl -d $devname -vl "'stf_isp0':1 -> 'stf_vin0_isp0':0 [0]"
- # media-ctl -d $devname -vl "'stf_vin0_isp0':1 -> 'stf_vin0_isp0_video1':0 [0]"
- ;;
- ISP0RAW)
- echo "DVP ISP0RAW disable pipeline:"
- media-ctl -d $devname -vl "'stf_dvp0':1 -> 'stf_isp0':0 [0]"
- media-ctl -d $devname -vl "'stf_isp0':1 -> 'stf_vin0_isp0_raw':0 [0]"
- # media-ctl -d $devname -vl "'stf_vin0_isp0':1 -> 'stf_vin0_isp0_video1':0 [0]"
- ;;
- ISP1)
- echo "DVP ISP1 disable pipeline:"
- media-ctl -d $devname -vl "'stf_dvp0':1 -> 'stf_isp1':0 [0]"
- media-ctl -d $devname -vl "'stf_isp1':1 -> 'stf_vin0_isp1':0 [0]"
- # media-ctl -d $devname -vl "'stf_vin0_isp1':1 -> 'stf_vin0_isp1_video2':0 [0]"
- ;;
- ISP1RAW)
- echo "DVP ISP1RAW disable pipeline:"
- media-ctl -d $devname -vl "'stf_dvp0':1 -> 'stf_isp1':0 [0]"
- media-ctl -d $devname -vl "'stf_isp1':1 -> 'stf_vin0_isp1_raw':0 [0]"
- # media-ctl -d $devname -vl "'stf_vin0_isp1':1 -> 'stf_vin0_isp1_video2':0 [0]"
- ;;
- *)
- echo $USAGE
- exit 1
- ;;
- esac
- ;;
- *)
- echo $USAGE
- exit 1
- ;;
- esac
- ;;
- csiphy0)
- case $action in
- start)
- # media-ctl -d $devname -vl "'ov4689 0-0036':0 -> 'stf_csiphy0':0 [1]"
- case $sensor_type in
- VIN)
- echo "csiphy0 CSIRX0 vin enable pipeline:"
- ;;
- ISP0)
- echo "csiphy0 CSIRX0 ISP0 enable pipeline:"
- media-ctl -d $devname -vl "'stf_csiphy0':1 -> 'stf_csi0':0 [1]"
- media-ctl -d $devname -vl "'stf_csi0':1 -> 'stf_isp0':0 [1]"
- media-ctl -d $devname -vl "'stf_isp0':1 -> 'stf_vin0_isp0':0 [1]"
- # media-ctl -d $devname -vl "'stf_vin0_isp0':1 -> 'stf_vin0_isp0_video1':0 [1]"
- ;;
- ISP0RAW)
- echo "csiphy0 CSIRX0 ISP0RAW enable pipeline:"
- media-ctl -d $devname -vl "'stf_csiphy0':1 -> 'stf_csi0':0 [1]"
- media-ctl -d $devname -vl "'stf_csi0':1 -> 'stf_isp0':0 [1]"
- media-ctl -d $devname -vl "'stf_isp0':1 -> 'stf_vin0_isp0_raw':0 [1]"
- # media-ctl -d $devname -vl "'stf_vin0_isp0':1 -> 'stf_vin0_isp0_video1':0 [1]"
- ;;
- ISP1)
- echo "csiphy0 CSIRX0 ISP1 enable pipeline:"
- media-ctl -d $devname -vl "'stf_csiphy0':1 -> 'stf_csi0':0 [1]"
- media-ctl -d $devname -vl "'stf_csi0':1 -> 'stf_isp1':0 [1]"
- media-ctl -d $devname -vl "'stf_isp1':1 -> 'stf_vin0_isp1':0 [1]"
- # media-ctl -d $devname -vl "'stf_vin0_isp1':1 -> 'stf_vin0_isp1_video2':0 [1]"
- ;;
- ISP1RAW)
- echo "csiphy0 CSIRX0 ISP1RAW enable pipeline:"
- media-ctl -d $devname -vl "'stf_csiphy0':1 -> 'stf_csi0':0 [1]"
- media-ctl -d $devname -vl "'stf_csi0':1 -> 'stf_isp1':0 [1]"
- media-ctl -d $devname -vl "'stf_isp1':1 -> 'stf_vin0_isp1_raw':0 [1]"
- # media-ctl -d $devname -vl "'stf_vin0_isp1':1 -> 'stf_vin0_isp1_video2':0 [1]"
- ;;
- *)
- echo $USAGE
- exit 1
- ;;
- esac
- ;;
- stop)
- # media-ctl -d $devname -vl "'ov4689 0-0036':0 -> 'stf_csiphy0':0 [0]"
- case $sensor_type in
- VIN)
- echo "csiphy0 CSIRX0 vin disable pipeline:"
- ;;
- ISP0)
- echo "csiphy0 CSIRX0 ISP0 disable pipeline:"
- media-ctl -d $devname -vl "'stf_csiphy0':1 -> 'stf_csi0':0 [0]"
- media-ctl -d $devname -vl "'stf_csi0':1 -> 'stf_isp0':0 [0]"
- media-ctl -d $devname -vl "'stf_isp0':1 -> 'stf_vin0_isp0':0 [0]"
- # media-ctl -d $devname -vl "'stf_vin0_isp0':1 -> 'stf_vin0_isp0_video1':0 [0]"
- ;;
- ISP0RAW)
- echo "csiphy0 CSIRX0 ISP0RAW disable pipeline:"
- media-ctl -d $devname -vl "'stf_csiphy0':1 -> 'stf_csi0':0 [0]"
- media-ctl -d $devname -vl "'stf_csi0':1 -> 'stf_isp0':0 [0]"
- media-ctl -d $devname -vl "'stf_isp0':1 -> 'stf_vin0_isp0_raw':0 [0]"
- # media-ctl -d $devname -vl "'stf_vin0_isp0':1 -> 'stf_vin0_isp0_video1':0 [0]"
- ;;
- ISP1)
- echo "csiphy0 CSIRX0 ISP1 disable pipeline:"
- media-ctl -d $devname -vl "'stf_csiphy0':1 -> 'stf_csi0':0 [0]"
- media-ctl -d $devname -vl "'stf_csi0':1 -> 'stf_isp1':0 [0]"
- media-ctl -d $devname -vl "'stf_isp1':1 -> 'stf_vin0_isp1':0 [0]"
- # media-ctl -d $devname -vl "'stf_vin0_isp1':1 -> 'stf_vin0_isp1_video2':0 [0]"
- ;;
- ISP1RAW)
- echo "csiphy0 CSIRX0 ISP1RAW disable pipeline:"
- media-ctl -d $devname -vl "'stf_csiphy0':1 -> 'stf_csi0':0 [0]"
- media-ctl -d $devname -vl "'stf_csi0':1 -> 'stf_isp1':0 [0]"
- media-ctl -d $devname -vl "'stf_isp1':1 -> 'stf_vin0_isp1_raw':0 [0]"
- # media-ctl -d $devname -vl "'stf_vin0_isp1':1 -> 'stf_vin0_isp1_video2':0 [0]"
- ;;
- *)
- echo $USAGE
- exit 1
- ;;
- esac
- ;;
- *)
- echo $USAGE
- exit 1
- ;;
- esac
- ;;
- csiphy1)
- case $action in
- start)
- # media-ctl -d $devname -vl "'ov4689 2-0036':0 -> 'stf_csiphy1':0 [1]"
- case $sensor_type in
- VIN)
- echo "csiphy1 CSIRX0 vin enable pipeline:"
- ;;
- ISP0)
- echo "csiphy1 CSIRX1 ISP0 enable pipeline:"
- media-ctl -d $devname -vl "'stf_csiphy1':1 -> 'stf_csi1':0 [1]"
- media-ctl -d $devname -vl "'stf_csi1':1 -> 'stf_isp0':0 [1]"
- media-ctl -d $devname -vl "'stf_isp0':1 -> 'stf_vin0_isp0':0 [1]"
- # media-ctl -d $devname -vl "'stf_vin0_isp0':1 -> 'stf_vin0_isp0_video1':0 [1]"
- ;;
- ISP0RAW)
- echo "csiphy1 CSIRX1 ISP0RAW enable pipeline:"
- media-ctl -d $devname -vl "'stf_csiphy1':1 -> 'stf_csi1':0 [1]"
- media-ctl -d $devname -vl "'stf_csi1':1 -> 'stf_isp0':0 [1]"
- media-ctl -d $devname -vl "'stf_isp0':1 -> 'stf_vin0_isp0_raw':0 [1]"
- # media-ctl -d $devname -vl "'stf_vin0_isp0':1 -> 'stf_vin0_isp0_video1':0 [1]"
- ;;
- ISP1)
- echo "csiphy1 CSIRX1 ISP1 enable pipeline:"
- media-ctl -d $devname -vl "'stf_csiphy1':1 -> 'stf_csi1':0 [1]"
- media-ctl -d $devname -vl "'stf_csi1':1 -> 'stf_isp1':0 [1]"
- media-ctl -d $devname -vl "'stf_isp1':1 -> 'stf_vin0_isp1':0 [1]"
- # media-ctl -d $devname -vl "'stf_vin0_isp1':1 -> 'stf_vin0_isp1_video2':0 [1]"
- ;;
- ISP1RAW)
- echo "csiphy1 CSIRX1 ISP1RAW enable pipeline:"
- media-ctl -d $devname -vl "'stf_csiphy1':1 -> 'stf_csi1':0 [1]"
- media-ctl -d $devname -vl "'stf_csi1':1 -> 'stf_isp1':0 [1]"
- media-ctl -d $devname -vl "'stf_isp1':1 -> 'stf_vin0_isp1_raw':0 [1]"
- # media-ctl -d $devname -vl "'stf_vin0_isp1':1 -> 'stf_vin0_isp1_video2':0 [1]"
- ;;
- *)
- echo $USAGE
- exit 1
- ;;
- esac
- ;;
- stop)
- # media-ctl -d $devname -vl "'ov4689 0-0036':0 -> 'stf_csiphy0':0 [0]"
- case $sensor_type in
- VIN)
- echo "csiphy1 CSIRX0 vin disable pipeline:"
- ;;
- ISP0)
- echo "csiphy1 CSIRX1 ISP0 disable pipeline:"
- media-ctl -d $devname -vl "'stf_csiphy1':1 -> 'stf_csi1':0 [0]"
- media-ctl -d $devname -vl "'stf_csi1':1 -> 'stf_isp0':0 [0]"
- media-ctl -d $devname -vl "'stf_isp0':1 -> 'stf_vin0_isp0':0 [0]"
- # media-ctl -d $devname -vl "'stf_vin0_isp0':1 -> 'stf_vin0_isp0_video1':0 [0]"
- ;;
- ISP0RAW)
- echo "csiphy1 CSIRX1 ISP0RAW disable pipeline:"
- media-ctl -d $devname -vl "'stf_csiphy1':1 -> 'stf_csi1':0 [0]"
- media-ctl -d $devname -vl "'stf_csi1':1 -> 'stf_isp0':0 [0]"
- media-ctl -d $devname -vl "'stf_isp0':1 -> 'stf_vin0_isp0_raw':0 [0]"
- # media-ctl -d $devname -vl "'stf_vin0_isp0':1 -> 'stf_vin0_isp0_video1':0 [0]"
- ;;
- ISP1)
- echo "csiphy1 CSIRX1 ISP1 disable pipeline:"
- media-ctl -d $devname -vl "'stf_csiphy1':1 -> 'stf_csi1':0 [0]"
- media-ctl -d $devname -vl "'stf_csi1':1 -> 'stf_isp1':0 [0]"
- media-ctl -d $devname -vl "'stf_isp1':1 -> 'stf_vin0_isp1':0 [0]"
- # media-ctl -d $devname -vl "'stf_vin0_isp1':1 -> 'stf_vin0_isp1_video2':0 [0]"
- ;;
- ISP1RAW)
- echo "csiphy1 CSIRX1 ISP1RAW disable pipeline:"
- media-ctl -d $devname -vl "'stf_csiphy1':1 -> 'stf_csi1':0 [0]"
- media-ctl -d $devname -vl "'stf_csi1':1 -> 'stf_isp1':0 [0]"
- media-ctl -d $devname -vl "'stf_isp1':1 -> 'stf_vin0_isp1_raw':0 [0]"
- # media-ctl -d $devname -vl "'stf_vin0_isp1':1 -> 'stf_vin0_isp1_video2':0 [0]"
- ;;
- *)
- echo $USAGE
- exit 1
- ;;
- esac
- ;;
- *)
- echo $USAGE
- exit 1
- ;;
- esac
- ;;
- *)
- echo $USAGE
- exit 1
- ;;
- esac
- exit 0;
|