Merge "[Bugfix][T106BUG-585] The second upgrade, during the verification phase, the upgrade progress is checked to be 10"
diff --git a/ap/app/zte_comm/zte_mainctrl/netdev_proc.c b/ap/app/zte_comm/zte_mainctrl/netdev_proc.c
index f7c0954..15b3c0e 100755
--- a/ap/app/zte_comm/zte_mainctrl/netdev_proc.c
+++ b/ap/app/zte_comm/zte_mainctrl/netdev_proc.c
@@ -2402,7 +2402,11 @@
 		defwan_change = 1;
 
 	//Êý¾ÝÏÈͨ£¬ºó×öÆäËûÅäÖã¬×¢Òâµã: ·À»ðǽ¶Ìʱ¼äÄÚ¿ÉÄÜδÉúЧ
+//xf.li@20240327 modify for T106BUG-578 start
+#ifndef USE_CAP_SUPPORT
 	if (defwan_change)
+#endif
+//xf.li@20240327 modify for T106BUG-578 end
 		system_cmd_ex("nat.sh");
 	defwan_set(defwan_if);
 
diff --git a/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/lynq-qser-voice-demo/files/lynq-qser-voice-demo.cpp b/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/lynq-qser-voice-demo/files/lynq-qser-voice-demo.cpp
index d6ddaf1..41c5c97 100755
--- a/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/lynq-qser-voice-demo/files/lynq-qser-voice-demo.cpp
+++ b/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/lynq-qser-voice-demo/files/lynq-qser-voice-demo.cpp
@@ -24,12 +24,14 @@
     {3,   "qser_voice_call_answer"},

     {4,   "qser_voice_set_speech_volume"},

     {5,   "qser_voice_get_speech_volume"},

-    {6,   "qser_voice_set_dtmf"},

+    {6,   "qser_voice_set_dtmf"},    

+#ifdef ECALL_SUPPORT

+    {7,   "qser_voice_set_test_num"},

+    {8,   "qser_voice_fast_ecall"},

+#endif

     {-1,    NULL}

 };

 

-

-

 typedef uint32_t voice_client_handle_type;

 

 

@@ -50,6 +52,37 @@
 int (*qser_voice_get_speech_volume)(int *volume);

 int (*qser_voice_set_dtmf)(const char callnum);

 

+#ifdef ECALL_SUPPORT

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

+int (*qser_voice_fast_ecall)(voice_client_handle_type*       h_voice,

+                        int                         *call_id,

+                        E_QSER_VOICE_ECALL_CATEGORY_T cat,

+                        E_QSER_VOICE_ECALL_VARIANT_T variant,

+                        const char *addr, 

+                        int addr_length, 

+                        const unsigned char *msd_data,

+                        int msd_length); //msd_length should <= QSER_MSD_MAX_LENGTH

+int (*qser_voice_set_msd)(int callid, const unsigned char *msd_data, int msd_length); //msd_length should <= QSER_MSD_MAX_LENGTH

+int (*qser_voice_add_ecall_indhandler)(voice_client_handle_type*          h_voice,

+                                  QSER_ECall_IndHandlerFunc_t   handlerPtr,

+                                  void*  contextPtr);

+

+static void yk_voice_ecall_cb_func(int         callid,  E_QSER_VOICE_ECALL_INDICATION_T ind, void* contextPtr)

+{   

+    unsigned char msd_data[QSER_MSD_MAX_LENGTH]={1,1,2,2,3,3,4,4};

+

+    printf("######### Call id=%d, event=%d!  ######\n", callid, ind);

+    

+    if(ind == E_QSER_VOICE_ECALL_IND_SENDING_START_IN_VOICE || ind == E_QSER_VOICE_ECALL_IND_PSAP_CALLBACK_START)

+    {

+        /*customer should construct msd including GPS data, here use msd_data for illustrate,*/

+        qser_voice_set_msd(callid,msd_data,8);                

+    }

+}

+

+#endif

+

+

 void *dlHandle_call = NULL;

 

 static void yk_voice_call_cb_func(int                     call_id,

@@ -62,6 +95,8 @@
     printf("######### Call id=%d, PhoneNum:%s, event=%s!  ######\n", call_id, phone_num, call_state[state]);

 }

 

+

+

 void print_help(void)

 {

     int i;

@@ -76,6 +111,8 @@
     }

 }

 

+

+

 int main(int argc, char const *argv[])

 {

     int cmdIdx = 0;

@@ -164,6 +201,36 @@
             printf("qser_voice_set_dtmf not defined or exported in %s\n", lynqLibPath_Call);

             return -1;

     }

+

+#ifdef ECALL_SUPPORT

+    qser_voice_fast_ecall = (int (*)(voice_client_handle_type*, int*, E_QSER_VOICE_ECALL_CATEGORY_T, E_QSER_VOICE_ECALL_VARIANT_T, const char*, int, const unsigned char*, int))dlsym(dlHandle_call,"qser_voice_fast_ecall");

+    if(qser_voice_fast_ecall == NULL)    

+    {

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

+            return -1;

+    }

+

+    qser_voice_set_test_num = (int (*)(voice_client_handle_type*, E_QSER_VOICE_ECALL_SET_TYPE_T, const char* , int))dlsym(dlHandle_call,"qser_voice_set_test_num");

+    if(qser_voice_set_test_num == NULL)    

+    {

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

+            return -1;

+    }    

+

+    qser_voice_set_msd = (int (*)(int , const unsigned char *, int))dlsym(dlHandle_call,"qser_voice_set_msd");

+    if(qser_voice_set_msd == NULL)    

+    {

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

+        return -1;

+    }

+

+    qser_voice_add_ecall_indhandler = (int (*)(voice_client_handle_type* h_voice, QSER_ECall_IndHandlerFunc_t, void*))dlsym(dlHandle_call,"qser_voice_add_ecall_indhandler");

+    if(qser_voice_add_ecall_indhandler == NULL)    

+    {

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

+            return -1;

+    }

+#endif

     

     ret = qser_voice_call_client_init(&h_voice);

     if(ret != 0 )

@@ -179,6 +246,14 @@
         return -1;

     }

 

+#ifdef ECALL_SUPPORT

+    ret = qser_voice_add_ecall_indhandler(&h_voice, yk_voice_ecall_cb_func, NULL);

+    if(ret != 0)

+    {

+        printf("qser_voice_add_ecall_indhandler FAIL\n");

+        return -1;

+    }

+#endif

 

     print_help();

     while(1)

@@ -270,7 +345,39 @@
                }

               break;

             }

-            

+#ifdef ECALL_SUPPORT

+            case 7:

+            {                

+                char PhoneNum[32] = {0};                 

+                printf("please input test phone number: \n");

+                scanf("%s", PhoneNum);                            

+                ret = qser_voice_set_test_num(&h_voice, E_QSER_VOICE_ECALL_SET_NUMBER, PhoneNum, strlen(PhoneNum)+1);

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

+                break;

+            }            

+            case 8:

+            {   

+                int call_id = -1;

+                int cat;

+                int var;

+                int length;

+                unsigned char  msd[QSER_MSD_MAX_LENGTH]={0};

+

+                printf("please input ecall cat: 0 manual, 1 auto\n");

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

+                printf("please input ecall type: 0 test, 1 emergency\n");

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

+                printf("please input msd content length (max length is 140)\n");

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

+                printf("please input %d unsigned char (0-255):\n", length);  

+                for (int i = 0; i < length; i++) {  

+                    scanf("%hhu", &msd[i]); 

+                }                               

+                ret = qser_voice_fast_ecall(&h_voice, &call_id, (E_QSER_VOICE_ECALL_CATEGORY_T) cat, (E_QSER_VOICE_ECALL_VARIANT_T) var, "null",5,msd,length);

+                printf("qser_voice_fast_ecall ret = %d, call id is %d\n", ret, call_id);

+                break;

+            }            

+#endif

             default:

                 print_help();

                 break;

diff --git a/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/lynq-qser-voice-demo/files/lynq-qser-voice-demo.h b/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/lynq-qser-voice-demo/files/lynq-qser-voice-demo.h
index 79977b9..82bf388 100755
--- a/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/lynq-qser-voice-demo/files/lynq-qser-voice-demo.h
+++ b/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/lynq-qser-voice-demo/files/lynq-qser-voice-demo.h
@@ -29,3 +29,69 @@
     void                    *contextPtr

 );

 

+

+#ifdef ECALL_SUPPORT

+

+#define QSER_MSD_MAX_LENGTH  140

+

+typedef enum{ 

+    E_QSER_VOICE_ECALL_SET_NUMBER = 0,     /* Set Number */

+    E_QSER_VOICE_ECALL_SET_URI = 1,      /* Set Uri */   

+}E_QSER_VOICE_ECALL_SET_TYPE_T; 

+

+typedef enum{

+    E_QSER_VOICE_ECALL_CAT_MANUAL = 0,      /* Manual Emergency eCall */

+    E_QSER_VOICE_ECALL_CAT_AUTO = 1,     /*  Automatic Emergency eCall */

+}E_QSER_VOICE_ECALL_CATEGORY_T;

+

+

+typedef enum{

+    E_QSER_VOICE_ECALL_TEST = 0,     /* Test eCall */

+    E_QSER_VOICE_ECALL_EMERGENCY = 1,      /* Emergency eCall */

+    E_QSER_VOICE_ECALL_RECONFIG = 2,     /*  Reconfiguration eCall */

+}E_QSER_VOICE_ECALL_VARIANT_T;

+

+typedef enum{

+    E_QSER_VOICE_ECALL_IND_SENDING_START = 1,

+    E_QSER_VOICE_ECALL_IND_SENDING_MSD = 2,

+    E_QSER_VOICE_ECALL_IND_LLACK_RECEIVED = 3,

+    E_QSER_VOICE_ECALL_IND_ALACK_POSITIVE_RECEIVED = 4,

+    E_QSER_VOICE_ECALL_IND_ALACK_CLEARDOWN_RECEIVED = 5,

+    E_QSER_VOICE_ECALL_IND_DAILING = 9,

+    E_QSER_VOICE_ECALL_IND_ALERTING = 10,

+    E_QSER_VOICE_ECALL_IND_ACTIVE = 11,

+    E_QSER_VOICE_ECALL_IND_DISCONNECTED = 12,

+    E_QSER_VOICE_ECALL_IND_IMS_ACTIVE = 13,

+    E_QSER_VOICE_ECALL_IND_IMS_DISCONNECTED = 14,

+    E_QSER_VOICE_ECALL_IND_ABNORMAL_HANGUP=15,

+    E_QSER_VOICE_ECALL_IND_IMS_MSD_ACK = 20,

+    E_QSER_VOICE_ECALL_IND_IMS_UPDATE_MSD = 21,

+    E_QSER_VOICE_ECALL_IND_IMS_IN_BAND_TRANSFER = 22,

+    E_QSER_VOICE_ECALL_IND_IMS_MSD_NACK = 23,

+    E_QSER_VOICE_ECALL_IND_IMS_SRVCC = 24,

+    E_QSER_VOICE_ECALL_IND_ONLY_DEREGISTRATION = 31,

+    E_QSER_VOICE_ECALL_IND_MAY_DEREGISTER = 32,

+    E_QSER_VOICE_ECALL_IND_PSAP_CALLBACK_START = 40,

+    E_QSER_VOICE_ECALL_IND_PSAP_CALLBACK_IMS_UPDATE_MSD = 41,

+    E_QSER_VOICE_ECALL_IND_SENDING_START_IN_VOICE=8000,    

+    E_QSER_VOICE_ECALL_IND_T2_TIMER_OUT = 9000,

+    E_QSER_VOICE_ECALL_IND_T5_TIMER_OUT = 9001,

+    E_QSER_VOICE_ECALL_IND_T6_TIMER_OUT = 9002,

+    E_QSER_VOICE_ECALL_IND_T7_TIMER_OUT = 9003,

+    E_QSER_VOICE_ECALL_IND_REDIAL_TIMER_OUT = 9004,    

+    E_QSER_VOICE_ECALL_IND_AUTO_ANS_TIMER_OUT = 9005,

+    E_QSER_VOICE_ECALL_IND_AUTO_ANS_IMS_TIMER_OUT = 9006,

+    E_QSER_VOICE_ECALL_IND_UNSPECIFIED = 0xffff,

+}E_QSER_VOICE_ECALL_INDICATION_T;

+

+typedef void (*QSER_ECall_IndHandlerFunc_t)

+(

+    int                     callid,   

+    E_QSER_VOICE_ECALL_INDICATION_T ind,

+    void                    *contextPtr

+);

+

+

+

+#endif

+

diff --git a/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/lynq-qser-voice-demo/lynq-qser-voice-demo.bb b/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/lynq-qser-voice-demo/lynq-qser-voice-demo.bb
old mode 100644
new mode 100755
index 1fb0142..480d42f
--- a/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/lynq-qser-voice-demo/lynq-qser-voice-demo.bb
+++ b/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/lynq-qser-voice-demo/lynq-qser-voice-demo.bb
@@ -24,7 +24,7 @@
 #INHIBIT_PACKAGE_STRIP = "1"
 do_compile () {
 
-	${CXX} -Wall lynq-qser-voice-demo.cpp ${LOCAL_LIBS} ${LOCAL_C_INCLUDES} -o lynq-qser-voice-demo
+	${CXX} -Wall lynq-qser-voice-demo.cpp ${LOCAL_LIBS} -DECALL_SUPPORT ${LOCAL_C_INCLUDES} -o lynq-qser-voice-demo 
 }
 
 do_install() {
diff --git a/cap/zx297520v3/src/lynq/lib/liblynq-qser-voice/include/lynq-qser-voice.h b/cap/zx297520v3/src/lynq/lib/liblynq-qser-voice/include/lynq-qser-voice.h
index 1fb0e01..8de497a 100755
--- a/cap/zx297520v3/src/lynq/lib/liblynq-qser-voice/include/lynq-qser-voice.h
+++ b/cap/zx297520v3/src/lynq/lib/liblynq-qser-voice/include/lynq-qser-voice.h
@@ -116,6 +116,83 @@
 
 
 */
+
+#ifdef ECALL_SUPPORT
+
+#define QSER_MSD_MAX_LENGTH  140
+
+typedef enum{ 
+    E_QSER_VOICE_ECALL_SET_NUMBER = 0,     /* Set Number */
+    E_QSER_VOICE_ECALL_SET_URI = 1,      /* Set Uri */   
+}E_QSER_VOICE_ECALL_SET_TYPE_T; 
+
+typedef enum{
+    E_QSER_VOICE_ECALL_CAT_MANUAL = 0,      /* Manual Emergency eCall */
+    E_QSER_VOICE_ECALL_CAT_AUTO = 1,     /*  Automatic Emergency eCall */
+}E_QSER_VOICE_ECALL_CATEGORY_T;
+
+
+typedef enum{
+    E_QSER_VOICE_ECALL_TEST = 0,     /* Test eCall */
+    E_QSER_VOICE_ECALL_EMERGENCY = 1,      /* Emergency eCall */
+    E_QSER_VOICE_ECALL_RECONFIG = 2,     /*  Reconfiguration eCall */
+}E_QSER_VOICE_ECALL_VARIANT_T;
+
+typedef enum{
+    E_QSER_VOICE_ECALL_IND_SENDING_START = 1,
+    E_QSER_VOICE_ECALL_IND_SENDING_MSD = 2,
+    E_QSER_VOICE_ECALL_IND_LLACK_RECEIVED = 3,
+    E_QSER_VOICE_ECALL_IND_ALACK_POSITIVE_RECEIVED = 4,
+    E_QSER_VOICE_ECALL_IND_ALACK_CLEARDOWN_RECEIVED = 5,
+    E_QSER_VOICE_ECALL_IND_DAILING = 9,
+    E_QSER_VOICE_ECALL_IND_ALERTING = 10,
+    E_QSER_VOICE_ECALL_IND_ACTIVE = 11,
+    E_QSER_VOICE_ECALL_IND_DISCONNECTED = 12,
+    E_QSER_VOICE_ECALL_IND_IMS_ACTIVE = 13,
+    E_QSER_VOICE_ECALL_IND_IMS_DISCONNECTED = 14,
+    E_QSER_VOICE_ECALL_IND_ABNORMAL_HANGUP=15,
+    E_QSER_VOICE_ECALL_IND_IMS_MSD_ACK = 20,
+    E_QSER_VOICE_ECALL_IND_IMS_UPDATE_MSD = 21,
+    E_QSER_VOICE_ECALL_IND_IMS_IN_BAND_TRANSFER = 22,
+    E_QSER_VOICE_ECALL_IND_IMS_MSD_NACK = 23,
+    E_QSER_VOICE_ECALL_IND_IMS_SRVCC = 24,
+    E_QSER_VOICE_ECALL_IND_ONLY_DEREGISTRATION = 31,
+    E_QSER_VOICE_ECALL_IND_MAY_DEREGISTER = 32,
+    E_QSER_VOICE_ECALL_IND_PSAP_CALLBACK_START = 40,
+    E_QSER_VOICE_ECALL_IND_PSAP_CALLBACK_IMS_UPDATE_MSD = 41,
+    E_QSER_VOICE_ECALL_IND_SENDING_START_IN_VOICE=8000,    
+    E_QSER_VOICE_ECALL_IND_T2_TIMER_OUT = 9000,
+    E_QSER_VOICE_ECALL_IND_T5_TIMER_OUT = 9001,
+    E_QSER_VOICE_ECALL_IND_T6_TIMER_OUT = 9002,
+    E_QSER_VOICE_ECALL_IND_T7_TIMER_OUT = 9003,
+    E_QSER_VOICE_ECALL_IND_REDIAL_TIMER_OUT = 9004,    
+    E_QSER_VOICE_ECALL_IND_AUTO_ANS_TIMER_OUT = 9005,
+    E_QSER_VOICE_ECALL_IND_AUTO_ANS_IMS_TIMER_OUT = 9006,
+    E_QSER_VOICE_ECALL_IND_UNSPECIFIED = 0xffff,
+}E_QSER_VOICE_ECALL_INDICATION_T;
+
+typedef void (*QSER_ECall_IndHandlerFunc_t)
+(
+    int                     callid,   
+    E_QSER_VOICE_ECALL_INDICATION_T ind,
+    void                    *contextPtr
+);
+
+int qser_voice_set_test_num(voice_client_handle_type*       h_voice,E_QSER_VOICE_ECALL_SET_TYPE_T type, const char *test_num, int test_num_length);
+int qser_voice_fast_ecall(voice_client_handle_type*       h_voice,
+                        int                         *call_id,
+                        E_QSER_VOICE_ECALL_CATEGORY_T cat,
+                        E_QSER_VOICE_ECALL_VARIANT_T variant,
+                        const char *addr, 
+                        int addr_length, 
+                        const unsigned char *msd_data,
+                        int msd_length);  //msd_length should <= QSER_MSD_MAX_LENGTH
+int qser_voice_set_msd( int callid, const unsigned char *msd_data, int msd_length); // msd_length should <= QSER_MSD_MAX_LENGTH
+int qser_voice_add_ecall_indhandler(voice_client_handle_type*          h_voice,
+                                  QSER_ECall_IndHandlerFunc_t   handlerPtr,
+                                  void*                             contextPtr);
+
+#endif
     
 #ifdef __cplusplus
 }
diff --git a/cap/zx297520v3/src/lynq/lib/liblynq-qser-voice/lynq-qser-voice.cpp b/cap/zx297520v3/src/lynq/lib/liblynq-qser-voice/lynq-qser-voice.cpp
index d32a69e..7d68695 100755
--- a/cap/zx297520v3/src/lynq/lib/liblynq-qser-voice/lynq-qser-voice.cpp
+++ b/cap/zx297520v3/src/lynq/lib/liblynq-qser-voice/lynq-qser-voice.cpp
@@ -19,6 +19,11 @@
 #define MIN_VOLUME 0
 #define MAX_VOLUME 5
 
+#ifdef ECALL_SUPPORT
+static pthread_t s_lynq_ecall_tid = -1;
+static QSER_ECall_IndHandlerFunc_t   s_ecall_cb = NULL;
+static int s_ecall_thread_status = 0;
+#endif
 
 static pthread_t s_lynq_voice_tid = -1;
 static QSER_VoiceCall_StateHandlerFunc_t   s_voice_cb = NULL;
@@ -112,6 +117,24 @@
         LYERRLOG("init first");
         return RESULT_ERROR;
     }
+
+
+#ifdef ECALL_SUPPORT    
+    s_ecall_thread_status = 0;
+
+    if(s_lynq_ecall_tid!=-1)
+    {
+        int ret = pthread_cancel(s_lynq_ecall_tid);
+        LYINFLOG("pthread cancel waiting urc thread, ret = %d",ret);            
+  
+        ret = pthread_join(s_lynq_ecall_tid,NULL);
+        LYINFLOG("pthread join waiting urc thread ret = %d",ret);
+        s_lynq_ecall_tid =-1;
+    }
+	
+    s_ecall_cb=NULL;
+#endif
+
     return lynq_deinit_call();
 }
 
@@ -235,5 +258,89 @@
 
 }
 
+#ifdef ECALL_SUPPORT
+int qser_voice_fast_ecall(voice_client_handle_type*       h_voice,
+                        int                         *call_id,
+                        E_QSER_VOICE_ECALL_CATEGORY_T cat,
+                        E_QSER_VOICE_ECALL_VARIANT_T variant,
+                        const char *addr, 
+                        int addr_length, 
+                        const unsigned char *msd_data,
+                        int msd_length)
+{ 
+    if(h_voice == NULL || (*h_voice) == 0 )
+    {
+        LYERRLOG("%s input error", __func__);
+        return RESULT_ERROR;
+    }
+
+    return lynq_fast_ecall(call_id,(LYNQ_ECall_Category) cat,(LYNQ_ECall_Variant) variant,addr,addr_length,msd_data,msd_length);
+}
+
+int qser_voice_set_test_num(voice_client_handle_type*       h_voice,E_QSER_VOICE_ECALL_SET_TYPE_T type, const char *test_num, int test_num_length)
+{
+    if(h_voice == NULL || (*h_voice) == 0 )
+    {
+        LYERRLOG("%s input error", __func__);
+        return RESULT_ERROR;
+    }              
+
+    return lynq_set_test_num((LYNQ_ECall_Set_Type) type, test_num, test_num_length);
+}
+
+int qser_voice_set_msd(int callid, const unsigned char *msd_data, int msd_length)
+{           
+    return lynq_set_msd(callid, msd_data, msd_length);
+}
+
+void *ecall_thread_recv(void *context)
+{
+    int handle = 0;
+    LYNQ_ECall_Indication eCall_Indication;
+    while (s_ecall_thread_status)
+    {
+        lynq_wait_ecall_indication(&handle, &eCall_Indication);
+        if(s_ecall_thread_status == 0)
+        {
+            return NULL;
+        }       
+       
+        if (s_ecall_cb != NULL)
+        {
+            s_ecall_cb(&handle,(E_QSER_VOICE_ECALL_INDICATION_T) eCall_Indication,context);
+        }
+    }
+    return NULL;
+}
+
+int qser_voice_add_ecall_indhandler(voice_client_handle_type*          h_voice,
+                                  QSER_ECall_IndHandlerFunc_t   handlerPtr,                                  
+                                  void*                             contextPtr)
+{
+    if(h_voice == NULL || (*h_voice) == 0 || handlerPtr== NULL)
+    {
+        LYERRLOG("input error");
+        return RESULT_ERROR;
+    }
+    if (s_ecall_cb != NULL)
+    {
+        LYERRLOG("The existing state handle does not need to be added");
+        return RESULT_ERROR;
+    }
+    s_ecall_cb = handlerPtr;
+    s_ecall_thread_status = 1;
+    int rt = pthread_create(&s_lynq_ecall_tid, NULL, ecall_thread_recv, contextPtr);
+    if(rt < 0)
+    {
+        LYDBGLOG("qser_voice_call_addstatehandler pthread_create error!!!\n");
+        s_ecall_cb = NULL;
+        s_ecall_thread_status = 0;
+        s_lynq_ecall_tid = -1;
+        return RESULT_ERROR;
+    }
+    return RESULT_OK;
+}
+#endif
+
 DEFINE_LYNQ_LIB_LOG(LYNQ_QSER_CALL)
 
diff --git a/cap/zx297520v3/src/lynq/lib/liblynq-qser-voice/makefile b/cap/zx297520v3/src/lynq/lib/liblynq-qser-voice/makefile
old mode 100644
new mode 100755
index b5b7d36..241cdec
--- a/cap/zx297520v3/src/lynq/lib/liblynq-qser-voice/makefile
+++ b/cap/zx297520v3/src/lynq/lib/liblynq-qser-voice/makefile
@@ -7,6 +7,7 @@
                 -flto \
                 -fPIC \
                 -fpermissive \
+                -DECALL_SUPPORT \
 
 
 
diff --git a/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/arch/arm/boot/dts/zx297520v3-pinctrl.dtsi b/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/arch/arm/boot/dts/zx297520v3-pinctrl.dtsi
index 5a5eb0a..db91206 100755
--- a/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/arch/arm/boot/dts/zx297520v3-pinctrl.dtsi
+++ b/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/arch/arm/boot/dts/zx297520v3-pinctrl.dtsi
@@ -23,8 +23,19 @@
 		bias-pull-up;
 //		input-schmitt-disable;
 	};
+//xf.li@20240327 modify for T106BUG-567 start
+	rmii_active: rmii_active {
+		pins ="RMII_TXEN", "RMII_RXEN", "RMII_RXD0", "RMII_RXD1", "RMII_TXD0", "RMII_TXD1";
+		function = "RMII";
+		bias-disabled;
+	};
 
-
+	rmii_sleep: rmii_sleep {
+		pins = "RMII_TXEN", "RMII_RXEN", "RMII_RXD0", "RMII_RXD1", "RMII_TXD0", "RMII_TXD1";
+    		function = "BGPIO";
+		bias-pull-down;
+		input-enable;
+	};
 
 i2c0_active: i2c0_active {
     pins = "I2C0_SCL", "I2C0_SDA";
@@ -36,8 +47,8 @@
 i2c0_sleep: i2c0_sleep {
     pins = "I2C0_SCL", "I2C0_SDA";
     function = "BGPIO";
-
-    bias-disabled;
+    input-enable;
+    bias-pull-down;
 };
 
 i2c1_active: i2c1_active {
@@ -50,10 +61,10 @@
 i2c1_sleep: i2c1_sleep {
     pins = "I2C1_SCL", "I2C1_SDA";
     function = "BGPIO";
-
-    bias-disabled;
+    input-enable;
+    bias-pull-down;
 };
-	
+//xf.li@20240327 modify for T106BUG-567 end
 	sd1_gpio: sd1_gpio {
 		pins = "SD1_CMD", "SD1_D0";
 		function = "BGPIO";
@@ -166,9 +177,12 @@
 		pins = "UART0_RXD", "UART0_TXD";
 		function = "UART0";
 	};
+//xf.li@20240327 modify for T106BUG-567 start
 	uart0_sleep: uart0_sleep {
 		pins = "UART0_RXD", "UART0_TXD";
 		function = "BGPIO";
+		input-enable;
+		bias-pull-down;
 	};
 	uart1_active: uart1_active {
 		pins = "UART1_RXD", "UART1_TXD";
@@ -185,13 +199,15 @@
 	uart2_sleep: uart2_sleep {
 		pins = "EXT_INT10", "EXT_INT11";
 		function = "BGPIO";
+		input-enable;
+		bias-pull-down;
 	};
-	
+//xf.li@20240327 modify for T106BUG-567 end
 	codec_reset_pins:codec_reset_pins {
 		pins = "EXT_INT10", "EXT_INT11";
 		function = "BGPIO";
 	};
-
+//xf.li@20240327 modify for T106BUG-567 start
 	ssp0_active:ssp0_active {
 		pins = "SSP0_CLK","SSP0_RXD","SSP0_TXD";
 		function = "SSP0";
@@ -200,9 +216,16 @@
 		pins = "SSP0_CLK","SSP0_RXD","SSP0_TXD";
 		function = "BGPIO";
 	};
-	ssp0_cs_gpio:ssp0_cs_gpio {
+	ssp0_cs_gpio_active:ssp0_cs_gpio_active {
 		pins = "SSP0_CS";
 		function = "BGPIO";
+		bias-pull-up;
+	};
+	ssp0_cs_gpio_sleep:ssp0_cs_gpio_sleep {
+		pins = "SSP0_CS";
+		function = "BGPIO";
+		bias-pull-down;
+		input-enable;
 	};
 	ssp0_cs_func:ssp0_cs_func {
 		pins = "SSP0_CS";
@@ -217,15 +240,22 @@
 		pins = "CAM_SPI_CLK","CAM_SPI_D0","CAM_SPI_D1";
 		function = "BGPIO";
 	};
-	ssp1_cs_gpio:ssp1_cs_gpio {
+	ssp1_cs_gpio_active:ssp1_cs_gpio_active {
 		pins = "CAM_SPI_CS";
 		function = "BGPIO";
+		bias-pull-up;
+	};
+	ssp1_cs_gpio_sleep:ssp1_cs_gpio_sleep {
+		pins = "CAM_SPI_CS";
+		function = "BGPIO";
+		bias-pull-down;
+		input-enable;
 	};
 	ssp1_cs_func:ssp1_cs_func {
 		pins = "CAM_SPI_CS";
 		function = "CAM_SPI";
 	};
-
+//xf.li@20240327 modify for T106BUG-567 end
 	spidev0_ex_gpio_pins:gpio129 {
 		pins = "GPIO129";
 		function = "BGPIO";	
@@ -251,17 +281,19 @@
 		input-schmitt-disable;
 	};
 	
-
+//xf.li@20240327 modify for T106BUG-567 start
 	i2s0_sleep: i2s0_sleep {
 		pins = "I2S0_WS","I2S0_CLK","I2S0_DIN","I2S0_DOUT";
 		function = "BGPIO";
-		bias-disable;
+		input-enable;
+		bias-pull-down;
 	};		
 
 	i2s1_sleep: i2s1_sleep {
 		pins = "I2S1_WS","I2S1_CLK","I2S1_DIN","I2S1_DOUT";
 		function = "BGPIO";
-		bias-disable;
+		input-enable;
+		bias-pull-down;
 	};		
 	tdm_pins: tdm_pins {
 		pins = "I2S0_WS","I2S0_CLK","I2S0_DIN","I2S0_DOUT";
@@ -274,9 +306,10 @@
 	tdm_sleep: tdm_sleep {
 		pins = "I2S0_WS","I2S0_CLK","I2S0_DIN","I2S0_DOUT";
 		function = "BGPIO";
-		bias-disable;
+		input-enable;
+		bias-pull-down;
 	};
-	
+//xf.li@20240327 modify for T106BUG-567 end
 	clk0_func_pins: clk0_func_pins 
 	{		
 		pins = "CLK_OUT0";		
diff --git a/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/arch/arm/boot/dts/zx297520v3-vehicle_dc_ref.dts b/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/arch/arm/boot/dts/zx297520v3-vehicle_dc_ref.dts
index ef16a4e..4aa7dd9 100755
--- a/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/arch/arm/boot/dts/zx297520v3-vehicle_dc_ref.dts
+++ b/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/arch/arm/boot/dts/zx297520v3-vehicle_dc_ref.dts
@@ -164,9 +164,10 @@
 &gmac {
     port-nums = <1>;
     rmii-ports = <1>;
-    pinctrl-names = "state0";
-	pinctrl-0 = <&rmii_clki_pins>;
-	
+//xf.li@20240327 modify for T106BUG-567 start
+    //pinctrl-names = "state0";
+	//pinctrl-0 = <&rmii_clki_pins>;
+//xf.li@20240327 modify for T106BUG-567 end
     gpios = <&bgpio 83 GPIO_ACTIVE_HIGH>,
             <&bgpio 63 GPIO_ACTIVE_HIGH>;
     status = "okay";
diff --git a/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/arch/arm/boot/dts/zx297520v3.dtsi b/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/arch/arm/boot/dts/zx297520v3.dtsi
index 6c69adc..c52f699 100755
--- a/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/arch/arm/boot/dts/zx297520v3.dtsi
+++ b/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/arch/arm/boot/dts/zx297520v3.dtsi
@@ -527,7 +527,11 @@
 			interrupts = <GIC_SPI GMAC_INT IRQ_TYPE_LEVEL_HIGH>;
 			phy-mode = "rmii";
 			port-mask = <0x00000000>;
-			
+//xf.li@20240327 modify for T106BUG-567 start
+			pinctrl-names = "default", "sleep";
+			pinctrl-0 = <&rmii_active>;
+			pinctrl-1 = <&rmii_sleep>;
+//xf.li@20240327 modify for T106BUG-567 end
 			status = "disabled";
 		};
 		
@@ -626,11 +630,12 @@
 			clock-frequency = <52000000>;
 			clocks = <&clkc SSP0_WCLK>, <&clkc SSP0_PCLK>;
 			clock-names = "work_clk", "apb_clk";
-			pinctrl-names = "default","sleep","cs_gpio","cs_func";
+			pinctrl-names = "default","sleep","cs_gpio_active","cs_func","cs_gpio_sleep";
 			pinctrl-0 = <&ssp0_active>; 
 			pinctrl-1 = <&ssp0_sleep>;
-			pinctrl-2 = <&ssp0_cs_gpio>;
+			pinctrl-2 = <&ssp0_cs_gpio_active>;
 			pinctrl-3 = <&ssp0_cs_func>;
+			pinctrl-4 = <&ssp0_cs_gpio_sleep>;
 			gpios = <&bgpio 25 GPIO_ACTIVE_HIGH>,
 					<&bgpio 26 GPIO_ACTIVE_HIGH>,/*clk*/
 					<&bgpio 28 GPIO_ACTIVE_HIGH>,/*tx*/
@@ -676,11 +681,12 @@
 			clock-frequency = <52000000>;
 			clocks = <&clkc SSP1_WCLK>, <&clkc SSP1_PCLK>;
 			clock-names = "work_clk", "apb_clk";
-			pinctrl-names = "default","sleep","cs_gpio","cs_func";
+			pinctrl-names = "default","sleep","cs_gpio_active","cs_func","cs_gpio_sleep";
 			pinctrl-0 = <&ssp1_active>; 
 			pinctrl-1 = <&ssp1_sleep>;
-			pinctrl-2 = <&ssp1_cs_gpio>;
+			pinctrl-2 = <&ssp1_cs_gpio_active>;
 			pinctrl-3 = <&ssp1_cs_func>;
+			pinctrl-4 = <&ssp1_cs_gpio_sleep>;
 			gpios = <&bgpio 87 GPIO_ACTIVE_LOW>,
 					<&bgpio 88 GPIO_ACTIVE_LOW>,/*clk*/
 					<&bgpio 90 GPIO_ACTIVE_LOW>,/*tx*/
@@ -850,8 +856,15 @@
 		};	
         zx29_es8311: zx29_es8311{
 			compatible = "zxic,zx29_es8311";
-			pinctrl-names = "top_i2s";
+//xf.li@20240327 modify for T106BUG-567 start
+			pinctrl-names = "top_i2s0","top_i2s1","top_tdm","topi2s0_sleep","topi2s1_sleep","toptdm_sleep";
 			pinctrl-0 = <&i2s0_pins>;
+			pinctrl-1 = <&i2s1_pins>;
+			pinctrl-2 = <&tdm_pins>;
+			pinctrl-3 = <&i2s0_sleep>;
+			pinctrl-4 = <&i2s1_sleep>;
+			pinctrl-5 = <&tdm_sleep>;
+//xf.li@20240327 modify for T106BUG-567 end
 			reg = <0x0 0x00140000 0x0 0x00001000>;
 			reg-names = "soc_sys";
 
diff --git a/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/drivers/i2c/busses/i2c-zx29.c b/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/drivers/i2c/busses/i2c-zx29.c
index b8fce94..2d52e80 100755
--- a/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/drivers/i2c/busses/i2c-zx29.c
+++ b/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/drivers/i2c/busses/i2c-zx29.c
@@ -1897,21 +1897,37 @@
 }

 

 

-

+//xf.li@20240327 modify for T106BUG-567 start

 #ifdef CONFIG_PM

 static int zx29_i2c_suspend(struct platform_device *pdev, pm_message_t state)

 {

-//    pinctrl_pm_select_sleep_state(&pdev->dev);

+	printk("LYNQ: in zx29_i2c_suspend");

+	if(pdev == NULL)

+		return -1;

+	if(pdev && &pdev->dev)

+	{

+		printk("LYNQ: select sleep state");

+		pinctrl_pm_select_sleep_state(&pdev->dev);

+	}

+

     return 0;

 };

 

 static int zx29_i2c_resume(struct platform_device *pdev)

 {

-//    pinctrl_pm_select_default_state(&pdev->dev);

+	printk("LYNQ: in zx29_i2c_resume");

+	if(pdev == NULL)

+		return -1;

+	if(pdev && &pdev->dev)

+	{

+		printk("LYNQ: select default state");

+		pinctrl_pm_select_default_state(&pdev->dev);

+	}

+

     return 0;

 };

 #endif

-

+//xf.li@20240327 modify for T106BUG-567 end

 

 static const struct of_device_id zx29_i2c_match[] = {

     {.compatible = "zte,zx29_i2c"},

diff --git a/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/drivers/net/ethernet/zte/zx29_gmac.c b/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/drivers/net/ethernet/zte/zx29_gmac.c
index fd87356..2db6217 100755
--- a/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/drivers/net/ethernet/zte/zx29_gmac.c
+++ b/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/drivers/net/ethernet/zte/zx29_gmac.c
@@ -24,7 +24,7 @@
 #include <linux/pinctrl/consumer.h>

 #include <linux/gpio.h>

 #include <linux/of_gpio.h>

-#include <linux/device.h>
+#include <linux/device.h>

 #include "zx29_gmac.h"

 

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

@@ -897,7 +897,7 @@
 	gmac = (unsigned *)ndev->base_addr;

 	

 	enum of_gpio_flags flags;

-    unsigned long flag;
+    unsigned long flag;

 	int gpio = 0;

 	int ret = 0;

 	

@@ -905,7 +905,7 @@
 	if (ndev && !priv->stopped) {

 		if (netif_running(ndev)) {

 			

-			spin_lock_irqsave(&priv->lock, flag);
+			spin_lock_irqsave(&priv->lock, flag);

             netif_stop_queue(ndev);

 			netif_carrier_off(ndev);

 			priv->stopped = 1;

@@ -918,12 +918,12 @@
 			gpio_direction_output(priv->gpio_power[0], 0);

 			

 			gmac_stop((void*)ndev->base_addr); 

-            spin_unlock_irqrestore(&priv->lock, flag);
+            spin_unlock_irqrestore(&priv->lock, flag);

 		

 //			netif_device_detach(ndev);

 		}

-        pm_relax(&pdev->dev);
-       // printk("[%s] sleep\n");
+        pm_relax(&pdev->dev);

+       // printk("[%s] sleep\n");

     }

 #endif

 	//printk("[%s] exit\n", __func__);

@@ -951,7 +951,7 @@
 	    pm_stay_awake(&pdev->dev);

 		if( netif_running(ndev)) {			

             printk("[%s] enter\n", __func__);

-			spin_lock_irqsave(&priv->lock, flag);
+			spin_lock_irqsave(&priv->lock, flag);

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

 

 			base = base_clk;

@@ -960,8 +960,8 @@
 			base = base_phy_release;

 			gmac_phy_release();

 

-		    mdelay(500); //icplus ping need
-
+		    mdelay(500); //icplus ping need

+

             priv->phydev->drv->config_init(priv->phydev);

 			gmac_hw_init(ndev);

 

@@ -972,7 +972,7 @@
             hrtimer_start(priv->timer, ktime_set(0, GTIMER_INTERVAL * 1000), HRTIMER_MODE_REL);

 #endif 

 			priv->stopped = 0;

-            spin_unlock_irqrestore(&priv->lock, flag);
+            spin_unlock_irqrestore(&priv->lock, flag);

             printk("[%s] enter\n", __func__);

 //			netif_device_attach(ndev);	  	

 		}

@@ -1153,6 +1153,9 @@
 #endif

     	}

     }

+//xf.li@20240327 modify for T106BUG-567 start

+    pinctrl_pm_select_sleep_state(&pdev->dev);

+//xf.li@20240327 modify for T106BUG-567 end

     return 0;

 }

 

@@ -1167,6 +1170,9 @@
 	gmac = (unsigned *)ndev->base_addr;

     unsigned long flag = 0;

 

+//xf.li@20240327 modify for T106BUG-567 start

+    pinctrl_pm_select_default_state(&pdev->dev);

+//xf.li@20240327 modify for T106BUG-567 end

     if(ndev) {

     	if(netif_running(ndev)) {

 //        	gmac_start((void*)ndev->base_addr);

@@ -1225,60 +1231,60 @@
 	.ndo_set_mac_address = zx29_gmac_set_mac_address,

 };

 

-
-
-ssize_t show_fun(struct device *dev, struct device_attribute *attr, char *buf)
-{
+

+

+ssize_t show_fun(struct device *dev, struct device_attribute *attr, char *buf)

+{

 	struct platform_device *pdev	= to_platform_device(dev);

     struct net_device 	*ndev		= platform_get_drvdata(pdev);

-    int status = 0;
-    volatile unsigned *gmac = (unsigned *)ndev->base_addr;
-    struct zx29_gmac_dev *priv = (struct zx29_gmac_dev *)netdev_priv(ndev);
-    printk("MAC(1000) :0x%x\n", MAC(0x1000));
-    printk("MAC(1004) :0x%x\n", MAC(0x1004));
-    printk("MAC(1008) :0x%x\n", MAC(0x1008));
-    printk("MAC(100c) :0x%x\n", MAC(0x100c));
-    printk("MAC(1010) :0x%x\n", MAC(0x1010));
-    printk("MAC(1014) int status:0x%x\n", MAC(0x1014));
-    printk("MAC(1018) :0x%x\n", MAC(0x1018));
-    printk("MAC(101c) :0x%x\n", MAC(0x101c));
-    printk("MAC(0000) :0x%x\n", MAC(0x0000));
-    printk("MAC(0004) :0x%x\n", MAC(0x0004));
-    printk("MAC(0010) :0x%x\n", MAC(0x0010));
-
-    status = mdiobus_read(priv->phydev->mdio.bus, 21, 1);
-    printk("phy status:0x%x\n", status);
-    status = mdiobus_read(priv->phydev->mdio.bus, 0, 1);
-    printk("phy status port0:0x%x\n", status);
-    status = mdiobus_read(priv->phydev->mdio.bus, 1, 1);
-    printk("phy status port1:0x%x\n", status);
-    status = mdiobus_read(priv->phydev->mdio.bus, 2, 1);
-    printk("phy status port2:0x%x\n", status);
-    status = mdiobus_read(priv->phydev->mdio.bus, 3, 1);
-    printk("phy status port3:0x%x\n", status);
-    status = mdiobus_read(priv->phydev->mdio.bus, 4, 1);
-    printk("phy status port4:0x%x\n", status);
-
-    status = mdiobus_read(priv->phydev->mdio.bus, 21, 20);
-    status |= 0x4;
-    mdiobus_write(priv->phydev->mdio.bus, 21, 20, status);
-
-    status = mdiobus_read(priv->phydev->mdio.bus, 21, 21);
-    printk("phy status loop port:0x%x\n", status);
-
-
-    return 0;
-}
-
-ssize_t store_fun(struct device *dev, struct device_attribute *attr, const char *buf, size_t count)
-{
+    int status = 0;

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

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

+    printk("MAC(1000) :0x%x\n", MAC(0x1000));

+    printk("MAC(1004) :0x%x\n", MAC(0x1004));

+    printk("MAC(1008) :0x%x\n", MAC(0x1008));

+    printk("MAC(100c) :0x%x\n", MAC(0x100c));

+    printk("MAC(1010) :0x%x\n", MAC(0x1010));

+    printk("MAC(1014) int status:0x%x\n", MAC(0x1014));

+    printk("MAC(1018) :0x%x\n", MAC(0x1018));

+    printk("MAC(101c) :0x%x\n", MAC(0x101c));

+    printk("MAC(0000) :0x%x\n", MAC(0x0000));

+    printk("MAC(0004) :0x%x\n", MAC(0x0004));

+    printk("MAC(0010) :0x%x\n", MAC(0x0010));

+

+    status = mdiobus_read(priv->phydev->mdio.bus, 21, 1);

+    printk("phy status:0x%x\n", status);

+    status = mdiobus_read(priv->phydev->mdio.bus, 0, 1);

+    printk("phy status port0:0x%x\n", status);

+    status = mdiobus_read(priv->phydev->mdio.bus, 1, 1);

+    printk("phy status port1:0x%x\n", status);

+    status = mdiobus_read(priv->phydev->mdio.bus, 2, 1);

+    printk("phy status port2:0x%x\n", status);

+    status = mdiobus_read(priv->phydev->mdio.bus, 3, 1);

+    printk("phy status port3:0x%x\n", status);

+    status = mdiobus_read(priv->phydev->mdio.bus, 4, 1);

+    printk("phy status port4:0x%x\n", status);

+

+    status = mdiobus_read(priv->phydev->mdio.bus, 21, 20);

+    status |= 0x4;

+    mdiobus_write(priv->phydev->mdio.bus, 21, 20, status);

+

+    status = mdiobus_read(priv->phydev->mdio.bus, 21, 21);

+    printk("phy status loop port:0x%x\n", status);

+

+

+    return 0;

+}

+

+ssize_t store_fun(struct device *dev, struct device_attribute *attr, const char *buf, size_t count)

+{

 	struct platform_device *pdev	= to_platform_device(dev);

     struct net_device 	*ndev		= platform_get_drvdata(pdev);

-    printk("[%s]", __func__);    
-    return 1;
-}
-
-
+    printk("[%s]", __func__);    

+    return 1;

+}

+

+

 ssize_t mdio_show(struct device *dev, struct device_attribute *attr, char *buf)

 {

 	struct platform_device *pdev	= to_platform_device(dev);

@@ -1695,7 +1701,7 @@
 

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

 

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

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

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

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

@@ -1723,7 +1729,7 @@
 	if (!ndev)

 		return -ENOMEM;

 

-    device_create_file(&pdev->dev, &dev_attr_gmac_test);
+    device_create_file(&pdev->dev, &dev_attr_gmac_test);

 	device_create_file(&pdev->dev, &dev_attr_mdio_test);

 	device_create_file(&pdev->dev, &dev_attr_free_mdio);

 	device_create_file(&pdev->dev, &dev_attr_debug_on);

@@ -1733,22 +1739,24 @@
 	prv = netdev_priv(ndev);

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

 	prv->stopped = 1;

-	
+	

     pctrl = devm_pinctrl_get(&pdev->dev);

 	if (IS_ERR(pctrl)) {

-		dev_warn(&pdev->dev, "Failed to get test pins");
+		dev_warn(&pdev->dev, "Failed to get test pins");

 		pctrl = NULL;

-		goto errirq;
+		goto errirq;

 	}

-	

-	state0 = pinctrl_lookup_state(pctrl, "state0");

+//xf.li@20240327 modify for T106BUG-567 start

+	//state0 = pinctrl_lookup_state(pctrl, "state0");

+	state0 = pinctrl_lookup_state(pctrl, "default");

+//xf.li@20240327 modify for T106BUG-567 end

 	if (IS_ERR(state0)) {

-		dev_err(&pdev->dev, "TEST: missing state0\n");
+		dev_err(&pdev->dev, "TEST: missing state0\n");

 		goto pinctrl_init_end;

 	}	

 

 	if (pinctrl_select_state(pctrl, state0) < 0) {

-		dev_err(&pdev->dev, "setting state0 failed\n");
+		dev_err(&pdev->dev, "setting state0 failed\n");

 		goto pinctrl_init_end;

 	}

     

@@ -1756,7 +1764,7 @@
 	ret = gpio_request(prv->gpio_power[0], "gmac_power"); /* gpio 83/124 */

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

 	mdelay(15);

-#ifdef CONFIG_MDIO_C45 //zw.wang Customer chooses phy c22/c45 issues on 20240301
+#ifdef CONFIG_MDIO_C45 //zw.wang Customer chooses phy c22/c45 issues on 20240301

 	prv->gpio_power[1] = of_get_gpio_flags(pdev->dev.of_node, 1, &flags);

 	ret = gpio_request(prv->gpio_power[1], "phy_rst"); /* gpio 63 */

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

@@ -1768,7 +1776,7 @@
 	SET_NETDEV_DEV(ndev, &pdev->dev); //if not, will panic

 	

 	base = devm_platform_ioremap_resource(pdev, 0);

-	gmac_power_flag = prv->gpio_power[0];//jb.qi add for gamc power down on 20231116
+	gmac_power_flag = prv->gpio_power[0];//jb.qi add for gamc power down on 20231116

 	ndev->base_addr = base;/*iomem->start;*/

 	if (!ndev->base_addr)

 		return -ENXIO;

@@ -1867,8 +1875,8 @@
 		printk("set gmac wakelock!\n");

 	} else {	

 		strcpy(board_name, "mdl");

-	    netif_device_detach(ndev);
-    }
+	    netif_device_detach(ndev);

+    }

     

 	platform_set_drvdata(pdev, ndev);

 

@@ -1963,7 +1971,7 @@
 		free_netdev(ndev);

 	    platform_set_drvdata(pdev, NULL);

 

-#ifdef CONFIG_MDIO_C45 //zw.wang Customer chooses phy c22/c45 issues on 20240301
+#ifdef CONFIG_MDIO_C45 //zw.wang Customer chooses phy c22/c45 issues on 20240301

 		gpio_free(priv->gpio_power[1]);

 #endif

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

diff --git a/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/drivers/spi/spi-zx29.c b/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/drivers/spi/spi-zx29.c
index 4000729..b18019f 100755
--- a/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/drivers/spi/spi-zx29.c
+++ b/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/drivers/spi/spi-zx29.c
@@ -288,12 +288,14 @@
 struct zx29_ssp_pins
 {
 	struct device	*dev;
-	
+	//xf.li@20240327 modify for T106BUG-567 start
 	struct pinctrl		*pctrl;
 	struct pinctrl_state	*pfunc;
 	struct pinctrl_state	*pgpio;
-	struct pinctrl_state	*pcs_gpio;
+	struct pinctrl_state	*pcs_gpio_active;
 	struct pinctrl_state	*pcs_func;
+	struct pinctrl_state	*pcs_gpio_sleep;
+	//xf.li@20240327 modify for T106BUG-567 end
 	int	gpio_cs;
 	int	gpio_clk;	
 	int	gpio_tx;	
@@ -1992,7 +1994,7 @@
 };
 
 /*
-*    spi ʹÓÃGPIOģʽ¶ÁÈ¡LCD µÄID Begin
+*    spi ʹ\D3\C3GPIOģʽ\B6\C1ȡLCD \B5\C4ID Begin
 */
 static void spi_set_gpio_function(int dev_id)
 {
@@ -2592,18 +2594,23 @@
 	}
 	ssp_pins[pdev->id].pctrl=pctrl;
 
-	ssp_pins[pdev->id].pcs_gpio =  pinctrl_lookup_state(pctrl, "cs_gpio");
-	if (IS_ERR(ssp_pins[pdev->id].pcs_gpio)) {
-			dev_err(&pdev->dev, "missing cs_gpio \n");
+	ssp_pins[pdev->id].pcs_gpio_active =  pinctrl_lookup_state(pctrl, "cs_gpio_active");
+	if (IS_ERR(ssp_pins[pdev->id].pcs_gpio_active)) {
+			dev_err(&pdev->dev, "missing cs_gpio_active \n");
 	}	
-
+//xf.li@20240327 modify for T106BUG-567 start
+	ssp_pins[pdev->id].pcs_gpio_sleep =  pinctrl_lookup_state(pctrl, "cs_gpio_sleep");
+	if (IS_ERR(ssp_pins[pdev->id].pcs_gpio_sleep)) {
+			dev_err(&pdev->dev, "missing cs_gpio_sleep \n");
+	}
+//xf.li@20240327 modify for T106BUG-567 end
 	ssp_pins[pdev->id].pcs_func = pinctrl_lookup_state(ssp_pins[pdev->id].pctrl, "cs_func");
 	if (IS_ERR(ssp_pins[pdev->id].pcs_func)) {
 			dev_err(&pdev->dev, "missing cs_func \n");
 	}
 	
 	if(zx29spi->master->slave == false) {	
-		if (pinctrl_select_state(ssp_pins[pdev->id].pctrl, ssp_pins[pdev->id].pcs_gpio) < 0) {
+		if (pinctrl_select_state(ssp_pins[pdev->id].pctrl, ssp_pins[pdev->id].pcs_gpio_active) < 0) {
 			printk("spi%d setting cs_gpio pin ctrl failed\n",pdev->id);
 		}		
 	}else {	
@@ -3222,14 +3229,23 @@
 		return -1;
 	if(pdev && &pdev->dev)
 		pinctrl_pm_select_sleep_state(&pdev->dev);
-
+//xf.li@20240327 modify for T106BUG-567 start
 	zx29spi = (struct zx29_spi *)platform_get_drvdata(pdev);
 	if(zx29spi && (zx29spi->master->slave == true)) {
-		if (pinctrl_select_state(ssp_pins[pdev->id].pctrl, ssp_pins[pdev->id].pcs_gpio) < 0) {
+		if (pinctrl_select_state(ssp_pins[pdev->id].pctrl, ssp_pins[pdev->id].pcs_gpio_sleep) < 0) {
 			printk("spi%d setting cs_gpio pin ctrl failed\n",pdev->id);
 			return -1;
 		}
 	}
+
+	if(zx29spi && (zx29spi->master->slave == false)) {
+		if (pinctrl_select_state(ssp_pins[pdev->id].pctrl, ssp_pins[pdev->id].pcs_gpio_sleep) < 0) {
+			printk("spi%d setting cs_gpio_sleep pin ctrl failed\n",pdev->id);
+			return -1;
+		}
+		printk("spi%d setting cs_gpio_sleep pin ctrl\n",pdev->id);
+	}
+//xf.li@20240327 modify for T106BUG-567 end
 	return 0;
 }
 
@@ -3241,7 +3257,7 @@
 		return -1;
 	if(pdev && &pdev->dev)
 		pinctrl_pm_select_default_state(&pdev->dev);
-
+//xf.li@20240327 modify for T106BUG-567 start
 	zx29spi = (struct zx29_spi *)platform_get_drvdata(pdev);
 	if(zx29spi && (zx29spi->master->slave == true)) {
 		if (pinctrl_select_state(ssp_pins[pdev->id].pctrl, ssp_pins[pdev->id].pcs_func) < 0) {
@@ -3249,6 +3265,15 @@
 			return -1;
 		}
 	}
+	if(zx29spi && (zx29spi->master->slave == false)) {
+		if (pinctrl_select_state(ssp_pins[pdev->id].pctrl, ssp_pins[pdev->id].pcs_gpio_active) < 0) {
+			printk("spi%d setting cs_gpio_active pin ctrl failed\n",pdev->id);
+			return -1;
+		}
+		printk("spi%d setting cs_gpio_active pin ctrl\n",pdev->id);
+		gpio_direction_output(ssp_pins[pdev->id].gpio_cs,SPI_GPIO_HIGH);
+	}
+//xf.li@20240327 modify for T106BUG-567 end
 	return 0;
 }
 #endif
diff --git a/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/drivers/tty/serial/zx29_uart.c b/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/drivers/tty/serial/zx29_uart.c
index 608ff72..bfa5cc4 100755
--- a/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/drivers/tty/serial/zx29_uart.c
+++ b/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/drivers/tty/serial/zx29_uart.c
@@ -3773,9 +3773,11 @@
 		enable_irq(zup->rxd_irq);
 		zup->rxd_int_depth = 1;
 	}
-#if 0
+//xf.li@20240327 modify for T106BUG-567 start
+#if 1
 	pinctrl_pm_select_sleep_state(dev);
 #endif
+//xf.li@20240327 modify for T106BUG-567 end
 	return 0;
 }
 
@@ -3799,9 +3801,11 @@
 	//	zup->rxd_int_depth--;
 	//}
 	//return uart_resume_port(&amba_reg, &uap->port);
-#if 0
+//xf.li@20240327 modify for T106BUG-567 start
+#if 1
 		pinctrl_pm_select_default_state(dev);
 #endif
+//xf.li@20240327 modify for T106BUG-567 end
 	return 0;
 }
 #endif
diff --git a/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/sound/soc/sanechips/zx29_es83xx.c b/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/sound/soc/sanechips/zx29_es83xx.c
index 050a0f8..6af8b65 100755
--- a/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/sound/soc/sanechips/zx29_es83xx.c
+++ b/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/sound/soc/sanechips/zx29_es83xx.c
@@ -77,6 +77,10 @@
 	int gpio_pdn;
 	void __iomem *sys_base_va;
 
+	struct pinctrl *p;
+	struct pinctrl_state *s;
+	struct pinctrl_state *s_sleep;
+
 };
 
 
@@ -703,15 +707,19 @@
 static void zx29_i2s_top_pin_cfg(struct platform_device *pdev)
 {
 	struct device *dev = &pdev->dev;
-	struct pinctrl *p,*p2;
-	struct pinctrl_state *s,*s2;
+	struct pinctrl *p;
+	struct pinctrl_state *s;
+	struct pinctrl_state *s_sleep;
 	int ret = 0;
-	printk("%s start n",__func__);
+	printk("%s start \n",__func__);
 
 	struct resource *res;
 	void __iomem	*reg_base;
 	unsigned int val;
+	
+	struct zx29_board_data *info = s_board;
 
+	pr_info("%s: board name(%s)!\n", __func__,info->name); 
 
 
 	res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "soc_sys");
@@ -732,7 +740,7 @@
 	#endif
 	 
 //#if 1 //CONFIG_USE_PIN_I2S0
-#ifdef 	CONFIG_USE_TOP_I2S0
+#if defined(CONFIG_USE_TOP_I2S0)
 
 	dev_info(dev, "%s: arm i2s1 to top i2s0!!\n", __func__); 
 	//9300
@@ -742,7 +750,7 @@
 	val &= ~(0x7<<0);
 	val |= 0x1<<0; //	inter arm_i2s1--top i2s1
 	zx_write_reg(reg_base+ZX29_I2S_TOP_LOOP_REG, val);
-#else //(CONFIG_USE_PIN_I2S1)
+#elif defined(CONFIG_USE_TOP_I2S1)//defined(CONFIG_USE_PIN_I2S1)
     //8501evb    	
 
 	dev_info(dev, "%s: arm i2s1 to top i2s1!\n", __func__); 
@@ -762,13 +770,89 @@
 	}
 	
 	dev_info(dev, "%s: get pinctrl ,p=0x%llx,dev=0x%llx!!\n", __func__,p,dev); 
+#if defined(CONFIG_USE_TOP_I2S0)
+	dev_info(dev, "%s: top_i2s0 pinctrl sel!!\n", __func__); 
 
-	s = pinctrl_lookup_state(p, "top_i2s");
+	s = pinctrl_lookup_state(p, "top_i2s0");
 	if (IS_ERR(s)) {
 		devm_pinctrl_put(p);
 		dev_err(dev, " get state failure!!\n");
 		return;
 	}
+
+	dev_info(dev, "%s: get  top_i2s sleep pinctrl sel!!\n", __func__); 
+
+	s_sleep = pinctrl_lookup_state(p, "topi2s0_sleep");
+	if (IS_ERR(s_sleep)) {
+		devm_pinctrl_put(p);
+		dev_err(dev, " get state failure!!\n");
+		return;
+	}
+
+	
+	
+#elif defined(CONFIG_USE_TOP_I2S1)
+	dev_info(dev, "%s: top_i2s1 pinctrl sel!!\n", __func__); 
+
+	s = pinctrl_lookup_state(p, "top_i2s1");
+	if (IS_ERR(s)) {
+		devm_pinctrl_put(p);
+		dev_err(dev, " get state failure!!\n");
+		return;
+	}
+	dev_info(dev, "%s: get  top_i2s sleep pinctrl sel!!\n", __func__); 
+
+	s_sleep = pinctrl_lookup_state(p, "topi2s1_sleep");
+	if (IS_ERR(s_sleep)) {
+		devm_pinctrl_put(p);
+		dev_err(dev, " get state failure!!\n");
+		return;
+	}	
+
+#elif defined(CONFIG_USE_TOP_TDM)
+	dev_info(dev, "%s: top_tdm pinctrl sel!!\n", __func__); 
+	s = pinctrl_lookup_state(p, "top_tdm");
+	if (IS_ERR(s)) {
+		devm_pinctrl_put(p);
+		dev_err(dev, " get state failure!!\n");
+		return;
+	}
+	dev_info(dev, "%s: get  top_i2s sleep pinctrl sel!!\n", __func__); 
+
+	s_sleep = pinctrl_lookup_state(p, "toptdm_sleep");
+	if (IS_ERR(s_sleep)) {
+		devm_pinctrl_put(p);
+		dev_err(dev, " get state failure!!\n");
+		return;
+	}
+
+#else
+	dev_info(dev, "%s: default top_i2s pinctrl sel!!\n", __func__); 
+
+	s = pinctrl_lookup_state(p, "top_i2s0");
+	if (IS_ERR(s)) {
+		devm_pinctrl_put(p);
+		dev_err(dev, " get state failure!!\n");
+		return;
+	}
+
+	dev_info(dev, "%s: get  top_i2s sleep pinctrl sel!!\n", __func__); 
+
+	s_sleep = pinctrl_lookup_state(p, "topi2s0_sleep");
+	if (IS_ERR(s_sleep)) {
+		devm_pinctrl_put(p);
+		dev_err(dev, " get state failure!!\n");
+		return;
+	}
+
+#endif
+	if(info != NULL){
+
+		info->p = p;
+		info->s = s;
+		info->s_sleep = s_sleep;
+	}
+
 	ret = pinctrl_select_state(p, s);
 	if (ret < 0) {
 		devm_pinctrl_put(p);
@@ -851,6 +935,104 @@
 	return ret;
 }
 
+#ifdef CONFIG_PM
+static int zx29_audio_suspend(struct platform_device * pdev, pm_message_t state)
+{
+	pr_info("%s: start!\n",__func__);
+
+    //pinctrl_pm_select_sleep_state(&pdev->dev);
+	return 0;
+}
+
+static int zx29_audio_resume(struct platform_device *pdev)
+{
+	pr_info("%s: start!\n",__func__);
+
+    //pinctrl_pm_select_default_state(&pdev->dev);
+
+	return 0;
+}
+
+int zx29_snd_soc_suspend(struct device *dev)
+{
+
+	int ret = 0;
+	struct zx29_board_data *info = s_board;
+
+	pr_info("%s: start![8311]\n",__func__);
+
+    //pinctrl_pm_select_sleep_state(dev);
+    if((info->p != NULL)&&(info->s_sleep != NULL)){
+		ret = pinctrl_select_state(info->p, info->s_sleep);
+		if (ret < 0) {
+			//devm_pinctrl_put(info->p);
+			dev_err(dev, " select state failure!!\n");
+			//return;
+		}
+		dev_info(dev, "%s: set pinctrl sleep end!\n", __func__);	
+    }
+	return snd_soc_suspend(dev);
+
+}
+int zx29_snd_soc_resume(struct device *dev)
+{
+	int ret = 0;
+	struct zx29_board_data *info = s_board;
+
+	pr_info("%s: start!\n",__func__);
+
+    //pinctrl_pm_select_default_state(dev);
+    if((info->p != NULL)&&(info->s != NULL)){
+		ret = pinctrl_select_state(info->p, info->s);
+		if (ret < 0) {
+			//devm_pinctrl_put(info->p);
+			dev_err(dev, " select state failure!!\n");
+			//return;
+		}
+		dev_info(dev, "%s: set pinctrl active end!\n", __func__);	
+    }
+
+
+	return snd_soc_resume(dev);
+
+}
+
+#else
+static int zx29_audio_suspend(struct platform_device * pdev, pm_message_t state)
+{
+
+	return 0;
+}
+
+static int zx29_audio_resume(struct platform_device *pdev)
+{
+
+
+	return 0;
+}
+
+int zx29_snd_soc_suspend(struct device *dev)
+{
+
+
+	return snd_soc_suspend(dev);
+
+}
+int zx29_snd_soc_resume(struct device *dev)
+{
+
+
+	return snd_soc_resume(dev);
+
+}
+
+
+#endif
+
+struct dev_pm_ops zx29_snd_soc_pm_ops = {
+	.suspend = zx29_snd_soc_suspend,
+	.resume = zx29_snd_soc_resume,
+};
 static struct platform_driver zx29_platform_driver = {
 	.driver		= {
 #if defined(CONFIG_SND_SOC_ZX29_ES8311)
@@ -862,7 +1044,7 @@
 		.name	= "zx29_es8311",
 #endif
 		.of_match_table = of_match_ptr(zx29_codec_of_match),
-		.pm	= &snd_soc_pm_ops,
+		.pm	= &zx29_snd_soc_pm_ops,
 	},
 	.probe		= zx29_audio_probe,
 };