summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornebkat <nebkat@gmail.com>2012-11-23 10:59:44 -0800
committerGerrit Code Review <gerrit@review.cyanogenmod.com>2012-11-23 10:59:44 -0800
commit9ae78a7905c83a155a697557d350386872ca9a3d (patch)
treee9a28283c622d511f05ab8868ee746cbc003e08b
parent7b28422186360c4539c773a99e4ab4d187f7c8d0 (diff)
parent08927522e3f0da2075a1ab430e94ac5500826397 (diff)
downloaddevice_samsung_n7100-9ae78a7905c83a155a697557d350386872ca9a3d.tar.gz
device_samsung_n7100-9ae78a7905c83a155a697557d350386872ca9a3d.tar.bz2
device_samsung_n7100-9ae78a7905c83a155a697557d350386872ca9a3d.zip
Merge "Audio updates" into jellybean
-rw-r--r--[-rwxr-xr-x]audio/audio_hw.c15
-rw-r--r--audio/audio_hw.h48
-rw-r--r--[-rwxr-xr-x]audio/ril_interface.c12
-rw-r--r--[-rwxr-xr-x]audio/ril_interface.h11
-rw-r--r--overlay/packages/apps/Phone/res/values/config.xml25
5 files changed, 97 insertions, 14 deletions
diff --git a/audio/audio_hw.c b/audio/audio_hw.c
index 42c6122..e0e306c 100755..100644
--- a/audio/audio_hw.c
+++ b/audio/audio_hw.c
@@ -2504,6 +2504,21 @@ static int adev_set_parameters(struct audio_hw_device *dev, const char *kvpairs)
adev->screen_off = true;
}
+ ret = str_parms_get_str(parms, "noise_suppression", value, sizeof(value));
+ if (ret >= 0) {
+ if (strcmp(value, "true") == 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);
+ }
+ }
+
str_parms_destroy(parms);
return ret;
}
diff --git a/audio/audio_hw.h b/audio/audio_hw.h
index 2791a87..ba9b9d1 100644
--- a/audio/audio_hw.h
+++ b/audio/audio_hw.h
@@ -146,10 +146,10 @@ struct route_setting voicecall_default_disable[] = {
struct route_setting default_input[] = {
{ .ctl_name = "Main Mic Switch", .intval = 1, },
{ .ctl_name = "MainMicBias Mode", .intval = 1, },
- { .ctl_name = "IN2L Volume", .intval = 30, },
+ { .ctl_name = "IN2L Volume", .intval = 28, },
{ .ctl_name = "MIXINL IN2L Switch", .intval = 1, },
- { .ctl_name = "MIXINL IN2L Volume", .intval = 1, },
- { .ctl_name = "AIF1ADC1 HPF Mode", .intval = 0, },
+ { .ctl_name = "MIXINL IN2L Volume", .intval = 0, },
+ { .ctl_name = "AIF1ADC1 HPF Mode", .intval = 1, },
{ .ctl_name = "AIF1ADC1 HPF Switch", .intval = 1, },
{ .ctl_name = NULL, },
};
@@ -157,17 +157,35 @@ struct route_setting default_input[] = {
struct route_setting default_input_disable[] = {
{ .ctl_name = "Main Mic Switch", .intval = 0, },
{ .ctl_name = "MainMicBias Mode", .intval = 0, },
- { .ctl_name = "IN2L Volume", .intval = 22, },
+ { .ctl_name = "IN2L Volume", .intval = 4, },
{ .ctl_name = "MIXINL IN2L Switch", .intval = 0, },
+ { .ctl_name = "MIXINL IN2L Volume", .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 = NULL, },
+};
+
struct route_setting headset_input[] = {
{ .ctl_name = "MIXINL IN2L Switch", .intval = 0, },
{ .ctl_name = "MIXINR IN1R Switch", .intval = 0, },
{ .ctl_name = "Headset Mic Switch", .intval = 1, },
- { .ctl_name = "IN1L Volume", .intval = 18, },
+ { .ctl_name = "IN1L Volume", .intval = 24, },
{ .ctl_name = "MIXINL IN1L Switch", .intval = 1, },
{ .ctl_name = "MIXINL IN1L Volume", .intval = 0, },
{ .ctl_name = "AIF1ADC1 HPF Mode", .intval = 1, },
@@ -180,7 +198,9 @@ struct route_setting headset_input[] = {
struct route_setting headset_input_disable[] = {
{ .ctl_name = "Headset Mic Switch", .intval = 0, },
+ { .ctl_name = "IN1L Volume", .intval = 11, },
{ .ctl_name = "MIXINL IN1L Switch", .intval = 0, },
+ { .ctl_name = "MIXINL IN1L Volume", .intval = 0, },
{ .ctl_name = "AIF1ADC1 HPF Mode", .intval = 0, },
{ .ctl_name = "AIF1ADC1 HPF Switch", .intval = 0, },
{ .ctl_name = NULL, },
@@ -192,19 +212,18 @@ struct route_setting bt_output[] = {
{ .ctl_name = "AIF3ADC Mux", .intval = 1, },
{ .ctl_name = "AIF2DAC2L Mixer AIF1.1 Switch", .intval = 1, },
{ .ctl_name = "AIF2DAC2R Mixer AIF1.1 Switch", .intval = 1, },
- { .ctl_name = "AIF2DAC Volume", .intval = 96, },
+ { .ctl_name = "AIF1DAC1 Volume", .intval = 96, },
{ .ctl_name = "DAC2 Volume", .intval = 96, },
{ .ctl_name = "AIF2ADC Volume", .intval = 96, },
- { .ctl_name = "Speaker Mixer Volume", .intval = 1, },
+ { .ctl_name = "AIF2DAC Volume", .intval = 96, },
{ .ctl_name = "MIXINL IN2L Volume", .intval = 1, },
{ .ctl_name = "IN1L Volume", .intval = 25, },
{ .ctl_name = "IN1R Volume", .intval = 25, },
- { .ctl_name = "Speaker Boost Volume", .intval = 4, },
+ { .ctl_name = "AIF1 Boost Volume", .intval = 0, },
{ .ctl_name = "LINEOUT1N Switch", .intval = 0, },
{ .ctl_name = "LINEOUT1P Switch", .intval = 0, },
- { .ctl_name = "AIF2DACR Source", .intval = 0, },
{ .ctl_name = "AIF1ADC1 HPF Switch", .intval = 0, },
- { .ctl_name = "AIF2ADC HPF Mode", .intval = 1, },
+ { .ctl_name = "AIF2ADC HPF Mode", .intval = 3, },
{ .ctl_name = "AIF2ADC HPF Switch", .intval = 1, },
{ .ctl_name = "AIF2DAC Mux", .strval = "AIF2DACDAT", },
{ .ctl_name = "AIF2DAC2R Mixer AIF2 Switch", .intval = 1, },
@@ -216,8 +235,6 @@ struct route_setting bt_input[] = {
{ .ctl_name = "AIF2ADC Mux", .intval = 1, },
{ .ctl_name = "AIF1ADCL Source", .intval = 0, },
{ .ctl_name = "AIF1ADCR Source", .intval = 1, },
- { .ctl_name = "AIF2ADCL Source", .intval = 0, },
- { .ctl_name = "AIF2ADCR Source", .intval = 1, },
{ .ctl_name = "DAC1L Mixer AIF2 Switch", .intval = 1, },
{ .ctl_name = "DAC1R Mixer AIF2 Switch", .intval = 1, },
{ .ctl_name = "AIF1ADC1R Mixer AIF2 Switch", .intval = 1, },
@@ -238,5 +255,10 @@ struct route_setting bt_disable[] = {
{ .ctl_name = "AIF2DAC2L Mixer AIF2 Switch", .intval = 0, },
{ .ctl_name = "AIF1ADC1R Mixer AIF2 Switch", .intval = 0, },
{ .ctl_name = "AIF1ADC1L Mixer AIF2 Switch", .intval = 0, },
+ { .ctl_name = "AIF1DAC1 Volume", .intval = 96, },
+ { .ctl_name = "AIF1 Boost Volume", .intval = 0, },
+ { .ctl_name = "DAC2 Volume", .intval = 96, },
+ { .ctl_name = "AIF2DAC Volume", .intval = 96, },
+ { .ctl_name = "AIF2ADC Volume", .intval = 96, },
{ .ctl_name = NULL, },
-};
+}; \ No newline at end of file
diff --git a/audio/ril_interface.c b/audio/ril_interface.c
index 89a0aef..a77efc0 100755..100644
--- a/audio/ril_interface.c
+++ b/audio/ril_interface.c
@@ -37,6 +37,7 @@ int (*_ril_disconnect)(void *);
int (*_ril_set_call_volume)(void *, enum ril_sound_type, int);
int (*_ril_set_call_audio_path)(void *, enum ril_audio_path);
int (*_ril_set_call_clock_sync)(void *, enum ril_clock_state);
+int (*_ril_set_two_mic_control)(void *, enum ril_two_mic_device, enum ril_two_mic_state);
int (*_ril_register_unsolicited_handler)(void *, int, void *);
int (*_ril_get_wb_amr)(void *, void *);
@@ -106,6 +107,7 @@ int ril_open(struct ril_handle *ril)
_ril_set_call_volume = dlsym(ril->handle, "SetCallVolume");
_ril_set_call_audio_path = dlsym(ril->handle, "SetCallAudioPath");
_ril_set_call_clock_sync = dlsym(ril->handle, "SetCallClockSync");
+ _ril_set_two_mic_control = dlsym(ril->handle, "SetTwoMicControl");
_ril_register_unsolicited_handler = dlsym(ril->handle,
"RegisterUnsolicitedHandler");
/* since this function is not supported in all RILs, don't require it */
@@ -113,7 +115,7 @@ int ril_open(struct ril_handle *ril)
if (!_ril_open_client || !_ril_close_client || !_ril_connect ||
!_ril_is_connected || !_ril_disconnect || !_ril_set_call_volume ||
- !_ril_set_call_audio_path || !_ril_set_call_clock_sync ||
+ !_ril_set_call_audio_path || !_ril_set_two_mic_control || !_ril_set_call_clock_sync ||
!_ril_register_unsolicited_handler) {
ALOGE("Cannot get symbols from '%s'", RIL_CLIENT_LIBPATH);
dlclose(ril->handle);
@@ -181,3 +183,11 @@ int ril_set_call_clock_sync(struct ril_handle *ril, enum ril_clock_state state)
return _ril_set_call_clock_sync(ril->client, state);
}
+
+int ril_set_two_mic_control(struct ril_handle *ril, enum ril_two_mic_device device, enum ril_two_mic_state state)
+{
+ if (ril_connect_if_required(ril))
+ return 0;
+
+ return _ril_set_two_mic_control(ril->client, device, state);
+}
diff --git a/audio/ril_interface.h b/audio/ril_interface.h
index 676772c..4b401aa 100755..100644
--- a/audio/ril_interface.h
+++ b/audio/ril_interface.h
@@ -60,6 +60,16 @@ enum ril_clock_state {
SOUND_CLOCK_START
};
+enum ril_two_mic_device {
+ AUDIENCE,
+ FORTEMEDIA
+};
+
+enum ril_two_mic_state {
+ TWO_MIC_SOLUTION_OFF,
+ TWO_MIC_SOLUTION_ON
+};
+
/* Function prototypes */
int ril_open(struct ril_handle *ril);
int ril_close(struct ril_handle *ril);
@@ -68,5 +78,6 @@ int ril_set_call_volume(struct ril_handle *ril, enum ril_sound_type sound_type,
int ril_set_call_audio_path(struct ril_handle *ril, enum ril_audio_path path);
int ril_set_call_clock_sync(struct ril_handle *ril, enum ril_clock_state state);
void ril_register_set_wb_amr_callback(void *function, void *data);
+int ril_set_two_mic_control(struct ril_handle *ril, enum ril_two_mic_device device, enum ril_two_mic_state state);
#endif
diff --git a/overlay/packages/apps/Phone/res/values/config.xml b/overlay/packages/apps/Phone/res/values/config.xml
new file mode 100644
index 0000000..23ec4e4
--- /dev/null
+++ b/overlay/packages/apps/Phone/res/values/config.xml
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2009 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<!-- Phone app resources that may need to be customized
+ for different hardware or product builds. -->
+<resources>
+ <!-- Determines if device implements a noise suppression device for in call audio-->
+ <bool name="has_in_call_noise_suppression">true</bool>
+
+ <!-- Audio parameter for setting noise suppression-->
+ <string name="in_call_noise_suppression_audioparameter">noise_suppression=true=false</string>
+</resources>