firmware/br-ext-chip-sigmastar/package/sigmastar-osdrv-ssc335/files/script/load_sigmastar

129 lines
3.6 KiB
Bash
Executable File

#!/bin/sh
#
# OpenIPC.org | 2021.06.16
#
# Useage: ./load [ -r|-i|-a ]
# -r : rmmod all modules
# -i : insmod all modules
# default : rmmod all moules and then insmod them
PATH_MODULE=/lib/modules/4.9.84/sigmastar
# Sensor
sensor=$(fw_printenv -n sensor)
# Watchdog
watchdog -t 10 /dev/watchdog
insert_ko()
{
insmod ${PATH_MODULE}/mhal.ko
insmod ${PATH_MODULE}/mi_common.ko
insmod ${PATH_MODULE}/mi_sys.ko cmdQBufSize=256 logBufSize=256
insmod ${PATH_MODULE}/mi_ai.ko
insmod ${PATH_MODULE}/mi_ao.ko
insmod ${PATH_MODULE}/mi_rgn.ko
insmod ${PATH_MODULE}/mi_divp.ko thread_priority=98
#insmod ${PATH_MODULE}/mi_ipu.ko
insmod ${PATH_MODULE}/mi_vpe.ko thread_priority=98
insmod ${PATH_MODULE}/mi_sensor.ko
insmod ${PATH_MODULE}/mi_vif.ko thread_priority=98
#
case $sensor in
gc2053)
# Untested | The information is obtained from the Gospell firmware
insmod ${PATH_MODULE}/mi_venc.ko max_width=1920 max_height=1080 max_jpe_task=1;
;;
imx307)
# Untested | The information is obtained from the Anjoy and Brovotech (no any params) firmware
insmod ${PATH_MODULE}/mi_venc.ko max_width=2304 max_height=1296 thread_priority=99;
;;
sc3335)
# Untested | The information is obtained from the Uniview firmware (no any params on other version)
insmod ${PATH_MODULE}/mi_venc.ko max_width=2304 max_height=1296 mi_timeout_reset=1;
;;
*)
echo -e "\n\e[1;31mAn UNSUPPORTED sensor type is specified - ${sensor}\e[0m\n" | logger -s -t OpenIPC;
;;
esac
#
insmod ${PATH_MODULE}/mi_shadow.ko
#
major=$(awk '$2=="mi_poll" {print $1}' /proc/devices)
mknod /dev/mi_poll c $major 0
#
# Disable it now, untested
#echo hvsp2 down /config/iqfile/filter.txt /config/iqfile/filter.txt > /sys/class/mstar/mscl/hvsp
#
# Change configs folder
echo isproot /etc/sensors/iqfile > /dev/ispmid
#
case $sensor in
gc2053)
# Untested | The information is obtained from the Gospell firmware
insmod ${PATH_MODULE}/sensor_gc2053_mipi.ko chmap=1 lane_num=2 hdr_lane_num=2;
;;
imx307)
# Untested | The information is obtained from the Anjoy and Brovotech (mclk=37.125M) firmware
insmod ${PATH_MODULE}/sensor_imx307_mipi.ko chmap=1 lane_num=2 hdr_lane_num=2 mclk=37.125M;
;;
sc3335)
# Untested | The information is obtained from the Uniview firmware
insmod ${PATH_MODULE}/sensor_sc3335_mipi.ko chmap=1;
;;
*)
echo -e "\n\e[1;31mAn UNSUPPORTED sensor type is specified - ${sensor}\e[0m\n" | logger -s -t OpenIPC;
;;
esac
#
mdev -s
}
remove_ko()
{
rmmod drv_ms_cus_gc2053_MIPI
rmmod drv_ms_cus_imx307_MIPI
rmmod drv_ms_cus_sc3335_MIPI
rmmod mi_shadow
rmmod mi_venc
rmmod mi_vif
rmmod mi_sensor
rmmod mi_vpe
rmmod mi_ipu
rmmod mi_divp
rmmod mi_rgn
rmmod mi_ao
rmmod mi_ai
rmmod mi_sys
rmmod mi_common
rmmod mhal
}
if [ -z ${sensor} ]; then
echo -e "\n\e[1;31mThe sensor parameter is MISSING\e[0m\n" | logger -s -t OpenIPC
exit 1
elif [ ${sensor} = "none" ]; then
echo -e "\n\e[1;33mThe sensor is assigned to NONE\e[0m\n" | logger -s -t OpenIPC
exit 0
else
echo -e "\n\e[1;32mThe sensor is assigned - ${sensor}\e[0m\n" | logger -s -t OpenIPC
fi
if [ "$1" = "-i" ]; then
insert_ko
fi
if [ "$1" = "-r" ]; then
remove_ko
fi
if [ $# -eq 0 ] || [ "$1" = "-a" ]; then
remove_ko
insert_ko
fi
exit 0