[Feature][CODEC]CODEC 8311 Turning on I2S Pin Control and Optimizing Audio Recording Results in TDM Mode

Only Configure: Yes
Affected branch: master
Affected module: CODEC
Is it affected on both ZXIC and MTK:only ZXIC
Self-test: Yes
Doc Update:No

Change-Id: I6c0de875308a94a30fe3bd6beeed0ae88b86975d
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");