Merge "[Feature][T106]version update to T106-MXX-NTEST2WIFI-56U11.AP.19.09_CAP.19.09" into INTEST_PM_SDK6.1_2WIFI
diff --git a/ap/os/linux/linux-3.4.x/drivers/Makefile b/ap/os/linux/linux-3.4.x/drivers/Makefile
index cf25cf9..d56dc0c 100644
--- a/ap/os/linux/linux-3.4.x/drivers/Makefile
+++ b/ap/os/linux/linux-3.4.x/drivers/Makefile
@@ -12,7 +12,7 @@
 obj-$(CONFIG_PCI)		+= pci/
 obj-$(CONFIG_PARISC)		+= parisc/
 obj-$(CONFIG_RAPIDIO)		+= rapidio/
-obj-y				+= video/
+obj-n				+= video/
 obj-y				+= idle/
 obj-$(CONFIG_ACPI)		+= acpi/
 obj-$(CONFIG_SFI)		+= sfi/
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 a1133c8..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
@@ -767,7 +767,7 @@
 # CONFIG_IP_SCTP is not set
 # CONFIG_RDS is not set
 # CONFIG_TIPC is not set
-CONFIG_ATM=y
+# CONFIG_ATM is not set
 # CONFIG_ATM_CLIP is not set
 # CONFIG_ATM_LANE is not set
 # CONFIG_ATM_BR2684 is not set
@@ -1037,7 +1037,7 @@
 # CONFIG_NET_POLL_CONTROLLER is not set
 CONFIG_TUN=y
 # CONFIG_VETH is not set
-CONFIG_ATM_DRIVERS=y
+# CONFIG_ATM_DRIVERS is not set
 # CONFIG_ATM_DUMMY is not set
 # CONFIG_ATM_TCP is not set
 
@@ -1667,7 +1667,7 @@
 #
 # CONFIG_EXT2_FS is not set
 # CONFIG_EXT3_FS is not set
-CONFIG_EXT4_FS=y
+# CONFIG_EXT4_FS is not set
 
 # CONFIG_REISERFS_FS is not set
 # CONFIG_JFS_FS is not set
@@ -1694,7 +1694,7 @@
 #
 # CD-ROM/DVD Filesystems
 #
-CONFIG_ISO9660_FS=y
+# CONFIG_ISO9660_FS is not set
 # CONFIG_JOLIET is not set
 # CONFIG_ZISOFS is not set
 # CONFIG_UDF_FS 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 $?
 
+
diff --git a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/sdk/libscipc/sc_ipc.c b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/sdk/libscipc/sc_ipc.c
index 9fa6d06..66404b7 100755
--- a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/sdk/libscipc/sc_ipc.c
+++ b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/sdk/libscipc/sc_ipc.c
@@ -62,6 +62,7 @@
 static sc_ipc_event_ex s_evt_list;

 static sc_ipc_registrant s_registrant_list;

 static long s_ipc_msg_cnt = 0;

+static int s_ipc_ref_cnt = 0;

 

 static void sc_ipc_event_init(void);

 static void sc_ipc_event_set(sc_ipc_event *pevt, int fd, int msg_id, int persist, sc_ipc_event_cb func, void *param);

@@ -652,6 +653,7 @@
     pthread_attr_t attr;

 

     pthread_mutex_lock(&s_startupMutex);

+    s_ipc_ref_cnt++;

     if(s_started)

 		goto done;

 	sem_init(&terminate_sem, 0, 0);

@@ -677,8 +679,11 @@
 {

     int ret = 0;

     sc_ipc_msg msg = {0};

+    pthread_mutex_lock(&s_startupMutex);

+    s_ipc_ref_cnt--;

+    pthread_mutex_unlock(&s_startupMutex);

 

-	if(!s_started)

+	if(!s_started || s_ipc_ref_cnt > 0)

 		goto Done;

 

     msg.type = 0;

diff --git a/cp/phy/bin/zx297520v3/merge_lte_220a1_bin/ps/evb_cpuphy.bin b/cp/phy/bin/zx297520v3/merge_lte_220a1_bin/ps/evb_cpuphy.bin
index f6ea8e5..d403b21 100755
--- a/cp/phy/bin/zx297520v3/merge_lte_220a1_bin/ps/evb_cpuphy.bin
+++ b/cp/phy/bin/zx297520v3/merge_lte_220a1_bin/ps/evb_cpuphy.bin
Binary files differ