diff options
author | UtkarshGupta <utkarsh.eminem@gmail.com> | 2014-03-01 14:12:44 +0530 |
---|---|---|
committer | tilaksidduram <tilaksidduram@gmail.com> | 2014-03-24 19:23:31 +0530 |
commit | d70bf47d8a3fbac42a70832bf920af23387b56c7 (patch) | |
tree | c52a258d433bc3a8d36e5f16b9e431663448df12 /audio | |
parent | 3e5fcd69f24368230865767623c7b6341091e7aa (diff) | |
download | device_samsung_n7100-d70bf47d8a3fbac42a70832bf920af23387b56c7.zip device_samsung_n7100-d70bf47d8a3fbac42a70832bf920af23387b56c7.tar.gz device_samsung_n7100-d70bf47d8a3fbac42a70832bf920af23387b56c7.tar.bz2 |
n7100: audio: update hal
Change-Id: I67d8822b68096445dd96ed8f80d21322c778daf2
Conflicts:
audio/audio_hw.c
Diffstat (limited to 'audio')
-rw-r--r--[-rwxr-xr-x] | audio/audio_hw.c | 66 | ||||
-rw-r--r-- | audio/audio_hw.h | 8 |
2 files changed, 33 insertions, 41 deletions
diff --git a/audio/audio_hw.c b/audio/audio_hw.c index 50b0014..55044f0 100755..100644 --- a/audio/audio_hw.c +++ b/audio/audio_hw.c @@ -73,7 +73,7 @@ struct pcm_config pcm_config_capture = { struct pcm_config pcm_config_vx = { .channels = 2, - .rate = VX_NB_SAMPLING_RATE, + .rate = VX_WB_SAMPLING_RATE, .period_size = 160, .period_count = 2, .format = PCM_FORMAT_S16_LE, @@ -209,7 +209,7 @@ static void in_update_aux_channels(struct m0_stream_in *in, effect_handle_t effe /* The enable flag when 0 makes the assumption that enums are disabled by * "Off" and integers/booleans by 0 */ -static int set_voicecall_route_by_array(struct mixer *mixer, struct route_setting *route, +static int set_bigroute_by_array(struct mixer *mixer, struct route_setting *route, int enable) { struct mixer_ctl *ctl; @@ -360,7 +360,13 @@ static int start_call(struct m0_audio_device *adev) int bt_on; bt_on = adev->out_device & AUDIO_DEVICE_OUT_ALL_SCO; - pcm_config_vx.rate = adev->wb_amr ? VX_WB_SAMPLING_RATE : VX_NB_SAMPLING_RATE; + + if (bt_on) { + /* use amr-nb for bluetooth */ + pcm_config_vx.rate = VX_NB_SAMPLING_RATE; + } else { + pcm_config_vx.rate = adev->wb_amr ? VX_WB_SAMPLING_RATE : VX_NB_SAMPLING_RATE; + } /* Open modem PCM channels */ if (adev->pcm_modem_dl == NULL) { @@ -592,19 +598,7 @@ static void select_mode(struct m0_audio_device *adev) adev->in_call = 0; end_call(adev); force_all_standby(adev); - - ALOGD("%s: set voicecall route: voicecall_default_disable", __func__); - set_voicecall_route_by_array(adev->mixer, voicecall_default_disable, 1); - ALOGD("%s: set voicecall route: default_input_disable", __func__); - set_voicecall_route_by_array(adev->mixer, default_input_disable, 1); - ALOGD("%s: set voicecall route: headset_input_disable", __func__); - set_voicecall_route_by_array(adev->mixer, headset_input_disable, 1); - ALOGD("%s: set voicecall route: bt_disable", __func__); - set_voicecall_route_by_array(adev->mixer, bt_disable, 1); - select_output_device(adev); - //Force Input Standby - adev->in_device = AUDIO_DEVICE_NONE; select_input_device(adev); } } @@ -690,41 +684,37 @@ static void select_output_device(struct m0_audio_device *adev) if (headset_on || headphone_on || speaker_on || earpiece_on) { ALOGD("%s: set voicecall route: voicecall_default", __func__); - set_voicecall_route_by_array(adev->mixer, voicecall_default, 1); + set_bigroute_by_array(adev->mixer, voicecall_default, 1); } else { ALOGD("%s: set voicecall route: voicecall_default_disable", __func__); - set_voicecall_route_by_array(adev->mixer, voicecall_default_disable, 1); + set_bigroute_by_array(adev->mixer, voicecall_default_disable, 1); } if (speaker_on || earpiece_on || headphone_on) { ALOGD("%s: set voicecall route: default_input", __func__); - set_voicecall_route_by_array(adev->mixer, default_input, 1); + set_bigroute_by_array(adev->mixer, default_input, 1); } else { ALOGD("%s: set voicecall route: default_input_disable", __func__); - set_voicecall_route_by_array(adev->mixer, default_input_disable, 1); + set_bigroute_by_array(adev->mixer, default_input_disable, 1); } if (headset_on) { ALOGD("%s: set voicecall route: headset_input", __func__); - set_voicecall_route_by_array(adev->mixer, headset_input, 1); + set_bigroute_by_array(adev->mixer, headset_input, 1); } else { ALOGD("%s: set voicecall route: headset_input_disable", __func__); - set_voicecall_route_by_array(adev->mixer, headset_input_disable, 1); + set_bigroute_by_array(adev->mixer, headset_input_disable, 1); } if (bt_on) { - // bt uses a different port (PORT_BT) for playback, reopen the pcms - end_call(adev); - start_call(adev); ALOGD("%s: set voicecall route: bt_input", __func__); - set_voicecall_route_by_array(adev->mixer, bt_input, 1); + set_bigroute_by_array(adev->mixer, bt_input, 1); ALOGD("%s: set voicecall route: bt_output", __func__); - set_voicecall_route_by_array(adev->mixer, bt_output, 1); + set_bigroute_by_array(adev->mixer, bt_output, 1); } else { ALOGD("%s: set voicecall route: bt_disable", __func__); - set_voicecall_route_by_array(adev->mixer, bt_disable, 1); + set_bigroute_by_array(adev->mixer, bt_disable, 1); } - set_incall_device(adev); } } @@ -738,9 +728,9 @@ static void select_input_device(struct m0_audio_device *adev) ALOGD("%s: AUDIO_DEVICE_IN_BUILTIN_MIC", __func__); break; case AUDIO_DEVICE_IN_BACK_MIC: - ALOGD("%s: AUDIO_DEVICE_IN_BACK_MIC | AUDIO_DEVICE_IN_BUILTIN_MIC", __func__); // Force use both mics for video recording adev->in_device = (AUDIO_DEVICE_IN_BACK_MIC | AUDIO_DEVICE_IN_BUILTIN_MIC) & ~AUDIO_DEVICE_BIT_IN; + ALOGD("%s: AUDIO_DEVICE_IN_BACK_MIC and AUDIO_DEVICE_IN_BUILTIN_MIC", __func__); break; case AUDIO_DEVICE_IN_BLUETOOTH_SCO_HEADSET: ALOGD("%s: AUDIO_DEVICE_IN_BLUETOOTH_SCO_HEADSET", __func__); @@ -2602,12 +2592,12 @@ static int adev_set_parameters(struct audio_hw_device *dev, const char *kvpairs) ALOGE("%s: enabling two mic control", __func__); ril_set_two_mic_control(&adev->ril, AUDIENCE, TWO_MIC_SOLUTION_ON); /* sub mic */ - set_voicecall_route_by_array(adev->mixer, noise_suppression, 1); + set_bigroute_by_array(adev->mixer, noise_suppression, 1); } else { ALOGE("%s: disabling two mic control", __func__); ril_set_two_mic_control(&adev->ril, AUDIENCE, TWO_MIC_SOLUTION_OFF); /* sub mic */ - set_voicecall_route_by_array(adev->mixer, noise_suppression_disable, 1); + set_bigroute_by_array(adev->mixer, noise_suppression_disable, 1); } } @@ -2830,7 +2820,7 @@ static const struct { { AUDIO_DEVICE_OUT_SPEAKER, "speaker" }, { AUDIO_DEVICE_OUT_WIRED_HEADSET | AUDIO_DEVICE_OUT_WIRED_HEADPHONE, "headphone" }, { AUDIO_DEVICE_OUT_EARPIECE, "earpiece" }, - { AUDIO_DEVICE_OUT_ANLG_DOCK_HEADSET, "analog-dock" }, + { AUDIO_DEVICE_OUT_ANLG_DOCK_HEADSET, "analogue-dock" }, { AUDIO_DEVICE_OUT_DGTL_DOCK_HEADSET, "digital-dock" }, { AUDIO_DEVICE_OUT_ALL_SCO, "sco-out" }, { AUDIO_DEVICE_OUT_AUX_DIGITAL, "aux-digital" }, @@ -3078,6 +3068,10 @@ static int adev_open(const hw_module_t* module, const char* name, return -EINVAL; } + /* +30db boost for mics */ + adev->mixer_ctls.mixinl_in1l_volume = mixer_get_ctl_by_name(adev->mixer, "MIXINL IN1L Volume"); + adev->mixer_ctls.mixinl_in2l_volume = mixer_get_ctl_by_name(adev->mixer, "MIXINL IN2L Volume"); + ret = adev_config_parse(adev); if (ret != 0) goto err_mixer; @@ -3086,13 +3080,9 @@ static int adev_open(const hw_module_t* module, const char* name, pthread_mutex_lock(&adev->lock); adev->mode = AUDIO_MODE_NORMAL; adev->out_device = AUDIO_DEVICE_OUT_SPEAKER; - adev->in_device = AUDIO_DEVICE_NONE; + adev->in_device = AUDIO_DEVICE_IN_BUILTIN_MIC & ~AUDIO_DEVICE_BIT_IN; select_devices(adev); - /* +30db boost for mics */ - adev->mixer_ctls.mixinl_in1l_volume = mixer_get_ctl_by_name(adev->mixer, "MIXINL IN1L Volume"); - adev->mixer_ctls.mixinl_in2l_volume = mixer_get_ctl_by_name(adev->mixer, "MIXINL IN2L Volume"); - adev->pcm_modem_dl = NULL; adev->pcm_modem_ul = NULL; adev->pcm_bt_dl = NULL; @@ -3128,7 +3118,7 @@ struct audio_module HAL_MODULE_INFO_SYM = { .module_api_version = AUDIO_MODULE_API_VERSION_0_1, .hal_api_version = HARDWARE_HAL_API_VERSION, .id = AUDIO_HARDWARE_MODULE_ID, - .name = "M0 audio HW HAL", + .name = "T03G audio HW HAL", .author = "The CyanogenMod Project", .methods = &hal_module_methods, }, diff --git a/audio/audio_hw.h b/audio/audio_hw.h index d7d68d9..889c249 100644 --- a/audio/audio_hw.h +++ b/audio/audio_hw.h @@ -134,6 +134,8 @@ struct route_setting voicecall_default_disable[] = { { .ctl_name = "AIF2DAC Mux", .strval = "AIF3DACDAT", }, { .ctl_name = "Main Mic Switch", .intval = 0, }, { .ctl_name = "MIXINL IN2L Switch", .intval = 0, }, + { .ctl_name = "Sub Mic Switch", .intval = 0, }, + { .ctl_name = "MIXINR IN1R Switch", .intval = 0, }, { .ctl_name = NULL, }, }; @@ -177,7 +179,7 @@ struct route_setting headset_input[] = { { .ctl_name = "MIXINL IN2L Switch", .intval = 0, }, { .ctl_name = "MIXINR IN1R Switch", .intval = 0, }, { .ctl_name = "Headset Mic Switch", .intval = 1, }, - { .ctl_name = "IN1L Volume", .intval = 28, }, + { .ctl_name = "IN1L Volume", .intval = 18, }, { .ctl_name = "MIXINL IN1L Switch", .intval = 1, }, { .ctl_name = "MIXINL IN1L Volume", .intval = 0, }, { .ctl_name = "AIF1ADC1 HPF Mode", .intval = 1, }, @@ -208,8 +210,8 @@ struct route_setting bt_output[] = { { .ctl_name = "AIF2DAC2R Mixer AIF1.1 Switch", .intval = 1, }, { .ctl_name = "AIF2DAC Volume", .intval = 96, }, { .ctl_name = "MIXINL IN1L Volume", .intval = 1, }, - { .ctl_name = "IN2L Volume", .intval = 25, }, - { .ctl_name = "IN1R Volume", .intval = 25, }, + { .ctl_name = "IN2L Volume", .intval = 28, }, + { .ctl_name = "IN1R Volume", .intval = 28, }, { .ctl_name = "LINEOUT1N Switch", .intval = 0, }, { .ctl_name = "LINEOUT1P Switch", .intval = 0, }, { .ctl_name = "AIF1ADC1 HPF Switch", .intval = 0, }, |