-
-
Notifications
You must be signed in to change notification settings - Fork 249
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Sigmastar: add infinity6 osdrv package (#987)
- Loading branch information
Showing
29 changed files
with
164 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
60 changes: 60 additions & 0 deletions
60
general/package/sigmastar-osdrv-infinity6/files/script/load_sigmastar
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
Binary file added
BIN
+60.7 KB
general/package/sigmastar-osdrv-infinity6/files/sensor/configs/gc2053.bin
Binary file not shown.
Binary file added
BIN
+60.7 KB
general/package/sigmastar-osdrv-infinity6/files/sensor/configs/imx307.bin
Binary file not shown.
Binary file added
BIN
+50.3 KB
general/package/sigmastar-osdrv-infinity6/files/sensor/firmware/iqfile0.bin
Binary file not shown.
57 changes: 57 additions & 0 deletions
57
general/package/sigmastar-osdrv-infinity6/files/src/config_tool.c
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; | ||
} |
38 changes: 38 additions & 0 deletions
38
general/package/sigmastar-osdrv-infinity6/sigmastar-osdrv-infinity6.mk
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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)) |