Merge "Revert "[Bugfix][T106][bug-view-149] UART sends single character, module does not receive it.""
diff --git a/ap/app/include/audio_res_ctrl.h b/ap/app/include/audio_res_ctrl.h
index e36ffeb..fc3a5ed 100755
--- a/ap/app/include/audio_res_ctrl.h
+++ b/ap/app/include/audio_res_ctrl.h
@@ -44,6 +44,10 @@
 	REL_AUDIO_IND,      //ÇëÇóijҵÎñÄ£¿éÊÍ·ÅaudioµÄ½á¹ûÓ¦´ð£¬Èôʧ°Ü£¬¶ÏÑÔ£»»»ÑÔÖ®£¬±ØÐë³É¹¦
 	IDLE_AUDIO_INFO,     //Ö÷¿ØÍ¨ÖªËùÓÐÉêÇë¹ýAUDIO×ÊÔ´µÄÒµÎñÄ£¿é£¬¸æÖªµ±Ç°¿ÕÏУ¬ÒÔ½â¾öÒµÎñÄ£¿é´¦ÓÚ¹ÒÆð̬»ò֮ǰ±»Ç¿ÐÐÊͷŵÄÒµÎñÄ£¿é£¬ÈçMP3ÒôÀÖ²¥·ÅµÈ£»
 	EXIT_AUDIO_IND, //֪ͨÖ÷¿Ø£¬ÒµÎñÄ£¿éÍ˳öÒôƵ×ÊÔ´¾ºÕù
+//LYNQ_MODIFY_ZXW_BUG_340_202410260E4E4183_START
+	EXIT_AUDIO_REQ, 
+	EXIT_AUDIO_RSP,
+//LYNQ_MODIFY_ZXW_BUG_340_202410260E4E4183_END
 };
 
 
diff --git a/ap/app/zte_comm/zte_audio_ctrl/audio_res_ctrl.c b/ap/app/zte_comm/zte_audio_ctrl/audio_res_ctrl.c
index d7769ce..9c4237d 100755
--- a/ap/app/zte_comm/zte_audio_ctrl/audio_res_ctrl.c
+++ b/ap/app/zte_comm/zte_audio_ctrl/audio_res_ctrl.c
@@ -332,17 +332,17 @@
     slog(RTC_PRINT, SLOG_NORMAL, "%s:%s: LINE(%d), moduleId(%x), type(%x), using_type(%d), releasing_type(%d)\n",  __FILE__, __FUNCTION__, __LINE__, rel_ind_data->moduleId, rel_ind_data->type, using_type, releasing_type);
 }
 
-static void  unregister_exist_app(MSG_BUF *msg)
+//LYNQ_MODIFY_ZXW_BUG_340_202410260E4E4183_START
+static void  unregister_exist_app(int moduleId, int type)
 {
-	T_audio_ExitInd *exitIndData = (T_audio_ExitInd*)(msg->aucDataBuf);
 	T_exist_applist  *tmp = NULL;
 	T_exist_applist  *node = exist_apphead;
 
-	slog(RTC_PRINT, SLOG_NORMAL, "unregister_exist_app: moduleId(%x) type(%d) \n", exitIndData->moduleId, exitIndData->type);
+	slog(RTC_PRINT, SLOG_NORMAL, "unregister_exist_app: moduleId(%x) type(%d) \n", moduleId, type);
 	
 	while (node != NULL)
     {    	
-        if (node->src_id == exitIndData->moduleId && node->type == exitIndData->type)
+        if (node->tempSrcId == moduleId && node->type == type)
         {
         	if(NULL != tmp)
         	{
@@ -353,7 +353,7 @@
 				exist_apphead = node->next;
 			}
             free(node);
-			slog(RTC_PRINT, SLOG_NORMAL, "unregister_exist_app: %d moduleId(%x) type(%d) \n", __LINE__,exitIndData->moduleId, exitIndData->type);
+			slog(RTC_PRINT, SLOG_NORMAL, "unregister_exist_app: %d moduleId(%x) type(%d) \n", __LINE__,moduleId, type);
             return;
         }
 		tmp = node;
@@ -361,6 +361,17 @@
     }
 }
 
+static void  unregister_exist_app_proc(MSG_BUF *msg)
+{
+	T_audio_ExitInd *exitIndData = (T_audio_ExitInd*)(msg->aucDataBuf);
+	unregister_exist_app(exitIndData->moduleId, exitIndData->type);
+	if(EXIT_AUDIO_REQ == msg->usMsgCmd) {
+		if (0 > platform_send_msg(MODULE_ID_CODEC, exitIndData->moduleId, EXIT_AUDIO_RSP, 0, NULL))
+			softap_assert("unregister_exist_app_proc function: send USE_AUDIO_RSP msg error\n");
+    	}
+}
+//LYNQ_MODIFY_ZXW_BUG_340_202410260E4E4183_END
+
 /*******************************************************************************
  *                             È«¾Öº¯Êý¶¨Òå                                   *
  ******************************************************************************/
@@ -423,7 +434,10 @@
             break;
 
 		case EXIT_AUDIO_IND:
-			unregister_exist_app(&msg);
+		//LYNQ_MODIFY_ZXW_BUG_340_202410260E4E4183_START
+		case EXIT_AUDIO_REQ:
+			unregister_exist_app_proc(&msg);
+		//LYNQ_MODIFY_ZXW_BUG_340_202410260E4E4183_END
 			break;
         default:
             slog(RTC_PRINT, SLOG_NORMAL, "%s: %s LINE(%d) other msg: MsgCmd(%d), srcId(%d), dstId(%d)\n", __FILE__, __FUNCTION__, __LINE__, msg.usMsgCmd, msg.src_id, msg.dst_id);
diff --git a/ap/os/linux/linux-3.4.x/arch/arm/mach-zx297520v3/pwr_ctrl.c b/ap/os/linux/linux-3.4.x/arch/arm/mach-zx297520v3/pwr_ctrl.c
index a57002a..0a37eb4 100755
--- a/ap/os/linux/linux-3.4.x/arch/arm/mach-zx297520v3/pwr_ctrl.c
+++ b/ap/os/linux/linux-3.4.x/arch/arm/mach-zx297520v3/pwr_ctrl.c
@@ -262,6 +262,10 @@
 
 void aic8800_wifi_enable(int bval)
 {	
+	// zw.wang The WiFi-related control pins gpio132 and gpio91 are still affected after the uboot removes mmc0 on 20241031 on start
+	if (get_wifi_enable() != 1)
+		return;
+	// zw.wang The WiFi-related control pins gpio132 and gpio91 are still affected after the uboot removes mmc0 on 20241031 on end
 	int ret = 0;
 	if(bval)	
 	{	
@@ -343,6 +347,10 @@
 #if (defined CONFIG_AIC8800 || defined CONFIG_AIC8800D80L)
 void aic8800_wifi_disable(int bval)
 {	
+	// zw.wang The WiFi-related control pins gpio132 and gpio91 are still affected after the uboot removes mmc0 on 20241031 on start
+	if (get_wifi_enable() != 1)
+		return;
+	// zw.wang The WiFi-related control pins gpio132 and gpio91 are still affected after the uboot removes mmc0 on 20241031 on end
 	int ret = 0;
 	if(bval)	
 	{	
diff --git a/ap/project/zx297520v3/prj_vehicle_dc_ref/fs/normal/rootfs/bin/zte_volte_main b/ap/project/zx297520v3/prj_vehicle_dc_ref/fs/normal/rootfs/bin/zte_volte_main
old mode 100755
new mode 100644
index 48177c8..d7a06fd
--- a/ap/project/zx297520v3/prj_vehicle_dc_ref/fs/normal/rootfs/bin/zte_volte_main
+++ b/ap/project/zx297520v3/prj_vehicle_dc_ref/fs/normal/rootfs/bin/zte_volte_main
Binary files differ
diff --git a/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/liblynq-qser-gnss/liblynq-qser-gnss.bb b/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/liblynq-qser-gnss/liblynq-qser-gnss.bb
index dd600c2..287b0ba 100755
--- a/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/liblynq-qser-gnss/liblynq-qser-gnss.bb
+++ b/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/liblynq-qser-gnss/liblynq-qser-gnss.bb
@@ -46,7 +46,7 @@
 

     if [ -d "${WORKONSRC}" ] ; then

         install -d ${D}${includedir}/

-        cp -raf ${SRC-DIR}/include/ ${D}${includedir}/

+        cp -raf ${SRC-DIR}/include/lynq_qser_gnss.h ${D}${includedir}/

     fi

     if [ "${MOBILETEK_GNSS_UPDATE_ENABLE}" = "yes" ]; then

         install -d ${D}/data/gnss_update

diff --git a/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/lynq-qser-network-demo/files/lynq-qser-network-demo.cpp b/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/lynq-qser-network-demo/files/lynq-qser-network-demo.cpp
index ad38820..2d45d7d 100755
--- a/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/lynq-qser-network-demo/files/lynq-qser-network-demo.cpp
+++ b/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/lynq-qser-network-demo/files/lynq-qser-network-demo.cpp
@@ -17,6 +17,7 @@
 int (*qser_nw_client_init_p)(nw_client_handle_type  * ph_nw);

 int (*qser_nw_client_deinit_p)(nw_client_handle_type h_nw);

 int (*qser_nw_set_config_p)(nw_client_handle_type  h_nw, QSER_NW_CONFIG_INFO_T *pt_info);

+int (*qser_nw_get_config_p)(nw_client_handle_type  h_nw, QSER_NW_CONFIG_INFO_T *pt_info);

 int (*qser_nw_get_operator_name_p)(nw_client_handle_type    h_nw, QSER_NW_OPERATOR_NAME_INFO_T    *pt_info );

 int (*qser_nw_get_reg_status_p)(nw_client_handle_type  h_nw, QSER_NW_REG_STATUS_INFO_T *pt_info);

 int (*qser_nw_add_rx_msg_handler_p)(nw_client_handle_type  h_nw, QSER_NW_RxMsgHandlerFunc_t handlerPtr,void* contextPtr);

@@ -44,6 +45,7 @@
     qser_nw_client_init_p = (int (*)(nw_client_handle_type  * ph_nw))dlsym(handle_network,"qser_nw_client_init");    

     qser_nw_client_deinit_p = (int (*)(nw_client_handle_type h_nw))dlsym(handle_network,"qser_nw_client_deinit");

     qser_nw_set_config_p = (int (*)(nw_client_handle_type  h_nw, QSER_NW_CONFIG_INFO_T *pt_info))dlsym(handle_network,"qser_nw_set_config");

+    qser_nw_get_config_p = (int (*)(nw_client_handle_type  h_nw, QSER_NW_CONFIG_INFO_T *pt_info))dlsym(handle_network,"qser_nw_get_config");

     qser_nw_get_operator_name_p = (int (*)(nw_client_handle_type  h_nw, QSER_NW_OPERATOR_NAME_INFO_T  *pt_info ))dlsym(handle_network,"qser_nw_get_operator_name");

     qser_nw_get_reg_status_p = (int (*)(nw_client_handle_type  h_nw, QSER_NW_REG_STATUS_INFO_T  *pt_info))dlsym(handle_network,"qser_nw_get_reg_status");

     qser_nw_get_signal_strength_p = (int (*)(nw_client_handle_type h_nw, QSER_NW_SIGNAL_STRENGTH_INFO_T *pt_info))dlsym(handle_network,"qser_nw_get_signal_strength");

@@ -55,7 +57,7 @@
     qser_nw_set_ims_enable_p = (int (*)(nw_client_handle_type  h_nw, E_QSER_NW_IMS_MODE_TYPE_T ims_mode))dlsym(handle_network,"qser_nw_set_ims_enable");

     qser_nw_get_ims_reg_status_p = (int (*)(nw_client_handle_type  h_nw, QSER_NW_IMS_REG_STATUS_INFO_T  *pt_info))dlsym(handle_network,"qser_nw_get_ims_reg_status");

         

-    if(qser_nw_client_deinit_p==NULL || qser_nw_client_init_p==NULL || qser_nw_set_config_p ==NULL ||

+    if(qser_nw_client_deinit_p==NULL || qser_nw_client_init_p==NULL || qser_nw_set_config_p ==NULL || qser_nw_get_config_p ==NULL ||

        qser_nw_get_operator_name_p == NULL || qser_nw_get_reg_status_p ==NULL || qser_nw_add_rx_msg_handler_p==NULL ||

        qser_nw_set_rf_mode_p == NULL || qser_nw_get_rf_mode_p == NULL || qser_nw_get_oos_config_p == NULL || qser_nw_set_oos_config_p == NULL || 

        qser_nw_set_ims_enable_p == NULL || qser_nw_get_ims_reg_status_p == NULL)

@@ -100,7 +102,8 @@
     {9,     "qser_nw_get_rf_mode"},

     {10,     "qser_nw_set_ims_enable"},

     {11,     "qser_nw_get_ims_reg_status"},

-    {12,     "qser_nw_client_deinit"},      

+    {12,     "qser_nw_get_config"}, 

+    {13,     "qser_nw_client_deinit"},      

     {-1,    "quit"}

 };

 

@@ -452,7 +455,7 @@
                              

                  break;

              }                 

-             case 12://"qser_nw_client_deinit"

+             case 13://"qser_nw_client_deinit"

              {

                  ret = qser_nw_client_deinit_p(h_nw);

                  printf("qser_nw_client_deinit ret = %d\n", ret);

@@ -610,7 +613,14 @@
                          t_info.registration_state);

                  }                

                  break;

-             }                 

+             }          

+             case 12://"qser_nw_get_config"

+             {

+                 QSER_NW_CONFIG_INFO_T     t_info = {0};              

+                 ret = qser_nw_get_config_p(h_nw, &t_info);

+                 printf("qser_nw_get_config ret = %d\n, nw_mode is %llu", ret,t_info.preferred_nw_mode);

+                 break;

+             }            

              default:

              {

                  show_group_help(&t_nw_test);

diff --git a/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/lynq-qser-network-demo/files/lynq_qser_network.h b/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/lynq-qser-network-demo/files/lynq_qser_network.h
index 56e2ce0..aee4285 100755
--- a/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/lynq-qser-network-demo/files/lynq_qser_network.h
+++ b/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/lynq-qser-network-demo/files/lynq_qser_network.h
@@ -401,6 +401,12 @@
     QSER_NW_CONFIG_INFO_T     *pt_info 
 );
 
+int qser_nw_get_config
+(
+    nw_client_handle_type       h_nw,
+    QSER_NW_CONFIG_INFO_T     *pt_info 
+);
+
 int qser_nw_set_ims_enable
 (
     nw_client_handle_type h_nw,
diff --git a/cap/zx297520v3/sources/meta-zxic-selinux/recipes-security/refpolicy/files/policy-mls/policy/modules/system/logging.te b/cap/zx297520v3/sources/meta-zxic-selinux/recipes-security/refpolicy/files/policy-mls/policy/modules/system/logging.te
index fe01295..3eabb0a 100644
--- a/cap/zx297520v3/sources/meta-zxic-selinux/recipes-security/refpolicy/files/policy-mls/policy/modules/system/logging.te
+++ b/cap/zx297520v3/sources/meta-zxic-selinux/recipes-security/refpolicy/files/policy-mls/policy/modules/system/logging.te
@@ -5,6 +5,7 @@
 # Declarations
 #
 
+
 attribute logfile;
 
 type auditctl_t;
@@ -323,6 +324,8 @@
 allow klogd_t self:capability sys_admin;
 dontaudit klogd_t self:capability { sys_resource sys_tty_config };
 allow klogd_t self:process signal_perms;
+allow klogd_t kernel_t:fd { use };
+allow klogd_t root_t:chr_file { read write };
 
 manage_dirs_pattern(klogd_t, klogd_tmp_t, klogd_tmp_t)
 manage_files_pattern(klogd_t, klogd_tmp_t, klogd_tmp_t)
@@ -620,7 +623,8 @@
 	xserver_rw_console(syslogd_t)
 ')
 gen_require(`
-    type default_t;
+        type root_t;
+        type default_t;
 	type nvserver_t;
 	type mnt_t;
 	type tmpfs_t;
@@ -670,7 +674,8 @@
 allow syslogd_t default_t:lnk_file { read  };
 allow syslogd_t mnt_t:dir { search };
 allow syslogd_t tmpfs_t:dir { write add_name remove_name search };
-
+allow syslogd_t root_t:chr_file { read write };
+allow syslogd_t mnt_t:file { getattr open append };
 allow syslogd_t self:capability { sys_rawio };
 
 
diff --git a/cap/zx297520v3/sources/meta-zxic/recipes-kernel/linux-libc-headers/linux-libc-headers/0001-lynq-spidev.h.patch b/cap/zx297520v3/sources/meta-zxic/recipes-kernel/linux-libc-headers/linux-libc-headers/0001-lynq-spidev.h.patch
new file mode 100755
index 0000000..289bf13
--- /dev/null
+++ b/cap/zx297520v3/sources/meta-zxic/recipes-kernel/linux-libc-headers/linux-libc-headers/0001-lynq-spidev.h.patch
@@ -0,0 +1,30 @@
+diff --git a/include/uapi/linux/spi/spidev.h b/include/uapi/linux/spi/spidev.h
+old mode 100644
+new mode 100755
+index d56427c..d69bab6
+--- a/include/uapi/linux/spi/spidev.h
++++ b/include/uapi/linux/spi/spidev.h
+@@ -146,6 +146,22 @@ struct spi_ioc_transfer {
+ #define SPI_IOC_RD_MODE32		_IOR(SPI_IOC_MAGIC, 5, __u32)
+ #define SPI_IOC_WR_MODE32		_IOW(SPI_IOC_MAGIC, 5, __u32)
+ 
+-
++/* Read data from buffer or device */
++#define SPI_IOC_RD_RD_DATA_FROM	_IOR(SPI_IOC_MAGIC, 6, __u8)
++#define SPI_IOC_WR_RD_DATA_FROM	_IOW(SPI_IOC_MAGIC, 6, __u8)
++
++/* Set signal pid */
++#define SPI_IOC_RD_SIG_PID		_IOR(SPI_IOC_MAGIC, 7, __u32)
++#define SPI_IOC_WR_SIG_PID	    _IOW(SPI_IOC_MAGIC, 7, __u32)
++
++/* get int status */
++#define SPI_IOC_RD_INT_ST		_IOR(SPI_IOC_MAGIC, 8, __u32)
++#define SPI_IOC_WR_INT_ST	    _IOW(SPI_IOC_MAGIC, 8, __u32)
++
++/* yu.dong@20240617 [T106BUG-641] SPI packet loss problem, add kernel buffer scheme start*/
++/* release from rd/wr block */
++#define SPI_IOC_RD_BLOCK_RELEASE	_IOR(SPI_IOC_MAGIC, 9, __u32)
++//#define SPI_IOC_WR_INT_ST	    _IOW(SPI_IOC_MAGIC, 9, __u32)
++/* yu.dong@20240617 [T106BUG-641] SPI packet loss problem, add kernel buffer scheme end*/
+ 
+ #endif /* SPIDEV_H */
diff --git a/cap/zx297520v3/sources/meta-zxic/recipes-kernel/linux-libc-headers/linux-libc-headers_5.10.bb b/cap/zx297520v3/sources/meta-zxic/recipes-kernel/linux-libc-headers/linux-libc-headers_5.10.bb
index 98ea747..d528304 100755
--- a/cap/zx297520v3/sources/meta-zxic/recipes-kernel/linux-libc-headers/linux-libc-headers_5.10.bb
+++ b/cap/zx297520v3/sources/meta-zxic/recipes-kernel/linux-libc-headers/linux-libc-headers_5.10.bb
@@ -6,7 +6,7 @@
     file://0001-libc-compat.h-musl-_does_-define-IFF_LOWER_UP-DORMAN.patch \
     file://0001-include-linux-stddef.h-in-swab.h-uapi-header.patch \
    "
-
+#xf.li@20241023 modify for libc-headers start
 SRC_URI_append = "\
     file://0001-scripts-Use-fixed-input-and-output-files-instead-of-.patch \
     file://0001-kbuild-install_headers.sh-Strip-_UAPI-from-if-define.patch \
@@ -14,8 +14,9 @@
     file://0002-add-zxic-rpmsg_zx29.h.patch \
     file://0003-add-zxic-bsp_api_h.patch \
     file://0001-mtd-abi.h.patch \
+    file://0001-lynq-spidev.h.patch \
 "
-
+#xf.li@20241023 modify for libc-headers end
 LIC_FILES_CHKSUM = "file://COPYING;md5=6bc538ed5bd9a7fc9398086aedcd7e46"
 
 SRC_URI[md5sum] = "753adc474bf799d569dec4f165ed92c3"
diff --git a/cap/zx297520v3/src/lynq/framework/lynq-autosuspend/autosuspend_wakeup_count.c b/cap/zx297520v3/src/lynq/framework/lynq-autosuspend/autosuspend_wakeup_count.c
index 6a235b3..48cbe12 100755
--- a/cap/zx297520v3/src/lynq/framework/lynq-autosuspend/autosuspend_wakeup_count.c
+++ b/cap/zx297520v3/src/lynq/framework/lynq-autosuspend/autosuspend_wakeup_count.c
@@ -378,7 +378,7 @@
 #endif
 
 #ifdef MOBILETEK_SUSPEND_CFG
-int t800_early_suspend(char *wakeup_count, int wakeup_count_len)
+int t800_early_suspend(void)
 {
     char buf[80];
     system("echo \"Sys standby mode\" >/dev/console");
@@ -398,15 +398,6 @@
     RLOGD("TIME: sys to rtc\n");
     lseek(wakeup_count_fd, 0, SEEK_SET);
     system("echo \"autosuspend:Sys seek\" >/dev/console");
-    wakeup_count_len = TEMP_FAILURE_RETRY(read(wakeup_count_fd, wakeup_count,
-               200));
-    ALOGE("%s: %d, write %s to wakeup_count\n", __func__, wakeup_count_len, wakeup_count);
-    if (wakeup_count_len < 0) {
-            strerror_r(errno, buf, sizeof(buf));
-            ALOGE("Error reading from %s: %s\n", SYS_POWER_WAKEUP_COUNT, buf);
-            wakeup_count_len = 0;
-            return -1;
-     }
 
     for(int i = 0;i < 5;i++)  //notify spm (other core) to handle pre-sleep configuration
     {
@@ -451,14 +442,17 @@
 #endif
 
 
-static int suspend_ctrl(char *wakeup_count,int wakeup_count_len)
+static int suspend_ctrl(void)
 {
 
-
+    char wakeup_count[16] = {0};
+    int wakeup_count_len;
     char buf[80];
     int ret = 0;
+    int flag = -1;
+    
 #ifdef MOBILETEK_SUSPEND_CFG
-    ret = t800_early_suspend(char *wakeup_count, wakeup_count_len);
+    ret = t800_early_suspend();
     if(ret != 0)
     {
 	ALOGD("t800_early_suspend fail\n");
@@ -476,15 +470,55 @@
     }
 #endif
 
-    system("echo \"autosuspend:Sys suspend\" >/dev/console");
-    if(TEMP_FAILURE_RETRY(write(state_fd, sleep_state, strlen(sleep_state))) < 0) //enter suspend procedures in kernel
+    for(int i=0;i<5;i++)
     {
-        strerror_r(errno, buf, sizeof(buf));
-        ALOGI("Error writing to %s: %s\n", SYS_POWER_STATE, buf);
+        
+        RLOGI("suspend_ctrl: start read wakeup_count\n");
+        lseek(wakeup_count_fd, 0, SEEK_SET);
+        memset(&wakeup_count,0,sizeof(char));
+        wakeup_count_len = TEMP_FAILURE_RETRY(read(wakeup_count_fd, wakeup_count,
+               sizeof(wakeup_count)));
+        if (wakeup_count_len < 0)
+        {
+            strerror_r(errno, buf, sizeof(buf));
+            ALOGE("Error reading from %s: %s\n", SYS_POWER_WAKEUP_COUNT, buf);
+            wakeup_count_len = 0;
+            continue;
+        }
+    
+        RLOGI("suspend_ctrl: start write wakeup_count\n");
+        ret = write(wakeup_count_fd, wakeup_count, wakeup_count_len);
+        if (ret < 0)
+        {
+            strerror_r(errno, buf, sizeof(buf));
+            RLOGE("Error writing to %s: %s\n", SYS_POWER_WAKEUP_COUNT,buf);
+            continue;
+        }
+        
+        system("echo \"autosuspend:Sys suspend\" >/dev/console");
+        RLOGI("suspend_ctrl: start write power_state\n");
+        if(TEMP_FAILURE_RETRY(write(state_fd, sleep_state, strlen(sleep_state))) < 0) //enter suspend procedures in kernel
+        {
+            strerror_r(errno, buf, sizeof(buf));
+            ALOGE("Error writing to %s: %s\n", SYS_POWER_STATE, buf);
+            continue;
+        }
+        else
+        {
+            flag = 0;
+            break;
+        }
+
+    }
+    if(flag == 0)
+    {
+        return 0;
+    }
+    else
+    {
         return -1;
     }
 
-    return 0;
 }
 
 
@@ -539,7 +573,7 @@
 static void *suspend_thread_func(void *arg __attribute__((unused)))
 {
     char buf[80];
-    char wakeup_count[20];
+    char wakeup_count[16];
     int wakeup_count_len;
     int ret;
     bool success = true;
@@ -572,6 +606,20 @@
             continue;
         }
 
+
+        ret = write(wakeup_count_fd, wakeup_count, wakeup_count_len);
+        if (ret < 0) {
+            strerror_r(errno, buf, sizeof(buf));
+            RLOGD("Error writing to %s: %s\n", SYS_POWER_WAKEUP_COUNT,buf);
+            RLOGD("%s: sem_post\n", __func__);
+            ret = sem_post(&suspend_lockout);
+            if (ret < 0)
+            {
+                strerror_r(errno, buf, sizeof(buf));
+                ALOGI("Error releasing semaphore: %s\n", buf);
+            }
+            continue;
+        }
         ALOGI("%s: start suspend_ctrl\n", __func__);
         memset(&tv,0,sizeof(struct timeval));
         // memset(&time_info,0 ,sizeof(struct time_info_t));
@@ -581,7 +629,7 @@
         ALOGI("%s: suspend start time: %ld ms\n", __func__,start_time);
         // time_info.sleep_start_time = tv.tv_sec * 1000 + tv.tv_usec / 1000;
 
-        ret = suspend_ctrl(wakeup_count,wakeup_count_len);
+        ret = suspend_ctrl();
 
         if (ret >= 0) {
                 ALOGI("suspend_ctrl success.\n");
diff --git a/cap/zx297520v3/src/lynq/framework/lynq-ril-service/src/commands.h b/cap/zx297520v3/src/lynq/framework/lynq-ril-service/src/commands.h
index 8e74197..a4a872a 100755
--- a/cap/zx297520v3/src/lynq/framework/lynq-ril-service/src/commands.h
+++ b/cap/zx297520v3/src/lynq/framework/lynq-ril-service/src/commands.h
@@ -207,6 +207,9 @@
     {"LYNQ_REQUEST_CHANGE_RADIO",setRadioPower,"setRadioPower",LYNQ_REQUEST_CHANGE_RADIO},/*lei add for both radio on/off */
     {"LYNQ_REQUEST_CHANGE_SLEEP_STATE",getSleepState,"lynq get Sleep State",LYNQ_REQUEST_CHANGE_SLEEP_STATE},/*jb.qi change for suspend 2024/2/23 */
     /*Warren change for t800 ril service 2022/1/18 end*/
+    /*cz.li change for t106 ril service 2024/11/06 start*/
+    {"LYNQ_REQUEST_GET_SMSDATABASE_STATE",getsmsDatabasestatus,"lynq get smsdatabase State",LYNQ_REQUEST_GET_SMSDATABASE_STATE},
+    /*cz.li change for t106 ril service 2024/11/06 start*/
 
     #ifdef C2K_SUPPORT
     {"RIL_REQUEST_CDMA_GET_BROADCAST_SMS_CONFIG",getCdmaBroadcastConfig, "get broadcast config",RIL_REQUEST_CDMA_GET_BROADCAST_SMS_CONFIG},
diff --git a/cap/zx297520v3/src/lynq/framework/lynq-ril-service/src/ecall/eCall.cpp b/cap/zx297520v3/src/lynq/framework/lynq-ril-service/src/ecall/eCall.cpp
index 5951ee3..218c670 100755
--- a/cap/zx297520v3/src/lynq/framework/lynq-ril-service/src/ecall/eCall.cpp
+++ b/cap/zx297520v3/src/lynq/framework/lynq-ril-service/src/ecall/eCall.cpp
@@ -383,24 +383,18 @@
 
         act_fecall_socid = -1;
         act_feCall_Id = -1;
-    } 
-    else if(sig.sival_int == sT5_sig_value) {        
-        resetEcallIVSandAudio(UDP, RIL_SOCKET_ID(fast_ecall_socket_id));
-        start_ecll_timer(sT7,sT7_sig_value,T7_TIMEOUT);
-    } 
+    }
     else if(sig.sival_int == sT6_sig_value
-            || sig.sival_int == sT7_sig_value) {
+            || sig.sival_int == sT7_sig_value || sig.sival_int == sT5_sig_value) {
         stop_ecall_timer(sRedialTimer, redial_sig_value);
         redial_tag = REDIAL_SUCCESS;
         normal_ecall_tag = false;
         resetEcallIVSandAudio(UDP, RIL_SOCKET_ID(fast_ecall_socket_id));
         if(0 != T7GostEcallSmsMsd(sig))
         {
-            if(sig.sival_int == sT5_sig_value || sig.sival_int == sT7_sig_value) {
-                fast_argc = 0;
-                fast_argv.clear();
-            }
-        }
+            fast_argc = 0;
+            fast_argv.clear();
+        }        
     }
     else if(sig.sival_int == redial_sig_value) {
         redial_tag = REDIAL_EXPIRES;
diff --git a/cap/zx297520v3/src/lynq/framework/lynq-ril-service/src/lynq_interface.h b/cap/zx297520v3/src/lynq/framework/lynq-ril-service/src/lynq_interface.h
index db8e782..2a4f339 100755
--- a/cap/zx297520v3/src/lynq/framework/lynq-ril-service/src/lynq_interface.h
+++ b/cap/zx297520v3/src/lynq/framework/lynq-ril-service/src/lynq_interface.h
@@ -24,6 +24,7 @@
 #define LYNQ_REQUEST_CHANGE_SCREEN_STATE (LYNQ_REQUEST_VENDOR_BASE + 14)/*jb.qi add for two sim suspend 2022/9/19*/
 #define LYNQ_REQUEST_CHANGE_RADIO (LYNQ_REQUEST_VENDOR_BASE + 15)
 #define LYNQ_REQUEST_CHANGE_SLEEP_STATE (LYNQ_REQUEST_VENDOR_BASE + 16)/*jb.qi change for suspend 2024/2/23 start*/
+#define LYNQ_REQUEST_GET_SMSDATABASE_STATE (LYNQ_REQUEST_VENDOR_BASE + 17)
 #define LYNQ_REQUEST_SET_VOICE_AUDIO_MODE (LYNQ_REQUEST_VENDOR_BASE + 28)
 #define LYNQ_REQUEST_GET_VOICE_AUDIO_MODE (LYNQ_REQUEST_VENDOR_BASE + 21)
 
diff --git a/cap/zx297520v3/src/lynq/framework/lynq-ril-service/src/ril.cpp b/cap/zx297520v3/src/lynq/framework/lynq-ril-service/src/ril.cpp
index 19b2854..0899cbf 100755
--- a/cap/zx297520v3/src/lynq/framework/lynq-ril-service/src/ril.cpp
+++ b/cap/zx297520v3/src/lynq/framework/lynq-ril-service/src/ril.cpp
@@ -5337,6 +5337,7 @@
         case RIL_REQUEST_GET_MSISDN:return "RIL_REQUEST_GET_MSISDN";
         case RIL_REQUEST_RESET_SIMCARD:return "RIL_REQUEST_RESET_SIMCARD";
         case LYNQ_REQUEST_CHANGE_SLEEP_STATE: return "LYNQ_REQUEST_CHANGE_SLEEP_STATE";/*jb.qi change for suspend 2024/2/23 */
+        case LYNQ_REQUEST_GET_SMSDATABASE_STATE: return "LYNQ_REQUEST_GET_SMSDATABASE_STATE";
         /*warren add for t800 ril service 2022/1/22 end*/
         default: return "<unknown request>";
     }
@@ -5607,6 +5608,7 @@
         case LYNQ_REQUEST_CHANGE_SCREEN_STATE:return "LYNQ_REQUEST_CHANGE_SCREEN_STATE";/*jb.qi add for two sim sleep 2022/9/19*/
         case LYNQ_REQUEST_CHANGE_RADIO:return "LYNQ_REQUEST_CHANGE_RADIO";/*lei add for factory test of sleep 2022/9/19*/
         case LYNQ_REQUEST_CHANGE_SLEEP_STATE:return "LYNQ_REQUEST_CHANGE_SLEEP_STATE";/*jb.qi add for two sim sleep 2022/9/19*/
+        case LYNQ_REQUEST_GET_SMSDATABASE_STATE: return "LYNQ_REQUEST_GET_SMSDATABASE_STATE";
         case RIL_REQUEST_GET_MSISDN: return "GET MSISDN";
         case RIL_REQUEST_RESET_SIMCARD: return "RESET SIMCARD";
         /*warren add for t800 ril service 2022/1/22 end*/
diff --git a/cap/zx297520v3/src/lynq/framework/lynq-ril-service/src/sms/lynqSmsManager/lynq_sms_manager.cpp b/cap/zx297520v3/src/lynq/framework/lynq-ril-service/src/sms/lynqSmsManager/lynq_sms_manager.cpp
index 95b5d13..5493846 100755
--- a/cap/zx297520v3/src/lynq/framework/lynq-ril-service/src/sms/lynqSmsManager/lynq_sms_manager.cpp
+++ b/cap/zx297520v3/src/lynq/framework/lynq-ril-service/src/sms/lynqSmsManager/lynq_sms_manager.cpp
@@ -174,26 +174,37 @@
             break;

         }

     }

-    if((!sms_usable)&&(count==LYNQ_MAX_SMS_LIST))

+    if((!sms_usable)&&(count > LYNQ_MAX_SMS_LIST))

     {

        set_sms_full(true);

     }

     sqlite3_close(smsDb);

     return count;

 }

-int sms_manager::lynq_write_sms_to_memory(const char* data,const char *num,const char *smsc,const char *msg,const int charset,const int slot_id,int current,int total)

+

+int sms_manager::lynq_check_sms_full()

 {

     int id = find_unuse_sms_index(SMS_DB_PATH);

     RLOGD("[%s] id = %d\n",__FUNCTION__,id);

-    //lynq_sms_list_t * sms_list = (lynq_sms_list_t * )malloc(sizeof(lynq_sms_list_t *));

     if(!get_sms_full())

     {

+        return id;

+    }

+    LYERRLOG("sms storage space is full!!!");

+    return -1;

+}

+

+int sms_manager::lynq_write_sms_to_memory(const char* data,const char *num,const char *smsc,const char *msg,const int charset,const int slot_id,int current,int total)

+{

+    int id = lynq_check_sms_full();

+    if(id > 0)

+    {

         RLOGD("[%s] sms full is false\n",__FUNCTION__);

         lynq_write_sms_to_sms_db(id, slot_id,0,smsc, charset,data,msg,SMS_DB_PATH,num,current,total);

         return id;//sms story index

     }

-    LYERRLOG("sms storage space is full!!!");

-    return -1;

+    else

+        return -1;

 }

 int sms_manager::lynq_delete_sms_from_memory(const int index)

 {

diff --git a/cap/zx297520v3/src/lynq/framework/lynq-ril-service/src/sms/lynqSmsManager/lynq_sms_manager.h b/cap/zx297520v3/src/lynq/framework/lynq-ril-service/src/sms/lynqSmsManager/lynq_sms_manager.h
index 1aca145..51532fc 100755
--- a/cap/zx297520v3/src/lynq/framework/lynq-ril-service/src/sms/lynqSmsManager/lynq_sms_manager.h
+++ b/cap/zx297520v3/src/lynq/framework/lynq-ril-service/src/sms/lynqSmsManager/lynq_sms_manager.h
@@ -73,6 +73,7 @@
         int lynq_delete_sms_from_memory(const int index);

         int lynq_read_sms_from_memory(const int index, lynq_sms_t *sms);

         int lynq_list_sms_from_memory(const int status,lynq_sms_list_t * sms_list);

+        int lynq_check_sms_full();

         int get_sms_total()

         {

             return sms_total;

@@ -105,8 +106,8 @@
         int create_sms_table(char*path);

         int create_sms_number_table(char * path);

         int lynq_write_sms_to_sms_db(int id,int slot_id,int status,const char *smsc,int charset,const char *pdu,const char *content,char *path,const char*address,int current,int total);

-        int find_unuse_sms_index(char *path);

         int lynq_check_index(int total);

+        int find_unuse_sms_index(char *path);

         int sms_total;

         int sms_usable_id;

         bool sms_full;

diff --git a/cap/zx297520v3/src/lynq/framework/lynq-ril-service/src/sms/sms.cpp b/cap/zx297520v3/src/lynq/framework/lynq-ril-service/src/sms/sms.cpp
index 474624b..a3e19ae 100755
--- a/cap/zx297520v3/src/lynq/framework/lynq-ril-service/src/sms/sms.cpp
+++ b/cap/zx297520v3/src/lynq/framework/lynq-ril-service/src/sms/sms.cpp
@@ -67,6 +67,21 @@
     writeStringToParcel(p, (const char *)pdu);
 }
 
+int getsmsDatabasestatus(int argc, char **argv, RIL_SOCKET_ID socket_id, RequestInfo *pRI)
+{
+    android::Parcel p;
+    int id = g_smsManagement->lynq_check_sms_full();
+    RLOGD("[%s] id = %d\n",__FUNCTION__,id);
+    android::lynqAssemblyParcelheader(p,socket_id,pRI->uToken,LYNQ_REQUEST_READ_SMS_FROM_MEMORY,0,0);
+
+    p.writeInt32(id);
+
+    android::LYNQ_RIL_respSocket(p,(void *)pRI);
+    free(pRI);
+    return 0;
+}
+
+
 //RIL_REQUEST_SEND_SMS
 int sendSMS(int argc, char **argv, RIL_SOCKET_ID socket_id, RequestInfo *pRI){
     char smscPDU[30]= {0};
diff --git a/cap/zx297520v3/src/lynq/framework/lynq-ril-service/src/sms/sms.h b/cap/zx297520v3/src/lynq/framework/lynq-ril-service/src/sms/sms.h
index 82f747b..895e7db 100755
--- a/cap/zx297520v3/src/lynq/framework/lynq-ril-service/src/sms/sms.h
+++ b/cap/zx297520v3/src/lynq/framework/lynq-ril-service/src/sms/sms.h
@@ -101,6 +101,7 @@
 int deleteSmsToMemory(int argc, char **argv, RIL_SOCKET_ID socket_id, RequestInfo *pRI);
 int listSmsToMemory(int argc, char **argv, RIL_SOCKET_ID socket_id, RequestInfo *pRI);
 /*Warren change for t800 ril service 2022/1/18 end*/
-
-
+/*cz.li change for t106 ril service 2024/11/06 start*/
+int getsmsDatabasestatus(int argc, char **argv, RIL_SOCKET_ID socket_id, RequestInfo *pRI);
+/*cz.li change for t106 ril service 2022/11/06 end*/
 #endif
diff --git a/cap/zx297520v3/src/lynq/lib/liblynq-call/lynq_call.cpp b/cap/zx297520v3/src/lynq/lib/liblynq-call/lynq_call.cpp
index 3540ac0..d42142e 100755
--- a/cap/zx297520v3/src/lynq/lib/liblynq-call/lynq_call.cpp
+++ b/cap/zx297520v3/src/lynq/lib/liblynq-call/lynq_call.cpp
@@ -399,9 +399,10 @@
     pthread_cond_signal(&call_state_change_cond);

     pthread_mutex_unlock(&call_state_change_mutex);

 }

-void send_call_state_change()

+void send_call_state_change(int callid)

 {

     LYINFLOG("send call state change");

+    s_CallId = callid;

     pthread_mutex_lock(&s_call_state_change_mutex);

     pthread_cond_signal(&s_call_state_change_cond);

     pthread_mutex_unlock(&s_call_state_change_mutex);

@@ -431,16 +432,17 @@
 #endif

     pthread_mutex_lock(&s_notice_get_call_list_mutex);

     pthread_cleanup_push(cleanup_call_list_mutex, NULL); // thread cleanup handler

+    int tmp_call_id;

     while(s_call_list_loop)

     {

         update=0;       

         pthread_cond_wait(&s_notice_get_call_list_cond, &s_notice_get_call_list_mutex);

-        LYDBGLOG("triggerGetCallList event!!!");

+        LYINFLOG("triggerGetCallList event %p!!!", pthread_self());

         memset(call_list,0,sizeof(call_list));

         ret = lynq_get_current_call_list(call_list);

         if(ret != RESULT_OK)

         {

-            LYDBGLOG("get current call list failure!!!");          

+            LYERRLOG("get current call list failure!!!");

             continue;

         }

         LYINFLOG("++++++++++++++triggerGetCallList++++++++++++++");

@@ -470,12 +472,11 @@
                 if(call_end == 0)

                 {

                     LYINFLOG("MT/MO hungup,then clean call info local idx is %d id is %d",i, s_call_lists[i].call_id);

-

-                    s_CallId = s_call_lists[i].call_id;

-                    

                     //update_end_state(i);//lei modify for:update end state for this call

+                    tmp_call_id = s_call_lists[i].call_id;

                     cleanCallList(i);

-                    send_call_state_change();//means mt/mo call is end

+                    //Release the end handle

+                    send_call_state_change(tmp_call_id);//means mt/mo call is end

                     //cleanCallList(i);

                 }

             } //fix bug API-54

@@ -522,8 +523,7 @@
                 {

                     n = addAddr(call_list[i].addr,call_list[i].call_id);

                     updateCallList(&s_call_lists[n],call_list[i].call_id,call_list[i].call_state,call_list[i].toa,call_list[i].direction);

-                    s_CallId = call_list[i].call_id;

-                    send_call_state_change();

+                    send_call_state_change(call_list[i].call_id);

                 }

                 else if(s_call_lists[n].call_state == call_list[i].call_state)

                 {

@@ -535,7 +535,7 @@
                         **fix bug API-54

                         */

                         LYINFLOG("resend incoming call signal");

-                        send_call_state_change();

+                        send_call_state_change(call_list[i].call_id);

                     }

                 }

                 else 

@@ -543,8 +543,7 @@
                     LYINFLOG("state changed from %d to %d",s_call_lists[n].call_state,call_list[i].call_state);

                     

                     updateCallList(&s_call_lists[n],call_list[i].call_id,call_list[i].call_state,call_list[i].toa,call_list[i].direction);//update mt call

-                    s_CallId = call_list[i].call_id;

-                    send_call_state_change();

+                    send_call_state_change(call_list[i].call_id);

                 }                            

             }

             else

@@ -559,12 +558,11 @@
                         {

                             LYINFLOG("add a call id");

                             update=1;//for send sigal

-                            s_CallId = call_list[i].call_id;

                         }

                         LYINFLOG("local idx %d updated, original call id is %d origial addr is %s original state is %d",n,s_call_lists[n].call_id,s_call_lists[n].addr,s_call_lists[n].call_state);                    

                         updateCallList(&s_call_lists[n],call_list[i].call_id,call_list[i].call_state,call_list[i].toa,call_list[i].direction);

                         call_end = 1;

-                        send_call_state_change();//means mo call is success

+                        send_call_state_change(call_list[i].call_id);//means mo call is success

                         break;

                     }                    

                 }

@@ -612,10 +610,11 @@
 

 void lynqNoticeGetModuleCallList()

 {

+    LYINFLOG("RIL_UNSOL_RESPONSE_CALL_STATE_CHANGED send start");

     pthread_mutex_lock(&s_notice_get_call_list_mutex);

     pthread_cond_signal(&s_notice_get_call_list_cond);

     pthread_mutex_unlock(&s_notice_get_call_list_mutex);

-    

+    LYINFLOG("RIL_UNSOL_RESPONSE_CALL_STATE_CHANGED send end");

 }

 

 #if 0

@@ -767,6 +766,11 @@
 }

 

 int lynq_init_call(int utoken){

+

+    LYLOGSET(LOG_INFO);

+    LYLOGEINIT(USER_LOG_TAG);   

+    LYERRLOG("%s start, parameter is %d", __func__,utoken);

+

     if(g_module_init_flag != MODULE_CLOSED)

     {

         LYERRLOG("module state is %d",g_module_init_flag);

@@ -777,9 +781,7 @@
         return LYNQ_E_PARAMETER_ANONALY;

     }

     g_module_init_flag = MODULE_SWITCHING;

-    

-    LYLOGSET(LOG_INFO);

-    LYLOGEINIT(USER_LOG_TAG);   

+  

 

     g_module_Global_uToken = utoken; 

 

@@ -811,13 +813,14 @@
         return LYNQ_E_INNER_ERROR;

     }      

 

-

-

     g_module_init_flag = MODULE_RUNNING;

+

+    LYERRLOG("%s end suc", __func__);

     return 0;

 }

 

 int lynq_deinit_call(void){

+    LYERRLOG("%s start", __func__);

 

     if (g_module_init_flag != MODULE_RUNNING)

     {

@@ -830,6 +833,8 @@
     lynq_close_all_rc_socket_thread();    

     lynq_stop_call_list_loop();

     g_module_init_flag = MODULE_CLOSED;

+

+    LYERRLOG("%s end suc", __func__);

     return 0;

 }

 

@@ -910,14 +915,17 @@
     LYINFLOG("wait Call state Change");

     int ret = 0;

     int sec = 0;

-    int usec = 0;

+    int ms  = 0;

     struct timeval now;

     struct timespec timeout;

     gettimeofday(&now,NULL);

     sec = mtime/1000;

-    usec = mtime%1000;

+    ms  = mtime%1000;

     timeout.tv_sec = now.tv_sec+sec;

-    timeout.tv_nsec = now.tv_usec*1000+usec*1000000;

+    unsigned long long ns;

+    ns = now.tv_usec*1000ull + ms*1000000ull;

+    timeout.tv_sec += ns/1000000000;

+    timeout.tv_nsec = ns % 1000000000;

     pthread_mutex_lock(&call_state_change_mutex);

     ret = pthread_cond_timedwait(&call_state_change_cond,&call_state_change_mutex,&timeout);

     pthread_mutex_unlock(&call_state_change_mutex);

@@ -976,7 +984,7 @@
         s_module_isDial = 0;      

         LYERRLOG("lynq_call timeout:wait Call state fail!!! clear local idx %d",lynq_call_id);

         cleanCallList(lynq_call_id);

-        send_call_state_change();

+        send_call_state_change(lynq_call_id);

         return LYNQ_E_TIME_OUT;

     }

     s_module_isDial = 0;

@@ -990,7 +998,7 @@
     {   

         LYERRLOG("lynq_call dial addr %s fail, invalid id",addr);

         cleanCallList(lynq_call_id);

-        send_call_state_change();

+        send_call_state_change(lynq_call_id);

         return LYNQ_E_INVALID_ID_ANONALY;

     }        

 }

@@ -1031,21 +1039,17 @@
     if(ret!=0)

     {

         return ret; 

-    }     

+    }

     delete p; 

 

-    int  lynq_call_id=find_call_id_with_call_id(call_id);

+    int lynq_call_id=find_call_id_with_call_id(call_id);

     if(lynq_call_id!=INVALID_ID)

     {

+        //lei  modify for API-857

         cleanCallList(lynq_call_id);

-    } 

-    

-    

-    s_CallId = call_id;

-    

-    //fix bug T106BUG-56

-    send_call_state_change();

-    return RESULT_OK;     

+        send_call_state_change(call_id);

+    }

+    return RESULT_OK;

 }

 int lynq_call_hungup_all()

 {

@@ -1115,6 +1119,11 @@
         LYERRLOG("handle is NULL");

         return LYNQ_E_PARAMETER_ANONALY;

     }

+    if((*handle) <= 0)

+    {

+        LYINFLOG("lynq_get_current_call_state input error %d\n ", *handle);

+        return LYNQ_E_INVALID_ID_ANONALY;

+    }

     LYINFLOG("lynq_get_current_call_state %d\n ", *handle);

     lynq_call_id = find_call_id_with_call_id(*handle);

     if(lynq_call_id==INVALID_ID)

diff --git a/cap/zx297520v3/src/lynq/lib/liblynq-call/lynq_call_ecall.cpp b/cap/zx297520v3/src/lynq/lib/liblynq-call/lynq_call_ecall.cpp
index 23a3b45..83ddf64 100755
--- a/cap/zx297520v3/src/lynq/lib/liblynq-call/lynq_call_ecall.cpp
+++ b/cap/zx297520v3/src/lynq/lib/liblynq-call/lynq_call_ecall.cpp
@@ -599,7 +599,8 @@
        case LYNQ_ECALL_LLACK_RECEIVED:

        case LYNQ_ECALL_ALACK_POSITIVE_RECEIVED:

        case LYNQ_ECALL_ALACK_CLEARDOWN_RECEIVED:

-       //case LYNQ_ECALL_T5_TIMER_OUT:  /*when Certificate CP 1.1.10.2, no msd start (ind 1), so T5 timeout is not regard as success*/

+       case LYNQ_ECALL_T5_TIMER_OUT:  /*2022 when Certificate CP 1.1.10.2, no msd start (ind 1), so T5 timeout is not regard as success, 

+                                        20241121 still regard T5 timeout as success by hq*/

        case LYNQ_ECALL_T6_TIMER_OUT:

        case LYNQ_ECALL_T7_TIMER_OUT:                          

            if(s_module_is_ecall_dial)

diff --git a/cap/zx297520v3/src/lynq/lib/liblynq-qser-data/lynq-qser-data.cpp b/cap/zx297520v3/src/lynq/lib/liblynq-qser-data/lynq-qser-data.cpp
index 23a7831..179e549 100755
--- a/cap/zx297520v3/src/lynq/lib/liblynq-qser-data/lynq-qser-data.cpp
+++ b/cap/zx297520v3/src/lynq/lib/liblynq-qser-data/lynq-qser-data.cpp
@@ -1270,6 +1270,30 @@
     return RESULT_OK;
 }
 
+static void acquire_wake_lock()
+{
+    int ret = 0;
+
+    ret = system("echo data_call_wakelock 5000000000 > /sys/power/wake_lock");//timeout 5s
+    if(ret != 0)
+    {
+        LYERRLOG("acquire_wake_lock error !!!");
+    }
+    return;
+}
+
+static void release_wake_lock()
+{
+    int ret = 0;
+    
+    ret = system("echo data_call_wakelock > /sys/power/wake_unlock");
+    if(ret != 0)
+    {
+        LYERRLOG("release_wake_lock error !!!");
+    }
+    return;
+}
+
 void *thread_wait_cb_status(void)
 {
     int handle = -1;
@@ -1289,6 +1313,7 @@
         {
             continue;
         }
+        acquire_wake_lock();
         LYINFLOG("[thread_wait_cb_status]: handle = %d", handle);
         memset(&data_urc_info, 0, sizeof(data_urc_info));
         memset(&data_cb_state, 0, sizeof(data_cb_state));
@@ -1350,12 +1375,15 @@
         }
         else
         {
+            release_wake_lock();
             LYERRLOG("unknow ip_family");
             continue;
         }
         if (s_data_call_cb != NULL)
         {
-         s_data_call_cb(&data_cb_state);
+            s_data_call_cb(&data_cb_state);
+            release_wake_lock();
+            LYINFLOG("[%s] call back s_data_call_cb end", __FUNCTION__);
         }
     }
     return NULL;
diff --git a/cap/zx297520v3/src/lynq/lib/liblynq-qser-gnss/include/lynq_qser_gnss.h b/cap/zx297520v3/src/lynq/lib/liblynq-qser-gnss/include/lynq_qser_gnss.h
index ed70d21..8208056 100755
--- a/cap/zx297520v3/src/lynq/lib/liblynq-qser-gnss/include/lynq_qser_gnss.h
+++ b/cap/zx297520v3/src/lynq/lib/liblynq-qser-gnss/include/lynq_qser_gnss.h
@@ -3,31 +3,20 @@
 #ifdef __cplusplus
 extern "C" {
 #endif
-struct mbtk_gnss_handle_t
-{
-    int dev_fd;
-    pthread_t  uart_pthread;
-    pthread_t  gnss_pthread;
-    gnss_handler_func_t gnss_handler_func;
-    int mode; // 0 - stop, 1 - single, 2 - periodic, 3 - start
-    pthread_mutex_t _cond_mutex;
-    int reset_state;
-    int inited;
-    ring_buffer_t ring_buffer;
-    int getap_status;
-    char *rb;
 
-#if TTFF_TEST
-    pthread_t ttff_pid;
-    int location_state;
-#endif
-    /********************
-    save handle's adr
-    phandle = &handle
-    handle  = mbtk_gnss_handle
-    *********************/
-    uint32_t *phandle; // handle's adr
-};
+typedef enum
+{
+    E_MT_LOC_MSG_ID_LOCATION_INFO = 1,          /**<  pv_data = &QL_LOC_LOCATION_INFO_T  */
+    E_MT_LOC_MSG_ID_NMEA_INFO = 3,              /**<  pv_data = &QL_LOC_NMEA_INFO_T  */
+}e_msg_id_t; //0,2reserve
+
+typedef void (*gnss_handler_func_t)
+(
+        uint32_t    h_loc,
+        e_msg_id_t  e_msg_id,
+        void        *pv_data,
+        void        *context_ptr
+);
 
 typedef struct 
 {
@@ -78,7 +67,7 @@
 };
 
 
-#endif
+
 typedef struct 
 {
     uint32_t year; // 大于1980
@@ -129,7 +118,8 @@
 int qser_Gnss_injectEphemeris(uint32_t h_gnss);
 int qser_Gnss_download_tle();
 int qser_Gnss_injectEphemeris_withpath(uint32_t h_gnss, char *path);
+
 #ifdef __cplusplus
 }
 #endif
-
+#endif
diff --git a/cap/zx297520v3/src/lynq/lib/liblynq-qser-gnss/include/mbtk_gnss_internal.h b/cap/zx297520v3/src/lynq/lib/liblynq-qser-gnss/include/mbtk_gnss_internal.h
index 5602ffe..6e0c903 100755
--- a/cap/zx297520v3/src/lynq/lib/liblynq-qser-gnss/include/mbtk_gnss_internal.h
+++ b/cap/zx297520v3/src/lynq/lib/liblynq-qser-gnss/include/mbtk_gnss_internal.h
@@ -4,10 +4,13 @@
 #define __MBTK_GNSS_H__
 #include <sc_bsp.h>
 #include "ringbuffer.h"
+#include "lynq_qser_gnss.h"
 #ifdef __cplusplus
 extern "C" {
 #endif
 
+
+
 /*
 GGA: GNSS 定位数据
 $GNGGA,,,,,,0,00,99.99,,,,,,*56
@@ -132,13 +135,7 @@
     char crc;
 };
 
-typedef uint32_t gnss_client_handle_type;
 
-typedef enum
-{
-    E_MT_LOC_MSG_ID_LOCATION_INFO = 1,          /**<  pv_data = &QL_LOC_LOCATION_INFO_T  */
-    E_MT_LOC_MSG_ID_NMEA_INFO = 3,              /**<  pv_data = &QL_LOC_NMEA_INFO_T  */
-}e_msg_id_t;  //0,2reserve
 
 #define     QL_LOC_MAX_SEVER_ADDR_LENGTH    255 /**  Maximum generic server address length for the host name. */
 typedef struct 
@@ -157,13 +154,33 @@
     E_QL_LOC_STATUS_ENGINE_OFF      = 4, /**<  GPS is powered off.  */
 }E_QL_LOC_STATUS_VALUE_T;
 
-typedef void (*gnss_handler_func_t)
-(
-        uint32_t    h_loc,
-        e_msg_id_t  e_msg_id,
-        void        *pv_data,
-        void        *context_ptr
-        );
+struct mbtk_gnss_handle_t
+{
+    int dev_fd;
+    pthread_t  uart_pthread;
+    pthread_t  gnss_pthread;
+    gnss_handler_func_t gnss_handler_func;
+    int mode; // 0 - stop, 1 - single, 2 - periodic, 3 - start
+    pthread_mutex_t _cond_mutex;
+    int reset_state;
+    int inited;
+    ring_buffer_t ring_buffer;
+    int getap_status;
+    char *rb;
+    e_msg_id_t e_msg_id;
+    
+#if TTFF_TEST
+    pthread_t ttff_pid;
+    int location_state;
+#endif
+    /********************
+    存储handle的地址指针
+    phandle = &handle
+    handle  = mbtk_gnss_handle
+    *********************/
+    uint32_t *phandle; // handle的地址指针
+};
+
 
 struct mopen_location_info_t
 {
@@ -325,7 +342,6 @@
 int mopen_gnss_print_version(uint32 h_gnss);
 int lynq_gnss_client_init(uint32 *ph_gnss);
 int lynq_gnss_client_deinit(uint32 h_gnss);
-int mopen_gnss_add_rx_msg_handler(uint32 h_gnss, gnss_handler_func_t handler_ptr);
 int mopen_gnss_set_mode(uint32 h_gnss, int mode);
 int mopen_gnss_set_system_config(uint32 h_gnss, int mode);
 int mopen_gnss_set_nema_config(uint32 h_gnss, int mode);
diff --git a/cap/zx297520v3/src/lynq/lib/liblynq-qser-gnss/src/mbtk_gnss.cpp b/cap/zx297520v3/src/lynq/lib/liblynq-qser-gnss/src/mbtk_gnss.cpp
index 360011b..0706884 100755
--- a/cap/zx297520v3/src/lynq/lib/liblynq-qser-gnss/src/mbtk_gnss.cpp
+++ b/cap/zx297520v3/src/lynq/lib/liblynq-qser-gnss/src/mbtk_gnss.cpp
@@ -102,32 +102,7 @@
     }   
 }
 
-struct mbtk_gnss_handle_t
-{
-    int dev_fd;
-    pthread_t  uart_pthread;
-    pthread_t  gnss_pthread;
-    gnss_handler_func_t gnss_handler_func;
-    int mode; // 0 - stop, 1 - single, 2 - periodic, 3 - start
-    pthread_mutex_t _cond_mutex;
-    int reset_state;
-    int inited;
-    ring_buffer_t ring_buffer;
-    int getap_status;
-    char *rb;
-    e_msg_id_t e_msg_id;
-    
-#if TTFF_TEST
-    pthread_t ttff_pid;
-    int location_state;
-#endif
-    /********************
-    存储handle的地址指针
-    phandle = &handle
-    handle  = mbtk_gnss_handle
-    *********************/
-    uint32_t *phandle; // handle的地址指针
-};
+
 #if TTFF_TEST
 struct mbtk_gnss_ttff_t
 {
@@ -1412,18 +1387,6 @@
     return 0;
 }
 
-int mopen_gnss_add_rx_msg_handler(uint32 h_gnss, gnss_handler_func_t handler_ptr)
-{
-    struct mbtk_gnss_handle_t *gnss_handle = (struct mbtk_gnss_handle_t *)h_gnss;
-    if(0 == h_gnss && NULL == handler_ptr)
-    {
-        printf("%s handler invalid.\n", __func__);
-        return -1;
-    }
-    gnss_handle->gnss_handler_func = handler_ptr;
-    return 0;
-}
-
 #define AGNSS_TLE_FILE  "/mnt/userdata/agnss_tle"
 
 static void http_data_cb_func(
diff --git a/cap/zx297520v3/src/lynq/lib/liblynq-qser-network/include/lynq_qser_network.h b/cap/zx297520v3/src/lynq/lib/liblynq-qser-network/include/lynq_qser_network.h
index dcfb9b7..b5abbc7 100755
--- a/cap/zx297520v3/src/lynq/lib/liblynq-qser-network/include/lynq_qser_network.h
+++ b/cap/zx297520v3/src/lynq/lib/liblynq-qser-network/include/lynq_qser_network.h
@@ -401,6 +401,12 @@
     QSER_NW_CONFIG_INFO_T     *pt_info 
 );
 
+int qser_nw_get_config
+(
+    nw_client_handle_type       h_nw,
+    QSER_NW_CONFIG_INFO_T     *pt_info 
+);
+
 int qser_nw_set_ims_enable
 (
     nw_client_handle_type h_nw,
diff --git a/cap/zx297520v3/src/lynq/lib/liblynq-qser-network/lynq_qser_network.cpp b/cap/zx297520v3/src/lynq/lib/liblynq-qser-network/lynq_qser_network.cpp
index 6d211d9..82a1b8f 100755
--- a/cap/zx297520v3/src/lynq/lib/liblynq-qser-network/lynq_qser_network.cpp
+++ b/cap/zx297520v3/src/lynq/lib/liblynq-qser-network/lynq_qser_network.cpp
@@ -60,7 +60,7 @@
 } RIL_PreferredNetworkType;
 #endif
 
-int switch_preferred_nw_mode(const uint64_t preferred_nw_mode)
+int switch_preferred_nw_mode(const uint64_t preferred_nw_mode, int dir)
 {
     uint32_t map[23]={    
             0xffff,                                                               //PREF_NET_TYPE_GSM_WCDMA                = 0, /* GSM/WCDMA (WCDMA preferred) */
@@ -87,16 +87,34 @@
             QSER_NW_MODE_TDSCDMA | QSER_NW_MODE_GSM | QSER_NW_MODE_WCDMA | QSER_NW_MODE_CDMA | QSER_NW_MODE_EVDO,                     //PREF_NET_TYPE_TD_SCDMA_GSM_WCDMA_CDMA_EVDO_AUTO  = 21, /* TD-SCDMA, GSM/WCDMA, CDMA and EvDo */
             QSER_NW_MODE_TDSCDMA | QSER_NW_MODE_LTE | QSER_NW_MODE_CDMA  |QSER_NW_MODE_EVDO | QSER_NW_MODE_GSM | QSER_NW_MODE_WCDMA,  //PREF_NET_TYPE_TD_SCDMA_LTE_CDMA_EVDO_GSM_WCDMA   = 22,  /* TD-SCDMA, LTE, CDMA, EvDo GSM/WCDMA */
     };
-    int array_length=sizeof (map)/ sizeof (map[0]);
 
-    for(int i=1;i<array_length;i++)
-    {
-        if(map[i]==preferred_nw_mode)
-        {
-            return i;
-        }
+    int array_length = sizeof (map)/ sizeof (map[0]);
+
+    if(dir==0)
+    {               
+         for(int i=1;i<array_length;i++)
+         {
+             if(map[i]==preferred_nw_mode)
+             {
+                 return i;
+             }
+         }         
     }
-    
+    else
+    {
+        if(preferred_nw_mode < array_length)
+        {
+            if(preferred_nw_mode!=0)
+            {
+                return map[preferred_nw_mode];
+            }
+            else
+            {
+                /*0 respond to gsm and wcdma, prefer wcdma*/
+                return (QSER_NW_MODE_GSM | QSER_NW_MODE_WCDMA);
+            }
+        }    
+    }   
     return INVALID_PREFER_TYPE;
 }
 
@@ -256,7 +274,7 @@
         LYINFLOG("pthread join waiting urc thread ret = %d",ret);
         s_new_network_tid =-1;
     }
-	
+    
     s_handlerPtr=NULL;
     s_contextPtr=NULL;
 
@@ -288,7 +306,7 @@
         return RESULT_ERROR;
     }    
     
-    pretype = switch_preferred_nw_mode(pt_info->preferred_nw_mode);
+    pretype = switch_preferred_nw_mode(pt_info->preferred_nw_mode,0);
     if (pretype ==INVALID_PREFER_TYPE)
     {
         LYERRLOG("invalid client parameters incoming %d",pt_info->preferred_nw_mode);
@@ -304,6 +322,38 @@
     return RESULT_OK;
 }
 
+int qser_nw_get_config(nw_client_handle_type h_nw, QSER_NW_CONFIG_INFO_T *pt_info)
+{
+    if(NULL == pt_info)
+    {
+        LYERRLOG("invalid client parameters incoming");
+        return RESULT_ERROR;
+    }
+    
+    if(h_nw != g_ph_hw || h_nw == INVALID_CLIENT_HANDLE)
+    {
+        LYERRLOG("h_nw not right %d %d",h_nw,g_ph_hw);
+        return RESULT_ERROR;
+    }    
+    int pretype;
+    int ret = lynq_query_prefferred_networktype(&pretype);
+    if (ret != RESULT_OK)
+    {
+        LYERRLOG("lynq_get_prefferred_networktype failed ret is %d",ret);
+        return RESULT_ERROR;
+    }
+
+    int preferred_nw_mode = switch_preferred_nw_mode(pretype,1);
+    if (preferred_nw_mode ==INVALID_PREFER_TYPE)
+    {
+        LYERRLOG("invalid pretype %d",pretype);
+        return RESULT_ERROR;
+    }
+    pt_info->preferred_nw_mode=preferred_nw_mode;
+    return RESULT_OK;
+}
+
+
 int qser_nw_set_ims_enable(nw_client_handle_type h_nw,E_QSER_NW_IMS_MODE_TYPE_T ims_mode)
 { 
     if(h_nw != g_ph_hw || h_nw == INVALID_CLIENT_HANDLE)
diff --git a/cap/zx297520v3/src/lynq/lib/liblynq-qser-sms/include/lynq_qser_sms.h b/cap/zx297520v3/src/lynq/lib/liblynq-qser-sms/include/lynq_qser_sms.h
index 7276fca..0d102f0 100755
--- a/cap/zx297520v3/src/lynq/lib/liblynq-qser-sms/include/lynq_qser_sms.h
+++ b/cap/zx297520v3/src/lynq/lib/liblynq-qser-sms/include/lynq_qser_sms.h
@@ -211,6 +211,10 @@
 int qser_sms_setsmscenteraddress( sms_client_handle_type     h_sms,
                        QSER_sms_service_center_cfg_t *get_sca_cfg);
 
+/* Get sms Database status.
+*/
+int qser_sms_getDatabasestatus();
+
 /*
 Usage 1 (register callback and wait for new sms arrive): 
 1, qser_sms_client_init
diff --git a/cap/zx297520v3/src/lynq/lib/liblynq-qser-sms/lynq_qser_sms.cpp b/cap/zx297520v3/src/lynq/lib/liblynq-qser-sms/lynq_qser_sms.cpp
index a86d8a5..1990166 100755
--- a/cap/zx297520v3/src/lynq/lib/liblynq-qser-sms/lynq_qser_sms.cpp
+++ b/cap/zx297520v3/src/lynq/lib/liblynq-qser-sms/lynq_qser_sms.cpp
@@ -204,5 +204,9 @@
     return lynq_set_smsc_address(get_sca_cfg->service_center_addr);
 }
 
+int qser_sms_getDatabasestatus()
+{
+    return(lynq_get_smsdatabase_status());
+}
 DEFINE_LYNQ_LIB_LOG(LYNQ_QSER_SMS)
 
diff --git a/cap/zx297520v3/src/lynq/lib/liblynq-sms/include/libsms/lynq_sms.h b/cap/zx297520v3/src/lynq/lib/liblynq-sms/include/libsms/lynq_sms.h
index 0d346a6..cdd7b30 100755
--- a/cap/zx297520v3/src/lynq/lib/liblynq-sms/include/libsms/lynq_sms.h
+++ b/cap/zx297520v3/src/lynq/lib/liblynq-sms/include/libsms/lynq_sms.h
@@ -22,6 +22,7 @@
 int lynq_list_sms(char index_list[SMS_NUM_MAX]);

 int lynq_delete_sms(int index);

 int lynq_wait_receive_new_sms(int *handle);

+int lynq_get_smsdatabase_status();

 #ifdef __cplusplus

 }

 #endif

diff --git a/cap/zx297520v3/src/lynq/lib/liblynq-sms/lynq_module_common.h b/cap/zx297520v3/src/lynq/lib/liblynq-sms/lynq_module_common.h
index 60719ef..9a3d58e 100755
--- a/cap/zx297520v3/src/lynq/lib/liblynq-sms/lynq_module_common.h
+++ b/cap/zx297520v3/src/lynq/lib/liblynq-sms/lynq_module_common.h
@@ -30,6 +30,7 @@
 #define LYNQ_REQUEST_OOS_DEEP_SLEEP_RECOVER_TIMER_INTERVAL (LYNQ_REQUEST_VENDOR_BASE +13)

 #define LYNQ_REQUEST_CHANGE_SCREEN_STATE (LYNQ_REQUEST_VENDOR_BASE + 14)/*jb.qi add for two sim suspend 2022/9/19*/

 #define LYNQ_REQUEST_CHANGE_RADIO (LYNQ_REQUEST_VENDOR_BASE + 15)

+#define LYNQ_REQUEST_GET_SMSDATABASE_STATE (LYNQ_REQUEST_VENDOR_BASE + 17)

 /*the same with lynq_interface.h end*/

 

 typedef enum{

diff --git a/cap/zx297520v3/src/lynq/lib/liblynq-sms/lynq_module_socket.cpp b/cap/zx297520v3/src/lynq/lib/liblynq-sms/lynq_module_socket.cpp
index 8d012da..1926a23 100755
--- a/cap/zx297520v3/src/lynq/lib/liblynq-sms/lynq_module_socket.cpp
+++ b/cap/zx297520v3/src/lynq/lib/liblynq-sms/lynq_module_socket.cpp
@@ -228,7 +228,6 @@
     lynq_client_t client;

     int ret;

     int send_num;

-    

     client.uToken = g_module_Global_uToken;

     g_module_Global_uToken=(g_module_Global_uToken+1)%10000;/*0-10000*/

     client.request = request_id;

@@ -593,6 +592,7 @@
         case LYNQ_REQUEST_READ_SMS_FROM_MEMORY:

         case LYNQ_REQUEST_DELETE_SMS_FROM_MEMORY:

         case LYNQ_REQUEST_LIST_SMS_FROM_MEMORY:

+        case LYNQ_REQUEST_GET_SMSDATABASE_STATE:

             return true;

         default:

             return false;

@@ -1034,6 +1034,9 @@
         case LYNQ_REQUEST_CHANGE_SCREEN_STATE:return "LYNQ_REQUEST_CHANGE_SCREEN_STATE";/*jb.qi add for two sim sleep 2022/9/19*/

         case LYNQ_REQUEST_CHANGE_RADIO:return "LYNQ_REQUEST_CHANGE_RADIO";/*lei add for factory test of sleep 2022/9/19*/

         /*warren add for t800 ril service 2022/1/22 end*/

+        /*cz.li change for t106 ril service 2024/11/06 start*/

+        case LYNQ_REQUEST_GET_SMSDATABASE_STATE:return "LYNQ_REQUEST_GET_SMSDATABASE_STATE";

+        /*cz.li change for t106 ril service 2024/11/06 start*/

         default: return "<unknown request>";

     }

 }

diff --git a/cap/zx297520v3/src/lynq/lib/liblynq-sms/lynq_sms.cpp b/cap/zx297520v3/src/lynq/lib/liblynq-sms/lynq_sms.cpp
index 9d5ef30..d45ff0a 100755
--- a/cap/zx297520v3/src/lynq/lib/liblynq-sms/lynq_sms.cpp
+++ b/cap/zx297520v3/src/lynq/lib/liblynq-sms/lynq_sms.cpp
@@ -210,6 +210,22 @@
     return RESULT_OK;

 }

 

+int lynq_get_smsdatabase_status()

+{

+    Parcel* p=NULL;

+    int states=0;

+    int ret=lynq_send_common_request(p,g_wait_time,LYNQ_REQUEST_GET_SMSDATABASE_STATE,0,"");

+    if(ret!=0)

+    {

+        return ret;

+    }

+    LYDBGLOG("LYNQ_REQUEST_GET_SMSDATABASE_STATE SUCCESS!");

+    p->readInt32(&states);

+    delete p;

+    return states;

+}

+

+

 int lynq_get_smsc_address(char service_num[SMSC_MAX_LEN])

 {

     if(g_module_init_flag != MODULE_RUNNING)

diff --git a/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/drivers/soc/sc/pcu/pcu-zx297520v3.c b/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/drivers/soc/sc/pcu/pcu-zx297520v3.c
index f9b23d7..e8d8e88 100755
--- a/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/drivers/soc/sc/pcu/pcu-zx297520v3.c
+++ b/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/drivers/soc/sc/pcu/pcu-zx297520v3.c
@@ -729,7 +729,7 @@
 	switch (action) {
 
 	case PM_POST_SUSPEND:
-		__pm_wakeup_event(zx_main_ws, 1000);		
+		__pm_wakeup_event(zx_main_ws, 500);//LYNQ_AUTOSUSPEND add for bug-view-372 by jb.qi on 20241114	
 		break;
 
 	default:
diff --git a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/include/audio_res_ctrl.h b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/include/audio_res_ctrl.h
index 2ab4da9..453e877 100755
--- a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/include/audio_res_ctrl.h
+++ b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/include/audio_res_ctrl.h
@@ -47,6 +47,10 @@
 	REL_AUDIO_IND,      //ÇëÇóijҵÎñÄ£¿éÊÍ·ÅaudioµÄ½á¹ûÓ¦´ð£¬Èôʧ°Ü£¬¶ÏÑÔ£»»»ÑÔÖ®£¬±ØÐë³É¹¦
 	IDLE_AUDIO_INFO,     //Ö÷¿ØÍ¨ÖªËùÓÐÉêÇë¹ýAUDIO×ÊÔ´µÄÒµÎñÄ£¿é£¬¸æÖªµ±Ç°¿ÕÏУ¬ÒÔ½â¾öÒµÎñÄ£¿é´¦ÓÚ¹ÒÆð̬»ò֮ǰ±»Ç¿ÐÐÊͷŵÄÒµÎñÄ£¿é£¬ÈçMP3ÒôÀÖ²¥·ÅµÈ£»
 	EXIT_AUDIO_IND, //֪ͨÖ÷¿Ø£¬ÒµÎñÄ£¿éÍ˳öÒôƵ×ÊÔ´¾ºÕù
+	//LYNQ_MODIFY_ZXW_BUG_340_202410260E4E4183_START
+	EXIT_AUDIO_REQ,
+	EXIT_AUDIO_RSP,
+	//LYNQ_MODIFY_ZXW_BUG_340_202410260E4E4183_END
 };
 
 
diff --git a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/libatreg/atreg.c b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/libatreg/atreg.c
index 5210d43..67bb391 100755
--- a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/libatreg/atreg.c
+++ b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/libatreg/atreg.c
@@ -285,20 +285,20 @@
  * @note         ÎÞ

  * @warning      ÎÞ

  */

-static void atreg_ser_allocation_proc(void* patreg_ser_instance)

+static int atreg_ser_allocation_proc(void* patreg_ser_instance)

 {

 	int i,j;

     pthread_mutex_lock(&atreg_ser_ctx.at_ser_idpool_lock);

-	for (i =0; i < ATREG_SER_ID_MAX; i++) {

+	for (i = 0; i < ATREG_SER_ID_MAX; i++) {

 		for (j = 7; j >= 0; j--) {

-			if (0 == atreg_ser_dynamic_idpool[i] & (1 << j)) {

+			if (0 == (int)(atreg_ser_dynamic_idpool[i] & (1 << j))) {

 				((struct atreg_ser_instance_t *)patreg_ser_instance)->req_msg_id = 8 * (i + 1) - (j + 1);

 				((struct atreg_ser_instance_t *)patreg_ser_instance)->rsp_msg_id = 8 * (i + 1) - (j + 1) + 1;

 				atreg_ser_dynamic_idpool[i] = atreg_ser_dynamic_idpool[i] | (1 << j);

 				atreg_ser_dynamic_idpool[i] = atreg_ser_dynamic_idpool[i] | (1 << (j - 1));

 				pthread_mutex_unlock(&atreg_ser_ctx.at_ser_idpool_lock);

 

-				return;

+				return 0;

 			}

 		}

 	}

@@ -306,7 +306,7 @@
 

 	slog(ATREG_PRINT, SLOG_ERR, "Err: atreg_ser_allocation_proc id pool is FULL\n");

 	

-	return;

+	return -1;

 }

 

 

@@ -317,18 +317,18 @@
  * @note         ÎÞ

  * @warning      ÎÞ

  */

-static void atreg_info_allocation_proc(void* patreg_info_instance)

+static int atreg_info_allocation_proc(void* patreg_info_instance)

 {

 	int i,j;

     pthread_mutex_lock(&atreg_info_ctx.at_info_idpool_lock);

 	for (i = 0; i < ATREG_INFO_ID_MAX; i++) {

 		for (j = 7; j >= 0; j--) {

-			if (0 == atreg_info_dynamic_idpool[i] & (1 << j)) {

+			if (0 == (int)(atreg_info_dynamic_idpool[i] & (1 << j))) {

 				((struct atreg_info_instance_t *)patreg_info_instance)->req_msg_id = 8 * (i + 1) - (j + 1) + 512;

 				atreg_info_dynamic_idpool[i] = atreg_info_dynamic_idpool[i] | (1 << j);

 				pthread_mutex_unlock(&atreg_info_ctx.at_info_idpool_lock);

 

-				return;

+				return 0;

 			}

 		}

 	}

@@ -336,7 +336,7 @@
 

 	slog(ATREG_PRINT, SLOG_ERR, "Err: atreg_info_allocation_proc id pool is FULL\n");

 	

-	return;

+	return -1;

 }

 

 

@@ -348,20 +348,25 @@
  * @note         ÎÞ

  * @warning      ÎÞ

  */

-static void atreg_dynamic_id_allocation(void* patreg_instance, int atreg_type)

+static int atreg_dynamic_id_allocation(void* patreg_instance, int atreg_type)

 {

+	int ret = -1;

+

 	switch (atreg_type) {

 		case AT_REG_SER:

-			atreg_ser_allocation_proc(patreg_instance);

+			ret = atreg_ser_allocation_proc(patreg_instance);

 			break;

 

 		case AT_REG_INFO:

-			atreg_info_allocation_proc(patreg_instance);

+			ret = atreg_info_allocation_proc(patreg_instance);

 			break;

 

 		default:

+			slog(ATREG_PRINT, SLOG_ERR, "Err: atreg_dynamic_id_allocation type invalid\n");

 			break;

 	}

+

+	return ret;

 }

 

 /**

@@ -435,7 +440,11 @@
 	}

 

 	/* ¶¯Ì¬·ÖÅäreq_msg_idÓërsp_msg_id */

-	atreg_dynamic_id_allocation((void *)patreg_ser_instance, AT_REG_SER);

+	if (0 != atreg_dynamic_id_allocation((void *)patreg_ser_instance, AT_REG_SER))

+	{

+		slog(ATREG_PRINT, SLOG_ERR, "Err: serv atreg_dynamic_id_allocation fail\n");

+		return -1;

+	}

 		

     /* »º´æatʵÀý */

     pthread_mutex_lock(&atreg_ser_ctx.at_ser_lock_tmp);

@@ -567,7 +576,11 @@
 	}

 

 	/* ¶¯Ì¬·ÖÅäreq_msg_id */

-	atreg_dynamic_id_allocation((void *)patreg_info_instance, AT_REG_INFO);

+	if (0 != atreg_dynamic_id_allocation((void *)patreg_info_instance, AT_REG_INFO))

+	{

+		slog(ATREG_PRINT, SLOG_ERR, "Err: info atreg_dynamic_id_allocation fail\n");

+		return -1;

+	}

 	

     /* »º´æatʵÀý */

     pthread_mutex_lock(&atreg_info_ctx.at_info_lock_tmp);

diff --git a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/libsoftap/audio_res_request_api.c b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/libsoftap/audio_res_request_api.c
index 85757ac..6618f5d 100755
--- a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/libsoftap/audio_res_request_api.c
+++ b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/libsoftap/audio_res_request_api.c
@@ -37,7 +37,10 @@
  *							   ºê¶¨Òå								   *
  ******************************************************************************/
 #define AUDIORES_EXIT (0xff)
-#define AUDIORES_EXIT_INTERVAL_NS     10000000
+//LYNQ_MODIFY_ZXW_BUG_340_202410260E4E4183_START
+#define AUDIORES_EXIT_INTERVAL_SEC         1
+#define AUDIORES_REQUEST_TIMEOUT_SEC       5
+//LYNQ_MODIFY_ZXW_BUG_340_202410260E4E4183_END
 
 /*******************************************************************************
  *							   Êý¾ÝÀàÐͶ¨Òå 							   *
@@ -180,7 +183,9 @@
 				paudiores->callbacks->audiores_read_callback(msgbuf.usMsgCmd, (void *)msgbuf.aucDataBuf, paudiores->priv);
 			}
 		}
-		else if(AUDIORES_EXIT == msgbuf.usMsgCmd) {
+		//LYNQ_MODIFY_ZXW_BUG_340_202410260E4E4183_START
+		else if(AUDIORES_EXIT == msgbuf.usMsgCmd || EXIT_AUDIO_RSP == msgbuf.usMsgCmd) {
+		//LYNQ_MODIFY_ZXW_BUG_340_202410260E4E4183_END
 			if(NULL != paudiores->callbacks->audiores_destroy_callback) {
 				paudiores->callbacks->audiores_destroy_callback((long)paudiores, paudiores->priv);
 			}
@@ -198,10 +203,15 @@
 		slog(AUDIO_CTRL, SLOG_ERR,"audiores_thread_entry error num(%d): error case:%s",errno,strerror(errno));
 	}
 
-	paudiores->msgq = 0;	
+	paudiores->msgq = 0;
+	//LYNQ_MODIFY_ZXW_BUG_340_202410260E4E4183_START	
+	sem_post(&paudiores->semid);
+	//LYNQ_MODIFY_ZXW_BUG_340_202410260E4E4183_END
 	slog(AUDIO_CTRL, SLOG_NORMAL, "audiores_thread_entry(%s) end!\n",name);
 
-	free(paudiores);
+	//LYNQ_MODIFY_ZXW_BUG_340_202410260E4E4183_START
+	//free(paudiores);
+	//LYNQ_MODIFY_ZXW_BUG_340_202410260E4E4183_END
 }
 
 static BOOL audiores_request_by_modid(int type, int queueId, int moduleId, T_audio_UseRsp *RspData)
@@ -407,6 +417,9 @@
 {
 	struct audiores_context_t *paudiores = NULL;
 	T_audio_ExitInd exitIndData = {0}; 
+	//LYNQ_MODIFY_ZXW_BUG_340_202410260E4E4183_START
+	struct timespec ts;
+	//LYNQ_MODIFY_ZXW_BUG_340_202410260E4E4183_END
 	
 	if(AUDIORES_HANDLE_BAD == handle) {
 		slog(AUDIO_CTRL, SLOG_ERR, "Err:The handle is bad!\n");
@@ -427,10 +440,24 @@
 	exitIndData.type = paudiores->type;
 	exitIndData.moduleId = paudiores->modid;
 
+	//LYNQ_MODIFY_ZXW_BUG_340_202410260E4E4183_START
+	platform_send_msg(paudiores->modid, MODULE_ID_CODEC, EXIT_AUDIO_REQ, sizeof(exitIndData), (unsigned char *)&exitIndData);
+	if (clock_gettime(CLOCK_REALTIME, &ts) == -1) {
+		slog(AUDIO_CTRL, SLOG_NORMAL, "audiores_close: clock_gettime fail.\n");
+	}
+	ts.tv_sec += AUDIORES_REQUEST_TIMEOUT_SEC;
+	ts.tv_nsec += 0;
+	if ((sem_timedwait(&paudiores->semid, &ts)) == -1) {
+		slog(AUDIO_CTRL, SLOG_ERR, "audiores_close: sem_timedwait timeout!errno:%d\n",errno);
 	/*Í˳ö×ÊÔ´¾ºÕù*/
-	platform_send_msg(paudiores->modid, MODULE_ID_CODEC, EXIT_AUDIO_IND, sizeof(exitIndData), (unsigned char *)&exitIndData);
+	//platform_send_msg(paudiores->modid, MODULE_ID_CODEC, EXIT_AUDIO_IND, sizeof(exitIndData), (unsigned char *)&exitIndData);
 
 	/*Í£Ö¹½ÓÊÕÏß³Ì*/
 	ipc_send_message(paudiores->modid, paudiores->modid, AUDIORES_EXIT, 0, NULL, 0);
+		sleep(AUDIORES_EXIT_INTERVAL_SEC);
+	}
+	sem_destroy(&paudiores->semid);
+	slog(AUDIO_CTRL, SLOG_NORMAL, "audiores_close: type(%d)\n ", paudiores->type);
+	free(paudiores);
+	//LYNQ_MODIFY_ZXW_BUG_340_202410260E4E4183_END
 }
-
diff --git a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/msm_svr/audio/msm_audio.c b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/msm_svr/audio/msm_audio.c
index 4ca23a4..dc1f5fd 100755
--- a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/msm_svr/audio/msm_audio.c
+++ b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/msm_svr/audio/msm_audio.c
@@ -96,11 +96,27 @@
 		AUDIORES_HANDLE_BAD == pmsmaudio_ctx->audiores_handle) {

 		if(NULL != pmsmaudio_ctx) {

 			slog(MSMSVR_PRINT, SLOG_NORMAL, "audiochn_count=%d handle=0x%x\n", pmsmaudio_ctx->audiochn_count, pmsmaudio_ctx->audiores_handle);

-			if(REL_AUDIO_REQ == msgtype) {		

+			if(REL_AUDIO_REQ == msgtype) {

+				//LYNQ_MODIFY_ZXW_BUG_340_202410260E4E4183_START

+				msm_audio_set_res_state(pmsmaudio_ctx, MSM_AUDIO_RES_STATE_RELEASE);

+				//LYNQ_MODIFY_ZXW_BUG_340_202410260E4E4183_END		

 				audiores_release(pmsmaudio_ctx->audiores_handle);

 			}

 			else if(IDLE_AUDIO_INFO == msgtype) {

-				audiores_request(pmsmaudio_ctx->audiores_handle);

+			//LYNQ_MODIFY_ZXW_BUG_340_202410260E4E4183_START

+				if(MSM_AUDIO_RES_STATE_RELEASE != msm_audio_get_res_state(pmsmaudio_ctx)) {

+					audiores_request(pmsmaudio_ctx->audiores_handle);

+				}

+			}

+			else if(USE_AUDIO_RSP == msgtype) {

+				server_response_data = (T_audio_UseRsp *)data;

+				slog(MSMSVR_PRINT, SLOG_DEBUG, "request result:%d type:%d using_type:%d \n", \

+					server_response_data->result, server_response_data->type, server_response_data->using_type);

+				if(0 != server_response_data->result) {

+					return 0;

+				}

+				msm_audio_set_res_state(pmsmaudio_ctx, MSM_AUDIO_RES_STATE_HOLD);

+			//LYNQ_MODIFY_ZXW_BUG_340_202410260E4E4183_END

 			}

 		}

 		else {

@@ -111,35 +127,51 @@
 

 	if(!audiochn_valid_check(pmsmaudio_ctx)) {

 		slog(MSMSVR_PRINT, SLOG_DEBUG, "audiochn_valid_check return FALSE!!!\n");

-		if(REL_AUDIO_REQ == msgtype) {		

+		if(REL_AUDIO_REQ == msgtype) {

+			//LYNQ_MODIFY_ZXW_BUG_340_202410260E4E4183_START

+			msm_audio_set_res_state(pmsmaudio_ctx, MSM_AUDIO_RES_STATE_RELEASE);

+			//LYNQ_MODIFY_ZXW_BUG_340_202410260E4E4183_END

 			audiores_release(pmsmaudio_ctx->audiores_handle);

 		}

 		else if(IDLE_AUDIO_INFO == msgtype) {

 			audiores_request(pmsmaudio_ctx->audiores_handle);

 		}

+//LYNQ_MODIFY_ZXW_BUG_340_202410260E4E4183_START

+		else if(USE_AUDIO_RSP == msgtype) {

+			server_response_data = (T_audio_UseRsp *)data;

+			slog(MSMSVR_PRINT, SLOG_DEBUG, "msm_audiores_read_callback request result:%d type:%d using_type:%d \n", \

+				server_response_data->result, server_response_data->type, server_response_data->using_type);

+			if(0 != server_response_data->result) {

+				return 0;

+			}

+			msm_audio_set_res_state(pmsmaudio_ctx, MSM_AUDIO_RES_STATE_HOLD);

+		}

 		return 0;

 	}

-	

-	if(REL_AUDIO_REQ == msgtype) {		

+//LYNQ_MODIFY_ZXW_BUG_340_202410260E4E4183_END

+	if(REL_AUDIO_REQ == msgtype) {

+		//LYNQ_MODIFY_ZXW_BUG_340_202410260E4E4183_START

+		msm_audio_set_res_state(pmsmaudio_ctx, MSM_AUDIO_RES_STATE_RELEASE);

+		//LYNQ_MODIFY_ZXW_BUG_340_202410260E4E4183_END

 		msm_audio_suspend(pmsmaudio_ctx);

-		/*»á´æÔÚpcm»¹Î´¹Ø±Õ£¬¶øÌáǰִÐÐÊÍ·Å£¿*/

 		audiores_release(pmsmaudio_ctx->audiores_handle);

 	}

 	else if(IDLE_AUDIO_INFO == msgtype) {

 		audiores_request(pmsmaudio_ctx->audiores_handle);

 	}

-	else if(USE_AUDIO_RSP == msgtype) {		

+	else if(USE_AUDIO_RSP == msgtype) {

 		server_response_data = (T_audio_UseRsp *)data;

 		slog(MSMSVR_PRINT, SLOG_DEBUG, "msm_audiores_read_callback request result:%d type:%d using_type:%d \n", \

 			server_response_data->result, server_response_data->type, server_response_data->using_type);

-

+ 

 		if(0 != server_response_data->result) {

 			return 0;

 		}

-		

+		//LYNQ_MODIFY_ZXW_BUG_340_202410260E4E4183_START

+		msm_audio_set_res_state(pmsmaudio_ctx, MSM_AUDIO_RES_STATE_HOLD);

+		//LYNQ_MODIFY_ZXW_BUG_340_202410260E4E4183_END

 		msm_audio_resume(pmsmaudio_ctx);

 	}

-	

 	return 0;

 }

 

@@ -160,6 +192,9 @@
 {

 	slog(MSMSVR_PRINT, SLOG_DEBUG, "msm_audiores_release enter.\n");

 	if(AUDIORES_HANDLE_BAD != audiores_handle) {

+		//LYNQ_MODIFY_ZXW_BUG_340_202410260E4E4183_START

+		msm_audio_set_res_state(&msmaudio_ctx, MSM_AUDIO_RES_STATE_RELEASE);

+		//LYNQ_MODIFY_ZXW_BUG_340_202410260E4E4183_END

 		audiores_release(audiores_handle);

 		audiores_close(audiores_handle);	

 	}

@@ -195,7 +230,12 @@
 

 static int msm_audio_resume(struct msm_audio_context *pmsmaudio_ctx)

 {

-	slog(MSMSVR_PRINT, SLOG_DEBUG, "msm_audio_resume enter.\n");		

+	slog(MSMSVR_PRINT, SLOG_DEBUG, "msm_audio_resume enter.\n");

+	//LYNQ_MODIFY_ZXW_BUG_340_202410260E4E4183_START

+	if(MSM_AUDIO_RES_STATE_RELEASE == msm_audio_get_res_state(pmsmaudio_ctx)) {

+		return;

+	}

+	//LYNQ_MODIFY_ZXW_BUG_340_202410260E4E4183_END

 	msm_ccm_notify_cc_status(0);

 	msm_audio_stream_event_notify(pmsmaudio_ctx, SCAUDIO_EVENT_RESUME);

 

@@ -317,7 +357,22 @@
     pipcmsg->data_len = len;

 	memcpy(pipcmsg->data, data, len);

 }

-

+//LYNQ_MODIFY_ZXW_BUG_340_202410260E4E4183_START

+void msm_audio_set_res_state(struct msm_audio_context *pmsmaudio_ctx, unsigned int state)

+{

+    pthread_mutex_lock(&pmsmaudio_ctx->audiochn_mutex);

+    pmsmaudio_ctx->audiores_state = state;

+    pthread_mutex_unlock(&pmsmaudio_ctx->audiochn_mutex);

+}

+unsigned int msm_audio_get_res_state(struct msm_audio_context *pmsmaudio_ctx)

+{

+    unsigned int state;

+    pthread_mutex_lock(&pmsmaudio_ctx->audiochn_mutex);

+    state = pmsmaudio_ctx->audiores_state;

+    pthread_mutex_unlock(&pmsmaudio_ctx->audiochn_mutex);

+    return state;

+}

+//LYNQ_MODIFY_ZXW_BUG_340_202410260E4E4183_END

 void audiochn_add_list(struct msm_client_node *new_audiochn, struct msm_audio_context *pmsmaudio_ctx)

 {

 	if(NULL == new_audiochn) {

diff --git a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/msm_svr/audio/msm_audio.h b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/msm_svr/audio/msm_audio.h
index 7941a3e..e676a08 100755
--- a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/msm_svr/audio/msm_audio.h
+++ b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/msm_svr/audio/msm_audio.h
@@ -6,7 +6,11 @@
 #include "msm_svrcall_media.h"

 

 #define MSM_AUDIO_HANDLE_INVALID  0

-

+//LYNQ_MODIFY_ZXW_BUG_340_202410260E4E4183_START

+#define MSM_AUDIO_RES_STATE_UNKNOW    0

+#define MSM_AUDIO_RES_STATE_HOLD    1

+#define MSM_AUDIO_RES_STATE_RELEASE    2

+//LYNQ_MODIFY_ZXW_BUG_340_202410260E4E4183_END

 struct msm_audio_channel {	

 	MM_HANDLE mm_handle;

 	unsigned int device;

@@ -34,10 +38,18 @@
 	unsigned char audiochn_count;

 

 	long audiores_handle;

+//LYNQ_MODIFY_ZXW_BUG_340_202410260E4E4183_START

+	/*0-unknow;1-hold;2-release;*/

+	unsigned int audiores_state;

+//LYNQ_MODIFY_ZXW_BUG_340_202410260E4E4183_END

 };

 

 BOOL msm_audio_file_check(const char *file, const char *mode);

 MSM_AUDIO_RATE_TYPE_E msm_audio_mantate_to_msmrate(int samplerate);

+//LYNQ_MODIFY_ZXW_BUG_340_202410260E4E4183_START

+void msm_audio_set_res_state(struct msm_audio_context *pmsmaudio_ctx, unsigned int state);

+unsigned int msm_audio_get_res_state(struct msm_audio_context *pmsmaudio_ctx);

+//LYNQ_MODIFY_ZXW_BUG_340_202410260E4E4183_END

 void msm_audio_ipcmsg_set(int fdsvr, int msgreq, void *data, int len, sc_ipc_msg *pipcmsg);

 void audiochn_add_list(struct msm_client_node *new_audiochn, struct msm_audio_context *pmsmaudio_ctx);

 void audiochn_del_list(struct msm_client_node *audioclient, struct msm_audio_context *pmsmaudio_ctx);

diff --git a/cp/ps/driver/src/chipsets/src/audio_base/i2s/hal_i2s.c b/cp/ps/driver/src/chipsets/src/audio_base/i2s/hal_i2s.c
index 5ea7c1d..377e726 100755
--- a/cp/ps/driver/src/chipsets/src/audio_base/i2s/hal_i2s.c
+++ b/cp/ps/driver/src/chipsets/src/audio_base/i2s/hal_i2s.c
@@ -3698,6 +3698,29 @@
 	return DRV_SUCCESS;

 }

 

+//LYNQ_MODIFY_ZXW_BUG_385_20241105C55F1640_START

+VOID zDrvI2S_Reg_Printf(VOID)

+{

+	zDrvRamlog_PRINTF(RAMLOG_MOD_AUDIO, "(zDrvI2S_Reg_Printf(I2S_1 timing ctrl) = 0x%8x", (s_i2sInstance[I2S_1].ptDev)->regs->timingCtrl);

+	zDrvRamlog_PRINTF(RAMLOG_MOD_AUDIO, "(zDrvI2S_Reg_Printf(I2S_1 fifo ctrl) = 0x%8x", (s_i2sInstance[I2S_1].ptDev)->regs->fifoCtrl);

+	zDrvRamlog_PRINTF(RAMLOG_MOD_AUDIO, "(zDrvI2S_Reg_Printf(I2S_1 frame ctrl) = 0x%8x", (s_i2sInstance[I2S_1].ptDev)->regs->frameCntr);

+	zDrvRamlog_PRINTF(RAMLOG_MOD_AUDIO, "(zDrvI2S_Reg_Printf(I2S_1 fifostatus) = 0x%8x", (s_i2sInstance[I2S_1].ptDev)->regs->fifoStatus);

+	zDrvRamlog_PRINTF(RAMLOG_MOD_AUDIO, "(zDrvI2S_Reg_Printf(I2S_1 process ctrl) = 0x%8x", (s_i2sInstance[I2S_1].ptDev)->regs->processCtrl);

+	zDrvRamlog_PRINTF(RAMLOG_MOD_AUDIO, "zDrvI2S_Reg_Printf(I2S_1 reg intEn) = 0x%8x", (s_i2sInstance[I2S_1].ptDev)->regs->intEn);

+	zDrvRamlog_PRINTF(RAMLOG_MOD_AUDIO, "zDrvI2S_Reg_Printf(I2S_1 reg intStatus) = 0x%8x\n", (s_i2sInstance[I2S_1].ptDev)->regs->intStatus);

+	zDrvRamlog_PRINTF(RAMLOG_MOD_AUDIO, "zDrvI2S_Reg_Printf(I2S_1 reg data) = 0x%8x\n", (s_i2sInstance[I2S_1].ptDev)->regs->data);

+

+	zDrvRamlog_PRINTF(RAMLOG_MOD_AUDIO, "(zDrvI2S_Reg_Printf(I2S_2 timing ctrl) = 0x%8x", (s_i2sInstance[I2S_2].ptDev)->regs->timingCtrl);

+	zDrvRamlog_PRINTF(RAMLOG_MOD_AUDIO, "(zDrvI2S_Reg_Printf(I2S_2 fifo ctrl) = 0x%8x", (s_i2sInstance[I2S_2].ptDev)->regs->fifoCtrl);

+	zDrvRamlog_PRINTF(RAMLOG_MOD_AUDIO, "(zDrvI2S_Reg_Printf(I2S_2 frame ctrl) = 0x%8x", (s_i2sInstance[I2S_2].ptDev)->regs->frameCntr);

+	zDrvRamlog_PRINTF(RAMLOG_MOD_AUDIO, "(zDrvI2S_Reg_Printf(I2S_2 fifostatus) = 0x%8x", (s_i2sInstance[I2S_2].ptDev)->regs->fifoStatus);

+	zDrvRamlog_PRINTF(RAMLOG_MOD_AUDIO, "(zDrvI2S_Reg_Printf(I2S_2 process ctrl) = 0x%8x", (s_i2sInstance[I2S_2].ptDev)->regs->processCtrl);

+	zDrvRamlog_PRINTF(RAMLOG_MOD_AUDIO, "zDrvI2S_Reg_Printf(I2S_2 reg intEn) = 0x%8x", (s_i2sInstance[I2S_2].ptDev)->regs->intEn);

+	zDrvRamlog_PRINTF(RAMLOG_MOD_AUDIO, "zDrvI2S_Reg_Printf(I2S_2 reg intStatus) = 0x%8x\n", (s_i2sInstance[I2S_2].ptDev)->regs->intStatus);

+	zDrvRamlog_PRINTF(RAMLOG_MOD_AUDIO, "zDrvI2S_Reg_Printf(I2S_2 reg data) = 0x%8x\n", (s_i2sInstance[I2S_2].ptDev)->regs->data);

+}

+//LYNQ_MODIFY_ZXW_BUG_385_20241105C55F1640_END

+

 /**

 * @brief	i2s read start do.

 *

diff --git a/cp/ps/driver/src/chipsets/src/audio_base/tdm/hal_tdm.c b/cp/ps/driver/src/chipsets/src/audio_base/tdm/hal_tdm.c
index 50e28da..3a778a6 100755
--- a/cp/ps/driver/src/chipsets/src/audio_base/tdm/hal_tdm.c
+++ b/cp/ps/driver/src/chipsets/src/audio_base/tdm/hal_tdm.c
@@ -286,7 +286,11 @@
 //	zDrvDma_CallbackFunc        fDmaCbTx;

     SINT32						 DmaRxID;	

     SINT32						 DmaTxID;	

-    T_ZDrvI2s_TransMode          tdmTransMode;        

+    T_ZDrvI2s_TransMode          tdmTransMode;   

+//LYNQ_MODIFY_ZXW_BUG_385_20241105C55F1640_START

+    ZOSS_MUTEX_ID				rxMutex;

+	ZOSS_MUTEX_ID				txMutex;

+//LYNQ_MODIFY_ZXW_BUG_385_20241105C55F1640_END

 } T_Tdm_Instance;

 

 typedef struct

@@ -2617,6 +2621,14 @@
     s_TdmDev.intprio = 15;

     s_TdmDev.regs = (T_Tdm_Reg*)TDM_REG_BASE;            

     s_tdmInstance.ptDev = &s_TdmDev;

+

+//LYNQ_MODIFY_ZXW_BUG_385_20241105C55F1640_START

+    s_tdmInstance.txMutex = zOss_CreateMutex("tdmTxMutex", 1);

+	zOss_ASSERT(s_tdmInstance.txMutex != ZOSS_NULL);

+    s_tdmInstance.rxMutex = zOss_CreateMutex("tdmRxMutex", 1);

+	zOss_ASSERT(s_tdmInstance.rxMutex != ZOSS_NULL);

+//LYNQ_MODIFY_ZXW_BUG_385_20241105C55F1640_END

+    

     s_bTdmInitInt = TRUE;

 	zDrvRamlog_PRINTF(RAMLOG_MOD_AUDIO, "(tdm_InitInt(TDM_REG_BASE) = %x",TDM_REG_BASE); 

 }

@@ -3111,6 +3123,25 @@
     return DRV_SUCCESS;

 }

 

+//LYNQ_MODIFY_ZXW_BUG_385_20241105C55F1640_START

+VOID zDrvTDM_Reg_Printf(VOID)

+{

+	zDrvRamlog_PRINTF(RAMLOG_MOD_AUDIO, "(zDrvTDM_Reg_Printf timing ctrl) = %x",  (s_tdmInstance.ptDev)->regs->timingCtrl);

+	zDrvRamlog_PRINTF(RAMLOG_MOD_AUDIO, "(zDrvTDM_Reg_Printf frame ctrl) = %x",(s_tdmInstance.ptDev)->regs->frameCntr);

+	zDrvRamlog_PRINTF(RAMLOG_MOD_AUDIO, "(zDrvTDM_Reg_Printf txFifoCtrl) = %x", (s_tdmInstance.ptDev)->regs->txFifoCtrl);

+    zDrvRamlog_PRINTF(RAMLOG_MOD_AUDIO, "(zDrvTDM_Reg_Printf rxFifoCtrl) = %x", (s_tdmInstance.ptDev)->regs->rxFifoCtrl);

+	zDrvRamlog_PRINTF(RAMLOG_MOD_AUDIO, "(zDrvTDM_Reg_Printf process ctrl) = %x", (s_tdmInstance.ptDev)->regs->processCtrl);

+	zDrvRamlog_PRINTF(RAMLOG_MOD_AUDIO, "(zDrvTDM_Reg_Printf reg intEn) = %x",  (s_tdmInstance.ptDev)->regs->intEn);

+	zDrvRamlog_PRINTF(RAMLOG_MOD_AUDIO, "(zDrvTDM_Reg_Printf reg intStatus) = %x\n", (s_tdmInstance.ptDev)->regs->intStatus);

+	zDrvRamlog_PRINTF(RAMLOG_MOD_AUDIO, "(zDrvTDM_Reg_Printf reg writeCntCtrl) = %x\n",  (s_tdmInstance.ptDev)->regs->writeCntCtrl);

+	zDrvRamlog_PRINTF(RAMLOG_MOD_AUDIO, "(zDrvTDM_Reg_Printf reg writeCntr) = %x\n",  (s_tdmInstance.ptDev)->regs->writeCntr);

+	zDrvRamlog_PRINTF(RAMLOG_MOD_AUDIO, "(zDrvTDM_Reg_Printf reg writeCntr2) = %x\n",  (s_tdmInstance.ptDev)->regs->writeCntr2);    

+    zDrvRamlog_PRINTF(RAMLOG_MOD_AUDIO, "(zDrvTDM_Reg_Printf reg readCntCtrl) = %x\n",  (s_tdmInstance.ptDev)->regs->readCntCtrl);

+    zDrvRamlog_PRINTF(RAMLOG_MOD_AUDIO, "(zDrvTDM_Reg_Printf reg readCntr) = %x\n",  (s_tdmInstance.ptDev)->regs->readCntr);

+    zDrvRamlog_PRINTF(RAMLOG_MOD_AUDIO, "(zDrvTDM_Reg_Printf reg readCntr2) = %x\n",  (s_tdmInstance.ptDev)->regs->readCntr2);

+}

+//LYNQ_MODIFY_ZXW_BUG_385_20241105C55F1640_END

+

 SINT32 zDrvTDM_Read_Start_Do(T_ZDrvTdm_Params *params)

 {

 

@@ -3234,6 +3265,10 @@
     {

         return DRV_ERR_NOT_STARTED;

     }

+

+//LYNQ_MODIFY_ZXW_BUG_385_20241105C55F1640_START

+    zOss_GetMutex(ptInstance->txMutex, ZOSS_WAIT_FOREVER);

+//LYNQ_MODIFY_ZXW_BUG_385_20241105C55F1640_END

     ret = tdm_UpdateTxBufferStatus((UINT16 *)pBuf , BUFFER_FULL);       /*ÉϲãÍù*pBufдÍêÊý¾Ýºó£¬¸Ä±äBUF״̬ΪFULL*/

     if (ret != DRV_SUCCESS)

     {

@@ -3252,7 +3287,10 @@
 				return DRV_ERROR;

 			}*/

 	}

-	

+//LYNQ_MODIFY_ZXW_BUG_385_20241105C55F1640_START

+    zOss_PutMutex(ptInstance->txMutex);

+//LYNQ_MODIFY_ZXW_BUG_385_20241105C55F1640_END

+    

     return DRV_SUCCESS;

 }

 

@@ -3297,7 +3335,10 @@
         return DRV_ERROR;

     }

     //zDrvRamlog_PRINTF(RAMLOG_MOD_AUDIO, "zDrvTDM_Read zOss_GetSemaphore done");

-

+//LYNQ_MODIFY_ZXW_BUG_385_20241105C55F1640_START

+    zOss_GetMutex(ptInstance->rxMutex, ZOSS_WAIT_FOREVER);

+//LYNQ_MODIFY_ZXW_BUG_385_20241105C55F1640_END

+    

 	*pBuf = tdmStream->rxBufferArray[tdmStream->rxRdIdx].buf;

 	*uiLen = tdmStream->rxLen;

 	tdm_UpdateRxBufferStatus((UINT16 *)tdmStream->rxBufferArray[tdmStream->rxRdIdx].buf, BUFFER_READ);

@@ -3327,7 +3368,10 @@
         return DRV_ERROR;

     }

 	#endif

-	

+//LYNQ_MODIFY_ZXW_BUG_385_20241105C55F1640_START

+	zOss_PutMutex(ptInstance->rxMutex);

+//LYNQ_MODIFY_ZXW_BUG_385_20241105C55F1640_END

+    

     return DRV_SUCCESS;

 }

 

@@ -3368,6 +3412,10 @@
     ptReg->intStatus |= TDM_INT_TX_THRESHOLD;

     ptReg->intEn &= ~TDM_INT_EN_TX_THRESHOLD;       /* disable tx interrupt */

 

+//LYNQ_MODIFY_ZXW_BUG_385_20241105C55F1640_START

+    zOss_GetMutex(ptInstance->txMutex, ZOSS_WAIT_FOREVER);

+//LYNQ_MODIFY_ZXW_BUG_385_20241105C55F1640_END

+

     ret = tdm_CleanTxResource();

 	/*klocwork 3 INVARIANT_CONDITION.UNREACH  delete if*/

 	/*

@@ -3375,6 +3423,10 @@
     {

         return DRV_ERROR;

     }*/

+//LYNQ_MODIFY_ZXW_BUG_385_20241105C55F1640_START

+    zOss_PutMutex(ptInstance->txMutex);

+//LYNQ_MODIFY_ZXW_BUG_385_20241105C55F1640_END

+

     txStream->txTransmit = NULL;

     txStream->channel = AUDIO_MONO_CHANNEL;

     txStream->txLen = 0;

@@ -3426,6 +3478,10 @@
     ptReg->intStatus |= TDM_INT_RX_THRESHOLD;

     ptReg->intEn &= ~TDM_INT_EN_RX_THRESHOLD;       /* disable tx interrupt */

 

+//LYNQ_MODIFY_ZXW_BUG_385_20241105C55F1640_START

+    zOss_GetMutex(ptInstance->rxMutex, ZOSS_WAIT_FOREVER);

+//LYNQ_MODIFY_ZXW_BUG_385_20241105C55F1640_END

+    

     ret = tdm_CleanRxResource();

 	/*klocwork 3 INVARIANT_CONDITION.UNREACH  delete if*/

 	/*

@@ -3433,6 +3489,9 @@
     {

         return DRV_ERROR;

     }*/

+//LYNQ_MODIFY_ZXW_BUG_385_20241105C55F1640_START

+    zOss_PutMutex(ptInstance->rxMutex);

+//LYNQ_MODIFY_ZXW_BUG_385_20241105C55F1640_END

 

     if (ptInstance->tdmStatus != TDM_BOTH_INUSE)

     {

@@ -3486,7 +3545,9 @@
         return DRV_ERROR;

     }

 

-

+//LYNQ_MODIFY_ZXW_BUG_385_20241105C55F1640_START

+    zOss_GetMutex(ptInstance->txMutex, ZOSS_WAIT_FOREVER);

+//LYNQ_MODIFY_ZXW_BUG_385_20241105C55F1640_END

 	if(tdmStream->txBufferArray == NULL) {

         zDrvRamlog_PRINTF(RAMLOG_MOD_AUDIO, "zDrvTDM_GetBuf tdmStream->txBufferArray == NULL  \n ");	

 		return DRV_ERROR;/*  ½â¾öPSµ÷ÁËSTOPºóLTE¼ÌÐøÐ´Êý¾Ý·ÃÎÊ¿ÕÖ¸ÕëËÀ»ú */

@@ -3516,6 +3577,9 @@
 	zDrvRamlog_PRINTF(RAMLOG_MOD_AUDIO, "(zDrvTDM_GetBuf reg readCntr) = %x\n",  (s_tdmInstance.ptDev)->regs->readCntr);

 	zDrvRamlog_PRINTF(RAMLOG_MOD_AUDIO, "(zDrvTDM_GetBuf reg readCntr2) = %x\n",  (s_tdmInstance.ptDev)->regs->readCntr2);

 #endif

+//LYNQ_MODIFY_ZXW_BUG_385_20241105C55F1640_START

+    zOss_PutMutex(ptInstance->txMutex);

+//LYNQ_MODIFY_ZXW_BUG_385_20241105C55F1640_END

     return DRV_SUCCESS;

 }

 

@@ -3597,7 +3661,9 @@
     {

         return DRV_ERR_NOT_STARTED;

     }

-

+//LYNQ_MODIFY_ZXW_BUG_385_20241105C55F1640_START

+    zOss_GetMutex(ptInstance->rxMutex, ZOSS_WAIT_FOREVER);

+//LYNQ_MODIFY_ZXW_BUG_385_20241105C55F1640_END

 	tdm_UpdateRxBufferStatus((UINT16 *)tdmStream->rxBufferArray[tdmStream->rxRdIdx].buf, BUFFER_NULL);

 	tdmStream->rxRdIdx = (tdmStream->rxRdIdx +1) % TDM_OUT_BUF_NUM ;

 

@@ -3617,6 +3683,9 @@
         return DRV_ERROR;

     }

 #endif

+//LYNQ_MODIFY_ZXW_BUG_385_20241105C55F1640_START

+    zOss_PutMutex(ptInstance->rxMutex);

+//LYNQ_MODIFY_ZXW_BUG_385_20241105C55F1640_END

     return DRV_SUCCESS;

 }

 

diff --git a/cp/ps/driver/src/chipsets/src/audio_base/voiceprocess/hal_voiceprocess.c b/cp/ps/driver/src/chipsets/src/audio_base/voiceprocess/hal_voiceprocess.c
index 3296dad..47f68f8 100755
--- a/cp/ps/driver/src/chipsets/src/audio_base/voiceprocess/hal_voiceprocess.c
+++ b/cp/ps/driver/src/chipsets/src/audio_base/voiceprocess/hal_voiceprocess.c
@@ -1195,6 +1195,26 @@
 	return ret;

 }

 

+//LYNQ_MODIFY_ZXW_BUG_385_20241105C55F1640_START

+VOID zDrvExtAudio_Reg_Printf(VOID)

+{

+    if (g_voiceVar.useVoiceBuffer == 1){ 

+		return;

+	}	

+#ifdef CONFIG_VOICE_BUFFER_DRV  

+#else	

+	if (g_voiceVar.g_isUseTdm != 1)

+	{

+		zDrvI2S_Reg_Printf();

+	}

+	else if (g_voiceVar.g_isUseTdm == 1)

+	{

+		zDrvTDM_Reg_Printf();

+	}

+#endif	

+}

+//LYNQ_MODIFY_ZXW_BUG_385_20241105C55F1640_END

+

 SINT32 zDrvExtAudio_Read_Start(T_ZDrvI2s_Params *i2sParams, T_ZDrvI2S_Cfg *i2sCfg,

                                T_ZDrvTdm_Params *tdmParams, T_ZDrvTdm_Cfg *tdmCfg)

 {

@@ -3502,6 +3522,10 @@
 	SINT32  ret = DRV_SUCCESS;

 	UINT8 *read_buf = NULL;

 	UINT32 read_len = 0;

+//LYNQ_MODIFY_ZXW_BUG_385_20241105C55F1640_START

+    UINT8 *read_buf_tmp = NULL;

+	UINT32 read_len_tmp = 0;

+//LYNQ_MODIFY_ZXW_BUG_385_20241105C55F1640_END

 

 	UINT32 i = 0, j = 0;

 #ifdef CONFIG_ARCH_ZX297520V3_CPE_SWITCH

@@ -3588,7 +3612,9 @@
 			zDrvRamlog_PRINTF(RAMLOG_MOD_AUDIO, "vp vp_ReadDataFromCodec ecall_GetRxBuf err ret=%d\n", ret);

 			return DRV_ERROR;

 		}

-		

+//LYNQ_MODIFY_ZXW_BUG_385_20241105C55F1640_START

+		ret = zDrvExtAudio_Read(&read_buf_tmp, &read_len_tmp); 

+//LYNQ_MODIFY_ZXW_BUG_385_20241105C55F1640_END		

 		ret = ecall_Read(&read_buf, &read_len);

 		//ret = zDrvExtAudio_Read(&read_buf, &read_len);

 

@@ -3667,8 +3693,18 @@
 				return DRV_ERROR;

 			}

 			ext_aRdFBufCount ++;				

-		}		

-      

+		}	

+//LYNQ_MODIFY_ZXW_BUG_385_20241105C55F1640_START   

+    	if ((e_reg_flag == 1)&&(g_voiceVar.ecallData.ecallTxSta == ECALL_ST_TX_INUSE))		

+    	{  

+            ret = zDrvExtAudio_FreeBuf(read_buf_tmp);

+    		if (ret  != DRV_SUCCESS)

+    		{

+    			zDrvRamlog_PRINTF(RAMLOG_MOD_AUDIO, "vp vp_ReadDataFromCodec err ret=%d\n", ret);

+    			return DRV_ERROR;

+    		}

+    	}

+//LYNQ_MODIFY_ZXW_BUG_385_20241105C55F1640_END    

 		#else //not ECALL_SUPPORT

 		ret = zDrvExtAudio_FreeBuf(read_buf);

 		if (ret  != DRV_SUCCESS)

diff --git a/update_version.sh b/update_version.sh
index 618bbae..4e7898d 100755
--- a/update_version.sh
+++ b/update_version.sh
@@ -1,8 +1,8 @@
 #!/bin/bash
 #export LYNQ_VERSION="T106_lynq_version_ap_build_sh"
-LYNQ_AP_VERSION="T106-V2.01.01.02P56U09.AP.17.02"
-LYNQ_CAP_INSIDE_VERSION="CAP.17.02"
-LYNQ_CAP_VERSION="CAP.17.02"
+LYNQ_AP_VERSION="T106-V2.01.01.02P56U09.AP.17.08"
+LYNQ_CAP_INSIDE_VERSION="CAP.17.08"
+LYNQ_CAP_VERSION="CAP.17.08"
 COMMIT_ID="$(git rev-parse HEAD)"
 
 LYNQ_SW_INSIDE_VERSION="LYNQ_CONFIG_VERSION = \"${LYNQ_AP_VERSION}_${LYNQ_CAP_INSIDE_VERSION}\""