Skip to content

Commit

Permalink
v500 fixes (#1712)
Browse files Browse the repository at this point in the history
  • Loading branch information
cronyx authored Feb 18, 2025
1 parent f37407c commit c81a39c
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 45 deletions.
2 changes: 1 addition & 1 deletion br-ext-chip-goke/configs/gk7201v200_lite_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ BR2_PACKAGE_LIBOGG_OPENIPC=y
BR2_PACKAGE_LINUX_FIRMWARE_OPENIPC=y
BR2_PACKAGE_MAJESTIC_FONTS=y
BR2_PACKAGE_MAJESTIC_WEBUI=y
# BR2_PACKAGE_MAJESTIC=y
# BR2_PACKAGE_MAJESTIC is not set
BR2_PACKAGE_MBEDTLS_OPENIPC=y
BR2_PACKAGE_MOTORS=y
BR2_PACKAGE_OPUS_OPENIPC=y
Expand Down
2 changes: 1 addition & 1 deletion br-ext-chip-goke/configs/gk7205v500_lite_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ BR2_PACKAGE_LIBOGG_OPENIPC=y
BR2_PACKAGE_LINUX_FIRMWARE_OPENIPC=y
BR2_PACKAGE_MAJESTIC_FONTS=y
BR2_PACKAGE_MAJESTIC_WEBUI=y
BR2_PACKAGE_MAJESTIC=y
# BR2_PACKAGE_MAJESTIC is not set
BR2_PACKAGE_MBEDTLS_OPENIPC=y
BR2_PACKAGE_MOTORS=y
BR2_PACKAGE_OPUS_OPENIPC=y
Expand Down
71 changes: 28 additions & 43 deletions general/package/goke-osdrv-gk7205v500/files/script/load_goke
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
#!/bin/sh
####################Variables Definition##########################
#
# This is part of OpenIPC.org project | 2025.02.18
#

# Board
board=demo

# SoC detect
CHIP_TYPE=$(ipcinfo --chip-name)
chipid=$(ipcinfo --chip-name)

# Memory config
mem_start=0x40000000 # phy mem start
Expand All @@ -13,7 +18,6 @@ mem_total=${mem_total:=64}
os_mem_size=$(fw_printenv -n osmem | tr -d 'M')
os_mem_size=${os_mem_size:=32}

BOARD=demo
YUV_TYPE0=0 # 0 -- raw, 1 --DC, 2 --bt1120, 3 --bt656

cd /lib/modules/$(uname -r)/goke/
Expand All @@ -23,30 +27,30 @@ report_error() {
exit 1
}

check_allocator() {
allocator=$(grep mmz_allocator /proc/cmdline)
if [ -z "${allocator}" ]; then
if [ ${mem_total} -ge 128 ]; then
set_allocator cma
else
set_allocator xmedia
fi
fi
calc_mmz_info() {
mmz_start=$(echo "$mem_start $os_mem_size" |
awk 'BEGIN { temp = 0; }
{
temp = $1/1024/1024 + $2;
}
END { printf("0x%x00000\n", temp); }')

mmz_size=$(echo "$mem_total $os_mem_size" |
awk 'BEGIN { temp = 0; }
{
temp = $1 - $2;
}
END { printf("%dM\n", temp); }')
echo "mmz_start: $mmz_start, mmz_size: $mmz_size"
}

insert_osal() {
check_allocator

MMZ=$(awk -F '=' '$1=="mmz"{print $2}' RS=" " /proc/cmdline)
if [ -z "$MMZ" ]; then
modprobe xm_osal mmz_allocator=xmedia mmz=anonymous,0,$mmz_start,$mmz_size || report_error
else
modprobe xm_osal mmz_allocator=cma mmz=$MMZ || report_error
fi
calc_mmz_info
modprobe xm_osal mmz_allocator=xmedia mmz=anonymous,0,$mmz_start,$mmz_size || report_error
}

insert_detect() {
modprobe xm_sysconfig chip=$CHIP_TYPE sensors=unknown g_cmos_yuv_flag=$YUV_TYPE0 board=$BOARD
modprobe xm_sysconfig chip=${chipid} sensors=unknown g_cmos_yuv_flag=$YUV_TYPE0 board=${board}
insert_osal
insmod xm_base.ko
modprobe xm_isp
Expand Down Expand Up @@ -88,7 +92,7 @@ insert_isp() {
}

insert_isp_piris() {
if [ "$CHIP_TYPE" == "gk7605v100" -a "$BOARD" == "demo" ]; then
if [ "${chipid}" == "gk7605v100" -a "${board}" == "demo" ]; then
modprobe xm_piris
fi
}
Expand All @@ -97,7 +101,7 @@ insert_ko() {
if [ "$SENSOR" == "bt656" ] || [ "$SENSOR" == "jxf23_dc" ]; then
YUV_TYPE0=1
fi
modprobe xm_sysconfig chip=$CHIP_TYPE sensors=$SENSOR g_cmos_yuv_flag=$YUV_TYPE0 board=$BOARD
modprobe xm_sysconfig chip=${chipid} sensors=$SENSOR g_cmos_yuv_flag=$YUV_TYPE0 board=${board}
insert_osal
insmod xm_base.ko
insmod xm_sys.ko
Expand Down Expand Up @@ -172,23 +176,6 @@ load_usage() {
echo -e "for example: ./load_goke -i -sensor imx307 -osmem 32M -board demo -yuv0 0\n"
}

calc_mmz_info() {
mmz_start=$(echo "$mem_start $os_mem_size" |
awk 'BEGIN { temp = 0; }
{
temp = $1/1024/1024 + $2;
}
END { printf("0x%x00000\n", temp); }')

mmz_size=$(echo "$mem_total $os_mem_size" |
awk 'BEGIN { temp = 0; }
{
temp = $1 - $2;
}
END { printf("%dM\n", temp); }')
echo "mmz_start: $mmz_start, mmz_size: $mmz_size"
}

######################parse arg###################################
b_arg_sensor0=0
b_arg_sensor1=0
Expand Down Expand Up @@ -221,7 +208,7 @@ for arg in $@; do

if [ $b_arg_board -eq 1 ]; then
b_arg_board=0
BOARD=$arg
board=$arg
fi

case $arg in
Expand Down Expand Up @@ -261,8 +248,6 @@ if [ $os_mem_size -ge $mem_total ]; then
exit
fi

calc_mmz_info

#######################Action###############################

if [ $# -lt 1 ]; then
Expand Down

0 comments on commit c81a39c

Please sign in to comment.