From 253ad107567d81f9eef355d3a34578c6eeb11536 Mon Sep 17 00:00:00 2001 From: Kunlei Zhang Date: Wed, 14 Oct 2020 16:21:28 +0800 Subject: [PATCH] hal: disable volume boost if device is not supported during call During call,if volume boost is enabled in handset,then insert headset, the volume boost still is active. This causes headset volume cannot adjust. Fix it by disable volume boost if the device is not supported. Change-Id: I650778a0d5190ec3551151a32f4d56bbe561bc18 --- hal/audio_hw.c | 1 + hal/msm8974/platform.c | 18 ++++++++++++++++++ hal/platform_api.h | 1 + 3 files changed, 20 insertions(+) diff --git a/hal/audio_hw.c b/hal/audio_hw.c index f441d3b2..1032b883 100644 --- a/hal/audio_hw.c +++ b/hal/audio_hw.c @@ -4975,6 +4975,7 @@ int route_output_stream(struct stream_out *out, ret = voice_start_call(adev); } } else { + platform_is_volume_boost_supported_device(adev->platform, &new_devices); adev->current_call_output = out; voice_update_devices_for_all_voice_usecases(adev); } diff --git a/hal/msm8974/platform.c b/hal/msm8974/platform.c index 526a88f3..d0332a5b 100644 --- a/hal/msm8974/platform.c +++ b/hal/msm8974/platform.c @@ -5573,6 +5573,24 @@ int platform_switch_voice_call_enable_device_config(void *platform, return ret; } +void platform_is_volume_boost_supported_device(void *platform, + struct listnode *devices) +{ + struct platform_data *my_data = (struct platform_data *)platform; + + if (my_data->voice_feature_set && + !(compare_device_type(devices, + AUDIO_DEVICE_OUT_SPEAKER)) && + !(compare_device_type(devices, + AUDIO_DEVICE_OUT_EARPIECE)) && + !(my_data->adev->voice.tty_mode == TTY_MODE_HCO)) { + if(!my_data->acdb_reload_vocvoltable(VOICE_FEATURE_SET_DEFAULT)) { + my_data->voice_feature_set = 0; + ALOGD("%s: Unsupported volume boost device", __func__); + } + } +} + int platform_switch_voice_call_device_post(void *platform, snd_device_t out_snd_device, snd_device_t in_snd_device) diff --git a/hal/platform_api.h b/hal/platform_api.h index f68d6e7a..dc271cc2 100644 --- a/hal/platform_api.h +++ b/hal/platform_api.h @@ -433,4 +433,5 @@ int platform_set_power_mode_on_device(struct audio_device* adev, snd_device_t sn int platform_set_island_cfg_on_device(struct audio_device* adev, snd_device_t snd_device, bool enable); void platform_reset_island_power_status(void *platform, snd_device_t snd_device); +void platform_is_volume_boost_supported_device(void *platform, struct listnode *devices); #endif // AUDIO_PLATFORM_API_H