Merge "[Feature][T106]version update to T106-V2.01.01.02P56U09.AP.17.08_CAP.17.08"
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/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/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)