diff options
| author | Patrick Buckley <ptrck@blck.io> | 2015-03-29 23:44:39 -0700 |
|---|---|---|
| committer | Patrick Buckley <ptrck@blck.io> | 2015-03-29 23:44:39 -0700 |
| commit | e8ce32fc86b2498124855df223793a8acadef6fa (patch) | |
| tree | 0aa8c0c91b11132a19cc00b801e7bfb90e90160e | |
| parent | 981ca950436ca3f701767267e7cafd2aa2903731 (diff) | |
| parent | 5d8e07568ee80a0c561d5c20b894e16f8430773b (diff) | |
Merge pull request #4 from lssjbrolli/cm-12.0
audio work
| -rw-r--r-- | audio/Android.mk | 3 | ||||
| -rw-r--r-- | audio/audio_hw.c | 317 | ||||
| -rw-r--r-- | audio/eS325VoiceProcessing.cpp | 34 | ||||
| -rw-r--r-- | audio/mixer_paths.xml | 778 | ||||
| -rw-r--r-- | audio/ril_interface.c | 8 | ||||
| -rw-r--r-- | audio/ril_interface.h | 18 | ||||
| -rw-r--r-- | audio/routing.h | 126 | ||||
| -rw-r--r-- | configs/audio_policy.conf | 8 | ||||
| -rw-r--r-- | device.mk | 8 | ||||
| -rw-r--r-- | proprietary-files.txt | 18 | ||||
| -rw-r--r-- | ril/telephony/java/com/android/internal/telephony/KlimtLteRIL.java | 90 | ||||
| -rw-r--r-- | rootdir/Android.mk | 8 |
12 files changed, 832 insertions, 584 deletions
diff --git a/audio/Android.mk b/audio/Android.mk index 656d684..cb1ef46 100644 --- a/audio/Android.mk +++ b/audio/Android.mk @@ -25,6 +25,7 @@ LOCAL_SRC_FILES := audio_hw.c ril_interface.c LOCAL_C_INCLUDES += \ external/tinyalsa/include \ + hardware/samsung_slsi/exynos5/include \ $(call include-path-for, audio-effects) \ $(call include-path-for, audio-utils) \ $(call include-path-for, audio-route) @@ -41,7 +42,7 @@ include $(CLEAR_VARS) LOCAL_MODULE := libaudience_voicefx LOCAL_MODULE_TAGS := optional -LOCAL_SRC_FILES:= eS325VoiceProcessing.cpp +LOCAL_SRC_FILES := eS325VoiceProcessing.cpp LOCAL_C_INCLUDES += \ $(call include-path-for, audio-effects) diff --git a/audio/audio_hw.c b/audio/audio_hw.c index eabd243..40857ef 100644 --- a/audio/audio_hw.c +++ b/audio/audio_hw.c @@ -1,3 +1,4 @@ + /* * Copyright (C) 2011 The Android Open Source Project * Copyright (C) 2012 Wolfson Microelectronics plc @@ -26,7 +27,7 @@ #include <stdint.h> #include <stdlib.h> #include <sys/time.h> -#include <dlfcn.h> +#include <fcntl.h> #include <cutils/log.h> #include <cutils/properties.h> @@ -35,6 +36,9 @@ #include <hardware/audio.h> #include <hardware/hardware.h> +#include <linux/videodev2.h> +#include <videodev2_exynos_media.h> + #include <system/audio.h> #include <tinyalsa/asoundlib.h> @@ -134,6 +138,8 @@ struct audio_device { audio_devices_t out_device; audio_devices_t in_device; bool mic_mute; + bool volume_boost; + bool noise_suppression; struct audio_route *ar; audio_source_t input_source; int cur_route_id; /* current route ID: combination of input source @@ -237,56 +243,80 @@ static int get_output_device_id(audio_devices_t device) return OUT_DEVICE_NONE; if (popcount(device) == 2) { - if ((device == (AUDIO_DEVICE_OUT_SPEAKER | - AUDIO_DEVICE_OUT_WIRED_HEADSET)) || - (device == (AUDIO_DEVICE_OUT_SPEAKER | - AUDIO_DEVICE_OUT_WIRED_HEADPHONE))) - return OUT_DEVICE_SPEAKER_AND_HEADSET; - else if (device == (AUDIO_DEVICE_OUT_SPEAKER | - AUDIO_DEVICE_OUT_EARPIECE)) - return OUT_DEVICE_SPEAKER_AND_EARPIECE; - else - return OUT_DEVICE_NONE; + + switch (device) { + + case (AUDIO_DEVICE_OUT_SPEAKER | AUDIO_DEVICE_OUT_WIRED_HEADSET): + case (AUDIO_DEVICE_OUT_SPEAKER | AUDIO_DEVICE_OUT_WIRED_HEADPHONE): + return OUT_DEVICE_SPEAKER_AND_HEADSET; + + case (AUDIO_DEVICE_OUT_SPEAKER | AUDIO_DEVICE_OUT_EARPIECE): + return OUT_DEVICE_SPEAKER_AND_EARPIECE; + + default: + return OUT_DEVICE_NONE; + } + } if (popcount(device) != 1) return OUT_DEVICE_NONE; switch (device) { - case AUDIO_DEVICE_OUT_SPEAKER: - return OUT_DEVICE_SPEAKER; - case AUDIO_DEVICE_OUT_EARPIECE: - return OUT_DEVICE_EARPIECE; - case AUDIO_DEVICE_OUT_WIRED_HEADSET: - return OUT_DEVICE_HEADSET; - case AUDIO_DEVICE_OUT_WIRED_HEADPHONE: - return OUT_DEVICE_HEADPHONES; - case AUDIO_DEVICE_OUT_BLUETOOTH_SCO: - case AUDIO_DEVICE_OUT_BLUETOOTH_SCO_HEADSET: - case AUDIO_DEVICE_OUT_BLUETOOTH_SCO_CARKIT: - return OUT_DEVICE_BT_SCO; - default: - return OUT_DEVICE_NONE; + case AUDIO_DEVICE_OUT_SPEAKER: + return OUT_DEVICE_SPEAKER; + + case AUDIO_DEVICE_OUT_EARPIECE: + return OUT_DEVICE_EARPIECE; + + case AUDIO_DEVICE_OUT_WIRED_HEADSET: + return OUT_DEVICE_HEADSET; + + case AUDIO_DEVICE_OUT_WIRED_HEADPHONE: + return OUT_DEVICE_HEADPHONES; + + case AUDIO_DEVICE_OUT_BLUETOOTH_SCO: + case AUDIO_DEVICE_OUT_BLUETOOTH_SCO_HEADSET: + case AUDIO_DEVICE_OUT_BLUETOOTH_SCO_CARKIT: + return OUT_DEVICE_BT_SCO; + + default: + return OUT_DEVICE_NONE; } + } -static int get_input_source_id(audio_source_t source) +static int get_input_source_id(audio_source_t source, bool wb_amr) { + +ALOGV("BP1: source: %d , wb_amr: %d", + source, wb_amr); + switch (source) { - case AUDIO_SOURCE_DEFAULT: - return IN_SOURCE_NONE; - case AUDIO_SOURCE_MIC: - return IN_SOURCE_MIC; - case AUDIO_SOURCE_CAMCORDER: - return IN_SOURCE_CAMCORDER; - case AUDIO_SOURCE_VOICE_RECOGNITION: - return IN_SOURCE_VOICE_RECOGNITION; - case AUDIO_SOURCE_VOICE_COMMUNICATION: - return IN_SOURCE_VOICE_COMMUNICATION; - case AUDIO_SOURCE_VOICE_CALL: - return IN_SOURCE_VOICE_CALL; - default: - return IN_SOURCE_NONE; + + case AUDIO_SOURCE_DEFAULT: + return IN_SOURCE_NONE; + + case AUDIO_SOURCE_MIC: + return IN_SOURCE_MIC; + + case AUDIO_SOURCE_CAMCORDER: + return IN_SOURCE_CAMCORDER; + + case AUDIO_SOURCE_VOICE_RECOGNITION: + return IN_SOURCE_VOICE_RECOGNITION; + + case AUDIO_SOURCE_VOICE_COMMUNICATION: + return IN_SOURCE_VOICE_COMMUNICATION; + + case AUDIO_SOURCE_VOICE_CALL: + if (wb_amr) { + return IN_SOURCE_VOICE_CALL_WB; + } + return IN_SOURCE_VOICE_CALL; + + default: + return IN_SOURCE_NONE; } } @@ -298,10 +328,34 @@ static void adev_set_call_audio_path(struct audio_device *adev); * stream_out mutexes. */ +static int enable_hdmi_audio(int enable) +{ + int fd; + int ret; + struct v4l2_control ctrl; + + fd = open("/dev/video16", O_RDWR); + if (fd < 0) { + ALOGE("cannot open /dev/video16 (%d)", fd); + return -ENOSYS; + } + + ctrl.id = V4L2_CID_TV_ENABLE_HDMI_AUDIO; + ctrl.value = !!enable; + ret = ioctl(fd, VIDIOC_S_CTRL, &ctrl); + + if (ret < 0) + ALOGE("V4L2_CID_TV_ENABLE_HDMI_AUDIO ioctl error (%d)", errno); + + close(fd); + + return ret; +} + static void select_devices(struct audio_device *adev) { int output_device_id = get_output_device_id(adev->out_device); - int input_source_id = get_input_source_id(adev->input_source); + int input_source_id = get_input_source_id(adev->input_source, adev->wb_amr); const char *output_route = NULL; const char *input_route = NULL; int new_route_id; @@ -309,13 +363,15 @@ static void select_devices(struct audio_device *adev) audio_route_reset(adev->ar); + enable_hdmi_audio(adev->out_device & AUDIO_DEVICE_OUT_AUX_DIGITAL); + new_route_id = (1 << (input_source_id + OUT_DEVICE_CNT)) + (1 << output_device_id); if ((new_route_id == adev->cur_route_id) && (adev->es325_mode == adev->es325_new_mode)) return; adev->cur_route_id = new_route_id; adev->es325_mode = adev->es325_new_mode; - if (input_source_id != IN_SOURCE_NONE) { + if (input_source_id != IN_SOURCE_NONE || adev->in_call) { if (output_device_id != OUT_DEVICE_NONE) { input_route = route_configs[input_source_id][output_device_id]->input_route; @@ -325,21 +381,26 @@ static void select_devices(struct audio_device *adev) route_configs[input_source_id][output_device_id]->es325_preset[adev->es325_mode]; } else { switch(adev->in_device) { - case AUDIO_DEVICE_IN_WIRED_HEADSET & ~AUDIO_DEVICE_BIT_IN: - output_device_id = OUT_DEVICE_HEADSET; - break; - case AUDIO_DEVICE_IN_BLUETOOTH_SCO_HEADSET & ~AUDIO_DEVICE_BIT_IN: - output_device_id = OUT_DEVICE_BT_SCO; - break; - default: - output_device_id = OUT_DEVICE_SPEAKER; - break; + case AUDIO_DEVICE_IN_WIRED_HEADSET & ~AUDIO_DEVICE_BIT_IN: + output_device_id = OUT_DEVICE_HEADSET; + break; + case AUDIO_DEVICE_IN_BLUETOOTH_SCO_HEADSET & ~AUDIO_DEVICE_BIT_IN: + output_device_id = OUT_DEVICE_BT_SCO; + break; + default: + output_device_id = OUT_DEVICE_SPEAKER; + break; } input_route = route_configs[input_source_id][output_device_id]->input_route; new_es325_preset = route_configs[input_source_id][output_device_id]->es325_preset[adev->es325_mode]; } + // disable noise suppression when capturing front and back mic for voice recognition + if ((adev->input_source == AUDIO_SOURCE_VOICE_RECOGNITION) && + (adev->in_channel_mask == AUDIO_CHANNEL_IN_FRONT_BACK) && + !adev->in_call) + new_es325_preset = -1; } else { if (output_device_id != OUT_DEVICE_NONE) { output_route = @@ -367,6 +428,8 @@ static void select_devices(struct audio_device *adev) } + enable_hdmi_audio(adev->out_device & AUDIO_DEVICE_OUT_AUX_DIGITAL); + audio_route_update_mixer(adev->ar); adev_set_call_audio_path(adev); @@ -386,6 +449,9 @@ static void start_bt_sco(struct audio_device *adev) ALOGV("%s: Opening SCO PCMs", __func__); + //Remove this once WB_AMR audio rate switching works ! + adev->wb_amr = 1; + if (adev->wb_amr) sco_config = &pcm_config_sco_wide; else @@ -450,6 +516,9 @@ static int start_voice_call(struct audio_device *adev) ALOGV("%s: Opening voice PCMs", __func__); + //Remove this once WB_AMR audio rate switching works ! + adev->wb_amr = 1; + if (adev->wb_amr) voice_config = &pcm_config_voice_wide; else @@ -515,36 +584,42 @@ static void adev_set_wb_amr_callback(void *data, int enable) if (adev->wb_amr != enable) { adev->wb_amr = enable; + /* reopen the modem PCMs at the new rate */ - if (adev->in_call) { -#if 0 - /* TODO: set rate properly */ + //FIX ME. THIS DOESN'T WORK CORRECTLY YET, AUDIO IS MUTED VERY OFTEN WHEN SWITCHING RATE + /* if (adev->in_call) { end_voice_call(adev); select_devices(adev); start_voice_call(adev); -#endif } + */ } pthread_mutex_unlock(&adev->lock); } static void adev_set_call_audio_path(struct audio_device *adev) { + enum ril_audio_path device_type; switch(adev->out_device) { + case AUDIO_DEVICE_OUT_SPEAKER: device_type = SOUND_AUDIO_PATH_SPEAKER; break; + case AUDIO_DEVICE_OUT_EARPIECE: - device_type = SOUND_AUDIO_PATH_HANDSET; + device_type = SOUND_AUDIO_PATH_EARPIECE; break; + case AUDIO_DEVICE_OUT_WIRED_HEADSET: device_type = SOUND_AUDIO_PATH_HEADSET; break; + case AUDIO_DEVICE_OUT_WIRED_HEADPHONE: device_type = SOUND_AUDIO_PATH_HEADPHONE; break; + case AUDIO_DEVICE_OUT_BLUETOOTH_SCO: case AUDIO_DEVICE_OUT_BLUETOOTH_SCO_HEADSET: case AUDIO_DEVICE_OUT_BLUETOOTH_SCO_CARKIT: @@ -554,14 +629,17 @@ static void adev_set_call_audio_path(struct audio_device *adev) device_type = SOUND_AUDIO_PATH_BLUETOOTH_NO_NR; } break; + default: /* if output device isn't supported, use handset by default */ - device_type = SOUND_AUDIO_PATH_HANDSET; + device_type = SOUND_AUDIO_PATH_EARPIECE; break; } ALOGV("%s: ril_set_call_audio_path(%d)", __func__, device_type); - ril_set_call_audio_path(&adev->ril, device_type); + + /* TODO: Figure out which devices need EXTRA_VOLUME_PATH set */ + ril_set_call_audio_path(&adev->ril, device_type, EXTRA_VOLUME_PATH); } /* Helper functions */ @@ -718,7 +796,7 @@ static void release_buffer(struct resampler_buffer_provider *buffer_provider, static ssize_t read_frames(struct stream_in *in, void *buffer, ssize_t frames) { ssize_t frames_wr = 0; - size_t frame_size = audio_stream_frame_size(&in->stream.common); + size_t frame_size = audio_stream_in_frame_size(&in->stream.common); while (frames_wr < frames) { size_t frames_rd = frames - frames_wr; @@ -771,7 +849,7 @@ static size_t out_get_buffer_size(const struct audio_stream *stream) struct stream_out *out = (struct stream_out *)stream; return out->config.period_size * - audio_stream_frame_size((struct audio_stream *)stream); + audio_stream_out_frame_size((struct audio_stream *)stream); } static audio_channel_mask_t out_get_channels(const struct audio_stream *stream) @@ -915,6 +993,9 @@ static int out_set_parameters(struct audio_stream *stream, const char *kvpairs) static char * out_get_parameters(const struct audio_stream *stream, const char *keys) { + + ALOGV("%s: key: ", __func__, keys); + struct stream_out *out = (struct stream_out *)stream; struct str_parms *query = str_parms_create_str(keys); char *str; @@ -1002,7 +1083,7 @@ exit: pthread_mutex_unlock(&out->lock); if (ret != 0) { - usleep(bytes * 1000000 / audio_stream_frame_size(&stream->common) / + usleep(bytes * 1000000 / audio_stream_out_frame_size(&stream->common) / out_get_sample_rate(&stream->common)); } @@ -1210,7 +1291,7 @@ static ssize_t in_read(struct audio_stream_in *stream, void* buffer, int ret = 0; struct stream_in *in = (struct stream_in *)stream; struct audio_device *adev = in->dev; - size_t frames_rq = bytes / audio_stream_frame_size(&stream->common); + size_t frames_rq = bytes / audio_stream_in_frame_size(&stream->common); /* * acquiring hw device mutex systematically is useful if a low @@ -1250,7 +1331,7 @@ static ssize_t in_read(struct audio_stream_in *stream, void* buffer, exit: if (ret < 0) - usleep(bytes * 1000000 / audio_stream_frame_size(&stream->common) / + usleep(bytes * 1000000 / audio_stream_in_frame_size(&stream->common) / in_get_sample_rate(&stream->common)); pthread_mutex_unlock(&in->lock); @@ -1305,7 +1386,8 @@ static int adev_open_output_stream(struct audio_hw_device *dev, audio_devices_t devices, audio_output_flags_t flags, struct audio_config *config, - struct audio_stream_out **stream_out) + struct audio_stream_out **stream_out, + const char *address __unused) { struct audio_device *adev = (struct audio_device *)dev; struct stream_out *out; @@ -1396,8 +1478,46 @@ static void adev_close_output_stream(struct audio_hw_device *dev, free(stream); } +static int adev_set_voice_volume(struct audio_hw_device *dev, float volume) +{ + struct audio_device *adev = (struct audio_device *)dev; + + adev->voice_volume = volume; + + if (adev->mode == AUDIO_MODE_IN_CALL) { + enum ril_sound_type sound_type; + + switch (adev->out_device) { + + case AUDIO_DEVICE_OUT_SPEAKER: + sound_type = SOUND_TYPE_SPEAKER; + break; + + case AUDIO_DEVICE_OUT_WIRED_HEADSET: + case AUDIO_DEVICE_OUT_WIRED_HEADPHONE: + sound_type = SOUND_TYPE_HEADSET; + break; + + case AUDIO_DEVICE_OUT_BLUETOOTH_SCO: + case AUDIO_DEVICE_OUT_ALL_SCO: + sound_type = SOUND_TYPE_BTVOICE; + break; + + default: + sound_type = SOUND_TYPE_VOICE; + } + + ril_set_call_volume(&adev->ril, sound_type, volume); + } + + return 0; +} + static int adev_set_parameters(struct audio_hw_device *dev, const char *kvpairs) { + + ALOGV("%s: kvpairs: %s", __func__, kvpairs); + struct audio_device *adev = (struct audio_device *)dev; struct str_parms *parms; char *str; @@ -1405,6 +1525,22 @@ static int adev_set_parameters(struct audio_hw_device *dev, const char *kvpairs) int ret; parms = str_parms_create_str(kvpairs); + + + ALOGV("%s: adev->voice_volume: %f", __func__, adev->voice_volume); + + if (strcmp(kvpairs, "volume_boost=on") == 0) { + // increase voice call volume + adev->volume_boost = true; + return adev_set_voice_volume(&adev->hw_device, 1.0f); + } + + if (strcmp(kvpairs, "volume_boost=off") == 0) { + // set original call volume + adev->volume_boost = false; + return adev_set_voice_volume(&adev->hw_device, 0.7f); + } + #if 0 ret = str_parms_get_str(parms, AUDIO_PARAMETER_KEY_TTY_MODE, value, sizeof(value)); if (ret >= 0) { @@ -1441,10 +1577,12 @@ static int adev_set_parameters(struct audio_hw_device *dev, const char *kvpairs) ret = str_parms_get_str(parms, "noise_suppression", value, sizeof(value)); if (ret >= 0) { - if (strcmp(value, "true") == 0) { + if (strcmp(value, "on") == 0) { ALOGV("%s: enabling two mic control", __func__); + adev->noise_suppression = true; ril_set_two_mic_control(&adev->ril, AUDIENCE, TWO_MIC_SOLUTION_ON); } else { + adev->noise_suppression = false; ALOGV("%s: disabling two mic control", __func__); ril_set_two_mic_control(&adev->ril, AUDIENCE, TWO_MIC_SOLUTION_OFF); } @@ -1457,23 +1595,33 @@ static int adev_set_parameters(struct audio_hw_device *dev, const char *kvpairs) static char * adev_get_parameters(const struct audio_hw_device *dev, const char *keys) { - return strdup(""); -} - -static int adev_init_check(const struct audio_hw_device *dev) -{ - return 0; -} -static int adev_set_voice_volume(struct audio_hw_device *dev, float volume) -{ struct audio_device *adev = (struct audio_device *)dev; - adev->voice_volume = volume; + ALOGV("%s: key: %s", __func__, keys); + + if (strcmp(keys, "volume_boost") == 0) { + if (adev->volume_boost) { + return strdup("volume_boost=on"); + } else { + return strdup("volume_boost=off"); + } + } + + if (strcmp(keys, "noise_suppression") == 0) { + if (adev->noise_suppression) { + return strdup("noise_suppression=on"); + } else { + return strdup("noise_suppression=off"); + } + + } - if (adev->mode == AUDIO_MODE_IN_CALL) - ril_set_call_volume(&adev->ril, SOUND_TYPE_VOICE, volume); + return strdup(""); +} +static int adev_init_check(const struct audio_hw_device *dev) +{ return 0; } @@ -1558,7 +1706,10 @@ static int adev_open_input_stream(struct audio_hw_device *dev, audio_io_handle_t handle, audio_devices_t devices, struct audio_config *config, - struct audio_stream_in **stream_in) + struct audio_stream_in **stream_in, + audio_input_flags_t flags, + const char *address __unused, + audio_source_t source __unused) { struct audio_device *adev = (struct audio_device *)dev; struct stream_in *in; @@ -1566,8 +1717,8 @@ static int adev_open_input_stream(struct audio_hw_device *dev, *stream_in = NULL; - /* Respond with a request for stereo if a different format is given. */ - if (config->channel_mask != AUDIO_CHANNEL_IN_STEREO) { + /* Respond with a request for stereo if a different format is given. */ + if (config->channel_mask != AUDIO_CHANNEL_IN_STEREO) { config->channel_mask = AUDIO_CHANNEL_IN_STEREO; return -EINVAL; } @@ -1602,7 +1753,7 @@ static int adev_open_input_stream(struct audio_hw_device *dev, in->channel_mask = config->channel_mask; in->buffer = malloc(pcm_config_in.period_size * pcm_config_in.channels - * audio_stream_frame_size(&in->stream.common)); + * audio_stream_in_frame_size(&in->stream.common)); if (!in->buffer) { ret = -ENOMEM; goto err_malloc; @@ -1719,7 +1870,7 @@ static int adev_open(const hw_module_t* module, const char* name, adev->es325_mode = ES325_MODE_LEVEL; adev->mode = AUDIO_MODE_NORMAL; - adev->voice_volume = 1.0f; + adev->voice_volume = 0.7f; /* RIL */ ril_open(&adev->ril); @@ -1741,7 +1892,7 @@ struct audio_module HAL_MODULE_INFO_SYM = { .module_api_version = AUDIO_MODULE_API_VERSION_0_1, .hal_api_version = HARDWARE_HAL_API_VERSION, .id = AUDIO_HARDWARE_MODULE_ID, - .name = "JA audio HW HAL", + .name = "KlimtLTE audio HW HAL", .author = "The CyanogenMod Project", .methods = &hal_module_methods, }, diff --git a/audio/eS325VoiceProcessing.cpp b/audio/eS325VoiceProcessing.cpp index 6e93820..424ac4c 100644 --- a/audio/eS325VoiceProcessing.cpp +++ b/audio/eS325VoiceProcessing.cpp @@ -1061,13 +1061,13 @@ int adnc_get_descriptor(const effect_uuid_t *uuid, effect_descriptor_t *pDescrip } audio_effect_library_t AUDIO_EFFECT_LIBRARY_INFO_SYM = { - tag : AUDIO_EFFECT_LIBRARY_TAG, - version : EFFECT_LIBRARY_API_VERSION, - name : "Audience Voice Preprocessing Library", - implementor : "The Android Open Source Project", - create_effect : adnc_create, - release_effect : adnc_release, - get_descriptor : adnc_get_descriptor + .tag = AUDIO_EFFECT_LIBRARY_TAG, + .version = EFFECT_LIBRARY_API_VERSION, + .name = "Audience Voice Preprocessing Library", + .implementor = "The Android Open Source Project", + .create_effect = adnc_create, + .release_effect = adnc_release, + .get_descriptor = adnc_get_descriptor }; //------------------------------------------------------- @@ -1283,17 +1283,21 @@ int Adnc_ApplySettingsFromSessionContextInt_l(adnc_pfx_session_t * session) status = Adnc_SetNoiseSuppressionInt_l(ns_on /*ns_on*/); // AEC - if ((session->createdMsk & (1 << PFX_ID_AEC)) /* the effect has been created */ - && (session->activeMsk & (1 << PFX_ID_AEC))) /* the effect is active */ - { - Adnc_SetEchoCancellationInt_l(true /*aec_on*/); + if (session->createdMsk & (1 << PFX_ID_AEC)) { /* the effect has been created */ + const bool aec_on = ((session->activeMsk & (1 << PFX_ID_AEC)) != 0); + int aec_status = Adnc_SetEchoCancellationInt_l(aec_on /*aec_on*/); + if (status == 0) { + status = aec_status; + } } // AGC - if ((session->createdMsk & (1 << PFX_ID_AGC)) /* the effect has been created */ - && (session->activeMsk & (1 << PFX_ID_AGC))) /* the effect is active */ - { - Adnc_SetAutomaticGainControlInt_l(true /*agc_on*/); + if (session->createdMsk & (1 << PFX_ID_AGC)) { /* the effect has been created */ + const bool agc_on = ((session->activeMsk & (1 << PFX_ID_AGC)) != 0); + int agc_status = Adnc_SetAutomaticGainControlInt_l(agc_on /*agc_on*/); + if (status == 0) { + status = agc_status; + } } return status; diff --git a/audio/mixer_paths.xml b/audio/mixer_paths.xml index 3402ebf..ea1f6b9 100644 --- a/audio/mixer_paths.xml +++ b/audio/mixer_paths.xml @@ -1,10 +1,10 @@ <mixer> <!-- INOUT_MAP { - <ctl name="Earpiece", "Builtin Mic" /> - <ctl name="Speaker", "Builtin Mic" /> + <ctl name="Earpiece", "Builtin Mic", "Third Mic"/> + <ctl name="Speaker", "Back Mic", "Third Mic" /> <ctl name="Headset Out", "Headset In" /> - <ctl name="Headphone", "Builtin Mic" /> + <ctl name="Headphone", "Builtin Mic", "Third Mic" /> <ctl name="SCO Headset Out", "SCO Headset In" /> <ctl name="SCO", "SCO Headset In" /> <ctl name="SCO Carkit", "SCO Headset In" /> @@ -15,393 +15,395 @@ INPUT_CHANNEL_MAP { <ctl name="Back Mic", "Right" /> <ctl name="Headset In", "Left" /> <ctl name="Third Mic", "Left" /> - <ctl name="SCO Headset In", value="None" /> + <ctl name="SCO Headset In" value="None" /> } --> - <!-- Initial mixer settings --> - - <!-- Noise gate control --> - <ctl name="Noise Gate Switch" value="0" /> - <ctl name="HPOUT1L NG HPOUT1L Switch" value="0" /> - <ctl name="HPOUT1R NG HPOUT1R Switch" value="0" /> - <ctl name="HPOUT2L NG HPOUT2L Switch" value="0" /> - <ctl name="HPOUT2R NG HPOUT2R Switch" value="0" /> - <ctl name="EPOUT NG EPOUT Switch" value="0" /> - <ctl name="SPKOUTL NG SPKOUTL Switch" value="0" /> - <ctl name="SPKOUTR NG SPKOUTR Switch" value="0" /> - <ctl name="SPKDAT1L NG SPKDAT1L Switch" value="0" /> - <ctl name="SPKDAT1R NG SPKDAT1R Switch" value="0" /> - <ctl name="Noise Gate Threshold Volume" value="3" /> - - <!-- Analog output AMP --> - <!-- AP Side is mixed to Input 1 of each out mixer --> - <!-- RCV(Mono) --> - <ctl name="EPOUT Input 1" value="AIF1RX1" /> - <ctl name="EPOUT Input 2" value="AIF1RX2" /> - <ctl name="EPOUT Digital Switch" value="1" /> - - <!-- SPK(stereo) --> - <ctl name="SPKOUTL Input 1" value="AIF1RX1" /> - <ctl name="SPKOUTR Input 1" value="AIF1RX2" /> - <ctl name="Speaker Digital Switch" value="1" /> - - <!-- HP(stereo) --> - <ctl name="HPOUT1L Input 1" value="AIF1RX1" /> - <ctl name="HPOUT1R Input 1" value="AIF1RX2" /> - <ctl name="HPOUT1 Digital Switch" value="1" /> - - <!-- VPS(stereo) --> - <ctl name="HPOUT2L Input 1" value="AIF1RX1" /> - <ctl name="HPOUT2R Input 1" value="AIF1RX2" /> - <ctl name="OUT2 Digital Switch" value="1" /> - - <!-- BT AP(use input 1) --> - <!-- ASRC2(RX domain) --> - <ctl name="ASRC2L Input" value="AIF2RX1" /> - <ctl name="ASRC2R Input" value="AIF2RX2" /> - - <!-- Currently use i2c dual mono(both L/R) --> - <!-- CP->RCV --> - <ctl name="EPOUT Input 3" value="None" /> - - <!-- CP->SPK --> - <ctl name="SPKOUTL Input 3" value="None" /> - <ctl name="SPKOUTR Input 3" value="None" /> - - <!-- CP->HP --> - <ctl name="HPOUT1L Input 2" value="None" /> - <ctl name="HPOUT1R Input 2" value="None" /> - - <!-- CP->BT --> - <ctl name="AIF3TX1 Input 2" value="AIF2RX1" /> - <ctl name="AIF3TX2 Input 2" value="AIF2RX2" /> - - <!-- Route all mics via LHPF1 --> - <!-- need to move modifier field --> - <ctl name="LHPF1 Mode" value="High-pass" /> - <ctl name="LHPF2 Mode" value="High-pass" /> - - <!-- BT mic->CP --> - <ctl name="AIF2TX1 Input 2" value="AIF3RX1" /> - <ctl name="AIF2TX2 Input 2" value="AIF3RX2" /> - - <!-- Stereo recording from mics --> - <!-- need to move channeltype --> - - <!-- Gain for main and headset mics --> - <ctl name="IN1L Volume" value="30" /> - <ctl name="IN1R Volume" value="30" /> - - <!-- Gain for sub and 3rd mic --> - <ctl name="IN2L Volume" value="30" /> - <ctl name="IN2R Volume" value="30" /> - - <!-- Mics to AIF2TX --> - <ctl name="ASRC1L Input" value="LHPF1" /> - <ctl name="ASRC1R Input" value="LHPF2" /> - <ctl name="AIF2TX1 Input 1" value="ASRC1L" /> - <ctl name="AIF2TX2 Input 1" value="ASRC1R" /> - - <!-- BT<-CP(use input 2) --> - <ctl name="AIF1TX1 Input 2" value="ASRC2L" /> - <ctl name="AIF1TX2 Input 2" value="ASRC2R" /> - - <!-- LHPF1 & 2 filter --> - <ctl name="LHPF1 COEFF FILTER" value="130Hz" /> - <ctl name="LHPF2 COEFF FILTER" value="130Hz" /> - - <!-- common digital volume --> - <!-- don't change this common volume --> - <ctl name="AIF1TX1 Input 1 Volume" value="32" /> - <ctl name="AIF1TX1 Input 2 Volume" value="32" /> - <ctl name="AIF1TX1 Input 3 Volume" value="32" /> - <ctl name="AIF1TX1 Input 4 Volume" value="32" /> - <ctl name="AIF1TX2 Input 1 Volume" value="32" /> - <ctl name="AIF1TX2 Input 2 Volume" value="32" /> - <ctl name="AIF1TX2 Input 3 Volume" value="32" /> - <ctl name="AIF1TX2 Input 4 Volume" value="32" /> - <ctl name="AIF1TX3 Input 1 Volume" value="32" /> - <ctl name="AIF1TX3 Input 2 Volume" value="32" /> - <ctl name="AIF1TX3 Input 3 Volume" value="32" /> - <ctl name="AIF1TX3 Input 4 Volume" value="32" /> - <ctl name="AIF1TX4 Input 1 Volume" value="32" /> - <ctl name="AIF1TX4 Input 2 Volume" value="32" /> - <ctl name="AIF1TX4 Input 3 Volume" value="32" /> - <ctl name="AIF1TX4 Input 4 Volume" value="32" /> - <ctl name="AIF1TX5 Input 1 Volume" value="32" /> - <ctl name="AIF1TX5 Input 2 Volume" value="32" /> - <ctl name="AIF1TX5 Input 3 Volume" value="32" /> - <ctl name="AIF1TX5 Input 4 Volume" value="32" /> - <ctl name="AIF1TX6 Input 1 Volume" value="32" /> - <ctl name="AIF1TX6 Input 2 Volume" value="32" /> - <ctl name="AIF1TX6 Input 3 Volume" value="32" /> - <ctl name="AIF1TX6 Input 4 Volume" value="32" /> - <ctl name="AIF1TX7 Input 1 Volume" value="32" /> - <ctl name="AIF1TX7 Input 2 Volume" value="32" /> - <ctl name="AIF1TX7 Input 3 Volume" value="32" /> - <ctl name="AIF1TX7 Input 4 Volume" value="32" /> - <ctl name="AIF1TX8 Input 1 Volume" value="32" /> - <ctl name="AIF1TX8 Input 2 Volume" value="32" /> - <ctl name="AIF1TX8 Input 3 Volume" value="32" /> - <ctl name="AIF1TX8 Input 4 Volume" value="32" /> - <ctl name="AIF2TX1 Input 1 Volume" value="32" /> - <ctl name="AIF2TX1 Input 2 Volume" value="32" /> - <ctl name="AIF2TX1 Input 3 Volume" value="32" /> - <ctl name="AIF2TX1 Input 4 Volume" value="32" /> - <ctl name="AIF2TX2 Input 1 Volume" value="32" /> - <ctl name="AIF2TX2 Input 2 Volume" value="32" /> - <ctl name="AIF2TX2 Input 3 Volume" value="32" /> - <ctl name="AIF2TX2 Input 4 Volume" value="32" /> - <ctl name="AIF3TX1 Input 1 Volume" value="32" /> - <ctl name="AIF3TX1 Input 2 Volume" value="32" /> - <ctl name="AIF3TX1 Input 3 Volume" value="32" /> - <ctl name="AIF3TX1 Input 4 Volume" value="32" /> - <ctl name="AIF3TX2 Input 1 Volume" value="32" /> - <ctl name="AIF3TX2 Input 2 Volume" value="32" /> - <ctl name="AIF3TX2 Input 3 Volume" value="32" /> - <ctl name="AIF3TX2 Input 4 Volume" value="32" /> - - <ctl name="Input Ramp Up" value="8ms/6dB" /> - - <ctl name="RCV Switch" value="0" /> - <ctl name="SPK Switch" value="0" /> - <ctl name="HP Switch" value="0" /> - <ctl name="VPS Switch" value="0" /> - <ctl name="HDMI Switch" value="0" /> - <ctl name="Main Mic Switch" value="0" /> - <ctl name="Sub Mic Switch" value="0" /> - <ctl name="3rd Mic Switch" value="0" /> - <ctl name="Headset Mic Switch" value="0" /> - - <ctl name="AIF2 Mode" value="Master" /> - - <!-- Channels --> - - <path name="channel-left"> - <ctl name="AIF1TX1 Input 1" value="LHPF1" /> - <ctl name="AIF1TX2 Input 1" value="LHPF1" /> - <ctl name="ASRC1L Input" value="LHPF1" /> - <ctl name="ASRC1R Input" value="LHPF1" /> - </path> - - <path name="channel-right"> - <ctl name="AIF1TX1 Input 1" value="LHPF2" /> - <ctl name="AIF1TX2 Input 1" value="LHPF2" /> - <ctl name="ASRC1L Input" value="LHPF2" /> - <ctl name="ASRC1R Input" value="LHPF2" /> - </path> - - <path name="channel-stereo"> - <ctl name="AIF1TX1 Input 1" value="LHPF1" /> - <ctl name="AIF1TX2 Input 1" value="LHPF2" /> - <ctl name="ASRC1L Input" value="LHPF1" /> - <ctl name="ASRC1R Input" value="LHPF2" /> - </path> - - <path name="channel-none"> - <ctl name="ASRC1L Input" value="AIF1RX1" /> - <ctl name="ASRC1R Input" value="AIF1RX2" /> - </path> - - <!-- Paths that roughly correspond to devices --> - - <path name="speaker"> - <ctl name="SPK Switch" value="1" /> - </path> - - <path name="earpiece"> - <ctl name="RCV Switch" value="1" /> - </path> - - <path name="headphones"> - <ctl name="HP Switch" value="1" /> - </path> - - <path name="sco-out"> - <ctl name="ASRC1L Input" value="AIF1RX1" /> - <ctl name="ASRC1R Input" value="AIF1RX2" /> - <ctl name="AIF3TX1 Input 1" value="ASRC1L" /> - <ctl name="AIF3TX2 Input 1" value="ASRC1R" /> - <ctl name="AIF3TX1 Input 2" value="AIF2RX1" /> - <ctl name="AIF3TX2 Input 2" value="AIF2RX2" /> - </path> - - <path name="dock"> - <ctl name="VPS Switch" value="1" /> - </path> - - <path name="aux-digital"> - <ctl name="HDMI Switch" value="1" /> - </path> - - <path name="aif2-stereo-mic"> - <ctl name="AIF2TX1 Input 1" value="ASRC1L" /> - <ctl name="AIF2TX2 Input 1" value="ASRC1R" /> - </path> - - <path name="builtin-mic"> - <ctl name="Main Mic Switch" value="1" /> - <ctl name="SPKOUTL Input 4" value="None" /> - <ctl name="SPKOUTR Input 4" value="None" /> - <ctl name="LHPF1 Input 1" value="IN2L" /> - <ctl name="AIF2TX1 Input 1" value="ASRC1L" /> - <ctl name="AIF2TX2 Input 1" value="ASRC1R" /> - </path> - - <path name="back-mic"> - <ctl name="Sub Mic Switch" value="1" /> - <ctl name="LHPF2 Input 1" value="IN2L" /> - <ctl name="AIF2TX1 Input 1" value="ASRC1L" /> - <ctl name="AIF2TX2 Input 1" value="ASRC1R" /> - </path> - - <path name="third-mic"> - <ctl name="3rd Mic Switch" value="1" /> - <ctl name="LHPF1 Input 1" value="IN2R" /> - <ctl name="AIF2TX1 Input 1" value="ASRC1L" /> - <ctl name="AIF2TX2 Input 1" value="ASRC1R" /> - </path> - - <path name="headset-in"> - <ctl name="Headset Mic Switch" value="1" /> - <ctl name="HPOUT1L Input 3" value="None" /> - <ctl name="HPOUT1R Input 3" value="None" /> - <ctl name="LHPF1 Input 1" value="IN1R" /> - <ctl name="AIF2TX1 Input 1" value="ASRC1L" /> - <ctl name="AIF2TX2 Input 1" value="ASRC1R" /> - </path> - - <path name="sco-in"> - <ctl name="AIF2TX1 Input 2" value="AIF3RX1" /> - <ctl name="AIF2TX2 Input 2" value="AIF3RX2" /> - <ctl name="ASRC2L Input" value="AIF3RX1" /> - <ctl name="ASRC2R Input" value="AIF3RX2" /> - <ctl name="AIF2TX1 Input 1" value="None" /> - <ctl name="AIF2TX2 Input 1" value="None" /> - </path> - - <!-- Paths used by HAL --> - - <!-- Playback paths --> - - <path name="voice-speaker"> - <path name="speaker" /> - <ctl name="AIF2 Mode" value="Slave" /> - <ctl name="SPKOUTL Input 3" value="ASRC2L" /> - <ctl name="SPKOUTR Input 3" value="ASRC2R" /> - </path> - - <path name="voice-earpiece"> - <path name="earpiece" /> - <ctl name="AIF2 Mode" value="Slave" /> - <ctl name="EPOUT Input 3" value="ASRC2L" /> - </path> - - <path name="voice-headphones"> - <path name="headphones" /> - <ctl name="AIF2 Mode" value="Slave" /> - <ctl name="HPOUT1L Input 2" value="ASRC2L" /> - <ctl name="HPOUT1R Input 2" value="ASRC2R" /> - </path> - - <path name="media-speaker"> - <path name="speaker" /> - </path> - - <path name="media-earpiece"> - <path name="earpiece" /> - </path> - - <path name="media-headphones"> - <path name="headphones" /> - </path> - - <path name="voice-rec-speaker"> - <path name="speaker" /> - </path> - - <path name="voice-rec-headphones"> - <path name="headphones" /> - </path> - - <path name="communication-speaker"> - <path name="speaker" /> - </path> - - <path name="communication-earpiece"> - <path name="earpiece" /> - </path> - - <path name="communication-headphones"> - <path name="headphones" /> - </path> - - <path name="speaker-and-headphones"> - <path name="speaker" /> - <path name="headphones" /> - </path> - - <path name="bt-sco-headset"> - <path name="sco-out" /> - <ctl name="AIF2 Mode" value="Slave" /> - </path> - - <!-- Capture paths --> - - <path name="voice-main-mic"> - <path name="channel-stereo" /> - <path name="builtin-mic" /> - </path> - - <path name="voice-headset-mic"> - <path name="channel-left" /> - <path name="headset-in" /> - </path> - - <path name="media-main-mic"> - <path name="channel-right" /> - <path name="back-mic" /> - </path> - - <path name="media-second-mic"> - <path name="channel-right" /> - <path name="back-mic" /> - </path> - - <path name="media-headset-mic"> - <path name="channel-left" /> - <path name="headset-in" /> - </path> - - <path name="voice-rec-main-mic"> - <path name="channel-left" /> - <path name="builtin-mic" /> - <path name="back-mic" /> - </path> - - <path name="communication-main-mic"> - <path name="channel-right" /> - <path name="back-mic" /> - </path> - - <path name="bt-sco-mic"> - <path name="channel-none" /> - <path name="sco-in" /> - </path> - - <path name="voice-rec-headset-mic"> - <path name="channel-left" /> - <path name="headset-in" /> - </path> - - <path name="communication-headset-mic"> - <path name="channel-left" /> - <path name="headset-in" /> - </path> - - <path name="none"> - <!-- Empty path --> - </path> + <!-- Initial mixer settings --> + <!-- Noise gate control --> + <ctl name="Noise Gate Switch" value="0"/> + <ctl name="HPOUT1L NG HPOUT1L Switch" value="0"/> + <ctl name="HPOUT1R NG HPOUT1R Switch" value="0"/> + <ctl name="HPOUT2L NG HPOUT2L Switch" value="0"/> + <ctl name="HPOUT2R NG HPOUT2R Switch" value="0"/> + <ctl name="EPOUT NG EPOUT Switch" value="0"/> + <ctl name="SPKOUTL NG SPKOUTL Switch" value="0"/> + <ctl name="SPKOUTR NG SPKOUTR Switch" value="0"/> + <ctl name="SPKDAT1L NG SPKDAT1L Switch" value="0"/> + <ctl name="SPKDAT1R NG SPKDAT1R Switch" value="0"/> + <ctl name="Noise Gate Threshold Volume" value="3"/> + + <!-- Analog output AMP --> + <!-- Speaker --> + <ctl name="SPKOUTL Input 1" value="AIF1RX1"/> + <ctl name="SPKOUTR Input 1" value="AIF1RX2"/> + <ctl name="SPKOUTL Input 2" value="None"/> + <ctl name="SPKOUTR Input 3" value="None"/> + <ctl name="Speaker Digital Switch" value="1"/> + + <!-- Headphones/Headset --> + <ctl name="HPOUT1L Input 1" value="AIF1RX1"/> + <ctl name="HPOUT1R Input 1" value="AIF1RX2"/> + <ctl name="HPOUT1 Digital Switch" value="1"/> + <!-- Earpiece(Mono) --> + <ctl name="EPOUT Input 1" value="AIF1RX1"/> + <ctl name="EPOUT Input 2" value="AIF1RX2"/> + <ctl name="EPOUT Digital Switch" value="1"/> + <!-- LineOut(stereo) --> + <ctl name="HPOUT2L Input 1" value="AIF1RX1"/> + <ctl name="HPOUT2R Input 1" value="AIF1RX2"/> + <ctl name="OUT2 Digital Switch" value="1"/> + <!-- BT <-AP(use input 1) --> + <!-- ASRC2(RX domain) --> + <ctl name="ASRC2L Input" value="AIF2RX1"/> + <ctl name="ASRC2R Input" value="AIF2RX2"/> + <!-- CP->BT --> + <ctl name="AIF3TX1 Input 2" value="AIF2RX1"/> + <ctl name="AIF3TX2 Input 2" value="AIF2RX2"/> + <!-- Route all mics via LHPF1 --> + <!-- need to move modifier field --> + <ctl name="LHPF1 Mode" value="High-pass"/> + <ctl name="LHPF2 Mode" value="High-pass"/> + <!-- BT mic->CP --> + <ctl name="AIF2TX1 Input 2" value="AIF3RX1"/> + <ctl name="AIF2TX2 Input 2" value="AIF3RX2"/> + <!-- Stereo recording from mics --> + <!-- need to move channeltype --> + <!-- Gain for main and headset mics --> + <ctl name="IN1L Volume" value="30"/> + <ctl name="IN1R Volume" value="30"/> + <!-- Gain for sub and 3rd mic --> + <ctl name="IN2L Volume" value="30"/> + <ctl name="IN2R Volume" value="30"/> + <!-- Mics to AIF2TX --> + <ctl name="ASRC1L Input" value="LHPF1"/> + <ctl name="ASRC1R Input" value="LHPF2"/> + <ctl name="AIF2TX1 Input 1" value="ASRC1L"/> + <ctl name="AIF2TX2 Input 1" value="ASRC1R"/> + <!-- BT<-CP(use input 2) --> + <ctl name="AIF1TX1 Input 2" value="ASRC2L"/> + <ctl name="AIF1TX2 Input 2" value="ASRC2R"/> + <!-- LHPF1 & 2 filter --> + <ctl name="LHPF1 COEFF FILTER" value="64Hz"/> + <ctl name="LHPF2 COEFF FILTER" value="64Hz"/> + <!-- LHPF1 & 2 coefficients --> + <ctl name="LHPF1 Coefficients" value="0xf0 0x3a"/> + <ctl name="LHPF2 Coefficients" value="0xf0 0x3a"/> + + <!-- common digital volume --> + <!-- don't change this common volume --> + <ctl name="AIF1TX1 Input 1 Volume" value="32"/> + <ctl name="AIF1TX1 Input 2 Volume" value="32"/> + <ctl name="AIF1TX1 Input 3 Volume" value="32"/> + <ctl name="AIF1TX1 Input 4 Volume" value="32"/> + <ctl name="AIF1TX2 Input 1 Volume" value="32"/> + <ctl name="AIF1TX2 Input 2 Volume" value="32"/> + <ctl name="AIF1TX2 Input 3 Volume" value="32"/> + <ctl name="AIF1TX2 Input 4 Volume" value="32"/> + <ctl name="AIF1TX3 Input 1 Volume" value="32"/> + <ctl name="AIF1TX3 Input 2 Volume" value="32"/> + <ctl name="AIF1TX3 Input 3 Volume" value="32"/> + <ctl name="AIF1TX3 Input 4 Volume" value="32"/> + <ctl name="AIF1TX4 Input 1 Volume" value="32"/> + <ctl name="AIF1TX4 Input 2 Volume" value="32"/> + <ctl name="AIF1TX4 Input 3 Volume" value="32"/> + <ctl name="AIF1TX4 Input 4 Volume" value="32"/> + <ctl name="AIF1TX5 Input 1 Volume" value="32"/> + <ctl name="AIF1TX5 Input 2 Volume" value="32"/> + <ctl name="AIF1TX5 Input 3 Volume" value="32"/> + <ctl name="AIF1TX5 Input 4 Volume" value="32"/> + <ctl name="AIF1TX6 Input 1 Volume" value="32"/> + <ctl name="AIF1TX6 Input 2 Volume" value="32"/> + <ctl name="AIF1TX6 Input 3 Volume" value="32"/> + <ctl name="AIF1TX6 Input 4 Volume" value="32"/> + <ctl name="AIF1TX7 Input 1 Volume" value="32"/> + <ctl name="AIF1TX7 Input 2 Volume" value="32"/> + <ctl name="AIF1TX7 Input 3 Volume" value="32"/> + <ctl name="AIF1TX7 Input 4 Volume" value="32"/> + <ctl name="AIF1TX8 Input 1 Volume" value="32"/> + <ctl name="AIF1TX8 Input 2 Volume" value="32"/> + <ctl name="AIF1TX8 Input 3 Volume" value="32"/> + <ctl name="AIF1TX8 Input 4 Volume" value="32"/> + <ctl name="AIF2TX1 Input 1 Volume" value="32"/> + <ctl name="AIF2TX1 Input 2 Volume" value="32"/> + <ctl name="AIF2TX1 Input 3 Volume" value="32"/> + <ctl name="AIF2TX1 Input 4 Volume" value="32"/> + <ctl name="AIF2TX2 Input 1 Volume" value="32"/> + <ctl name="AIF2TX2 Input 2 Volume" value="32"/> + <ctl name="AIF2TX2 Input 3 Volume" value="32"/> + <ctl name="AIF2TX2 Input 4 Volume" value="32"/> + <ctl name="AIF3TX1 Input 1 Volume" value="32"/> + <ctl name="AIF3TX1 Input 2 Volume" value="32"/> + <ctl name="AIF3TX1 Input 3 Volume" value="32"/> + <ctl name="AIF3TX1 Input 4 Volume" value="32"/> + <ctl name="AIF3TX2 Input 1 Volume" value="32"/> + <ctl name="AIF3TX2 Input 2 Volume" value="32"/> + <ctl name="AIF3TX2 Input 3 Volume" value="32"/> + <ctl name="AIF3TX2 Input 4 Volume" value="32"/> + <ctl name="HPOUT1L Input 3 Volume" value="32"/> + <ctl name="HPOUT1R Input 3 Volume" value="32"/> + <ctl name="EPOUT Input 3 Volume" value="32"/> + <ctl name="EPOUT Input 4 Volume" value="32"/> + <ctl name="SPKOUTL Input 1 Volume" value="32"/> + <ctl name="SPKOUTR Input 1 Volume" value="32"/> + <ctl name="SPKOUTL Input 3 Volume" value="32"/> + <ctl name="EPOUT Digital Volume" value="128"/> + <ctl name="Speaker Digital Volume" value="122"/> + <ctl name="Input Ramp Up" value="8ms/6dB"/> + <ctl name="RCV Switch" value="0"/> + <ctl name="SPK Switch" value="0"/> + <ctl name="HP Switch" value="0"/> + <ctl name="VPS Switch" value="0"/> + <ctl name="HDMI Switch" value="0"/> + <ctl name="Main Mic Switch" value="0"/> + <ctl name="Sub Mic Switch" value="0"/> + <ctl name="3rd Mic Switch" value="0"/> + <ctl name="Headset Mic Switch" value="0"/> + <ctl name="AIF2 Mode" value="Master"/> + + <!-- Channels --> + <path name="channel-left"> + <ctl name="AIF1TX1 Input 1" value="LHPF1"/> + <ctl name="AIF1TX2 Input 1" value="LHPF1"/> + <ctl name="ASRC1L Input" value="LHPF1"/> + <ctl name="ASRC1R Input" value="LHPF1"/> + </path> + + <path name="channel-right"> + <ctl name="AIF1TX1 Input 1" value="LHPF2"/> + <ctl name="AIF1TX2 Input 1" value="LHPF2"/> + <ctl name="ASRC1L Input" value="LHPF2"/> + <ctl name="ASRC1R Input" value="LHPF2"/> + </path> + + <path name="channel-stereo"> + <ctl name="AIF1TX1 Input 1" value="LHPF1"/> + <ctl name="AIF1TX2 Input 1" value="LHPF2"/> + <ctl name="ASRC1L Input" value="LHPF1"/> + <ctl name="ASRC1R Input" value="LHPF2"/> + </path> + + <path name="channel-none"> + <ctl name="AIF3TX1 Input 1" value="ASRC1L"/> + <ctl name="AIF3TX2 Input 1" value="ASRC1R"/> + <ctl name="ASRC1L Input" value="AIF1RX1"/> + <ctl name="ASRC1R Input" value="AIF1RX2"/> + </path> + + <!-- Paths that roughly correspond to devices --> + <path name="speaker"> + <ctl name="SPK Switch" value="1"/> + </path> + + <path name="headphones"> + <ctl name="HP Switch" value="1"/> + </path> + + <path name="earpiece"> + <ctl name="RCV Switch" value="1"/> + </path> + + <path name="builtin-mic"> + <ctl name="Main Mic Switch" value="1"/> + <ctl name="LHPF1 Input 1" value="IN1L"/> + <ctl name="IN1L Volume" value="25"/> + <ctl name="LHPF1 Input 1 Volume" value="32"/> + <ctl name="IN1L Digital Volume" value="128"/> + </path> + + <path name="back-mic"> + <ctl name="Sub Mic Switch" value="1"/> + <ctl name="LHPF2 Input 1" value="IN2L"/> + <ctl name="IN2L Volume" value="28"/> + <ctl name="LHPF2 Input 1 Volume" value="32"/> + <ctl name="IN2L Digital Volume" value="128"/> + </path> + + <path name="third-mic"> + <ctl name="3rd Mic Switch" value="1"/> + <ctl name="LHPF2 Input 1" value="IN2R"/> + <ctl name="IN1L Volume" value="31"/> + <ctl name="LHPF1 Input 1 Volume" value="32"/> + <ctl name="IN1L Digital Volume" value="128"/> + </path> + + <path name="headset-in"> + <ctl name="Headset Mic Switch" value="1"/> + <ctl name="LHPF1 Input 1" value="IN1R"/> + <ctl name="IN1R Volume" value="18"/> + <ctl name="IN1R Digital Volume" value="128"/> + </path> + + <!--Setups--> + <path name="media-setup"> + <ctl name="HPOUT1L Input 3 Volume" value="6"/> + <ctl name="HPOUT1R Input 3 Volume" value="6"/> + <ctl name="EPOUT Input 1 Volume" value="28"/> + <ctl name="EPOUT Input 2 Volume" value="28"/> + <ctl name="EPOUT Input 3 Volume" value="30"/> + <ctl name="EPOUT Input 4 Volume" value="30"/> + <ctl name="SPKOUTL Input 1 Volume" value="31"/> + <ctl name="SPKOUTR Input 1 Volume" value="31"/> + <ctl name="SPKOUTL Input 3 Volume" value="30"/> + <ctl name="HPOUT1 Digital Volume" value="115"/> + <ctl name="EPOUT Digital Volume" value="122"/> + <ctl name="Speaker Digital Volume" value="121"/> + <ctl name="EPOUT DRE Switch" value="1"/> + </path> + + <path name="voice-setup"> + <ctl name="EPOUT Input 1 Volume" value="32"/> + <ctl name="EPOUT Input 2 Volume" value="32"/> + <ctl name="EPOUT Input 3 Volume" value="30"/> + <ctl name="EPOUT Input 4 Volume" value="30"/> + <ctl name="SPKOUTR Input 3" value="ASRC2R"/> + <ctl name="SPKOUTL Input 3" value="ASRC2L"/> + <ctl name="EPOUT Input 3" value="ASRC2L"/> + <ctl name="HPOUT1R Input 2" value="ASRC2R"/> + <ctl name="HPOUT1L Input 2" value="ASRC2L"/> + <ctl name="AIF2 Mode" value="Slave"/> + <ctl name="HPOUT1 DRE Switch" value="0"/> + <ctl name="EPOUT DRE Switch" value="0"/> + <ctl name="HPOUT1 Digital Volume" value="128"/> + </path> + + <path name="headphones-setup"> + <ctl name="HPOUT1L Input 3 Volume" value="6"/> + <ctl name="HPOUT1R Input 3 Volume" value="6"/> + <ctl name="SPKOUTL Input 1 Volume" value="30"/> + <ctl name="SPKOUTR Input 1 Volume" value="31"/> + <ctl name="SPKOUTL Input 3 Volume" value="30"/> + <ctl name="EPOUT Digital Volume" value="108"/> + </path> + + <!-- Paths used by HAL --> + <!-- Playback paths --> + <path name="voice-earpiece"> + <path name="earpiece"/> + </path> + + <path name="voice-earpiece-wb"> + <path name="voice-setup"/> + <path name="earpiece"/> + <ctl name="SPKOUTL Input 1 Volume" value="31"/> + <ctl name="SPKOUTR Input 1 Volume" value="30"/> + </path> + + <path name="voice-speaker"> + <path name="speaker"/> + </path> + + <path name="voice-speaker-wb"> + <path name="voice-setup"/> + <path name="speaker"/> + <ctl name="SPKOUTL Input 3 Volume" value="30"/> + <ctl name="Speaker Digital Volume" value="128"/> + </path> + + <path name="voice-headphones"> + <path name="headphones"/> + <ctl name="Noise Gate Switch" value="0"/> + </path> + + <path name="voice-headphones-wb"> + <path name="voice-setup"/> + <path name="headphones-setup"/> + <path name="headphones"/> + <ctl name="Noise Gate Switch" value="0"/> + <ctl name="LHPF2 Input 1" value="IN2L"/> + <ctl name="IN2L Volume" value="28"/> + <ctl name="HPOUT1 Digital Volume" value="116"/> + </path> + + <path name="media-speaker"> + <path name="speaker"/> + <path name="media-setup"/> + </path> + + <path name="media-earpiece"> + <path name="earpiece"/> + <path name="media-setup"/> + </path> + + <path name="media-headphones"> + <path name="headphones-setup"/> + <path name="headphones"/> + </path> + + <path name="speaker-and-headphones"> + <path name="speaker"/> + <path name="headphones"/> + </path> + + + <!-- Capture paths --> + <path name="voice-speaker-mic"> + <path name="back-mic"/> + <path name="channel-right"/> + <ctl name="IN1L Volume" value="31"/> + <ctl name="IN1R Volume" value="18"/> + <ctl name="LHPF1 Input 1" value="IN1L"/> + </path> + + <path name="voice-speaker-mic-wb"> + <path name="back-mic"/> + <path name="channel-right"/> + <ctl name="IN1L Volume" value="30"/> + <ctl name="IN1R Volume" value="30"/> + <ctl name="IN2L Volume" value="15"/> + <ctl name="LHPF1 Input 1" value="IN1L"/> + </path> + + <path name="voice-earpiece-mic"> + <path name="builtin-mic"/> + <path name="channel-left"/> + <ctl name="IN2L Volume" value="28"/> + <ctl name="IN1R Volume" value="18"/> + <ctl name="LHPF2 Input 1" value="IN2L"/> + </path> + + <path name="voice-earpiece-mic-wb"> + <path name="builtin-mic"/> + <path name="channel-left"/> + <ctl name="IN1L Volume" value="30"/> + <ctl name="IN2L Volume" value="30"/> + <ctl name="IN1R Volume" value="30"/> + </path> + + <path name="voice-headset-mic"> + <path name="headset-in"/> + <path name="channel-left"/> + </path> + + <path name="voice-headset-mic-wb"> + <path name="headset-in"/> + <path name="channel-left"/> + <ctl name="IN1L Volume" value="25"/> + </path> + + <path name="media-speaker-mic"> + <path name="back-mic"/> + <path name="channel-right"/> + <ctl name="IN1L Volume" value="31"/> + <ctl name="IN1R Volume" value="18"/> + <ctl name="LHPF1 Input 1" value="IN1L"/> + </path> + + <path name="media-earpiece-mic"> + <path name="builtin-mic"/> + <path name="channel-left"/> + <ctl name="IN2L Volume" value="28"/> + <ctl name="IN1R Volume" value="18"/> + <ctl name="LHPF2 Input 1" value="IN2L"/> + </path> + + <path name="media-headset-mic"> + <path name="channel-left"/> + <path name="headset-in"/> + </path> + + <path name="none"> + <!-- Empty path --> + </path> </mixer> diff --git a/audio/ril_interface.c b/audio/ril_interface.c index 69d40a5..ad7448e 100644 --- a/audio/ril_interface.c +++ b/audio/ril_interface.c @@ -35,7 +35,7 @@ int (*_ril_connect)(void *); int (*_ril_is_connected)(void *); 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_audio_path)(void *, enum ril_audio_path, int); int (*_ril_set_call_clock_sync)(void *, enum ril_clock_state); int (*_ril_set_mute)(void *, int); int (*_ril_set_two_mic_control)(void *, enum ril_two_mic_device, enum ril_two_mic_state); @@ -170,12 +170,14 @@ int ril_set_call_volume(struct ril_handle *ril, enum ril_sound_type sound_type, (int)(volume * ril->volume_steps_max)); } -int ril_set_call_audio_path(struct ril_handle *ril, enum ril_audio_path path) +int ril_set_call_audio_path(struct ril_handle *ril, + enum ril_audio_path path, + enum ril_extra_volume mode) { if (ril_connect_if_required(ril)) return 0; - return _ril_set_call_audio_path(ril->client, path); + return _ril_set_call_audio_path(ril->client, path, mode); } int ril_set_call_clock_sync(struct ril_handle *ril, enum ril_clock_state state) diff --git a/audio/ril_interface.h b/audio/ril_interface.h index 697d04e..f69ad23 100644 --- a/audio/ril_interface.h +++ b/audio/ril_interface.h @@ -47,12 +47,22 @@ enum ril_sound_type { }; enum ril_audio_path { - SOUND_AUDIO_PATH_HANDSET, + SOUND_AUDIO_PATH_EARPIECE, SOUND_AUDIO_PATH_HEADSET, SOUND_AUDIO_PATH_SPEAKER, SOUND_AUDIO_PATH_BLUETOOTH, + SOUND_AUDIO_PATH_STEREO_BT, + SOUND_AUDIO_PATH_HEADPHONE, SOUND_AUDIO_PATH_BLUETOOTH_NO_NR, - SOUND_AUDIO_PATH_HEADPHONE + SOUND_AUDIO_PATH_MIC1, + SOUND_AUDIO_PATH_MIC2, + SOUND_AUDIO_PATH_BLUETOOTH_WB, + SOUND_AUDIO_PATH_BLUETOOTH_WB_NO_NR +}; + +enum ril_extra_volume { + ORIGINAL_PATH, + EXTRA_VOLUME_PATH }; enum ril_clock_state { @@ -84,7 +94,9 @@ int ril_open(struct ril_handle *ril); int ril_close(struct ril_handle *ril); int ril_set_call_volume(struct ril_handle *ril, enum ril_sound_type sound_type, float volume); -int ril_set_call_audio_path(struct ril_handle *ril, enum ril_audio_path path); +int ril_set_call_audio_path(struct ril_handle *ril, + enum ril_audio_path path, + enum ril_extra_volume mode); int ril_set_call_clock_sync(struct ril_handle *ril, enum ril_clock_state state); int ril_set_mute(struct ril_handle *ril, enum ril_mute_state state); void ril_register_set_wb_amr_callback(void *function, void *data); diff --git a/audio/routing.h b/audio/routing.h index 46d027c..fae05b5 100644 --- a/audio/routing.h +++ b/audio/routing.h @@ -38,6 +38,7 @@ enum { IN_SOURCE_VOICE_RECOGNITION, IN_SOURCE_VOICE_COMMUNICATION, IN_SOURCE_VOICE_CALL, + IN_SOURCE_VOICE_CALL_WB, IN_SOURCE_TAB_SIZE, /* number of lines in route_configs[][] */ IN_SOURCE_NONE, IN_SOURCE_CNT @@ -56,129 +57,163 @@ struct route_config { // -1 means es325 bypass }; -/* TODO: Figure out whether voice routes need to set ES325 presets */ const struct route_config voice_speaker = { "voice-speaker", - "voice-main-mic", - { ES325_PRESET_OFF, - ES325_PRESET_OFF } + "voice-speaker-mic", + { ES325_PRESET_VOIP_DESKTOP, + ES325_PRESET_VOIP_DESKTOP } +}; + +const struct route_config voice_speaker_wb = { + "voice-speaker-wb", + "voice-speaker-mic-wb", + { ES325_PRESET_VOIP_DESKTOP, + ES325_PRESET_VOIP_DESKTOP } }; const struct route_config voice_earpiece = { "voice-earpiece", - "voice-main-mic", - { ES325_PRESET_OFF, - ES325_PRESET_OFF } + "voice-earpiece-mic", + { ES325_PRESET_VOIP_HANDHELD, + ES325_PRESET_VOIP_HANDHELD } +}; + +const struct route_config voice_earpiece_wb = { + "voice-earpiece-wb", + "voice-earpiece-mic-wb", + { ES325_PRESET_VOIP_HANDHELD, + ES325_PRESET_VOIP_HANDHELD } }; const struct route_config voice_headphones = { "voice-headphones", - "voice-main-mic", - { ES325_PRESET_OFF, - ES325_PRESET_OFF } + "voice-earpiece-mic", + { ES325_PRESET_VOIP_HEADPHONES, + ES325_PRESET_VOIP_HEADPHONES } +}; + +const struct route_config voice_headphones_wb = { + "voice-headphones-wb", + "voice-earpiece-mic-wb", + { ES325_PRESET_VOIP_HEADPHONES, + ES325_PRESET_VOIP_HEADPHONES } }; const struct route_config voice_headset = { "voice-headphones", "voice-headset-mic", - { ES325_PRESET_OFF, - ES325_PRESET_OFF } + { ES325_PRESET_VOIP_HEADSET, + ES325_PRESET_VOIP_HEADSET } +}; + +const struct route_config voice_headset_wb = { + "voice-headphones-wb", + "voice-headset-mic-wb", + { ES325_PRESET_VOIP_HEADSET, + ES325_PRESET_VOIP_HEADSET } }; const struct route_config media_speaker = { "media-speaker", - "media-main-mic", + "media-speaker-mic", + { ES325_PRESET_ASRA_HANDHELD, + ES325_PRESET_ASRA_DESKTOP } +}; + +const struct route_config bluetooth_sco_wb = { + "bt-sco-headset-wb", + "bt-sco-mic", { ES325_PRESET_OFF, ES325_PRESET_OFF } }; const struct route_config media_earpiece = { "media-earpiece", - "media-main-mic", - { ES325_PRESET_OFF, - ES325_PRESET_OFF } + "media-earpiece-mic", + { ES325_PRESET_VOIP_HANDHELD, + ES325_PRESET_VOIP_HANDHELD } }; const struct route_config media_headphones = { "media-headphones", - "media-main-mic", - { ES325_PRESET_OFF, - ES325_PRESET_OFF } + "media-earpiece-mic", + { ES325_PRESET_VOIP_HEADPHONES, + ES325_PRESET_VOIP_HEADPHONES } }; const struct route_config media_headset = { "media-headphones", "media-headset-mic", - { ES325_PRESET_OFF, - ES325_PRESET_OFF } + { ES325_PRESET_VOIP_HEADSET, + ES325_PRESET_ASRA_HEADSET } }; const struct route_config camcorder_speaker = { "media-speaker", - "media-second-mic", + "media-speaker-mic", { ES325_PRESET_CAMCORDER, ES325_PRESET_CAMCORDER } }; const struct route_config camcorder_headphones = { "media-headphones", - "media-second-mic", + "media-earpiece-mic", { ES325_PRESET_CAMCORDER, ES325_PRESET_CAMCORDER } }; const struct route_config voice_rec_speaker = { - "voice-rec-speaker", - "voice-rec-main-mic", + "media-speaker", + "media-speaker-mic", { ES325_PRESET_ASRA_HANDHELD, ES325_PRESET_ASRA_DESKTOP } }; const struct route_config voice_rec_headphones = { - "voice-rec-headphones", - "voice-rec-main-mic", + "media-headphones", + "media-earpiece-mic", { ES325_PRESET_ASRA_HANDHELD, ES325_PRESET_ASRA_DESKTOP } }; const struct route_config voice_rec_headset = { - "voice-rec-headphones", - "voice-rec-headset-mic", + "media-headphones", + "media-headset-mic", { ES325_PRESET_ASRA_HEADSET, ES325_PRESET_ASRA_HEADSET } }; const struct route_config communication_speaker = { - "communication-speaker", - "communication-main-mic", - { ES325_PRESET_VOIP_HANDHELD, + "voice-speaker", + "voice-speaker-mic", + { ES325_PRESET_VOIP_DESKTOP, ES325_PRESET_VOIP_DESKTOP } }; const struct route_config communication_earpiece = { - "communication-earpiece", - "communication-main-mic", - { ES325_PRESET_OFF, - ES325_PRESET_OFF } + "voice-earpiece", + "voice-earpiece-mic", + { ES325_PRESET_VOIP_HANDHELD, + ES325_PRESET_VOIP_HANDHELD } }; const struct route_config communication_headphones = { - "communication-headphones", - "communication-main-mic", + "voice-headphones", + "voice-earpiece-mic", { ES325_PRESET_VOIP_HEADPHONES, ES325_PRESET_VOIP_HP_DESKTOP} }; const struct route_config communication_headset = { - "communication-headphones", - "communication-headset-mic", + "voice-headphones", + "voice-headset-mic", { ES325_PRESET_VOIP_HEADSET, ES325_PRESET_VOIP_HEADSET } }; const struct route_config speaker_and_headphones = { "speaker-and-headphones", - "main-mic", + "media-speaker-mic", { ES325_PRESET_CURRENT, ES325_PRESET_CURRENT } }; @@ -244,6 +279,15 @@ const struct route_config * const route_configs[IN_SOURCE_TAB_SIZE] &voice_headphones, /* OUT_DEVICE_SPEAKER_AND_HEADSET */ &voice_earpiece /* OUT_DEVICE_SPEAKER_AND_EARPIECE */ }, + { /* IN_SOURCE_VOICE_CALL_WB */ + &voice_speaker_wb, /* OUT_DEVICE_SPEAKER */ + &voice_earpiece_wb, /* OUT_DEVICE_EARPIECE */ + &voice_headset_wb, /* OUT_DEVICE_HEADSET */ + &voice_headphones_wb, /* OUT_DEVICE_HEADPHONES */ + &bluetooth_sco_wb, /* OUT_DEVICE_BT_SCO */ + &voice_headphones_wb, /* OUT_DEVICE_SPEAKER_AND_HEADSET */ + &voice_earpiece_wb /* OUT_DEVICE_SPEAKER_AND_EARPIECE */ + }, }; #endif diff --git a/configs/audio_policy.conf b/configs/audio_policy.conf index 6e65078..9f18246 100644 --- a/configs/audio_policy.conf +++ b/configs/audio_policy.conf @@ -3,9 +3,9 @@ # Devices are designated by a string that corresponds to the enum in audio.h global_configuration { - attached_output_devices AUDIO_DEVICE_OUT_SPEAKER + attached_output_devices AUDIO_DEVICE_OUT_EARPIECE|AUDIO_DEVICE_OUT_SPEAKER default_output_device AUDIO_DEVICE_OUT_SPEAKER - attached_input_devices AUDIO_DEVICE_IN_BUILTIN_MIC|AUDIO_DEVICE_IN_VOICE_CALL|AUDIO_DEVICE_IN_REMOTE_SUBMIX + attached_input_devices AUDIO_DEVICE_IN_BUILTIN_MIC|AUDIO_DEVICE_IN_BACK_MIC|AUDIO_DEVICE_IN_VOICE_CALL|AUDIO_DEVICE_IN_REMOTE_SUBMIX } # audio hardware module section: contains descriptors for all audio hw modules present on the @@ -26,7 +26,7 @@ audio_hw_modules { sampling_rates 48000 channel_masks AUDIO_CHANNEL_OUT_STEREO formats AUDIO_FORMAT_PCM_16_BIT|AUDIO_FORMAT_PCM_24_BIT - devices AUDIO_DEVICE_OUT_SPEAKER|AUDIO_DEVICE_OUT_ALL_SCO|AUDIO_DEVICE_OUT_WIRED_HEADSET|AUDIO_DEVICE_OUT_WIRED_HEADPHONE|AUDIO_DEVICE_OUT_ANLG_DOCK_HEADSET + devices AUDIO_DEVICE_OUT_EARPIECE|AUDIO_DEVICE_OUT_SPEAKER|AUDIO_DEVICE_OUT_ALL_SCO|AUDIO_DEVICE_OUT_WIRED_HEADSET|AUDIO_DEVICE_OUT_WIRED_HEADPHONE|AUDIO_DEVICE_OUT_ANLG_DOCK_HEADSET flags AUDIO_OUTPUT_FLAG_PRIMARY } hdmi { @@ -42,7 +42,7 @@ audio_hw_modules { sampling_rates 8000|11025|16000|22050|24000|32000|44100|48000 channel_masks AUDIO_CHANNEL_IN_MONO|AUDIO_CHANNEL_IN_STEREO formats AUDIO_FORMAT_PCM_16_BIT - devices AUDIO_DEVICE_IN_BUILTIN_MIC|AUDIO_DEVICE_IN_BLUETOOTH_SCO_HEADSET|AUDIO_DEVICE_IN_WIRED_HEADSET|AUDIO_DEVICE_IN_FM|AUDIO_DEVICE_IN_VOICE_CALL + devices AUDIO_DEVICE_IN_BUILTIN_MIC|AUDIO_DEVICE_IN_BLUETOOTH_SCO_HEADSET|AUDIO_DEVICE_IN_WIRED_HEADSET|AUDIO_DEVICE_IN_BACK_MIC|AUDIO_DEVICE_IN_VOICE_CALL } } } @@ -112,7 +112,13 @@ PRODUCT_PACKAGES += \ libcsc \ libExynosOMX_Core \ libOMX.Exynos.MP3.Decoder \ - libstagefrighthw \ + libOMX.Exynos.AVC.Decoder \ + libOMX.Exynos.AVC.Encoder \ + libOMX.Exynos.MPEG4.Decoder \ + libOMX.Exynos.MPEG4.Encoder \ + libOMX.Exynos.VP8.Decoder \ + libOMX.Exynos.VP8.Encoder \ + libstagefrighthw # Permissions PRODUCT_COPY_FILES += \ diff --git a/proprietary-files.txt b/proprietary-files.txt index 76dad75..9f30253 100644 --- a/proprietary-files.txt +++ b/proprietary-files.txt @@ -5,10 +5,6 @@ vendor/firmware/srp_vliw.bin # Bluetooth vendor/firmware/bcm4350.hcd -vendor/firmware/bcm4350_A0.hcd -vendor/firmware/bcm4350_murata.hcd -vendor/firmware/bcm4350_semco.hcd -vendor/firmware/BT_FW_VER_BCM4354_003.001.012.0197.0319_Klint_3G_WIFI_ORC.hcd # Camera lib/hw/camera.vendor.universal5420.so @@ -27,7 +23,6 @@ lib/libsecnativefeature.so lib/libvdis.so # DRM -bin/drmserver.samsung lib/libstagefright_hdcp.so vendor/lib/libdrmdecrypt.so vendor/lib/liboemcrypto.so @@ -39,13 +34,6 @@ vendor/lib/drm/libdrmwvmplugin.so vendor/lib/mediadrm/libdrmclearkeyplugin.so vendor/lib/mediadrm/libwvdrmengine.so -lib/omx/libOMX.Exynos.AVC.Decoder.so -lib/omx/libOMX.Exynos.AVC.Encoder.so -lib/omx/libOMX.Exynos.MPEG4.Decoder.so -lib/omx/libOMX.Exynos.MPEG4.Encoder.so -lib/omx/libOMX.Exynos.VP8.Decoder.so -lib/omx/libOMX.Exynos.VP8.Encoder.so - # Graphics vendor/lib/egl/libGLES_mali.so vendor/lib/libmalicore.bc @@ -104,4 +92,8 @@ etc/wifi/nvram_net.txt # Input usr/idc/Synaptics_HID_TouchPad.idc -usr/keylayout/gpio-keys.kl
\ No newline at end of file +usr/keylayout/gpio-keys.kl + +# Radio +lib/libsec-ril.so +bin/cbd
\ No newline at end of file diff --git a/ril/telephony/java/com/android/internal/telephony/KlimtLteRIL.java b/ril/telephony/java/com/android/internal/telephony/KlimtLteRIL.java index 0c5e308..816b45e 100644 --- a/ril/telephony/java/com/android/internal/telephony/KlimtLteRIL.java +++ b/ril/telephony/java/com/android/internal/telephony/KlimtLteRIL.java @@ -38,13 +38,27 @@ import com.android.internal.telephony.uicc.IccCardApplicationStatus; import com.android.internal.telephony.uicc.IccCardStatus; /** - * RIL customization for tab s LTE devices + * RIL customization for Galaxy Tab S LTE devices * * {@hide} */ public class KlimtLteRIL extends RIL { + private static final int RIL_UNSOL_RESPONSE_IMS_NETWORK_STATE_CHANGED = 1036; private static final int RIL_REQUEST_DIAL_EMERGENCY = 10016; + private static final int RIL_UNSOL_RELEASE_COMPLETE_MESSAGE = 11001; + private static final int RIL_UNSOL_STK_CALL_CONTROL_RESULT = 11003; + private static final int RIL_UNSOL_DEVICE_READY_NOTI = 11008; + private static final int RIL_UNSOL_GPS_NOTI = 11009; + private static final int RIL_UNSOL_AM = 11010; + private static final int RIL_UNSOL_DUN_PIN_CONTROL_SIGNAL = 11011; + private static final int RIL_UNSOL_DATA_SUSPEND_RESUME = 11012; + private static final int RIL_UNSOL_HSDPA_STATE_CHANGED = 11016; + private static final int RIL_UNSOL_WB_AMR_STATE = 11017; + private static final int RIL_UNSOL_UART = 11020; + private static final int RIL_UNSOL_RESPONSE_HANDOVER = 11021; + private static final int RIL_UNSOL_PCMCLOCK_STATE = 11022; + private static final int RIL_LTE_UNSOL_LAST = 11036; private final AudioManager mAudioManager; @@ -259,31 +273,47 @@ public class KlimtLteRIL extends RIL { int response = p.readInt(); switch(response) { - // SAMSUNG STATES - case 11008: // RIL_DEVICE_READY: + case RIL_UNSOL_RESPONSE_IMS_NETWORK_STATE_CHANGED: ret = responseVoid(p); break; - case 11010: // RIL_UNSOL_AM: - ret = responseString(p); - String amString = (String) ret; - Rlog.d(RILJ_LOG_TAG, "Executing AM: " + amString); - - try { - Runtime.getRuntime().exec("am " + amString); - } catch (IOException e) { - e.printStackTrace(); - Rlog.e(RILJ_LOG_TAG, "am " + amString + " could not be executed."); - } + case RIL_UNSOL_RELEASE_COMPLETE_MESSAGE: + ret = responseVoid(p); break; - case 11021: // RIL_UNSOL_RESPONSE_HANDOVER: + case RIL_UNSOL_STK_CALL_CONTROL_RESULT: ret = responseVoid(p); break; - case 1036: + case RIL_UNSOL_DEVICE_READY_NOTI: ret = responseVoid(p); break; - case 11017: // RIL_UNSOL_WB_AMR_STATE: + case RIL_UNSOL_GPS_NOTI: + ret = responseVoid(p); + break; + case RIL_UNSOL_AM: + ret = responseString(p); + break; + case RIL_UNSOL_DUN_PIN_CONTROL_SIGNAL: + ret = responseVoid(p); + break; + case RIL_UNSOL_DATA_SUSPEND_RESUME: + ret = responseInts(p); + break; + case RIL_UNSOL_HSDPA_STATE_CHANGED: ret = responseInts(p); - setWbAmr(((int[])ret)[0]); + break; + case RIL_UNSOL_WB_AMR_STATE: + ret = responseInts(p); + break; + case RIL_UNSOL_UART: + ret = responseInts(p); + break; + case RIL_UNSOL_RESPONSE_HANDOVER: + ret = responseVoid(p); + break; + case RIL_UNSOL_PCMCLOCK_STATE: + ret = responseVoid(p); + break; + case RIL_LTE_UNSOL_LAST: + ret = responseVoid(p); break; default: // Rewind the Parcel @@ -304,18 +334,22 @@ public class KlimtLteRIL extends RIL { int dataPosition = p.dataPosition(); // save off position within the Parcel serial = p.readInt(); error = p.readInt(); + RILRequest rr = null; + /* Pre-process the reply before popping it */ synchronized (mRequestList) { RILRequest tr = mRequestList.get(serial); if (tr != null && tr.mSerial == serial) { if (error == 0 || p.dataAvail() > 0) { - try {switch (tr.mRequest) { + try { + switch (tr.mRequest) { /* Get those we're interested in */ - case RIL_REQUEST_DATA_REGISTRATION_STATE: - rr = tr; - break; - }} catch (Throwable thr) { + case RIL_REQUEST_DATA_REGISTRATION_STATE: + rr = tr; + break; + } + } catch (Throwable thr) { // Exceptions here usually mean invalid RIL responses if (tr.mResult != null) { AsyncResult.forMessage(tr.mResult, null, thr); @@ -326,27 +360,35 @@ public class KlimtLteRIL extends RIL { } } } + if (rr == null) { /* Nothing we care about, go up */ p.setDataPosition(dataPosition); + // Forward responses that we are not overriding to the super class return super.processSolicited(p); } + rr = findAndRemoveRequestFromList(serial); + if (rr == null) { return rr; } Object ret = null; + if (error == 0 || p.dataAvail() > 0) { switch (rr.mRequest) { - case RIL_REQUEST_DATA_REGISTRATION_STATE: ret = responseDataRegistrationState(p); break; + case RIL_REQUEST_DATA_REGISTRATION_STATE: + ret = responseDataRegistrationState(p); break; default: throw new RuntimeException("Unrecognized solicited response: " + rr.mRequest); } //break; } + if (RILJ_LOGD) riljLog(rr.serialString() + "< " + requestToString(rr.mRequest) + " " + retToString(rr.mRequest, ret)); + if (rr.mResult != null) { AsyncResult.forMessage(rr.mResult, ret, null); rr.mResult.sendToTarget(); diff --git a/rootdir/Android.mk b/rootdir/Android.mk index 221bea1..35689ed 100644 --- a/rootdir/Android.mk +++ b/rootdir/Android.mk @@ -80,11 +80,3 @@ LOCAL_MODULE_CLASS := ETC LOCAL_SRC_FILES := etc/init.baseband.rc LOCAL_MODULE_PATH := $(TARGET_ROOT_OUT) include $(BUILD_PREBUILT) - -include $(CLEAR_VARS) -LOCAL_MODULE := init.recovery.universal5420.usb.rc -LOCAL_MODULE_TAGS := optional eng -LOCAL_MODULE_CLASS := ETC -LOCAL_SRC_FILES := etc/init.recovery.universal5420.usb.rc -LOCAL_MODULE_PATH := $(TARGET_ROOT_OUT) -include $(BUILD_PREBUILT) |
