9. 音频调试日志

1. 音频参数(客制化共8个文件)
	audio_acf_default.h					-- 不用改
	audio_custom.h						-- 不用改
	audio_hcf_default.h					-- 不用改
	audio_music_drc_default.h			-- 要改
	audio_ringtone_drc_default.h		-- 要改
	audio_ver1_volume_custom_default.h	-- 要改
	audio_voip_custom.h					-- 不用改
	audio_volume_custom_default.h		-- 不用改
	sph_coeff_default.h					-- 不用改 - 降噪后面会专门提出优化
	
	1.1 audio_ver1_volume_custom_default.h分析:

	*#*#889988#*#*  => HarhWare Testing => Audio => 
	
	#define VER1_AUD_VOLUME_RING \
		32,48,64,80,96,112,128,144,160,176,192,208,224,240,255,\		// Normal Mode
		32,48,64,80,96,112,128,144,160,176,192,208,224,240,255,\		// Headset Mode
		128,136,144,152,160,168,176,184,192,200,212,224,236,248,255,\	// LoudSpeaker MOde // 外放
		128,136,144,152,160,168,176,184,192,200,212,224,236,248,255		// Headset_LoudSpeaker Mode
		
		level0,level1,level2,...,level13,level14 	// 音量加一次 level升一级
		
	案例一: 免提模式下MIC的增益level3 修改为128
		#define VER1_AUD_VOLUME_RING \
			32,48,64,80,96,112,128,144,160,176,192,208,224,240,255,\		// Normal Mode
			32,48,64,80,96,112,128,144,160,176,192,208,224,240,255,\		// Headset Mode
		-	128,136,144,152,160,168,176,184,192,200,212,224,236,248,255,\	// LoudSpeaker MOde // 外放
		+	128,136,144,128,160,168,176,184,192,200,212,224,236,248,255,\	// LoudSpeaker MOde // 外放
		
		
	#define VER1_AUD_VOLUME_RING \		// 铃声
	#define VER1_AUD_VOLUME_SIP \		//
	#define VER1_AUD_VOLUME_MIC \		// MIC
	#define VER1_AUD_VOLUME_FM \		// FM
	#define VER1_AUD_VOLUME_SPH \		//
	#define VER1_AUD_VOLUME_SID \		// 
	#define VER1_AUD_VOLUME_MEDIA \		// 媒体影音
	#define VER1_AUD_VOLUME_MATV \
	
	#define VER1_AUD_NORMAL_VOLUME_DEFAULT \
	#define VER1_AUD_HEADSER_VOLUME_DEFAULT \
	#define VER1_AUD_SPEAKER_VOLUME_DEFAULT \
	#define VER1_AUD_HEADSETSPEAKER_VOLUME_DEFAULT \
	#define VER1_AUD_EXTAMP_VOLUME_DEFAULT \
	#define VER1_AUD_VOLUME_LEVEL_DEFAULT \
	
	#define DEFAULT_VER1_AUD_VOLUME_MIC_HAC \
	#define DEFAULT_VER1_AUD_VOLUME_SPH_HAC \
	#define DEFAULT_VER1_AUD_VOLUME_SID_HAC \

	alps/vendor/mediatek/proprietary/custom/magc6737m_35_n/cgen/cfgdefault/audio_ver1_volume_custom_default.h
		AUDIO_VER1_CUSTOM_VOLUME_STRUCT audio_ver1_custom_default = {
			VER1_AUD_VOLUME_RING,
			VER1_AUD_VOLUME_SIP,
			VER1_AUD_VOLUME_MIC,
			VER1_AUD_VOLUME_FM,
			VER1_AUD_VOLUME_SPH,
			VER1_AUD_VOLUME_SPH, // sph2 now use the same
			VER1_AUD_VOLUME_SID,
			VER1_AUD_VOLUME_MEDIA,
			VER1_AUD_VOLUME_MATV,
			VER1_AUD_NORMAL_VOLUME_DEFAULT,
			VER1_AUD_HEADSER_VOLUME_DEFAULT,
			VER1_AUD_SPEAKER_VOLUME_DEFAULT,
			VER1_AUD_HEADSETSPEAKER_VOLUME_DEFAULT,
			VER1_AUD_EXTAMP_VOLUME_DEFAULT,
			VER1_AUD_VOLUME_LEVEL_DEFAULT
		};
	
		AUDIO_CUSTOM_HAC_PARAM_STRUCT speech_hac_param_custom_default = {
			DEFAULT_SPEECH_HAC_MODE_PARA,
			DEFAULT_WB_SPEECH_HAC_MODE_PARA,
			DEFAULT_SPEECH_HAC_INPUT_FIR_COEFF,
			DEFAULT_SPEECH_HAC_OUTPUT_FIR_COEFF,
			DEFAULT_WB_SPEECH_HAC_INPUT_FIR_COEFF,
			DEFAULT_WB_SPEECH_HAC_OUTPUT_FIR_COEFF,
			DEFAULT_VER1_AUD_VOLUME_MIC_HAC,
			DEFAULT_VER1_AUD_VOLUME_SPH_HAC,
			DEFAULT_VER1_AUD_VOLUME_SID_HAC
		};
	
	
	
	alps/vendor/mediatek/proprietary/custom/magc6737m_65_n/cgen/inc/CFG_file_info_custom.h
		extern "C"
		{
			const TCFG_FILE g_akCFG_File_Custom[]=
			{
				...
				{
					"/data/nvram/media/Audio_ver1_Vol_custom",       VER(AP_CFG_RDCL_FILE_AUDIO_VER1_VOLUME_CUSTOM_LID),         CFG_FILE_AUDIO_VER1_VOLUME_CUSTOM_REC_SIZE,
					CFG_FILE_AUDIO_VER1_VOLUME_CUSTOM_REC_TOTAL,           SIGNLE_DEFUALT_REC,                (char *)&audio_ver1_custom_default, DataReset , NULL
				},
				...
				{ "/data/nvram/media/Audio_HAC_Param",   VER(AP_CFG_RDCL_FILE_AUDIO_HAC_PARAM_LID), CFG_FILE_SPEECH_HAC_PARAM_SIZE,
					CFG_FILE_SPEECH_HAC_PARAM_TOTAL, SIGNLE_DEFUALT_REC  ,    (char *)&speech_hac_param_custom_default, DataReset , NULL
				},
				...
			};
			...
			const unsigned int g_i4CFG_File_Custom_Count = sizeof(g_akCFG_File_Custom)/sizeof(TCFG_FILE);
			extern const TCFG_FILE g_akCFG_File_Custom[];
			extern const unsigned int g_i4CFG_File_Custom_Count;
			...
		}
	
	
2. 查看音频模式 - 根据功放芯片手册
	01						模式1	speaker mode	- 功率0.6w
	0101					模式2	speaker mode	- 功率0.85w
	0101 0101 0101			模式6	speaker mode	
	0101 0101 0101 01		模式7
	0101 0101 0101 0101		模式8


	Z:kernel-3.18\sound\soc\mediatek\mt_soc_audio_v3\mt_soc_codec_63xx.c
	
		static void Ext_Speaker_Amp_Change(bool enable)
		{
			if (enable) {
				#if defined(CONFIG_KST_BOARD_V618)		// 0101 为模式2	- 功率0.85w
					mt_audgpio_set_gpio(0);
					mt_audgpio_set_gpio(1);
					mt_audgpio_set_gpio(0);
					mt_audgpio_set_gpio(1);
				#else
					mt_audgpio_set_gpio(1);				// 1   为模式1	- 功率0.6w
				#endif
				
				

3. 调试:
	1.喇叭没有声音----硬件测喇叭是好的
		1.1硬件原理图查看喇叭gpio口
			\\192.168.22.243\software\_HW_Resource_\项目分类\b939-37\原理图\B939_MB_V5.0_20161125.sch
			查看得知为GPIO2
		
		1.2修改驱动
			kernel-3.18\sound\soc\mediatek\mt_soc_audio_v3\mt_soc_codec_63xx.c
			1867  #define GPIO_SPEAKER_EN_PIN	2		//改为2
	

案例一:	mt6739平台音频参数客制化

硬件工程师调试出来的mt6739平台音频参数是一个default.audio_param文件,和之前的mt6580、mt6737等平台的不一样,在mtkonline上搜索default.audio_param关键字,查到如下faq:
[FAQ17569] [AudioTuningTool]如何集成Audio_Tuning_ToolV2.2(或以上)版本的音频参数
其中有说明只要将default.audio_param放在$(MTK_TARGET_PROJECT_FOLDER)/目录下或device/mediatek/$(CHIP)/目录下即可,该规则是在alps/vendor/mediatek/proprietary/external/AudioParamParser/DeployAudioParam.mk中定义的。
解决办法:只要如下修改代码即可客制化mt6739平台的音频参数:
commit 640b5857ebee88624c1fc3da44aa1256b7f9fa13
Author: xujianming 
Date:   Thu Apr 26 18:30:31 2018 +0800

    audio:custom audio para for v630k h1
    
    Signed-off-by: xujianming 

diff --git a/update/alps/kst/drv/audio_para/v630k_h1/default.audio_param b/update/alps/kst/drv/audio_para/v630k_h1/default.audio_param
new file mode 100755
index 0000000..5b93dbf
Binary files /dev/null and b/update/alps/kst/drv/audio_para/v630k_h1/default.audio_param differ
diff --git a/update/alps/kst/make/v630k_v1.1_hd720p_oule_h1_gsm4_w158_f13782040_2GB_16GB.mk b/update/alps/kst/make/v630k_v1.1_hd720p_oule_h1_gsm4_w158_f13782040_2GB_16GB.mk
index c526647..3d845f9 100755
--- a/update/alps/kst/make/v630k_v1.1_hd720p_oule_h1_gsm4_w158_f13782040_2GB_16GB.mk
+++ b/update/alps/kst/make/v630k_v1.1_hd720p_oule_h1_gsm4_w158_f13782040_2GB_16GB.mk
@@ -69,7 +69,7 @@ KST_MIC_CFG =
 #  Mic
 
 #PA
-KST_AUDIO_PARAM = kst_common_audio
+KST_AUDIO_PARAM = v630k_h1
 KST_AUDIO_AMP = 
 #extamp 獠?[7mKD ___ CONFIG_MTK_SPEAKER is not set
 #intamp DMTK PMU  ___ CONFIG_MTK_SPEAKER = y
diff --git a/update/alps/new_x_kst b/update/alps/new_x_kst
index 77a2a47..f91f8d7 100755
--- a/update/alps/new_x_kst
+++ b/update/alps/new_x_kst
@@ -1333,6 +1333,11 @@ fi
 #
 kst_get $KST_PROJECT_CONFIG KST_AUDIO_PARAM                                                                    KST_AUDIO_PARAM
 KST_AUDIO_PARAM=$(echo $KST_AUDIO_PARAM)
+if [[ $KST_PROJECT_NAME =~ "k39" ]] ; then
+ALPS_AUDIO_PARAM=device/mediatek/mt6739
+KST_AUDIO_PARAM=kst/drv/audio_para/$KST_AUDIO_PARAM
+cp -f $KST_AUDIO_PARAM/*  $ALPS_AUDIO_PARAM/
+else
 ALPS_AUDIO_PARAM=vendor/mediatek/proprietary/custom/common/cgen/cfgdefault
 KST_AUDIO_PARAM=kst/drv/audio_para/$KST_AUDIO_PARAM
 cp -f $KST_AUDIO_PARAM/*  $ALPS_AUDIO_PARAM/
@@ -1340,7 +1345,7 @@ cp -f $KST_AUDIO_PARAM/*  $ALPS_AUDIO_PARAM/
 #Remove project audio volume param
 rm vendor/mediatek/proprietary/custom/$KST_PROJECT_NAME/cgen/cfgdefault/audio_ver1_volume_custom_default.h
 rm vendor/mediatek/proprietary/custom/$KST_PROJECT_NAME/cgen/cfgdefault/sph_coeff_default.h
-
+fi
 echo $KST_AUDIO_PARAM is configured





你可能感兴趣的:(mtk驱动)