Sigmastar: add infinity6 osdrv package (#987)

pull/988/head
viktorxda 2023-09-07 19:22:41 +02:00 committed by GitHub
parent 4fc61f2a58
commit 46cfa67aa2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
29 changed files with 164 additions and 3 deletions

View File

@ -71,8 +71,8 @@ BR2_PACKAGE_LIBEVENT_OPENIPC=y
BR2_PACKAGE_LIBEVENT_OPENIPC_REMOVE_PYSCRIPT=y
BR2_PACKAGE_LIBOGG_OPENIPC=y
BR2_PACKAGE_LIBYAML=y
# BR2_PACKAGE_MAJESTIC is not set
# BR2_PACKAGE_MAJESTIC_FONTS is not set
BR2_PACKAGE_MAJESTIC=y
BR2_PACKAGE_MAJESTIC_FONTS=y
BR2_PACKAGE_MBEDTLS_OPENIPC=y
# BR2_PACKAGE_MBEDTLS_OPENIPC_PROGRAMS is not set
# BR2_PACKAGE_MBEDTLS_OPENIPC_COMPRESSION is not set
@ -81,7 +81,7 @@ BR2_PACKAGE_MICROBE_WEB=y
# BR2_PACKAGE_MOTORS is not set
BR2_PACKAGE_OPUS_OPENIPC=y
BR2_PACKAGE_OPUS_OPENIPC_FIXED_POINT=y
# BR2_PACKAGE_SIGMASTAR_OSDRV_INFINITY6B0 is not set
BR2_PACKAGE_SIGMASTAR_OSDRV_INFINITY6=y
BR2_PACKAGE_EXFAT_OPENIPC=y
BR2_PACKAGE_EXFATPROGS=y
# BR2_PACKAGE_SSHPASS is not set

View File

@ -83,6 +83,7 @@ source "$BR2_EXTERNAL_GENERAL_PATH/package/rtl8192eu-openipc/Config.in"
source "$BR2_EXTERNAL_GENERAL_PATH/package/rtl8733bu-openipc/Config.in"
source "$BR2_EXTERNAL_GENERAL_PATH/package/rtl8812au-openipc/Config.in"
source "$BR2_EXTERNAL_GENERAL_PATH/package/rtw-hostapd/Config.in"
source "$BR2_EXTERNAL_GENERAL_PATH/package/sigmastar-osdrv-infinity6/Config.in"
source "$BR2_EXTERNAL_GENERAL_PATH/package/sigmastar-osdrv-infinity6b0/Config.in"
source "$BR2_EXTERNAL_GENERAL_PATH/package/sigmastar-osdrv-infinity6e/Config.in"
source "$BR2_EXTERNAL_GENERAL_PATH/package/sigmastar-osdrv-msc313e/Config.in"

View File

@ -0,0 +1,5 @@
config BR2_PACKAGE_SIGMASTAR_OSDRV_INFINITY6
bool "sigmastar-osdrv-infinity6"
select BR2_PACKAGE_SIGMASTAR_OSDRV_SENSOR
help
Sigmastar infinity6 kernel modules

View File

@ -0,0 +1,60 @@
#!/bin/sh
#
# OpenIPC.org | 2023.09.01
#
PATH_MODULE=/lib/modules/4.9.84/sigmastar
PATH_SENSOR=${PATH_MODULE}/sensor
SENSOR=$(fw_printenv -n sensor)
detect_sensor() {
devmem 0x1F207188 16 0x0001
devmem 0x1F263200 16 0x000D
SENSOR=$(ipcinfo -s)
fw_setenv sensor ${SENSOR}
}
set_sensor() {
case ${SENSOR} in
imx307)
insmod ${PATH_SENSOR}/sensor_${SENSOR}_mipi.ko chmap=1 lane_num=2 hdr_lane_num=2 mclk=37.125M
;;
*)
echo -e "\n\e[1;31mUNSUPPORTED sensor found - ${SENSOR}\e[0m\n" | logger -s -t OpenIPC
;;
esac
}
insert_ko() {
insmod ${PATH_MODULE}/mhal.ko
insmod ${PATH_MODULE}/mi_common.ko
insmod ${PATH_MODULE}/mi_sys.ko logBufSize=256 default_config_path=/usr/bin
insmod ${PATH_MODULE}/mi_rgn.ko
insmod ${PATH_MODULE}/mi_ai.ko
insmod ${PATH_MODULE}/mi_ao.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
}
if [ ! -e /dev/mi_poll ]; then
insert_ko
fi
if [ -z ${SENSOR} ]; then
echo -e "\n\e[1;33mAutodetect sensor\e[0m\n" | logger -s -t OpenIPC
detect_sensor
fi
if [ -z ${SENSOR} ]; then
echo -e "\n\e[1;31mSensor parameter is MISSING\e[0m\n" | logger -s -t OpenIPC
exit 1
else
echo -e "\n\e[1;32mSensor is assigned - ${SENSOR}\e[0m\n" | logger -s -t OpenIPC
$(lsmod | grep -q ${SENSOR}) || set_sensor
fi
exit 0

View File

@ -0,0 +1,57 @@
#include <stdio.h>
#include <string.h>
#include <errno.h>
#include <fcntl.h>
#include <unistd.h>
#include <src/tools.h>
#define BOUNDS 0x80000000
#define LENGTH 0x1A000
#define ALIGN 0x1000
#define CMDQ "E_MMAP_ID_CMDQ"
#define SSTAR 0x1F2025A4
int main() {
char buf[128];
int fd, size;
uint32_t addr, total, val;
if (!mem_reg(SSTAR, &val, 0)) {
printf("Failed to read memory address: 0x%X\n", SSTAR);
return -1;
}
val = 1 << (val >> 12);
if (val == 64) {
addr = 0x3FC6000;
total = 0x4000000;
} else if (val == 128) {
addr = 0x7FC6000;
total = 0x8000000;
} else if (val == 256) {
addr = 0xFFC6000;
total = 0x10000000;
}
fd = open("/proc/mi_modules/common/memory_info", O_WRONLY);
if (fd < 0) {
printf("Failed to open memory_info: %s\n", strerror(errno));
return -1;
}
size = sprintf(buf, "%u %u %u %u %u %u %u\n", total, total, 0, BOUNDS, 1, 1, 0);
write(fd, buf, size);
close(fd);
fd = open("/proc/mi_modules/common/mmap_info", O_WRONLY);
if (fd < 0) {
printf("Failed to open mmap_info: %s\n", strerror(errno));
return -1;
}
size = sprintf(buf, "%s %u %u %u %u %u %u %u %u\n", CMDQ, 0, addr, LENGTH, 0, ALIGN, 4, 0, 0);
write(fd, buf, size);
close(fd);
return 0;
}

View File

@ -0,0 +1,38 @@
################################################################################
#
# sigmastar-osdrv-infinity6
#
################################################################################
SIGMASTAR_OSDRV_INFINITY6_VERSION =
SIGMASTAR_OSDRV_INFINITY6_SITE =
SIGMASTAR_OSDRV_INFINITY6_LICENSE = MIT
SIGMASTAR_OSDRV_INFINITY6_LICENSE_FILES = LICENSE
SIGMASTAR_OSDRV_INFINITY6_DEPENDENCIES = ipctool
define SIGMASTAR_OSDRV_INFINITY6_BUILD_CMDS
cp -rf $(SIGMASTAR_OSDRV_INFINITY6_PKGDIR)/files/src $(@D)
$(TARGET_CC) $(@D)/src/config_tool.c -o $(@D)/config_tool -s \
-I$(BUILD_DIR)/ipctool -L$(BUILD_DIR)/ipctool -lipchw
endef
define SIGMASTAR_OSDRV_INFINITY6_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_INFINITY6_PKGDIR)/files/kmod/*
$(INSTALL) -m 755 -d $(TARGET_DIR)/etc/firmware
$(INSTALL) -m 644 -t $(TARGET_DIR)/etc/firmware $(SIGMASTAR_OSDRV_INFINITY6_PKGDIR)/files/sensor/firmware/*
$(INSTALL) -m 755 -d $(TARGET_DIR)/etc/sensors
$(INSTALL) -m 644 -t $(TARGET_DIR)/etc/sensors $(SIGMASTAR_OSDRV_INFINITY6_PKGDIR)/files/sensor/configs/*
$(INSTALL) -m 755 -d $(TARGET_DIR)/usr/lib
$(INSTALL) -m 644 -t $(TARGET_DIR)/usr/lib $(SIGMASTAR_OSDRV_INFINITY6_PKGDIR)/files/lib/*
$(INSTALL) -m 755 -d $(TARGET_DIR)/usr/bin
$(INSTALL) -m 755 -t $(TARGET_DIR)/usr/bin $(@D)/config_tool
$(INSTALL) -m 755 -t $(TARGET_DIR)/usr/bin $(SIGMASTAR_OSDRV_INFINITY6_PKGDIR)/files/script/*
endef
$(eval $(generic-package))