[Feature][Modem]Merge MTK release P3 P4 patch

Change-Id: I1ef3d69e36378ee73a422ecb2721488d6b416427
diff --git a/mcu/protocol/interface/ims/atp_imc_struct.h b/mcu/protocol/interface/ims/atp_imc_struct.h
index 82c1bc4..8b756e8 100755
--- a/mcu/protocol/interface/ims/atp_imc_struct.h
+++ b/mcu/protocol/interface/ims/atp_imc_struct.h
@@ -53,6 +53,11 @@
  * removed!
  * removed!
  * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
  *
  * removed!
  * removed!
@@ -810,7 +815,7 @@
 typedef struct {
     LOCAL_PARA_HDR
     kal_uint8    name[64];
-    kal_uint8    value[128];
+    kal_uint8    value[256];
 } atp_imc_ecfg_set_req_struct;
 
 /*
@@ -869,7 +874,7 @@
     ims_err_id_enum     cause;      // return "IMS_ERR_UNKNOWN" for all so far
                                     // before define IMS domain proprietary cause
     kal_uint8           name[64];
-    kal_uint8           value[128];
+    kal_uint8           value[256];
 } atp_imc_ecfg_get_cnf_struct;
 
 /*
@@ -1342,6 +1347,15 @@
     kal_uint32 cause;   // un-used
 } atp_imc_atcmd_relay_cnf_struct;
 
+#ifdef __NG_ECALL_SUPPORT__
+typedef struct {  
+    LOCAL_PARA_HDR 
+    kal_uint8  ecall_domain;
+    kal_uint32 msd_data_len; 
+    kal_uint8  msd_data[IMS_MAX_MSD_LENGTH];
+} atp_imc_msd_update_req_struct;
+#endif
+
 /*
  * Description
  *  - the primitive is request of "MSG_ID_ATP_IMC_MIMS_CAPABILITY_REQ"
diff --git a/mcu/protocol/interface/ims/d2pm_d2rm_struct.h b/mcu/protocol/interface/ims/d2pm_d2rm_struct.h
index 22b617b..01264e8 100755
--- a/mcu/protocol/interface/ims/d2pm_d2rm_struct.h
+++ b/mcu/protocol/interface/ims/d2pm_d2rm_struct.h
@@ -332,6 +332,7 @@
 {
     kal_char apn[APN_STRING_LEN];
     kal_char req_apn[APN_STRING_LEN];
+    kal_char nw_assigned_apn[APN_STRING_LEN];
     kal_bool is_succ;
     ran_filter_struct ran_filter;    // d2pm_d2rm_ran_enum
     kal_bool errcause_present;
diff --git a/mcu/protocol/interface/ims/imcb_imc_struct.h b/mcu/protocol/interface/ims/imcb_imc_struct.h
index 6850014..de3258c 100755
--- a/mcu/protocol/interface/ims/imcb_imc_struct.h
+++ b/mcu/protocol/interface/ims/imcb_imc_struct.h
@@ -203,6 +203,7 @@
     IMCB_IMC_CALL_CAUSE_RETRY_IMS_VIDEO_TO_VOICE,
     IMCB_IMC_CALL_CAUSE_NO_RETRY_BAR_IMS,
 	IMCB_IMC_CALL_CAUSE_BEREJECT_380_FLIGHTMODE_CS,
+    IMCB_IMC_CALL_CAUSE_NO_RETRY_EMERGENCY,
     IMCB_IMC_CALL_CAUSE_UA_MAX,
     IMCB_IMC_CALL_CAUSE_AVAIABLE_OF_CALLS,
     IMCB_IMC_CALL_CAUSE_EMERG_REG_TIMEOUT, /* AT&T <CDR-LTE-2424>, CS domain search after emerg-reg-timer expires */
@@ -634,6 +635,7 @@
     IMCB_IMC_OPERATOR_M1            = 0x97, //151
     IMCB_IMC_OPERATOR_FIRSTNET      = 0xC4, //196
     IMCB_IMC_OPERATOR_TPG           = 0xDD, //221
+    IMCB_IMC_OPERATOR_CBN           = 0x0184, //388 
     
     /* For Any IODT Activities */
     IMCB_IMC_OPERATOR_ERICSSON_IMS_IWLAN = 0x03E9, //1001
@@ -1335,7 +1337,7 @@
     imcf_uint8   amr_nb_codec_support;
     imcf_uint8   amr_wb_codec_support;
     imcf_uint8   g_series_codec_support;
-    imcf_uint8   user_agent[128];
+    imcf_uint8   user_agent[256];
     imcf_uint8   UA_call_amr_mode_set[16];
     imcf_uint8   UA_call_amr_wb_mode_set[20];
     imcf_uint8   UA_reg_auth_name[64];
@@ -1385,6 +1387,19 @@
     imcb_imc_loc_ts_struct loc_info;
 } imcb_imc_ims_reg_ind_struct;
 
+
+/**
+ * Description
+ *  - the ILM indicate which rat UE attach
+ * Direction
+ *   IMC -> IMCB
+ */
+typedef struct {
+    LOCAL_PARA_HDR
+    imcf_uint32        currently_attached_rat; /* imc_access_rat_type_enum */
+} imcb_imc_attached_rat_ind_struct;
+
+
 /**
  * Description
  *  - the primitive is used for IMCB notifing IMC current IMS registration state,
diff --git a/mcu/protocol/interface/ims/imcb_imsua_struct.h b/mcu/protocol/interface/ims/imcb_imsua_struct.h
index 63498c3..40495f1 100755
--- a/mcu/protocol/interface/ims/imcb_imsua_struct.h
+++ b/mcu/protocol/interface/ims/imcb_imsua_struct.h
@@ -356,7 +356,8 @@
     VoLTE_Event_Call_Cause_BeReject_380_emergency_action_elem_unknown, /* receive 380 alternative service, without contact header, XML type is emergency but unknown or missing action element. */
     VoLTE_Event_Call_Cause_Retry_IMS_Video_To_Voice,    /*for CMCC requirement, if original call type is video, some error codes need to retry ims as voice*/
     VoLTE_Event_Call_Cause_No_Retry_Bar_IMS,            /*Huawei's requirement, bar IMS for some specific scenarios, then VDM will only try CS during a time period*/
-	VoLTE_Event_Call_Cause_BeReject_380_FlightMode_CS,	/* For Claro requirement , UI should pop-up message when receive 380 alternative service during FlightMode, mapping to CS SERVICE_NOT_AVAILABLE = 380. Other behavior is same as Bereject_380 (cause = 7)*/
+    VoLTE_Event_Call_Cause_BeReject_380_FlightMode_CS,  /* For Claro requirement , UI should pop-up message when receive 380 alternative service during FlightMode, mapping to CS SERVICE_NOT_AVAILABLE = 380. Other behavior is same as Bereject_380 (cause = 7)*/
+    VoLTE_Event_Call_Cause_No_Retry_emergency,     /* For KDDI requirement, MD don't retry IMS/CS when UA receive error code, AP may customize to choice another sim card to retry */
     /*add here*/
     VoLTE_Event_Call_Cause_Max,
 } VoLTE_Event_Call_stop_cause_e;
diff --git a/mcu/protocol/interface/ims/ims_common_def.h b/mcu/protocol/interface/ims/ims_common_def.h
index 49b4b02..d90f054 100755
--- a/mcu/protocol/interface/ims/ims_common_def.h
+++ b/mcu/protocol/interface/ims/ims_common_def.h
@@ -53,6 +53,11 @@
  *===========================================================
  * $Log$
  *
+ * 09 16 2022 xin.ni
+ * [MOLY00827342] [FOCUS][MT6879][Figeac][S0][R2][JAPAN][SOFTBANK][SIM][Lab][OTR-Voice-032031] VoLTE 4sec cancel timer to apply to EPS-FB case
+ * 	
+ * 	.
+ *
  * 07 28 2022 ot_gang.zhang
  * [MOLY00823817] [MT6879][Figeac][S0][R2][JAPAN][SOFTBANK][TB][TrialNW][SIP PANI Info][CR Review Excluded] Supporting OTR-Voice-032066
  * 	
@@ -295,9 +300,9 @@
  * .
  *
  * 04 03 2020 delphine.wang
- * [MOLY00508252] [MT6889][Petrus][5G FT][5GMM][China][CMCC][SA][IODT][端到端][OPPO Load][Hangzhou][2.1]1314_CMCC+CMCC??1ï¿??????????��???HD???????��?
- * [MOLY00508252] [MT6889][Petrus][5G FT][5GMM][China][CMCC][SA][IODT][端到端][OPPO Load][Hangzhou][2.1]1314_CMCC+CMCC??1ï¿??????????��???HD???????��?
- * [MOLY00508252] [MT6889][Petrus][5G FT][5GMM][China][CMCC][SA][IODT][端到端][OPPO Load][Hangzhou][2.1]1314_CMCC+CMCC??1ï¿?????��???HD???????��?
+ * [MOLY00508252] [MT6889][Petrus][5G FT][5GMM][China][CMCC][SA][IODT][端到端][OPPO Load][Hangzhou][2.1]1314_CMCC+CMCC??1�??????????��???HD???????��?
+ * [MOLY00508252] [MT6889][Petrus][5G FT][5GMM][China][CMCC][SA][IODT][端到端][OPPO Load][Hangzhou][2.1]1314_CMCC+CMCC??1�??????????��???HD???????��?
+ * [MOLY00508252] [MT6889][Petrus][5G FT][5GMM][China][CMCC][SA][IODT][端到端][OPPO Load][Hangzhou][2.1]1314_CMCC+CMCC??1�?????��???HD???????��?
  * 	
  * 	.
  *
@@ -896,7 +901,7 @@
 #define VOLTE_MAX_SERVICE_ROUTE_LENGTH                  256
 #define VOLTE_MAX_TIMESTAMP_LENGTH                      256
 #define VOLTE_MAX_SECURIT_VERIFY_LENGTH                 768 //6 algo combo
-#define VOLTE_MAX_USER_AGENT_LENGTH                     128
+#define VOLTE_MAX_USER_AGENT_LENGTH                     256
 #define VOLTE_MAX_P_ACCESS_NETWORK_INFO_LENGTH          256
 #define VOLTE_MAX_DIGIT_PIDENTIFIER_LENGTH              256
 #define VOLTE_MAX_DIGIT_PPA_LENGTH                      4096
@@ -2257,6 +2262,7 @@
     IMC_PS_CAUSE_PROTOCO_ERROR_UNSPECIFIED                              = 111,
     IMC_PS_CAUSE_APN_RESTRICTION_VALUE_INCOMPATIBLE_WITH_ACTIVE_EPS_BEARER_CONTEXT = 112,
     IMC_PS_CAUSE_REQUEST_REJECTED_CORE_TX_FAILURE                       = 113,
+    IMC_PS_CAUSE_TCM_L4C_MODIFY_DUE_TO_INTERRAT                         = 114,
 
     /* WFC */
     IMC_PS_CAUSE_REMAP = 200,
@@ -3362,7 +3368,8 @@
     IMS_CC_CAUSE_BEREJECT_380_EMERGENCY_ACTION_ELEM_UNKNOWN, /* receive 380 alternative service, without contact header, XML type is emergency but unknown or missing action element. */
     IMS_CC_CAUSE_RETRY_IMS_VIDEO_TO_VOICE,
     IMS_CC_CAUSE_NO_RETRY_BAR_IMS,  /*Huawei's requirement, bar IMS for some specific scenarios, then VDM will only try CS during a time period*/
-	IMS_CC_CAUSE_BEREJECT_380_FLIGHTMODE_CS, /* For Claro requirement , UI should pop-up message when receive 380 alternative service during FlightMode, mapping to CS SERVICE_NOT_AVAILABLE = 380. Other behavior is same as Bereject_380 (cause = 7)*/
+    IMS_CC_CAUSE_BEREJECT_380_FLIGHTMODE_CS, /* For Claro requirement , UI should pop-up message when receive 380 alternative service during FlightMode, mapping to CS SERVICE_NOT_AVAILABLE = 380. Other behavior is same as Bereject_380 (cause = 7)*/
+    IMS_CC_CAUSE_NO_RETRY_EMERGENCY, /* For KDDI requirement, MD don't retry IMS/CS when UA receive error code, AP may customize to choice another sim card to retry */
     IMS_CC_CAUSE_UA_MAX,
 
     // Source: IMC
diff --git a/mcu/protocol/interface/ims/ims_stack_struct.h b/mcu/protocol/interface/ims/ims_stack_struct.h
index 82ee110..c533b2c 100755
--- a/mcu/protocol/interface/ims/ims_stack_struct.h
+++ b/mcu/protocol/interface/ims/ims_stack_struct.h
@@ -72,7 +72,7 @@
  * 	.imcb for ATT v21.3 <CDR-LTE-1447>, <CDR-IMS-1210>
  *
  * 03 03 2022 olli.kettunen
- * [MOLY00782359] [Vodafone][Greece][J15S][J19A][?¬å??ˆ] SMS issue
+ * [MOLY00782359] [Vodafone][Greece][J15S][J19A][?��??�] SMS issue
  * 	
  * 	.
  *
@@ -132,7 +132,7 @@
  * 	.
  *
  * 11 06 2020 york.li
- * [MOLY00588036] ??20131?��??DVT?��??��???��??��????��??�CT+CMCC(2G+IMS),主??�电ï¿??2G?��??过�?中状?????��?�移?�VoLTE消失(1/10)
+ * [MOLY00588036] ??20131?��??DVT?��??��???��??��????��??�CT+CMCC(2G+IMS),主??�电��??2G?��??过�?中状?????��?�移?�VoLTE消失(1/10)
  * 	
  * 	.
  *
@@ -361,7 +361,7 @@
  * 	SUBMARINE DEV patch back to VMOLY (MOLY00416875 + MOLY00411449)
  *
  * 07 17 2019 york.li
- * [MOLY00422101] ï¿??????��??��?��??��ï¿???????18073 CMCC+CMCC,�?ï¿????1移动4G CSFB MT失败 16/50
+ * [MOLY00422101] ��??????��??��?��??����???????18073 CMCC+CMCC,�?��????1移动4G CSFB MT失败 16/50
  *
  * 	.
  *
@@ -1070,6 +1070,7 @@
     kal_char                        force_broadcast_reg_state;                              // force IMSUA to broadcast REG's state change to IMCB and UAs even if the state does not change
     kal_char                        is_nw_cap_smsip_in_register_200_contact;                // Use to deliver "+3gpp.smsip" availability from successfull register 200 OK contact hdr. RFC 3840.
     kal_char                        imei_svn[VOLTE_MAX_IMEI_SVN_LENGTH];                    // IMEI SVN
+    kal_char                        f_public_uid[VOLTE_MAX_REG_UID_LENGTH];                 // First public user identity that REG receive, for Anonymous backup public UID
 } VoLTE_Event_Reg_State_t;
 
 typedef struct _VoLTE_Event_Reg_Ems_Mode_ {