fix pmu bug for MaixCAM-Pro

This commit is contained in:
Neucrack
2025-08-04 20:36:48 +08:00
parent 6aedfa43db
commit 891bfba94f
3 changed files with 48 additions and 34 deletions

View File

@@ -7,8 +7,8 @@ then
cd /mnt/system/ko/
insmod soph_sys.ko
insmod soph_base.ko
insmod soph_rtos_cmdqu.ko
insmod soph_fast_image.ko
insmod soph_rtos_cmdqu.ko # optional for RTOS core
insmod soph_fast_image.ko # optional for RTOS core
insmod soph_mipi_rx.ko
insmod soph_snsr_i2c.ko
insmod soph_vi.ko

View File

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

View File

@@ -11,16 +11,16 @@ then
then
panel_value=$(grep '^panel=' /boot/uEnv.txt | cut -d '=' -f 2)
fi
if [ "$panel_value" = "st7701_lct024bsi20" ]
if [ "$panel_value" = "st7701_lct024bsi20" ] # MaixCAM-Pro
then
echo "load cst7xx touchscreen driver"
insmod /mnt/system/ko/hynitron_touch_new.ko
elif [ "$panel_value" = "st7701_hd228001c31" ]
elif [ "$panel_value" = "st7701_hd228001c31" ] # MaixCAM
then
echo "load cst3xx touchscreen driver"
insmod /mnt/system/ko/hynitron_touch.ko
fi
if [ -e /boot/gt9xx ]
elif [ "$panel_value" = "mtd700920b" ] # 7-inch touchscreen
then
echo "load gt9xx touchscreen driver"
insmod /mnt/system/ko/3rd/gt9xx.ko