summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--hal/audio_hw.c3
-rw-r--r--hal/msm8960/platform.c5
-rw-r--r--hal/msm8974/platform.c47
-rw-r--r--hal/platform_api.h3
4 files changed, 56 insertions, 2 deletions
diff --git a/hal/audio_hw.c b/hal/audio_hw.c
index c66f7ec8..7c017fd3 100644
--- a/hal/audio_hw.c
+++ b/hal/audio_hw.c
@@ -346,6 +346,7 @@ int enable_snd_device(struct audio_device *adev,
for (i = 0; i < num_devices; i++) {
enable_snd_device(adev, new_snd_devices[i]);
}
+ platform_set_speaker_gain_in_combo(adev, snd_device, true);
} else {
const char * dev_path = platform_get_snd_device_name(snd_device);
ALOGD("%s: snd_device(%d: %s)", __func__, snd_device, dev_path);
@@ -384,12 +385,14 @@ int disable_snd_device(struct audio_device *adev,
for (i = 0; i < num_devices; i++) {
disable_snd_device(adev, new_snd_devices[i]);
}
+ platform_set_speaker_gain_in_combo(adev, snd_device, false);
} else {
audio_route_reset_and_update_path(adev->audio_route, dev_path);
}
audio_extn_sound_trigger_update_device_status(snd_device,
ST_EVENT_SND_DEVICE_FREE);
}
+
return 0;
}
diff --git a/hal/msm8960/platform.c b/hal/msm8960/platform.c
index 06663a4a..c75efbe6 100644
--- a/hal/msm8960/platform.c
+++ b/hal/msm8960/platform.c
@@ -547,6 +547,11 @@ int platform_stop_voice_call(void *platform, uint32_t vsid __unused)
return ret;
}
+void platform_set_speaker_gain_in_combo(struct audio_device *adev __unused,
+ snd_device_t snd_device,
+ bool enable __unused) {
+}
+
int platform_set_voice_volume(void *platform, int volume)
{
struct platform_data *my_data = (struct platform_data *)platform;
diff --git a/hal/msm8974/platform.c b/hal/msm8974/platform.c
index 6a8da857..4958cb12 100644
--- a/hal/msm8974/platform.c
+++ b/hal/msm8974/platform.c
@@ -891,6 +891,7 @@ void *platform_init(struct audio_device *adev)
char value[PROPERTY_VALUE_MAX];
struct platform_data *my_data;
int retry_num = 0, snd_card_num = 0;
+ bool dual_mic_config = false;
const char *snd_card_name;
char *cvd_version = NULL;
@@ -955,6 +956,11 @@ void *platform_init(struct audio_device *adev)
property_get("ro.config.vc_call_vol_steps", value, TOSTRING(MAX_VOL_INDEX));
my_data->max_vol_index = atoi(value);
+ property_get("persist.audio.dualmic.config",value,"");
+ if (!strcmp("endfire", value)) {
+ dual_mic_config = true;
+ }
+
my_data->source_mic_type = SOURCE_DUAL_MIC;
my_data->fluence_in_spkr_mode = false;
@@ -962,10 +968,10 @@ void *platform_init(struct audio_device *adev)
my_data->fluence_in_voice_comm = false;
my_data->fluence_in_voice_rec = false;
- property_get("ro.qc.sdk.audio.fluencetype", value, "");
+ property_get("ro.qc.sdk.audio.fluencetype", value, "none");
if (!strcmp("fluencepro", value)) {
my_data->fluence_type = FLUENCE_PRO_ENABLE;
- } else if (!strcmp("fluence", value)) {
+ } else if (!strcmp("fluence", value) || (dual_mic_config)) {
my_data->fluence_type = FLUENCE_ENABLE;
} else if (!strcmp("none", value)) {
my_data->fluence_type = FLUENCE_DISABLE;
@@ -1491,6 +1497,43 @@ int platform_get_sample_rate(void *platform, uint32_t *rate)
return ret;
}
+void platform_set_speaker_gain_in_combo(struct audio_device *adev,
+ snd_device_t snd_device,
+ bool enable)
+{
+ const char* name;
+ switch (snd_device) {
+ case SND_DEVICE_OUT_SPEAKER_AND_HEADPHONES:
+ if (enable)
+ name = "spkr-gain-in-headphone-combo";
+ else
+ name = "speaker-gain-default";
+ break;
+ case SND_DEVICE_OUT_SPEAKER_AND_LINE:
+ if (enable)
+ name = "spkr-gain-in-line-combo";
+ else
+ name = "speaker-gain-default";
+ break;
+ case SND_DEVICE_OUT_SPEAKER_SAFE_AND_HEADPHONES:
+ if (enable)
+ name = "spkr-safe-gain-in-headphone-combo";
+ else
+ name = "speaker-safe-gain-default";
+ break;
+ case SND_DEVICE_OUT_SPEAKER_SAFE_AND_LINE:
+ if (enable)
+ name = "spkr-safe-gain-in-line-combo";
+ else
+ name = "speaker-safe-gain-default";
+ break;
+ default:
+ return;
+ }
+
+ audio_route_apply_and_update_path(adev->audio_route, name);
+}
+
int platform_set_voice_volume(void *platform, int volume)
{
struct platform_data *my_data = (struct platform_data *)platform;
diff --git a/hal/platform_api.h b/hal/platform_api.h
index 569577e4..1e413587 100644
--- a/hal/platform_api.h
+++ b/hal/platform_api.h
@@ -41,6 +41,9 @@ int platform_switch_voice_call_usecase_route_post(void *platform,
int platform_start_voice_call(void *platform, uint32_t vsid);
int platform_stop_voice_call(void *platform, uint32_t vsid);
int platform_set_voice_volume(void *platform, int volume);
+void platform_set_speaker_gain_in_combo(struct audio_device *adev,
+ snd_device_t snd_device,
+ bool enable);
int platform_set_mic_mute(void *platform, bool state);
int platform_get_sample_rate(void *platform, uint32_t *rate);
int platform_set_device_mute(void *platform, bool state, char *dir);