diff options
author | Simon Wilson <simonwilson@google.com> | 2011-09-27 13:39:53 -0700 |
---|---|---|
committer | Simon Wilson <simonwilson@google.com> | 2011-09-30 17:57:46 -0700 |
commit | d2dbaf991e3f6b730624b7dfc9ce3cda8101b8d7 (patch) | |
tree | 42a615dc89d9c206de0afff69a1a9e1db832f8bc /audio/audio_hw.c | |
parent | 196758539e06c7476ca4083e193d52a52929a1cd (diff) | |
download | device_samsung_tuna-d2dbaf991e3f6b730624b7dfc9ce3cda8101b8d7.zip device_samsung_tuna-d2dbaf991e3f6b730624b7dfc9ce3cda8101b8d7.tar.gz device_samsung_tuna-d2dbaf991e3f6b730624b7dfc9ce3cda8101b8d7.tar.bz2 |
audio: support wideband call audio
Some networks support wideband AMR for voice calls. To support
this, implement a callback that the RIL uses to set the
wideband config.
Change-Id: Ifa75ff189cc300728f560b77fd4fb3f1798e776d
Diffstat (limited to 'audio/audio_hw.c')
-rwxr-xr-x[-rw-r--r--] | audio/audio_hw.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/audio/audio_hw.c b/audio/audio_hw.c index 40f5df3..48947cb 100644..100755 --- a/audio/audio_hw.c +++ b/audio/audio_hw.c @@ -119,6 +119,8 @@ #define MM_FULL_POWER_SAMPLING_RATE 48000 /* sampling rate when using VX port for narrow band */ #define VX_NB_SAMPLING_RATE 8000 +/* sampling rate when using VX port for wide band */ +#define VX_WB_SAMPLING_RATE 16000 /* conversions from dB to ABE and codec gains */ #define DB_TO_ABE_GAIN(x) ((x) + MIXER_ABE_GAIN_0DB) @@ -445,6 +447,7 @@ struct tuna_audio_device { bool bluetooth_nrec; bool headphone_volume_europe; bool earpiece_volume_toro; + int wb_amr; /* RIL */ struct ril_handle ril; @@ -568,6 +571,8 @@ static int start_call(struct tuna_audio_device *adev) { LOGE("Opening modem PCMs"); + pcm_config_vx.rate = adev->wb_amr ? VX_WB_SAMPLING_RATE : VX_NB_SAMPLING_RATE; + /* Open modem PCM channels */ if (adev->pcm_modem_dl == NULL) { adev->pcm_modem_dl = pcm_open(0, PORT_MODEM, PCM_OUT, &pcm_config_vx); @@ -612,6 +617,18 @@ static void end_call(struct tuna_audio_device *adev) adev->pcm_modem_ul = NULL; } +void audio_set_wb_amr_callback(void *data, int enable) +{ + struct tuna_audio_device *adev = (struct tuna_audio_device *)data; + adev->wb_amr = enable; + + /* reopen the modem PCMs at the new rate */ + if (adev->in_call) { + end_call(adev); + start_call(adev); + } +} + static void set_incall_device(struct tuna_audio_device *adev) { int device_type; @@ -2407,10 +2424,13 @@ static int adev_open(const hw_module_t* module, const char* name, adev->headphone_volume_europe = is_product_yakju(); adev->earpiece_volume_toro = is_device_toro(); adev->bluetooth_nrec = true; + adev->wb_amr = 0; /* RIL */ ril_open(&adev->ril); pthread_mutex_unlock(&adev->lock); + /* register callback for wideband AMR setting */ + ril_register_set_wb_amr_callback(audio_set_wb_amr_callback, (void *)adev); *device = &adev->hw_device.common; |