[Sigmastar] update infinit6e sensor handling

pull/730/head
Viktor 2023-04-19 16:32:14 +02:00 committed by viktorxda
parent a5f1f0de1e
commit 0feaa8f0b3
18 changed files with 49 additions and 79 deletions

View File

@ -79,7 +79,6 @@ BR2_PACKAGE_MICROBE_WEB=y
BR2_PACKAGE_OPUS_OPENIPC=y
BR2_PACKAGE_OPUS_OPENIPC_FIXED_POINT=y
BR2_PACKAGE_SIGMASTAR_OSDRV_INFINITY6E=y
BR2_PACKAGE_SIGMASTAR_OSDRV_SENSOR="imx415"
BR2_PACKAGE_DOSFSTOOLS=y
BR2_PACKAGE_DOSFSTOOLS_FSCK_FAT=y
BR2_PACKAGE_EXFAT_OPENIPC=y

View File

@ -2,8 +2,3 @@ config BR2_PACKAGE_SIGMASTAR_OSDRV_INFINITY6E
bool "sigmastar-osdrv-infinity6e"
help
sigmastar-osdrv-infinity6e - SigmaStar kernel modules and libs
config BR2_PACKAGE_SIGMASTAR_OSDRV_SENSOR
depends on BR2_PACKAGE_SIGMASTAR_OSDRV_INFINITY6E
string "Camera sensor"
default "imx415"

View File

@ -1,101 +1,82 @@
#!/bin/sh
#
# OpenIPC.org | 2023.03.01
# OpenIPC.org | 2023.04.01
#
# Usage: load_sigmastar [-r|-i|-a]
# Usage: load_sigmastar [ -r | -i ]
# -r : remove all modules
# -i : insert all modules
# default : remove and insert all modules
# default : insert all modules
PATH_MODULE=/lib/modules/4.9.84/sigmastar
PATH_FIRMWARE=/etc/sensors/venc_fw/chagall.bin
# Sensor
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=768 logBufSize=256
insmod ${PATH_MODULE}/mi_rgn.ko
insmod ${PATH_MODULE}/mi_ldc.ko
insmod ${PATH_MODULE}/mi_ai.ko
insmod ${PATH_MODULE}/mi_ao.ko
insmod ${PATH_MODULE}/mi_mipitx.ko
insmod ${PATH_MODULE}/mi_sensor.ko
insmod ${PATH_MODULE}/mi_shadow.ko
insmod ${PATH_MODULE}/mi_divp.ko thread_priority=98
insmod ${PATH_MODULE}/mi_vif.ko thread_priority=98
insmod ${PATH_MODULE}/mi_vpe.ko thread_priority=98
insmod ${PATH_MODULE}/mhal.ko
insmod ${PATH_MODULE}/mi_common.ko
insmod ${PATH_MODULE}/mi_sys.ko cmdQBufSize=768 logBufSize=256
insmod ${PATH_MODULE}/mi_rgn.ko
insmod ${PATH_MODULE}/mi_ldc.ko
insmod ${PATH_MODULE}/mi_ai.ko
insmod ${PATH_MODULE}/mi_ao.ko
insmod ${PATH_MODULE}/mi_mipitx.ko
insmod ${PATH_MODULE}/mi_sensor.ko
insmod ${PATH_MODULE}/mi_shadow.ko
insmod ${PATH_MODULE}/mi_divp.ko
insmod ${PATH_MODULE}/mi_vif.ko
insmod ${PATH_MODULE}/mi_vpe.ko
insmod ${PATH_MODULE}/mi_venc.ko fw_path=${PATH_FIRMWARE}
insmod ${PATH_MODULE}/sensor_${sensor}_mipi.ko chmap=1
case $sensor in
imx415)
insmod ${PATH_MODULE}/mi_venc.ko fw_path=${PATH_FIRMWARE};
;;
*)
echo -e "\n\e[1;31mAn UNSUPPORTED sensor type is specified - ${sensor}\e[0m\n" | logger -s -t OpenIPC;
;;
esac
major=$(awk '$2=="mi_poll" {print $1}' /proc/devices)
mknod /dev/mi_poll c $major 0
if [ ! -e /dev/mi_poll ]; then
major=$(awk '$2=="mi_poll" {print $1}' /proc/devices | head -n 1)
mknod /dev/mi_poll c $major 0
fi
# Change iqfile folder
echo isproot /etc/sensors/iqfile > /dev/ispmid
case $sensor in
imx415)
insmod ${PATH_MODULE}/sensor_${sensor}_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
echo isproot /etc/sensors/iqfile > /dev/ispmid
mdev -s
}
remove_ko() {
rmmod -w drv_ms_cus_${sensor}_MIPI
rmmod -w mi_venc
rmmod -w mi_shadow
rmmod -w mi_sensor
rmmod -w mi_mipitx
rmmod -w mi_ao
rmmod -w mi_ai
rmmod -w mi_vpe
rmmod -w mi_vif
rmmod -w mi_divp
rmmod -w mi_ldc
rmmod -w mi_rgn
rmmod -w mi_sys
rmmod -w mi_common
rmmod -w mhal
rmmod -w drv_ms_cus_${sensor}_MIPI
rmmod -w mi_venc
rmmod -w mi_shadow
rmmod -w mi_sensor
rmmod -w mi_mipitx
rmmod -w mi_ao
rmmod -w mi_ai
rmmod -w mi_vpe
rmmod -w mi_vif
rmmod -w mi_divp
rmmod -w mi_ldc
rmmod -w mi_rgn
rmmod -w mi_sys
rmmod -w mi_common
rmmod -w mhal
}
if [ -z ${sensor} ]; then
echo -e "\n\e[1;31mThe sensor parameter is MISSING\e[0m\n" | logger -s -t OpenIPC
exit 1
echo -e "\n\e[1;31mThe sensor parameter is MISSING\e[0m\n" | logger -s -t OpenIPC
echo -e "\n\e[1;33mUsage: fw_setenv sensor imx415\e[0m\n" | logger -s -t OpenIPC
echo -e "\n\e[1;33m load_sigmastar\e[0m\n" | logger -s -t OpenIPC
exit 1
else
echo -e "\n\e[1;32mThe sensor is assigned - ${sensor}\e[0m\n" | logger -s -t OpenIPC
echo -e "\n\e[1;32mThe sensor is assigned - ${sensor}\e[0m\n" | logger -s -t OpenIPC
fi
if [ "$1" = "-i" ]; then
insert_ko
insert_ko
fi
if [ "$1" = "-r" ]; then
remove_ko
remove_ko
fi
if [ $# -eq 0 ] || [ "$1" = "-a" ]; then
remove_ko
insert_ko
if [ $# -eq 0 ]; then
insert_ko
fi
exit 0

View File

@ -10,7 +10,6 @@ SIGMASTAR_OSDRV_INFINITY6E_LICENSE = MIT
SIGMASTAR_OSDRV_INFINITY6E_LICENSE_FILES = LICENSE
SIGMASTAR_OSDRV_INFINITY6E_PATH = $(SIGMASTAR_OSDRV_INFINITY6E_PKGDIR)/files
SIGMASTAR_OSDRV_INFINITY6E_SENSOR = $(call qstrip,$(BR2_PACKAGE_SIGMASTAR_OSDRV_SENSOR))
define SIGMASTAR_OSDRV_INFINITY6E_INSTALL_TARGET_CMDS
$(INSTALL) -m 755 -d $(TARGET_DIR)/usr/bin
@ -21,17 +20,13 @@ define SIGMASTAR_OSDRV_INFINITY6E_INSTALL_TARGET_CMDS
$(INSTALL) -m 755 -d $(TARGET_DIR)/lib/modules/4.9.84/sigmastar
$(INSTALL) -m 644 -t $(TARGET_DIR)/lib/modules/4.9.84/sigmastar $(SIGMASTAR_OSDRV_INFINITY6E_PATH)/kmod/*.ko
$(INSTALL) -m 644 -t $(TARGET_DIR)/lib/modules/4.9.84/sigmastar $(SIGMASTAR_OSDRV_INFINITY6E_PATH)/sensor/$(SIGMASTAR_OSDRV_INFINITY6E_SENSOR)/*.ko
$(INSTALL) -m 644 -t $(TARGET_DIR)/lib/modules/4.9.84/sigmastar $(SIGMASTAR_OSDRV_INFINITY6E_PATH)/sensor/kmod/*.ko
$(INSTALL) -m 755 -d $(TARGET_DIR)/etc/sensors/iqfile
$(INSTALL) -m 644 -t $(TARGET_DIR)/etc/sensors/iqfile $(SIGMASTAR_OSDRV_INFINITY6E_PATH)/sensor/$(SIGMASTAR_OSDRV_INFINITY6E_SENSOR)/$(SIGMASTAR_OSDRV_INFINITY6E_SENSOR)_iqfile.bin
ln -sf $(SIGMASTAR_OSDRV_INFINITY6E_SENSOR)_iqfile.bin $(TARGET_DIR)/etc/sensors/iqfile/iqfile0.bin
$(INSTALL) -m 644 -t $(TARGET_DIR)/etc/sensors/iqfile $(SIGMASTAR_OSDRV_INFINITY6E_PATH)/sensor/iqfile/iqfile0.bin
$(INSTALL) -m 755 -d $(TARGET_DIR)/etc/sensors/venc_fw
$(INSTALL) -m 644 -t $(TARGET_DIR)/etc/sensors/venc_fw $(SIGMASTAR_OSDRV_INFINITY6E_PATH)/sensor/venc_fw/chagall.bin
# Set sensor for insmod
sed -i "s/sensor=/sensor=$(SIGMASTAR_OSDRV_INFINITY6E_SENSOR)/g" $(TARGET_DIR)/usr/bin/load_sigmastar
endef
$(eval $(generic-package))