[Feature][T106_eSDK]update from T106-V2.01.01.02P56U09.AP.17.09_CAP.17.09.01 to T106-M42-PLXXXX-P56U11.AP.19.00_CAP.19.00.01 -- code

Only Configure: No
Affected branch: master
Affected module: unknow
Is it affected on both ZXIC and MTK: only ZXIC
Self-test: Yes
Doc Update: No

Change-Id: I5eb7f586f78a987785b0f9885f1300c42bfd6819
diff --git a/esdk/layers/meta-zxic-custom/conf/distro/include/nand-config-default.inc b/esdk/layers/meta-zxic-custom/conf/distro/include/nand-config-default.inc
index 439b293..fe9fc43 100755
--- a/esdk/layers/meta-zxic-custom/conf/distro/include/nand-config-default.inc
+++ b/esdk/layers/meta-zxic-custom/conf/distro/include/nand-config-default.inc
@@ -2,9 +2,19 @@
 ERASEBLOCK     = "0x40000"
 UBI_LEB_SIZE   = "253952"
 UBI_IMAGE_SEQ  = "1024"
-
+#LYNQ_MODIFY_ZXW_TASK944_XF.Li_20250123_START
+LYNQ_M22_PAGESIZE = "0x800"
+LYNQ_M22_ERASEBLOCK = "0x20000"
+LYNQ_M22_UBI_LEB_SIZE = "126976"
+#LYNQ_MODIFY_ZXW_TASK944_XF.Li_20250123_END
 #rootfs ubi参数配置
 #MKUBIFS_ARGS = "-m ${PAGESIZE} -e ${UBI_LEB_SIZE} -c 122 -x zlib -F"
 UBINIZE_ARGS = "-m ${PAGESIZE} -p ${ERASEBLOCK} -s ${PAGESIZE} -Q ${UBI_IMAGE_SEQ}"
+#LYNQ_MODIFY_ZXW_TASK944_XF.Li_20250123_START
+LYNQ_M22_UBINIZE_ARGS = "-m ${LYNQ_M22_PAGESIZE} -p ${LYNQ_M22_ERASEBLOCK} -s ${LYNQ_M22_PAGESIZE} -Q ${UBI_IMAGE_SEQ}"
+#LYNQ_MODIFY_ZXW_TASK944_XF.Li_20250123_END
 #userdata ubi参数配置
 USERDATA_UBINIZE_ARGS = "${UBINIZE_ARGS}"
+#LYNQ_MODIFY_ZXW_TASK944_XF.Li_20250123_START
+LYNQ_M22_USERDATA_UBINIZE_ARGS = "${LYNQ_M22_UBINIZE_ARGS}"
+#LYNQ_MODIFY_ZXW_TASK944_XF.Li_20250123_END
diff --git a/esdk/layers/meta-zxic-custom/conf/distro/vehicle_dc_ref.conf b/esdk/layers/meta-zxic-custom/conf/distro/vehicle_dc_ref.conf
index 50c2f6e..231b4a1 100755
--- a/esdk/layers/meta-zxic-custom/conf/distro/vehicle_dc_ref.conf
+++ b/esdk/layers/meta-zxic-custom/conf/distro/vehicle_dc_ref.conf
@@ -51,7 +51,9 @@
 
 # storage type: nand or emmc
 STRORAGE_TYPE = "nand"
-STRORAGE_CONF = "nand-config-4k"
+#LYNQ_MODIFY_ZXW_TASK944_XF.Li_20250123_START
+STRORAGE_CONF = "nand-config-default"
+#LYNQ_MODIFY_ZXW_TASK944_XF.Li_20250123_END
 require conf/distro/include/${STRORAGE_CONF}.inc
 
 #rootfs文件系统类型
@@ -467,6 +469,9 @@
 #xf.li@20240716 add for MOBILETEK_LOG_ENCRYPT value: "enable","disable"
 MOBILETEK_LOG_ENCRYPT = "disable"
 
+#xf.li@20250123 add for M22 SDK value (support M22 or not): "M22", "default"
+MOBILETEK_NAND_TYPE = "M22"
+
 LYNQ_CONFIG_COMMITID = "e2a3410390ff0ad762462ccb6af8faa5e16dcd61"
-LYNQ_CONFIG_VERSION = "T106-V2.01.01.02P56U09.AP.17.09_CAP.17.09.01"
-LYNQ_CONFIG_SW_VERSION = "T106-V2.01.01.02P56U09.AP.17.09_CAP.17.09.01"
+LYNQ_CONFIG_VERSION = "T106-M42-PLXXXX-P56U11.AP.19.00_CAP.19.00.01"
+LYNQ_CONFIG_SW_VERSION = "T106-MXX-PLXXXX-P56U11.AP.19.00_CAP.19.00"
diff --git a/esdk/layers/meta-zxic-custom/conf/lynq_base.conf b/esdk/layers/meta-zxic-custom/conf/lynq_base.conf
index 8126a9e..73d9856 100755
--- a/esdk/layers/meta-zxic-custom/conf/lynq_base.conf
+++ b/esdk/layers/meta-zxic-custom/conf/lynq_base.conf
@@ -67,6 +67,6 @@
 #OEMAPP_CFG value:"PLATFORM","GSW"
 MOBILETEK_OEMAPP_CFG = "PLATFORM"
 
-LYNQ_CONFIG_COMMITID = "db2a7e1b3aa519b00153f78dcb223c2eb539f891"
-LYNQ_CONFIG_VERSION = "T106-V2.01.01.02P56U09.AP.17.09_CAP.17.09.01"
-LYNQ_CONFIG_SW_VERSION = "T106-V2.01.01.02P56U09.AP.17.09_CAP.17.09.01"
+LYNQ_CONFIG_COMMITID = "7b4d681bdad8b0a31c564ea665a424b81038791a"
+LYNQ_CONFIG_VERSION = "T106-M42-PLXXXX-P56U11.AP.19.00_CAP.19.00.01"
+LYNQ_CONFIG_SW_VERSION = "T106-MXX-PLXXXX-P56U11.AP.19.00_CAP.19.00"
diff --git a/esdk/layers/meta-zxic-custom/recipes-core/busybox/busybox/vehicle_dc-normal-busybox.cfg b/esdk/layers/meta-zxic-custom/recipes-core/busybox/busybox/vehicle_dc-normal-busybox.cfg
index 2b48930..34e65ab 100755
--- a/esdk/layers/meta-zxic-custom/recipes-core/busybox/busybox/vehicle_dc-normal-busybox.cfg
+++ b/esdk/layers/meta-zxic-custom/recipes-core/busybox/busybox/vehicle_dc-normal-busybox.cfg
@@ -50,7 +50,7 @@
 CONFIG_SYSROOT=""
 CONFIG_EXTRA_CFLAGS=""
 CONFIG_EXTRA_LDFLAGS=""
-CONFIG_EXTRA_LDLIBS="-lnvram"
+CONFIG_EXTRA_LDLIBS="-lnvram -ldebug_info"
 
 #
 # Installation Options ("make install" behavior)
diff --git a/esdk/layers/meta-zxic-custom/recipes-core/busybox/busybox/vehicle_dc_4Gb-normal-busybox.cfg b/esdk/layers/meta-zxic-custom/recipes-core/busybox/busybox/vehicle_dc_4Gb-normal-busybox.cfg
index 2b48930..34e65ab 100755
--- a/esdk/layers/meta-zxic-custom/recipes-core/busybox/busybox/vehicle_dc_4Gb-normal-busybox.cfg
+++ b/esdk/layers/meta-zxic-custom/recipes-core/busybox/busybox/vehicle_dc_4Gb-normal-busybox.cfg
@@ -50,7 +50,7 @@
 CONFIG_SYSROOT=""
 CONFIG_EXTRA_CFLAGS=""
 CONFIG_EXTRA_LDFLAGS=""
-CONFIG_EXTRA_LDLIBS="-lnvram"
+CONFIG_EXTRA_LDLIBS="-lnvram -ldebug_info"
 
 #
 # Installation Options ("make install" behavior)
diff --git a/esdk/layers/meta-zxic-custom/recipes-core/busybox/busybox/vehicle_dc_ref-normal-busybox.cfg b/esdk/layers/meta-zxic-custom/recipes-core/busybox/busybox/vehicle_dc_ref-normal-busybox.cfg
index 2b48930..34e65ab 100755
--- a/esdk/layers/meta-zxic-custom/recipes-core/busybox/busybox/vehicle_dc_ref-normal-busybox.cfg
+++ b/esdk/layers/meta-zxic-custom/recipes-core/busybox/busybox/vehicle_dc_ref-normal-busybox.cfg
@@ -50,7 +50,7 @@
 CONFIG_SYSROOT=""
 CONFIG_EXTRA_CFLAGS=""
 CONFIG_EXTRA_LDFLAGS=""
-CONFIG_EXTRA_LDLIBS="-lnvram"
+CONFIG_EXTRA_LDLIBS="-lnvram -ldebug_info"
 
 #
 # Installation Options ("make install" behavior)
diff --git a/esdk/layers/meta-zxic-custom/recipes-core/busybox/busybox/vehicle_dc_systemd-normal-busybox.cfg b/esdk/layers/meta-zxic-custom/recipes-core/busybox/busybox/vehicle_dc_systemd-normal-busybox.cfg
index 5d7d82f..bd0c63c 100755
--- a/esdk/layers/meta-zxic-custom/recipes-core/busybox/busybox/vehicle_dc_systemd-normal-busybox.cfg
+++ b/esdk/layers/meta-zxic-custom/recipes-core/busybox/busybox/vehicle_dc_systemd-normal-busybox.cfg
@@ -50,7 +50,7 @@
 CONFIG_SYSROOT=""
 CONFIG_EXTRA_CFLAGS=""
 CONFIG_EXTRA_LDFLAGS=""
-CONFIG_EXTRA_LDLIBS="-lnvram"
+CONFIG_EXTRA_LDLIBS="-lnvram -ldebug_info"
 
 #
 # Installation Options ("make install" behavior)
diff --git a/esdk/layers/meta-zxic-custom/recipes-core/images/files/zx297520v3/vehicle_dc/fs/normal/rootfs/etc_ro/default/default_parameter_user b/esdk/layers/meta-zxic-custom/recipes-core/images/files/zx297520v3/vehicle_dc/fs/normal/rootfs/etc_ro/default/default_parameter_user
index 5234be8..7570274 100755
--- a/esdk/layers/meta-zxic-custom/recipes-core/images/files/zx297520v3/vehicle_dc/fs/normal/rootfs/etc_ro/default/default_parameter_user
+++ b/esdk/layers/meta-zxic-custom/recipes-core/images/files/zx297520v3/vehicle_dc/fs/normal/rootfs/etc_ro/default/default_parameter_user
@@ -500,4 +500,5 @@
 telog_path=
 zpsstate_detect=1
 zpsstate_detect_period=60
-zpsstate_restart=0
\ No newline at end of file
+zpsstate_restart=0
+ap_reset_app=default
diff --git a/esdk/layers/meta-zxic-custom/recipes-core/images/files/zx297520v3/vehicle_dc_4Gb/fs/normal/rootfs/etc_ro/default/default_parameter_user b/esdk/layers/meta-zxic-custom/recipes-core/images/files/zx297520v3/vehicle_dc_4Gb/fs/normal/rootfs/etc_ro/default/default_parameter_user
index 7147993..63f20d3 100755
--- a/esdk/layers/meta-zxic-custom/recipes-core/images/files/zx297520v3/vehicle_dc_4Gb/fs/normal/rootfs/etc_ro/default/default_parameter_user
+++ b/esdk/layers/meta-zxic-custom/recipes-core/images/files/zx297520v3/vehicle_dc_4Gb/fs/normal/rootfs/etc_ro/default/default_parameter_user
@@ -499,4 +499,5 @@
 telog_path=
 zpsstate_detect=1
 zpsstate_detect_period=60
-zpsstate_restart=0
\ No newline at end of file
+zpsstate_restart=0
+ap_reset_app=default
diff --git a/esdk/layers/meta-zxic-custom/recipes-core/images/files/zx297520v3/vehicle_dc_ref/fs/normal/rootfs/etc_ro/default/default_parameter_user b/esdk/layers/meta-zxic-custom/recipes-core/images/files/zx297520v3/vehicle_dc_ref/fs/normal/rootfs/etc_ro/default/default_parameter_user
index f082891..f7695af 100755
--- a/esdk/layers/meta-zxic-custom/recipes-core/images/files/zx297520v3/vehicle_dc_ref/fs/normal/rootfs/etc_ro/default/default_parameter_user
+++ b/esdk/layers/meta-zxic-custom/recipes-core/images/files/zx297520v3/vehicle_dc_ref/fs/normal/rootfs/etc_ro/default/default_parameter_user
@@ -551,4 +551,5 @@
 telog_path=
 zpsstate_detect=1
 zpsstate_detect_period=60
-zpsstate_restart=0
\ No newline at end of file
+zpsstate_restart=0
+ap_reset_app=default
diff --git a/esdk/layers/meta-zxic-custom/recipes-core/images/files/zx297520v3/vehicle_dc_systemd/fs/normal/rootfs/etc_ro/default/default_parameter_user b/esdk/layers/meta-zxic-custom/recipes-core/images/files/zx297520v3/vehicle_dc_systemd/fs/normal/rootfs/etc_ro/default/default_parameter_user
index 92191d4..4c1dd17 100755
--- a/esdk/layers/meta-zxic-custom/recipes-core/images/files/zx297520v3/vehicle_dc_systemd/fs/normal/rootfs/etc_ro/default/default_parameter_user
+++ b/esdk/layers/meta-zxic-custom/recipes-core/images/files/zx297520v3/vehicle_dc_systemd/fs/normal/rootfs/etc_ro/default/default_parameter_user
@@ -495,3 +495,4 @@
 xlat_enable=1
 telog_path_cap=
 telog_path=
+ap_reset_app=default
diff --git a/esdk/layers/meta-zxic-custom/recipes-core/images/zxic-image.bb b/esdk/layers/meta-zxic-custom/recipes-core/images/zxic-image.bb
index b86b882..1a77daa 100755
--- a/esdk/layers/meta-zxic-custom/recipes-core/images/zxic-image.bb
+++ b/esdk/layers/meta-zxic-custom/recipes-core/images/zxic-image.bb
@@ -147,6 +147,11 @@
 		cp -arfp ${BSPDIR}/sources/meta-zxic-custom/conf/distro/include/${USERDATA_UBINIZE_CFG} ${B}
 		mkdir -p ${BINS-PATH}
 		${B}/ubinize-cfg.sh "${BINS-PATH}/${USEDATA_FS_NAME}"  "${B}/${USERDATA_UBINIZE_CFG}"  "${USERDATA_UBINIZE_ARGS}"
+#LYNQ_MODIFY_ZXW_TASK944_XF.Li_20250123_START
+if ${@bb.utils.contains('MOBILETEK_NAND_TYPE','M22','true','false',d)}; then
+		${B}/ubinize-cfg.sh "${BINS-PATH}/ap_capuserdata_M22.img"  "${B}/${USERDATA_UBINIZE_CFG}"  "${LYNQ_M22_USERDATA_UBINIZE_ARGS}"
+fi
+#LYNQ_MODIFY_ZXW_TASK944_XF.Li_20250123_END
 		mkdir -p ${IMAGE_ROOTFS}/etc_ro/
 		cp -v "${BINS-PATH}/${USEDATA_FS_NAME}" ${IMAGE_ROOTFS}/etc_ro/
 	fi
@@ -207,6 +212,11 @@
 		cp -arfp ${BSPDIR}/sources/meta-zxic-custom/conf/distro/include/${OEMDATA_UBINIZE_CFG} ${B}
 		mkdir -p ${BINS-PATH}
 		${B}/ubinize-cfg.sh "${BINS-PATH}/${OEMDATA_FS_NAME}"  "${B}/${OEMDATA_UBINIZE_CFG}"  "${USERDATA_UBINIZE_ARGS}"
+#LYNQ_MODIFY_ZXW_TASK944_XF.Li_20250123_START
+if ${@bb.utils.contains('MOBILETEK_NAND_TYPE','M22','true','false',d)}; then
+		${B}/ubinize-cfg.sh "${BINS-PATH}/cap_oemdata_M22.img"  "${B}/${OEMDATA_UBINIZE_CFG}"  "${LYNQ_M22_USERDATA_UBINIZE_ARGS}"
+fi
+#LYNQ_MODIFY_ZXW_TASK944_XF.Li_20250123_END
 		mkdir -p ${IMAGE_ROOTFS}/etc_ro/
 		cp -v "${BINS-PATH}/${OEMDATA_FS_NAME}" ${IMAGE_ROOTFS}/etc_ro/
 	fi
@@ -234,12 +244,21 @@
 		${S}/squashfs_dm-verity.sh  ${S}/${ROOT_FS_NAME}.unsigned  ${S} \
 			${BINS-PATH}/ap_caprootfs.img.dm ${SIGNIMAGE_PRIVATE_KEY} ${BSPDIR}/tools/SignTool/SignImage
 		${S}/ubinize-static.sh vol_rootfs "${BINS-PATH}/ap_caprootfs.img" ${BINS-PATH}/ap_caprootfs.img.dm "${UBINIZE_ARGS}"
-
+#LYNQ_MODIFY_ZXW_TASK944_XF.Li_20250123_START
+if ${@bb.utils.contains('MOBILETEK_NAND_TYPE','M22','true','false',d)}; then
+		${S}/ubinize-static.sh vol_rootfs "${BINS-PATH}/ap_caprootfs_M22.img" ${BINS-PATH}/ap_caprootfs.img.dm "${LYNQ_M22_UBINIZE_ARGS}"
+fi
+#LYNQ_MODIFY_ZXW_TASK944_XF.Li_20250123_END
 		if ${@bb.utils.contains('DISTRO_FEATURES','oemfs','true','false',d)}; then
 			rm -fv ${BINS-PATH}/cap_oem.img.dm
 			${B}/squashfs_dm-verity.sh  ${S}/cap_oem.img.unsigned  ${B} \
 				${BINS-PATH}/cap_oem.img.dm ${SIGNIMAGE_PRIVATE_KEY} ${BSPDIR}/tools/SignTool/SignImage
 			${B}/ubinize-static.sh vol_oem "${BINS-PATH}/cap_oem.img" ${BINS-PATH}/cap_oem.img.dm "${UBINIZE_ARGS}"
+#LYNQ_MODIFY_ZXW_TASK944_XF.Li_20250123_START
+if ${@bb.utils.contains('MOBILETEK_NAND_TYPE','M22','true','false',d)}; then
+			${B}/ubinize-static.sh vol_oem "${BINS-PATH}/cap_oem_M22.img" ${BINS-PATH}/cap_oem.img.dm "${LYNQ_M22_UBINIZE_ARGS}"
+fi
+#LYNQ_MODIFY_ZXW_TASK944_XF.Li_20250123_END
 		fi
 	fi
 }
@@ -258,6 +277,8 @@
     "
 #xf.li@20240716 add start
 do_oem_config() {
+	LYNQ_INSIDE_VERSION_UCI="        option LYNQ_SW_INSIDE_VERSION '${LYNQ_CONFIG_VERSION}'"
+	eval sed -i 's/^.*LYNQ_SW_INSIDE_VERSION.*$/"${LYNQ_INSIDE_VERSION_UCI}"/' ${IMAGE_ROOTFS}/etc/config/lynq_uci_ro
 	cp -R ${TOPDIR}/prebuilt/rootfs/* ${IMAGE_ROOTFS}/
 	if [ "${MOBILETEK_LOG_ENCRYPT}" = "enable" ]; then
 		touch ${IMAGE_ROOTFS}/etc/syslog_encrypt_flag
diff --git a/esdk/layers/meta-zxic-custom/recipes-lynq/liblynq-sim/liblynq-sim.bb b/esdk/layers/meta-zxic-custom/recipes-lynq/liblynq-sim/liblynq-sim.bb
index 7b8ff1d..65d5358 100755
--- a/esdk/layers/meta-zxic-custom/recipes-lynq/liblynq-sim/liblynq-sim.bb
+++ b/esdk/layers/meta-zxic-custom/recipes-lynq/liblynq-sim/liblynq-sim.bb
@@ -3,7 +3,7 @@
 DESCRIPTION = "lynq sim"
 LICENSE = "CLOSED"
 LIC_FILES_CHKSUM = "file://LICENSE;md5=e1696b147d49d491bcb4da1a57173fff"
-DEPENDS += "libpal gstreamer1.0 glib-2.0 libapn liblynq-log libvendor-ril liblynq-shm libbinder"
+DEPENDS += "libpal gstreamer1.0 glib-2.0 libapn liblynq-log libvendor-ril liblynq-shm libbinder liblynq-uci libsctel"
 #inherit workonsrc
 WORKONSRC = "${TOPDIR}/../src/lynq/lib/liblynq-sim/"
 FILESEXTRAPATHS_prepend :="${TOPDIR}/../src/lynq/lib/:"
diff --git a/esdk/layers/meta-zxic-custom/recipes-lynq/libpoweralarm/libpoweralarm.bb b/esdk/layers/meta-zxic-custom/recipes-lynq/libpoweralarm/libpoweralarm.bb
index aeecf6e..c709cf9 100755
--- a/esdk/layers/meta-zxic-custom/recipes-lynq/libpoweralarm/libpoweralarm.bb
+++ b/esdk/layers/meta-zxic-custom/recipes-lynq/libpoweralarm/libpoweralarm.bb
@@ -4,7 +4,7 @@
 #LICENSE = "Mobiletek""
 LICENSE = "CLOSED"
 LIC_FILES_CHKSUM = "file://LICENSE;md5=d759532d295a4ec07250edf931caef80"
-DEPENDS += "bootchart  liblynq-log libsctel libscrtc"
+DEPENDS += "bootchart  liblynq-log libsctel libscrtc libsoftap"
 
 #inherit workonsrc
 WORKONSRC = "${TOPDIR}/../src/lynq/lib/libpoweralarm/"
diff --git a/esdk/layers/meta-zxic-custom/recipes-lynq/lynq-qser-network-demo/files/lynq_qser_network.h b/esdk/layers/meta-zxic-custom/recipes-lynq/lynq-qser-network-demo/files/lynq_qser_network.h
index aee4285..a6c8e15 100755
--- a/esdk/layers/meta-zxic-custom/recipes-lynq/lynq-qser-network-demo/files/lynq_qser_network.h
+++ b/esdk/layers/meta-zxic-custom/recipes-lynq/lynq-qser-network-demo/files/lynq_qser_network.h
@@ -42,23 +42,25 @@
 }E_QSER_NW_IMS_MODE_TYPE_T;
 
 /** Configures the OOS (out of service)  settings that define the MCM network interface. */
-#define QSER_NW_OOS_CFG_TYPE_FAST_SCAN          0x00    /**<  fast net scan */
-#define QSER_NW_OOS_CFG_TYPE_FULL_BAND_SCAN     0x01    /**<  full band scan */
+#define QSER_NW_OOS_CFG_TYPE_FAST_SCAN          0x00    /**<  fast net scan, only for normal mode */
+#define QSER_NW_OOS_CFG_TYPE_FULL_BAND_SCAN     0x01    /**<  full band scan, only for low power mode */
 
 typedef struct 
 {
-    /*    Configuration parameters for MCM network fast network scan when OOS (out of service)*/
-    char                        enable;
-    uint16_t                    time_interval;
+    /*    Configuration parameters for MCM network fast network scan when OOS (out of service) in normal mode*/
+    char                        enable; /*[0, 1]*/
+    uint16_t                    time_interval;  /*[1, 65535],unit: second, valid when enable equal 1*/
 }QSER_NW_OOS_CONFIG_FAST_SCAN_INFO_T;
 
 typedef struct 
 {
-    /*    Configuration parameters for MCM network full band network scan when OOS (out of service)*/
-    int t_min;
-    int t_step;
-    int t_num;
-    int t_max;
+    /*    Configuration parameters for MCM network full band network scan when OOS (out of service) in low power mode*/
+    /*t_min,t_step,t_num,t_max all are 0, or all are not 0*/
+    /*if t_min > t_max, time interval will be t_max*/
+    int t_min;   /*[0, 65535], unit: second*/
+    int t_step;  /*[0, 65535], unit: second*/
+    int t_num;   /*[0, 65535]*/
+    int t_max;   /*[0, 65535], unit: second*/  
 }QSER_NW_OOS_CONFIG_FULL_BAND_SCAN_INFO_T;
 
 
diff --git a/esdk/layers/meta-zxic-custom/recipes-lynq/lynq-qser-voice-demo/files/lynq-qser-voice-demo.cpp b/esdk/layers/meta-zxic-custom/recipes-lynq/lynq-qser-voice-demo/files/lynq-qser-voice-demo.cpp
index e7eebc3..e9730f1 100755
--- a/esdk/layers/meta-zxic-custom/recipes-lynq/lynq-qser-voice-demo/files/lynq-qser-voice-demo.cpp
+++ b/esdk/layers/meta-zxic-custom/recipes-lynq/lynq-qser-voice-demo/files/lynq-qser-voice-demo.cpp
@@ -31,6 +31,8 @@
 #endif

     {9,   "qser_voice_set_audio_mode"},

     {10,  "qser_voice_get_audio_mode"},

+    {11,  "qser_voice_set_mic_volume"},

+    {12,  "qser_voice_get_mic_volume"},

     {-1,    NULL}

 };

 

@@ -56,6 +58,9 @@
 int (*qser_voice_set_audio_mode)(const int audio_mode);

 int (*qser_voice_get_audio_mode)(int* audio_mode);

 

+int (*qser_voice_set_mic_volume)(const int volume);

+int (*qser_voice_get_mic_volume)(int *volume);

+

 

 #ifdef ECALL_SUPPORT

 int (*qser_voice_set_test_num)(voice_client_handle_type*       h_voice,E_QSER_VOICE_ECALL_SET_TYPE_T type, const char *test_num, int test_num_length);

@@ -252,6 +257,19 @@
         printf("qser_voice_get_audio_mode not defined or exported in %s\n", lynqLibPath_Call);

         return -1;

     }

+     qser_voice_set_mic_volume = (int (*)(const int ))dlsym(dlHandle_call,"qser_voice_set_mic_volume");

+    if(qser_voice_set_mic_volume == NULL)    

+    {

+            printf("qser_voice_set_mic_volume not defined or exported in %s\n", lynqLibPath_Call);

+            return -1;

+    }

+   

+    qser_voice_get_mic_volume = (int (*)(int* ))dlsym(dlHandle_call,"qser_voice_get_mic_volume");

+    if(qser_voice_get_mic_volume == NULL)    

+    {

+            printf("qser_voice_get_mic_volume not defined or exported in %s\n", lynqLibPath_Call);

+            return -1;

+    }

     

     

     ret = qser_voice_call_client_init(&h_voice);

@@ -419,7 +437,25 @@
                 printf("qser_voice_get_audio_mode ret = %d, audio_mode is %d\n", ret, audio_mode);

                 break;

             }            

+            case 11:

+            {

+                int volume = 0;

+                printf("Please set mic volume:0-5 level\n");

+                scanf("%d",&volume);

+                ret = qser_voice_set_mic_volume(volume);

+                printf("ret is %d\n",ret);

+                break;

 

+            }

+

+            case 12:

+            {

+                int volume = -1;

+                printf("Enter get mic volume\n");

+                ret = qser_voice_get_mic_volume(&volume);

+                printf("ret is %d,get volume is %d\n",ret,volume);

+                break;

+            }

             default:

                 print_help();

                 break;

diff --git a/esdk/layers/meta-zxic-custom/recipes-lynq/lynq-vb-demo/files/lynq_vb_demo.c b/esdk/layers/meta-zxic-custom/recipes-lynq/lynq-vb-demo/files/lynq_vb_demo.c
index fc94d2a..a3e6499 100755
--- a/esdk/layers/meta-zxic-custom/recipes-lynq/lynq-vb-demo/files/lynq_vb_demo.c
+++ b/esdk/layers/meta-zxic-custom/recipes-lynq/lynq-vb-demo/files/lynq_vb_demo.c
@@ -14,12 +14,17 @@
 #include <semaphore.h>

 #include <sys/types.h>

 #include <pthread.h>

+#include <log/log.h>

+#include <time.h>

+#define LOG_TAG "VB_DEMO"

+

+

 

 /*command max len*/

 #define VOICE_CMD_MAX_LEN 64

 

-#define EXIT_CMD_STOP	"stop\n"

-#define EXIT_CMD_Q	"q\n"

+#define EXIT_CMD_STOP    "stop\n"

+#define EXIT_CMD_Q    "q\n"

 #define EXIT_CMD_EXIT   "exit\n"

 

 #define REQ_VOICE_BUFFER_TEST_START        "voice_buffer_test_start"

@@ -38,7 +43,7 @@
 

 

 

-#define VB_MAX_INT	     0x7fffffff

+#define VB_MAX_INT         0x7fffffff

 #define VB_MIN_INT        0 

 #define VB_INT_OVERFLOW(x) if((x < VB_MIN_INT)||(x > VB_MAX_INT))  x = 0;

  

@@ -49,21 +54,21 @@
 typedef int (vb_thread_proc)(void*);

 struct vbuf_info_t

 {

-	int fd;

-    pthread_t	    rx_test_thread;	

-    pthread_t	    tx_test_thread;

-	pthread_t	    loop_test_thread;

-	int quit;

-	char        	*tx_buf;

-    char        	*rx_buf;

-	int buf_size;

-	char *tx_filename;

-	char *rx_filename;

+    int fd;

+    pthread_t        rx_test_thread;    

+    pthread_t        tx_test_thread;

+    pthread_t        loop_test_thread;

+    int quit;

+    char            *tx_buf;

+    char            *rx_buf;

+    int buf_size;

+    char *tx_filename;

+    char *rx_filename;

     FILE *tx_file;

-	FILE *rx_file;

+    FILE *rx_file;

     int tx_filesize;

-	int rx_filesize;		

-	int fs;	 	

+    int rx_filesize;        

+    int fs;         

 };

 

 static struct vbuf_info_t vbuf_rec;

@@ -74,40 +79,47 @@
      

     printf("voice_buffer_test_start                      value: 8000,16000\n");

     printf("voice_buffer_test_stop                       no value input\n");

-	printf("voice_buffer_loop_test_start                      value: 8000,16000\n");

+    printf("voice_buffer_loop_test_start                      value: 8000,16000\n");

     printf("voice_buffer_loop_test_stop                       no value input\n");

     printf("\n");

 }

 

 static int vbuffer_start_flag = 0;

 static int tx_optcount = 0;

-static int rx_optcount = 0;	

+static int rx_optcount = 0;    

 static int first_rderr_flag = 0;

 static int first_wrerr_flag = 0;

 

+static pthread_mutex_t s_vb_demo_mtx = PTHREAD_MUTEX_INITIALIZER;

+

 static int vb_close_fd_release_buf()

-{    

-    int ret = voice_buffer_close(vbuf_rec.fd); 

-    if(ret != 0) 

+{   

+    int ret=0;

+    if(vbuf_rec.fd>0)

     {

-		printf("%s : vb close fail \n",__func__);

+        ret = voice_buffer_close(vbuf_rec.fd); 

+        if(ret != 0) 

+        {

+            RLOGE("%s : vb close fail ret is %d\n",__func__,ret);

+        }

+        vbuf_rec.fd = -1;

     }

-	vbuf_rec.fd = -1;

+    

 

     if(vbuf_rec.rx_buf)

     {

-	    free(vbuf_rec.rx_buf);

-    	vbuf_rec.rx_buf = NULL;

+        free(vbuf_rec.rx_buf);

+        vbuf_rec.rx_buf = NULL;

     }

 

     if(vbuf_rec.tx_buf)

     {

         free(vbuf_rec.tx_buf);

-    	vbuf_rec.tx_buf = NULL;

+        vbuf_rec.tx_buf = NULL;

     }

 

-	vbuffer_start_flag = 0;	

-    printf("close buf fd and release buf end\n");

+    vbuffer_start_flag = 0;    

+    RLOGD("close buf fd and release buf end\n");

     return ret;

 }

 

@@ -124,56 +136,56 @@
     int r_size;

 

  

-    printf( "%s: start size=%d! \n",__func__,size);

+    RLOGD( "%s: start size=%d! \n",__func__,size);

     memset (buf,0, size);

     

     while (!vbuf_rec.quit) 

     {

-		rx_optcount ++;	

-		VB_INT_OVERFLOW(rx_optcount);

-		if((rx_optcount%1000) == 0){

-            printf("%s: rx_optcount=%d! \n",__func__,rx_optcount);

+        rx_optcount ++;    

+        VB_INT_OVERFLOW(rx_optcount);

+        if((rx_optcount%1000) == 0){

+            RLOGD("%s: rx_optcount=%d! \n",__func__,rx_optcount);

 

-		}

-		else if(rx_optcount == 1000000){

-            printf("%s: rx_optcount=%d! \n",__func__,rx_optcount);

-			rx_optcount = 0;

-			

-		}

+        }

+        else if(rx_optcount == 1000000){

+            RLOGD("%s: rx_optcount=%d! \n",__func__,rx_optcount);

+            rx_optcount = 0;

+            

+        }

 

         //read form ps

-		r_size = voice_buffer_read(vbuf_rec.fd, buf, size);

+        r_size = voice_buffer_read(vbuf_rec.fd, buf, size);

         if(r_size <= 0) 

         {

-            first_rderr_flag++;			

-			VB_INT_OVERFLOW(first_rderr_flag);			

+            first_rderr_flag++;            

+            VB_INT_OVERFLOW(first_rderr_flag);            

             continue ;

         }

-		else{

-			first_rderr_flag = 0;

+        else{

+            first_rderr_flag = 0;

 

-		}

-		

+        }

+        

         if(vbuf_rec.rx_file != NULL) 

         {

-			r_size = fwrite(buf, 1,size, vbuf_rec.rx_file);

+            r_size = fwrite(buf, 1,size, vbuf_rec.rx_file);

 

-		    if (r_size != size) {

-		        //printf("Error fwrite size not eq,r_size=%d,size=%d\n",r_size,size);

-		    }

-			else{

-			

-		        bytes_read += size;

-				if(bytes_read >= vbuf_rec.rx_filesize){

-					fseek(vbuf_rec.rx_file, 0, SEEK_SET);

-					bytes_read = 0;

-					printf("fwrite over write maxsize(%d)!!!\n",vbuf_rec.rx_filesize);

-				

-				}

-			}

+            if (r_size != size) {

+                //printf("Error fwrite size not eq,r_size=%d,size=%d\n",r_size,size);

+            }

+            else{

+            

+                bytes_read += size;

+                if(bytes_read >= vbuf_rec.rx_filesize){

+                    fseek(vbuf_rec.rx_file, 0, SEEK_SET);

+                    bytes_read = 0;

+                    RLOGD("fwrite over write maxsize(%d)!!!\n",vbuf_rec.rx_filesize);

+                

+                }

+            }

         }

-		

-		

+        

+        

     }

     

     return 0;

@@ -184,65 +196,65 @@
     int ret;

     int num_read;

 

-	

+    

     char* buf = vbuf_rec.tx_buf;

-	

+    

     int size = vbuf_rec.buf_size;

      int w_size;

 

-	 printf("%s: start size=%d! \n",__func__,size);

+     RLOGD("%s: start size=%d! \n",__func__,size);

  

-	

+    

     memset(buf, 0,size);    

     while (!vbuf_rec.quit) 

     {

 

-	    if(vbuf_rec.tx_file != NULL) 

-	    {

+        if(vbuf_rec.tx_file != NULL) 

+        {

 

-	        num_read = fread(buf,1,size, vbuf_rec.tx_file);

-			

-	        if (num_read != size) {

-		        //printf("Error fread size not eq,num_read=%d,size=%d\n",num_read,size);

-			}

-	        if (num_read <= 0) {

-		        printf("Error fread size not eq,num_read=%d,size=%d\n",num_read,size); 

-				fseek(vbuf_rec.tx_file, 0, SEEK_SET);

-			}

-	    }			

-		tx_optcount ++;

-		VB_INT_OVERFLOW(tx_optcount);

-		

-		w_size = voice_buffer_write(vbuf_rec.fd, buf, size);

+            num_read = fread(buf,1,size, vbuf_rec.tx_file);

+            

+            if (num_read != size) {

+                //printf("Error fread size not eq,num_read=%d,size=%d\n",num_read,size);

+            }

+            if (num_read <= 0) {

+                RLOGD("Error fread size not eq,num_read=%d,size=%d\n",num_read,size); 

+                fseek(vbuf_rec.tx_file, 0, SEEK_SET);

+            }

+        }            

+        tx_optcount ++;

+        VB_INT_OVERFLOW(tx_optcount);

+        

+        w_size = voice_buffer_write(vbuf_rec.fd, buf, size);

         if(w_size <= 0) 

         {

-        	first_wrerr_flag++;

-			

-			VB_INT_OVERFLOW(first_wrerr_flag);

-			

+            first_wrerr_flag++;

+            

+            VB_INT_OVERFLOW(first_wrerr_flag);

+            

             continue;

         }

-		else{

-			first_wrerr_flag = 0;

+        else{

+            first_wrerr_flag = 0;

 

-		}

+        }

 

     }

     return 0;

 }

 

 

-static int vb_thread_create( const char *name,pthread_t	*thread_t, vb_thread_proc *proc, 

-								int stack_size, unsigned priority,void *arg )

+static int vb_thread_create( const char *name,pthread_t    *thread_t, vb_thread_proc *proc, 

+                                int stack_size, unsigned priority,void *arg )

 {

     pthread_attr_t thread_attr;

     int ret;

-	int default_size;

+    int default_size;

     

     struct sched_param    param;

     int  policy = SCHED_FIFO;

     

-    printf("%s: start! \n",__func__);

+    RLOGD("%s: start! \n",__func__);

     

     /* Init thread attributes */

     pthread_attr_init(&thread_attr);    

@@ -251,18 +263,18 @@
     ret = pthread_create( thread_t, &thread_attr,proc, arg);

     if (ret != 0) 

     {

-    	printf("%s: pthread_create fail,ret=%d! \n",__func__,ret);

+        RLOGE("%s: pthread_create fail,ret=%d! \n",__func__,ret);

     

-    	pthread_attr_destroy(&thread_attr);

+        pthread_attr_destroy(&thread_attr);

         return ret;

     }

-	

+    

     pthread_attr_getstacksize(&thread_attr, &default_size);

-    printf("%s: pthread_attr_getstacksize(%d)! \n",__func__,default_size);

+    RLOGD("%s: pthread_attr_getstacksize(%d)! \n",__func__,default_size);

     

     pthread_attr_destroy(&thread_attr);

-	

-    printf("%s: end \n",__func__);

+    

+    RLOGD("%s: end \n",__func__);

     return 0;

 }

 

@@ -273,136 +285,136 @@
 {

     int ret = 0;

     int buf_size = 320;

-	tx_optcount = 0;

-	rx_optcount = 0;	

+    tx_optcount = 0;

+    rx_optcount = 0;    

     int* buf_int;

 

-	int i;

+    int i;

 

-	if(vbuffer_start_flag == 1){ 

-		printf(" VB already start,return \n");

+    if(vbuffer_start_flag == 1){ 

+        RLOGE(" VB already start,return \n");

 

-		return 0;

-	}

+        return 0;

+    }

 

-	vbuffer_start_flag = 1;

+    vbuffer_start_flag = 1;

 

 

 

-	if((vbuf_rec.fd != -1)&&(vbuf_rec.fd != 0)){

-		printf(" VB fd already get, vbuf_rec.fd=%d return \n",vbuf_rec.fd);

-	}

+    if((vbuf_rec.fd != -1)&&(vbuf_rec.fd != 0)){

+        RLOGE(" VB fd already get, vbuf_rec.fd=%d return \n",vbuf_rec.fd);

+    }

 

-	if(fs == 8000){

+    if(fs == 8000){

 

-		buf_size = 320;

-	}

-	else if(fs == 16000){

+        buf_size = 320;

+    }

+    else if(fs == 16000){

 

-		buf_size = 640;

-	}	

-	else

-	{

-		buf_size = 320;

-	}

- 	printf("Starting vb stream fs=%d buf_size=%d \n",fs,buf_size);

+        buf_size = 640;

+    }    

+    else

+    {

+        buf_size = 320;

+    }

+     RLOGD("Starting vb stream fs=%d buf_size=%d \n",fs,buf_size);

 

- 	printf("%s:open tx and rx file \n",__func__);

-	if(fs == 8000){

+     RLOGD("%s:open tx and rx file \n",__func__);

+    if(fs == 8000){

 

-   		vbuf_rec.tx_filename = VBUFFER_TX_FILE_NAME;//"/cache/tx.pcm";

-    	vbuf_rec.rx_filename = VBUFFER_RX_FILE_NAME;//"/cache/rx.pcm";

+        vbuf_rec.tx_filename = VBUFFER_TX_FILE_NAME;//"/cache/tx.pcm";

+        vbuf_rec.rx_filename = VBUFFER_RX_FILE_NAME;//"/cache/rx.pcm";

 

-	}

-	else if(fs == 16000){

+    }

+    else if(fs == 16000){

 

-    	vbuf_rec.tx_filename = VBUFFER_TX16_FILE_NAME;//"/cache/tx16.pcm";

-    	vbuf_rec.rx_filename = VBUFFER_RX16_FILE_NAME;//"/cache/rx16.pcm";

+        vbuf_rec.tx_filename = VBUFFER_TX16_FILE_NAME;//"/cache/tx16.pcm";

+        vbuf_rec.rx_filename = VBUFFER_RX16_FILE_NAME;//"/cache/rx16.pcm";

 

-	}	

-	else

-	{

-		vbuf_rec.tx_filename = VBUFFER_TX_FILE_NAME;//"/cache/tx.pcm";

-		vbuf_rec.rx_filename = VBUFFER_RX_FILE_NAME;//"/cache/rx.pcm";

+    }    

+    else

+    {

+        vbuf_rec.tx_filename = VBUFFER_TX_FILE_NAME;//"/cache/tx.pcm";

+        vbuf_rec.rx_filename = VBUFFER_RX_FILE_NAME;//"/cache/rx.pcm";

 

-	}

+    }

 

 

 

-	

+    

     vbuf_rec.tx_file = fopen(vbuf_rec.tx_filename , "rb");

     if (!vbuf_rec.tx_file) {

-        printf("Unable to open file '%s'\n", vbuf_rec.tx_filename);

+        RLOGE("Unable to open file '%s'\n", vbuf_rec.tx_filename);

         //return -1;

     }

 

 

     vbuf_rec.rx_file = fopen(vbuf_rec.rx_filename, "wb");

     if (!vbuf_rec.rx_file) {

-        printf(stderr, "Unable to create file '%s'\n", vbuf_rec.rx_filename);

-		//fclose(vbuf_rec.tx_file);

+        RLOGE("Unable to create file '%s'\n", vbuf_rec.rx_filename);

+        //fclose(vbuf_rec.tx_file);

  

         //return -1;

     }

-	vbuf_rec.rx_filesize = RX_FILE_LEN_MAX;	

-	printf("%s : vbuf_rec.rx_filesize(%d) \n",__func__,vbuf_rec.rx_filesize);

+    vbuf_rec.rx_filesize = RX_FILE_LEN_MAX;    

+    RLOGD("%s : vbuf_rec.rx_filesize(%d) \n",__func__,vbuf_rec.rx_filesize);

 

     vbuf_rec.rx_buf = (char*) malloc(buf_size);

-	if(!vbuf_rec.rx_buf) {

-		printf("%s : malloc buf fail,return \n",__func__);

-		goto err;

-	}	

+    if(!vbuf_rec.rx_buf) {

+        RLOGE("%s : malloc buf fail,return \n",__func__);

+        goto err;

+    }    

     vbuf_rec.tx_buf = (char*) malloc(buf_size);  

-	if(!vbuf_rec.tx_buf) {

-		free(vbuf_rec.rx_buf);

-		printf("%s : malloc buf fail,return \n",__func__);

-	    vbuf_rec.rx_buf = NULL;

-		goto err;

-	}	

-	vbuf_rec.buf_size = buf_size;

-	

+    if(!vbuf_rec.tx_buf) {

+        free(vbuf_rec.rx_buf);

+        RLOGE("%s : malloc buf fail,return \n",__func__);

+        vbuf_rec.rx_buf = NULL;

+        goto err;

+    }    

+    vbuf_rec.buf_size = buf_size;

+    

     vbuf_rec.quit = 0;

-	

-	printf("%s : vb open start \n",__func__);

+    

+    RLOGD("%s : vb open start \n",__func__);

 

-	

+    

     vbuf_rec.fd = voice_buffer_open();

-	if(vbuf_rec.fd <= 0){

-		printf("%s : vb open fail fd=%d,return \n",__func__,vbuf_rec.fd);

-		ret = -1;

-		goto err;

-		

-	}

-	printf("%s :voice_buffer_open end \n",__func__);

-	

-	printf("%s :rx tx vb_thread_create start \n",__func__);

+    if(vbuf_rec.fd <= 0){

+        RLOGE("%s : vb open fail fd=%d,return \n",__func__,vbuf_rec.fd);

+        ret = -1;

+        goto err;

+        

+    }

+    RLOGD("%s :voice_buffer_open end \n",__func__);

+    

+    RLOGD("%s :rx tx vb_thread_create start \n",__func__);

     ret = vb_thread_create ("vb_playback_test",&vbuf_rec.rx_test_thread, vb_rx_test_thread_func, 

-    							4*1024,35,NULL);

+                                4*1024,35,NULL);

     if (ret != 0)

     {

-		printf("%s :rx vb_thread_create fail ret=%d,return \n",__func__,ret);  

+        RLOGE("%s :rx vb_thread_create fail ret=%d,return \n",__func__,ret);  

         vbuf_rec.rx_test_thread = NULL;

-		goto err;

+        goto err;

     }

 

-	printf("%s :rx vb_thread_create end \n",__func__);

+    RLOGD("%s :rx vb_thread_create end \n",__func__);

 

     ret = vb_thread_create ( "vbuf_record_test", &vbuf_rec.tx_test_thread, vb_tx_test_thread_func,

-    							4*1024,35,NULL);

+                                4*1024,35,NULL);

     if (ret != 0) 

     {

     

-		printf("%s :tx vb_thread_create fail ret=%d,return \n",__func__,ret);       

+        RLOGE("%s :tx vb_thread_create fail ret=%d,return \n",__func__,ret);       

         vbuf_rec.tx_test_thread = NULL;

-		goto err;

+        goto err;

     }

-	printf("%s :tx vb_thread_create end \n",__func__);

+    RLOGD("%s :tx vb_thread_create end \n",__func__);

 

     return 0;

 

 err:

     voice_buffer_stream_test_stop();

-	

+    

     return ret;

 }

 

@@ -411,42 +423,42 @@
 int voice_buffer_stream_test_stop(void)

 {

     int ret = 0;

-	printf("%s:rx tx thread exit start \n",__func__);

-	if(vbuf_rec.quit == 1) {

-		printf("%s,already stop ,return\n",__func__);

+    RLOGD("%s:rx tx thread exit start \n",__func__);

+    if(vbuf_rec.quit == 1) {

+        RLOGD("%s,already stop ,return\n",__func__);

 

-	}

+    }

     

     vbuf_rec.quit = 1;

-	voice_buffer_stop(vbuf_rec.fd);

+    voice_buffer_stop(vbuf_rec.fd);

     if (vbuf_rec.tx_test_thread) 

     {

         pthread_join (vbuf_rec.tx_test_thread,NULL);

         vbuf_rec.tx_test_thread = NULL;

-		

+        

     }

     

     if (vbuf_rec.rx_test_thread) 

-    {	

+    {    

         pthread_join (vbuf_rec.rx_test_thread,NULL);

         vbuf_rec.rx_test_thread = NULL;

     }    

-	

-	if(vbuf_rec.tx_file != NULL) 

-	{

-		fclose(vbuf_rec.tx_file);

-		printf("%s : vb close ,close tx file \n",__func__);

-		vbuf_rec.tx_file = NULL;

-	}

-		

-	if(vbuf_rec.rx_file != NULL) 

-	{

+    

+    if(vbuf_rec.tx_file != NULL) 

+    {

+        fclose(vbuf_rec.tx_file);

+        RLOGD("%s : vb close ,close tx file \n",__func__);

+        vbuf_rec.tx_file = NULL;

+    }

+        

+    if(vbuf_rec.rx_file != NULL) 

+    {

 

-		fclose(vbuf_rec.rx_file);

-		printf("%s : vb close ,close rx file \n",__func__);

-		vbuf_rec.rx_file = NULL;

-		

-	}

+        fclose(vbuf_rec.rx_file);

+        RLOGD("%s : vb close ,close rx file \n",__func__);

+        vbuf_rec.rx_file = NULL;

+        

+    }

 

     vb_close_fd_release_buf();

     return 0;

@@ -460,55 +472,55 @@
     char* buf = vbuf_rec.rx_buf;

     int size = vbuf_rec.buf_size;

 

-	//char* buf = vbuf_rec.tx_buf;

-	

+    //char* buf = vbuf_rec.tx_buf;

+    

     //int size = vbuf_rec.buf_size;

     int w_size;

     int r_size;

 

  

-    printf( "%s: start size=%d! \n",__func__,size);

+    RLOGD( "%s: start size=%d! \n",__func__,size);

     memset (buf,0, size);

     

     while (!vbuf_rec.quit) 

     {

-		rx_optcount ++;	

-		VB_INT_OVERFLOW(rx_optcount);

-		if((rx_optcount%1000) == 0){

-            printf("%s: rx_optcount=%d! \n",__func__,rx_optcount);

+        rx_optcount ++;    

+        VB_INT_OVERFLOW(rx_optcount);

+        if((rx_optcount%1000) == 0){

+            RLOGD("%s: rx_optcount=%d! \n",__func__,rx_optcount);

 

-		}

-		else if(rx_optcount == 1000000){

-            printf("%s: rx_optcount=%d! \n",__func__,rx_optcount);

-			rx_optcount = 0;

-			

-		}

+        }

+        else if(rx_optcount == 1000000){

+            RLOGD("%s: rx_optcount=%d! \n",__func__,rx_optcount);

+            rx_optcount = 0;

+            

+        }

 

         //read form ps

-		r_size = voice_buffer_read(vbuf_rec.fd, vbuf_rec.rx_buf, size);

+        r_size = voice_buffer_read(vbuf_rec.fd, vbuf_rec.rx_buf, size);

         if(r_size <= 0) 

         {

-            first_rderr_flag++;			

-			VB_INT_OVERFLOW(first_rderr_flag);			

+            first_rderr_flag++;            

+            VB_INT_OVERFLOW(first_rderr_flag);            

             continue ;

         }

-		else{

-			first_rderr_flag = 0;

-		}

+        else{

+            first_rderr_flag = 0;

+        }

         memcpy(vbuf_rec.tx_buf,vbuf_rec.rx_buf,size);

-		w_size = voice_buffer_write(vbuf_rec.fd, vbuf_rec.tx_buf, size);

+        w_size = voice_buffer_write(vbuf_rec.fd, vbuf_rec.tx_buf, size);

         if(w_size <= 0) 

         {

-        	first_wrerr_flag++;

-			

-			VB_INT_OVERFLOW(first_wrerr_flag);

-			

+            first_wrerr_flag++;

+            

+            VB_INT_OVERFLOW(first_wrerr_flag);

+            

             continue;

         }

-		else{

-			first_wrerr_flag = 0;

-		}

-		

+        else{

+            first_wrerr_flag = 0;

+        }

+        

     }

     

     return 0;

@@ -521,98 +533,98 @@
 {

     int ret = -1;

     int buf_size = 320;

-	tx_optcount = 0;

-	rx_optcount = 0;	

+    tx_optcount = 0;

+    rx_optcount = 0;    

     int* buf_int;

 

-	int i;

+    int i;

 

-	if(vbuffer_start_flag == 1){ 

-		printf(" VB already start,return \n");

+    if(vbuffer_start_flag == 1){ 

+        RLOGE(" VB already start,return \n");

 

-		return 0;

-	}

-

-	if((vbuf_rec.fd != -1)&&(vbuf_rec.fd != 0)){

-		printf(" VB fd already get, vbuf_rec.fd=%d return \n",vbuf_rec.fd);

-	}

-

-	vbuffer_start_flag = 1;

-

-	if(fs == 8000){

-

-		buf_size = 320;

-	}

-	else if(fs == 16000){

-

-		buf_size = 640;

-	}	

-	else

-	{

-		buf_size = 320;

-	}

- 	printf("Starting vb stream fs=%d buf_size=%d \n",fs,buf_size);

-

-    vbuf_rec.rx_buf = (char*) malloc(buf_size);

-	if(!vbuf_rec.rx_buf) {

-		printf("%s : malloc buf fail,return \n",__func__);

-		goto err;

-	}	

-    vbuf_rec.tx_buf = (char*) malloc(buf_size);  

-	if(!vbuf_rec.tx_buf) {		

-	   printf("%s : malloc buf fail,return \n",__func__);

-	   goto err;

-	}	

-	vbuf_rec.buf_size = buf_size;

-	

-    vbuf_rec.quit = 0;

-	

-	printf("%s : vb open start \n",__func__);

-

-	

-    vbuf_rec.fd = voice_buffer_open();

-	if(vbuf_rec.fd <= 0){

-		printf("%s : vb open fail fd=%d,return \n",__func__,vbuf_rec.fd);		

-		goto err;

-		

-	}	

-	printf("%s :loop vb_thread_create start \n",__func__);

-    ret = vb_thread_create ("vb_playback_test",&vbuf_rec.loop_test_thread, vb_loop_test_thread_func, 

-    							4*1024,35,NULL);

-    if (ret != 0)

-    {

-		printf("%s :rx vb_thread_create fail ret=%d,return \n",__func__,ret);    

-		goto err;

+        return 0;

     }

 

-	printf("%s :rx vb_thread_create end \n",__func__);

+    if((vbuf_rec.fd != -1)&&(vbuf_rec.fd != 0)){

+        RLOGE(" VB fd already get, vbuf_rec.fd=%d return \n",vbuf_rec.fd);

+    }

+

+    vbuffer_start_flag = 1;

+

+    if(fs == 8000){

+

+        buf_size = 320;

+    }

+    else if(fs == 16000){

+

+        buf_size = 640;

+    }    

+    else

+    {

+        buf_size = 320;

+    }

+     RLOGD("Starting vb stream fs=%d buf_size=%d \n",fs,buf_size);

+

+    vbuf_rec.rx_buf = (char*) malloc(buf_size);

+    if(!vbuf_rec.rx_buf) {

+        RLOGE("%s : malloc buf fail,return \n",__func__);

+        goto err;

+    }    

+    vbuf_rec.tx_buf = (char*) malloc(buf_size);  

+    if(!vbuf_rec.tx_buf) {        

+       RLOGE("%s : malloc buf fail,return \n",__func__);

+       goto err;

+    }    

+    vbuf_rec.buf_size = buf_size;

+    

+    vbuf_rec.quit = 0;

+    

+    RLOGD("%s : vb open start \n",__func__);

+

+    

+    vbuf_rec.fd = voice_buffer_open();

+    if(vbuf_rec.fd <= 0){

+        RLOGE("%s : vb open fail fd=%d,return \n",__func__,vbuf_rec.fd);        

+        goto err;

+        

+    }    

+    RLOGD("%s :loop vb_thread_create start \n",__func__);

+    ret = vb_thread_create ("vb_playback_test",&vbuf_rec.loop_test_thread, vb_loop_test_thread_func, 

+                                4*1024,35,NULL);

+    if (ret != 0)

+    {

+        RLOGE("%s :rx vb_thread_create fail ret=%d,return \n",__func__,ret);    

+        goto err;

+    }

+

+    RLOGD("%s :rx vb_thread_create end \n",__func__);

 

     return 0;

 

 err:

-	voice_buffer_stream_loop_test_stop();

-	

+    voice_buffer_stream_loop_test_stop();

+    

     return ret;

 }

 

 int voice_buffer_stream_loop_test_stop(void)

 {

     int ret = 0;

-	printf("%s:loop thread exit start \n",__func__);

-	if(vbuf_rec.quit == 1) {

-		printf("%s,already stop ,return\n",__func__);

+    RLOGD("%s:loop thread exit start \n",__func__);

+    if(vbuf_rec.quit == 1) {

+        RLOGD("%s,already stop ,return\n",__func__);

 

-	}

+    }

     

     vbuf_rec.quit = 1;

-	voice_buffer_stop(vbuf_rec.fd);

+    voice_buffer_stop(vbuf_rec.fd);

     if (vbuf_rec.loop_test_thread) 

     {

         pthread_join (vbuf_rec.loop_test_thread,NULL);

         vbuf_rec.tx_test_thread = NULL;

-		

+        

     }

-    	

+        

     vb_close_fd_release_buf();

     return 0;

 }

@@ -635,102 +647,110 @@
 void voice_buffer_cmd_proc(char *cmdstr)

 {

     int ret = 0;

-	char data[VOICE_CMD_MAX_LEN];

-	int cmdstr_len = strlen(cmdstr); //-strlen("\r")

+    char data[VOICE_CMD_MAX_LEN];

+    int cmdstr_len = strlen(cmdstr); //-strlen("\r")

     int value = 0;

     int *p_value = &value;

+

+    

     

     cmdstr[cmdstr_len] = '\0'; //+strlen("\0")

 

-	ret = sscanf(cmdstr, "%s", data);

+    ret = sscanf(cmdstr, "%s", data);

     if(1 != ret){

-        printf("data sscanf failed!(%d)\n", ret);

+        RLOGE("data sscanf failed!(%d)\n", ret);

         return;

     }

-	if(0 == strncmp(data, REQ_VOICE_BUFFER_TEST_START, strlen(REQ_VOICE_BUFFER_TEST_START))){

 

-		ret = sscanf(cmdstr, "%*s %d", &value);

+    pthread_mutex_lock(&s_vb_demo_mtx);

+    if(0 == strncmp(data, REQ_VOICE_BUFFER_TEST_START, strlen(REQ_VOICE_BUFFER_TEST_START))){

+

+        ret = sscanf(cmdstr, "%*s %d", &value);

         if(1 != ret){

-            printf("%s,value sscanf failed!(%d)\n",data, ret);

-            return;

+            RLOGE("%s,value sscanf failed!(%d)\n",data, ret);

+            goto vb_cmd_end;

         }

-		

-        printf("%s set value %d\n", data, value);

-		ret = voice_buffer_stream_test_start(value);

+        

+        RLOGD("%s set value %d\n", data, value);

+        ret = voice_buffer_stream_test_start(value);

 

-		printf("%s return ret=%d\n", data, ret);

-		

-	}

-	else if(0 == strncmp(data, REQ_VOICE_BUFFER_TEST_STOP, strlen(REQ_VOICE_BUFFER_TEST_STOP))){

-		ret = voice_buffer_stream_test_stop();

-		printf("%s return %d\n", data, ret);

-	}

-	else if(0 == strncmp(data, REQ_VOICE_BUFFER_LOOP_TEST_START, strlen(REQ_VOICE_BUFFER_LOOP_TEST_START))){

+        RLOGD("%s return ret=%d\n", data, ret);

+        

+    }

+    else if(0 == strncmp(data, REQ_VOICE_BUFFER_TEST_STOP, strlen(REQ_VOICE_BUFFER_TEST_STOP))){

+        ret = voice_buffer_stream_test_stop();

+        RLOGD("%s return %d\n", data, ret);

+    }

+    else if(0 == strncmp(data, REQ_VOICE_BUFFER_LOOP_TEST_START, strlen(REQ_VOICE_BUFFER_LOOP_TEST_START))){

 

-		ret = sscanf(cmdstr, "%*s %d", &value);

+        ret = sscanf(cmdstr, "%*s %d", &value);

         if(1 != ret){

-            printf("%s,value sscanf failed!(%d)\n",data, ret);

-            return;

+            RLOGE("%s,value sscanf failed!(%d)\n",data, ret);

+            goto vb_cmd_end;

         }

-		

-        printf("%s set value %d\n", data, value);

-		ret = voice_buffer_stream_loop_test_start(value);

+        

+        RLOGD("%s set value %d\n", data, value);

+        ret = voice_buffer_stream_loop_test_start(value);

 

-		printf("%s return ret=%d\n", data, ret);

-		

-	}

-	else if(0 == strncmp(data, REQ_VOICE_BUFFER_LOOP_TEST_STOP, strlen(REQ_VOICE_BUFFER_LOOP_TEST_STOP))){

-		printf("voice_buffer_stream_loop_test_stop \n");

-		ret = voice_buffer_stream_loop_test_stop();

-		printf("%s return %d\n", data, ret);

-	}

+        RLOGD("%s return ret=%d\n", data, ret);

+        

+    }

+    else if(0 == strncmp(data, REQ_VOICE_BUFFER_LOOP_TEST_STOP, strlen(REQ_VOICE_BUFFER_LOOP_TEST_STOP))){

+        RLOGD("voice_buffer_stream_loop_test_stop \n");

+        ret = voice_buffer_stream_loop_test_stop();

+        RLOGD("%s return %d\n", data, ret);

+    }

     else if(0 == strncmp(data, REQ_VOICE_BUFFER_RTP_TEST_START, strlen(REQ_VOICE_BUFFER_RTP_TEST_START))){

 

-		ret = sscanf(cmdstr, "%*s %d", &value);

+        ret = sscanf(cmdstr, "%*s %d", &value);

         if(1 != ret){

-            printf("%s,value sscanf failed!(%d)\n",data, ret);

-            return;

+            RLOGE("%s,value sscanf failed!(%d)\n",data, ret);

+            goto vb_cmd_end;

         }

-		

-        printf("%s set value %d\n", data, value);

-		ret = voice_buffer_rtp_test_start(value);

+        

+        RLOGD("%s set value %d\n", data, value);

+        ret = voice_buffer_rtp_test_start(value);

 

-		printf("%s return ret=%d\n", data, ret);

-		

-	}

-	else if(0 == strncmp(data, REQ_VOICE_BUFFER_RTP_TEST_STOP, strlen(REQ_VOICE_BUFFER_RTP_TEST_STOP))){

-		ret = voice_buffer_rtp_test_stop();

-		printf("%s return %d\n", data, ret);

-	}	

+        RLOGD("%s return ret=%d\n", data, ret);

+        

+    }

+    else if(0 == strncmp(data, REQ_VOICE_BUFFER_RTP_TEST_STOP, strlen(REQ_VOICE_BUFFER_RTP_TEST_STOP))){

+        ret = voice_buffer_rtp_test_stop();

+        RLOGD("%s return %d\n", data, ret);

+    }    

     else{

-		printf("Request unknow.\n");

+        RLOGE("Request unknow.\n");

         printUsage(cmdstr);

-	}

+    }

+vb_cmd_end:

+    pthread_mutex_unlock(&s_vb_demo_mtx);

 }

 

 void vb_buffer_stop_all()

 {

-	voice_buffer_stream_loop_test_stop();

+    voice_buffer_stream_loop_test_stop();

     voice_buffer_stream_test_stop();

     voice_buffer_rtp_test_stop();

 }

 

 void signal_handle_func(int sig)

 {

-	printf("sig(%d) signal_handle_func exit ",sig);

-    

+    RLOGD("sig(%d) signal_handle_func exit ",sig);

+

+    pthread_mutex_lock(&s_vb_demo_mtx);   

     vb_buffer_stop_all();

-	exit(0);

+    pthread_mutex_unlock(&s_vb_demo_mtx);

+    exit(0);

 }

 

 int main(int argc, char **argv)

 {

     char cmdstr[VOICE_CMD_MAX_LEN];

-	

-	signal(SIGINT, signal_handle_func);

-	signal(SIGQUIT, signal_handle_func);

-	signal(SIGTERM, signal_handle_func);

-	signal(SIGPIPE, signal_handle_func);

+    

+    signal(SIGINT, signal_handle_func);

+    signal(SIGQUIT, signal_handle_func);

+    signal(SIGTERM, signal_handle_func);

+    signal(SIGPIPE, signal_handle_func);

 

     memset(&vbuf_rec,0,sizeof(vbuf_rec));

 #if 0

@@ -743,27 +763,28 @@
     else

     {

 #endif

-        while(1){

-            printf("Please input an voice_demo command:\n");

+    printf("Please input an voice_demo command:\n");  

+        while(1){           

             if(NULL != fgets(cmdstr, VOICE_CMD_MAX_LEN - 1, stdin)){

                 if(0 == strcmp(EXIT_CMD_STOP, cmdstr) || 

                     0 == strcmp(EXIT_CMD_Q, cmdstr) || 

                     0 == strcmp(EXIT_CMD_EXIT, cmdstr)){

-					vb_buffer_stop_all();

-    				break;

-    			}

+                    vb_buffer_stop_all();

+                    break;

+                }

                 

-                printf("len:%d, cmdstr:%s\n", strlen(cmdstr), cmdstr);

+                RLOGI("len:%d, cmdstr:%s\n", strlen(cmdstr), cmdstr);

                 

                 if(1 >= strlen(cmdstr)){

-    				continue;

-    			}

-                voice_buffer_cmd_proc(cmdstr);

+                    continue;

+                }

+                voice_buffer_cmd_proc(cmdstr);               

             }         

-        }

-//    }    

+            sleep(5);                    

+      }

+    

 

-    printf("voice_demo end\n");

+    RLOGD("voice_demo end\n");

     

     return 0;

 }

diff --git a/esdk/layers/meta-zxic-custom/recipes-lynq/lynq-vb-demo/files/makefile b/esdk/layers/meta-zxic-custom/recipes-lynq/lynq-vb-demo/files/makefile
index 6a6f960..7117ebc 100755
--- a/esdk/layers/meta-zxic-custom/recipes-lynq/lynq-vb-demo/files/makefile
+++ b/esdk/layers/meta-zxic-custom/recipes-lynq/lynq-vb-demo/files/makefile
@@ -26,6 +26,7 @@
 LOCAL_LIBS := \
     -L. \
     -ldl \
+    -llog \
     -lpthread \
     -lvoice \
 
diff --git a/esdk/layers/meta-zxic-custom/recipes-lynq/lynq-vb-demo/lynq-vb-demo.bb b/esdk/layers/meta-zxic-custom/recipes-lynq/lynq-vb-demo/lynq-vb-demo.bb
index b01d3b0..5691603 100755
--- a/esdk/layers/meta-zxic-custom/recipes-lynq/lynq-vb-demo/lynq-vb-demo.bb
+++ b/esdk/layers/meta-zxic-custom/recipes-lynq/lynq-vb-demo/lynq-vb-demo.bb
@@ -3,7 +3,7 @@
 DESCRIPTION = "lynq-vb-demo"
 LICENSE = "CLOSED"
 LIC_FILES_CHKSUM = "file://LICENSE;md5=b1e07e8d88e26263e71d3a9e2aa9a2ff"
-DEPENDS += "libvoice"
+DEPENDS += "libbinder libvoice"
 SRC_URI = "file://lynq_vb_demo.c \
            file://makefile \
 "
diff --git a/esdk/layers/meta-zxic/recipes-app/libvoice/libvoice.bb b/esdk/layers/meta-zxic/recipes-app/libvoice/libvoice.bb
index b413ee2..236850c 100755
--- a/esdk/layers/meta-zxic/recipes-app/libvoice/libvoice.bb
+++ b/esdk/layers/meta-zxic/recipes-app/libvoice/libvoice.bb
@@ -1,5 +1,5 @@
 DESCRIPTION = "libvoice"

-DEPENDS = "libtinyalsa libnvram libsoftap libsofttimer"

+DEPENDS = "libtinyalsa libnvram libsoftap libsofttimer libdebug-info"

 SECTION     = "lib"
 LICENSE     = "zte"
 PV          = "1.0.0"
@@ -15,11 +15,13 @@
 S = "${WORKDIR}"
 #引用公用头文件和编译选项。
 include ${BSPDIR}/sources/meta-zxic/conf/app_com.inc

+include ${BSPDIR}/sources/meta-zxic/conf/pub.inc

 CFLAGS_append    = "-I ${BSPDIR}/zxic_code/zxic_source/zxic_app_open/platform/libtinyalsa/include"

 CFLAGS_append    = "-I ${BSPDIR}/zxic_code/zxic_source/linux-5.10/include/linux"

 

 
 CFLAGS_append += "${@bb.utils.contains("CONFIG_VB_TRANSMIT_INTF", "RTP", "-I ${BSPDIR}/zxic_code/zxic_source/zxic_app/librtp/include", "", d)}"

+CFLAGS_append += "${ZXIC_EXTRA_CFLAGS}"

 DEPENDS += "${@bb.utils.contains('CONFIG_VB_TRANSMIT_INTF', 'RTP', 'librtp', '', d)}"

 #编译
 do_compile () {
diff --git a/esdk/layers/meta-zxic/recipes-app/nvserver/nvserver.bb b/esdk/layers/meta-zxic/recipes-app/nvserver/nvserver.bb
index 69ad466..e7cf838 100755
--- a/esdk/layers/meta-zxic/recipes-app/nvserver/nvserver.bb
+++ b/esdk/layers/meta-zxic/recipes-app/nvserver/nvserver.bb
@@ -1,6 +1,6 @@
 DESCRIPTION = "nvserver"
 #nvserver依赖libnvram库
-DEPENDS     = "libmtd libnvram libflags libsd-daemon"
+DEPENDS     = "libmtd libnvram libflags libsd-daemon libdebug-info"
 SECTION     = "app"
 LICENSE     = "zte"
 PV = "1.0.0"
diff --git a/esdk/layers/meta-zxic/recipes-app/sntp/sntp.bb b/esdk/layers/meta-zxic/recipes-app/sntp/sntp.bb
index dd579d3..37b2b5f 100755
--- a/esdk/layers/meta-zxic/recipes-app/sntp/sntp.bb
+++ b/esdk/layers/meta-zxic/recipes-app/sntp/sntp.bb
@@ -50,7 +50,9 @@
 	if ${@bb.utils.contains('DISTRO_FEATURES','sysvinit','true','false',d)}; then
 		install -Dm 0755 ${WORKDIR}/sntp.sysvinit ${D}${sysconfdir}/init.d/sntp
 		install -d ${D}${sysconfdir}/rcS.d
-		ln -s ../init.d/sntp ${D}${sysconfdir}/rcS.d/S22sntp
+		#xy.he@20250211 bug-view-378 add for disable sntp autostart start
+		#ln -s ../init.d/sntp ${D}${sysconfdir}/rcS.d/S22sntp
+		#xy.he@20250211 bug-view-378 add for disable sntp autostart end
 	fi
 	
 	#install elfs
@@ -73,4 +75,4 @@
 SYSTEMD_SERVICE_${PN}     = "sntp.service"
 SYSTEMD_AUTO_ENABLE_${PN} = "enable"
 
-RDEPENDS_${PN} = " libdebug-info libnvram libsoftap libsofttimer"
\ No newline at end of file
+RDEPENDS_${PN} = " libdebug-info libnvram libsoftap libsofttimer"
diff --git a/esdk/layers/meta-zxic/recipes-app/zxic-debug/zxic-debug.bb b/esdk/layers/meta-zxic/recipes-app/zxic-debug/zxic-debug.bb
index 61650fa..0386349 100755
--- a/esdk/layers/meta-zxic/recipes-app/zxic-debug/zxic-debug.bb
+++ b/esdk/layers/meta-zxic/recipes-app/zxic-debug/zxic-debug.bb
@@ -1,6 +1,6 @@
 DESCRIPTION = "zxic-debug"
 #zxic-debug依赖libnvram库
-DEPENDS     = "libnvram"
+DEPENDS     = "libnvram  openssl "
 SECTION     = "app"
 LICENSE     = "zte"
 PV = "1.0.0"
diff --git a/esdk/layers/meta-zxic/recipes-core/busybox/busybox/busybox-1.33.1/0104-zxic-reboot-print-ppid.patch b/esdk/layers/meta-zxic/recipes-core/busybox/busybox/busybox-1.33.1/0104-zxic-reboot-print-ppid.patch
new file mode 100755
index 0000000..fe957aa
--- /dev/null
+++ b/esdk/layers/meta-zxic/recipes-core/busybox/busybox/busybox-1.33.1/0104-zxic-reboot-print-ppid.patch
@@ -0,0 +1,105 @@
+From 788511a2255d0416dfba782853bd20cb55b5ea67 Mon Sep 17 00:00:00 2001
+From: =?utf-8?q?=E5=91=A8=E5=9B=BD=E5=9D=A10318000136?=
+ <zhou.guopo@sanechips.com.cn>
+Date: Thu, 7 Nov 2024 14:18:56 +0800
+Subject: [PATCH] zxic reboot print ppid
+
+---
+ init/halt.c | 74 +++++++++++++++++++++++++++++++++++++++++++++++++++++
+ 1 file changed, 74 insertions(+)
+
+diff --git a/init/halt.c b/init/halt.c
+index ddb03e2..93980b6 100644
+--- a/init/halt.c
++++ b/init/halt.c
+@@ -154,6 +154,78 @@ static int init_was_not_there(void)
+ # define init_was_not_there() 0
+ #endif
+ 
++extern int sc_debug_info_record(char *id, const char *format, ...);
++static void get_app_name_by_pid(int pid, char *app_name, int app_name_len)
++{
++	char file_comm[256];
++	FILE *pfile;
++	size_t len;
++	
++	memset(file_comm, 0, sizeof(file_comm));
++	snprintf(file_comm, sizeof(file_comm), "/proc/%d/comm", pid);
++
++	pfile = fopen(file_comm, "r");
++	if (pfile)
++	{
++		memset(app_name, 0, app_name_len);
++		fgets(app_name, app_name_len, pfile);
++		app_name[app_name_len-1] = '\0';
++		app_name[strlen(app_name) - 1] = '\0'; //last byte is \n
++		fclose(pfile);
++	}
++}
++
++static int get_ppid(int pid) {
++    char path[256];
++    snprintf(path, sizeof(path), "/proc/%d/stat", pid);
++    
++    FILE *fp = fopen(path, "r");
++    if (fp == NULL) {
++        perror("fopen");
++        return -1;
++    }
++    
++    int ppid = -1;
++    // 通过解析第4列(ppid)来获取父进程ID
++    fscanf(fp, "%*d %*s %*c %d", &ppid);
++    fclose(fp);
++    return ppid;
++}
++
++static int get_reboot_caller(char *applet_name)
++{
++	int pid = get_ppid(getpid());
++	char app_name[32];
++	int app_name_len = sizeof(app_name);
++	int try_cnt = 0;
++
++	while(1)
++	{
++		if (try_cnt > 5) {
++			strcpy(app_name, "unkown");
++			break;
++		}
++		try_cnt++;
++		if (pid == 1) {
++			get_app_name_by_pid(pid, app_name, app_name_len);
++			break; //init
++		}
++		get_app_name_by_pid(pid, app_name, app_name_len);
++		if ((strcmp(app_name, "sh") == 0) || (strcmp(app_name, "bash") == 0)) {
++			//printf("shell %s continue %d\n", app_name, strlen(app_name));
++			pid = get_ppid(pid); //sh continue
++		} else {
++			//printf("not sh break %s %d\n", app_name, strlen(app_name));
++			break; //not sh
++		}
++	}
++
++	sc_debug_info_record("cap_reboot", "call %s reset_by %s(%d)\n", applet_name, app_name, pid);
++	printf("call %s by %s(%d)\n", applet_name, app_name, pid);
++
++	return 0;
++}
++
+ int halt_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
+ int halt_main(int argc UNUSED_PARAM, char **argv)
+ {
+@@ -180,6 +252,8 @@ int halt_main(int argc UNUSED_PARAM, char **argv)
+ 	for (which = 0; "hpr"[which] != applet_name[0]; which++)
+ 		continue;
+ 
++	get_reboot_caller(applet_name); //add by zxic, print parent proccess name and pid
++
+ 	/* Parse and handle arguments */
+ 	/* We support -w even if !ENABLE_FEATURE_WTMP,
+ 	 * in order to not break scripts.
+-- 
+2.17.1
+
diff --git a/esdk/layers/meta-zxic/recipes-core/busybox/busybox_1.33.1.bb b/esdk/layers/meta-zxic/recipes-core/busybox/busybox_1.33.1.bb
index a5a5bf4..43a4540 100755
--- a/esdk/layers/meta-zxic/recipes-core/busybox/busybox_1.33.1.bb
+++ b/esdk/layers/meta-zxic/recipes-core/busybox/busybox_1.33.1.bb
@@ -52,8 +52,9 @@
            file://busybox-1.33.1/0100-zxic-tty-disable-soft-flow-control.patch \
 		   file://busybox-1.33.1/700-dhcpd-fix.patch \
            "
-
-SRC_URI += "file://busybox-1.33.1/010-syslogd-recive-remote-log.patch"
+#LYNQ_MODIFY_ZXW_TASK935_XF.Li_20250122_START
+#SRC_URI += "file://busybox-1.33.1/010-syslogd-recive-remote-log.patch"
+#LYNQ_MODIFY_ZXW_TASK935_XF.Li_20250122_END
 SRC_URI += "file://busybox-1.33.1/020-syslogd-filesize-and-filenum-parameter-nvcfg.patch" 
 #SRC_URI += "file://busybox-1.33.1/022-syslogd-replace-remote-log-facility.patch"
 SRC_URI += "file://busybox-1.33.1/0100-zxic-add-sync-after-chmod.patch"
@@ -61,6 +62,7 @@
 SRC_URI += "file://busybox-1.33.1/0102-zxic-ash-read-etc-profile.patch"
 SRC_URI += "file://busybox-1.33.1/0103-top-short-lived-processes-optimize.patch"
 SRC_URI += "file://busybox-1.33.1/0103-syslogd-data-encryption.patch"
+SRC_URI += "file://busybox-1.33.1/0104-zxic-reboot-print-ppid.patch"
 
 SRC_URI_append_libc-musl = " file://busybox-1.33.1/musl.cfg "
 
diff --git a/esdk/layers/meta-zxic/recipes-core/busybox/busybox_1.33.1.inc b/esdk/layers/meta-zxic/recipes-core/busybox/busybox_1.33.1.inc
index 2efbe4d..1b610f9 100755
--- a/esdk/layers/meta-zxic/recipes-core/busybox/busybox_1.33.1.inc
+++ b/esdk/layers/meta-zxic/recipes-core/busybox/busybox_1.33.1.inc
@@ -3,7 +3,7 @@
 HOMEPAGE = "https://www.busybox.net"
 BUGTRACKER = "https://bugs.busybox.net/"
 
-DEPENDS += "kern-tools-native virtual/crypt libnvram"
+DEPENDS += "kern-tools-native virtual/crypt libnvram libdebug-info"
 
 # bzip2 applet in busybox is based on lightly-modified bzip2-1.0.4 source
 # the GPL is version 2 only
diff --git a/esdk/layers/meta-zxic/recipes-core/glibc/glibc_%.bbappend b/esdk/layers/meta-zxic/recipes-core/glibc/glibc_%.bbappend
index 1ea730c..7a45c61 100755
--- a/esdk/layers/meta-zxic/recipes-core/glibc/glibc_%.bbappend
+++ b/esdk/layers/meta-zxic/recipes-core/glibc/glibc_%.bbappend
@@ -2,8 +2,7 @@
 FILESEXTRAPATHS_prepend := "${THISDIR}/files:"
 
 SRC_URI += " \
-           file://0001-write-log-to-zcat-tool.patch \
-           file://0002-fix-y2038-time_t-unsigned-long.patch \
+            file://0001-write-log-to-zcat-tool.patch \
 "
 
 do_install_append() {
diff --git a/upstream/linux-5.10/drivers/mfd/zx234290-core.c b/upstream/linux-5.10/drivers/mfd/zx234290-core.c
index d43085f..6da76d2 100755
--- a/upstream/linux-5.10/drivers/mfd/zx234290-core.c
+++ b/upstream/linux-5.10/drivers/mfd/zx234290-core.c
@@ -246,15 +246,16 @@
 #endif
 #if 1
 extern int Zx234290_SetUserReg_PSM(unsigned char data);
+extern void zxic_reset_reason(int reason, const char *cpu, const char *app);
 
 void zx29_restart(const char * cmd)
 {
 	/*set reset value = 1*/
-	unsigned char  status = ZX234290_USER_RST_TO_NORMAL;
+	unsigned char  status = USER_RST_TO_NORMAL;
 
 	printk(KERN_INFO"restart:enter reboot  :reset to normal\n");
+	zxic_reset_reason(2, "cap", current->comm);
 	
-	status = ZX234290_USER_RST_TO_NORMAL;
 	Zx234290_SetUserReg_PSM(status);
 }
 
diff --git a/upstream/linux-5.10/drivers/mmc/core/mmc_ramdump.c b/upstream/linux-5.10/drivers/mmc/core/mmc_ramdump.c
index be7309c..9235ec4 100755
--- a/upstream/linux-5.10/drivers/mmc/core/mmc_ramdump.c
+++ b/upstream/linux-5.10/drivers/mmc/core/mmc_ramdump.c
@@ -530,7 +530,7 @@
 }
 
 //ÉèÖöÁÊý¾Ý´óС
-int mmc_bread(u32 start_addr, u32 data_size, void *dst)
+int mmc_bread(u64 start_addr, u32 data_size, void *dst)
 {
 	int ret;
     u32 src = 0;
@@ -548,7 +548,7 @@
 	if(block_addr == 0)
 		src	= start_addr;
 	else
-		src	= start_addr/MMC_BLOCK_SIZE;
+		src = (u32)(start_addr/MMC_BLOCK_SIZE);
 	
 	if(blk_count){
 		ret= zx_mmc_read(src, (u8 *) dst, blk_count * MMC_BLOCK_SIZE);
@@ -573,7 +573,7 @@
 	return data_size;
 }
 
-int mmc_bwrite(u32 start_addr, u32 data_size, void *src_buf)
+int mmc_bwrite(u64 start_addr, u32 data_size, void *src_buf)
 {
 	int ret;
     u32 start_blk = 0;
@@ -594,7 +594,7 @@
 	if(block_addr == 0)
 		start_blk	= start_addr;
 	else
-		start_blk	= (start_addr/MMC_BLOCK_SIZE);
+		start_blk	= (u32)(start_addr/MMC_BLOCK_SIZE);
 	
 	if(blk_count){
 		ret= zx_mmc_write(start_blk, (u8 *)src_buf, blk_count * MMC_BLOCK_SIZE);
diff --git a/upstream/linux-5.10/drivers/mtd/mtdcore.c b/upstream/linux-5.10/drivers/mtd/mtdcore.c
index a52a2c8..c07e824 100755
--- a/upstream/linux-5.10/drivers/mtd/mtdcore.c
+++ b/upstream/linux-5.10/drivers/mtd/mtdcore.c
@@ -228,6 +228,17 @@
 }
 static DEVICE_ATTR(ecc_strength, S_IRUGO, mtd_ecc_strength_show, NULL);
 
+#define MTD_RECORD_NAME_MAX        (16)
+struct zxic_mtd_record
+{
+	char name[MTD_RECORD_NAME_MAX];
+	unsigned int erase_times;
+	unsigned int write_times;
+};
+
+static struct zxic_mtd_record g_zxic_mtd_record; //save data
+static int record_mtd_trigger_flag; // 0 stop record, 1 start record
+
 static ssize_t mtd_bitflip_threshold_show(struct device *dev,
 					  struct device_attribute *attr,
 					  char *buf)
@@ -1111,6 +1122,9 @@
 
 	adjinstr.addr += mst_ofs;
 
+	if (record_mtd_trigger_flag && (strcmp(mtd->name, g_zxic_mtd_record.name) == 0))
+		g_zxic_mtd_record.erase_times++;
+
 	ret = master->_erase(master, &adjinstr);
 
 	if (adjinstr.fail_addr != MTD_FAIL_ADDR_UNKNOWN) {
@@ -1232,6 +1246,9 @@
 	};
 	int ret;
 
+	if (record_mtd_trigger_flag && (strcmp(mtd->name, g_zxic_mtd_record.name) == 0))
+		g_zxic_mtd_record.write_times++;
+
 	ret = mtd_write_oob(mtd, to, &ops);
 	*retlen = ops.retlen;
 
@@ -2203,6 +2220,107 @@
 
 static struct proc_dir_entry *proc_mtd;
 
+/* Started by AICoder, pid:5fc9ey6dc555c241432c0bd800e0358e8d683380 */
+static struct proc_dir_entry *proc_record_mtd_name;
+static struct proc_dir_entry *proc_record_mtd_trigger;
+static struct proc_dir_entry *proc_record_mtd_erase_times;
+
+static ssize_t proc_record_mtd_name_read(struct file *file, char __user *user_buffer, size_t count, loff_t *offset) {
+	if (g_zxic_mtd_record.name[0] != '\0')
+		return simple_read_from_buffer(user_buffer, count, offset, g_zxic_mtd_record.name, strlen(g_zxic_mtd_record.name));
+	else
+		return 0;
+}
+
+static ssize_t proc_record_mtd_name_write(struct file *file, const char __user *user_buffer, size_t count, loff_t *offset) {
+	if (count <= 1 || count >= MTD_RECORD_NAME_MAX) {
+		return -EINVAL;
+	}
+
+	if (copy_from_user(g_zxic_mtd_record.name, user_buffer, count)) {
+		return -EFAULT;
+	}
+
+	g_zxic_mtd_record.name[count-1] = '\0'; // last 1 byte 0x0a
+	g_zxic_mtd_record.erase_times = 0;
+	g_zxic_mtd_record.write_times = 0;
+
+	return count;
+}
+
+static ssize_t proc_record_mtd_trigger_read(struct file *file, char __user *user_buffer, size_t count, loff_t *offset) {
+	if (record_mtd_trigger_flag)
+		return simple_read_from_buffer(user_buffer, count, offset, "start\n", 6);
+	else
+		return simple_read_from_buffer(user_buffer, count, offset, "stop\n", 5);
+}
+
+static ssize_t proc_record_mtd_trigger_write(struct file *file, const char __user *user_buffer, size_t count, loff_t *offset) {
+	char buffer[10];
+
+	if (count < 4 || count > 6)
+		return -EINVAL;
+	if (g_zxic_mtd_record.name[0] == '\0')
+		return -EINVAL; // mtd name not set
+	if (copy_from_user(buffer, user_buffer, count))
+		return -EFAULT;
+
+	buffer[count-1] = '\0'; // last 1 byte 0x0a
+	//printk("record mtd trigger:%s\n", buffer);
+
+	if (memcmp(buffer, "start", 5) == 0) {
+		printk(KERN_WARNING "record mtd erase and write start\n");
+		g_zxic_mtd_record.erase_times = 0;
+		g_zxic_mtd_record.write_times = 0;
+		record_mtd_trigger_flag = 1;
+	} else {
+		if (memcmp(buffer, "stop", 4) == 0)
+		{
+			printk(KERN_WARNING "record mtd erase and write stop\n");
+			record_mtd_trigger_flag = 0;
+		}
+		else
+		{
+			return -EINVAL;
+		}
+	}
+
+	return count;
+}
+
+static int proc_record_mtd_erase_times_show(struct seq_file *m, void *v)
+{
+	seq_printf(m, "mtd:%s\n", g_zxic_mtd_record.name);
+	seq_printf(m, "erase_times:%u\n", g_zxic_mtd_record.erase_times);
+	seq_printf(m, "write_times:%u\n", g_zxic_mtd_record.write_times);
+	return 0;
+}
+
+static const struct proc_ops proc_record_mtd_name_fops = {
+    .proc_read = proc_record_mtd_name_read,
+    .proc_write = proc_record_mtd_name_write,
+};
+
+static const struct proc_ops proc_record_mtd_trigger_fops = {
+    .proc_read = proc_record_mtd_trigger_read,
+    .proc_write = proc_record_mtd_trigger_write,
+};
+
+static int zxic_record_proc_init(void)
+{
+	proc_record_mtd_name = proc_create("record_mtd_name", 0666, NULL, &proc_record_mtd_name_fops);
+	if (!proc_record_mtd_name)
+		return -ENOMEM;
+	proc_record_mtd_trigger = proc_create("record_mtd_trigger", 0666, NULL, &proc_record_mtd_trigger_fops);
+	if (!proc_record_mtd_trigger)
+		return -ENOMEM;
+	proc_record_mtd_erase_times = proc_create_single("record_mtd_erase_times", 0, NULL, proc_record_mtd_erase_times_show);
+	if (!proc_record_mtd_erase_times)
+		return -ENOMEM;
+	return 0;
+}
+/* Ended by AICoder, pid:5fc9ey6dc555c241432c0bd800e0358e8d683380 */
+
 static int __init init_mtd(void)
 {
 	int ret;
@@ -2219,6 +2337,9 @@
 
 	proc_mtd = proc_create_single("mtd", 0, NULL, mtd_proc_show);
 
+	if (zxic_record_proc_init() < 0)
+		printk(KERN_ERR "zxic_record_proc_init error\n");
+
 	ret = init_mtdchar();
 	if (ret)
 		goto out_procfs;
diff --git a/upstream/linux-5.10/drivers/net/ethernet/zte/zx29_gmac.c b/upstream/linux-5.10/drivers/net/ethernet/zte/zx29_gmac.c
index 668d9d9..32cb5a5 100755
--- a/upstream/linux-5.10/drivers/net/ethernet/zte/zx29_gmac.c
+++ b/upstream/linux-5.10/drivers/net/ethernet/zte/zx29_gmac.c
@@ -25,8 +25,11 @@
 #include <linux/gpio.h>

 #include <linux/of_gpio.h>

 #include <linux/device.h>

+#include <uapi/linux/sched/types.h>

 #include "zx29_gmac.h"

 

+#define GMAC_RX_WORKER_TH 1

+

 #define gmac_printk(_format, _args...)		do{printk(KERN_INFO"gmac," _format "\n",##_args);}while(0)

 

 static u8 zx29_gmac_addr[MAC_ADDR_LENTH] = {0xec,0x1d,0x7f,0xb0,0x2f,0x32};

@@ -86,10 +89,11 @@
 

 	d = (struct bd_tx *)priv->dma_tx_vir;

 

+      

 	if (n == priv->tx_bd_offset) 

 		return 0;

 

-	if (d[n].TDES0 & DMA_OWNER)

+	if ( (!d) || (d[n].TDES0 & DMA_OWNER))

 		return 0;

 

 	if (d[n].skb == NULL)

@@ -123,7 +127,7 @@
     int   n						= prv->rx_bd_offset;

     struct bd_rx *d				= (struct bd_rx*)prv->dma_rx_vir;

 

-    if(d[n].RDES0 & DMA_OWNER) 

+    if ((!d) || (d[n].RDES0 & DMA_OWNER)) 

     {

         return 0;

     }

@@ -359,6 +363,56 @@
 	return (exhausted > 10);

 }

 

+#ifdef GMAC_RX_WORKER_TH

+static struct task_struct *s_gmac_rx_worker = 0;

+static int ko_remove_flag = 0;

+struct semaphore s_gmac_rx_sem = {0};

+static int gmac_rx_worker(void *dev)

+{

+	struct net_device *ndev = (struct net_device *)dev;

+	struct zx29_gmac_dev *prv = (struct zx29_gmac_dev *)netdev_priv(ndev);

+	volatile unsigned *gmac = (unsigned *)ndev->base_addr;

+	unsigned int events = prv->int_event;

+

+	do {

+		down(&s_gmac_rx_sem);

+		if (ko_remove_flag)

+		    return 0;

+		events = prv->int_event;

+    	do {

+    		if (events & INT_ST_TX)

+    			zx29_gmac_tx(ndev);

+    

+    		if (events & INT_ST_RX)

+    			zx29_gmac_rx(ndev);

+    

+    		events = MAC(0x1014);

+    		MAC(0x1014) = events;

+    	} while (events & (INT_ST_TX | INT_ST_RX));

+    

+    #ifndef GMAC_NO_INT

+    	mac_int_enable();

+    #endif

+	} while(1);

+

+	return 0;

+}

+

+static int zx29_gmac_worker(struct net_device* pnetdev)

+{

+    struct sched_param param = {.sched_priority = 40};

+

+	sema_init(&s_gmac_rx_sem, 0);

+

+	s_gmac_rx_worker = kthread_create(gmac_rx_worker, (void *)pnetdev, "gmac_rx_worker");

+

+	//sched_setscheduler(s_gmac_rx_worker, SCHED_RR, &param);

+    wake_up_process(s_gmac_rx_worker);

+

+	return 0;

+}

+

+#endif

 

 #ifndef GMAC_NO_INT

 static irqreturn_t zx29_gmac_interrupt(int irq, void *dev_id)

@@ -371,8 +425,11 @@
 	MAC(0x1014) = priv->int_event;

 

 	mac_int_disable();

+#ifndef GMAC_RX_WORKER_TH

 	tasklet_schedule(&priv->tasklet);

-

+#else

+	up(&s_gmac_rx_sem);

+#endif

 	return IRQ_HANDLED;

 }

 

@@ -424,7 +481,11 @@
 	ktime_t gmac_schdule_time = ktime_set(0, delay_in_us * 1000);

 	

 	hrtimer_forward_now(timer, gmac_schdule_time);

+#ifndef GMAC_RX_WORKER_TH

 	tasklet_schedule(g_gmac_tasklet);

+#else

+    up(&s_gmac_rx_sem);

+#endif

 	return HRTIMER_RESTART;

 }

 #endif

@@ -759,7 +820,7 @@
 		return ret;

 	}

 

-	netif_carrier_on(ndev);

+//	netif_carrier_on(ndev);

 	spin_unlock_irqrestore(&priv->lock, flags);

 	

 	phy_start(priv->phydev);

@@ -1725,12 +1786,46 @@
 

 /*zw.wang add for switching the primary/secondary mode of gmac on 20240118 end */

 

+/*zw.wang add a new interface to obtain the PHY link status on 20250226 begin*/

+ssize_t phy_pma_link_show(struct device *dev, struct device_attribute *attr,

+			  char *buf)

+{

+	int val = 0;

+	struct platform_device *pdev = to_platform_device(dev);

+	if (!pdev) {

+		printk(KERN_ERR "%s : %s pdev : %x \n", __func__, __LINE__,

+		       pdev);

+		return -1;

+	}

+	struct net_device *ndev = platform_get_drvdata(pdev);

+	if (!ndev) {

+		printk(KERN_ERR "%s : %s ndev : %x \n", __func__, __LINE__,

+		       ndev);

+		return -1;

+	}

+	struct zx29_gmac_dev *priv = (struct zx29_gmac_dev *)netdev_priv(ndev);

+	if (!priv) {

+		printk(KERN_ERR "%s : %s priv : %x \n", __func__, __LINE__,

+		       priv);

+		return -1;

+	}

+	mdiobus_write(priv->phydev->mdio.bus, priv->phydev->mdio.addr, 0x0d,0x1);

+	mdiobus_write(priv->phydev->mdio.bus, priv->phydev->mdio.addr, 0x0e,0x1);

+	mdiobus_write(priv->phydev->mdio.bus, priv->phydev->mdio.addr, 0x0d,0x4000 | 0x1);

+	val = mdiobus_read(priv->phydev->mdio.bus, priv->phydev->mdio.addr,0x0e);

+	sprintf(buf, "link : %s\n", (val & BIT(2)) ? "yes":"no");

+	return strlen(buf);

+}

+

+/*zw.wang add a new interface to obtain the PHY link status on 20250226 end*/

+

 static DEVICE_ATTR(gmac_test, 0664, show_fun, store_fun);

 static DEVICE_ATTR(mdio_test, 0664, mdio_show, mdio_store);

 static DEVICE_ATTR(free_mdio, 0664, free_mdio_show, free_mdio_store);

 static DEVICE_ATTR(debug_on, 0664, debug_on_show, debug_on_store);

 static DEVICE_ATTR(gmac_power, 0664, gmac_power_show, gmac_power_store);//jb.qi add for gamc power down on 20231116

 static DEVICE_ATTR(gmac_master_or_slave, 0664, gmac_master_or_slave_show, gmac_master_or_slave_store);//zw.wang add for switching the primary/secondary mode of gmac on 20240118

+static DEVICE_ATTR_RO(phy_pma_link); //zw.wang add a new interface to obtain the PHY link status on 20250226

 

 static int zx29_gmac_probe(struct platform_device *pdev)

 {

@@ -1759,6 +1854,7 @@
 	device_create_file(&pdev->dev, &dev_attr_debug_on);

     device_create_file(&pdev->dev, &dev_attr_gmac_power);//jb.qi add for gamc power down on 20231116

 	device_create_file(&pdev->dev, &dev_attr_gmac_master_or_slave);//zw.wang add for switching the primary/secondary mode of gmac on 20240118

+	device_create_file(&pdev->dev, &dev_attr_phy_pma_link); //zw.wang add a new interface to obtain the PHY link status on 20250226

 

 	prv = netdev_priv(ndev);

 	memset(prv, 0, sizeof(*prv));

@@ -1851,6 +1947,10 @@
 		goto errdev;

 	}

 

+#ifdef GMAC_RX_WORKER_TH

+	zx29_gmac_worker(ndev);//gmac_rx_worker

+#endif

+

 	of_property_read_u32(np, "port-nums", &prv->nports); 

 	of_property_read_u32(np, "rmii-ports", &prv->rmii_port);

 	prv->base_addr = ndev->base_addr;

@@ -1987,9 +2087,10 @@
 

 //	    gpio_direction_output(priv->gpio_power[0], 1);

 //	    msleep(500);

-		unregister_netdev(ndev);

+//		unregister_netdev(ndev);

 

 		phy_disconnect(priv->phydev);

+		unregister_netdev(ndev);

 			

 	    kobj_gmac_del(NULL);

 		

@@ -1998,11 +2099,17 @@
 #ifndef GMAC_NO_INT

 		free_irq(ndev->irq, ndev);

 #endif

+		

+#ifdef GMAC_RX_WORKER_TH

+	        ko_remove_flag = 1;

+                up(&s_gmac_rx_sem);	

+#endif 

+

 		tasklet_disable(&priv->tasklet);

 		tasklet_kill(&priv->tasklet);

 

-		if (priv->dma_rx_vir)

-			dma_free_coherent(ndev->dev.parent, GMAC_BUF_LEN, priv->dma_rx_vir, priv->dma_rx_phy);

+		if (priv->dma_rx_vir_init)

+			dma_free_coherent(ndev->dev.parent, GMAC_BUF_LEN, priv->dma_rx_vir_init, priv->dma_rx_phy_init);

 

 		pm_relax(&pdev->dev);

 		free_netdev(ndev);

@@ -2020,6 +2127,7 @@
 	    device_remove_file(&pdev->dev, &dev_attr_debug_on);

         device_remove_file(&pdev->dev, &dev_attr_gmac_power);//jb.qi add for gamc power down on 20231116

 		device_remove_file(&pdev->dev, &dev_attr_gmac_master_or_slave);//zw.wang add for switching the primary/secondary mode of gmac on 20240118

+		device_remove_file(&pdev->dev, &dev_attr_phy_pma_link); //zw.wang add a new interface to obtain the PHY link status on 20250226

 	}

 	return 0;

 }

diff --git a/upstream/linux-5.10/drivers/net/ethernet/zte/zx29_gmac_event.c b/upstream/linux-5.10/drivers/net/ethernet/zte/zx29_gmac_event.c
index 750580b..6df9cfd 100755
--- a/upstream/linux-5.10/drivers/net/ethernet/zte/zx29_gmac_event.c
+++ b/upstream/linux-5.10/drivers/net/ethernet/zte/zx29_gmac_event.c
@@ -137,7 +137,7 @@
 

 void kobj_gmac_del(struct kobject *kobject)

 {

-	kset_unregister(kset_gmac);

+//	kset_unregister(kset_gmac);

 	

     kobject_uevent(typekobj, KOBJ_REMOVE);

 	kobject_del(typekobj);

@@ -150,6 +150,7 @@
 

 	kfree(gmackobj);

 	

+	kset_unregister(kset_gmac);

 	printk("[gmac kobj_test: delete!]\n");

 }

 EXPORT_SYMBOL(kobj_gmac_del);

@@ -278,8 +279,8 @@
 	}

 	kset_gmac = kset_create_and_add("gmac", &gmac_uevent_ops, NULL); 

 	kobject_init(gmackobj, &gmacktype);

-	kobject_add(gmackobj,&kset_gmac->kobj,"%s","gmacconfig");  

 	gmackobj->kset = kset_gmac;

+	kobject_add(gmackobj,&kset_gmac->kobj,"%s","gmacconfig");  

 

 	typekobj = kzalloc(sizeof(*typekobj),GFP_KERNEL);

 	if(!typekobj){

@@ -288,8 +289,8 @@
 	}

 //	kset_gmac = kset_create_and_add("gmac", &gmac_uevent_ops, NULL); 

 	kobject_init(typekobj, &typektype);

-	kobject_add(typekobj,&kset_gmac->kobj,"%s",name);  

 	typekobj->kset = kset_gmac;

+	kobject_add(typekobj,&kset_gmac->kobj,"%s",name);  

 

 	strcpy(type, name);

 	

diff --git a/upstream/linux-5.10/drivers/net/phy/phy_device.c b/upstream/linux-5.10/drivers/net/phy/phy_device.c
index d9b53ba..f6a5a56 100755
--- a/upstream/linux-5.10/drivers/net/phy/phy_device.c
+++ b/upstream/linux-5.10/drivers/net/phy/phy_device.c
@@ -1316,6 +1316,10 @@
 }
 EXPORT_SYMBOL(phy_sfp_probe);
 
+static bool phy_drv_supports_irq(struct phy_driver *phydrv)
+{
+	return phydrv->config_intr && phydrv->ack_interrupt;
+}
 /**
  * phy_attach_direct - attach a network device to a given PHY device pointer
  * @dev: network device to attach
@@ -1421,6 +1425,8 @@
 
 	phydev->state = PHY_READY;
 
+	if (!phy_drv_supports_irq(phydev->drv) && phy_interrupt_is_valid(phydev))
+		phydev->irq = PHY_POLL;
 	/* Port is set to PORT_TP by default and the actual PHY driver will set
 	 * it to different value depending on the PHY configuration. If we have
 	 * the generic PHY driver we can't figure it out, thus set the old
@@ -2819,7 +2825,7 @@
 	if (delay < 0)
 		return delay;
 
-	if (delay && size == 0)
+	if (size == 0)
 		return delay;
 
 	if (delay < delay_values[0] || delay > delay_values[size - 1]) {
@@ -2852,10 +2858,6 @@
 }
 EXPORT_SYMBOL(phy_get_internal_delay);
 
-static bool phy_drv_supports_irq(struct phy_driver *phydrv)
-{
-	return phydrv->config_intr && phydrv->ack_interrupt;
-}
 
 /**
  * phy_probe - probe and init a PHY device
diff --git a/upstream/linux-5.10/drivers/net/zvnet/zvnet_dev.c b/upstream/linux-5.10/drivers/net/zvnet/zvnet_dev.c
index c7da7a4..ffade7e 100755
--- a/upstream/linux-5.10/drivers/net/zvnet/zvnet_dev.c
+++ b/upstream/linux-5.10/drivers/net/zvnet/zvnet_dev.c
@@ -9,6 +9,8 @@
 #include "ram_config.h"

 #include <net/netfilter/nf_conntrack.h>

 #include <net/SI/fast_common.h>

+#include <pub_debug_info.h>

+

 /*******************************************************************************

  *                             Macro definitions                               *

  ******************************************************************************/

@@ -50,6 +52,18 @@
 	unsigned short flag;

 	struct	T_zvnet_pkt_stats pkt[2];

 };

+struct zvnet_arphdr {

+	unsigned short		ar_hrd;		/* format of hardware address	*/

+	unsigned short		ar_pro;		/* format of protocol address	*/

+	unsigned char		ar_hln;		/* length of hardware address	*/

+	unsigned char		ar_pln;		/* length of protocol address	*/

+	unsigned short		ar_op;		/* ARP opcode (command)		*/

+	unsigned char		ar_sha[ETH_ALEN];	/* sender hardware address	*/

+	unsigned char		ar_sip[4];		/* sender IP address		*/

+	unsigned char		ar_tha[ETH_ALEN];	/* target hardware address	*/

+	unsigned char		ar_tip[4];		/* target IP address		*/

+};

+

 /*******************************************************************************

  *						   Local variable definitions					*

  ******************************************************************************/

@@ -65,6 +79,7 @@
 struct semaphore g_zvnet_free_sem;

 struct semaphore g_zvnet_xmit_sem;

 struct sk_buff_head g_zvnet_skb_xmit_queue;

+atomic_t g_zvnet_pm_flag;

 

 unsigned int g_wrap_packet_size = 1000;

 module_param(g_wrap_packet_size, int, 0644);

@@ -152,7 +167,7 @@
     unsigned char *p = data;

     for(i = 0; i < len && i < limit_len; i+=16)

     {

-        printk("0x%04x: %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x\n",i,

+        printk("0x%04x: %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x\n",i,

             p[0],p[1],p[2],p[3],p[4],p[5],p[6],p[7],

             p[8],p[9],p[10],p[11],p[12],p[13],p[14],p[15]);

         p += 16;

@@ -160,6 +175,11 @@
 }

 /* Ended by AICoder, pid:z5702yf8bad07ad1448a083e806dc31250b2418f */

 

+void zvnet_set_pm_flag(unsigned int flag){

+	if(flag & 0x100000)

+		atomic_set(&g_zvnet_pm_flag, 1);

+}

+

 int zvnet_get_index_by_netdev(struct net_device *net)

 {

     int i;

@@ -304,11 +324,127 @@
 	/* make sure we initialize shinfo sequentially */

 	skb_reset_network_header(skb);

 	skb_set_kcov_handle(skb, kcov_common_handle());

-	if(unlikely(g_trace_limit > 0)){

-		printk("-%s-dump_packet-start-%d\n", skb->dev->name, skb->len);

+	if(unlikely(g_trace_limit & 1)){

+		printk("-%s-dump_fromap-start-%d\n", skb->dev->name, skb->len);

 		zvnet_dump_packet(skb->data, skb->len, g_trace_limit);

-		printk("-%s-dump_packet-end-\n", skb->dev->name);

+		printk("-%s-dump_fromap-end-\n", skb->dev->name);

 	}

+/* Started by AICoder, pid:j2d34uccf7y1f37146a108290182771184940711 */

+	if (atomic_read(&g_zvnet_pm_flag)) {

+		unsigned short l2_hdr_len = 0;

+		unsigned short h_proto = htons(*(unsigned short *)(skb->data + ETH_ALEN + ETH_ALEN));

+		again:

+		if (l2_hdr_len + ETH_HLEN < skb->len) {

+			switch (h_proto) {

+				case ETH_P_IP: {

+					struct iphdr *iph = (struct iphdr *)(skb->data + ETH_HLEN + l2_hdr_len);

+					if (iph->protocol == IPPROTO_TCP) {

+						struct tcphdr *tcph = (struct tcphdr *)(((unsigned char *)iph) + iph->ihl * 4);

+						char *flag;

+						if (tcph->ack) {

+							if (tcph->fin)

+								flag = "FA";

+							else if (tcph->syn)

+								flag = "SA";

+							else if (tcph->psh)

+								flag = "PA";

+							else

+								flag = "A";

+						} else {

+							if (tcph->fin)

+								flag = "F";

+							else if (tcph->syn)

+								flag = "S";

+							else if (tcph->rst)

+								flag = "R";

+							else

+								flag = "";

+						}

+						sc_debug_info_record("cap_net", "%u-%pI4-%pI4-%u%s %u:%u/%u\n",

+											pbuf_temp->dev, &iph->saddr, &iph->daddr,

+											iph->protocol, flag, ntohs(tcph->source), ntohs(tcph->dest), skb->len);

+					} else if (iph->protocol == IPPROTO_UDP) {

+						struct udphdr *udph = (struct udphdr *)(((unsigned char *)iph) + iph->ihl * 4);

+						sc_debug_info_record("cap_net", "%u-%pI4-%pI4-%u %u:%u/%u\n",

+											pbuf_temp->dev, &iph->saddr, &iph->daddr,

+											iph->protocol, ntohs(udph->source), ntohs(udph->dest), skb->len);

+					} else if (iph->protocol == IPPROTO_ICMP) {

+						struct icmphdr *icmph = (struct icmphdr *)(((unsigned char *)iph) + iph->ihl * 4);

+						sc_debug_info_record("cap_net", "%u-%pI4-%pI4-%u %u:%u/%u\n",

+											pbuf_temp->dev, &iph->saddr, &iph->daddr,

+											iph->protocol, icmph->type, icmph->code, skb->len);

+					} else {

+						sc_debug_info_record("cap_net", "%u-%pI4-%pI4-%u/%u\n",

+											pbuf_temp->dev, &iph->saddr, &iph->daddr,

+											iph->protocol, skb->len);

+					}

+					break;

+				}

+				case ETH_P_IPV6: {

+					struct ipv6hdr *iph = (struct ipv6hdr *)(skb->data + ETH_HLEN + l2_hdr_len);

+					if (iph->nexthdr == NEXTHDR_TCP) {

+						struct tcphdr *tcph = (struct tcphdr *)(((unsigned char *)iph) + sizeof(struct ipv6hdr));

+						char *flag;

+						if (tcph->ack) {

+							if (tcph->fin)

+								flag = "FA";

+							else if (tcph->syn)

+								flag = "SA";

+							else if (tcph->psh)

+								flag = "PA";

+							else

+								flag = "A";

+						} else {

+							if (tcph->fin)

+								flag = "F";

+							else if (tcph->syn)

+								flag = "S";

+							else if (tcph->rst)

+								flag = "R";

+							else

+								flag = "";

+						}

+						sc_debug_info_record("cap_net", "%u-%pI6-%pI6-%u%s %u:%u/%u\n",

+											pbuf_temp->dev, iph->saddr.s6_addr32, iph->daddr.s6_addr32,

+											iph->nexthdr, flag, ntohs(tcph->source), ntohs(tcph->dest), skb->len);

+					} else if (iph->nexthdr == NEXTHDR_UDP) {

+						struct udphdr *udph = (struct udphdr *)(((unsigned char *)iph) + sizeof(struct ipv6hdr));

+						sc_debug_info_record("cap_net", "%u-%pI6-%pI6-%u %u:%u/%u\n",

+											pbuf_temp->dev, iph->saddr.s6_addr32, iph->daddr.s6_addr32,

+											iph->nexthdr, ntohs(udph->source), ntohs(udph->dest), skb->len);

+					} else if (iph->nexthdr == NEXTHDR_ICMP) {

+						struct icmp6hdr *icmph = (struct icmp6hdr *)(((unsigned char *)iph) + sizeof(struct ipv6hdr));

+						sc_debug_info_record("cap_net", "%u-%pI6-%pI6-%u %u:%u/%u\n",

+											pbuf_temp->dev, iph->saddr.s6_addr32, iph->daddr.s6_addr32,

+											iph->nexthdr, icmph->icmp6_type, icmph->icmp6_code,skb->len);

+					} else {

+						sc_debug_info_record("cap_net", "%u-%pI6-%pI6-%u/%u\n",

+											pbuf_temp->dev, iph->saddr.s6_addr32, iph->daddr.s6_addr32,

+											iph->nexthdr, skb->len);

+					}

+					break;

+				}

+				case ETH_P_ARP: {

+					struct zvnet_arphdr *arph = (struct zvnet_arphdr *)(skb->data + ETH_HLEN + l2_hdr_len);

+					sc_debug_info_record("cap_net", "%u:%04x-%pI4-%pI4-%u/%u\n",

+										pbuf_temp->dev, h_proto, arph->ar_sip, arph->ar_tip, htons(arph->ar_op), skb->len);

+					break;

+				}

+				case ETH_P_8021Q: {

+					struct vlan_hdr *vlanh = (struct vlan_hdr *)(skb->data + ETH_HLEN + l2_hdr_len);

+					sc_debug_info_record("cap_net", "%u:%04x-%u\n",

+										pbuf_temp->dev, h_proto, htons(vlanh->h_vlan_TCI) & VLAN_VID_MASK);

+					l2_hdr_len += VLAN_HLEN;

+					h_proto = htons(vlanh->h_vlan_encapsulated_proto);

+					goto again;

+				}

+				default:

+					sc_debug_info_record("cap_net", "%u:%04x/%u\n", pbuf_temp->dev, h_proto, skb->len);

+			}

+		}

+		atomic_set(&g_zvnet_pm_flag, 0);

+	}

+/* Ended by AICoder, pid:j2d34uccf7y1f37146a108290182771184940711 */

 	return skb;

 }

 

@@ -400,6 +536,11 @@
 		buff[i].len = skb->len;

 		buff[i].end_off = skb->end - skb->head;

 		buff[i].dev = zvnet_get_index_by_netdev(skb->dev);

+		if(unlikely(g_trace_limit & 2)){

+			printk("-%s-dump_toap-start-%d\n", skb->dev->name, skb->len);

+			zvnet_dump_packet(skb->data, skb->len, g_trace_limit);

+			printk("-%s-dump_toap-end-\n", skb->dev->name);

+		}

 		if(skb->capHead){

 			buff[i].buff = skb->capHead;

 #ifdef CONFIG_FASTNAT_MODULE

@@ -500,11 +641,11 @@
 	data->dev = net;

 	data->isToap = 1;

 	v7_dma_map_area(data->head, data->end - data->head + sizeof(struct skb_shared_info), DMA_TO_DEVICE);

+	net->stats.tx_packets++;

+	net->stats.tx_bytes += data->len;

 	skb_queue_tail(&g_zvnet_skb_xmit_queue, data);

 	if(data->len < g_wrap_packet_size || g_zvnet_skb_xmit_queue.qlen > g_wrap_num)

 		up(&g_zvnet_xmit_sem);

-	net->stats.tx_packets++;

-	net->stats.tx_bytes += skb->len;

 #else

     struct zvnet *dev = netdev_priv(net);

     struct zvnet_device *zvnetdev = (struct zvnet_device *)dev->dev_priv;

@@ -1240,6 +1381,7 @@
     struct net_device *net = NULL;

     struct zvnet_device *zvnetdev = NULL;

 

+	atomic_set(&g_zvnet_pm_flag, 0);

 #ifdef USE_ZVNET_PACKET

 			skb_queue_head_init(&g_zvnet_skb_xmit_queue);

 			spin_lock_init(&g_zvnet_free_lock);

diff --git a/upstream/linux-5.10/drivers/soc/sc/rpmsg/zx29_icp.c b/upstream/linux-5.10/drivers/soc/sc/rpmsg/zx29_icp.c
index 3c5ba58..0e1ca16 100755
--- a/upstream/linux-5.10/drivers/soc/sc/rpmsg/zx29_icp.c
+++ b/upstream/linux-5.10/drivers/soc/sc/rpmsg/zx29_icp.c
@@ -324,7 +324,7 @@
 	[40] = "at channel 40",
 	[41] = "voice buffer",
 };
-
+extern void zvnet_set_pm_flag(unsigned int flag);
 void show_icp_state(T_ZDrvRpMsg_ActorID actorID)
 {
 	unsigned int	hw, lw;
@@ -334,6 +334,7 @@
 		return;
 
 	icp_get_int_info(actorID, &hw, &lw);
+	zvnet_set_pm_flag(lw);
 	pr_info("[SLP] icpwake: 0x%x 0x%x\n", hw, lw);
 	sc_debug_info_record(MODULE_ID_CAP_PM, " icpwake: 0x%x 0x%x\n", hw, lw);
 
diff --git a/upstream/linux-5.10/drivers/tty/serial/zx29_uart.c b/upstream/linux-5.10/drivers/tty/serial/zx29_uart.c
index b29437a..7029976 100755
--- a/upstream/linux-5.10/drivers/tty/serial/zx29_uart.c
+++ b/upstream/linux-5.10/drivers/tty/serial/zx29_uart.c
@@ -591,6 +591,48 @@
 		);
 }
 DEVICE_ATTR(statics, S_IRUGO, statics_show, NULL);
+
+static unsigned int uart_io_seletc = 0;
+ 
+ 
+static ssize_t uart_io_select_show(struct device *_dev,
+struct device_attribute *attr, char *buf)
+{
+struct platform_device *pdev = container_of(_dev, struct platform_device, dev);
+//struct zx29_uart_platdata *pdata = pdev->dev.platform_data;
+ 
+return sprintf(buf, "%d\n",uart_io_seletc );
+ 
+}
+ 
+static ssize_t uart_io_select_store(struct device *_dev,
+struct device_attribute *attr,
+const char *buf, size_t count)
+{
+    uint32_t  flag = 0;
+struct platform_device *pdev = container_of(_dev, struct platform_device, dev);
+flag = simple_strtoul(buf, NULL, 16);
+ 
+if(flag == 1){
+	printk("uart io is 1\n");
+pinctrl_pm_select_default_state(_dev);
+}else if(flag == 0){
+pinctrl_pm_select_sleep_state(_dev);
+}
+else{
+printk("uart io select flag invaild\n");
+}
+ 
+uart_io_seletc = flag;
+ 
+ 
+   
+return count;
+}
+ 
+DEVICE_ATTR(uart_io_select, S_IRUGO | S_IWUSR, uart_io_select_show,
+    uart_io_select_store);
+
 #define VEHICLE_USE_ONE_UART_LOG 1
 #if VEHICLE_USE_ONE_UART_LOG
 #define ICP_CORE_ID_PS CORE_PS0
@@ -4412,6 +4454,9 @@
 		error = device_create_file(&pdev->dev, &dev_attr_app_ctrl);
 		
 	}
+	if(pdev->id == 2){
+		error = device_create_file(&pdev->dev, &dev_attr_uart_io_select); 
+		}
 		error = device_create_file(&pdev->dev, &dev_attr_statics);
 	device_init_wakeup(&pdev->dev, true);
 /*	
diff --git a/upstream/linux-5.10/include/linux/mfd/zx234290.h b/upstream/linux-5.10/include/linux/mfd/zx234290.h
index ea89815..40e71bf 100755
--- a/upstream/linux-5.10/include/linux/mfd/zx234290.h
+++ b/upstream/linux-5.10/include/linux/mfd/zx234290.h
@@ -1009,24 +1009,6 @@
     SINK_CURRENT_MAX
 }T_ZDrvZx234297_SINK_CURRENT;
 
-typedef enum _T_ZDrvZx234290_ResetType
-{
-#if 0
-	ZX234290_USER_RST_UNDEFINE	= 0,
-	ZX234290_USER_RST_TO_NORMAL = 1,
-	ZX234290_USER_RST_TO_CHARGER = 2,
-	ZX234290_USER_RST_TO_ALARM = 3,
-#else
-	ZX234290_USER_RST_UNDEFINE	= 3,
-	ZX234290_USER_RST_TO_NORMAL = 0,
-	ZX234290_USER_RST_TO_CHARGER = 1,
-	ZX234290_USER_RST_TO_ALARM = 2,
-#endif
-	ZX234290_USER_RST_TO_EXCEPT = 4,
-
-	ZX234290_USER_RST_MAX
-}T_ZDrvZx234290_ResetType;
-
 
 int zx234290_get_chip_version(void);
 int zx234290_irq_init(struct zx234290 *zx234290);
diff --git a/upstream/linux-5.10/include/linux/mmc/mmc_func.h b/upstream/linux-5.10/include/linux/mmc/mmc_func.h
index b2636ab..911c010 100755
--- a/upstream/linux-5.10/include/linux/mmc/mmc_func.h
+++ b/upstream/linux-5.10/include/linux/mmc/mmc_func.h
@@ -23,7 +23,7 @@
 *  data_size: the size of data you want to write .defined by byte
 *  src_buf: data buffer where log or file stored; 
 */
-int mmc_bwrite(u32 start_addr, u32 data_size, void *src_buf);
+int mmc_bwrite(u64 start_addr, u32 data_size, void *src_buf);
 
 /*
 *  start_addr: the address is the emmc address you want to write,and it size is 
@@ -32,6 +32,6 @@
 *  src_buf: data buffer where log or file will store; 
 */
 
-int mmc_bread(u32 start_addr, u32 data_size, void *dst);
+int mmc_bread(u64 start_addr, u32 data_size, void *dst);
 
 #endif /* LINUX_MMC_MMC_FUNC_H */
diff --git a/upstream/linux-5.10/kernel/ramdump/ramdump_client_cap.c b/upstream/linux-5.10/kernel/ramdump/ramdump_client_cap.c
index bcb6a53..1492b49 100755
--- a/upstream/linux-5.10/kernel/ramdump/ramdump_client_cap.c
+++ b/upstream/linux-5.10/kernel/ramdump/ramdump_client_cap.c
@@ -45,6 +45,7 @@
 extern void ramdump_data_transfer_to_device(void);
 extern void ramdump_oss_data_trans_init(void);
 extern unsigned char *ramdump_export_flag_base;
+extern void zxic_reset_reason(int reason, const char *cpu, const char *app);
 
 /*******************************************************************************
 *                              ¾Ö²¿¾²Ì¬±äÁ¿¶¨Òå                                *
@@ -71,7 +72,7 @@
 unsigned char *ramdump_cap_error_log  = NULL;
 unsigned int *cap_ddr_len_base        = NULL;
 unsigned int   sysctl_ramdump_emmc_size = 0x0;
-unsigned int   sysctl_ramdump_emmc_start_addr = 0xFFFF;
+u64 sysctl_ramdump_emmc_start_addr = 0xFFFF;
 
 static struct ctl_table cfg_ramdump_array[] = {
 #ifdef CONFIG_RAMDUMP_USER
@@ -128,7 +129,7 @@
 {
 	ramdump_msg_t *icp_msg = (ramdump_msg_t *)buf;
 
-	ramdump_server_exp_core = RAMDUMP_SUCCESS;
+	ramdump_server_exp_core = RAMDUMP_TRUE;
 
 	switch(icp_msg->msg_id)
 	{
@@ -413,6 +414,9 @@
 void ramdump_entry (void)
 {
 	unsigned long flags;
+
+	if (ramdump_server_exp_core == RAMDUMP_FALSE)
+		zxic_reset_reason(1, "cap", current->comm); /* not ap ramdump and cap ramdump */
 	if (sysctl_ramdump_on_panic == false)
 		return;
 
diff --git a/upstream/linux-5.10/kernel/ramdump/ramdump_device_trans.c b/upstream/linux-5.10/kernel/ramdump/ramdump_device_trans.c
index f3e91e9..0b0f0dc 100755
--- a/upstream/linux-5.10/kernel/ramdump/ramdump_device_trans.c
+++ b/upstream/linux-5.10/kernel/ramdump/ramdump_device_trans.c
@@ -51,6 +51,8 @@
 extern unsigned int ramdump_compress_flag;
 extern unsigned char *ramdump_log_buf;
 extern unsigned int ramdump_export_mode;
+extern unsigned int ramdump_emmc_size;
+extern unsigned int ramdump_spinand_size;
 
 /*******************************************************************************
  *                             Macro definitions                               *
@@ -288,6 +290,8 @@
 *******************************************************************************/
 void ramdump_device_close(void)
 {
+	g_ramdump_dev_fp->file_num = ramdump_device_file_cnt;
+	
 	if(ramdump_export_mode == RAMDUMP_MODE_EMMC)
 	{
 #ifdef CONFIG_RAMDUMP_EMMC
@@ -333,11 +337,16 @@
 int ramdump_device_write_file(ramdump_trans_server_file_info_req *server_to_cap)
 {
 	int ret = -1;
+	unsigned int file_size = 0;
+
+	/* Started by AICoder, pid:wcfb91c2aa35add146d90b5530cd112845133621 */
+	file_size = server_to_cap->file_size;
 	
 	if(ramdump_export_mode == RAMDUMP_MODE_EMMC)
 	{
 #ifdef CONFIG_RAMDUMP_EMMC
-		if (ramdump_emmc_offset >= RAMDUMP_TRANS_EMMC_LEN)
+		if ((ramdump_emmc_offset >= RAMDUMP_TRANS_EMMC_LEN)
+			|| ((ramdump_emmc_offset + file_size) > ramdump_emmc_size))
 			return -1;
 
 		ret = ramdump_fill_header(server_to_cap->file_name, 
@@ -349,9 +358,11 @@
 	else if(ramdump_export_mode == RAMDUMP_MODE_SPINAND)
 	{
 #ifdef CONFIG_MTD_SPI_NAND
-		if (ramdump_spinand_offset >= RAMDUMP_SPINAND_LEN)
+		if ((ramdump_spinand_offset >= RAMDUMP_SPINAND_LEN)
+			|| ((ramdump_spinand_offset + file_size) > ramdump_spinand_size))
 			return -1;
-
+		/* Ended by AICoder, pid:wcfb91c2aa35add146d90b5530cd112845133621 */
+		
 		ret = ramdump_fill_header(server_to_cap->file_name, 
 								  server_to_cap->file_size,
 								  &ramdump_spinand_fp, 
@@ -557,9 +568,9 @@
 int ramdump_device_write_data(ramdump_shmem_t *msg, unsigned int size, ssize_t *dstlen)
 {
 	int ret = 0;
-		
+
 	if(ramdump_export_mode == RAMDUMP_MODE_EMMC)
-	{		
+	{
 #ifdef CONFIG_RAMDUMP_EMMC
 		ret = ramdump_emmc_write_data(msg, &ramdump_device_fp, size);
 		if(ret < 0)
@@ -637,8 +648,6 @@
 				ramdump_trans_server_interactive_req *server_to_cap_msg = (ramdump_trans_server_interactive_req *)req_buf;
 				/* data from server to cap */
 				ramdump_file_num = server_to_cap_msg->file_num;
-				ramdump_device_fp.file_num  += ramdump_file_num;
-				ramdump_spinand_fp.file_num += ramdump_file_num;
 
 				/* data from cap to server */
 				cap_to_server_msg.cmd = RAMDUMP_PC_FILE_INFO_READ_REQ;
@@ -658,8 +667,12 @@
 				/*device memory file create*/
 				if(ramdump_device_write_file(server_to_cap_msg) == -1){
 					cap_to_server_msg.cmd = RAMDUMP_PC_FILE_TRANS_DONE_REQ;
-					ramdump_device_write_file_head();//±£Ö¤³ö´íǰ¼¸¸öÎļþ¾ùд¶Ô¡£
-					ramdump_printf("ramdump write emmc file error!\n");
+					/* Started by AICoder, pid:ddd3ag3c37x6798145ec08ac1067150b58735197 */
+					ramdump_oss_data_trans_write(
+					(unsigned char*)(&cap_to_server_msg), 
+					sizeof(cap_to_server_msg));	
+					break; 
+					/* Ended by AICoder, pid:ddd3ag3c37x6798145ec08ac1067150b58735197 */
 				}
 				file_size = server_to_cap_msg->file_size;
 				file_offset = 0;
@@ -675,7 +688,8 @@
 				file_trans_size = cap_to_server_msg.length;
 				file_left_size = file_left_size - cap_to_server_msg.length;
 				file_offset = file_offset + cap_to_server_msg.length;
-				printk("device memory trans file:%s !!!\n", server_to_cap_msg->file_name);
+				
+				printk("device memory trans file:%-30s size %9d, offset %9d!!!\n", server_to_cap_msg->file_name, file_size, ramdump_emmc_offset);
 				/* interactive data trans */
 				ramdump_oss_data_trans_write(
 					(unsigned char*)(&cap_to_server_msg), 
@@ -690,14 +704,24 @@
 				/* data from server to cap */
 				ramdump_shmem_t *server_to_cap_msg = (ramdump_shmem_t *)ramdump_shared_mem_base;
 				server_to_cap_msg->core_flag = 0;
+
 				/*data from cap to emmc*/
-				
 				write_len = ramdump_device_write_data(server_to_cap_msg, file_left_size, &file_dstlen);
-				if(write_len < 0)
+				if(write_len < 0 )
 				{
-					ramdump_printf("ramdump write emmc data error!\n");
+					/* Started by AICoder, pid:u5befs8483y615f142ce0bda306d660bed685275 */		
+					if(write_len == -RAMDUMP_NO_FREE_SPACE)
+					{
+						cap_to_server_msg.cmd = RAMDUMP_PC_FILE_TRANS_DONE_REQ;
+						ramdump_oss_data_trans_write(
+						(unsigned char*)(&cap_to_server_msg), 
+						sizeof(cap_to_server_msg));	
+						break;
+					}
+					else
+						ramdump_printf("ramdump write emmc data error!\n");
+					/* Ended by AICoder, pid:u5befs8483y615f142ce0bda306d660bed685275 */	
 				}
-				
 				/*ÅжÏÊ£Óà´óС*/
 				if (file_left_size == 0)
 				{
diff --git a/upstream/linux-5.10/kernel/ramdump/ramdump_emmc.c b/upstream/linux-5.10/kernel/ramdump/ramdump_emmc.c
index 0c28f27..5054440 100755
--- a/upstream/linux-5.10/kernel/ramdump/ramdump_emmc.c
+++ b/upstream/linux-5.10/kernel/ramdump/ramdump_emmc.c
@@ -128,16 +128,28 @@
 int ramdump_emmc_write_data(ramdump_shmem_t *msg, ramdump_file_t *fp, unsigned int size)
 {
 	int ret = 0;
-	unsigned int buffer = RAMDUMP_EMMC_ADDR + ramdump_emmc_offset;
+	u64 buffer = RAMDUMP_EMMC_ADDR + ramdump_emmc_offset;
 
 	if (ramdump_device_file_cnt >= RAMDUMP_FILE_NUM_MAX)
 		return -1;
 
 	while(1){
 		if ((msg->core_flag == 1) && (msg->rw_flag == 2)){
-			if(msg->size >= (ramdump_emmc_size - fp->file_fp[ramdump_device_file_cnt].offset))
-				return -1;
+			/* Started by AICoder, pid:fe298k6b27edc1c14f9e0be2e0451e1abfc5830e */
+			if((ramdump_emmc_size < ramdump_emmc_offset)
+				|| (msg->size >= (ramdump_emmc_size - fp->file_fp[ramdump_device_file_cnt].offset)))
+			{
+				printk("[ramdump] No space left in emmc, Emmc_size is %ld,ramdump_emmc_offset is %d!\n", ramdump_emmc_size, ramdump_emmc_offset);
+				return -RAMDUMP_NO_FREE_SPACE;
+			}
 			ret = mmc_bwrite(buffer, msg->size, msg->buf);
+			if(ret < 0)
+			{
+				printk("[ramdump] ramdump_emmc_write_data Error.\n");
+				ramdump_wait_delay(0);
+				continue;
+			}
+			/* Ended by AICoder, pid:fe298k6b27edc1c14f9e0be2e0451e1abfc5830e */
 			ramdump_emmc_offset = ramdump_emmc_offset + roundup(msg->size, RAMDUMP_EMMC_ALIGN_SIZE);
 			msg->core_flag = 1;
 			msg->rw_flag = 1;
diff --git a/upstream/linux-5.10/kernel/ramdump/ramdump_emmc.h b/upstream/linux-5.10/kernel/ramdump/ramdump_emmc.h
index 1028ab2..6c9817e 100755
--- a/upstream/linux-5.10/kernel/ramdump/ramdump_emmc.h
+++ b/upstream/linux-5.10/kernel/ramdump/ramdump_emmc.h
@@ -24,13 +24,14 @@
 /*******************************************************************************
 *                                Íⲿ±äÁ¿ÉùÃ÷                                  *
 *******************************************************************************/
-extern unsigned int sysctl_ramdump_emmc_start_addr;
+extern u64 sysctl_ramdump_emmc_start_addr;
 extern unsigned int sysctl_ramdump_emmc_size;
 extern volatile unsigned int ramdump_emmc_offset;
 
 /*******************************************************************************
 *                                   ºê¶¨Òå                                     *
 *******************************************************************************/
+#define RAMDUMP_NO_FREE_SPACE     (2)
 #define RAMDUMP_EMMC_ADDR         (sysctl_ramdump_emmc_start_addr * 512) 
 #define RAMDUMP_TRANS_EMMC_LEN    (sysctl_ramdump_emmc_size * 512)
 
diff --git a/upstream/linux-5.10/kernel/tracker.c b/upstream/linux-5.10/kernel/tracker.c
index 6f7e1ab..792818b 100755
--- a/upstream/linux-5.10/kernel/tracker.c
+++ b/upstream/linux-5.10/kernel/tracker.c
@@ -63,6 +63,7 @@
 #define OS_IRAM_SOFTIRQ_END        (OS_IRAM_SOFTIRQ_START + sizeof(t_os_iram_statistic))
 #define OS_IRAM_TIMER_START        (OS_IRAM_SOFTIRQ_END + sizeof(t_os_iram_statistic))
 #define OS_IRAM_TIMER_END          (OS_IRAM_TIMER_START + sizeof(t_os_iram_statistic))
+#define OS_IRAM_RESET_REASON_START (OS_STATISTIC_IRAM_BASE + 0x800 - sizeof(T_Reset_Reason))
 #endif
 
 #define os_statistic_check()       *((volatile unsigned long *)OS_STATISTIC_IRAM_BASE)
@@ -98,6 +99,12 @@
     } statistics[OS_DDR_STATISTIC_CNT];
 }t_os_ddr_statistic;
 
+typedef struct    
+{
+    char   ramdump_reason[32];      //±ÈÈ磺ramdump_ap_appname
+    char   kernel_reboot[32];       //±ÈÈ磺reboot_ap_appname
+} T_Reset_Reason;
+
 /*******************************************************************************
 *                                   È«¾Ö±äÁ¿                                   *
 *******************************************************************************/
@@ -134,6 +141,7 @@
 volatile  static t_os_ddr_statistic *g_os_ddr_softirq_end_statistic;
 volatile  static t_os_ddr_statistic *g_os_ddr_timer_start_statistic;
 volatile  static t_os_ddr_statistic *g_os_ddr_timer_end_statistic;
+volatile T_Reset_Reason *g_os_reset_reason;
 #endif
 
 /*******************************************************************************
@@ -418,7 +426,32 @@
     os_statistic_in_ddr(g_os_ddr_timer_end_statistic, func, time);
     os_statistic_info_update();
 }
+/*
+reason: 1 for ramdump, 2 for reboot
+cpu: ap/cap/rpm/phy
+app: current->comm
+*/
+/* Started by AICoder, pid:pf139dce4f7776c149ec081b508bae14e6084ede */
+void zxic_reset_reason(int reason, const char *cpu, const char *app)
+{
+	char buffer[32];
 
+	memset(buffer, 0, sizeof(buffer));
+	switch (reason)
+	{
+		case 1:
+			snprintf(buffer, 32, "reset_ramdump_%s_%s", cpu, app);
+			memcpy(g_os_reset_reason->ramdump_reason, buffer, sizeof(buffer));
+			break;
+		case 2:
+			snprintf(buffer, 32, "reset_kreboot_%s_%s", cpu, app);
+			memcpy(g_os_reset_reason->kernel_reboot, buffer, sizeof(buffer));
+			break;
+		default:
+			break;
+	}
+}
+/* Ended by AICoder, pid:pf139dce4f7776c149ec081b508bae14e6084ede */
 
 /*******************************************************************************
 * ¹¦ÄÜÃèÊö:     ¹ì¼£Í³¼Æµ½DDR
@@ -438,9 +471,10 @@
 #ifdef IRAM_BASE_ADDR_VA
     g_zxic_trace_apcpu_addr = IRAM_BASE_ADDR_OS_STATISTIC_PSCPU;
 #else
-    g_zxic_trace_apcpu_addr = ioremap(IRAM_BASE_ADDR_OS_STATISTIC_PSCPU, IRAM_BASE_LEN_OS_STATISTIC_PSCPU);
+    g_zxic_trace_apcpu_addr = ioremap(IRAM_BASE_ADDR_OS_STATISTIC_PSCPU, IRAM_BASE_LEN_OS_STATISTIC_PSCPU + IRAM_BASE_LEN_OS_STATISTIC_PHYCPU + IRAM_BASE_LEN_OS_STATISTIC_APCPU);
 #endif
 
+    g_os_reset_reason = (T_Reset_Reason *)OS_IRAM_RESET_REASON_START;
     /*
     init_timer(&timer);
     timer.expires = jiffies + 40*HZ;//msecs_to_jiffies(40*1000);//ÑÓ³Ù40Ãë
diff --git a/upstream/linux-5.10/sound/soc/sanechips/zx29_ak4940.c b/upstream/linux-5.10/sound/soc/sanechips/zx29_ak4940.c
index f730067..efdfe9e 100755
--- a/upstream/linux-5.10/sound/soc/sanechips/zx29_ak4940.c
+++ b/upstream/linux-5.10/sound/soc/sanechips/zx29_ak4940.c
@@ -37,6 +37,7 @@
 
 
 #include "i2s.h"
+#include "pub_debug_info.h"
 
 #define ZX29_I2S_TOP_LOOP_REG	0xac
 
@@ -362,48 +363,97 @@
  
 #endif
  
- static int zx29startup(struct snd_pcm_substream *substream)
- {
- //  int ret = 0;
-	 print_audio("Alsa	Entered func %s\n", __func__);
-	 //CPPS_FUNC(cpps_callbacks, zDrv_Audio_Printf)("Alsa: zx29_startup device=%d,stream=%d\n", substream->pcm->device, substream->stream);
+/* Started by AICoder, pid:r53959b7c94916e146e3093b301a356223b009fa */
+static int zx29startup(struct snd_pcm_substream *substream)
+{
+    //int ret = 0;
+    print_audio("Alsa	Entered func %s\n", __func__);
+    //CPPS_FUNC(cpps_callbacks, zDrv_Audio_Printf)("Alsa: zx29_startup device=%d,stream=%d\n", substream->pcm->device, substream->stream);
+
+    struct snd_pcm *pcmC0D0p = snd_lookup_minor_data(16, SNDRV_DEVICE_TYPE_PCM_PLAYBACK);
+    struct snd_pcm *pcmC0D1p = snd_lookup_minor_data(17, SNDRV_DEVICE_TYPE_PCM_PLAYBACK);
+    struct snd_pcm *pcmC0D2p = snd_lookup_minor_data(18, SNDRV_DEVICE_TYPE_PCM_PLAYBACK);	 
+    struct snd_pcm *pcmC0D3p = snd_lookup_minor_data(19, SNDRV_DEVICE_TYPE_PCM_PLAYBACK);
+    //struct snd_pcm *pcmC0D4p = snd_lookup_minor_data(20, SNDRV_DEVICE_TYPE_PCM_PLAYBACK);
  
-	 struct snd_pcm *pcmC0D0p = snd_lookup_minor_data(16, SNDRV_DEVICE_TYPE_PCM_PLAYBACK);
-	 struct snd_pcm *pcmC0D1p = snd_lookup_minor_data(17, SNDRV_DEVICE_TYPE_PCM_PLAYBACK);
-	 struct snd_pcm *pcmC0D2p = snd_lookup_minor_data(18, SNDRV_DEVICE_TYPE_PCM_PLAYBACK);	 
-	 struct snd_pcm *pcmC0D3p = snd_lookup_minor_data(19, SNDRV_DEVICE_TYPE_PCM_PLAYBACK);	
-	 if ((pcmC0D0p == NULL) || (pcmC0D1p == NULL) || (pcmC0D2p == NULL) || (pcmC0D3p == NULL))
-		 return  -EINVAL;	  
-	 if ((pcmC0D0p->streams[0].substream_opened && pcmC0D1p->streams[0].substream_opened) || 
-		 (pcmC0D0p->streams[0].substream_opened && pcmC0D2p->streams[0].substream_opened) || 
-		 (pcmC0D0p->streams[0].substream_opened && pcmC0D3p->streams[0].substream_opened) || 
-		 (pcmC0D1p->streams[0].substream_opened && pcmC0D2p->streams[0].substream_opened) ||
-		 (pcmC0D1p->streams[0].substream_opened && pcmC0D3p->streams[0].substream_opened) ||
-		 (pcmC0D2p->streams[0].substream_opened && pcmC0D3p->streams[0].substream_opened))
-		 BUG();
+    struct snd_pcm *pcmC0D0c = snd_lookup_minor_data(24, SNDRV_DEVICE_TYPE_PCM_CAPTURE);
+    struct snd_pcm *pcmC0D1c = snd_lookup_minor_data(25, SNDRV_DEVICE_TYPE_PCM_CAPTURE);
+    struct snd_pcm *pcmC0D2c = snd_lookup_minor_data(26, SNDRV_DEVICE_TYPE_PCM_CAPTURE);	 
+    struct snd_pcm *pcmC0D3c = snd_lookup_minor_data(27, SNDRV_DEVICE_TYPE_PCM_CAPTURE);	
+    //struct snd_pcm *pcmC0D4c = snd_lookup_minor_data(28, SNDRV_DEVICE_TYPE_PCM_CAPTURE);
+
+    if ((pcmC0D0p == NULL) || (pcmC0D1p == NULL) || (pcmC0D2p == NULL) || (pcmC0D3p == NULL))
+    {
+        print_audio("Alsa Entered func %s, pcmC0D0p=%p, pcmC0D1p=%p, pcmC0D2p=%p, pcmC0D3p=%p\n", __func__, 
+            pcmC0D0p, pcmC0D1p, pcmC0D2p, pcmC0D3p);
+        return  -EINVAL;	  
+    }
+    if ((pcmC0D0p->streams[0].substream_opened && pcmC0D1p->streams[0].substream_opened) || 
+	    (pcmC0D0p->streams[0].substream_opened && pcmC0D2p->streams[0].substream_opened) || 
+	    (pcmC0D0p->streams[0].substream_opened && pcmC0D3p->streams[0].substream_opened) || 
+	    (pcmC0D1p->streams[0].substream_opened && pcmC0D2p->streams[0].substream_opened) ||
+	    (pcmC0D1p->streams[0].substream_opened && pcmC0D3p->streams[0].substream_opened) ||
+	    (pcmC0D2p->streams[0].substream_opened && pcmC0D3p->streams[0].substream_opened))
+    {
+        print_audio("Alsa Entered func %s error busy, pcmC0D0p.opened=%d, pcmC0D1p.opened=%d, pcmC0D2p.opened=%d, pcmC0D3p.opened=%d\n", 
+            __func__, pcmC0D0p->streams[0].substream_opened, pcmC0D1p->streams[0].substream_opened, 
+            pcmC0D2p->streams[0].substream_opened, pcmC0D3p->streams[0].substream_opened);
+        sc_debug_info_record(MODULE_ID_CAP_AUDIO, "Alsa %s err, opened value pcmC0D0p=%d, pcmC0D1p=%d, pcmC0D2p=%d, pcmC0D3p=%d\n", 
+            __func__, pcmC0D0p->streams[0].substream_opened, pcmC0D1p->streams[0].substream_opened, 
+            pcmC0D2p->streams[0].substream_opened, pcmC0D3p->streams[0].substream_opened);
+        
+        return -EBUSY;
+        //BUG();
+    }
+
+    if ((pcmC0D0c == NULL) || (pcmC0D1c == NULL) || (pcmC0D2c == NULL) || (pcmC0D3c == NULL))
+    {
+        print_audio("Alsa Entered func %s, pcmC0D0c=%p, pcmC0D1c=%p, pcmC0D2c=%p, pcmC0D3c=%p\n", __func__, 
+            pcmC0D0c, pcmC0D1c, pcmC0D2c, pcmC0D3c);
+        return  -EINVAL;	  
+    }
+    if ((pcmC0D0c->streams[1].substream_opened && pcmC0D1c->streams[1].substream_opened) || 
+        (pcmC0D0c->streams[1].substream_opened && pcmC0D2c->streams[1].substream_opened) || 
+        (pcmC0D0c->streams[1].substream_opened && pcmC0D3c->streams[1].substream_opened) || 
+        (pcmC0D1c->streams[1].substream_opened && pcmC0D2c->streams[1].substream_opened) ||
+        (pcmC0D1c->streams[1].substream_opened && pcmC0D3c->streams[1].substream_opened) ||
+        (pcmC0D2c->streams[1].substream_opened && pcmC0D3c->streams[1].substream_opened))
+    {
+        print_audio("Alsa Entered func %s error busy, pcmC0D0c.opened=%d, pcmC0D1c.opened=%d, pcmC0D2c.opened=%d,pcmC0D3c.opened=%d\n", 
+            __func__, pcmC0D0c->streams[1].substream_opened, pcmC0D1c->streams[1].substream_opened, 
+            pcmC0D2c->streams[1].substream_opened, pcmC0D3c->streams[1].substream_opened,);
+        sc_debug_info_record(MODULE_ID_CAP_AUDIO, "Alsa %s err, opened value pcmC0D0c=%d, pcmC0D1c=%d, pcmC0D2c=%d, pcmC0D3c=%d\n", 
+            __func__, pcmC0D0c->streams[1].substream_opened, pcmC0D1c->streams[1].substream_opened, 
+            pcmC0D2c->streams[1].substream_opened, pcmC0D3c->streams[1].substream_opened);
+
+        return -EBUSY;
+        //BUG();
+    }
+ 
 #if 0
-	 unsigned long	flags;
-	 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
-		 gpio_set_value(ZX29_GPIO_125, GPIO_LOW);
-		 mdelay(1);  
- 
-		 raw_spin_lock_irqsave(&codec_pa_lock, flags);
-		 gpio_set_value(ZX29_GPIO_125, GPIO_HIGH);
-		 udelay(2);  
-		 gpio_set_value(ZX29_GPIO_125, GPIO_LOW);
-		 udelay(2);
-		 gpio_set_value(ZX29_GPIO_125, GPIO_HIGH);
-		 udelay(2);  
-		 gpio_set_value(ZX29_GPIO_125, GPIO_LOW);
-		 udelay(2);
-		 gpio_set_value(ZX29_GPIO_125, GPIO_HIGH);
-		 raw_spin_unlock_irqrestore(&codec_pa_lock, flags);
-	 }
+    unsigned long	flags;
+    if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+        gpio_set_value(ZX29_GPIO_125, GPIO_LOW);
+        mdelay(1);  
+
+        raw_spin_lock_irqsave(&codec_pa_lock, flags);
+        gpio_set_value(ZX29_GPIO_125, GPIO_HIGH);
+        udelay(2);  
+        gpio_set_value(ZX29_GPIO_125, GPIO_LOW);
+        udelay(2);
+        gpio_set_value(ZX29_GPIO_125, GPIO_HIGH);
+        udelay(2);  
+        gpio_set_value(ZX29_GPIO_125, GPIO_LOW);
+        udelay(2);
+        gpio_set_value(ZX29_GPIO_125, GPIO_HIGH);
+        raw_spin_unlock_irqrestore(&codec_pa_lock, flags);
+    }
 #endif
 
-	 
-	 return 0;
- }
+
+    return 0;
+}
+/* Ended by AICoder, pid:r53959b7c94916e146e3093b301a356223b009fa */
  
  static void zx29_shutdown(struct snd_pcm_substream *substream)
  {
diff --git a/upstream/linux-5.10/sound/soc/sanechips/zx29_dummycodec.c b/upstream/linux-5.10/sound/soc/sanechips/zx29_dummycodec.c
index 1a8cf3e..ff07416 100755
--- a/upstream/linux-5.10/sound/soc/sanechips/zx29_dummycodec.c
+++ b/upstream/linux-5.10/sound/soc/sanechips/zx29_dummycodec.c
@@ -36,6 +36,7 @@
 
 
 #include "i2s.h"
+#include "pub_debug_info.h"
 
 #define ZX29_I2S_TOP_LOOP_REG	0x60
 
@@ -361,53 +362,102 @@
  
 #endif
  
- static int zx29startup(struct snd_pcm_substream *substream)
- {
- //  int ret = 0;
-	 print_audio("Alsa	Entered func %s\n", __func__);
-	 //CPPS_FUNC(cpps_callbacks, zDrv_Audio_Printf)("Alsa: zx29_startup device=%d,stream=%d\n", substream->pcm->device, substream->stream);
+/* Started by AICoder, pid:53525s2951m0dfb1406409962017998611b17cc1 */
+static int zx29startup(struct snd_pcm_substream *substream)
+{
+    //int ret = 0;
+    print_audio("Alsa Entered func %s\n", __func__);
+    //CPPS_FUNC(cpps_callbacks, zDrv_Audio_Printf)("Alsa: zx29_startup device=%d,stream=%d\n", substream->pcm->device, substream->stream);
+
+    struct snd_pcm *pcmC0D0p = snd_lookup_minor_data(16, SNDRV_DEVICE_TYPE_PCM_PLAYBACK);
+    struct snd_pcm *pcmC0D1p = snd_lookup_minor_data(17, SNDRV_DEVICE_TYPE_PCM_PLAYBACK);
+    struct snd_pcm *pcmC0D2p = snd_lookup_minor_data(18, SNDRV_DEVICE_TYPE_PCM_PLAYBACK);	 
+    struct snd_pcm *pcmC0D3p = snd_lookup_minor_data(19, SNDRV_DEVICE_TYPE_PCM_PLAYBACK);	
+    //struct snd_pcm *pcmC0D4p = snd_lookup_minor_data(20, SNDRV_DEVICE_TYPE_PCM_PLAYBACK);
  
-	 struct snd_pcm *pcmC0D0p = snd_lookup_minor_data(16, SNDRV_DEVICE_TYPE_PCM_PLAYBACK);
-	 struct snd_pcm *pcmC0D1p = snd_lookup_minor_data(17, SNDRV_DEVICE_TYPE_PCM_PLAYBACK);
-	 struct snd_pcm *pcmC0D2p = snd_lookup_minor_data(18, SNDRV_DEVICE_TYPE_PCM_PLAYBACK);	 
-	 struct snd_pcm *pcmC0D3p = snd_lookup_minor_data(19, SNDRV_DEVICE_TYPE_PCM_PLAYBACK);	
-	 if ((pcmC0D0p == NULL) || (pcmC0D1p == NULL) || (pcmC0D2p == NULL) || (pcmC0D3p == NULL))
-		 return  -EINVAL;	  
-	 if ((pcmC0D0p->streams[0].substream_opened && pcmC0D1p->streams[0].substream_opened) || 
-		 (pcmC0D0p->streams[0].substream_opened && pcmC0D2p->streams[0].substream_opened) || 
-		 (pcmC0D0p->streams[0].substream_opened && pcmC0D3p->streams[0].substream_opened) || 
-		 (pcmC0D1p->streams[0].substream_opened && pcmC0D2p->streams[0].substream_opened) ||
-		 (pcmC0D1p->streams[0].substream_opened && pcmC0D3p->streams[0].substream_opened) ||
-		 (pcmC0D2p->streams[0].substream_opened && pcmC0D3p->streams[0].substream_opened))
-		 BUG();
+    struct snd_pcm *pcmC0D0c = snd_lookup_minor_data(24, SNDRV_DEVICE_TYPE_PCM_CAPTURE);
+    struct snd_pcm *pcmC0D1c = snd_lookup_minor_data(25, SNDRV_DEVICE_TYPE_PCM_CAPTURE);
+    struct snd_pcm *pcmC0D2c = snd_lookup_minor_data(26, SNDRV_DEVICE_TYPE_PCM_CAPTURE);	 
+    struct snd_pcm *pcmC0D3c = snd_lookup_minor_data(27, SNDRV_DEVICE_TYPE_PCM_CAPTURE);	
+    //struct snd_pcm *pcmC0D4c = snd_lookup_minor_data(28, SNDRV_DEVICE_TYPE_PCM_CAPTURE);
+    
+    if ((pcmC0D0p == NULL) || (pcmC0D1p == NULL) || (pcmC0D2p == NULL) || (pcmC0D3p == NULL))
+    {
+        print_audio("Alsa Entered func %s, pcmC0D0p=%p, pcmC0D1p=%p, pcmC0D2p=%p, pcmC0D3p=%p\n", __func__, 
+            pcmC0D0p, pcmC0D1p, pcmC0D2p, pcmC0D3p);
+        return  -EINVAL;	  
+    }
+    if ((pcmC0D0p->streams[0].substream_opened && pcmC0D1p->streams[0].substream_opened) || 
+	    (pcmC0D0p->streams[0].substream_opened && pcmC0D2p->streams[0].substream_opened) || 
+	    (pcmC0D0p->streams[0].substream_opened && pcmC0D3p->streams[0].substream_opened) || 
+	    (pcmC0D1p->streams[0].substream_opened && pcmC0D2p->streams[0].substream_opened) ||
+	    (pcmC0D1p->streams[0].substream_opened && pcmC0D3p->streams[0].substream_opened) ||
+	    (pcmC0D2p->streams[0].substream_opened && pcmC0D3p->streams[0].substream_opened))
+    {
+        print_audio("Alsa Entered func %s error busy, pcmC0D0p.opened=%d, pcmC0D1p.opened=%d, pcmC0D2p.opened=%d, pcmC0D3p.opened=%d\n", 
+            __func__, pcmC0D0p->streams[0].substream_opened, pcmC0D1p->streams[0].substream_opened, 
+            pcmC0D2p->streams[0].substream_opened, pcmC0D3p->streams[0].substream_opened);
+        sc_debug_info_record(MODULE_ID_CAP_AUDIO, "Alsa %s err, opened value pcmC0D0p=%d, pcmC0D1p=%d, pcmC0D2p=%d, pcmC0D3p=%d\n", 
+            __func__, pcmC0D0p->streams[0].substream_opened, pcmC0D1p->streams[0].substream_opened, 
+            pcmC0D2p->streams[0].substream_opened, pcmC0D3p->streams[0].substream_opened);
+        
+        return -EBUSY;
+        //BUG();
+    }
+
+    if ((pcmC0D0c == NULL) || (pcmC0D1c == NULL) || (pcmC0D2c == NULL) || (pcmC0D3c == NULL))
+    {
+        print_audio("Alsa Entered func %s, pcmC0D0c=%p, pcmC0D1c=%p, pcmC0D2c=%p, pcmC0D3c=%p\n", __func__, 
+            pcmC0D0c, pcmC0D1c, pcmC0D2c, pcmC0D3c);
+        return  -EINVAL;	  
+    }
+    if ((pcmC0D0c->streams[1].substream_opened && pcmC0D1c->streams[1].substream_opened) || 
+        (pcmC0D0c->streams[1].substream_opened && pcmC0D2c->streams[1].substream_opened) || 
+        (pcmC0D0c->streams[1].substream_opened && pcmC0D3c->streams[1].substream_opened) || 
+        (pcmC0D1c->streams[1].substream_opened && pcmC0D2c->streams[1].substream_opened) ||
+        (pcmC0D1c->streams[1].substream_opened && pcmC0D3c->streams[1].substream_opened) ||
+        (pcmC0D2c->streams[1].substream_opened && pcmC0D3c->streams[1].substream_opened))
+    {
+        print_audio("Alsa Entered func %s error busy, pcmC0D0c.opened=%d, pcmC0D1c.opened=%d, pcmC0D2c.opened=%d,pcmC0D3c.opened=%d\n", 
+            __func__, pcmC0D0c->streams[1].substream_opened, pcmC0D1c->streams[1].substream_opened, 
+            pcmC0D2c->streams[1].substream_opened, pcmC0D3c->streams[1].substream_opened);
+        sc_debug_info_record(MODULE_ID_CAP_AUDIO, "Alsa %s err, opened value pcmC0D0c=%d, pcmC0D1c=%d, pcmC0D2c=%d, pcmC0D3c=%d\n", 
+            __func__, pcmC0D0c->streams[1].substream_opened, pcmC0D1c->streams[1].substream_opened, 
+            pcmC0D2c->streams[1].substream_opened, pcmC0D3c->streams[1].substream_opened);
+
+        return -EBUSY;
+        //BUG();
+    }
+ 
 #if 0
-	 unsigned long	flags;
-	 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
-		 gpio_set_value(ZX29_GPIO_125, GPIO_LOW);
-		 mdelay(1);  
- 
-		 raw_spin_lock_irqsave(&codec_pa_lock, flags);
-		 gpio_set_value(ZX29_GPIO_125, GPIO_HIGH);
-		 udelay(2);  
-		 gpio_set_value(ZX29_GPIO_125, GPIO_LOW);
-		 udelay(2);
-		 gpio_set_value(ZX29_GPIO_125, GPIO_HIGH);
-		 udelay(2);  
-		 gpio_set_value(ZX29_GPIO_125, GPIO_LOW);
-		 udelay(2);
-		 gpio_set_value(ZX29_GPIO_125, GPIO_HIGH);
-		 raw_spin_unlock_irqrestore(&codec_pa_lock, flags);
-	 }
+    unsigned long	flags;
+    if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+        gpio_set_value(ZX29_GPIO_125, GPIO_LOW);
+        mdelay(1);  
+
+        raw_spin_lock_irqsave(&codec_pa_lock, flags);
+        gpio_set_value(ZX29_GPIO_125, GPIO_HIGH);
+        udelay(2);  
+        gpio_set_value(ZX29_GPIO_125, GPIO_LOW);
+        udelay(2);
+        gpio_set_value(ZX29_GPIO_125, GPIO_HIGH);
+        udelay(2);  
+        gpio_set_value(ZX29_GPIO_125, GPIO_LOW);
+        udelay(2);
+        gpio_set_value(ZX29_GPIO_125, GPIO_HIGH);
+        raw_spin_unlock_irqrestore(&codec_pa_lock, flags);
+    }
 #endif
- 
-	 unsigned int  armRegBit = 0;
-	 //armRegBit = zx_read_reg(AON_WIFI_BT_CLK_CFG2);
-	 //armRegBit &= 0xfffffffe;
-	 //armRegBit |= 0x1;
-	 //zx_write_reg(AON_WIFI_BT_CLK_CFG2, armRegBit);
-	 
-	 return 0;
- }
+
+    unsigned int  armRegBit = 0;
+    //armRegBit = zx_read_reg(AON_WIFI_BT_CLK_CFG2);
+    //armRegBit &= 0xfffffffe;
+    //armRegBit |= 0x1;
+    //zx_write_reg(AON_WIFI_BT_CLK_CFG2, armRegBit);
+
+    return 0;
+}
+/* Ended by AICoder, pid:53525s2951m0dfb1406409962017998611b17cc1 */
  
  static void zx29_shutdown(struct snd_pcm_substream *substream)
  {
diff --git a/upstream/linux-5.10/sound/soc/sanechips/zx29_es83xx.c b/upstream/linux-5.10/sound/soc/sanechips/zx29_es83xx.c
index 1204542..0aaf23f 100755
--- a/upstream/linux-5.10/sound/soc/sanechips/zx29_es83xx.c
+++ b/upstream/linux-5.10/sound/soc/sanechips/zx29_es83xx.c
@@ -39,6 +39,7 @@
 
 
 #include "i2s.h"
+#include "pub_debug_info.h"
 
 #define ZX29_I2S_TOP_LOOP_REG	0x60
 //#define NAU_CLK_ID 0
@@ -101,29 +102,97 @@
 				 struct snd_ctl_elem_value *ucontrol);
 
 
- static int zx29startup(struct snd_pcm_substream *substream)
- {
- //  int ret = 0;
-	 print_audio("Alsa	Entered func %s\n", __func__);
-	 //CPPS_FUNC(cpps_callbacks, zDrv_Audio_Printf)("Alsa: zx29_startup device=%d,stream=%d\n", substream->pcm->device, substream->stream);
+/* Started by AICoder, pid:i3fd98546erae28145550ba82095535ff4895652 */
+static int zx29startup(struct snd_pcm_substream *substream)
+{
+    //int ret = 0;
+    print_audio("Alsa Entered func %s\n", __func__);
+    //CPPS_FUNC(cpps_callbacks, zDrv_Audio_Printf)("Alsa: zx29_startup device=%d,stream=%d\n", substream->pcm->device, substream->stream);
+
+    struct snd_pcm *pcmC0D0p = snd_lookup_minor_data(16, SNDRV_DEVICE_TYPE_PCM_PLAYBACK);
+    struct snd_pcm *pcmC0D1p = snd_lookup_minor_data(17, SNDRV_DEVICE_TYPE_PCM_PLAYBACK);
+    struct snd_pcm *pcmC0D2p = snd_lookup_minor_data(18, SNDRV_DEVICE_TYPE_PCM_PLAYBACK);	 
+    struct snd_pcm *pcmC0D3p = snd_lookup_minor_data(19, SNDRV_DEVICE_TYPE_PCM_PLAYBACK);	
+    //struct snd_pcm *pcmC0D4p = snd_lookup_minor_data(20, SNDRV_DEVICE_TYPE_PCM_PLAYBACK);
  
-	 struct snd_pcm *pcmC0D0p = snd_lookup_minor_data(16, SNDRV_DEVICE_TYPE_PCM_PLAYBACK);
-	 struct snd_pcm *pcmC0D1p = snd_lookup_minor_data(17, SNDRV_DEVICE_TYPE_PCM_PLAYBACK);
-	 struct snd_pcm *pcmC0D2p = snd_lookup_minor_data(18, SNDRV_DEVICE_TYPE_PCM_PLAYBACK);	 
-	 struct snd_pcm *pcmC0D3p = snd_lookup_minor_data(19, SNDRV_DEVICE_TYPE_PCM_PLAYBACK);	
-	 if ((pcmC0D0p == NULL) || (pcmC0D1p == NULL) || (pcmC0D2p == NULL) || (pcmC0D3p == NULL))
-		 return  -EINVAL;	  
-	 if ((pcmC0D0p->streams[0].substream_opened && pcmC0D1p->streams[0].substream_opened) || 
-		 (pcmC0D0p->streams[0].substream_opened && pcmC0D2p->streams[0].substream_opened) || 
-		 (pcmC0D0p->streams[0].substream_opened && pcmC0D3p->streams[0].substream_opened) || 
-		 (pcmC0D1p->streams[0].substream_opened && pcmC0D2p->streams[0].substream_opened) ||
-		 (pcmC0D1p->streams[0].substream_opened && pcmC0D3p->streams[0].substream_opened) ||
-		 (pcmC0D2p->streams[0].substream_opened && pcmC0D3p->streams[0].substream_opened))
-		 BUG();
+    struct snd_pcm *pcmC0D0c = snd_lookup_minor_data(24, SNDRV_DEVICE_TYPE_PCM_CAPTURE);
+    struct snd_pcm *pcmC0D1c = snd_lookup_minor_data(25, SNDRV_DEVICE_TYPE_PCM_CAPTURE);
+    struct snd_pcm *pcmC0D2c = snd_lookup_minor_data(26, SNDRV_DEVICE_TYPE_PCM_CAPTURE);	 
+    struct snd_pcm *pcmC0D3c = snd_lookup_minor_data(27, SNDRV_DEVICE_TYPE_PCM_CAPTURE);	
+    //struct snd_pcm *pcmC0D4c = snd_lookup_minor_data(28, SNDRV_DEVICE_TYPE_PCM_CAPTURE);
+    
+    if ((pcmC0D0p == NULL) || (pcmC0D1p == NULL) || (pcmC0D2p == NULL) || (pcmC0D3p == NULL))
+    {
+        print_audio("Alsa Entered func %s, pcmC0D0p=%p, pcmC0D1p=%p, pcmC0D2p=%p, pcmC0D3p=%p\n", __func__, 
+            pcmC0D0p, pcmC0D1p, pcmC0D2p, pcmC0D3p);
+        return  -EINVAL;	  
+    }
+    if ((pcmC0D0p->streams[0].substream_opened && pcmC0D1p->streams[0].substream_opened) || 
+	    (pcmC0D0p->streams[0].substream_opened && pcmC0D2p->streams[0].substream_opened) || 
+	    (pcmC0D0p->streams[0].substream_opened && pcmC0D3p->streams[0].substream_opened) || 
+	    (pcmC0D1p->streams[0].substream_opened && pcmC0D2p->streams[0].substream_opened) ||
+	    (pcmC0D1p->streams[0].substream_opened && pcmC0D3p->streams[0].substream_opened) ||
+	    (pcmC0D2p->streams[0].substream_opened && pcmC0D3p->streams[0].substream_opened))
+    {
+        print_audio("Alsa Entered func %s error busy, pcmC0D0p.opened=%d, pcmC0D1p.opened=%d, pcmC0D2p.opened=%d, pcmC0D3p.opened=%d\n", 
+            __func__, pcmC0D0p->streams[0].substream_opened, pcmC0D1p->streams[0].substream_opened, 
+            pcmC0D2p->streams[0].substream_opened, pcmC0D3p->streams[0].substream_opened);
+        sc_debug_info_record(MODULE_ID_CAP_AUDIO, "Alsa %s err, opened value pcmC0D0p=%d, pcmC0D1p=%d, pcmC0D2p=%d, pcmC0D3p=%d\n", 
+            __func__, pcmC0D0p->streams[0].substream_opened, pcmC0D1p->streams[0].substream_opened, 
+            pcmC0D2p->streams[0].substream_opened, pcmC0D3p->streams[0].substream_opened);
+
+        return -EBUSY;
+        //BUG();
+    }
+
+    if ((pcmC0D0c == NULL) || (pcmC0D1c == NULL) || (pcmC0D2c == NULL) || (pcmC0D3c == NULL))
+    {
+        print_audio("Alsa Entered func %s, pcmC0D0c=%p, pcmC0D1c=%p, pcmC0D2c=%p, pcmC0D3c=%p\n", __func__, 
+            pcmC0D0c, pcmC0D1c, pcmC0D2c, pcmC0D3c);
+        return  -EINVAL;	  
+    }
+    if ((pcmC0D0c->streams[1].substream_opened && pcmC0D1c->streams[1].substream_opened) || 
+        (pcmC0D0c->streams[1].substream_opened && pcmC0D2c->streams[1].substream_opened) || 
+        (pcmC0D0c->streams[1].substream_opened && pcmC0D3c->streams[1].substream_opened) || 
+        (pcmC0D1c->streams[1].substream_opened && pcmC0D2c->streams[1].substream_opened) ||
+        (pcmC0D1c->streams[1].substream_opened && pcmC0D3c->streams[1].substream_opened) ||
+        (pcmC0D2c->streams[1].substream_opened && pcmC0D3c->streams[1].substream_opened))
+    {
+        print_audio("Alsa Entered func %s error busy, pcmC0D0c.opened=%d, pcmC0D1c.opened=%d, pcmC0D2c.opened=%d,pcmC0D3c.opened=%d\n", 
+            __func__, pcmC0D0c->streams[1].substream_opened, pcmC0D1c->streams[1].substream_opened, 
+            pcmC0D2c->streams[1].substream_opened, pcmC0D3c->streams[1].substream_opened);
+        sc_debug_info_record(MODULE_ID_CAP_AUDIO, "Alsa %s err, opened value pcmC0D0c=%d, pcmC0D1c=%d, pcmC0D2c=%d, pcmC0D3c=%d\n", 
+            __func__, pcmC0D0c->streams[1].substream_opened, pcmC0D1c->streams[1].substream_opened, 
+            pcmC0D2c->streams[1].substream_opened, pcmC0D3c->streams[1].substream_opened);
+        
+        return -EBUSY;
+        //BUG();
+    }
  
- 
-	 return 0;
- }
+#if 0
+    unsigned long	flags;
+    if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+        gpio_set_value(ZX29_GPIO_125, GPIO_LOW);
+        mdelay(1);  
+
+        raw_spin_lock_irqsave(&codec_pa_lock, flags);
+        gpio_set_value(ZX29_GPIO_125, GPIO_HIGH);
+        udelay(2);  
+        gpio_set_value(ZX29_GPIO_125, GPIO_LOW);
+        udelay(2);
+        gpio_set_value(ZX29_GPIO_125, GPIO_HIGH);
+        udelay(2);  
+        gpio_set_value(ZX29_GPIO_125, GPIO_LOW);
+        udelay(2);
+        gpio_set_value(ZX29_GPIO_125, GPIO_HIGH);
+        raw_spin_unlock_irqrestore(&codec_pa_lock, flags);
+    }
+#endif
+
+    
+    return 0;
+}
+/* Ended by AICoder, pid:i3fd98546erae28145550ba82095535ff4895652 */
  
  static void zx29_shutdown(struct snd_pcm_substream *substream)
  {
diff --git a/upstream/linux-5.10/sound/soc/sanechips/zx29_max9867.c b/upstream/linux-5.10/sound/soc/sanechips/zx29_max9867.c
index ea874ee..7cb0c36 100755
--- a/upstream/linux-5.10/sound/soc/sanechips/zx29_max9867.c
+++ b/upstream/linux-5.10/sound/soc/sanechips/zx29_max9867.c
@@ -37,6 +37,7 @@
 
 
 #include "i2s.h"
+#include "pub_debug_info.h"
 
 #define ZX29_I2S_TOP_LOOP_REG	0x60
 #define CODEC_CLK_ID 0
@@ -371,48 +372,97 @@
 
 
 
- static int zx29startup(struct snd_pcm_substream *substream)
- {
- //  int ret = 0;
-	 print_audio("Alsa	Entered func %s\n", __func__);
-	 //CPPS_FUNC(cpps_callbacks, zDrv_Audio_Printf)("Alsa: zx29_startup device=%d,stream=%d\n", substream->pcm->device, substream->stream);
+/* Started by AICoder, pid:g33a6vccc4k69881474b0948e0153c719773e1fe */
+static int zx29startup(struct snd_pcm_substream *substream)
+{
+    //int ret = 0;
+    print_audio("Alsa Entered func %s\n", __func__);
+    //CPPS_FUNC(cpps_callbacks, zDrv_Audio_Printf)("Alsa: zx29_startup device=%d,stream=%d\n", substream->pcm->device, substream->stream);
+
+    struct snd_pcm *pcmC0D0p = snd_lookup_minor_data(16, SNDRV_DEVICE_TYPE_PCM_PLAYBACK);
+    struct snd_pcm *pcmC0D1p = snd_lookup_minor_data(17, SNDRV_DEVICE_TYPE_PCM_PLAYBACK);
+    struct snd_pcm *pcmC0D2p = snd_lookup_minor_data(18, SNDRV_DEVICE_TYPE_PCM_PLAYBACK);	 
+    struct snd_pcm *pcmC0D3p = snd_lookup_minor_data(19, SNDRV_DEVICE_TYPE_PCM_PLAYBACK);	
+    //struct snd_pcm *pcmC0D4p = snd_lookup_minor_data(20, SNDRV_DEVICE_TYPE_PCM_PLAYBACK);
  
-	 struct snd_pcm *pcmC0D0p = snd_lookup_minor_data(16, SNDRV_DEVICE_TYPE_PCM_PLAYBACK);
-	 struct snd_pcm *pcmC0D1p = snd_lookup_minor_data(17, SNDRV_DEVICE_TYPE_PCM_PLAYBACK);
-	 struct snd_pcm *pcmC0D2p = snd_lookup_minor_data(18, SNDRV_DEVICE_TYPE_PCM_PLAYBACK);	 
-	 struct snd_pcm *pcmC0D3p = snd_lookup_minor_data(19, SNDRV_DEVICE_TYPE_PCM_PLAYBACK);	
-	 if ((pcmC0D0p == NULL) || (pcmC0D1p == NULL) || (pcmC0D2p == NULL) || (pcmC0D3p == NULL))
-		 return  -EINVAL;	  
-	 if ((pcmC0D0p->streams[0].substream_opened && pcmC0D1p->streams[0].substream_opened) || 
-		 (pcmC0D0p->streams[0].substream_opened && pcmC0D2p->streams[0].substream_opened) || 
-		 (pcmC0D0p->streams[0].substream_opened && pcmC0D3p->streams[0].substream_opened) || 
-		 (pcmC0D1p->streams[0].substream_opened && pcmC0D2p->streams[0].substream_opened) ||
-		 (pcmC0D1p->streams[0].substream_opened && pcmC0D3p->streams[0].substream_opened) ||
-		 (pcmC0D2p->streams[0].substream_opened && pcmC0D3p->streams[0].substream_opened))
-		 BUG();
+    struct snd_pcm *pcmC0D0c = snd_lookup_minor_data(24, SNDRV_DEVICE_TYPE_PCM_CAPTURE);
+    struct snd_pcm *pcmC0D1c = snd_lookup_minor_data(25, SNDRV_DEVICE_TYPE_PCM_CAPTURE);
+    struct snd_pcm *pcmC0D2c = snd_lookup_minor_data(26, SNDRV_DEVICE_TYPE_PCM_CAPTURE);	 
+    struct snd_pcm *pcmC0D3c = snd_lookup_minor_data(27, SNDRV_DEVICE_TYPE_PCM_CAPTURE);	
+    //struct snd_pcm *pcmC0D4c = snd_lookup_minor_data(28, SNDRV_DEVICE_TYPE_PCM_CAPTURE);
+    
+    if ((pcmC0D0p == NULL) || (pcmC0D1p == NULL) || (pcmC0D2p == NULL) || (pcmC0D3p == NULL))
+    {
+        print_audio("Alsa Entered func %s, pcmC0D0p=%p, pcmC0D1p=%p, pcmC0D2p=%p, pcmC0D3p=%p\n", __func__, 
+            pcmC0D0p, pcmC0D1p, pcmC0D2p, pcmC0D3p);
+        return  -EINVAL;	  
+    }
+    if ((pcmC0D0p->streams[0].substream_opened && pcmC0D1p->streams[0].substream_opened) || 
+	    (pcmC0D0p->streams[0].substream_opened && pcmC0D2p->streams[0].substream_opened) || 
+	    (pcmC0D0p->streams[0].substream_opened && pcmC0D3p->streams[0].substream_opened) || 
+	    (pcmC0D1p->streams[0].substream_opened && pcmC0D2p->streams[0].substream_opened) ||
+	    (pcmC0D1p->streams[0].substream_opened && pcmC0D3p->streams[0].substream_opened) ||
+	    (pcmC0D2p->streams[0].substream_opened && pcmC0D3p->streams[0].substream_opened))
+    {
+        print_audio("Alsa Entered func %s error busy, pcmC0D0p.opened=%d, pcmC0D1p.opened=%d, pcmC0D2p.opened=%d, pcmC0D3p.opened=%d\n", 
+            __func__, pcmC0D0p->streams[0].substream_opened, pcmC0D1p->streams[0].substream_opened, 
+            pcmC0D2p->streams[0].substream_opened, pcmC0D3p->streams[0].substream_opened);
+        sc_debug_info_record(MODULE_ID_CAP_AUDIO, "Alsa %s err, opened value pcmC0D0p=%d, pcmC0D1p=%d, pcmC0D2p=%d, pcmC0D3p=%d\n", 
+            __func__, pcmC0D0p->streams[0].substream_opened, pcmC0D1p->streams[0].substream_opened, 
+            pcmC0D2p->streams[0].substream_opened, pcmC0D3p->streams[0].substream_opened);
+        
+        return -EBUSY;
+        //BUG();
+    }
+
+    if ((pcmC0D0c == NULL) || (pcmC0D1c == NULL) || (pcmC0D2c == NULL) || (pcmC0D3c == NULL))
+    {
+        print_audio("Alsa Entered func %s, pcmC0D0c=%p, pcmC0D1c=%p, pcmC0D2c=%p, pcmC0D3c=%p\n", __func__, 
+            pcmC0D0c, pcmC0D1c, pcmC0D2c, pcmC0D3c);
+        return  -EINVAL;	  
+    }
+    if ((pcmC0D0c->streams[1].substream_opened && pcmC0D1c->streams[1].substream_opened) || 
+        (pcmC0D0c->streams[1].substream_opened && pcmC0D2c->streams[1].substream_opened) || 
+        (pcmC0D0c->streams[1].substream_opened && pcmC0D3c->streams[1].substream_opened) || 
+        (pcmC0D1c->streams[1].substream_opened && pcmC0D2c->streams[1].substream_opened) ||
+        (pcmC0D1c->streams[1].substream_opened && pcmC0D3c->streams[1].substream_opened) ||
+        (pcmC0D2c->streams[1].substream_opened && pcmC0D3c->streams[1].substream_opened))
+    {
+        print_audio("Alsa Entered func %s error busy, pcmC0D0c.opened=%d, pcmC0D1c.opened=%d, pcmC0D2c.opened=%d,pcmC0D3c.opened=%d\n", 
+            __func__, pcmC0D0c->streams[1].substream_opened, pcmC0D1c->streams[1].substream_opened, 
+            pcmC0D2c->streams[1].substream_opened, pcmC0D3c->streams[1].substream_opened);
+        sc_debug_info_record(MODULE_ID_CAP_AUDIO, "Alsa %s err, opened value pcmC0D0c=%d, pcmC0D1c=%d, pcmC0D2c=%d, pcmC0D3c=%d\n", 
+            __func__, pcmC0D0c->streams[1].substream_opened, pcmC0D1c->streams[1].substream_opened, 
+            pcmC0D2c->streams[1].substream_opened, pcmC0D3c->streams[1].substream_opened;
+
+        return -EBUSY;
+        //BUG();
+    }
+ 
 #if 0
-	 unsigned long	flags;
-	 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
-		 gpio_set_value(ZX29_GPIO_125, GPIO_LOW);
-		 mdelay(1);  
- 
-		 raw_spin_lock_irqsave(&codec_pa_lock, flags);
-		 gpio_set_value(ZX29_GPIO_125, GPIO_HIGH);
-		 udelay(2);  
-		 gpio_set_value(ZX29_GPIO_125, GPIO_LOW);
-		 udelay(2);
-		 gpio_set_value(ZX29_GPIO_125, GPIO_HIGH);
-		 udelay(2);  
-		 gpio_set_value(ZX29_GPIO_125, GPIO_LOW);
-		 udelay(2);
-		 gpio_set_value(ZX29_GPIO_125, GPIO_HIGH);
-		 raw_spin_unlock_irqrestore(&codec_pa_lock, flags);
-	 }
+    unsigned long	flags;
+    if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+        gpio_set_value(ZX29_GPIO_125, GPIO_LOW);
+        mdelay(1);  
+
+        raw_spin_lock_irqsave(&codec_pa_lock, flags);
+        gpio_set_value(ZX29_GPIO_125, GPIO_HIGH);
+        udelay(2);  
+        gpio_set_value(ZX29_GPIO_125, GPIO_LOW);
+        udelay(2);
+        gpio_set_value(ZX29_GPIO_125, GPIO_HIGH);
+        udelay(2);  
+        gpio_set_value(ZX29_GPIO_125, GPIO_LOW);
+        udelay(2);
+        gpio_set_value(ZX29_GPIO_125, GPIO_HIGH);
+        raw_spin_unlock_irqrestore(&codec_pa_lock, flags);
+    }
 #endif
- 
- 
-	 return 0;
- }
+
+
+    return 0;
+}
+/* Ended by AICoder, pid:g33a6vccc4k69881474b0948e0153c719773e1fe */
  
  static void zx29_shutdown(struct snd_pcm_substream *substream)
  {
diff --git a/upstream/linux-5.10/sound/soc/sanechips/zx29_nau8810.c b/upstream/linux-5.10/sound/soc/sanechips/zx29_nau8810.c
index 1e5777d..4dc8672 100755
--- a/upstream/linux-5.10/sound/soc/sanechips/zx29_nau8810.c
+++ b/upstream/linux-5.10/sound/soc/sanechips/zx29_nau8810.c
@@ -37,6 +37,7 @@
 
 
 #include "i2s.h"
+#include "pub_debug_info.h"
 
 #define ZX29_I2S_TOP_LOOP_REG	0x60
 #define NAU_CLK_ID 0
@@ -373,48 +374,97 @@
 
 
 
- static int zx29startup(struct snd_pcm_substream *substream)
- {
- //  int ret = 0;
-	 print_audio("Alsa	Entered func %s\n", __func__);
-	 //CPPS_FUNC(cpps_callbacks, zDrv_Audio_Printf)("Alsa: zx29_startup device=%d,stream=%d\n", substream->pcm->device, substream->stream);
+/* Started by AICoder, pid:we8d34d80fbc7981449d0b1590d6b753b789d779 */
+static int zx29startup(struct snd_pcm_substream *substream)
+{
+    //int ret = 0;
+    print_audio("Alsa Entered func %s\n", __func__);
+    //CPPS_FUNC(cpps_callbacks, zDrv_Audio_Printf)("Alsa: zx29_startup device=%d,stream=%d\n", substream->pcm->device, substream->stream);
+
+    struct snd_pcm *pcmC0D0p = snd_lookup_minor_data(16, SNDRV_DEVICE_TYPE_PCM_PLAYBACK);
+    struct snd_pcm *pcmC0D1p = snd_lookup_minor_data(17, SNDRV_DEVICE_TYPE_PCM_PLAYBACK);
+    struct snd_pcm *pcmC0D2p = snd_lookup_minor_data(18, SNDRV_DEVICE_TYPE_PCM_PLAYBACK);	 
+    struct snd_pcm *pcmC0D3p = snd_lookup_minor_data(19, SNDRV_DEVICE_TYPE_PCM_PLAYBACK);	
+    //struct snd_pcm *pcmC0D4p = snd_lookup_minor_data(20, SNDRV_DEVICE_TYPE_PCM_PLAYBACK);
  
-	 struct snd_pcm *pcmC0D0p = snd_lookup_minor_data(16, SNDRV_DEVICE_TYPE_PCM_PLAYBACK);
-	 struct snd_pcm *pcmC0D1p = snd_lookup_minor_data(17, SNDRV_DEVICE_TYPE_PCM_PLAYBACK);
-	 struct snd_pcm *pcmC0D2p = snd_lookup_minor_data(18, SNDRV_DEVICE_TYPE_PCM_PLAYBACK);	 
-	 struct snd_pcm *pcmC0D3p = snd_lookup_minor_data(19, SNDRV_DEVICE_TYPE_PCM_PLAYBACK);	
-	 if ((pcmC0D0p == NULL) || (pcmC0D1p == NULL) || (pcmC0D2p == NULL) || (pcmC0D3p == NULL))
-		 return  -EINVAL;	  
-	 if ((pcmC0D0p->streams[0].substream_opened && pcmC0D1p->streams[0].substream_opened) || 
-		 (pcmC0D0p->streams[0].substream_opened && pcmC0D2p->streams[0].substream_opened) || 
-		 (pcmC0D0p->streams[0].substream_opened && pcmC0D3p->streams[0].substream_opened) || 
-		 (pcmC0D1p->streams[0].substream_opened && pcmC0D2p->streams[0].substream_opened) ||
-		 (pcmC0D1p->streams[0].substream_opened && pcmC0D3p->streams[0].substream_opened) ||
-		 (pcmC0D2p->streams[0].substream_opened && pcmC0D3p->streams[0].substream_opened))
-		 BUG();
+    struct snd_pcm *pcmC0D0c = snd_lookup_minor_data(24, SNDRV_DEVICE_TYPE_PCM_CAPTURE);
+    struct snd_pcm *pcmC0D1c = snd_lookup_minor_data(25, SNDRV_DEVICE_TYPE_PCM_CAPTURE);
+    struct snd_pcm *pcmC0D2c = snd_lookup_minor_data(26, SNDRV_DEVICE_TYPE_PCM_CAPTURE);	 
+    struct snd_pcm *pcmC0D3c = snd_lookup_minor_data(27, SNDRV_DEVICE_TYPE_PCM_CAPTURE);	
+    //struct snd_pcm *pcmC0D4c = snd_lookup_minor_data(28, SNDRV_DEVICE_TYPE_PCM_CAPTURE);
+    
+    if ((pcmC0D0p == NULL) || (pcmC0D1p == NULL) || (pcmC0D2p == NULL) || (pcmC0D3p == NULL))
+    {
+        print_audio("Alsa Entered func %s, pcmC0D0p=%p, pcmC0D1p=%p, pcmC0D2p=%p, pcmC0D3p=%p\n", __func__, 
+            pcmC0D0p, pcmC0D1p, pcmC0D2p, pcmC0D3p);
+        return  -EINVAL;	  
+    }
+    if ((pcmC0D0p->streams[0].substream_opened && pcmC0D1p->streams[0].substream_opened) || 
+	    (pcmC0D0p->streams[0].substream_opened && pcmC0D2p->streams[0].substream_opened) || 
+	    (pcmC0D0p->streams[0].substream_opened && pcmC0D3p->streams[0].substream_opened) || 
+	    (pcmC0D1p->streams[0].substream_opened && pcmC0D2p->streams[0].substream_opened) ||
+	    (pcmC0D1p->streams[0].substream_opened && pcmC0D3p->streams[0].substream_opened) ||
+	    (pcmC0D2p->streams[0].substream_opened && pcmC0D3p->streams[0].substream_opened))
+    {
+        print_audio("Alsa Entered func %s error busy, pcmC0D0p.opened=%d, pcmC0D1p.opened=%d, pcmC0D2p.opened=%d, pcmC0D3p.opened=%d\n", 
+            __func__, pcmC0D0p->streams[0].substream_opened, pcmC0D1p->streams[0].substream_opened, 
+            pcmC0D2p->streams[0].substream_opened, pcmC0D3p->streams[0].substream_opened);
+        sc_debug_info_record(MODULE_ID_CAP_AUDIO, "Alsa %s err, opened value pcmC0D0p=%d, pcmC0D1p=%d, pcmC0D2p=%d, pcmC0D3p=%d\n", 
+            __func__, pcmC0D0p->streams[0].substream_opened, pcmC0D1p->streams[0].substream_opened, 
+            pcmC0D2p->streams[0].substream_opened, pcmC0D3p->streams[0].substream_opened);
+        
+        return -EBUSY;
+        //BUG();
+    }
+
+    if ((pcmC0D0c == NULL) || (pcmC0D1c == NULL) || (pcmC0D2c == NULL) || (pcmC0D3c == NULL))
+    {
+        print_audio("Alsa Entered func %s, pcmC0D0c=%p, pcmC0D1c=%p, pcmC0D2c=%p, pcmC0D3c=%p\n", __func__, 
+            pcmC0D0c, pcmC0D1c, pcmC0D2c, pcmC0D3c);
+        return  -EINVAL;	  
+    }
+    if ((pcmC0D0c->streams[1].substream_opened && pcmC0D1c->streams[1].substream_opened) || 
+        (pcmC0D0c->streams[1].substream_opened && pcmC0D2c->streams[1].substream_opened) || 
+        (pcmC0D0c->streams[1].substream_opened && pcmC0D3c->streams[1].substream_opened) || 
+        (pcmC0D1c->streams[1].substream_opened && pcmC0D2c->streams[1].substream_opened) ||
+        (pcmC0D1c->streams[1].substream_opened && pcmC0D3c->streams[1].substream_opened) ||
+        (pcmC0D2c->streams[1].substream_opened && pcmC0D3c->streams[1].substream_opened))
+    {
+        print_audio("Alsa Entered func %s error busy, pcmC0D0c.opened=%d, pcmC0D1c.opened=%d, pcmC0D2c.opened=%d,pcmC0D3c.opened=%d\n", 
+            __func__, pcmC0D0c->streams[1].substream_opened, pcmC0D1c->streams[1].substream_opened, 
+            pcmC0D2c->streams[1].substream_opened, pcmC0D3c->streams[1].substream_opened);
+        sc_debug_info_record(MODULE_ID_CAP_AUDIO, "Alsa %s err, opened value pcmC0D0c=%d, pcmC0D1c=%d, pcmC0D2c=%d, pcmC0D3c=%d\n", 
+            __func__, pcmC0D0c->streams[1].substream_opened, pcmC0D1c->streams[1].substream_opened, 
+            pcmC0D2c->streams[1].substream_opened, pcmC0D3c->streams[1].substream_opened);
+
+        return -EBUSY;
+        //BUG();
+    }
+ 
 #if 0
-	 unsigned long	flags;
-	 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
-		 gpio_set_value(ZX29_GPIO_125, GPIO_LOW);
-		 mdelay(1);  
- 
-		 raw_spin_lock_irqsave(&codec_pa_lock, flags);
-		 gpio_set_value(ZX29_GPIO_125, GPIO_HIGH);
-		 udelay(2);  
-		 gpio_set_value(ZX29_GPIO_125, GPIO_LOW);
-		 udelay(2);
-		 gpio_set_value(ZX29_GPIO_125, GPIO_HIGH);
-		 udelay(2);  
-		 gpio_set_value(ZX29_GPIO_125, GPIO_LOW);
-		 udelay(2);
-		 gpio_set_value(ZX29_GPIO_125, GPIO_HIGH);
-		 raw_spin_unlock_irqrestore(&codec_pa_lock, flags);
-	 }
+    unsigned long	flags;
+    if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+        gpio_set_value(ZX29_GPIO_125, GPIO_LOW);
+        mdelay(1);  
+
+        raw_spin_lock_irqsave(&codec_pa_lock, flags);
+        gpio_set_value(ZX29_GPIO_125, GPIO_HIGH);
+        udelay(2);  
+        gpio_set_value(ZX29_GPIO_125, GPIO_LOW);
+        udelay(2);
+        gpio_set_value(ZX29_GPIO_125, GPIO_HIGH);
+        udelay(2);  
+        gpio_set_value(ZX29_GPIO_125, GPIO_LOW);
+        udelay(2);
+        gpio_set_value(ZX29_GPIO_125, GPIO_HIGH);
+        raw_spin_unlock_irqrestore(&codec_pa_lock, flags);
+    }
 #endif
- 
- 
-	 return 0;
- }
+
+
+    return 0;
+}
+/* Ended by AICoder, pid:we8d34d80fbc7981449d0b1590d6b753b789d779 */
  
  static void zx29_shutdown(struct snd_pcm_substream *substream)
  {
diff --git a/upstream/linux-5.10/sound/soc/sanechips/zx29_ti3100.c b/upstream/linux-5.10/sound/soc/sanechips/zx29_ti3100.c
index 9959350..3b9bedf 100755
--- a/upstream/linux-5.10/sound/soc/sanechips/zx29_ti3100.c
+++ b/upstream/linux-5.10/sound/soc/sanechips/zx29_ti3100.c
@@ -37,6 +37,7 @@
 
 
 #include "i2s.h"
+#include "pub_debug_info.h"
 
 #define ZX29_I2S_TOP_LOOP_REG	0x60
 
@@ -370,48 +371,97 @@
 
 
 
- static int zx29startup(struct snd_pcm_substream *substream)
- {
- //  int ret = 0;
-	 print_audio("Alsa	Entered func %s\n", __func__);
-	 //CPPS_FUNC(cpps_callbacks, zDrv_Audio_Printf)("Alsa: zx29_startup device=%d,stream=%d\n", substream->pcm->device, substream->stream);
+/* Started by AICoder, pid:cd752b8f85qb5fa14ec60aceb0c11d619783bee6 */
+static int zx29startup(struct snd_pcm_substream *substream)
+{
+    //int ret = 0;
+    print_audio("Alsa Entered func %s\n", __func__);
+    //CPPS_FUNC(cpps_callbacks, zDrv_Audio_Printf)("Alsa: zx29_startup device=%d,stream=%d\n", substream->pcm->device, substream->stream);
+
+    struct snd_pcm *pcmC0D0p = snd_lookup_minor_data(16, SNDRV_DEVICE_TYPE_PCM_PLAYBACK);
+    struct snd_pcm *pcmC0D1p = snd_lookup_minor_data(17, SNDRV_DEVICE_TYPE_PCM_PLAYBACK);
+    struct snd_pcm *pcmC0D2p = snd_lookup_minor_data(18, SNDRV_DEVICE_TYPE_PCM_PLAYBACK);	 
+    struct snd_pcm *pcmC0D3p = snd_lookup_minor_data(19, SNDRV_DEVICE_TYPE_PCM_PLAYBACK);	
+    //struct snd_pcm *pcmC0D4p = snd_lookup_minor_data(20, SNDRV_DEVICE_TYPE_PCM_PLAYBACK);
  
-	 struct snd_pcm *pcmC0D0p = snd_lookup_minor_data(16, SNDRV_DEVICE_TYPE_PCM_PLAYBACK);
-	 struct snd_pcm *pcmC0D1p = snd_lookup_minor_data(17, SNDRV_DEVICE_TYPE_PCM_PLAYBACK);
-	 struct snd_pcm *pcmC0D2p = snd_lookup_minor_data(18, SNDRV_DEVICE_TYPE_PCM_PLAYBACK);	 
-	 struct snd_pcm *pcmC0D3p = snd_lookup_minor_data(19, SNDRV_DEVICE_TYPE_PCM_PLAYBACK);	
-	 if ((pcmC0D0p == NULL) || (pcmC0D1p == NULL) || (pcmC0D2p == NULL) || (pcmC0D3p == NULL))
-		 return  -EINVAL;	  
-	 if ((pcmC0D0p->streams[0].substream_opened && pcmC0D1p->streams[0].substream_opened) || 
-		 (pcmC0D0p->streams[0].substream_opened && pcmC0D2p->streams[0].substream_opened) || 
-		 (pcmC0D0p->streams[0].substream_opened && pcmC0D3p->streams[0].substream_opened) || 
-		 (pcmC0D1p->streams[0].substream_opened && pcmC0D2p->streams[0].substream_opened) ||
-		 (pcmC0D1p->streams[0].substream_opened && pcmC0D3p->streams[0].substream_opened) ||
-		 (pcmC0D2p->streams[0].substream_opened && pcmC0D3p->streams[0].substream_opened))
-		 BUG();
+    struct snd_pcm *pcmC0D0c = snd_lookup_minor_data(24, SNDRV_DEVICE_TYPE_PCM_CAPTURE);
+    struct snd_pcm *pcmC0D1c = snd_lookup_minor_data(25, SNDRV_DEVICE_TYPE_PCM_CAPTURE);
+    struct snd_pcm *pcmC0D2c = snd_lookup_minor_data(26, SNDRV_DEVICE_TYPE_PCM_CAPTURE);	 
+    struct snd_pcm *pcmC0D3c = snd_lookup_minor_data(27, SNDRV_DEVICE_TYPE_PCM_CAPTURE);	
+    //struct snd_pcm *pcmC0D4c = snd_lookup_minor_data(28, SNDRV_DEVICE_TYPE_PCM_CAPTURE);
+    
+    if ((pcmC0D0p == NULL) || (pcmC0D1p == NULL) || (pcmC0D2p == NULL) || (pcmC0D3p == NULL))
+    {
+        print_audio("Alsa Entered func %s, pcmC0D0p=%p, pcmC0D1p=%p, pcmC0D2p=%p, pcmC0D3p=%p\n", __func__, 
+            pcmC0D0p, pcmC0D1p, pcmC0D2p, pcmC0D3p);
+        return  -EINVAL;	  
+    }
+    if ((pcmC0D0p->streams[0].substream_opened && pcmC0D1p->streams[0].substream_opened) || 
+	    (pcmC0D0p->streams[0].substream_opened && pcmC0D2p->streams[0].substream_opened) || 
+	    (pcmC0D0p->streams[0].substream_opened && pcmC0D3p->streams[0].substream_opened) || 
+	    (pcmC0D1p->streams[0].substream_opened && pcmC0D2p->streams[0].substream_opened) ||
+	    (pcmC0D1p->streams[0].substream_opened && pcmC0D3p->streams[0].substream_opened) ||
+	    (pcmC0D2p->streams[0].substream_opened && pcmC0D3p->streams[0].substream_opened))
+    {
+        print_audio("Alsa Entered func %s error busy, pcmC0D0p.opened=%d, pcmC0D1p.opened=%d, pcmC0D2p.opened=%d, pcmC0D3p.opened=%d\n", 
+            __func__, pcmC0D0p->streams[0].substream_opened, pcmC0D1p->streams[0].substream_opened, 
+            pcmC0D2p->streams[0].substream_opened, pcmC0D3p->streams[0].substream_opened);
+        sc_debug_info_record(MODULE_ID_CAP_AUDIO, "Alsa %s err, opened value pcmC0D0p=%d, pcmC0D1p=%d, pcmC0D2p=%d, pcmC0D3p=%d\n", 
+            __func__, pcmC0D0p->streams[0].substream_opened, pcmC0D1p->streams[0].substream_opened, 
+            pcmC0D2p->streams[0].substream_opened, pcmC0D3p->streams[0].substream_opened);
+        
+        return -EBUSY;
+        //BUG();
+    }
+
+    if ((pcmC0D0c == NULL) || (pcmC0D1c == NULL) || (pcmC0D2c == NULL) || (pcmC0D3c == NULL))
+    {
+        print_audio("Alsa Entered func %s, pcmC0D0c=%p, pcmC0D1c=%p, pcmC0D2c=%p, pcmC0D3c=%p\n", __func__, 
+            pcmC0D0c, pcmC0D1c, pcmC0D2c, pcmC0D3c);
+        return  -EINVAL;	  
+    }
+    if ((pcmC0D0c->streams[1].substream_opened && pcmC0D1c->streams[1].substream_opened) || 
+        (pcmC0D0c->streams[1].substream_opened && pcmC0D2c->streams[1].substream_opened) || 
+        (pcmC0D0c->streams[1].substream_opened && pcmC0D3c->streams[1].substream_opened) || 
+        (pcmC0D1c->streams[1].substream_opened && pcmC0D2c->streams[1].substream_opened) ||
+        (pcmC0D1c->streams[1].substream_opened && pcmC0D3c->streams[1].substream_opened) ||
+        (pcmC0D2c->streams[1].substream_opened && pcmC0D3c->streams[1].substream_opened))
+    {
+        print_audio("Alsa Entered func %s error busy, pcmC0D0c.opened=%d, pcmC0D1c.opened=%d, pcmC0D2c.opened=%d,pcmC0D3c.opened=%d\n", 
+            __func__, pcmC0D0c->streams[1].substream_opened, pcmC0D1c->streams[1].substream_opened, 
+            pcmC0D2c->streams[1].substream_opened, pcmC0D3c->streams[1].substream_opened);
+        sc_debug_info_record(MODULE_ID_CAP_AUDIO, "Alsa %s err, opened value pcmC0D0c=%d, pcmC0D1c=%d, pcmC0D2c=%d, pcmC0D3c=%d\n", 
+            __func__, pcmC0D0c->streams[1].substream_opened, pcmC0D1c->streams[1].substream_opened, 
+            pcmC0D2c->streams[1].substream_opened, pcmC0D3c->streams[1].substream_opened);
+
+        return -EBUSY;
+        //BUG();
+    }
+ 
 #if 0
-	 unsigned long	flags;
-	 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
-		 gpio_set_value(ZX29_GPIO_125, GPIO_LOW);
-		 mdelay(1);  
- 
-		 raw_spin_lock_irqsave(&codec_pa_lock, flags);
-		 gpio_set_value(ZX29_GPIO_125, GPIO_HIGH);
-		 udelay(2);  
-		 gpio_set_value(ZX29_GPIO_125, GPIO_LOW);
-		 udelay(2);
-		 gpio_set_value(ZX29_GPIO_125, GPIO_HIGH);
-		 udelay(2);  
-		 gpio_set_value(ZX29_GPIO_125, GPIO_LOW);
-		 udelay(2);
-		 gpio_set_value(ZX29_GPIO_125, GPIO_HIGH);
-		 raw_spin_unlock_irqrestore(&codec_pa_lock, flags);
-	 }
+    unsigned long	flags;
+    if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+        gpio_set_value(ZX29_GPIO_125, GPIO_LOW);
+        mdelay(1);  
+
+        raw_spin_lock_irqsave(&codec_pa_lock, flags);
+        gpio_set_value(ZX29_GPIO_125, GPIO_HIGH);
+        udelay(2);  
+        gpio_set_value(ZX29_GPIO_125, GPIO_LOW);
+        udelay(2);
+        gpio_set_value(ZX29_GPIO_125, GPIO_HIGH);
+        udelay(2);  
+        gpio_set_value(ZX29_GPIO_125, GPIO_LOW);
+        udelay(2);
+        gpio_set_value(ZX29_GPIO_125, GPIO_HIGH);
+        raw_spin_unlock_irqrestore(&codec_pa_lock, flags);
+    }
 #endif
- 
- 
-	 return 0;
- }
+
+
+    return 0;
+}
+/* Ended by AICoder, pid:cd752b8f85qb5fa14ec60aceb0c11d619783bee6 */
  
  static void zx29_shutdown(struct snd_pcm_substream *substream)
  {
diff --git a/upstream/pub/include/infra/pub_debug_info.h b/upstream/pub/include/infra/pub_debug_info.h
index 95a480f..1ee2f88 100755
--- a/upstream/pub/include/infra/pub_debug_info.h
+++ b/upstream/pub/include/infra/pub_debug_info.h
@@ -36,6 +36,10 @@
 
 #define MODULE_ID_CAP_FOTA			 ("cap_fota")
 #define MODULE_ID_CAP_FS_CHECK		 ("cap_fs_check")
+
+#define MODULE_ID_PS_AUDIO           ("ps_audio")
+#define MODULE_ID_AP_AUDIO			 ("ap_audio")
+#define MODULE_ID_CAP_AUDIO			 ("cap_audio")
  
 #if defined(_USE_ZXIC_DEBUG_INFO)
 int sc_debug_info_vrecord(char *id, const char *format, va_list args);
diff --git a/upstream/pub/include/ps_phy/atipsevent.h b/upstream/pub/include/ps_phy/atipsevent.h
index 92e71e6..adc2b63 100755
--- a/upstream/pub/include/ps_phy/atipsevent.h
+++ b/upstream/pub/include/ps_phy/atipsevent.h
@@ -952,6 +952,7 @@
 #define MMIA_UMM_FAST_FREQ_SCAN_REQ_EV           (DWORD)(MMIA_UMM_EVENT_BASE + 35)

 #define MMIA_UMM_IMSAIRREL_REQ_EV                (DWORD)(MMIA_UMM_EVENT_BASE + 36)

 #define MMIA_UMM_SOFTPOWER_STATUS_IND_EV         (DWORD)(MMIA_UMM_EVENT_BASE + 37)

+#define MMIA_UMM_IMS_CALL_REQ_EV                 (DWORD)(MMIA_UMM_EVENT_BASE + 38)

 

 

 #define MMIA_UMM_PLMN_INFO_IND_EV                (DWORD)(MMIA_UMM_RSP_EVENT + 0)

@@ -1012,6 +1013,7 @@
 #define MMIA_CC_T9TIMER_QRY_REQ_EV               (DWORD)(MMIA_CC_EVENT_BASE + 18)

 #define MMIA_CC_VOICEMODE_QRY_REQ_EV             (DWORD)(MMIA_CC_EVENT_BASE + 19)

 #define MMIA_CC_RESETIVS_REQ_EV                  (DWORD)(MMIA_CC_EVENT_BASE + 20)

+#define MMIA_CC_WAITMSD_QRY_REQ_EV               (DWORD)(MMIA_CC_EVENT_BASE + 21)

 

 #define MMIA_CC_MOC_CNF_EV                       (DWORD)(MMIA_CC_RSP_EVENT + 0)

 #define MMIA_CC_MTC_IND_EV                       (DWORD)(MMIA_CC_RSP_EVENT + 1)

@@ -1048,6 +1050,7 @@
 #define MMIA_CC_CALLBACK_EVENT_EV                (DWORD)(MMIA_CC_RSP_EVENT + 32)

 #define MMIA_CC_VOICEMODE_QRY_CNF_EV             (DWORD)(MMIA_CC_RSP_EVENT + 33)

 #define MMIA_CC_RESETIVS_CNF_EV                  (DWORD)(MMIA_CC_RSP_EVENT + 34)

+#define MMIA_CC_WAITMSD_QRY_CNF_EV               (DWORD)(MMIA_CC_RSP_EVENT + 35)

 

 /* ========================================================================

    MMIA£­SMSÏûÏ¢ºÅ¶¨Òå                                                       

diff --git a/upstream/pub/include/ps_phy/psevent.h b/upstream/pub/include/ps_phy/psevent.h
index d1fbdf8..4a1897b 100755
--- a/upstream/pub/include/ps_phy/psevent.h
+++ b/upstream/pub/include/ps_phy/psevent.h
@@ -1588,6 +1588,7 @@
 #define IVS_CC_MSD_STATE_IND_EV                  (DWORD)(CM_MM_EVENT_BASE + 25)

 

 #define PSAP_UL_PCM_IND_EV                       (DWORD)(CM_MM_EVENT_BASE + 26)

+#define CC_UMM_ECALL_EVENT_IND_EV                (DWORD)(CM_MM_EVENT_BASE + 27)

 

 /* ========================================================================

    UMM£­MM/GMM/EMMÏûÏ¢ºÅ¶¨Òå

@@ -4000,6 +4001,7 @@
 /*ESM->UMM*/

 #define ESM_UMM_DETACH_REQ_EV                   (DWORD)(ESM_UMM_EVENT_BASE + 0) /*Modified:KangShuJie*/

 #define ESM_UMM_LOCAL_DEACT_IND_EV              (DWORD)(ESM_UMM_EVENT_BASE + 1)

+#define ESM_UMM_EMERPDN_DEACT_IND_EV            (DWORD)(ESM_UMM_EVENT_BASE + 2)

 

 /* ========================================================================

   SMºÍESMÄ£¿é¼äÏûÏ¢ºÅ¶¨Òå