From c8f47b317431f0f2353d44da6482212044a05371 Mon Sep 17 00:00:00 2001 From: "keunhui.park" Date: Mon, 13 Jul 2015 10:57:37 +0900 Subject: audio: set voice call volume step by property Bug: 22469108 Change-Id: I6999a2d0da1296deef252fdfb6a7c7e7df642dd9 --- hal/msm8974/platform.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/hal/msm8974/platform.c b/hal/msm8974/platform.c index 03aa5967..23a122aa 100644 --- a/hal/msm8974/platform.c +++ b/hal/msm8974/platform.c @@ -62,6 +62,9 @@ #define DEFAULT_APP_TYPE_RX_PATH 0x11130 +#define TOSTRING_(x) #x +#define TOSTRING(x) TOSTRING_(x) + struct audio_block_header { int reserved; @@ -104,6 +107,7 @@ struct platform_data { char ec_ref_mixer_path[64]; char *snd_card_name; + int max_vol_index; }; static int pcm_device_table[AUDIO_USECASE_MAX][2] = { @@ -850,6 +854,10 @@ void *platform_init(struct audio_device *adev) goto init_failed; } + //set max volume step for voice call + property_get("ro.config.vc_call_vol_steps", value, TOSTRING(MAX_VOL_INDEX)); + my_data->max_vol_index = atoi(value); + my_data->dualmic_config = DUALMIC_CONFIG_NONE; my_data->fluence_in_spkr_mode = false; my_data->fluence_in_voice_call = false; @@ -1317,7 +1325,7 @@ int platform_set_voice_volume(void *platform, int volume) // Voice volume levels are mapped to adsp volume levels as follows. // 100 -> 5, 80 -> 4, 60 -> 3, 40 -> 2, 20 -> 1 0 -> 0 // But this values don't changed in kernel. So, below change is need. - vol_index = (int)percent_to_index(volume, MIN_VOL_INDEX, MAX_VOL_INDEX); + vol_index = (int)percent_to_index(volume, MIN_VOL_INDEX, my_data->max_vol_index); set_values[0] = vol_index; ctl = mixer_get_ctl_by_name(adev->mixer, mixer_ctl_name); -- cgit v1.2.3 From a2981bac4344d124b1448b0d0673c220805cfd13 Mon Sep 17 00:00:00 2001 From: Ravi Kumar Alamanda Date: Thu, 24 Sep 2015 19:17:26 -0700 Subject: hal: Fix EC not working with some VoIP app Echo reference must be before starting input stream. But in some cases, input stream is started first and then the output stream. As the primary output is not started, echo reference is set based on AUDIO_DEVICE_NONE. Fix by using primary output's device even if it is in standby. Bug: 23720819 Change-Id: I1cf2b93ea52219489964e09ee671ef008e81255c --- hal/audio_hw.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/hal/audio_hw.c b/hal/audio_hw.c index 3b8d6e08..d44eeb45 100644 --- a/hal/audio_hw.c +++ b/hal/audio_hw.c @@ -649,12 +649,13 @@ int select_devices(struct audio_device *adev, out_snd_device = SND_DEVICE_NONE; if (in_snd_device == SND_DEVICE_NONE) { audio_devices_t out_device = AUDIO_DEVICE_NONE; - if (adev->active_input->source == AUDIO_SOURCE_VOICE_COMMUNICATION && - adev->primary_output && !adev->primary_output->standby) { - out_device = adev->primary_output->devices; + if (adev->active_input->source == AUDIO_SOURCE_VOICE_COMMUNICATION) { platform_set_echo_reference(adev, false, AUDIO_DEVICE_NONE); - } else if (usecase->id == USECASE_AUDIO_RECORD_AFE_PROXY) { - out_device = AUDIO_DEVICE_OUT_TELEPHONY_TX; + if (usecase->id == USECASE_AUDIO_RECORD_AFE_PROXY) { + out_device = AUDIO_DEVICE_OUT_TELEPHONY_TX; + } else if (adev->primary_output) { + out_device = adev->primary_output->devices; + } } in_snd_device = platform_get_input_snd_device(adev->platform, out_device); } -- cgit v1.2.3 From 94f93563a6c015f306d1a0c14c5af85cb079aa72 Mon Sep 17 00:00:00 2001 From: Jean-Michel Trivi Date: Fri, 25 Sep 2015 15:06:53 -0700 Subject: Add support for voice recognition on headset use case Add sound device for voice recognition headset mic. Map it by default to same ACDB as headset mic. Use it when sound source is VOICE_RECOGNITION and the input audio device is AUDIO_DEVICE_IN_WIRED_HEADSET. Bug 22504877 Change-Id: I7ebd9ed0f805c6c6941ba9ddfa3aa7ad0587effb --- hal/msm8974/platform.c | 5 +++++ hal/msm8974/platform.h | 1 + 2 files changed, 6 insertions(+) diff --git a/hal/msm8974/platform.c b/hal/msm8974/platform.c index a753c0f1..66da2498 100644 --- a/hal/msm8974/platform.c +++ b/hal/msm8974/platform.c @@ -246,6 +246,7 @@ static const char * const device_table[SND_DEVICE_MAX] = { [SND_DEVICE_IN_VOICE_REC_MIC_NS] = "voice-rec-mic", [SND_DEVICE_IN_VOICE_REC_DMIC_STEREO] = "voice-rec-dmic-ef", [SND_DEVICE_IN_VOICE_REC_DMIC_FLUENCE] = "voice-rec-dmic-ef-fluence", + [SND_DEVICE_IN_VOICE_REC_HEADSET_MIC] = "headset-mic", [SND_DEVICE_IN_VOICE_RX] = "voice-rx", @@ -329,6 +330,7 @@ static int acdb_device_table[SND_DEVICE_MAX] = { [SND_DEVICE_IN_VOICE_REC_MIC_NS] = 113, [SND_DEVICE_IN_VOICE_REC_DMIC_STEREO] = 35, [SND_DEVICE_IN_VOICE_REC_DMIC_FLUENCE] = 43, + [SND_DEVICE_IN_VOICE_REC_HEADSET_MIC] = 8, [SND_DEVICE_IN_VOICE_RX] = 44, @@ -419,6 +421,7 @@ static const struct name_to_index snd_device_name_index[SND_DEVICE_MAX] = { {TO_NAME_INDEX(SND_DEVICE_IN_VOICE_REC_MIC_NS)}, {TO_NAME_INDEX(SND_DEVICE_IN_VOICE_REC_DMIC_STEREO)}, {TO_NAME_INDEX(SND_DEVICE_IN_VOICE_REC_DMIC_FLUENCE)}, + {TO_NAME_INDEX(SND_DEVICE_IN_VOICE_REC_HEADSET_MIC)}, {TO_NAME_INDEX(SND_DEVICE_IN_THREE_MIC)}, {TO_NAME_INDEX(SND_DEVICE_IN_QUAD_MIC)}, @@ -1934,6 +1937,8 @@ snd_device_t platform_get_input_snd_device(void *platform, audio_devices_t out_d else snd_device = SND_DEVICE_IN_VOICE_REC_MIC; } + } else if (in_device & AUDIO_DEVICE_IN_WIRED_HEADSET) { + snd_device = SND_DEVICE_IN_VOICE_REC_HEADSET_MIC; } } else if (source == AUDIO_SOURCE_VOICE_COMMUNICATION) { if (out_device & (AUDIO_DEVICE_OUT_SPEAKER | AUDIO_DEVICE_OUT_SPEAKER_SAFE)) diff --git a/hal/msm8974/platform.h b/hal/msm8974/platform.h index c1f901ca..4b4332e0 100644 --- a/hal/msm8974/platform.h +++ b/hal/msm8974/platform.h @@ -128,6 +128,7 @@ enum { SND_DEVICE_IN_VOICE_REC_MIC_NS, SND_DEVICE_IN_VOICE_REC_DMIC_STEREO, SND_DEVICE_IN_VOICE_REC_DMIC_FLUENCE, + SND_DEVICE_IN_VOICE_REC_HEADSET_MIC, SND_DEVICE_IN_VOICE_RX, -- cgit v1.2.3