From d074ce13dec4cdd8c240ced09f206fa1909a76f1 Mon Sep 17 00:00:00 2001 From: fang hui Date: Mon, 20 Jun 2016 15:23:02 +0800 Subject: Refine route for wm8960 Refine route settings for speaker, headset-out, headset-mic. So can swich among them ok. BUG: 30241480 TEST: plug in headset, run as below "brillo_audio_test --libmedia --playback --filename=/data/a.wav" Change-Id: I1e34f83eec794504e18d9e4e7544b3bea565862e Signed-off-by: fang hui --- peripheral/alsa/config_wm8960.h | 77 ++++++++++++++++++++++++++++++++++++++--- 1 file changed, 72 insertions(+), 5 deletions(-) diff --git a/peripheral/alsa/config_wm8960.h b/peripheral/alsa/config_wm8960.h index c51c9bf..29c1797 100755 --- a/peripheral/alsa/config_wm8960.h +++ b/peripheral/alsa/config_wm8960.h @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -/* Copyright (C) 2015 Freescale Semiconductor, Inc. */ +/* Copyright (C) 2015-2016 Freescale Semiconductor, Inc. */ #ifndef ANDROID_INCLUDE_IMX_CONFIG_WM8960_H #define ANDROID_INCLUDE_IMX_CONFIG_WM8960_H @@ -44,7 +44,9 @@ #define MIXER_WM8960_RIGHT_INPUT2_SWITCH "Right Boost Mixer LINPUT2 Switch" #endif -static struct route_setting speaker_output_wm8960[] = { +/* These are values that never change */ +static struct route_setting defaults_wm8960[] = { + /* general */ { .ctl_name = MIXER_WM8960_LEFT_OUTPUT_SWITCH, .intval = 1, @@ -57,10 +59,23 @@ static struct route_setting speaker_output_wm8960[] = { .ctl_name = MIXER_WM8960_PLAYBACK_VOLUME, .intval = 230, }, + { + .ctl_name = NULL, + }, +}; + + +static struct route_setting speaker_output_wm8960[] = { { .ctl_name = MIXER_WM8960_SPEAKER_VOLUME, .intval = 120, }, + { + .ctl_name = NULL, + }, +}; + +static struct route_setting headset_output_wm8960[] = { { .ctl_name = MIXER_WM8960_HEADPHONE_VOLUME, .intval = 120, @@ -70,6 +85,8 @@ static struct route_setting speaker_output_wm8960[] = { }, }; + + static struct route_setting mm_main_mic_input_wm8960[] = { { .ctl_name = MIXER_WM8960_ALC_FUNCTION, @@ -118,6 +135,56 @@ static struct route_setting mm_main_mic_input_wm8960[] = { }, }; + +static struct route_setting mm_hs_mic_input_wm8960[] = { + { + .ctl_name = MIXER_WM8960_ALC_FUNCTION, + .intval = 3, + }, + { + .ctl_name = MIXER_WM8960_LEFT_INPUT_SWITCH, + .intval = 1, + }, + { + .ctl_name = MIXER_WM8960_ADC_PCM_CAPTURE_VOLUME, + .intval = 230, + }, + { + .ctl_name = MIXER_WM8960_CAPTURE_VOLUME, + .intval = 60, + }, +#ifdef __BRILLO__ + { + .ctl_name = MIXER_WM8960_LEFT_INPUT1_SWITCH, + .intval = 1, + }, + { + .ctl_name = MIXER_WM8960_LEFT_INPUT2_SWITCH, + .intval = 1, + }, + { + .ctl_name = MIXER_WM8960_LEFT_INPUT3_SWITCH, + .intval = 1, + }, + { + .ctl_name = MIXER_WM8960_RIGHT_INPUT_SWITCH, + .intval = 1, + }, + { + .ctl_name = MIXER_WM8960_RIGHT_INPUT1_SWITCH, + .intval = 1, + }, + { + .ctl_name = MIXER_WM8960_RIGHT_INPUT2_SWITCH, + .intval = 1, + }, +#endif + { + .ctl_name = NULL, + }, +}; + + /* ALSA cards for IMX, these must be defined according different board / kernel config*/ static struct audio_card wm8960_card = { .name = "wm8960-audio", @@ -137,15 +204,15 @@ static struct audio_card wm8960_card = { AUDIO_DEVICE_IN_BACK_MIC | AUDIO_DEVICE_IN_ALL_SCO | AUDIO_DEVICE_IN_DEFAULT), - .defaults = NULL, + .defaults = defaults_wm8960, .bt_output = NULL, .speaker_output = speaker_output_wm8960, - .hs_output = NULL, + .hs_output = headset_output_wm8960, .earpiece_output = NULL, .vx_hs_mic_input = NULL, .mm_main_mic_input = mm_main_mic_input_wm8960, .vx_main_mic_input = NULL, - .mm_hs_mic_input = NULL, + .mm_hs_mic_input = mm_hs_mic_input_wm8960, .vx_bt_mic_input = NULL, .mm_bt_mic_input = NULL, .card = 0, -- cgit v1.2.3