Merge "[Bugfix][T106][bug-view-2278] Fixed the bug that when calling the WiFi interface, the audio recording and playback would be blocked abnormally" into INTEST_PM_SDK6.1_2WIFI
diff --git a/ap/os/linux/linux-3.4.x/sound/soc/sanechips/Kconfig b/ap/os/linux/linux-3.4.x/sound/soc/sanechips/Kconfig
index baafde6..b481212 100644
--- a/ap/os/linux/linux-3.4.x/sound/soc/sanechips/Kconfig
+++ b/ap/os/linux/linux-3.4.x/sound/soc/sanechips/Kconfig
@@ -1,7 +1,10 @@
 config SND_SOC_SANECHIPS
 	tristate "ASoC support for Sanechips zx297520v3"
 	depends on ARCH_ZX297520V3 || ARCH_ZX297520V2 
+	select SND_SOC_ZX297520V3 if ARCH_ZX297520V3
 	select SND_SOC_ZX297520V2 if ARCH_ZX297520V2
+	select SND_SOC_ZX_I2S
+	select SND_SOC_ZX_PCM
 
 config SND_SOC_ZX297520V3_TI3100
 	tristate "SoC I2S Audio support for ZX297520V3 - TI3100"
diff --git a/ap/project/zx297520v3/prj_vehicle_dc_ref/config/normal/config.linux b/ap/project/zx297520v3/prj_vehicle_dc_ref/config/normal/config.linux
index e5764dc..12ca404 100755
--- a/ap/project/zx297520v3/prj_vehicle_dc_ref/config/normal/config.linux
+++ b/ap/project/zx297520v3/prj_vehicle_dc_ref/config/normal/config.linux
@@ -1375,9 +1375,9 @@
 # CONFIG_SND_SOC_ZX297520V3_NAU8810 is not set
 CONFIG_SND_SOC_ZX297520V3_DUMMY=y
 CONFIG_SND_SOC_ZX_VOICE=y
-# CONFIG_SND_SOC_ZX297520V3 is not set
-# CONFIG_SND_SOC_ZX_I2S is not set
-# CONFIG_SND_SOC_ZX_PCM is not
+CONFIG_SND_SOC_ZX297520V3=y
+CONFIG_SND_SOC_ZX_I2S=y
+CONFIG_SND_SOC_ZX_PCM=y
 CONFIG_SND_EXTRA_CTRL=y
 CONFIG_SND_SOC_DUMMY=y
 # CONFIG_HID_SUPPORT is not set
diff --git a/boot/common/src/uboot/drivers/gpio/hal_gpio.c b/boot/common/src/uboot/drivers/gpio/hal_gpio.c
index 82d1e82..33468b1 100644
--- a/boot/common/src/uboot/drivers/gpio/hal_gpio.c
+++ b/boot/common/src/uboot/drivers/gpio/hal_gpio.c
@@ -395,6 +395,22 @@
 			reg32(GPIO1_REG_BASE + 0x40 *i + 0x20)=0;	

 			reg32(GPIO1_REG_BASE + 0x40 *i + 0x24)=0;

 		}

+//xf.li@20250809 add for bug-2083 (intest emmc power gpio) start

+		else if(i==0)//gpio128

+		{

+			reg32(GPIO0_REG_BASE + 0x40 *i + 0x00)=0;

+			reg32(GPIO0_REG_BASE + 0x40 *i + 0x18)=0;

+			reg32(GPIO0_REG_BASE + 0x40 *i + 0x1c)=0;

+			reg32(GPIO0_REG_BASE + 0x40 *i + 0x20)=0;

+			reg32(GPIO0_REG_BASE + 0x40 *i + 0x24)=0;

+

+			reg32(GPIO1_REG_BASE + 0x40 *i + 0x00) &=0x1;

+			reg32(GPIO1_REG_BASE + 0x40 *i + 0x18) &=0x1;

+			reg32(GPIO1_REG_BASE + 0x40 *i + 0x1c) &=0x1;

+			reg32(GPIO1_REG_BASE + 0x40 *i + 0x20) &=0x1;

+			reg32(GPIO1_REG_BASE + 0x40 *i + 0x24) &=0x1;

+		}

+//xf.li@20250809 add for bug-2083 (intest emmc power gpio) end

 		else {

 			reg32(GPIO0_REG_BASE + 0x40 *i + 0x00)=0;

 			reg32(GPIO0_REG_BASE + 0x40 *i + 0x18)=0;

@@ -459,7 +475,13 @@
 	reg32(IO_CFG_REG_BASE + 0x20)=0x00154ff7;

 	reg32(IO_CFG_REG_BASE + 0x24)=0x00555555;	

 	reg32(IO_CFG_REG_BASE + 0x28)=0x00003858;	

-	reg32(IO_CFG_REG_BASE + 0x2c)=0x05555555;	

+	//reg32(IO_CFG_REG_BASE + 0x2c)=0x05555555;

+//xf.li@20250809 add for bug-2083 (intest emmc power gpio) start

+	tmp=reg32(IO_CFG_REG_BASE + 0x2c);

+	tmp &= 0xc0000;

+	tmp |= 0x05515555;

+	reg32(IO_CFG_REG_BASE + 0x2c)=tmp;

+//xf.li@20250809 add for bug-2083 (intest emmc power gpio) end

 	reg32(IO_CFG_REG_BASE + 0x30)=0x000000ad;

 	reg32(IO_CFG_REG_BASE + 0x34)=0x00000048;	

 	reg32(IO_CFG_REG_BASE + 0x38)=0x00000001;	

diff --git a/cap/zx297520v3/sources/meta-zxic-custom/conf/distro/vehicle_dc_ref.conf b/cap/zx297520v3/sources/meta-zxic-custom/conf/distro/vehicle_dc_ref.conf
index 0ff4c1a..c7ed9ed 100755
--- a/cap/zx297520v3/sources/meta-zxic-custom/conf/distro/vehicle_dc_ref.conf
+++ b/cap/zx297520v3/sources/meta-zxic-custom/conf/distro/vehicle_dc_ref.conf
@@ -95,6 +95,8 @@
 
 #dm-verity for squashfs
 DISTRO_FEATURES += " dm-verity "
+#support cgroup
+DISTRO_FEATURES += " cgroup "
 
 
 #CUSTOM_MACRO在各个产品不变的宏放到cpe-base.inc文件,变化的宏放在产品发布文件。
diff --git a/cap/zx297520v3/sources/meta-zxic-custom/recipes-core/images/files/zx297520v3/vehicle_dc_ref/fs/normal/rootfs/etc/init.d/first.sh b/cap/zx297520v3/sources/meta-zxic-custom/recipes-core/images/files/zx297520v3/vehicle_dc_ref/fs/normal/rootfs/etc/init.d/first.sh
index 285cdd5..b01f11b 100755
--- a/cap/zx297520v3/sources/meta-zxic-custom/recipes-core/images/files/zx297520v3/vehicle_dc_ref/fs/normal/rootfs/etc/init.d/first.sh
+++ b/cap/zx297520v3/sources/meta-zxic-custom/recipes-core/images/files/zx297520v3/vehicle_dc_ref/fs/normal/rootfs/etc/init.d/first.sh
@@ -46,6 +46,22 @@
 mount   -t  devpts  devpts   /dev/pts
 
 mkdir -p /tmp/run
+#support cgroup
+if [ -e /sys/fs/cgroup ]; then
+    mount -t tmpfs cgroup  /sys/fs/cgroup
+    #mkdir -p /sys/fs/cgroup/cpuset
+    #mount -t cgroup -o cpuset cpuset /sys/fs/cgroup/cpuset
+    mkdir -p /sys/fs/cgroup/cpu,cpuacct
+    mount -t cgroup -o cpu,cpuacct cgroup /sys/fs/cgroup/cpu,cpuacct
+    mkdir -p /sys/fs/cgroup/memory
+    mount -t cgroup -o memory cgroup /sys/fs/cgroup/memory
+    cd /sys/fs/cgroup
+    ln -s /sys/fs/cgroup/cpu,cpuacct cpu
+    ln -s /sys/fs/cgroup/cpu,cpuacct cpuacct
+fi
+
+
+
 
 #软锁panic
 #echo 1 > /proc/sys/kernel/softlockup_panic
diff --git a/cap/zx297520v3/sources/meta-zxic-custom/recipes-kernel/linux/files/zx297520v3/cgroup.cfg b/cap/zx297520v3/sources/meta-zxic-custom/recipes-kernel/linux/files/zx297520v3/cgroup.cfg
new file mode 100644
index 0000000..d72754a
--- /dev/null
+++ b/cap/zx297520v3/sources/meta-zxic-custom/recipes-kernel/linux/files/zx297520v3/cgroup.cfg
@@ -0,0 +1,7 @@
+CONFIG_CGROUP_SCHED=y
+CONFIG_CGROUP_PIDS=y
+CONFIG_CGROUP_CPUACCT=y
+CONFIG_FAIR_GROUP_SCHED=y
+CONFIG_CFS_BANDWIDTH=y
+CONFIG_CGROUPS=y
+
diff --git a/cap/zx297520v3/sources/meta-zxic-custom/recipes-kernel/linux/linux-zxic_5.10.bbappend b/cap/zx297520v3/sources/meta-zxic-custom/recipes-kernel/linux/linux-zxic_5.10.bbappend
index 3d328f4..ac8c86c 100755
--- a/cap/zx297520v3/sources/meta-zxic-custom/recipes-kernel/linux/linux-zxic_5.10.bbappend
+++ b/cap/zx297520v3/sources/meta-zxic-custom/recipes-kernel/linux/linux-zxic_5.10.bbappend
@@ -4,4 +4,5 @@
     file://${LINUX_CONFIG} \
     ${@bb.utils.contains('DISTRO_FEATURES', 'OPTEE', 'file://optee.cfg', '', d)} \
     ${@bb.utils.contains('DISTRO_FEATURES', 'dm-verity', 'file://dm-verity.cfg', '', d)} \
-"
\ No newline at end of file
+    ${@bb.utils.contains('DISTRO_FEATURES', 'cgroup', 'file://cgroup.cfg', '', d)} \
+"
diff --git a/cap/zx297520v3/src/lynq/framework/lynq-fota-backup/lynq-fota-backup.sh b/cap/zx297520v3/src/lynq/framework/lynq-fota-backup/lynq-fota-backup.sh
index 53eb20f..8013112 100644
--- a/cap/zx297520v3/src/lynq/framework/lynq-fota-backup/lynq-fota-backup.sh
+++ b/cap/zx297520v3/src/lynq/framework/lynq-fota-backup/lynq-fota-backup.sh
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# Run the daemon
+# Run the daemon with CPU cgroup limitation
 #
 
 DAEMON="lynq-fota-backup-service"
@@ -8,11 +8,52 @@
 EXEC="/usr/bin/lynq-fota-backup"
 EXEC_ARGS=""
 
+# Cgroup配置
+CGROUP_NAME="fota_backup"
+CGROUP_PATH="/sys/fs/cgroup/cpu/$CGROUP_NAME"
+CPU_LIMIT="20000"  # 20% CPU (100000 = 100%)
+
+# 创建Cgroup并设置CPU限制
+setup_cgroup() {
+	if [ ! -d "$CGROUP_PATH" ]; then
+		mkdir -p "$CGROUP_PATH"
+		echo "$CPU_LIMIT" > "$CGROUP_PATH/cpu.cfs_quota_us"
+		echo "100000" > "$CGROUP_PATH/cpu.cfs_period_us"
+		echo "Cgroup $CGROUP_NAME created with 20% CPU limit"
+	else
+		echo "Cgroup $CGROUP_NAME already exists, updating limit"
+		echo "$CPU_LIMIT" > "$CGROUP_PATH/cpu.cfs_quota_us"
+	fi
+}
+
+# 将进程添加到Cgroup
+add_to_cgroup() {
+	PID=$1
+	if [ -d "$CGROUP_PATH" ]; then
+		echo "$PID" > "$CGROUP_PATH/tasks"
+		echo -n "Process $PID added to Cgroup $CGROUP_NAME"
+	else
+		echo -n "ERROR: Cgroup $CGROUP_PATH does not exist!"
+	fi
+}
 
 start() {
-        echo -n "Starting $DAEMON... "
-        start-stop-daemon --no-close -S -b -m -p $PIDFILE -x $EXEC -- $EXEC_ARGS
-        [ $? -eq 0 ] && echo "OK" || echo "ERROR"
+	sleep 600
+	echo "Starting $DAEMON with 20% CPU limit... "
+	setup_cgroup
+	start-stop-daemon --no-close -S -b -m -p $PIDFILE -x $EXEC -- $EXEC_ARGS
+	RETVAL=$?
+	if [ $RETVAL -eq 0 ]; then
+		PID=$(cat $PIDFILE 2>/dev/null)
+		if [ -n "$PID" ]; then
+			add_to_cgroup "$PID"
+		else
+			echo "WARNING: Failed to read PID from $PIDFILE"
+		fi
+			echo "OK"
+		else
+			echo "ERROR"
+	fi
 }
 
 stop() {
@@ -22,18 +63,22 @@
 }
 
 restart() {
-        stop
-        start
+        stop 
+        start &
 }
 
 case "$1" in
-  start|stop|restart)
+	start)
+	start &
+	;;
+	stop|restart)
         "$1"
         ;;
-  *)
+	*)
         echo "Usage: $0 {start|stop|restart}"
         exit 1
 esac
 
 exit $?
 
+