Compare commits

...

7 Commits

Author SHA1 Message Date
Neucrack
21ffdadc78 fix gitignore file error 2025-07-29 15:27:01 +08:00
Neucrack
64510bd44d optimize startup logo load and add PyQT5 package 2025-07-28 18:55:41 +08:00
Neucrack
4c9e842ee1 Merge pull request #90 from mcpanl/patch-1
Add USB audio support
2025-05-11 13:24:06 +08:00
洒脱
017c2724d2 Add USB audio support 2025-05-10 21:24:46 +08:00
lxowalle
639ae39291 * add isp config for os04a10 90fps 2025-04-21 15:31:01 +08:00
Neucrack
a3ccb527b2 add usb adbd support, enable with create /boot/usb.adbd file 2025-04-17 19:58:46 +08:00
lxowalle
e4e133f3df * fix audio bug 2025-03-11 18:02:41 +08:00
20 changed files with 4677 additions and 399 deletions

2
.gitignore vendored
View File

@@ -3,6 +3,7 @@
*.o
*.ko
*.d
!init.d
host-tools/
host-tools
*.sqfs
@@ -420,3 +421,4 @@ osdrv/extdrv/wireless/.tmp_4261/
middleware/v2/lib
host-tools/
kvm/
.vscode*

View File

@@ -367,7 +367,9 @@ CONFIG_SND=y
# CONFIG_SND_DRIVERS is not set
CONFIG_SND_HDA_PREALLOC_SIZE=1
# CONFIG_SND_SPI is not set
# CONFIG_SND_USB is not set
CONFIG_SND_USB=y
CONFIG_SND_USB_AUDIO=y
CONFIG_SND_USB_AUDIO_USE_MEDIA_CONTROLLER=y
CONFIG_SND_SOC=y
CONFIG_SND_SOC_CV182XA_CV182XAADC=y
CONFIG_SND_SOC_CV182XA_CV182XADAC=y
@@ -1007,4 +1009,4 @@ CONFIG_USB_SERIAL=y
CONFIG_USB_SERIAL_OPTION=y
CONFIG_USB_ACM=y
CONFIG_VETH=y
CONFIG_VETH=y

View File

@@ -1,4 +1,4 @@
<physical_partition type="sd">
<partition label="BOOT" size_in_kb="80960" readonly="false" file="boot.sd"/>
<partition label="ROOTFS" size_in_kb="1572864" readonly="false" file="rootfs.sd" />
<partition label="ROOTFS" size_in_kb="1638400" readonly="false" file="rootfs.sd" />
</physical_partition>

View File

@@ -17,18 +17,14 @@ then
insmod soph_vo.ko
# insmod soph_mipi_tx.ko
insmod soph_rgn.ko
insmod soph_wdt.ko
insmod soph_clock_cooling.ko
insmod soph_tpu.ko
insmod soph_vcodec.ko
insmod soph_jpeg.ko
insmod soph_vc_driver.ko MaxVencChnNum=9 MaxVdecChnNum=9
insmod soph_rtc.ko
insmod soph_ive.ko
insmod soph_mon.ko
insmod soph_pwm.ko
insmod soph_saradc.ko
insmod soph_wiegand.ko
# insmod soph_wiegand.ko # uncomment it if want use wiegand
echo "OK"
exit 0
fi

View File

@@ -1,31 +1,48 @@
#!/bin/sh
if ! command -v i2cget &> /dev/null
then
echo "i2cdetect not find, please install i2c-tools"
exit 1
fi
start() {
if ! command -v i2cget &> /dev/null
then
echo "i2cdetect not find, please install i2c-tools"
exit 1
fi
pmu_version=$(i2cget -y 4 0x34 0x03)
pmu_version=$((pmu_version & 0xCF))
pmu_version=$(i2cget -y 4 0x34 0x03)
pmu_version=$((pmu_version & 0xCF))
chip_id_1=$(printf "%d" 0x47)
chip_id_2=$(printf "%d" 0x4a)
chip_id_1=$(printf "%d" 0x47)
chip_id_2=$(printf "%d" 0x4a)
if [ "$pmu_version" -eq "$chip_id_1" ] || [ "$pmu_version" -eq "$chip_id_2" ]; then
case "$1" in
if [ "$pmu_version" -eq "$chip_id_1" ] || [ "$pmu_version" -eq "$chip_id_2" ]; then
exec /usr/bin/axp2101
echo "Starting PMU: OK\n"
fi
}
stop() {
runlevel=$(cat /run/runlevel | awk '{ print $1 }')
if [ "$runlevel" = "0" ]; then
printf "Stopping PMU\n"
value=$(i2cget -y 4 0x34 0x10)
value=$((value | 0x01))
i2cset -y 4 0x34 0x10 $value
fi
}
case "$1" in
start)
exec /usr/bin/axp2101
echo "Starting PMU: OK\n"
;;
stop)
runlevel=$(cat /run/runlevel | awk '{ print $1 }')
if [ "$runlevel" = "0" ]; then
printf "Stopping PMU\n"
value=$(i2cget -y 4 0x34 0x10)
value=$((value | 0x01))
i2cset -y 4 0x34 0x10 $value
if grep -q "pmu=axp2101" /boot/board 2>/dev/null; then
start
fi
;;
esac
fi
;;
stop)
if grep -q "pmu=axp2101" /boot/board 2>/dev/null; then
stop
fi
;;
*)
echo "Usage: /etc/init.d/S00pmu {start}"
exit 1
;;
esac

View File

@@ -6,7 +6,5 @@ then
printf "mounting filesystem : "
mkdir -p /boot
mount -t vfat /dev/mmcblk0p1 /boot
mount -t configfs configfs /sys/kernel/config
mount -t debugfs debugfs /sys/kernel/debug
echo "OK"
fi

View File

@@ -2,7 +2,7 @@
if [ "$1" = "start" ]
then
. /etc/profile
# . /etc/profile
if [ ! -e /boot/alpha ]
then
devmem 0x030010AC 32 0x04 # PINMUX PWM10
@@ -21,11 +21,11 @@ then
then
panel_value=$(grep '^panel=' /boot/uEnv.txt | cut -d '=' -f 2)
fi
if [ "$panel_value" = "st7701_hd228001c31" ]
if [ "$panel_value" = "st7701_hd228001c31" ] || [ "$panel_value" = "st7701_lct024bsi20" ]
then
echo "2000" > ${blpwm}/duty_cycle # 20%
else
echo "9000" > ${blpwm}/duty_cycle
echo "5000" > ${blpwm}/duty_cycle
fi
echo 1 > $blpwm/enable
fi

View File

@@ -0,0 +1,10 @@
#!/bin/sh
if [ "$1" = "start" ]
then
. /etc/profile
printf "mounting filesystem : "
mount -t configfs configfs /sys/kernel/config
mount -t debugfs debugfs /sys/kernel/debug
echo "OK"
fi

View File

@@ -0,0 +1,14 @@
#!/bin/sh
if [ "$1" = "start" ]
then
. /etc/profile
printf "load kernel module: "
cd /mnt/system/ko/
insmod soph_wdt.ko
insmod soph_clock_cooling.ko
insmod soph_rtc.ko
insmod soph_mon.ko
echo "OK"
exit 0
fi

View File

@@ -168,7 +168,33 @@ then
ln -s functions/hid.GS2 configs/c.1
fi
ls /sys/class/udc/ | cat > UDC
# adbd
if [ -e /boot/usb.adbd ]
then
echo 0x18d1 > idVendor # google
mkdir -p configs/c.1/strings/0x409
echo "" > configs/c.1/strings/0x409/configuration
echo 0x80 > configs/c.1/bmAttributes
mkdir functions/ffs.adb
ln -s functions/ffs.adb configs/c.1/
mkdir -p /dev/usb-ffs/adb
mount -t functionfs adb /dev/usb-ffs/adb/
/usr/bin/adbd &
for i in $(seq 1 40); do
if [ -e /dev/usb-ffs/adb/ep2 ]; then
break
fi
sleep 0.1
done
fi
while true; do
ls /sys/class/udc/ | cat > UDC || true
res=$(cat UDC)
if [[ "x$res" != "x" ]]; then
break
fi
sleep 0.4
done
echo device > /proc/cviusb/otg_role
fi
fi

File diff suppressed because it is too large Load Diff

View File

@@ -1252,6 +1252,7 @@ menu "External python modules"
source "package/python-pyphen/Config.in"
source "package/python-pyqrcode/Config.in"
source "package/python-pyqt5/Config.in"
source "package/python-pyqt5-sip/Config.in"
source "package/python-pyratemp/Config.in"
source "package/python-pyroute2/Config.in"
source "package/python-pyrsistent/Config.in"

View File

@@ -0,0 +1,7 @@
config BR2_PACKAGE_PYTHON_PYQT5_SIP
bool "python-pyqt5-sip"
help
This is the PyQt5.sip module which is needed at runtime for
the PyQt5 module from package python-pyqt5.
https://pypi.org/project/PyQt5-sip/

View File

@@ -0,0 +1,6 @@
# From https://pypi.org/pypi/PyQt5-sip/json
md5 9e0909e79f40619b0f2d3d3c33b4d4f7 PyQt5_sip-12.15.0.tar.gz
sha256 d23fdfcf363b5cedd9d39f8a9c5710e7d52804f5b08a58e91c638b36eafcb702 PyQt5_sip-12.15.0.tar.gz
# Locally calculated
sha256 3859cfca971e429d6b79bdfeb1dc9e43aa9592f7295bf28fdd62824097909383 LICENSE

View File

@@ -0,0 +1,24 @@
################################################################################
#
# python-sip-qt5
#
################################################################################
# Note about the package version:
# This module version corresponds in fact to the "sip" ABI
# version (not the version of its generator). See:
# https://github.com/Python-SIP/sip/blob/6.8.6/sipbuild/module/source/12/sip.h.in#L43
# The source git repository of this module is located at:
# https://github.com/Python-SIP/sip/tree/main/sipbuild/module/source
# The Python-SIP version/tag which generated a given "sip" module is
# recorded in the PyPI source file "sip.h", in the SIP_VERSION_STR
# macro. For example, PyQt5-sip 12.15.0 was generated with Python-SIP
# 6.8.6.
PYTHON_PYQT5_SIP_VERSION = 12.15.0
PYTHON_PYQT5_SIP_SITE = https://files.pythonhosted.org/packages/1b/15/78318d50f10062c428e97e7ce387e772616a4673c356018b905f247a6a85
PYTHON_PYQT5_SIP_SOURCE = PyQt5_sip-$(PYTHON_PYQT5_SIP_VERSION).tar.gz
PYTHON_PYQT5_SIP_LICENSE = BSD-2-Clause
PYTHON_PYQT5_SIP_LICENSE_FILES = LICENSE
PYTHON_PYQT5_SIP_SETUP_TYPE = setuptools
$(eval $(python-package))

View File

@@ -20,6 +20,10 @@ static unsigned long pool_size_dma32;
static struct gen_pool *atomic_pool_kernel __ro_after_init;
static unsigned long pool_size_kernel;
#ifndef DEFAULT_DMA_COHERENT_POOL_SIZE
#define DEFAULT_DMA_COHERENT_POOL_SIZE SZ_1M
#endif
/* Size can be defined by the coherent_pool command line */
static size_t atomic_pool_size;
@@ -198,7 +202,7 @@ static int __init dma_atomic_pool_init(void)
if (!atomic_pool_size) {
unsigned long pages = totalram_pages() / (SZ_1G / SZ_128K);
pages = min_t(unsigned long, pages, MAX_ORDER_NR_PAGES);
atomic_pool_size = max_t(size_t, pages << PAGE_SHIFT, SZ_128K);
atomic_pool_size = max_t(size_t, pages << PAGE_SHIFT, DEFAULT_DMA_COHERENT_POOL_SIZE);
}
INIT_WORK(&atomic_pool_work, atomic_pool_work_fn);

View File

@@ -3,9 +3,38 @@
export PATH=/
msc() {
umount /dev/mmcblk0p1
umount /dev/mmcblk0p2
echo mmc0 > /sys/devices/platform/leds/leds/led-user/trigger
# backlight
devmem 0x030010AC 32 0x04 # PINMUX PWM10
blpwm="/sys/class/pwm/pwmchip8/pwm2/"
if [ ! -e "${blpwm}" ]
then
echo 2 > /sys/class/pwm/pwmchip8/export
fi
echo 0 > $blpwm/enable
echo "10000" > ${blpwm}/period # 100KHZ
panel_value=""
if [ -e /boot/board ]
then
panel_value=$(grep '^panel=' /boot/board | cut -d '=' -f 2)
elif [ -e /boot/uEnv.txt ]
then
panel_value=$(grep '^panel=' /boot/uEnv.txt | cut -d '=' -f 2)
fi
if [ "$panel_value" = "st7701_hd228001c31" ] || [ "$panel_value" = "st7701_lct024bsi20" ]
then
echo "2000" > ${blpwm}/duty_cycle # 20%
else
echo "5000" > ${blpwm}/duty_cycle
fi
echo 1 > $blpwm/enable
umount /dev/mmcblk0p1
umount /dev/mmcblk0p2 || true
# usb
mount -t configfs configfs /sys/kernel/config
cd /sys/kernel/config/usb_gadget
mkdir g0
cd g0
@@ -65,31 +94,38 @@ mkdir -p /proc
mount -t proc proc /proc
mkdir -p /sys
mount -t sysfs sysfs /sys
mount -t configfs configfs /sys/kernel/config
mount -t debugfs debugfs /sys/kernel/debug
# mount -t debugfs debugfs /sys/kernel/debug
mkdir -p /boot
mount -o ro /dev/mmcblk0p1 /boot
msc=0
if [ -e /boot/rec ]
if [ -e /boot/rec ] # recovery mode
then
msc
fi
# flashkey0=$(cat /sys/kernel/debug/gpio | grep 'User Key' | grep lo | wc -l)
# if [ "${flashkey0}" -ne 0 ]
# then
# msc
# fi
boot_key=0
for arg in $(cat /proc/cmdline); do
case "$arg" in
boot_key=*)
boot_key="${arg#boot_key=}"
;;
esac
done
if [ "${boot_key}" -eq 1 ] # boot key pressed
then
msc
fi
umount /dev/mmcblk0p1
flashkey0=$(cat /sys/kernel/debug/gpio | grep 'User Key' | grep lo | wc -l)
sleep 0.5
flashkey1=$(cat /sys/kernel/debug/gpio | grep 'User Key' | grep lo | wc -l)
if [ "${flashkey0}" -ne 0 ]
then
if [ "${flashkey1}" -ne 0 ]
then
msc
fi
fi
mkdir /realroot
# parted -s /dev/mmcblk0 "resizepart 2 -0"
# echo "yes

View File

@@ -18,6 +18,8 @@
#include <cvi_panels/cvi_panels.h>
#include <asm/io.h>
#include "part.h"
#include "fs.h"
#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
@@ -278,6 +280,40 @@ static int get_value_from_header(const char *filepath, const char *key, char *bu
return -2; // 未找到 key 或 value 为空
}
static bool fat_file_exists(const char *filename)
{
struct blk_desc *dev_desc;
#if defined(CONFIG_NAND_SUPPORT) || defined(CONFIG_SPI_FLASH)
const char *dev_part = "0:1";
int dev = 0;
#elif defined(CONFIG_EMMC_SUPPORT)
const char *dev_part = "1:1";
int dev = 1;
#else
const char *dev_part = "0:1";
int dev = 0;
#endif
dev_desc = blk_get_dev("mmc", dev);
if (!dev_desc || dev_desc->type == DEV_TYPE_UNKNOWN) {
printf("Cannot find mmc device %s\n", dev_part);
return -ENODEV;
}
if (fs_set_blk_dev("mmc", dev_part, FS_TYPE_FAT)) {
printf("Failed to set fs device mmc %s\n", dev_part);
return -EINVAL;
}
if (fs_exists(filename)) {
printf("File %s exists on mmc %s\n", filename, dev_part);
return true;
} else {
printf("File %s not found on mmc %s\n", filename, dev_part);
return false;
}
}
/***************************************************/
static int do_startvo(struct cmd_tbl *cmdtp, int flag, int argc, char * const argv[])
{
@@ -288,6 +324,31 @@ static int do_startvo(struct cmd_tbl *cmdtp, int flag, int argc, char * const ar
if (argc < 4)
return CMD_RET_USAGE;
// check boot key pressed
// writel(0x00000003, 0x03001078);
uint32_t val = readl((const volatile void *)0x03020050);
int boot_key = (val >> 30) & 0x01; // GPIOA30
if (boot_key == 0) // boot key pressed
{
char *_bootargs = NULL;
char new_bootargs[256] = {0};
printf("boot key pressed\n");
_bootargs = env_get("othbootargs");
memcpy(new_bootargs, _bootargs, strlen(_bootargs));
char *boot_key_arg = " boot_key=1";
memcpy(new_bootargs + strlen(new_bootargs), boot_key_arg, strlen(boot_key_arg));
printf("new_othbootargs[%ld]: %s\n", strlen(new_bootargs), new_bootargs);
env_set("othbootargs", new_bootargs);
if (fat_file_exists("logo_upgrade.jpeg"))
env_set("logo", "logo_upgrade.jpeg");
else
env_set("logo", "logo.jpeg");
}
else
{
env_set("logo", "logo.jpeg");
}
dev = simple_strtoul(argv[1], &endp, 10);
if (*argv[1] == 0 || *endp != 0)
return CMD_RET_USAGE;

View File

@@ -283,9 +283,9 @@
#elif defined(CONFIG_SPI_FLASH)
#define LOAD_LOGO "sf probe;sf read " LOGO_READ_ADDR " ${MISC_PART_OFFSET} ${MISC_PART_SIZE};"
#else
#define LOAD_LOGO "mmc dev 0;load mmc 0:1 " LOGO_READ_ADDR " logo.jpeg ;"
#define LOAD_LOGO "mmc dev 0;load mmc 0:1 " LOGO_READ_ADDR " ${logo} ;"
#endif
#define SHOWLOGOCOMMAND LOAD_LOGO CVI_JPEG START_VO START_VL SET_VO_BG
#define SHOWLOGOCOMMAND START_VO LOAD_LOGO CVI_JPEG START_VL SET_VO_BG
#else
#define SHOWLOGOCMD
#endif