Shiv Maliyappanahalli | 34b585f | 2013-10-01 15:49:05 -0700 | [diff] [blame] | 1 | /* |
Alexy Joseph | b137994 | 2016-01-29 15:49:38 -0800 | [diff] [blame] | 2 | * Copyright (c) 2013-2016, The Linux Foundation. All rights reserved. |
Shiv Maliyappanahalli | 34b585f | 2013-10-01 15:49:05 -0700 | [diff] [blame] | 3 | * Not a contribution. |
| 4 | * |
Shiv Maliyappanahalli | 8911f28 | 2014-01-10 15:56:19 -0800 | [diff] [blame] | 5 | * Copyright (C) 2013 The Android Open Source Project |
Shiv Maliyappanahalli | 34b585f | 2013-10-01 15:49:05 -0700 | [diff] [blame] | 6 | * |
| 7 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 8 | * you may not use this file except in compliance with the License. |
| 9 | * You may obtain a copy of the License at |
| 10 | * |
| 11 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 12 | * |
| 13 | * Unless required by applicable law or agreed to in writing, software |
| 14 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 16 | * See the License for the specific language governing permissions and |
| 17 | * limitations under the License. |
| 18 | */ |
| 19 | |
| 20 | #define LOG_TAG "voice" |
| 21 | /*#define LOG_NDEBUG 0*/ |
| 22 | #define LOG_NDDEBUG 0 |
| 23 | |
| 24 | #include <errno.h> |
Sharad Sangle | b27354b | 2015-06-18 15:58:55 +0530 | [diff] [blame] | 25 | #include <stdlib.h> |
Shiv Maliyappanahalli | 34b585f | 2013-10-01 15:49:05 -0700 | [diff] [blame] | 26 | #include <math.h> |
| 27 | #include <cutils/log.h> |
| 28 | #include <cutils/str_parms.h> |
| 29 | |
| 30 | #include "audio_hw.h" |
| 31 | #include "voice.h" |
| 32 | #include "voice_extn/voice_extn.h" |
| 33 | #include "platform.h" |
| 34 | #include "platform_api.h" |
Kiran Kandi | 910e186 | 2013-10-29 13:29:42 -0700 | [diff] [blame] | 35 | #include "audio_extn.h" |
Shiv Maliyappanahalli | 34b585f | 2013-10-01 15:49:05 -0700 | [diff] [blame] | 36 | |
| 37 | struct pcm_config pcm_config_voice_call = { |
| 38 | .channels = 1, |
| 39 | .rate = 8000, |
| 40 | .period_size = 160, |
| 41 | .period_count = 2, |
| 42 | .format = PCM_FORMAT_S16_LE, |
| 43 | }; |
| 44 | |
Shiv Maliyappanahalli | 34b585f | 2013-10-01 15:49:05 -0700 | [diff] [blame] | 45 | static struct voice_session *voice_get_session_from_use_case(struct audio_device *adev, |
| 46 | audio_usecase_t usecase_id) |
| 47 | { |
| 48 | struct voice_session *session = NULL; |
| 49 | int ret = 0; |
| 50 | |
| 51 | ret = voice_extn_get_session_from_use_case(adev, usecase_id, &session); |
| 52 | if (ret == -ENOSYS) { |
| 53 | session = &adev->voice.session[VOICE_SESS_IDX]; |
| 54 | } |
| 55 | |
| 56 | return session; |
| 57 | } |
| 58 | |
Bhalchandra Gajare | 45fee28 | 2015-06-09 22:23:45 -0700 | [diff] [blame] | 59 | static bool voice_is_sidetone_device(snd_device_t out_device, |
| 60 | char *mixer_path) |
| 61 | { |
| 62 | bool is_sidetone_dev; |
| 63 | |
| 64 | switch (out_device) { |
| 65 | case SND_DEVICE_OUT_VOICE_HANDSET: |
| 66 | is_sidetone_dev = true; |
| 67 | strlcpy(mixer_path, "sidetone-handset", MIXER_PATH_MAX_LENGTH); |
| 68 | break; |
| 69 | case SND_DEVICE_OUT_VOICE_HEADPHONES: |
| 70 | case SND_DEVICE_OUT_VOICE_ANC_HEADSET: |
| 71 | case SND_DEVICE_OUT_VOICE_ANC_FB_HEADSET: |
| 72 | is_sidetone_dev = true; |
| 73 | strlcpy(mixer_path, "sidetone-headphones", MIXER_PATH_MAX_LENGTH); |
| 74 | break; |
Kuirong Wang | 1cad714 | 2016-05-24 15:21:56 -0700 | [diff] [blame] | 75 | case SND_DEVICE_OUT_USB_HEADSET: |
| 76 | is_sidetone_dev = true; |
| 77 | break; |
Bhalchandra Gajare | 45fee28 | 2015-06-09 22:23:45 -0700 | [diff] [blame] | 78 | default: |
| 79 | is_sidetone_dev = false; |
| 80 | break; |
| 81 | } |
| 82 | |
| 83 | return is_sidetone_dev; |
| 84 | } |
| 85 | |
| 86 | void voice_set_sidetone(struct audio_device *adev, |
| 87 | snd_device_t out_snd_device, bool enable) |
| 88 | { |
| 89 | char mixer_path[MIXER_PATH_MAX_LENGTH]; |
Bhalchandra Gajare | 45fee28 | 2015-06-09 22:23:45 -0700 | [diff] [blame] | 90 | ALOGD("%s: %s, out_snd_device: %d\n", |
| 91 | __func__, (enable ? "enable" : "disable"), |
| 92 | out_snd_device); |
Kuirong Wang | 1cad714 | 2016-05-24 15:21:56 -0700 | [diff] [blame] | 93 | if (voice_is_sidetone_device(out_snd_device, mixer_path)) |
| 94 | platform_set_sidetone(adev, out_snd_device, enable, mixer_path); |
Bhalchandra Gajare | 45fee28 | 2015-06-09 22:23:45 -0700 | [diff] [blame] | 95 | return; |
| 96 | } |
| 97 | |
Vidyakumar Athota | ea269c6 | 2016-10-31 09:05:59 -0700 | [diff] [blame] | 98 | static bool voice_is_aanc_device(snd_device_t out_device, |
| 99 | char *mixer_path) |
| 100 | { |
| 101 | bool is_aanc_dev; |
| 102 | |
| 103 | switch (out_device) { |
| 104 | case SND_DEVICE_OUT_ANC_HANDSET: |
| 105 | is_aanc_dev = true; |
| 106 | strlcpy(mixer_path, "aanc-path", MIXER_PATH_MAX_LENGTH); |
| 107 | break; |
| 108 | default: |
| 109 | is_aanc_dev = false; |
| 110 | break; |
| 111 | } |
| 112 | |
| 113 | return is_aanc_dev; |
| 114 | } |
| 115 | |
| 116 | void voice_check_and_update_aanc_path(struct audio_device *adev, |
| 117 | snd_device_t out_snd_device, |
| 118 | bool enable) |
| 119 | { |
| 120 | char mixer_path[MIXER_PATH_MAX_LENGTH]; |
| 121 | |
| 122 | ALOGV("%s: %s, out_snd_device: %d\n", |
| 123 | __func__, (enable ? "enable" : "disable"), out_snd_device); |
| 124 | |
| 125 | if (voice_is_aanc_device(out_snd_device, mixer_path)) |
| 126 | platform_update_aanc_path(adev, out_snd_device, enable, mixer_path); |
| 127 | |
| 128 | return; |
| 129 | } |
| 130 | |
Ravi Kumar Alamanda | 263d80c | 2014-08-20 16:24:38 -0700 | [diff] [blame] | 131 | int voice_stop_usecase(struct audio_device *adev, audio_usecase_t usecase_id) |
Shiv Maliyappanahalli | 34b585f | 2013-10-01 15:49:05 -0700 | [diff] [blame] | 132 | { |
Satya Krishna Pindiproli | f1cd92b | 2016-04-14 19:05:23 +0530 | [diff] [blame] | 133 | int ret = 0; |
Shiv Maliyappanahalli | 34b585f | 2013-10-01 15:49:05 -0700 | [diff] [blame] | 134 | struct audio_usecase *uc_info; |
| 135 | struct voice_session *session = NULL; |
| 136 | |
Shiv Maliyappanahalli | 3bb7358 | 2013-11-05 12:49:15 -0800 | [diff] [blame] | 137 | ALOGD("%s: enter usecase:%s", __func__, use_case_table[usecase_id]); |
Shiv Maliyappanahalli | 34b585f | 2013-10-01 15:49:05 -0700 | [diff] [blame] | 138 | |
| 139 | session = (struct voice_session *)voice_get_session_from_use_case(adev, usecase_id); |
Haynes Mathew George | b51ceb1 | 2014-06-30 13:56:18 -0700 | [diff] [blame] | 140 | if (!session) { |
| 141 | ALOGE("stop_call: couldn't find voice session"); |
| 142 | return -EINVAL; |
| 143 | } |
| 144 | |
Bhalchandra Gajare | 45fee28 | 2015-06-09 22:23:45 -0700 | [diff] [blame] | 145 | uc_info = get_usecase_from_list(adev, usecase_id); |
| 146 | if (uc_info == NULL) { |
| 147 | ALOGE("%s: Could not find the usecase (%d) in the list", |
| 148 | __func__, usecase_id); |
| 149 | return -EINVAL; |
| 150 | } |
| 151 | |
Shiv Maliyappanahalli | 34b585f | 2013-10-01 15:49:05 -0700 | [diff] [blame] | 152 | session->state.current = CALL_INACTIVE; |
| 153 | |
Bhalchandra Gajare | 45fee28 | 2015-06-09 22:23:45 -0700 | [diff] [blame] | 154 | /* Disable sidetone only when no calls are active */ |
| 155 | if (!voice_is_call_state_active(adev)) |
| 156 | voice_set_sidetone(adev, uc_info->out_snd_device, false); |
| 157 | |
Vidyakumar Athota | ea269c6 | 2016-10-31 09:05:59 -0700 | [diff] [blame] | 158 | /* Disable aanc only when no calls are active */ |
| 159 | if (!voice_is_call_state_active(adev)) |
| 160 | voice_check_and_update_aanc_path(adev, uc_info->out_snd_device, false); |
| 161 | |
Vidyakumar Athota | d9d9ff3 | 2013-11-13 11:46:52 -0800 | [diff] [blame] | 162 | ret = platform_stop_voice_call(adev->platform, session->vsid); |
Shiv Maliyappanahalli | 34b585f | 2013-10-01 15:49:05 -0700 | [diff] [blame] | 163 | |
| 164 | /* 1. Close the PCM devices */ |
| 165 | if (session->pcm_rx) { |
| 166 | pcm_close(session->pcm_rx); |
| 167 | session->pcm_rx = NULL; |
| 168 | } |
| 169 | if (session->pcm_tx) { |
| 170 | pcm_close(session->pcm_tx); |
| 171 | session->pcm_tx = NULL; |
| 172 | } |
| 173 | |
Shiv Maliyappanahalli | 34b585f | 2013-10-01 15:49:05 -0700 | [diff] [blame] | 174 | /* 2. Get and set stream specific mixer controls */ |
Haynes Mathew George | 1376ca6 | 2014-04-24 11:55:48 -0700 | [diff] [blame] | 175 | disable_audio_route(adev, uc_info); |
Shiv Maliyappanahalli | 34b585f | 2013-10-01 15:49:05 -0700 | [diff] [blame] | 176 | |
| 177 | /* 3. Disable the rx and tx devices */ |
Haynes Mathew George | 1376ca6 | 2014-04-24 11:55:48 -0700 | [diff] [blame] | 178 | disable_snd_device(adev, uc_info->out_snd_device); |
| 179 | disable_snd_device(adev, uc_info->in_snd_device); |
Shiv Maliyappanahalli | 34b585f | 2013-10-01 15:49:05 -0700 | [diff] [blame] | 180 | |
| 181 | list_remove(&uc_info->list); |
| 182 | free(uc_info); |
| 183 | |
| 184 | ALOGD("%s: exit: status(%d)", __func__, ret); |
| 185 | return ret; |
| 186 | } |
| 187 | |
Ravi Kumar Alamanda | 263d80c | 2014-08-20 16:24:38 -0700 | [diff] [blame] | 188 | int voice_start_usecase(struct audio_device *adev, audio_usecase_t usecase_id) |
Shiv Maliyappanahalli | 34b585f | 2013-10-01 15:49:05 -0700 | [diff] [blame] | 189 | { |
Satya Krishna Pindiproli | f1cd92b | 2016-04-14 19:05:23 +0530 | [diff] [blame] | 190 | int ret = 0; |
Shiv Maliyappanahalli | 34b585f | 2013-10-01 15:49:05 -0700 | [diff] [blame] | 191 | struct audio_usecase *uc_info; |
| 192 | int pcm_dev_rx_id, pcm_dev_tx_id; |
Helen Zeng | 6a16ad7 | 2014-02-23 22:04:44 -0800 | [diff] [blame] | 193 | uint32_t sample_rate = 8000; |
Shiv Maliyappanahalli | 34b585f | 2013-10-01 15:49:05 -0700 | [diff] [blame] | 194 | struct voice_session *session = NULL; |
Shiv Maliyappanahalli | da10764 | 2013-10-17 11:16:13 -0700 | [diff] [blame] | 195 | struct pcm_config voice_config = pcm_config_voice_call; |
Shiv Maliyappanahalli | 3bb7358 | 2013-11-05 12:49:15 -0800 | [diff] [blame] | 196 | |
| 197 | ALOGD("%s: enter usecase:%s", __func__, use_case_table[usecase_id]); |
Shiv Maliyappanahalli | 34b585f | 2013-10-01 15:49:05 -0700 | [diff] [blame] | 198 | |
| 199 | session = (struct voice_session *)voice_get_session_from_use_case(adev, usecase_id); |
Haynes Mathew George | b51ceb1 | 2014-06-30 13:56:18 -0700 | [diff] [blame] | 200 | if (!session) { |
| 201 | ALOGE("start_call: couldn't find voice session"); |
| 202 | return -EINVAL; |
| 203 | } |
| 204 | |
Shiv Maliyappanahalli | 34b585f | 2013-10-01 15:49:05 -0700 | [diff] [blame] | 205 | uc_info = (struct audio_usecase *)calloc(1, sizeof(struct audio_usecase)); |
Haynes Mathew George | b51ceb1 | 2014-06-30 13:56:18 -0700 | [diff] [blame] | 206 | if (!uc_info) { |
| 207 | ALOGE("start_call: couldn't allocate mem for audio_usecase"); |
| 208 | return -ENOMEM; |
| 209 | } |
| 210 | |
Shiv Maliyappanahalli | 34b585f | 2013-10-01 15:49:05 -0700 | [diff] [blame] | 211 | uc_info->id = usecase_id; |
| 212 | uc_info->type = VOICE_CALL; |
Ravi Kumar Alamanda | 060bc5a | 2014-09-05 13:51:35 -0700 | [diff] [blame] | 213 | uc_info->stream.out = adev->current_call_output ; |
| 214 | uc_info->devices = adev->current_call_output ->devices; |
Shiv Maliyappanahalli | 34b585f | 2013-10-01 15:49:05 -0700 | [diff] [blame] | 215 | uc_info->in_snd_device = SND_DEVICE_NONE; |
| 216 | uc_info->out_snd_device = SND_DEVICE_NONE; |
| 217 | |
| 218 | list_add_tail(&adev->usecase_list, &uc_info->list); |
| 219 | |
| 220 | select_devices(adev, usecase_id); |
| 221 | |
| 222 | pcm_dev_rx_id = platform_get_pcm_device_id(uc_info->id, PCM_PLAYBACK); |
| 223 | pcm_dev_tx_id = platform_get_pcm_device_id(uc_info->id, PCM_CAPTURE); |
| 224 | |
| 225 | if (pcm_dev_rx_id < 0 || pcm_dev_tx_id < 0) { |
| 226 | ALOGE("%s: Invalid PCM devices (rx: %d tx: %d) for the usecase(%d)", |
| 227 | __func__, pcm_dev_rx_id, pcm_dev_tx_id, uc_info->id); |
| 228 | ret = -EIO; |
| 229 | goto error_start_voice; |
| 230 | } |
Helen Zeng | 6a16ad7 | 2014-02-23 22:04:44 -0800 | [diff] [blame] | 231 | ret = platform_get_sample_rate(adev->platform, &sample_rate); |
| 232 | if (ret < 0) { |
| 233 | ALOGE("platform_get_sample_rate error %d\n", ret); |
| 234 | } else { |
| 235 | voice_config.rate = sample_rate; |
| 236 | } |
| 237 | ALOGD("voice_config.rate %d\n", voice_config.rate); |
Shiv Maliyappanahalli | 34b585f | 2013-10-01 15:49:05 -0700 | [diff] [blame] | 238 | |
Vidyakumar Athota | b000e0b | 2015-04-09 17:45:20 -0700 | [diff] [blame] | 239 | voice_set_mic_mute(adev, adev->voice.mic_mute); |
| 240 | |
Bhalchandra Gajare | 45fee28 | 2015-06-09 22:23:45 -0700 | [diff] [blame] | 241 | ALOGV("%s: Opening PCM capture device card_id(%d) device_id(%d)", |
| 242 | __func__, adev->snd_card, pcm_dev_tx_id); |
| 243 | session->pcm_tx = pcm_open(adev->snd_card, |
| 244 | pcm_dev_tx_id, |
| 245 | PCM_IN, &voice_config); |
| 246 | if (session->pcm_tx && !pcm_is_ready(session->pcm_tx)) { |
| 247 | ALOGE("%s: %s", __func__, pcm_get_error(session->pcm_tx)); |
| 248 | ret = -EIO; |
| 249 | goto error_start_voice; |
| 250 | } |
| 251 | |
Shiv Maliyappanahalli | 34b585f | 2013-10-01 15:49:05 -0700 | [diff] [blame] | 252 | ALOGV("%s: Opening PCM playback device card_id(%d) device_id(%d)", |
Apoorv Raghuvanshi | 84fa2fe | 2013-12-04 11:57:47 -0800 | [diff] [blame] | 253 | __func__, adev->snd_card, pcm_dev_rx_id); |
| 254 | session->pcm_rx = pcm_open(adev->snd_card, |
Shiv Maliyappanahalli | 34b585f | 2013-10-01 15:49:05 -0700 | [diff] [blame] | 255 | pcm_dev_rx_id, |
Shiv Maliyappanahalli | da10764 | 2013-10-17 11:16:13 -0700 | [diff] [blame] | 256 | PCM_OUT, &voice_config); |
Shiv Maliyappanahalli | 34b585f | 2013-10-01 15:49:05 -0700 | [diff] [blame] | 257 | if (session->pcm_rx && !pcm_is_ready(session->pcm_rx)) { |
| 258 | ALOGE("%s: %s", __func__, pcm_get_error(session->pcm_rx)); |
| 259 | ret = -EIO; |
| 260 | goto error_start_voice; |
| 261 | } |
| 262 | |
Shiv Maliyappanahalli | 34b585f | 2013-10-01 15:49:05 -0700 | [diff] [blame] | 263 | pcm_start(session->pcm_tx); |
Bhalchandra Gajare | 45fee28 | 2015-06-09 22:23:45 -0700 | [diff] [blame] | 264 | pcm_start(session->pcm_rx); |
| 265 | |
Vidyakumar Athota | ea269c6 | 2016-10-31 09:05:59 -0700 | [diff] [blame] | 266 | /* Enable aanc only when no calls are active */ |
| 267 | if (!voice_is_call_state_active(adev)) |
| 268 | voice_check_and_update_aanc_path(adev, uc_info->out_snd_device, true); |
| 269 | |
Bhalchandra Gajare | 45fee28 | 2015-06-09 22:23:45 -0700 | [diff] [blame] | 270 | /* Enable sidetone only when no calls are already active */ |
| 271 | if (!voice_is_call_state_active(adev)) |
| 272 | voice_set_sidetone(adev, uc_info->out_snd_device, true); |
Shiv Maliyappanahalli | 34b585f | 2013-10-01 15:49:05 -0700 | [diff] [blame] | 273 | |
Shruthi Krishna | ace1085 | 2013-10-25 14:32:12 -0700 | [diff] [blame] | 274 | voice_set_volume(adev, adev->voice.volume); |
| 275 | |
Vidyakumar Athota | d9d9ff3 | 2013-11-13 11:46:52 -0800 | [diff] [blame] | 276 | ret = platform_start_voice_call(adev->platform, session->vsid); |
Shiv Maliyappanahalli | 34b585f | 2013-10-01 15:49:05 -0700 | [diff] [blame] | 277 | if (ret < 0) { |
| 278 | ALOGE("%s: platform_start_voice_call error %d\n", __func__, ret); |
| 279 | goto error_start_voice; |
| 280 | } |
| 281 | |
| 282 | session->state.current = CALL_ACTIVE; |
Vidyakumar Athota | ad34d57 | 2014-08-05 18:20:42 -0700 | [diff] [blame] | 283 | goto done; |
Shiv Maliyappanahalli | 34b585f | 2013-10-01 15:49:05 -0700 | [diff] [blame] | 284 | |
| 285 | error_start_voice: |
Ravi Kumar Alamanda | 263d80c | 2014-08-20 16:24:38 -0700 | [diff] [blame] | 286 | voice_stop_usecase(adev, usecase_id); |
Shiv Maliyappanahalli | 34b585f | 2013-10-01 15:49:05 -0700 | [diff] [blame] | 287 | |
Vidyakumar Athota | ad34d57 | 2014-08-05 18:20:42 -0700 | [diff] [blame] | 288 | done: |
Shiv Maliyappanahalli | 34b585f | 2013-10-01 15:49:05 -0700 | [diff] [blame] | 289 | ALOGD("%s: exit: status(%d)", __func__, ret); |
| 290 | return ret; |
| 291 | } |
| 292 | |
Vidyakumar Athota | ad34d57 | 2014-08-05 18:20:42 -0700 | [diff] [blame] | 293 | bool voice_is_call_state_active(struct audio_device *adev) |
Shiv Maliyappanahalli | 34b585f | 2013-10-01 15:49:05 -0700 | [diff] [blame] | 294 | { |
Vidyakumar Athota | ad34d57 | 2014-08-05 18:20:42 -0700 | [diff] [blame] | 295 | bool call_state = false; |
Shiv Maliyappanahalli | 34b585f | 2013-10-01 15:49:05 -0700 | [diff] [blame] | 296 | int ret = 0; |
| 297 | |
Vidyakumar Athota | ad34d57 | 2014-08-05 18:20:42 -0700 | [diff] [blame] | 298 | ret = voice_extn_is_call_state_active(adev, &call_state); |
Shiv Maliyappanahalli | 34b585f | 2013-10-01 15:49:05 -0700 | [diff] [blame] | 299 | if (ret == -ENOSYS) { |
Vidyakumar Athota | ad34d57 | 2014-08-05 18:20:42 -0700 | [diff] [blame] | 300 | call_state = (adev->voice.session[VOICE_SESS_IDX].state.current == CALL_ACTIVE) ? true : false; |
Shiv Maliyappanahalli | 34b585f | 2013-10-01 15:49:05 -0700 | [diff] [blame] | 301 | } |
| 302 | |
Vidyakumar Athota | ad34d57 | 2014-08-05 18:20:42 -0700 | [diff] [blame] | 303 | return call_state; |
Shiv Maliyappanahalli | 34b585f | 2013-10-01 15:49:05 -0700 | [diff] [blame] | 304 | } |
| 305 | |
Alexy Joseph | b137994 | 2016-01-29 15:49:38 -0800 | [diff] [blame] | 306 | bool voice_is_in_call(const struct audio_device *adev) |
Ravi Kumar Alamanda | 060bc5a | 2014-09-05 13:51:35 -0700 | [diff] [blame] | 307 | { |
| 308 | return adev->voice.in_call; |
| 309 | } |
| 310 | |
Alexy Joseph | b137994 | 2016-01-29 15:49:38 -0800 | [diff] [blame] | 311 | bool voice_is_in_call_rec_stream(const struct stream_in *in) |
kunleiz | c5a639b | 2014-04-24 18:46:22 +0800 | [diff] [blame] | 312 | { |
| 313 | bool in_call_rec = false; |
kunleiz | c5a639b | 2014-04-24 18:46:22 +0800 | [diff] [blame] | 314 | |
Anish Kumar | 50ebcbf | 2014-12-09 04:01:39 +0530 | [diff] [blame] | 315 | if (!in) { |
| 316 | ALOGE("%s: input stream is NULL", __func__); |
| 317 | return in_call_rec; |
| 318 | } |
| 319 | |
Narsinga Rao Chella | d06b098 | 2014-11-20 16:59:57 -0800 | [diff] [blame] | 320 | if(in->source == AUDIO_SOURCE_VOICE_DOWNLINK || |
| 321 | in->source == AUDIO_SOURCE_VOICE_UPLINK || |
| 322 | in->source == AUDIO_SOURCE_VOICE_CALL) { |
| 323 | in_call_rec = true; |
kunleiz | c5a639b | 2014-04-24 18:46:22 +0800 | [diff] [blame] | 324 | } |
| 325 | |
| 326 | return in_call_rec; |
| 327 | } |
| 328 | |
Shiv Maliyappanahalli | da10764 | 2013-10-17 11:16:13 -0700 | [diff] [blame] | 329 | uint32_t voice_get_active_session_id(struct audio_device *adev) |
| 330 | { |
| 331 | int ret = 0; |
| 332 | uint32_t session_id; |
| 333 | |
| 334 | ret = voice_extn_get_active_session_id(adev, &session_id); |
| 335 | if (ret == -ENOSYS) { |
| 336 | session_id = VOICE_VSID; |
| 337 | } |
| 338 | return session_id; |
| 339 | } |
| 340 | |
| 341 | int voice_check_and_set_incall_rec_usecase(struct audio_device *adev, |
Vidyakumar Athota | 2850d53 | 2013-11-19 16:02:12 -0800 | [diff] [blame] | 342 | struct stream_in *in) |
Shiv Maliyappanahalli | da10764 | 2013-10-17 11:16:13 -0700 | [diff] [blame] | 343 | { |
| 344 | int ret = 0; |
| 345 | uint32_t session_id; |
Vidyakumar Athota | 2850d53 | 2013-11-19 16:02:12 -0800 | [diff] [blame] | 346 | int rec_mode = INCALL_REC_NONE; |
Shiv Maliyappanahalli | da10764 | 2013-10-17 11:16:13 -0700 | [diff] [blame] | 347 | |
Vidyakumar Athota | ad34d57 | 2014-08-05 18:20:42 -0700 | [diff] [blame] | 348 | if (voice_is_call_state_active(adev)) { |
Shiv Maliyappanahalli | da10764 | 2013-10-17 11:16:13 -0700 | [diff] [blame] | 349 | switch (in->source) { |
| 350 | case AUDIO_SOURCE_VOICE_UPLINK: |
Helen Zeng | e56b485 | 2013-12-03 16:54:40 -0800 | [diff] [blame] | 351 | if (audio_extn_compr_cap_enabled() && |
| 352 | audio_extn_compr_cap_format_supported(in->config.format)) { |
| 353 | in->usecase = USECASE_INCALL_REC_UPLINK_COMPRESS; |
| 354 | } else |
| 355 | in->usecase = USECASE_INCALL_REC_UPLINK; |
Vidyakumar Athota | 2850d53 | 2013-11-19 16:02:12 -0800 | [diff] [blame] | 356 | rec_mode = INCALL_REC_UPLINK; |
Shiv Maliyappanahalli | da10764 | 2013-10-17 11:16:13 -0700 | [diff] [blame] | 357 | break; |
| 358 | case AUDIO_SOURCE_VOICE_DOWNLINK: |
Helen Zeng | e56b485 | 2013-12-03 16:54:40 -0800 | [diff] [blame] | 359 | if (audio_extn_compr_cap_enabled() && |
| 360 | audio_extn_compr_cap_format_supported(in->config.format)) { |
| 361 | in->usecase = USECASE_INCALL_REC_DOWNLINK_COMPRESS; |
| 362 | } else |
| 363 | in->usecase = USECASE_INCALL_REC_DOWNLINK; |
Vidyakumar Athota | 2850d53 | 2013-11-19 16:02:12 -0800 | [diff] [blame] | 364 | rec_mode = INCALL_REC_DOWNLINK; |
Shiv Maliyappanahalli | da10764 | 2013-10-17 11:16:13 -0700 | [diff] [blame] | 365 | break; |
| 366 | case AUDIO_SOURCE_VOICE_CALL: |
Helen Zeng | e56b485 | 2013-12-03 16:54:40 -0800 | [diff] [blame] | 367 | if (audio_extn_compr_cap_enabled() && |
| 368 | audio_extn_compr_cap_format_supported(in->config.format)) { |
| 369 | in->usecase = USECASE_INCALL_REC_UPLINK_AND_DOWNLINK_COMPRESS; |
| 370 | } else |
| 371 | in->usecase = USECASE_INCALL_REC_UPLINK_AND_DOWNLINK; |
Vidyakumar Athota | 2850d53 | 2013-11-19 16:02:12 -0800 | [diff] [blame] | 372 | rec_mode = INCALL_REC_UPLINK_AND_DOWNLINK; |
Shiv Maliyappanahalli | da10764 | 2013-10-17 11:16:13 -0700 | [diff] [blame] | 373 | break; |
| 374 | default: |
| 375 | ALOGV("%s: Source type %d doesnt match incall recording criteria", |
| 376 | __func__, in->source); |
| 377 | return ret; |
| 378 | } |
| 379 | |
Shiv Maliyappanahalli | da10764 | 2013-10-17 11:16:13 -0700 | [diff] [blame] | 380 | session_id = voice_get_active_session_id(adev); |
Vidyakumar Athota | 2850d53 | 2013-11-19 16:02:12 -0800 | [diff] [blame] | 381 | ret = platform_set_incall_recording_session_id(adev->platform, |
| 382 | session_id, rec_mode); |
Shiv Maliyappanahalli | da10764 | 2013-10-17 11:16:13 -0700 | [diff] [blame] | 383 | ALOGV("%s: Update usecase to %d",__func__, in->usecase); |
| 384 | } else { |
Venkata Narendra Kumar Gutta | 76440ba | 2015-03-30 19:16:14 +0530 | [diff] [blame] | 385 | /* |
| 386 | * Reject the recording instances, where the recording is started |
| 387 | * with In-call voice recording source types but voice call is not |
| 388 | * active by the time input is started |
| 389 | */ |
| 390 | if ((in->source == AUDIO_SOURCE_VOICE_UPLINK) || |
| 391 | (in->source == AUDIO_SOURCE_VOICE_DOWNLINK) || |
| 392 | (in->source == AUDIO_SOURCE_VOICE_CALL)) { |
| 393 | ret = -EINVAL; |
| 394 | ALOGE("%s: As voice call is not active, Incall rec usecase can't be \ |
| 395 | selected for requested source:%d",__func__, in->source); |
| 396 | } |
Shiv Maliyappanahalli | da10764 | 2013-10-17 11:16:13 -0700 | [diff] [blame] | 397 | ALOGV("%s: voice call not active", __func__); |
| 398 | } |
| 399 | |
| 400 | return ret; |
| 401 | } |
| 402 | |
Vidyakumar Athota | 2850d53 | 2013-11-19 16:02:12 -0800 | [diff] [blame] | 403 | int voice_check_and_stop_incall_rec_usecase(struct audio_device *adev, |
| 404 | struct stream_in *in) |
| 405 | { |
| 406 | int ret = 0; |
| 407 | |
| 408 | if (in->source == AUDIO_SOURCE_VOICE_UPLINK || |
| 409 | in->source == AUDIO_SOURCE_VOICE_DOWNLINK || |
| 410 | in->source == AUDIO_SOURCE_VOICE_CALL) { |
| 411 | ret = platform_stop_incall_recording_usecase(adev->platform); |
| 412 | ALOGV("%s: Stop In-call recording", __func__); |
| 413 | } |
| 414 | |
| 415 | return ret; |
| 416 | } |
| 417 | |
Narsinga Rao Chella | 212e254 | 2014-11-17 19:57:04 -0800 | [diff] [blame] | 418 | snd_device_t voice_get_incall_rec_snd_device(snd_device_t in_snd_device) |
| 419 | { |
| 420 | snd_device_t incall_record_device = in_snd_device; |
| 421 | |
| 422 | /* |
| 423 | * For incall recording stream, AUDIO_COPP topology will be picked up |
| 424 | * from the calibration data of the input sound device which is nothing |
| 425 | * but the voice call's input device. But there are requirements to use |
| 426 | * AUDIO_COPP_MONO topology even if the voice call's input device is |
| 427 | * different. Hence override the input device with the one which uses |
| 428 | * the AUDIO_COPP_MONO topology. |
| 429 | */ |
| 430 | switch(in_snd_device) { |
| 431 | case SND_DEVICE_IN_HANDSET_MIC: |
| 432 | case SND_DEVICE_IN_VOICE_DMIC: |
| 433 | case SND_DEVICE_IN_AANC_HANDSET_MIC: |
| 434 | incall_record_device = SND_DEVICE_IN_HANDSET_MIC; |
Shiv Maliyappanahalli | 4d2d97c | 2015-02-19 14:29:01 -0800 | [diff] [blame] | 435 | break; |
Narsinga Rao Chella | 212e254 | 2014-11-17 19:57:04 -0800 | [diff] [blame] | 436 | case SND_DEVICE_IN_VOICE_SPEAKER_MIC: |
| 437 | case SND_DEVICE_IN_VOICE_SPEAKER_DMIC: |
| 438 | case SND_DEVICE_IN_VOICE_SPEAKER_DMIC_BROADSIDE: |
| 439 | case SND_DEVICE_IN_VOICE_SPEAKER_QMIC: |
| 440 | incall_record_device = SND_DEVICE_IN_VOICE_SPEAKER_MIC; |
Shiv Maliyappanahalli | 4d2d97c | 2015-02-19 14:29:01 -0800 | [diff] [blame] | 441 | break; |
Narsinga Rao Chella | 212e254 | 2014-11-17 19:57:04 -0800 | [diff] [blame] | 442 | default: |
| 443 | incall_record_device = in_snd_device; |
| 444 | } |
| 445 | |
Shiv Maliyappanahalli | 4d2d97c | 2015-02-19 14:29:01 -0800 | [diff] [blame] | 446 | ALOGD("%s: in_snd_device(%d: %s) incall_record_device(%d: %s)", __func__, |
| 447 | in_snd_device, platform_get_snd_device_name(in_snd_device), |
| 448 | incall_record_device, platform_get_snd_device_name(incall_record_device)); |
| 449 | |
Narsinga Rao Chella | 212e254 | 2014-11-17 19:57:04 -0800 | [diff] [blame] | 450 | return incall_record_device; |
| 451 | } |
| 452 | |
Shiv Maliyappanahalli | 34b585f | 2013-10-01 15:49:05 -0700 | [diff] [blame] | 453 | int voice_set_mic_mute(struct audio_device *adev, bool state) |
| 454 | { |
| 455 | int err = 0; |
| 456 | |
Narsinga Rao Chella | 05573b7 | 2013-11-15 15:21:40 -0800 | [diff] [blame] | 457 | adev->voice.mic_mute = state; |
Dhanalakshmi Siddani | 823dc5a | 2016-09-28 14:47:26 +0530 | [diff] [blame] | 458 | if (audio_extn_hfp_is_active(adev)) { |
| 459 | err = hfp_set_mic_mute(adev, state); |
| 460 | } else if (adev->mode == AUDIO_MODE_IN_CALL) { |
Narsinga Rao Chella | 05573b7 | 2013-11-15 15:21:40 -0800 | [diff] [blame] | 461 | err = platform_set_mic_mute(adev->platform, state); |
Dhanalakshmi Siddani | 823dc5a | 2016-09-28 14:47:26 +0530 | [diff] [blame] | 462 | } else if (adev->mode == AUDIO_MODE_IN_COMMUNICATION) { |
Narsinga Rao Chella | 05573b7 | 2013-11-15 15:21:40 -0800 | [diff] [blame] | 463 | err = voice_extn_compress_voip_set_mic_mute(adev, state); |
Dhanalakshmi Siddani | 823dc5a | 2016-09-28 14:47:26 +0530 | [diff] [blame] | 464 | } |
Shiv Maliyappanahalli | 34b585f | 2013-10-01 15:49:05 -0700 | [diff] [blame] | 465 | return err; |
| 466 | } |
| 467 | |
| 468 | bool voice_get_mic_mute(struct audio_device *adev) |
| 469 | { |
| 470 | return adev->voice.mic_mute; |
| 471 | } |
| 472 | |
| 473 | int voice_set_volume(struct audio_device *adev, float volume) |
| 474 | { |
| 475 | int vol, err = 0; |
| 476 | |
Shruthi Krishna | ace1085 | 2013-10-25 14:32:12 -0700 | [diff] [blame] | 477 | adev->voice.volume = volume; |
Shiv Maliyappanahalli | 34b585f | 2013-10-01 15:49:05 -0700 | [diff] [blame] | 478 | if (adev->mode == AUDIO_MODE_IN_CALL) { |
| 479 | if (volume < 0.0) { |
| 480 | volume = 0.0; |
| 481 | } else if (volume > 1.0) { |
| 482 | volume = 1.0; |
| 483 | } |
| 484 | |
| 485 | vol = lrint(volume * 100.0); |
| 486 | |
| 487 | // Voice volume levels from android are mapped to driver volume levels as follows. |
| 488 | // 0 -> 5, 20 -> 4, 40 ->3, 60 -> 2, 80 -> 1, 100 -> 0 |
| 489 | // So adjust the volume to get the correct volume index in driver |
| 490 | vol = 100 - vol; |
| 491 | |
| 492 | err = platform_set_voice_volume(adev->platform, vol); |
Shiv Maliyappanahalli | 34b585f | 2013-10-01 15:49:05 -0700 | [diff] [blame] | 493 | } |
Narsinga Rao Chella | 05573b7 | 2013-11-15 15:21:40 -0800 | [diff] [blame] | 494 | if (adev->mode == AUDIO_MODE_IN_COMMUNICATION) |
| 495 | err = voice_extn_compress_voip_set_volume(adev, volume); |
| 496 | |
Shruthi Krishna | ace1085 | 2013-10-25 14:32:12 -0700 | [diff] [blame] | 497 | |
Shiv Maliyappanahalli | 34b585f | 2013-10-01 15:49:05 -0700 | [diff] [blame] | 498 | return err; |
| 499 | } |
| 500 | |
| 501 | int voice_start_call(struct audio_device *adev) |
| 502 | { |
| 503 | int ret = 0; |
| 504 | |
Ravi Kumar Alamanda | be14939 | 2014-10-20 17:07:43 -0700 | [diff] [blame] | 505 | adev->voice.in_call = true; |
Shiv Maliyappanahalli | 3bb7358 | 2013-11-05 12:49:15 -0800 | [diff] [blame] | 506 | ret = voice_extn_start_call(adev); |
Shiv Maliyappanahalli | 34b585f | 2013-10-01 15:49:05 -0700 | [diff] [blame] | 507 | if (ret == -ENOSYS) { |
Ravi Kumar Alamanda | 263d80c | 2014-08-20 16:24:38 -0700 | [diff] [blame] | 508 | ret = voice_start_usecase(adev, USECASE_VOICE_CALL); |
Shiv Maliyappanahalli | 34b585f | 2013-10-01 15:49:05 -0700 | [diff] [blame] | 509 | } |
| 510 | |
| 511 | return ret; |
| 512 | } |
| 513 | |
| 514 | int voice_stop_call(struct audio_device *adev) |
| 515 | { |
| 516 | int ret = 0; |
| 517 | |
Vidyakumar Athota | ad34d57 | 2014-08-05 18:20:42 -0700 | [diff] [blame] | 518 | adev->voice.in_call = false; |
Shiv Maliyappanahalli | 3bb7358 | 2013-11-05 12:49:15 -0800 | [diff] [blame] | 519 | ret = voice_extn_stop_call(adev); |
Shiv Maliyappanahalli | 34b585f | 2013-10-01 15:49:05 -0700 | [diff] [blame] | 520 | if (ret == -ENOSYS) { |
Ravi Kumar Alamanda | 263d80c | 2014-08-20 16:24:38 -0700 | [diff] [blame] | 521 | ret = voice_stop_usecase(adev, USECASE_VOICE_CALL); |
Shiv Maliyappanahalli | 34b585f | 2013-10-01 15:49:05 -0700 | [diff] [blame] | 522 | } |
| 523 | |
| 524 | return ret; |
| 525 | } |
| 526 | |
Shiv Maliyappanahalli | f930849 | 2013-12-12 12:18:09 -0800 | [diff] [blame] | 527 | void voice_get_parameters(struct audio_device *adev, |
| 528 | struct str_parms *query, |
| 529 | struct str_parms *reply) |
| 530 | { |
| 531 | voice_extn_get_parameters(adev, query, reply); |
| 532 | } |
| 533 | |
Shiv Maliyappanahalli | 34b585f | 2013-10-01 15:49:05 -0700 | [diff] [blame] | 534 | int voice_set_parameters(struct audio_device *adev, struct str_parms *parms) |
| 535 | { |
Shiv Maliyappanahalli | 34b585f | 2013-10-01 15:49:05 -0700 | [diff] [blame] | 536 | char value[32]; |
Shiv Maliyappanahalli | 3e064fd | 2013-12-16 15:54:40 -0800 | [diff] [blame] | 537 | int ret = 0, err; |
Krishnankutty Kolathappilly | 061a949 | 2014-01-31 18:12:13 -0800 | [diff] [blame] | 538 | char *kv_pairs = str_parms_to_str(parms); |
Shiv Maliyappanahalli | 34b585f | 2013-10-01 15:49:05 -0700 | [diff] [blame] | 539 | |
Krishnankutty Kolathappilly | 061a949 | 2014-01-31 18:12:13 -0800 | [diff] [blame] | 540 | ALOGV_IF(kv_pairs != NULL, "%s: enter: %s", __func__, kv_pairs); |
Shiv Maliyappanahalli | 34b585f | 2013-10-01 15:49:05 -0700 | [diff] [blame] | 541 | |
Shiv Maliyappanahalli | 3e064fd | 2013-12-16 15:54:40 -0800 | [diff] [blame] | 542 | ret = voice_extn_set_parameters(adev, parms); |
Vidyakumar Athota | 8d931f0 | 2014-07-21 14:51:44 -0700 | [diff] [blame] | 543 | if (ret != 0) { |
| 544 | if (ret == -ENOSYS) |
| 545 | ret = 0; |
| 546 | else |
| 547 | goto done; |
| 548 | } |
Shiv Maliyappanahalli | 34b585f | 2013-10-01 15:49:05 -0700 | [diff] [blame] | 549 | |
Shiv Maliyappanahalli | 3e064fd | 2013-12-16 15:54:40 -0800 | [diff] [blame] | 550 | ret = voice_extn_compress_voip_set_parameters(adev, parms); |
Vidyakumar Athota | 8d931f0 | 2014-07-21 14:51:44 -0700 | [diff] [blame] | 551 | if (ret != 0) { |
| 552 | if (ret == -ENOSYS) |
| 553 | ret = 0; |
| 554 | else |
| 555 | goto done; |
| 556 | } |
Shiv Maliyappanahalli | 3e064fd | 2013-12-16 15:54:40 -0800 | [diff] [blame] | 557 | |
| 558 | err = str_parms_get_str(parms, AUDIO_PARAMETER_KEY_TTY_MODE, value, sizeof(value)); |
| 559 | if (err >= 0) { |
Shiv Maliyappanahalli | 34b585f | 2013-10-01 15:49:05 -0700 | [diff] [blame] | 560 | int tty_mode; |
| 561 | str_parms_del(parms, AUDIO_PARAMETER_KEY_TTY_MODE); |
| 562 | if (strcmp(value, AUDIO_PARAMETER_VALUE_TTY_OFF) == 0) |
| 563 | tty_mode = TTY_MODE_OFF; |
| 564 | else if (strcmp(value, AUDIO_PARAMETER_VALUE_TTY_VCO) == 0) |
| 565 | tty_mode = TTY_MODE_VCO; |
| 566 | else if (strcmp(value, AUDIO_PARAMETER_VALUE_TTY_HCO) == 0) |
| 567 | tty_mode = TTY_MODE_HCO; |
| 568 | else if (strcmp(value, AUDIO_PARAMETER_VALUE_TTY_FULL) == 0) |
| 569 | tty_mode = TTY_MODE_FULL; |
| 570 | else { |
| 571 | ret = -EINVAL; |
| 572 | goto done; |
| 573 | } |
| 574 | |
Shiv Maliyappanahalli | 34b585f | 2013-10-01 15:49:05 -0700 | [diff] [blame] | 575 | if (tty_mode != adev->voice.tty_mode) { |
| 576 | adev->voice.tty_mode = tty_mode; |
| 577 | adev->acdb_settings = (adev->acdb_settings & TTY_MODE_CLEAR) | tty_mode; |
Vidyakumar Athota | ad34d57 | 2014-08-05 18:20:42 -0700 | [diff] [blame] | 578 | if (voice_is_call_state_active(adev)) |
Narsinga Rao Chella | 22d8d7a | 2014-02-06 14:05:14 -0800 | [diff] [blame] | 579 | voice_update_devices_for_all_voice_usecases(adev); |
Shiv Maliyappanahalli | 34b585f | 2013-10-01 15:49:05 -0700 | [diff] [blame] | 580 | } |
Shiv Maliyappanahalli | 34b585f | 2013-10-01 15:49:05 -0700 | [diff] [blame] | 581 | } |
| 582 | |
Shiv Maliyappanahalli | 3e064fd | 2013-12-16 15:54:40 -0800 | [diff] [blame] | 583 | err = str_parms_get_str(parms, AUDIO_PARAMETER_KEY_INCALLMUSIC, |
Vidyakumar Athota | 2850d53 | 2013-11-19 16:02:12 -0800 | [diff] [blame] | 584 | value, sizeof(value)); |
Shiv Maliyappanahalli | 3e064fd | 2013-12-16 15:54:40 -0800 | [diff] [blame] | 585 | if (err >= 0) { |
Vidyakumar Athota | 2850d53 | 2013-11-19 16:02:12 -0800 | [diff] [blame] | 586 | str_parms_del(parms, AUDIO_PARAMETER_KEY_INCALLMUSIC); |
| 587 | if (strcmp(value, AUDIO_PARAMETER_VALUE_TRUE) == 0) |
| 588 | platform_start_incall_music_usecase(adev->platform); |
| 589 | else |
| 590 | platform_stop_incall_music_usecase(adev->platform); |
Vidyakumar Athota | 8d931f0 | 2014-07-21 14:51:44 -0700 | [diff] [blame] | 591 | } |
Vidyakumar Athota | 2850d53 | 2013-11-19 16:02:12 -0800 | [diff] [blame] | 592 | |
Shiv Maliyappanahalli | 34b585f | 2013-10-01 15:49:05 -0700 | [diff] [blame] | 593 | done: |
| 594 | ALOGV("%s: exit with code(%d)", __func__, ret); |
Krishnankutty Kolathappilly | 061a949 | 2014-01-31 18:12:13 -0800 | [diff] [blame] | 595 | free(kv_pairs); |
Shiv Maliyappanahalli | 34b585f | 2013-10-01 15:49:05 -0700 | [diff] [blame] | 596 | return ret; |
| 597 | } |
| 598 | |
| 599 | void voice_init(struct audio_device *adev) |
| 600 | { |
| 601 | int i = 0; |
| 602 | |
| 603 | memset(&adev->voice, 0, sizeof(adev->voice)); |
| 604 | adev->voice.tty_mode = TTY_MODE_OFF; |
| 605 | adev->voice.volume = 1.0f; |
| 606 | adev->voice.mic_mute = false; |
Vidyakumar Athota | ad34d57 | 2014-08-05 18:20:42 -0700 | [diff] [blame] | 607 | adev->voice.in_call = false; |
Shiv Maliyappanahalli | 34b585f | 2013-10-01 15:49:05 -0700 | [diff] [blame] | 608 | for (i = 0; i < MAX_VOICE_SESSIONS; i++) { |
| 609 | adev->voice.session[i].pcm_rx = NULL; |
| 610 | adev->voice.session[i].pcm_tx = NULL; |
| 611 | adev->voice.session[i].state.current = CALL_INACTIVE; |
| 612 | adev->voice.session[i].state.new = CALL_INACTIVE; |
Ravi Kumar Alamanda | bdf1416 | 2014-09-05 16:14:17 -0700 | [diff] [blame] | 613 | adev->voice.session[i].vsid = VOICE_VSID; |
Shiv Maliyappanahalli | 34b585f | 2013-10-01 15:49:05 -0700 | [diff] [blame] | 614 | } |
| 615 | |
| 616 | voice_extn_init(adev); |
| 617 | } |
| 618 | |
Narsinga Rao Chella | 22d8d7a | 2014-02-06 14:05:14 -0800 | [diff] [blame] | 619 | void voice_update_devices_for_all_voice_usecases(struct audio_device *adev) |
| 620 | { |
| 621 | struct listnode *node; |
| 622 | struct audio_usecase *usecase; |
| 623 | |
| 624 | list_for_each(node, &adev->usecase_list) { |
| 625 | usecase = node_to_item(node, struct audio_usecase, list); |
| 626 | if (usecase->type == VOICE_CALL) { |
| 627 | ALOGV("%s: updating device for usecase:%s", __func__, |
| 628 | use_case_table[usecase->id]); |
Ravi Kumar Alamanda | 060bc5a | 2014-09-05 13:51:35 -0700 | [diff] [blame] | 629 | usecase->stream.out = adev->current_call_output; |
Narsinga Rao Chella | 22d8d7a | 2014-02-06 14:05:14 -0800 | [diff] [blame] | 630 | select_devices(adev, usecase->id); |
| 631 | } |
| 632 | } |
| 633 | } |
| 634 | |
Shiv Maliyappanahalli | 34b585f | 2013-10-01 15:49:05 -0700 | [diff] [blame] | 635 | |