diff options
author | Sudheer Papothi <spapothi@codeaurora.org> | 2018-05-15 00:41:52 +0530 |
---|---|---|
committer | Sudheer Papothi <spapothi@codeaurora.org> | 2018-07-03 00:49:36 +0530 |
commit | d63caef737f833bbf118298b9501475a1d55b35c (patch) | |
tree | 2b3e601b245d3067d1cbede1819116ff8ce7bdf3 /hal/audio_extn/audio_extn.c | |
parent | d90940c9d26256763b6d965c0ae3588c33d4a55f (diff) | |
download | hardware_qcom_audio-d63caef737f833bbf118298b9501475a1d55b35c.tar.gz hardware_qcom_audio-d63caef737f833bbf118298b9501475a1d55b35c.tar.bz2 hardware_qcom_audio-d63caef737f833bbf118298b9501475a1d55b35c.zip |
hal: audio_extn: Add support to control AANC noise level
Add support to control AANC(Adaptive Active Noise Cancellation) noise
level from user interface.
Change-Id: Ib7dfe94e95e098e02da13eeeeeca9e3b30d68c46
Diffstat (limited to 'hal/audio_extn/audio_extn.c')
-rwxr-xr-x | hal/audio_extn/audio_extn.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/hal/audio_extn/audio_extn.c b/hal/audio_extn/audio_extn.c index 28aa23a4..5b388a85 100755 --- a/hal/audio_extn/audio_extn.c +++ b/hal/audio_extn/audio_extn.c @@ -80,6 +80,7 @@ struct audio_extn_module { static struct audio_extn_module aextnmod; +#define AUDIO_PARAMETER_KEY_AANC_NOISE_LEVEL "aanc_noise_level" #define AUDIO_PARAMETER_KEY_ANC "anc_enabled" #define AUDIO_PARAMETER_KEY_WFD "wfd_channel_cap" #define AUDIO_PARAMETER_CAN_OPEN_PROXY "can_open_proxy" @@ -467,6 +468,26 @@ bool audio_extn_should_use_fb_anc(void) return false; } +void audio_extn_set_aanc_noise_level(struct audio_device *adev, + struct str_parms *parms) +{ + int ret; + char value[32] = {0}; + struct mixer_ctl *ctl = NULL; + const char *mixer_ctl_name = "AANC Noise Level"; + + ret = str_parms_get_str(parms, AUDIO_PARAMETER_KEY_AANC_NOISE_LEVEL, value, + sizeof(value)); + if (ret >= 0) { + ctl = mixer_get_ctl_by_name(adev->mixer, mixer_ctl_name); + if (ctl) + mixer_ctl_set_value(ctl, 0, atoi(value)); + else + ALOGW("%s: Not able to get mixer ctl: %s", + __func__, mixer_ctl_name); + } +} + void audio_extn_set_anc_parameters(struct audio_device *adev, struct str_parms *parms) { @@ -816,6 +837,7 @@ void audio_extn_init(struct audio_device *adev) void audio_extn_set_parameters(struct audio_device *adev, struct str_parms *parms) { + audio_extn_set_aanc_noise_level(adev, parms); audio_extn_set_anc_parameters(adev, parms); audio_extn_set_fluence_parameters(adev, parms); audio_extn_set_afe_proxy_parameters(adev, parms); |