aboutsummaryrefslogtreecommitdiffstats
path: root/audio
diff options
context:
space:
mode:
authorDaniel Hillenbrand <codeworkx@cyanogenmod.org>2013-04-15 17:08:25 +0200
committerDaniel Hillenbrand <codeworkx@cyanogenmod.org>2015-01-01 13:46:39 +0000
commit8f3930a5c7533aa6232a83797084c5ee9e58cfda (patch)
tree57e8228a5c10d7ffc0508dd07abca1e9bd2b0796 /audio
parentb8a47d5eaccdbc685183077f0ff99865d3280d87 (diff)
downloaddevice_samsung_espresso3g-8f3930a5c7533aa6232a83797084c5ee9e58cfda.zip
device_samsung_espresso3g-8f3930a5c7533aa6232a83797084c5ee9e58cfda.tar.gz
device_samsung_espresso3g-8f3930a5c7533aa6232a83797084c5ee9e58cfda.tar.bz2
p5100: add incall noise suppression support
Update for CM11: Fix Phone overlay that is now a service, also Update Audio parameter for setting noise suppression - thanks to @kumajaya Change-Id: I8cba9a1b5b98d2bb3accbd8f32ff5cdc4b5e568d
Diffstat (limited to 'audio')
-rwxr-xr-xaudio/audio_hw.c18
-rw-r--r--audio/audio_hw.h16
-rwxr-xr-xaudio/ril_interface.c12
-rwxr-xr-xaudio/ril_interface.h11
4 files changed, 55 insertions, 2 deletions
diff --git a/audio/audio_hw.c b/audio/audio_hw.c
index 9b92b59..8a14def 100755
--- a/audio/audio_hw.c
+++ b/audio/audio_hw.c
@@ -476,7 +476,7 @@ void audio_set_wb_amr_callback(void *data, int enable)
/* reopen the modem PCMs at the new rate */
if (adev->in_call) {
end_call(adev);
- set_eq_filter(adev);
+ select_output_device(adev);
start_call(adev);
}
}
@@ -2581,6 +2581,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, "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);
+ }
+ }
+
str_parms_destroy(parms);
return ret;
}
@@ -2805,6 +2820,7 @@ static const struct {
{ AUDIO_DEVICE_OUT_ALL_SCO, "sco-out" },
{ AUDIO_DEVICE_IN_BUILTIN_MIC, "builtin-mic" },
+ { AUDIO_DEVICE_IN_BACK_MIC, "back-mic" },
{ AUDIO_DEVICE_IN_WIRED_HEADSET, "headset-in" },
{ AUDIO_DEVICE_IN_ALL_SCO, "sco-in" },
};
diff --git a/audio/audio_hw.h b/audio/audio_hw.h
index 65a6443..70afc63 100644
--- a/audio/audio_hw.h
+++ b/audio/audio_hw.h
@@ -156,6 +156,22 @@ struct route_setting default_input_disable[] = {
{ .ctl_name = NULL, },
};
+struct route_setting noise_suppression[] = {
+ { .ctl_name = "Sub Mic Switch", .intval = 1, },
+ { .ctl_name = "AIF1ADCR Source", .intval = 1, },
+ { .ctl_name = "MIXINR IN2R Switch", .intval = 1, },
+ { .ctl_name = "IN2R Volume", .intval = 25, },
+ { .ctl_name = NULL, },
+};
+
+struct route_setting noise_suppression_disable[] = {
+ { .ctl_name = "Sub Mic Switch", .intval = 0, },
+ { .ctl_name = "AIF1ADCR Source", .intval = 0, },
+ { .ctl_name = "MIXINR IN2R Switch", .intval = 0, },
+ { .ctl_name = "IN2R Volume", .intval = 11, },
+ { .ctl_name = NULL, },
+};
+
struct route_setting headset_input[] = {
{ .ctl_name = "Headset Mic Switch", .intval = 1, },
{ .ctl_name = "MIXINR IN1R Switch", .intval = 1, },
diff --git a/audio/ril_interface.c b/audio/ril_interface.c
index 89a0aef..a77efc0 100755
--- 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
--- 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