summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDheeraj CVR <cvr.dheeraj@gmail.com>2014-08-02 11:04:57 +0530
committerforkbomb <keepcalm444@gmail.com>2015-11-25 08:07:32 +1100
commit2778a86eb13bf85b0818dcaf75fccb6a0846d12f (patch)
tree436ab3ff1057c93934d18ed82facd762bdf03f43
parentc07fd11027cd1cb4e22facc1ed97e97e0a74765b (diff)
downloaddevice_samsung_i9300-2778a86eb13bf85b0818dcaf75fccb6a0846d12f.zip
device_samsung_i9300-2778a86eb13bf85b0818dcaf75fccb6a0846d12f.tar.gz
device_samsung_i9300-2778a86eb13bf85b0818dcaf75fccb6a0846d12f.tar.bz2
audio: fix noise supression and update mixer ctls
Change-Id: I5b76be2d7d5d9754974295fce81b26498ccee391
-rw-r--r--audio/audio_hw.c63
-rw-r--r--audio/audio_hw.h77
-rw-r--r--configs/tiny_hw.xml76
-rw-r--r--overlay/packages/apps/Phone1
4 files changed, 70 insertions, 147 deletions
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
<ctl name="Headset Mic Switch" val="0"/>
<ctl name="FM In Switch" val="0"/>
+ <!-- EQ Switches -->
+ <ctl name="AIF1DAC1 EQ Switch" val="1"/>
+ <ctl name="AIF1DAC1 EQ1 Volume" val="9"/>
+ <ctl name="AIF1DAC1 EQ2 Volume" val="7"/>
+ <ctl name="AIF1DAC1 EQ3 Volume" val="10"/>
+ <ctl name="AIF1DAC1 EQ4 Volume" val="13"/>
+ <ctl name="AIF1DAC1 EQ5 Volume" val="12"/>
+
</path>
<device name="speaker">
<path name="on">
@@ -132,49 +140,34 @@ We are able to have most of our routing static so do that
<ctl name="SPKL DAC1 Volume" val="1"/>
<ctl name="SPKR DAC1 Volume" val="1"/>
<ctl name="Speaker Mixer Volume" val="3"/>
- <ctl name="Speaker Boost Volume" val="6"/>
+ <ctl name="Speaker Boost Volume" val="4"/>
<ctl name="Speaker Volume" val="57"/>
- <ctl name="AIF1DAC1 EQ Switch" val="1"/>
- <ctl name="AIF1DAC1 EQ1 Volume" val="9"/>
- <ctl name="AIF1DAC1 EQ2 Volume" val="7"/>
- <ctl name="AIF1DAC1 EQ3 Volume" val="10"/>
- <ctl name="AIF1DAC1 EQ4 Volume" val="13"/>
- <ctl name="AIF1DAC1 EQ5 Volume" val="12"/>
</path>
<path name="off">
<ctl name="SPK Switch" val="0"/>
- <ctl name="AIF1DAC1 Volume" val="96"/>
- <ctl name="AIF1 Boost Volume" val="0"/>
- <ctl name="DAC1 Volume" val="96"/>
- <ctl name="SPKL DAC1 Volume" val="1"/>
- <ctl name="SPKR DAC1 Volume" val="1"/>
- <ctl name="Speaker Mixer Volume" val="0"/>
+ <ctl name="Speaker Mixer Volume" val="1"/>
<ctl name="Speaker Volume" val="0"/>
- <ctl name="Speaker Boost Volume" val="0"/>
- <ctl name="AIF1DAC1 EQ Switch" val="0"/>
</path>
</device>
<device name="earpiece">
<path name="on">
<ctl name="RCV Switch" val="1"/>
+ <ctl name="AIF2DAC2L Mixer AIF2 Switch" val="0"/>
+ <ctl name="AIF2DAC2R Mixer AIF2 Switch" val="0"/>
+ <ctl name="AIF2ADC HPF Mode" val="1"/>
+ <ctl name="AIF2ADC HPF Switch" val="1"/>
<ctl name="AIF1DAC1 Volume" val="96"/>
+ <ctl name="AIF2DAC Volume" val="96"/>
<ctl name="AIF1 Boost Volume" val="0"/>
+ <ctl name="AIF2 Boost Volume" val="0"/>
<ctl name="DAC1 Volume" val="96"/>
<ctl name="Left Output Mixer DAC Volume" val="7"/>
<ctl name="Right Output Mixer DAC Volume" val="7"/>
<ctl name="Output Volume" val="57"/>
<ctl name="Earpiece Volume" val="1"/>
- <ctl name="Speaker Mixer Volume" val="1"/>
</path>
<path name="off">
<ctl name="RCV Switch" val="0"/>
- <ctl name="AIF1DAC1 Volume" val="96"/>
- <ctl name="AIF1 Boost Volume" val="0"/>
- <ctl name="DAC1 Volume" val="96"/>
- <ctl name="Left Output Mixer DAC Volume" val="7"/>
- <ctl name="Right Output Mixer DAC Volume" val="7"/>
- <ctl name="Output Volume" val="57"/>
- <ctl name="Earpiece Volume" val="1"/>
</path>
</device>
<device name="headphone">
@@ -187,16 +180,9 @@ We are able to have most of our routing static so do that
<ctl name="DAC1 Volume" val="96"/>
<ctl name="Left Output Mixer DAC Volume" val="7"/>
<ctl name="Right Output Mixer DAC Volume" val="7"/>
- <ctl name="AIF1DAC1 EQ Switch" val="1"/>
- <ctl name="AIF1DAC1 EQ1 Volume" val="16"/>
- <ctl name="AIF1DAC1 EQ2 Volume" val="14"/>
- <ctl name="AIF1DAC1 EQ3 Volume" val="12"/>
- <ctl name="AIF1DAC1 EQ4 Volume" val="14"/>
- <ctl name="AIF1DAC1 EQ5 Volume" val="16"/>
</path>
<path name="off">
<ctl name="HP Switch" val="0"/>
- <ctl name="AIF1DAC1 EQ Switch" val="0"/>
</path>
</device>
<device name="sco-out">
@@ -267,19 +253,20 @@ We are able to have most of our routing static so do that
<device name="builtin-mic">
<path name="on">
<ctl name="Main Mic Switch" val="1"/>
- <ctl name="IN1L Volume" val="28"/>
+ <ctl name="IN1L Volume" val="13"/>
<ctl name="MIXINL IN1L Switch" val="1"/>
<ctl name="MIXINL IN1L Volume" val="1"/>
- <ctl name="AIF1ADCL Source" val="0"/>
- <ctl name="AIF1ADC1 HPF Mode" val="0"/>
+ <ctl name="AIF1ADCL Source" val="Left"/>
+ <ctl name="AIF1ADCR Source" val="Left"/>
+ <ctl name="AIF1ADC1L Mixer ADC/DMIC Switch" val="1"/>
+ <ctl name="AIF1ADC1R Mixer ADC/DMIC Switch" val="1"/>
+ <ctl name="AIF1ADC1 HPF Mode" val="1"/>
<ctl name="AIF1ADC1 HPF Switch" val="1"/>
<ctl name="AIF1ADC1 Volume" val="96"/>
</path>
<path name="off">
<ctl name="Main Mic Switch" val="0"/>
<ctl name="MIXINL IN1L Switch" val="0"/>
- <ctl name="MIXINL IN1L Volume" val="0"/>
- <ctl name="IN1L Volume" val="10"/>
</path>
</device>
<device name="back-mic">
@@ -302,24 +289,25 @@ We are able to have most of our routing static so do that
<device name="headset-in">
<path name="on">
<ctl name="MIXINL IN1L Switch" val="0"/>
+ <ctl name="MIXINR IN1R Switch" val="0"/>
<ctl name="Headset Mic Switch" val="1"/>
- <ctl name="IN2L Volume" val="22"/>
+ <ctl name="AIF1ADCL Source" val="0"/>
+ <ctl name="AIF1ADCR Source" val="0"/>
+ <ctl name="AIF2ADCL Source" val="0"/>
+ <ctl name="AIF1ADCL Source" val="Left"/>
+ <ctl name="AIF1ADCL Source" val="Right"/>
+ <ctl name="AIF1ADC1L Mixer ADC/DMIC Switch" val="1"/>
+ <ctl name="AIF1ADC1L Mixer ADC/DMIC Switch" val="1"/>
+ <ctl name="IN2L Volume" val="18"/>
<ctl name="MIXINL IN2L Switch" val="1"/>
- <ctl name="MIXINL IN2L Volume" val="1"/>
+ <ctl name="MIXINL IN2L Volume" val="0"/>
<ctl name="AIF1ADC1 HPF Mode" val="1"/>
<ctl name="AIF1ADC1 HPF Switch" val="1"/>
<ctl name="AIF1ADC1 Volume" val="96"/>
- <ctl name="AIF1ADCL Source" val="0"/>
- <ctl name="AIF1ADCR Source" val="0"/>
</path>
<path name="off">
<ctl name="Headset Mic Switch" val="0"/>
- <ctl name="IN2L Volume" val="10"/>
<ctl name="MIXINL IN2L Switch" val="0"/>
- <ctl name="MIXINL IN2L Volume" val="1"/>
- <ctl name="AIF1ADC1 HPF Mode" val="0"/>
- <ctl name="AIF1ADC1 HPF Switch" val="0"/>
- <ctl name="AIF1ADC1 Volume" val="96"/>
</path>
</device>
<device name="sco-in">
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