firmware/general/package/ingenic-osdrv-t21/files/script/load_ingenic

116 lines
2.3 KiB
Bash
Executable File

#!/bin/sh
KMOD_PATH=/lib/modules/$(uname -r)/ingenic
SOC=$(ipcinfo -c)
vendor=$(ipcinfo -v)
if [ ! -f /usr/sbin/sensor_cli ]; then
ln -s /usr/sbin/extutils /usr/sbin/sensor_cli
fi
echo 1 >/proc/sys/vm/overcommit_memory
log_vendor() {
logger -s -p daemon.info -t ${vendor} "$1"
}
check_return() {
if [ $? -ne 0 ]; then
echo err: $1
echo exit
exit
fi
}
lsmod | grep "sinfo" >/dev/null
if [ $? -ne 0 ]; then
insmod ${KMOD_PATH/%\//}/sinfo.ko
check_return "insmod sinfo"
fi
if fw_printenv -n sensor >/dev/null; then
export SENSOR=$(fw_printenv -n sensor)
log_vendor "Get data from environment and set SENSOR as ${SENSOR}"
else
echo 1 >/proc/jz/sinfo/info
check_return "start sinfo"
SENSOR_INFO=$(cat /proc/jz/sinfo/info)
check_return "get sensor type"
SENSOR=${SENSOR_INFO#*:}
if [ "sensor not found" = "$SENSOR" ]; then
unset SENSOR
fw_setenv sensor
else
log_vendor "Get data from sinfo and set SENSOR as ${SENSOR}"
fw_setenv sensor $SENSOR && log_vendor "Write detected ${SENSOR} to U-Boot ENV"
fi
fi
case ${SENSOR} in
"gc2053")
ISP_PARAM="isp_clk=125000000"
SENSOR_PARAM="sensor_max_fps=25 data_interface=1"
;;
"jxf23")
ISP_PARAM="isp_clk=125000000"
SENSOR_PARAM="sensor_gpio_func=0"
;;
"jxf37")
ISP_PARAM="isp_clk=90000000"
SENSOR_PARAM="sensor_gpio_func=0"
;;
"ov2735b")
ISP_PARAM="isp_clk=125000000"
SENSOR_PARAM="sensor_gpio_func=0"
;;
"sc2232")
ISP_PARAM="isp_clk=90000000"
SENSOR_PARAM=""
;;
"sc2232h")
ISP_PARAM="isp_clk=125000000"
SENSOR_PARAM="sensor_gpio_func=0"
;;
"sc2300")
ISP_PARAM="isp_clk=90000000"
SENSOR_PARAM=""
;;
"sc2332")
ISP_PARAM=""
SENSOR_PARAM="sensor_gpio_func=0"
;;
"sc2335")
ISP_PARAM="isp_clk=125000000"
SENSOR_PARAM="sensor_gpio_func=0"
;;
*)
ISP_PARAM="isp_clk=90000000"
SENSOR_PARAM="sensor_gpio_func=0"
break
;;
esac
echo --------------------
echo "ISP_PARAM: ${ISP_PARAM}"
echo "SENSOR: ${SENSOR}"
echo "SENSOR_PARAM: ${SENSOR_PARAM}"
echo --------------------
lsmod | grep "tx_isp" >/dev/null
if [ $? -ne 0 ]; then
insmod ${KMOD_PATH/%\//}/tx-isp-${SOC}.ko ${ISP_PARAM}
check_return "insmod isp drv"
fi
lsmod | grep ${SENSOR} >/dev/null
if [ $? -ne 0 ]; then
insmod ${KMOD_PATH/%\//}/sensor_${SENSOR}_${SOC}.ko ${SENSOR_PARAM}
check_return "insmod sensor drv"
fi
lsmod | grep "audio" >/dev/null
if [ $? -ne 0 ]; then
insmod ${KMOD_PATH/%\//}/audio.ko
check_return "insmod audio"
fi