From 24c130f97ba94521eba78cd9097ce429a8e13a6d Mon Sep 17 00:00:00 2001 From: Dheeraj CVR Date: Wed, 17 Jun 2015 00:45:04 +0200 Subject: audio: forward call mute to RIL client interface Change-Id: Ifd0c6d3bf271a49f9e938514c79e3ec3a1e6d92c --- audio/audio_hw.c | 3 +++ audio/ril_interface.c | 12 +++++++++++- audio/ril_interface.h | 5 +++++ 3 files changed, 19 insertions(+), 1 deletion(-) (limited to 'audio') diff --git a/audio/audio_hw.c b/audio/audio_hw.c index c80da45..fff00d7 100644 --- a/audio/audio_hw.c +++ b/audio/audio_hw.c @@ -2661,6 +2661,9 @@ static int adev_set_mic_mute(struct audio_hw_device *dev, bool state) { struct espresso_audio_device *adev = (struct espresso_audio_device *)dev; + if (adev->mode == AUDIO_MODE_IN_CALL) + ril_set_mic_mute(&adev->ril, state); + adev->mic_mute = state; return 0; diff --git a/audio/ril_interface.c b/audio/ril_interface.c index a77efc0..c6f359c 100644 --- a/audio/ril_interface.c +++ b/audio/ril_interface.c @@ -38,6 +38,7 @@ 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_set_mic_mute)(void *, enum ril_mic_mute); int (*_ril_register_unsolicited_handler)(void *, int, void *); int (*_ril_get_wb_amr)(void *, void *); @@ -108,6 +109,7 @@ int ril_open(struct ril_handle *ril) _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_set_mic_mute = dlsym(ril->handle, "SetMute"); _ril_register_unsolicited_handler = dlsym(ril->handle, "RegisterUnsolicitedHandler"); /* since this function is not supported in all RILs, don't require it */ @@ -116,7 +118,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_two_mic_control || !_ril_set_call_clock_sync || - !_ril_register_unsolicited_handler) { + !_ril_register_unsolicited_handler || !_ril_set_mic_mute) { ALOGE("Cannot get symbols from '%s'", RIL_CLIENT_LIBPATH); dlclose(ril->handle); return -1; @@ -191,3 +193,11 @@ int ril_set_two_mic_control(struct ril_handle *ril, enum ril_two_mic_device devi return _ril_set_two_mic_control(ril->client, device, state); } + +int ril_set_mic_mute(struct ril_handle *ril, enum ril_mic_mute state) +{ + if (ril_connect_if_required(ril)) + return 0; + + return _ril_set_mic_mute(ril->client, state); +} diff --git a/audio/ril_interface.h b/audio/ril_interface.h index 4b401aa..7950eb9 100644 --- a/audio/ril_interface.h +++ b/audio/ril_interface.h @@ -70,6 +70,11 @@ enum ril_two_mic_state { TWO_MIC_SOLUTION_ON }; +enum ril_mic_mute { + MIC_UNMUTE, + MIC_MUTE +}; + /* Function prototypes */ int ril_open(struct ril_handle *ril); int ril_close(struct ril_handle *ril); -- cgit v1.1