Merge "[Feature][T106]version update to T106-V2.01.01.02P56U06.AP.15.09_CAP.15.09"
diff --git a/ap/os/linux/linux-3.4.x/arch/arm/mach-zx297520v3/zx297520v3-mdl-devices.c b/ap/os/linux/linux-3.4.x/arch/arm/mach-zx297520v3/zx297520v3-mdl-devices.c
index 74cba0d..e0ad7ac 100755
--- a/ap/os/linux/linux-3.4.x/arch/arm/mach-zx297520v3/zx297520v3-mdl-devices.c
+++ b/ap/os/linux/linux-3.4.x/arch/arm/mach-zx297520v3/zx297520v3-mdl-devices.c
@@ -1406,8 +1406,7 @@
 };
 #else
 int ts_temp_value_table[TS_ADC_TEMP_NUMBER][TS_ADC_TEMP_VOLTAGE_NUMBER]={
-{
- -45,-44,-43,-42,-41,		
+{		
  -40,-39,-38,-37,-36, -35,-34,-33,-32,-31,		
  -30,-29,-28,-27,-26, -25,-24,-23,-22,-21,		
  -20,-19,-18,-17,-16, -15,-14,-13,-12,-11,		
@@ -1427,24 +1426,23 @@
  120,121,122,123,124,125},
 
 {
-5849,5842,5835,5828,5821,
-5814,5807,5800,5794,5787,5780,5770,5761,5751,5742,
-5732,5720,5707,5695,5682,5670,5654,5638,5623,5607,
-5591,5571,5550,5530,5509,5489,5461,5432,5404,5375,
-5347,5318,5290,5261,5233,5204,5179,5154,5129,5104,
-5079,5040,5001,4961,4922,4883,4838,4794,4749,4705,
-4660,4618,4576,4534,4492,4450,4416,4383,4349,4316,
-4282,4238,4193,4149,4104,4060,4015,3971,3926,3882,
-3837,3798,3759,3719,3680,3641,3603,3565,3526,3488,
-3450,3419,3387,3356,3324,3293,3262,3232,3201,3171,
-3140,3112,3085,3057,3030,3002,2978,2954,2931,2907,
-2883,2862,2841,2819,2798,2777,2759,2740,2722,2703,
-2685,2669,2653,2636,2620,2604,2590,2575,2561,2546,
-2532,2520,2508,2495,2483,2471,2461,2451,2442,2432,
-2422,2414,2406,2398,2390,2380,2373,2366,2359,2352,
-2345,2339,2333,2327,2321,2315,2310,2305,2300,2295,
-2290,2286,2282,2278,2274,2270,2267,2264,2261,2258,
-2255,2254,2253,2252,2251,2250  }
+5753,5743,5732,5721,5709,5697,5684,5671,5658,5643,
+5629,5614,5598,5581,5564,5547,5529,5510,5491,5471,
+5450,5429,5407,5385,5362,5338,5314,5289,5263,5237,
+5211,5183,5155,5127,5097,5068,5037,5007,4975,4944,
+4912,4879,4846,4813,4779,4745,4710,4676,4641,4605,
+4570,4534,4498,4462,4426,4389,4353,4317,4280,4244,
+4207,4171,4135,4099,4063,4027,3992,3956,3921,3886,
+3851,3817,3783,3749,3716,3683,3650,3618,3587,3555,
+3524,3494,3464,3434,3405,3376,3348,3320,3292,3265,
+3239,3213,3188,3163,3138,3114,3091,3068,3045,3023,
+3001,2980,2960,2940,2920,2901,2883,2864,2847,2829,
+2812,2796,2779,2763,2748,2733,2718,2704,2690,2676,
+2662,2649,2637,2624,2612,2601,2589,2578,2567,2556,
+2546,2536,2526,2516,2507,2498,2489,2480,2471,2463,
+2455,2447,2440,2432,2425,2418,2411,2404,2398,2391,
+2385,2379,2373,2367,2362,2356,2351,2346,2341,2336,
+2331,2326,2322,2317,2313,2309}
 };
 #endif
 volatile u32 ts_adc_flag=3;// 1:adc1; 2:adc2, other:adc rf;  
diff --git a/ap/os/linux/linux-3.4.x/drivers/soc/zte/tsc/zx-tsc.h b/ap/os/linux/linux-3.4.x/drivers/soc/zte/tsc/zx-tsc.h
index cad1254..aec0eb1 100755
--- a/ap/os/linux/linux-3.4.x/drivers/soc/zte/tsc/zx-tsc.h
+++ b/ap/os/linux/linux-3.4.x/drivers/soc/zte/tsc/zx-tsc.h
@@ -206,7 +206,7 @@
 //#define  TS_ADC_TEMP_NUMBER   2
 //#define  TS_ADC_TEMP_VOLTAGE_NUMBER  110
 #define  TS_TEMP_NUMBER_SMALLEST   0
-#define  TS_TEMP_NUMBER_BIGGEST  171
+#define  TS_TEMP_NUMBER_BIGGEST  166
 
 #define TEMP_PERCENT_INTERVAL  (10) //ζȰٷֱȼä¸ô
 
diff --git a/ap/os/linux/linux-3.4.x/drivers/usb/gadget/multi_packet.c b/ap/os/linux/linux-3.4.x/drivers/usb/gadget/multi_packet.c
index eab1ea0..ea72d9e 100755
--- a/ap/os/linux/linux-3.4.x/drivers/usb/gadget/multi_packet.c
+++ b/ap/os/linux/linux-3.4.x/drivers/usb/gadget/multi_packet.c
@@ -128,7 +128,7 @@
 struct multi_packet{

 

 	volatile int maxPacketNum; 

-

+	volatile int bindedMaxPacketNum;

 	unsigned int active;

 	

 	struct usb_gadget *gadget;	

@@ -1468,6 +1468,12 @@
 	return multiPacket.maxPacketNum;

 }

 

+void multi_packet_set_actual_maxnum(int max_packet_num)

+{

+	multiPacket.maxPacketNum = max_packet_num;

+	multiPacket.bind.maxPacketNum = max_packet_num;

+	multiPacket.unbind.maxPacketNum = max_packet_num;

+}

 

 void multi_packet_activate(void)

 {	

@@ -1501,6 +1507,7 @@
 {

 	int	retval = 0;

     unsigned long flags;

+	struct multi_packet *multiPkt = &multiPacket;

 	struct sk_buff *skb = (struct sk_buff *)req->context;

 	ep->is_netep = 1;

 	int bind_th_state = 0;

@@ -1510,7 +1517,10 @@
 		//req->dma = virt_to_phys(req->buf);

 		//retval = usb_gadget_map_request(multiPacket.gadget, req, 1);

 		//dma_sync_single_for_device();	

-		ep->protocol_type = 2;

+		if(strcmp(multiPkt->geth->func.name,RNDIS_NAME_STR) == 0)

+            ep->protocol_type = 1;

+		else

+			ep->protocol_type = 2;

 		retval = usb_ep_queue(ep, req, gfp_flags);

 	}

 	else

@@ -1586,12 +1596,16 @@
 {

 	int	retval = 0;

     unsigned long flags;

-

+	struct multi_packet *multiPkt = &multiPacket;

 	ep->is_netep = 1;

 	if(multi_packet_get_maxnum() <=1 )

 	{

 		///retval = usb_gadget_map_request(multiPacket.gadget, req, 0);

-		ep->protocol_type = 2;

+		//ep->protocol_type = 2;

+		if(strcmp(multiPkt->geth->func.name,RNDIS_NAME_STR) == 0)

+            ep->protocol_type = 1;

+		else

+			ep->protocol_type = 2;

 		retval = usb_ep_queue(ep, req, gfp_flags);

 	}

 	else

@@ -1776,6 +1790,16 @@
     multiPkt->trans_buffer_size = 0 ;

 }

 

+void set_rndis_wrap_unwrap_header()

+{

+	struct multi_packet *multiPkt = &multiPacket;

+	if(multiPkt->maxPacketNum > 1)

+   	{

+		multiPkt->geth->ioport->wrap = NULL;

+		multiPkt->geth->ioport->unwrap = NULL;

+   	}

+}

+

 int multi_packet_buf_alloc()

 {

 	struct multi_packet *multiPkt = &multiPacket;

@@ -1829,6 +1853,7 @@
 	struct usb_multi_packet *pbind = &multiPacket.bind;

 	struct usb_multi_packet *punbind = &multiPacket.unbind;

     multiPkt->maxPacketNum = get_vnic_multi_packet_num();

+	multiPkt->bindedMaxPacketNum = multiPkt->maxPacketNum;

 #if 1

 

     size_t alloc_req_size =   (multiPkt->maxPacketNum + PACKET_BUF_EXTRA_NUM) * sizeof(struct usb_request *) ;

@@ -1873,20 +1898,22 @@
 		usb_multi_pkt_init(pbind, 1);

 		pbind->thread = kthread_run(usbBind_thread, pbind, "usbbind_thread");

 		BUG_ON(IS_ERR(pbind->thread));

+#if 0

         if(strcmp(geth->func.name,RNDIS_NAME_STR)==0)

         {

             geth->wrap = NULL;

 

         }

 #endif

+#endif

         pbind->maxPacketNum  = multiPkt->maxPacketNum ;

         punbind->maxPacketNum  = multiPkt->maxPacketNum ;

-

+#if 0

         if(strcmp(geth->func.name,RNDIS_NAME_STR) == 0)

         {

             geth->unwrap = NULL;

         }

-

+#endif

         //ÅжÏÍø¿¨ÀàÐÍ

         printk("$$$$$$$geth->func.name = %s \n",geth->func.name) ;

         if(strcmp(geth->func.name,RNDIS_NAME_STR) == 0)

@@ -1931,19 +1958,22 @@
 

 	USBSTACK_DBG("multi-pkt exit begin!");

 

-	if(multiPacket.maxPacketNum>1)

+	if(multiPacket.maxPacketNum>1 || multiPacket.bindedMaxPacketNum > 1)

 	{

 #ifndef RNDIS_DL_MULTI_DESC

 		USBSTACK_DBG("kill bind thread");

 		kthread_stop(pbind->thread);

-		usb_mutli_pkt_exit(pbind, 1);

+		if (multiPacket.maxPacketNum > 1)

+			usb_mutli_pkt_exit(pbind, 1);

 #endif

 

 		USBSTACK_DBG("kill unbind thread");

 		kthread_stop(punbind->thread);

-		usb_mutli_pkt_exit(punbind, 0);

+		if (multiPacket.maxPacketNum > 1)

+			usb_mutli_pkt_exit(punbind, 0);

 	}

 	multiPacket.maxPacketNum = 0;

+	multiPacket.bindedMaxPacketNum = 0;

     if(multiPacket.alloc_mem != NULL)

     {

         kfree(multiPacket.alloc_mem);

diff --git a/ap/os/linux/linux-3.4.x/drivers/usb/gadget/multi_packet.h b/ap/os/linux/linux-3.4.x/drivers/usb/gadget/multi_packet.h
index c9ebd1d..4197f94 100644
--- a/ap/os/linux/linux-3.4.x/drivers/usb/gadget/multi_packet.h
+++ b/ap/os/linux/linux-3.4.x/drivers/usb/gadget/multi_packet.h
@@ -8,6 +8,9 @@
 

 #define MULTIPACKET_BUF_ALLOC 1

 int multi_packet_get_maxnum(void);

+void multi_packet_set_actual_maxnum(int max_packet_num);

+void set_rndis_wrap_unwrap_header(void);

+

 typedef void (*usb_complete_t)(struct usb_ep *ep,	struct usb_request *req);

 

 int multi_packet_tx_queue(struct usb_ep *ep, struct usb_request *req, gfp_t gfp_flags);

diff --git a/ap/os/linux/linux-3.4.x/drivers/usb/gadget/rndis.c b/ap/os/linux/linux-3.4.x/drivers/usb/gadget/rndis.c
index e2d2e3b..d72d333 100755
--- a/ap/os/linux/linux-3.4.x/drivers/usb/gadget/rndis.c
+++ b/ap/os/linux/linux-3.4.x/drivers/usb/gadget/rndis.c
@@ -58,6 +58,12 @@
 #define rndis_debug		0
 #endif
 extern unsigned int get_panic_flag(void);
+extern int get_vnic_multi_packet_num(void);
+extern void multi_packet_set_actual_maxnum(int max_packet_num);
+extern void set_rndis_wrap_unwrap_header(void);
+
+
+
 
 #define RNDIS_MAX_CONFIGS	1
 extern void usb_notify_up(usb_notify_event notify_type, void* puf);
@@ -585,6 +591,8 @@
 {
 	rndis_init_cmplt_type *resp;
 	rndis_resp_t *r;
+	int pc_expect_max_packet_num = 0;
+	int max_multi_packet_num = get_vnic_multi_packet_num();
 	struct rndis_params *params = rndis_per_dev_params + configNr;
 
 	if (!params->dev)
@@ -605,8 +613,16 @@
 	resp->Medium = cpu_to_le32(RNDIS_MEDIUM_802_3);
 
 #if 1
-	resp->MaxPacketsPerTransfer = cpu_to_le32(multi_packet_get_maxnum());//cpu_to_le32(1);
-	resp->MaxTransferSize = 1568*multi_packet_get_maxnum();
+	pc_expect_max_packet_num = le32_to_cpu(buf->MaxTransferSize) / 1568;
+	if (pc_expect_max_packet_num > max_multi_packet_num)
+		pc_expect_max_packet_num = max_multi_packet_num;
+	resp->MaxPacketsPerTransfer = cpu_to_le32(pc_expect_max_packet_num);
+	resp->MaxTransferSize = 1568*pc_expect_max_packet_num;
+	multi_packet_set_actual_maxnum(pc_expect_max_packet_num);
+	set_rndis_wrap_unwrap_header();
+
+	//resp->MaxPacketsPerTransfer = cpu_to_le32(multi_packet_get_maxnum());//cpu_to_le32(1);
+	//resp->MaxTransferSize = 1568*multi_packet_get_maxnum();
 #else
 	resp->MaxPacketsPerTransfer = cpu_to_le32(1);
 	resp->MaxTransferSize = cpu_to_le32(
diff --git a/ap/os/linux/linux-3.4.x/drivers/usb/gadget/u_serial.c b/ap/os/linux/linux-3.4.x/drivers/usb/gadget/u_serial.c
index 461af0a..09507a5 100644
--- a/ap/os/linux/linux-3.4.x/drivers/usb/gadget/u_serial.c
+++ b/ap/os/linux/linux-3.4.x/drivers/usb/gadget/u_serial.c
@@ -152,9 +152,9 @@
 } ports[N_PORTS];
 static unsigned	n_ports;
 static int inform_state = 0;
-
-#define GS_CLOSE_TIMEOUT		15		/* seconds */
-
+//xf.li@20240719 modify for youwei get_sim_status slowly start
+#define GS_CLOSE_TIMEOUT		1		/* seconds */
+//xf.li@20240719 modify for youwei get_sim_status slowly end
 
 #ifdef VERBOSE_DEBUG
 #define pr_vdebug(fmt, arg...) \
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 e1d2ab4..5ca13fe 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
@@ -134,25 +134,43 @@
     {
         QSER_NW_SINGNAL_EVENT_IND_T msg_buf;
         msg_buf.gsm_sig_info_valid = signalstrength.gw_sig_valid;
-        msg_buf.gsm_sig_info.rssi = (signalstrength.rssi<<1)-110;
+        if(msg_buf.gsm_sig_info_valid)
+        {
+            msg_buf.gsm_sig_info.rssi = (signalstrength.rssi<<1)-113;
+            if(msg_buf.gsm_sig_info.rssi < -110)
+            {
+                msg_buf.gsm_sig_info.rssi=-110;
+            }
+        }
+        
         msg_buf.wcdma_sig_info_valid = signalstrength.wcdma_sig_valid;
-        msg_buf.wcdma_sig_info.rssi = (signalstrength.wcdma_signalstrength<<1)-113;
-        msg_buf.wcdma_sig_info.ecio = signalstrength.ecno/5;
+        if(msg_buf.wcdma_sig_info_valid)
+        {
+            msg_buf.wcdma_sig_info.rssi = (signalstrength.wcdma_signalstrength<<1)-113;
+            msg_buf.wcdma_sig_info.ecio = signalstrength.ecno/5;
+        }
         msg_buf.tdscdma_sig_info_valid = 0;
         msg_buf.lte_sig_info_valid = signalstrength.lte_sig_valid;
-        msg_buf.lte_sig_info.rssi = (signalstrength.lte_signalstrength<<1)-113;
-        msg_buf.lte_sig_info.rsrp = -signalstrength.rsrp;
-        msg_buf.lte_sig_info.rsrq = -signalstrength.rsrq;
-        msg_buf.lte_sig_info.snr = signalstrength.rssnr;
+        if(msg_buf.lte_sig_info_valid)
+        {
+            msg_buf.lte_sig_info.rssi = (signalstrength.lte_signalstrength<<1)-113;
+            msg_buf.lte_sig_info.rsrp = -signalstrength.rsrp;
+            msg_buf.lte_sig_info.rsrq = -signalstrength.rsrq;
+            msg_buf.lte_sig_info.snr = signalstrength.rssnr;    
+        }
         msg_buf.cdma_sig_info_valid = 0;
         msg_buf.hdr_sig_info_valid = 0;
         msg_buf.nr_sig_info_valid = signalstrength.nr_sig_valid;
-        msg_buf.nr_sig_info.ssRsrp = signalstrength.ssRsrp;
-        msg_buf.nr_sig_info.ssRsrq = signalstrength.ssRsrq;
-        msg_buf.nr_sig_info.ssSinr = signalstrength.ssSinr;
-        msg_buf.nr_sig_info.csiRsrp = signalstrength.csiRsrp;
-        msg_buf.nr_sig_info.csiRsrq = signalstrength.csiRsrq;
-        msg_buf.nr_sig_info.csiSinr = signalstrength.csiSinr;
+        if(msg_buf.nr_sig_info_valid)
+        {
+            msg_buf.nr_sig_info.ssRsrp = signalstrength.ssRsrp;
+            msg_buf.nr_sig_info.ssRsrq = signalstrength.ssRsrq;
+            msg_buf.nr_sig_info.ssSinr = signalstrength.ssSinr;
+            msg_buf.nr_sig_info.csiRsrp = signalstrength.csiRsrp;
+            msg_buf.nr_sig_info.csiRsrq = signalstrength.csiRsrq;
+            msg_buf.nr_sig_info.csiSinr = signalstrength.csiSinr;
+        }
+        
         void *ind_msg_buf= &msg_buf;
         if(s_handlerPtr!=NULL)
         {
@@ -736,25 +754,47 @@
         return RESULT_ERROR;
     }
     pt_info->gsm_sig_info_valid = lib_info.gw_sig_valid;
-    pt_info->gsm_sig_info.rssi = (lib_info.rssi<<1)-110;
+    if(pt_info->gsm_sig_info_valid)
+    {
+        pt_info->gsm_sig_info.rssi = (lib_info.rssi<<1)-113;
+        if(pt_info->gsm_sig_info.rssi < -110)
+        {
+            pt_info->gsm_sig_info.rssi=-110;
+        }
+    }
+    
     pt_info->wcdma_sig_info_valid = lib_info.wcdma_sig_valid;
-    pt_info->wcdma_sig_info.rssi = (lib_info.wcdma_signalstrength<<1)-113;
-    pt_info->wcdma_sig_info.ecio = lib_info.ecno/5;
+    if(pt_info->wcdma_sig_info_valid)
+    {
+        pt_info->wcdma_sig_info.rssi = (lib_info.wcdma_signalstrength<<1)-113;
+        pt_info->wcdma_sig_info.ecio = lib_info.ecno/5;
+    }
+    
     pt_info->tdscdma_sig_info_valid = 0;
+    
     pt_info->lte_sig_info_valid = lib_info.lte_sig_valid;
-    pt_info->lte_sig_info.rssi = (lib_info.lte_signalstrength<<1)-113;
-    pt_info->lte_sig_info.rsrp = -lib_info.rsrp;
-    pt_info->lte_sig_info.rsrq = -lib_info.rsrq;
-    pt_info->lte_sig_info.snr = lib_info.rssnr;
+    if(pt_info->lte_sig_info_valid)
+    {
+        pt_info->lte_sig_info.rssi = (lib_info.lte_signalstrength<<1)-113;
+        pt_info->lte_sig_info.rsrp = -lib_info.rsrp;
+        pt_info->lte_sig_info.rsrq = -lib_info.rsrq;
+        pt_info->lte_sig_info.snr = lib_info.rssnr;
+    }
+    
     pt_info->cdma_sig_info_valid = 0;
     pt_info->hdr_sig_info_valid = 0;
+    
     pt_info->nr_sig_info_valid = lib_info.nr_sig_valid;
-    pt_info->nr_sig_info.ssRsrp = lib_info.ssRsrp;
-    pt_info->nr_sig_info.ssRsrq = lib_info.ssRsrq;
-    pt_info->nr_sig_info.ssSinr = lib_info.ssSinr;
-    pt_info->nr_sig_info.csiRsrp = lib_info.csiRsrp;
-    pt_info->nr_sig_info.csiRsrq = lib_info.csiRsrq;
-    pt_info->nr_sig_info.csiSinr = lib_info.csiSinr;
+    if(pt_info->nr_sig_info_valid)
+    {
+        pt_info->nr_sig_info.ssRsrp = lib_info.ssRsrp;
+        pt_info->nr_sig_info.ssRsrq = lib_info.ssRsrq;
+        pt_info->nr_sig_info.ssSinr = lib_info.ssSinr;
+        pt_info->nr_sig_info.csiRsrp = lib_info.csiRsrp;
+        pt_info->nr_sig_info.csiRsrq = lib_info.csiRsrq;
+        pt_info->nr_sig_info.csiSinr = lib_info.csiSinr;
+    }
+    
     return RESULT_OK;
 }
 
diff --git a/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/drivers/net/zvnet/zvnet_dev.c b/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/drivers/net/zvnet/zvnet_dev.c
index bea60e1..ffdba06 100755
--- a/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/drivers/net/zvnet/zvnet_dev.c
+++ b/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/drivers/net/zvnet/zvnet_dev.c
@@ -451,7 +451,7 @@
 	}

 		

 	if(unlikely(skb_headroom(skb) < NET_SKB_PAD || skb->next//|| skb->capHead

-		|| skb->fclone || skb->cloned || (skb_shinfo(skb)->nr_frags) 

+		|| skb->fclone || skb->cloned || (skb_shinfo(skb)->nr_frags) || skb->sk || (skb->indev == NULL) 

 		|| (skb_shinfo(skb)->tx_flags & SKBTX_DEV_ZEROCOPY) || (skb_has_frag_list(skb)))){

 		int ret_len = skb->len;

 

diff --git a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/sdk/binder/liblog/logd_write.c b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/sdk/binder/liblog/logd_write.c
index 5b30e8d..8e86270 100755
--- a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/sdk/binder/liblog/logd_write.c
+++ b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/sdk/binder/liblog/logd_write.c
@@ -440,7 +440,7 @@
     return LOG_NAME[log_id];
 }
 #endif
-int sys_log_levle = -1;
+int sys_log_levle = 4;
 static int __write_to_log_init(log_id_t log_id, struct iovec *vec, size_t nr)
 {
 #ifdef HAVE_PTHREADS
@@ -506,7 +506,12 @@
     struct iovec vec[3];
     log_id_t log_id = LOG_ID_MAIN;
     char tmp_tag[32];
-
+/*cz.li add on 2024/7/8 for control RLOGD start*/
+    if(prio < sys_log_levle)
+    {
+        return 0;
+    }
+/*cz.li add on 2024/7/8 for control RLOGD end*/
     if (!tag)
         tag = "";