Merge "[Bugfix][ZXW-302]CPU usage optimization-ZXW patch"
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/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/spi/spi-zx29.c b/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/drivers/spi/spi-zx29.c
index 3d371ea..fd49fd6 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
@@ -2341,7 +2341,7 @@
 	.iface = SPI_INTERFACE_MOTOROLA_SPI,
 	.hierarchy = SPI_MASTER,
 	.slave_tx_disable = DO_NOT_DRIVE_TX,
-	.rx_lev_trig = SPI_RX_4_OR_MORE_ELEM,
+	.rx_lev_trig = SPI_RX_8_OR_MORE_ELEM,
 	.tx_lev_trig = SPI_TX_4_OR_MORE_EMPTY_LOC,
 //	.ctrl_len = SSP_BITS_8,
 //	.wait_state = SSP_MWIRE_WAIT_ZERO,
diff --git a/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/sound/soc/codecs/es8311.c b/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/sound/soc/codecs/es8311.c
index 0e9dab6..fef445f 100755
--- a/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/sound/soc/codecs/es8311.c
+++ b/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/sound/soc/codecs/es8311.c
@@ -894,6 +894,12 @@
 		snd_soc_component_write(component, ES8311_ADC_REG1B, 0x0A);

 		snd_soc_component_write(component, ES8311_ADC_REG1C, 0x6A);

 		snd_soc_component_write(component, ES8311_DAC_REG37, 0x48);

+/* yu.dong@20240718[ZXW-277]Optimizing Recording in CODEC 8311 TDM Mode start*/
+#if defined(CONFIG_USE_TOP_TDM)
+        snd_soc_component_write(component, ES8311_CLK_MANAGER_REG01, 0x9f);
+        snd_soc_component_write(component, ES8311_ADC_REG15, 0x00);
+#endif
+/* yu.dong@20240718[ZXW-277]Optimizing Recording in CODEC 8311 TDM Mode end*/
 		//snd_soc_component_write(component, ES8311_ADC_REG17, 0xBF);

 		//snd_soc_component_write(component, ES8311_DAC_REG32, 0xBF);

 		break;

@@ -1425,13 +1431,10 @@
 		}

 	}

 /* yu.dong@20240508[ZXW-277]Modified Platform CODEC ES8311 Compatible with I2S and TDM Modes start */
-#ifdef CONFIG_USE_TOP_TDM
-#else
 	ret = zx29_i2s_config_default_pin();
 	if(ret < 0) {
 		pr_err("%s select state failure %d !! \n", __func__, ret);
 	}
-#endif
 	es8311_reinit(component, info);
 /* yu.dong@20240508[ZXW-277]Modified Platform CODEC ES8311 Compatible with I2S and TDM Modes end */	
 	pr_info("%s:clk en end!\n",__func__);
@@ -1457,13 +1460,10 @@
 	}

 	pr_info("%s:clk dis end!\n",__func__);

 /* yu.dong@20240508[ZXW-277]Modified Platform CODEC ES8311 Compatible with I2S and TDM Modes start */
-#ifdef CONFIG_USE_TOP_TDM
-#else
 	ret = zx29_i2s_config_sleep_pin();
         if(ret < 0) {
                 pr_err("%s select state failure %d !! \n", __func__, ret);
         }
-#endif
 /* yu.dong@20240508[ZXW-277]Modified Platform CODEC ES8311 Compatible with I2S and TDM Modes end */
 	return ret;
 }
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 3c755a6..1204542 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
@@ -1119,14 +1119,8 @@
 		info->s = s;
 		info->s_sleep = s_sleep;
 	}
-/* yu.dong@20240508[ZXW-277]Modified Platform CODEC ES8311 Compatible with I2S and TDM Modes start */
-#ifdef CONFIG_USE_TOP_TDM
-	ret = pinctrl_select_state(p, s);
-#else
 //yu.dong@20240416[ZXW-268]Added codec re-initialization for power down and I2S default configuration adjustment start
 	ret = pinctrl_select_state(p, s_sleep);
-#endif
-/* yu.dong@20240508[ZXW-277]Modified Platform CODEC ES8311 Compatible with I2S and TDM Modes end */
 	if (ret < 0) {
 		devm_pinctrl_put(p);
 		dev_err(dev, " select state failure!!\n");
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 = "";
 
diff --git a/update_version.sh b/update_version.sh
index f82d336..efe9533 100755
--- a/update_version.sh
+++ b/update_version.sh
@@ -1,8 +1,8 @@
 #!/bin/bash
 #export LYNQ_VERSION="T106_lynq_version_ap_build_sh"
-LYNQ_AP_VERSION="T106-V2.01.01.02P56U06.AP.15.08"
-LYNQ_CAP_INSIDE_VERSION="CAP.15.08"
-LYNQ_CAP_VERSION="CAP.15.08"
+LYNQ_AP_VERSION="T106-W-V2.01.01.02P56U06.AP.15.09"
+LYNQ_CAP_INSIDE_VERSION="CAP.15.09"
+LYNQ_CAP_VERSION="CAP.15.09"
 COMMIT_ID="$(git rev-parse HEAD)"
 
 LYNQ_SW_INSIDE_VERSION="LYNQ_CONFIG_VERSION = \"${LYNQ_AP_VERSION}_${LYNQ_CAP_INSIDE_VERSION}\""