From 2778a86eb13bf85b0818dcaf75fccb6a0846d12f Mon Sep 17 00:00:00 2001 From: Dheeraj CVR Date: Sat, 2 Aug 2014 11:04:57 +0530 Subject: audio: fix noise supression and update mixer ctls Change-Id: I5b76be2d7d5d9754974295fce81b26498ccee391 --- audio/audio_hw.c | 63 ------------------------------------- audio/audio_hw.h | 77 ++++++++++++++++++++++----------------------- configs/tiny_hw.xml | 76 +++++++++++++++++++------------------------- overlay/packages/apps/Phone | 1 + 4 files changed, 70 insertions(+), 147 deletions(-) create mode 100644 overlay/packages/apps/Phone diff --git a/audio/audio_hw.c b/audio/audio_hw.c index e33a1b3..e32acf0 100644 --- a/audio/audio_hw.c +++ b/audio/audio_hw.c @@ -103,7 +103,6 @@ struct m0_audio_device { struct m0_stream_in *active_input; struct m0_stream_out *outputs[OUTPUT_TOTAL]; bool mic_mute; - int tty_mode; struct echo_reference_itfe *echo_reference; bool bluetooth_nrec; int wb_amr; @@ -532,15 +531,6 @@ static void set_incall_device(struct m0_audio_device *adev) ril_set_call_audio_path(&adev->ril, device_type); } -static void set_input_volumes(struct m0_audio_device *adev, int main_mic_on, - int headset_mic_on, int sub_mic_on) -{ -} - -static void set_output_volumes(struct m0_audio_device *adev, bool tty_volume) -{ -} - static void force_all_standby(struct m0_audio_device *adev) { struct m0_stream_in *in; @@ -624,7 +614,6 @@ static void select_output_device(struct m0_audio_device *adev) int speaker_on; int earpiece_on; int bt_on; - bool tty_volume = false; unsigned int channel; headset_on = adev->out_device & AUDIO_DEVICE_OUT_WIRED_HEADSET; @@ -671,29 +660,6 @@ static void select_output_device(struct m0_audio_device *adev) set_eq_filter(adev); if (adev->mode == AUDIO_MODE_IN_CALL) { - if (!bt_on) { - /* force tx path according to TTY mode when in call */ - switch(adev->tty_mode) { - case TTY_MODE_FULL: - case TTY_MODE_HCO: - /* tx path from headset mic */ - headphone_on = 0; - headset_on = 1; - speaker_on = 0; - earpiece_on = 0; - break; - case TTY_MODE_VCO: - /* tx path from device sub mic */ - headphone_on = 0; - headset_on = 0; - speaker_on = 1; - earpiece_on = 0; - break; - case TTY_MODE_OFF: - default: - break; - } - } if (headset_on || headphone_on || speaker_on || earpiece_on) { ALOGD("%s: set voicecall route: voicecall_default", __func__); @@ -2559,30 +2525,6 @@ static int adev_set_parameters(struct audio_hw_device *dev, const char *kvpairs) int ret; parms = str_parms_create_str(kvpairs); - ret = str_parms_get_str(parms, AUDIO_PARAMETER_KEY_TTY_MODE, value, sizeof(value)); - if (ret >= 0) { - int tty_mode; - - if (strcmp(value, AUDIO_PARAMETER_VALUE_TTY_OFF) == 0) - tty_mode = TTY_MODE_OFF; - else if (strcmp(value, AUDIO_PARAMETER_VALUE_TTY_VCO) == 0) - tty_mode = TTY_MODE_VCO; - else if (strcmp(value, AUDIO_PARAMETER_VALUE_TTY_HCO) == 0) - tty_mode = TTY_MODE_HCO; - else if (strcmp(value, AUDIO_PARAMETER_VALUE_TTY_FULL) == 0) - tty_mode = TTY_MODE_FULL; - else - return -EINVAL; - - pthread_mutex_lock(&adev->lock); - if (tty_mode != adev->tty_mode) { - adev->tty_mode = tty_mode; - if (adev->mode == AUDIO_MODE_IN_CALL) - select_output_device(adev); - } - pthread_mutex_unlock(&adev->lock); - } - ret = str_parms_get_str(parms, AUDIO_PARAMETER_KEY_BT_NREC, value, sizeof(value)); if (ret >= 0) { if (strcmp(value, AUDIO_PARAMETER_VALUE_ON) == 0) @@ -2604,13 +2546,9 @@ static int adev_set_parameters(struct audio_hw_device *dev, const char *kvpairs) if (strcmp(value, "on") == 0) { ALOGE("%s: enabling two mic control", __func__); ril_set_two_mic_control(&adev->ril, AUDIENCE, TWO_MIC_SOLUTION_ON); - /* sub mic */ - 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_bigroute_by_array(adev->mixer, noise_suppression_disable, 1); } } @@ -3102,7 +3040,6 @@ static int adev_open(const hw_module_t* module, const char* name, adev->pcm_bt_dl = NULL; adev->pcm_bt_ul = NULL; adev->voice_volume = 1.0f; - adev->tty_mode = TTY_MODE_OFF; adev->bluetooth_nrec = true; adev->wb_amr = 0; diff --git a/audio/audio_hw.h b/audio/audio_hw.h index ae7905e..33930a7 100644 --- a/audio/audio_hw.h +++ b/audio/audio_hw.h @@ -97,13 +97,6 @@ enum output_type { OUTPUT_TOTAL }; -enum tty_modes { - TTY_MODE_OFF, - TTY_MODE_VCO, - TTY_MODE_HCO, - TTY_MODE_FULL -}; - struct mixer_ctls { struct mixer_ctl *mixinl_in1l_volume; @@ -118,6 +111,11 @@ struct route_setting }; struct route_setting voicecall_default[] = { + { .ctl_name = "DAC1L Mixer AIF1.1 Switch", .intval = 1, }, + { .ctl_name = "DAC1R Mixer AIF1.1 Switch", .intval = 1, }, + { .ctl_name = "AIF2ADCL DRC Switch", .intval = 0, }, + { .ctl_name = "AIF2DACL Source", .intval = 0, }, + { .ctl_name = "AIF2DACR Source", .intval = 0, }, { .ctl_name = "AIF2 Mode", .intval = 0, }, { .ctl_name = "DAC1L Mixer AIF1.1 Switch", .intval = 1, }, { .ctl_name = "DAC1R Mixer AIF1.1 Switch", .intval = 1, }, @@ -128,72 +126,71 @@ struct route_setting voicecall_default[] = { }; struct route_setting voicecall_default_disable[] = { - { .ctl_name = "AIF2 Mode", .intval = 0, }, { .ctl_name = "DAC1L Mixer AIF2 Switch", .intval = 0, }, { .ctl_name = "DAC1R Mixer AIF2 Switch", .intval = 0, }, { .ctl_name = "AIF2DAC Mux", .strval = "AIF3DACDAT", }, - { .ctl_name = "Main Mic Switch", .intval = 0, }, - { .ctl_name = "MIXINL IN1L Switch", .intval = 0, }, - { .ctl_name = "Sub Mic Switch", .intval = 0, }, - { .ctl_name = "MIXINR IN1R Switch", .intval = 0, }, + { .ctl_name = "AIF2 Mode", .intval = 1, }, { .ctl_name = NULL, }, }; struct route_setting default_input[] = { { .ctl_name = "Main Mic Switch", .intval = 1, }, - { .ctl_name = "IN1L Volume", .intval = 28, }, + { .ctl_name = "AIF1ADCL Source", .intval = 0, }, + { .ctl_name = "AIF2ADCL Source", .intval = 0, }, { .ctl_name = "MIXINL IN1L Switch", .intval = 1, }, + { .ctl_name = "Sub Mic Switch", .intval = 1, }, + { .ctl_name = "AIF1ADCR Source", .intval = 1, }, + { .ctl_name = "AIF2ADCR Source", .intval = 1, }, + { .ctl_name = "MIXINR IN1R Switch", .intval = 1, }, + { .ctl_name = "IN1L Volume", .intval = 25, }, { .ctl_name = "MIXINL IN1L Volume", .intval = 0, }, - { .ctl_name = "AIF1ADC1 HPF Mode", .intval = 0, }, - { .ctl_name = "AIF1ADC1 HPF Switch", .intval = 1, }, + { .ctl_name = "DAC2 Left Sidetone Volume", .intval = 12, }, + { .ctl_name = "DAC2 Right Sidetone Volume", .intval = 12, }, + { .ctl_name = "AIF2ADC Volume", .intval = 96, }, + { .ctl_name = "AIF2ADCL DRC Switch", .intval = 0, }, { .ctl_name = NULL, }, }; struct route_setting default_input_disable[] = { { .ctl_name = "Main Mic Switch", .intval = 0, }, - { .ctl_name = "IN1L Volume", .intval = 4, }, { .ctl_name = "MIXINL IN1L Switch", .intval = 0, }, - { .ctl_name = "AIF1ADC1 HPF Switch", .intval = 0, }, - { .ctl_name = NULL, }, -}; - -struct route_setting noise_suppression[] = { - { .ctl_name = "Sub Mic Switch", .intval = 1, }, - { .ctl_name = "IN1R Volume", .intval = 25, }, - { .ctl_name = "MIXINR IN1R Switch", .intval = 1, }, - { .ctl_name = "MIXINR IN1R Volume", .intval = 0, }, - { .ctl_name = "AIF1ADCR Source", .intval = 1, }, - { .ctl_name = NULL, }, -}; - -struct route_setting noise_suppression_disable[] = { { .ctl_name = "Sub Mic Switch", .intval = 0, }, - { .ctl_name = "IN1R Volume", .intval = 7, }, { .ctl_name = "MIXINR IN1R Switch", .intval = 0, }, - { .ctl_name = "MIXINR IN1R Volume", .intval = 0, }, + { .ctl_name = "AIF2DACL Source", .intval = 0, }, + { .ctl_name = "AIF2DACR Source", .intval = 1, }, { .ctl_name = NULL, }, }; struct route_setting headset_input[] = { + { .ctl_name = "AIF2DAC2L Mixer AIF2 Switch", .intval = 0, }, + { .ctl_name = "AIF2DAC2R Mixer AIF2 Switch", .intval = 0, }, + { .ctl_name = "Headphone ZC Switch", .intval = 0, }, + { .ctl_name = "AIF1DAC1 Volume", .intval = 96, }, + { .ctl_name = "AIF2DAC Volume", .intval = 96, }, + { .ctl_name = "AIF1 Boost Volume", .intval = 0, }, + { .ctl_name = "AIF2 Boost Volume", .intval = 0, }, + { .ctl_name = "DAC1 Volume", .intval = 96, }, + { .ctl_name = "Headphone Volume", .intval = 49, }, { .ctl_name = "MIXINL IN1L Switch", .intval = 0, }, { .ctl_name = "MIXINR IN1R Switch", .intval = 0, }, { .ctl_name = "Headset Mic Switch", .intval = 1, }, - { .ctl_name = "IN2L Volume", .intval = 18, }, - { .ctl_name = "MIXINL IN2L Switch", .intval = 1, }, - { .ctl_name = "MIXINL IN2L Volume", .intval = 0, }, - { .ctl_name = "AIF1ADC1 HPF Mode", .intval = 1, }, - { .ctl_name = "AIF1ADC1 HPF Switch", .intval = 1, }, - { .ctl_name = "AIF1ADC1 Volume", .intval = 96, }, { .ctl_name = "AIF1ADCL Source", .intval = 0, }, { .ctl_name = "AIF1ADCR Source", .intval = 0, }, + { .ctl_name = "AIF2ADCL Source", .intval = 0, }, + { .ctl_name = "MIXINL IN2L Switch", .intval = 1, }, + { .ctl_name = "IN2L Volume", .intval = 28, }, + { .ctl_name = "MIXINL IN2L Volume", .intval = 0, }, + { .ctl_name = "DAC2 Left Sidetone Volume", .intval = 12, }, + { .ctl_name = "AIF2ADC Volume", .intval = 96, }, + { .ctl_name = "AIF2ADCL DRC Switch", .intval = 0, }, { .ctl_name = NULL, }, }; struct route_setting headset_input_disable[] = { { .ctl_name = "Headset Mic Switch", .intval = 0, }, { .ctl_name = "MIXINL IN2L Switch", .intval = 0, }, - { .ctl_name = "AIF1ADC1 HPF Mode", .intval = 0, }, - { .ctl_name = "AIF1ADC1 HPF Switch", .intval = 0, }, + { .ctl_name = "AIF2DACL Source", .intval = 0, }, + { .ctl_name = "AIF2DACR Source", .intval = 1, }, { .ctl_name = NULL, }, }; diff --git a/configs/tiny_hw.xml b/configs/tiny_hw.xml index 91cea7d..8ffa698 100644 --- a/configs/tiny_hw.xml +++ b/configs/tiny_hw.xml @@ -120,6 +120,14 @@ We are able to have most of our routing static so do that + + + + + + + + @@ -132,49 +140,34 @@ We are able to have most of our routing static so do that - + - - - - - - - - - - - - + - - + + + + + + - - - - - - - - @@ -187,16 +180,9 @@ We are able to have most of our routing static so do that - - - - - - - @@ -267,19 +253,20 @@ We are able to have most of our routing static so do that - + - - + + + + + - - @@ -302,24 +289,25 @@ We are able to have most of our routing static so do that + - + + + + + + + + - + - - - - - - - diff --git a/overlay/packages/apps/Phone b/overlay/packages/apps/Phone new file mode 100644 index 0000000..0f8d39e --- /dev/null +++ b/overlay/packages/apps/Phone @@ -0,0 +1 @@ +../services/Telephony/ \ No newline at end of file -- cgit v1.1