Merge "[Bugfix][T106BUG-615]CODEC 8311 using voice_demo to set codec volume has no effect."
diff --git a/cap/zx297520v3/sources/meta-zxic-custom/conf/distro/vehicle_dc_ref.conf b/cap/zx297520v3/sources/meta-zxic-custom/conf/distro/vehicle_dc_ref.conf
index 7472cc2..8400655 100755
--- a/cap/zx297520v3/sources/meta-zxic-custom/conf/distro/vehicle_dc_ref.conf
+++ b/cap/zx297520v3/sources/meta-zxic-custom/conf/distro/vehicle_dc_ref.conf
@@ -133,9 +133,9 @@
 SECURITY_STACK_PROTECTOR = " -fstack-protector-all"
 #CUSTOM_MACRO += " -D_USE_CODEC_TI3100 "
 #CUSTOM_MACRO += " -D_USE_CODEC_NAU8810 "
-CUSTOM_MACRO += " -D_USE_CODEC_TI3104 "
+#CUSTOM_MACRO += " -D_USE_CODEC_TI3104 "
 #CUSTOM_MACRO += " -D_USE_CODEC_MAX9867 "
-#CUSTOM_MACRO += " -D_USE_CODEC_ES8311 "
+CUSTOM_MACRO += " -D_USE_CODEC_ES8311 "
 CUSTOM_MACRO += "${@bb.utils.contains('DISTRO_FEATURES', 'voice_alsa', '-D_USE_VOICE_ALSA', '', d)}"
 CUSTOM_MACRO += "${@bb.utils.contains('DISTRO_FEATURES', 'use_voice_buffer', '-D_USE_VOICE_BUFFER', '', d)}"
 #CONFIG_VB_TRANSMIT_INTF = "RTP"
diff --git a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/libtinyalsa/audio_mixer_ctrl.c b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/libtinyalsa/audio_mixer_ctrl.c
index 1dfa9e2..0ff24e3 100755
--- a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/libtinyalsa/audio_mixer_ctrl.c
+++ b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/libtinyalsa/audio_mixer_ctrl.c
@@ -379,6 +379,7 @@
 	}
 }
 
+
 static int input_vol_conversion(int vol)
 {
 	switch(vol) {
@@ -785,18 +786,86 @@
 	{"DAC DEM  MUTE", {"0"}},
 };
 
+/* yu.dong@20240627 [T106BUG-615]CODEC 8311 using voice_demo to set codec volume has no effect start */
 
+/*
 static int output_vol_conversion(int vol)
 {
 	return 255;
 
 }
+*/
+
 static int input_vol_conversion(int vol)
 {
 	return 255;
 
 }
- 
+
+enum t_output_vol {
+    T_OUTPUT_VOL_MINUS_96DB = 0,
+    T_OUTPUT_VOL_MINUS_95DB = 2,
+    T_OUTPUT_VOL_MINUS_90DB = 12,
+    T_OUTPUT_VOL_MINUS_85DB = 22,
+    T_OUTPUT_VOL_MINUS_80DB = 32,
+    T_OUTPUT_VOL_MINUS_75DB = 42,
+    T_OUTPUT_VOL_MINUS_70DB = 52,
+    T_OUTPUT_VOL_MINUS_65DB = 62,
+    T_OUTPUT_VOL_MINUS_60DB = 72,
+    T_OUTPUT_VOL_MINUS_55DB = 82,
+    T_OUTPUT_VOL_MINUS_50DB = 92,
+    T_OUTPUT_VOL_MINUS_45DB = 102,
+    T_OUTPUT_VOL_MINUS_40DB = 112,
+    T_OUTPUT_VOL_MINUS_35DB = 122,
+    T_OUTPUT_VOL_MINUS_30DB = 132,
+    T_OUTPUT_VOL_MINUS_25DB = 142,
+    T_OUTPUT_VOL_MINUS_20DB = 152,
+    T_OUTPUT_VOL_MINUS_15DB = 162,
+    T_OUTPUT_VOL_MINUS_10DB = 172,
+    T_OUTPUT_VOL_MINUS_7DB  = 178,
+    T_OUTPUT_VOL_MINUS_6DB  = 180,
+    T_OUTPUT_VOL_MINUS_5DB  = 182,
+    T_OUTPUT_VOL_MINUS_4DB  = 184,
+    T_OUTPUT_VOL_MINUS_3DB  = 186,
+    T_OUTPUT_VOL_MINUS_2DB  = 188,
+    T_OUTPUT_VOL_MINUS_1DB  = 190,
+    T_OUTPUT_VOL_0DB        = 192
+};
+
+ static int output_vol_conversion(int vol)
+{
+    switch(vol){
+    case T_AUDIO_OUTPUT_VOL_LEVEL_0:
+        return T_OUTPUT_VOL_MINUS_96DB;
+    case T_AUDIO_OUTPUT_VOL_LEVEL_1:
+        return T_OUTPUT_VOL_MINUS_45DB;
+    case T_AUDIO_OUTPUT_VOL_LEVEL_2:
+        return T_OUTPUT_VOL_MINUS_40DB;
+    case T_AUDIO_OUTPUT_VOL_LEVEL_3:
+        return T_OUTPUT_VOL_MINUS_35DB;
+    case T_AUDIO_OUTPUT_VOL_LEVEL_4:
+        return T_OUTPUT_VOL_MINUS_30DB;
+    case T_AUDIO_OUTPUT_VOL_LEVEL_5:
+        return T_OUTPUT_VOL_MINUS_25DB;
+    case T_AUDIO_OUTPUT_VOL_LEVEL_6:
+        return T_OUTPUT_VOL_MINUS_20DB;
+    case T_AUDIO_OUTPUT_VOL_LEVEL_7:
+        return T_OUTPUT_VOL_MINUS_15DB;
+    case T_AUDIO_OUTPUT_VOL_LEVEL_8:
+        return T_OUTPUT_VOL_MINUS_10DB;
+    case T_AUDIO_OUTPUT_VOL_LEVEL_9:
+        return T_OUTPUT_VOL_MINUS_6DB;
+    case T_AUDIO_OUTPUT_VOL_LEVEL_10:
+        return T_OUTPUT_VOL_MINUS_3DB;
+    case T_AUDIO_OUTPUT_VOL_LEVEL_11:
+        return T_OUTPUT_VOL_0DB;
+    default:
+        return T_OUTPUT_VOL_0DB;
+    }
+}
+
+/* yu.dong@20240627 [T106BUG-615]CODEC 8311 using voice_demo to set codec volume has no effect end */
+
 #elif defined _USE_CODEC_ES8374