Loading hal/audio_extn/hfp.c +5 −2 Original line number Diff line number Diff line Loading @@ -270,10 +270,13 @@ static int32_t stop_hfp(struct audio_device *adev) return -EINVAL; } /* 2. Get and set stream specific mixer controls */ /* 2. Disable echo reference while stopping hfp */ platform_set_echo_reference(adev->platform, false); /* 3. Get and set stream specific mixer controls */ disable_audio_route(adev, uc_info); /* 3. Disable the rx and tx devices */ /* 4. Disable the rx and tx devices */ disable_snd_device(adev, uc_info->out_snd_device); disable_snd_device(adev, uc_info->in_snd_device); Loading hal/audio_hw.c +3 −0 Original line number Diff line number Diff line Loading @@ -3016,6 +3016,9 @@ static void adev_close_input_stream(struct audio_hw_device *dev, ALOGD("%s: enter:stream_handle(%p)",__func__, in); /* Disable echo reference while closing input stream */ platform_set_echo_reference(adev->platform, false); if (in->usecase == USECASE_COMPRESS_VOIP_CALL) { pthread_mutex_lock(&adev->lock); ret = voice_extn_compress_voip_close_input_stream(&stream->common); Loading hal/msm8916/platform.c +26 −14 Original line number Diff line number Diff line Loading @@ -124,6 +124,7 @@ struct platform_data { int fluence_mode; bool slowtalk; bool hd_voice; bool ec_ref_enabled; /* Audio calibration related functions */ void *acdb_handle; int voice_feature_set; Loading Loading @@ -472,16 +473,24 @@ static void query_platform(const char *snd_card_name, } } static void set_echo_reference(struct audio_device *adev, bool enable) void platform_set_echo_reference(void *platform, bool enable) { int ret = 0; struct platform_data *my_data = (struct platform_data *)platform; struct audio_device *adev = my_data->adev; if (enable) ret = audio_route_apply_and_update_path(adev->audio_route, "echo-reference"); else ret = audio_route_reset_and_update_path(adev->audio_route, "echo-reference"); if (enable) { my_data->ec_ref_enabled = enable; audio_route_apply_and_update_path(adev->audio_route, "echo-reference"); } else { if (my_data->ec_ref_enabled) { audio_route_reset_and_update_path(adev->audio_route, "echo-reference"); my_data->ec_ref_enabled = enable; } else { ALOGV("EC reference is already disabled : %d", my_data->ec_ref_enabled); } } ALOGV("Setting EC Reference: %d ret: %d", enable, ret); ALOGV("Setting EC Reference: %d", enable); } static struct csd_data *open_csd_client() Loading Loading @@ -1474,14 +1483,16 @@ snd_device_t platform_get_input_snd_device(void *platform, audio_devices_t out_d } else if (my_data->fluence_type == FLUENCE_NONE || my_data->fluence_in_voice_call == false) { snd_device = SND_DEVICE_IN_HANDSET_MIC; set_echo_reference(adev, true); if (audio_extn_hfp_is_active(adev)) platform_set_echo_reference(adev->platform, true); } else { snd_device = SND_DEVICE_IN_VOICE_DMIC; adev->acdb_settings |= DMIC_FLAG; } } else if (out_device & AUDIO_DEVICE_OUT_WIRED_HEADSET) { snd_device = SND_DEVICE_IN_VOICE_HEADSET_MIC; set_echo_reference(adev, true); if (audio_extn_hfp_is_active(adev)) platform_set_echo_reference(adev->platform, true); } else if (out_device & AUDIO_DEVICE_OUT_ALL_SCO) { if (adev->bt_wb_speech_enabled) { if (adev->bluetooth_nrec) Loading Loading @@ -1510,7 +1521,8 @@ snd_device_t platform_get_input_snd_device(void *platform, audio_devices_t out_d } } else { snd_device = SND_DEVICE_IN_VOICE_SPEAKER_MIC; set_echo_reference(adev, true); if (audio_extn_hfp_is_active(adev)) platform_set_echo_reference(adev->platform, true); } } } else if (source == AUDIO_SOURCE_CAMCORDER) { Loading Loading @@ -1562,7 +1574,7 @@ snd_device_t platform_get_input_snd_device(void *platform, audio_devices_t out_d } else if (in_device & AUDIO_DEVICE_IN_WIRED_HEADSET) { snd_device = SND_DEVICE_IN_HEADSET_MIC_FLUENCE; } set_echo_reference(adev, true); platform_set_echo_reference(adev->platform, true); } else if (adev->active_input->enable_aec) { if (in_device & AUDIO_DEVICE_IN_BACK_MIC) { if (my_data->fluence_type & FLUENCE_DUAL_MIC && Loading @@ -1583,7 +1595,7 @@ snd_device_t platform_get_input_snd_device(void *platform, audio_devices_t out_d } else if (in_device & AUDIO_DEVICE_IN_WIRED_HEADSET) { snd_device = SND_DEVICE_IN_HEADSET_MIC_FLUENCE; } set_echo_reference(adev, true); platform_set_echo_reference(adev->platform, true); } else if (adev->active_input->enable_ns) { if (in_device & AUDIO_DEVICE_IN_BACK_MIC) { if (my_data->fluence_type & FLUENCE_DUAL_MIC && Loading @@ -1604,9 +1616,9 @@ snd_device_t platform_get_input_snd_device(void *platform, audio_devices_t out_d } else if (in_device & AUDIO_DEVICE_IN_WIRED_HEADSET) { snd_device = SND_DEVICE_IN_HEADSET_MIC_FLUENCE; } set_echo_reference(adev, false); platform_set_echo_reference(adev->platform,false); } else set_echo_reference(adev, false); platform_set_echo_reference(adev->platform, false); } } else if (source == AUDIO_SOURCE_MIC) { if (in_device & AUDIO_DEVICE_IN_BUILTIN_MIC && Loading hal/msm8960/platform.c +17 −6 Original line number Diff line number Diff line Loading @@ -80,6 +80,7 @@ struct platform_data { bool fluence_in_voice_rec; int fluence_type; int dualmic_config; bool ec_ref_enabled; /* Audio calibration related functions */ void *acdb_handle; Loading Loading @@ -201,12 +202,22 @@ static const int acdb_device_table[SND_DEVICE_MAX] = { #define DEEP_BUFFER_PLATFORM_DELAY (29*1000LL) #define LOW_LATENCY_PLATFORM_DELAY (13*1000LL) static void set_echo_reference(struct audio_device *adev, bool enable) void platform_set_echo_reference(void *platform, bool enable) { if (enable) struct platform_data *my_data = (struct platform_data *)platform; struct audio_device *adev = my_data->adev; if (enable) { my_data->ec_ref_enabled = enable; audio_route_apply_and_update_path(adev->audio_route, "echo-reference"); else } else { if (my_data->ec_ref_enabled) { audio_route_reset_and_update_path(adev->audio_route, "echo-reference"); my_data->ec_ref_enabled = enable; } else { ALOGV("EC Reference is already disabled: %d", my_data->ec_ref_enabled); } } ALOGV("Setting EC Reference: %d", enable); } Loading Loading @@ -809,9 +820,9 @@ snd_device_t platform_get_input_snd_device(void *platform, audio_devices_t out_d } else if (in_device & AUDIO_DEVICE_IN_WIRED_HEADSET) { snd_device = SND_DEVICE_IN_HEADSET_MIC_AEC; } set_echo_reference(adev, true); platform_set_echo_reference(adev->platform, true); } else set_echo_reference(adev, false); platform_set_echo_reference(adev->platform, false); } } else if (source == AUDIO_SOURCE_DEFAULT) { goto exit; Loading hal/msm8974/platform.c +27 −13 Original line number Diff line number Diff line Loading @@ -132,6 +132,7 @@ struct platform_data { char fluence_cap[PROPERTY_VALUE_MAX]; bool slowtalk; bool hd_voice; bool ec_ref_enabled; bool is_i2s_ext_modem; /* Audio calibration related functions */ void *acdb_handle; Loading Loading @@ -497,12 +498,22 @@ static struct name_to_index usecase_name_index[AUDIO_USECASE_MAX] = { #define DEEP_BUFFER_PLATFORM_DELAY (29*1000LL) #define LOW_LATENCY_PLATFORM_DELAY (13*1000LL) static void set_echo_reference(struct audio_device *adev, bool enable) void platform_set_echo_reference(void *platform, bool enable) { if (enable) struct platform_data *my_data = (struct platform_data *)platform; struct audio_device *adev = my_data->adev; if (enable) { my_data->ec_ref_enabled = enable; audio_route_apply_and_update_path(adev->audio_route, "echo-reference"); else } else { if (my_data->ec_ref_enabled) { audio_route_reset_and_update_path(adev->audio_route, "echo-reference"); my_data->ec_ref_enabled = enable; } else { ALOGV("EC Reference is already disabled: %d", my_data->ec_ref_enabled); } } ALOGV("Setting EC Reference: %d", enable); } Loading Loading @@ -1656,13 +1667,15 @@ snd_device_t platform_get_input_snd_device(void *platform, audio_devices_t out_d } else if (my_data->fluence_type == FLUENCE_NONE || my_data->fluence_in_voice_call == false) { snd_device = SND_DEVICE_IN_HANDSET_MIC; set_echo_reference(adev, true); if (audio_extn_hfp_is_active(adev)) platform_set_echo_reference(adev->platform, true); } else { snd_device = SND_DEVICE_IN_VOICE_DMIC; } } else if (out_device & AUDIO_DEVICE_OUT_WIRED_HEADSET) { snd_device = SND_DEVICE_IN_VOICE_HEADSET_MIC; set_echo_reference(adev, true); if (audio_extn_hfp_is_active(adev)) platform_set_echo_reference(adev->platform, true); } else if (out_device & AUDIO_DEVICE_OUT_ALL_SCO) { if (adev->bt_wb_speech_enabled) { if (adev->bluetooth_nrec) Loading Loading @@ -1690,7 +1703,8 @@ snd_device_t platform_get_input_snd_device(void *platform, audio_devices_t out_d } } else { snd_device = SND_DEVICE_IN_VOICE_SPEAKER_MIC; set_echo_reference(adev, true); if (audio_extn_hfp_is_active(adev)) platform_set_echo_reference(adev->platform, true); } } } else if (source == AUDIO_SOURCE_CAMCORDER) { Loading Loading @@ -1734,7 +1748,7 @@ snd_device_t platform_get_input_snd_device(void *platform, audio_devices_t out_d } else if (in_device & AUDIO_DEVICE_IN_WIRED_HEADSET) { snd_device = SND_DEVICE_IN_HEADSET_MIC_FLUENCE; } set_echo_reference(adev, true); platform_set_echo_reference(adev->platform, true); } else if (adev->active_input->enable_aec) { if (in_device & AUDIO_DEVICE_IN_BACK_MIC) { if (my_data->fluence_type & FLUENCE_DUAL_MIC && Loading @@ -1753,7 +1767,7 @@ snd_device_t platform_get_input_snd_device(void *platform, audio_devices_t out_d } else if (in_device & AUDIO_DEVICE_IN_WIRED_HEADSET) { snd_device = SND_DEVICE_IN_HEADSET_MIC_FLUENCE; } set_echo_reference(adev, true); platform_set_echo_reference(adev->platform, true); } else if (adev->active_input->enable_ns) { if (in_device & AUDIO_DEVICE_IN_BACK_MIC) { if (my_data->fluence_type & FLUENCE_DUAL_MIC && Loading @@ -1772,9 +1786,9 @@ snd_device_t platform_get_input_snd_device(void *platform, audio_devices_t out_d } else if (in_device & AUDIO_DEVICE_IN_WIRED_HEADSET) { snd_device = SND_DEVICE_IN_HEADSET_MIC_FLUENCE; } set_echo_reference(adev, false); platform_set_echo_reference(adev->platform, false); } else set_echo_reference(adev, false); platform_set_echo_reference(adev->platform, false); } } else if (source == AUDIO_SOURCE_MIC) { if (in_device & AUDIO_DEVICE_IN_BUILTIN_MIC && Loading @@ -1782,7 +1796,7 @@ snd_device_t platform_get_input_snd_device(void *platform, audio_devices_t out_d if(my_data->fluence_type & FLUENCE_DUAL_MIC && my_data->fluence_in_audio_rec) { snd_device = SND_DEVICE_IN_HANDSET_DMIC; set_echo_reference(adev, true); platform_set_echo_reference(adev->platform, true); } } } else if (source == AUDIO_SOURCE_FM_RX || Loading Loading
hal/audio_extn/hfp.c +5 −2 Original line number Diff line number Diff line Loading @@ -270,10 +270,13 @@ static int32_t stop_hfp(struct audio_device *adev) return -EINVAL; } /* 2. Get and set stream specific mixer controls */ /* 2. Disable echo reference while stopping hfp */ platform_set_echo_reference(adev->platform, false); /* 3. Get and set stream specific mixer controls */ disable_audio_route(adev, uc_info); /* 3. Disable the rx and tx devices */ /* 4. Disable the rx and tx devices */ disable_snd_device(adev, uc_info->out_snd_device); disable_snd_device(adev, uc_info->in_snd_device); Loading
hal/audio_hw.c +3 −0 Original line number Diff line number Diff line Loading @@ -3016,6 +3016,9 @@ static void adev_close_input_stream(struct audio_hw_device *dev, ALOGD("%s: enter:stream_handle(%p)",__func__, in); /* Disable echo reference while closing input stream */ platform_set_echo_reference(adev->platform, false); if (in->usecase == USECASE_COMPRESS_VOIP_CALL) { pthread_mutex_lock(&adev->lock); ret = voice_extn_compress_voip_close_input_stream(&stream->common); Loading
hal/msm8916/platform.c +26 −14 Original line number Diff line number Diff line Loading @@ -124,6 +124,7 @@ struct platform_data { int fluence_mode; bool slowtalk; bool hd_voice; bool ec_ref_enabled; /* Audio calibration related functions */ void *acdb_handle; int voice_feature_set; Loading Loading @@ -472,16 +473,24 @@ static void query_platform(const char *snd_card_name, } } static void set_echo_reference(struct audio_device *adev, bool enable) void platform_set_echo_reference(void *platform, bool enable) { int ret = 0; struct platform_data *my_data = (struct platform_data *)platform; struct audio_device *adev = my_data->adev; if (enable) ret = audio_route_apply_and_update_path(adev->audio_route, "echo-reference"); else ret = audio_route_reset_and_update_path(adev->audio_route, "echo-reference"); if (enable) { my_data->ec_ref_enabled = enable; audio_route_apply_and_update_path(adev->audio_route, "echo-reference"); } else { if (my_data->ec_ref_enabled) { audio_route_reset_and_update_path(adev->audio_route, "echo-reference"); my_data->ec_ref_enabled = enable; } else { ALOGV("EC reference is already disabled : %d", my_data->ec_ref_enabled); } } ALOGV("Setting EC Reference: %d ret: %d", enable, ret); ALOGV("Setting EC Reference: %d", enable); } static struct csd_data *open_csd_client() Loading Loading @@ -1474,14 +1483,16 @@ snd_device_t platform_get_input_snd_device(void *platform, audio_devices_t out_d } else if (my_data->fluence_type == FLUENCE_NONE || my_data->fluence_in_voice_call == false) { snd_device = SND_DEVICE_IN_HANDSET_MIC; set_echo_reference(adev, true); if (audio_extn_hfp_is_active(adev)) platform_set_echo_reference(adev->platform, true); } else { snd_device = SND_DEVICE_IN_VOICE_DMIC; adev->acdb_settings |= DMIC_FLAG; } } else if (out_device & AUDIO_DEVICE_OUT_WIRED_HEADSET) { snd_device = SND_DEVICE_IN_VOICE_HEADSET_MIC; set_echo_reference(adev, true); if (audio_extn_hfp_is_active(adev)) platform_set_echo_reference(adev->platform, true); } else if (out_device & AUDIO_DEVICE_OUT_ALL_SCO) { if (adev->bt_wb_speech_enabled) { if (adev->bluetooth_nrec) Loading Loading @@ -1510,7 +1521,8 @@ snd_device_t platform_get_input_snd_device(void *platform, audio_devices_t out_d } } else { snd_device = SND_DEVICE_IN_VOICE_SPEAKER_MIC; set_echo_reference(adev, true); if (audio_extn_hfp_is_active(adev)) platform_set_echo_reference(adev->platform, true); } } } else if (source == AUDIO_SOURCE_CAMCORDER) { Loading Loading @@ -1562,7 +1574,7 @@ snd_device_t platform_get_input_snd_device(void *platform, audio_devices_t out_d } else if (in_device & AUDIO_DEVICE_IN_WIRED_HEADSET) { snd_device = SND_DEVICE_IN_HEADSET_MIC_FLUENCE; } set_echo_reference(adev, true); platform_set_echo_reference(adev->platform, true); } else if (adev->active_input->enable_aec) { if (in_device & AUDIO_DEVICE_IN_BACK_MIC) { if (my_data->fluence_type & FLUENCE_DUAL_MIC && Loading @@ -1583,7 +1595,7 @@ snd_device_t platform_get_input_snd_device(void *platform, audio_devices_t out_d } else if (in_device & AUDIO_DEVICE_IN_WIRED_HEADSET) { snd_device = SND_DEVICE_IN_HEADSET_MIC_FLUENCE; } set_echo_reference(adev, true); platform_set_echo_reference(adev->platform, true); } else if (adev->active_input->enable_ns) { if (in_device & AUDIO_DEVICE_IN_BACK_MIC) { if (my_data->fluence_type & FLUENCE_DUAL_MIC && Loading @@ -1604,9 +1616,9 @@ snd_device_t platform_get_input_snd_device(void *platform, audio_devices_t out_d } else if (in_device & AUDIO_DEVICE_IN_WIRED_HEADSET) { snd_device = SND_DEVICE_IN_HEADSET_MIC_FLUENCE; } set_echo_reference(adev, false); platform_set_echo_reference(adev->platform,false); } else set_echo_reference(adev, false); platform_set_echo_reference(adev->platform, false); } } else if (source == AUDIO_SOURCE_MIC) { if (in_device & AUDIO_DEVICE_IN_BUILTIN_MIC && Loading
hal/msm8960/platform.c +17 −6 Original line number Diff line number Diff line Loading @@ -80,6 +80,7 @@ struct platform_data { bool fluence_in_voice_rec; int fluence_type; int dualmic_config; bool ec_ref_enabled; /* Audio calibration related functions */ void *acdb_handle; Loading Loading @@ -201,12 +202,22 @@ static const int acdb_device_table[SND_DEVICE_MAX] = { #define DEEP_BUFFER_PLATFORM_DELAY (29*1000LL) #define LOW_LATENCY_PLATFORM_DELAY (13*1000LL) static void set_echo_reference(struct audio_device *adev, bool enable) void platform_set_echo_reference(void *platform, bool enable) { if (enable) struct platform_data *my_data = (struct platform_data *)platform; struct audio_device *adev = my_data->adev; if (enable) { my_data->ec_ref_enabled = enable; audio_route_apply_and_update_path(adev->audio_route, "echo-reference"); else } else { if (my_data->ec_ref_enabled) { audio_route_reset_and_update_path(adev->audio_route, "echo-reference"); my_data->ec_ref_enabled = enable; } else { ALOGV("EC Reference is already disabled: %d", my_data->ec_ref_enabled); } } ALOGV("Setting EC Reference: %d", enable); } Loading Loading @@ -809,9 +820,9 @@ snd_device_t platform_get_input_snd_device(void *platform, audio_devices_t out_d } else if (in_device & AUDIO_DEVICE_IN_WIRED_HEADSET) { snd_device = SND_DEVICE_IN_HEADSET_MIC_AEC; } set_echo_reference(adev, true); platform_set_echo_reference(adev->platform, true); } else set_echo_reference(adev, false); platform_set_echo_reference(adev->platform, false); } } else if (source == AUDIO_SOURCE_DEFAULT) { goto exit; Loading
hal/msm8974/platform.c +27 −13 Original line number Diff line number Diff line Loading @@ -132,6 +132,7 @@ struct platform_data { char fluence_cap[PROPERTY_VALUE_MAX]; bool slowtalk; bool hd_voice; bool ec_ref_enabled; bool is_i2s_ext_modem; /* Audio calibration related functions */ void *acdb_handle; Loading Loading @@ -497,12 +498,22 @@ static struct name_to_index usecase_name_index[AUDIO_USECASE_MAX] = { #define DEEP_BUFFER_PLATFORM_DELAY (29*1000LL) #define LOW_LATENCY_PLATFORM_DELAY (13*1000LL) static void set_echo_reference(struct audio_device *adev, bool enable) void platform_set_echo_reference(void *platform, bool enable) { if (enable) struct platform_data *my_data = (struct platform_data *)platform; struct audio_device *adev = my_data->adev; if (enable) { my_data->ec_ref_enabled = enable; audio_route_apply_and_update_path(adev->audio_route, "echo-reference"); else } else { if (my_data->ec_ref_enabled) { audio_route_reset_and_update_path(adev->audio_route, "echo-reference"); my_data->ec_ref_enabled = enable; } else { ALOGV("EC Reference is already disabled: %d", my_data->ec_ref_enabled); } } ALOGV("Setting EC Reference: %d", enable); } Loading Loading @@ -1656,13 +1667,15 @@ snd_device_t platform_get_input_snd_device(void *platform, audio_devices_t out_d } else if (my_data->fluence_type == FLUENCE_NONE || my_data->fluence_in_voice_call == false) { snd_device = SND_DEVICE_IN_HANDSET_MIC; set_echo_reference(adev, true); if (audio_extn_hfp_is_active(adev)) platform_set_echo_reference(adev->platform, true); } else { snd_device = SND_DEVICE_IN_VOICE_DMIC; } } else if (out_device & AUDIO_DEVICE_OUT_WIRED_HEADSET) { snd_device = SND_DEVICE_IN_VOICE_HEADSET_MIC; set_echo_reference(adev, true); if (audio_extn_hfp_is_active(adev)) platform_set_echo_reference(adev->platform, true); } else if (out_device & AUDIO_DEVICE_OUT_ALL_SCO) { if (adev->bt_wb_speech_enabled) { if (adev->bluetooth_nrec) Loading Loading @@ -1690,7 +1703,8 @@ snd_device_t platform_get_input_snd_device(void *platform, audio_devices_t out_d } } else { snd_device = SND_DEVICE_IN_VOICE_SPEAKER_MIC; set_echo_reference(adev, true); if (audio_extn_hfp_is_active(adev)) platform_set_echo_reference(adev->platform, true); } } } else if (source == AUDIO_SOURCE_CAMCORDER) { Loading Loading @@ -1734,7 +1748,7 @@ snd_device_t platform_get_input_snd_device(void *platform, audio_devices_t out_d } else if (in_device & AUDIO_DEVICE_IN_WIRED_HEADSET) { snd_device = SND_DEVICE_IN_HEADSET_MIC_FLUENCE; } set_echo_reference(adev, true); platform_set_echo_reference(adev->platform, true); } else if (adev->active_input->enable_aec) { if (in_device & AUDIO_DEVICE_IN_BACK_MIC) { if (my_data->fluence_type & FLUENCE_DUAL_MIC && Loading @@ -1753,7 +1767,7 @@ snd_device_t platform_get_input_snd_device(void *platform, audio_devices_t out_d } else if (in_device & AUDIO_DEVICE_IN_WIRED_HEADSET) { snd_device = SND_DEVICE_IN_HEADSET_MIC_FLUENCE; } set_echo_reference(adev, true); platform_set_echo_reference(adev->platform, true); } else if (adev->active_input->enable_ns) { if (in_device & AUDIO_DEVICE_IN_BACK_MIC) { if (my_data->fluence_type & FLUENCE_DUAL_MIC && Loading @@ -1772,9 +1786,9 @@ snd_device_t platform_get_input_snd_device(void *platform, audio_devices_t out_d } else if (in_device & AUDIO_DEVICE_IN_WIRED_HEADSET) { snd_device = SND_DEVICE_IN_HEADSET_MIC_FLUENCE; } set_echo_reference(adev, false); platform_set_echo_reference(adev->platform, false); } else set_echo_reference(adev, false); platform_set_echo_reference(adev->platform, false); } } else if (source == AUDIO_SOURCE_MIC) { if (in_device & AUDIO_DEVICE_IN_BUILTIN_MIC && Loading @@ -1782,7 +1796,7 @@ snd_device_t platform_get_input_snd_device(void *platform, audio_devices_t out_d if(my_data->fluence_type & FLUENCE_DUAL_MIC && my_data->fluence_in_audio_rec) { snd_device = SND_DEVICE_IN_HANDSET_DMIC; set_echo_reference(adev, true); platform_set_echo_reference(adev->platform, true); } } } else if (source == AUDIO_SOURCE_FM_RX || Loading