blob: aa8c29af3673c86fe882fbf5f83f5953458c4104 [file] [log] [blame]
Shiv Maliyappanahalli34b585f2013-10-01 15:49:05 -07001/*
Shiv Maliyappanahalli3e064fd2013-12-16 15:54:40 -08002 * Copyright (c) 2013-2014, The Linux Foundation. All rights reserved.
Shiv Maliyappanahalli34b585f2013-10-01 15:49:05 -07003 * Not a contribution.
4 *
Shiv Maliyappanahalli8911f282014-01-10 15:56:19 -08005 * Copyright (C) 2013 The Android Open Source Project
Shiv Maliyappanahalli34b585f2013-10-01 15:49:05 -07006 *
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>
25#include <math.h>
26#include <cutils/log.h>
27#include <cutils/str_parms.h>
28
29#include "audio_hw.h"
30#include "voice.h"
31#include "voice_extn/voice_extn.h"
32#include "platform.h"
33#include "platform_api.h"
Kiran Kandi910e1862013-10-29 13:29:42 -070034#include "audio_extn.h"
Shiv Maliyappanahalli34b585f2013-10-01 15:49:05 -070035
36struct pcm_config pcm_config_voice_call = {
37 .channels = 1,
38 .rate = 8000,
39 .period_size = 160,
40 .period_count = 2,
41 .format = PCM_FORMAT_S16_LE,
42};
43
Shiv Maliyappanahalli3bb73582013-11-05 12:49:15 -080044extern const char * const use_case_table[AUDIO_USECASE_MAX];
Shiv Maliyappanahalli34b585f2013-10-01 15:49:05 -070045
46static struct voice_session *voice_get_session_from_use_case(struct audio_device *adev,
47 audio_usecase_t usecase_id)
48{
49 struct voice_session *session = NULL;
50 int ret = 0;
51
52 ret = voice_extn_get_session_from_use_case(adev, usecase_id, &session);
53 if (ret == -ENOSYS) {
54 session = &adev->voice.session[VOICE_SESS_IDX];
55 }
56
57 return session;
58}
59
60int stop_call(struct audio_device *adev, audio_usecase_t usecase_id)
61{
62 int i, ret = 0;
63 struct audio_usecase *uc_info;
64 struct voice_session *session = NULL;
65
Shiv Maliyappanahalli3bb73582013-11-05 12:49:15 -080066 ALOGD("%s: enter usecase:%s", __func__, use_case_table[usecase_id]);
Shiv Maliyappanahalli34b585f2013-10-01 15:49:05 -070067
68 session = (struct voice_session *)voice_get_session_from_use_case(adev, usecase_id);
Haynes Mathew Georgeb51ceb12014-06-30 13:56:18 -070069 if (!session) {
70 ALOGE("stop_call: couldn't find voice session");
71 return -EINVAL;
72 }
73
Shiv Maliyappanahalli34b585f2013-10-01 15:49:05 -070074 session->state.current = CALL_INACTIVE;
Venkata Narendra Kumar Gutta5f64eea2014-05-28 17:42:10 +053075 if (adev->mode == AUDIO_MODE_NORMAL)
76 adev->voice.is_in_call = false;
Shiv Maliyappanahalli34b585f2013-10-01 15:49:05 -070077
Vidyakumar Athotad9d9ff32013-11-13 11:46:52 -080078 ret = platform_stop_voice_call(adev->platform, session->vsid);
Shiv Maliyappanahalli34b585f2013-10-01 15:49:05 -070079
80 /* 1. Close the PCM devices */
81 if (session->pcm_rx) {
82 pcm_close(session->pcm_rx);
83 session->pcm_rx = NULL;
84 }
85 if (session->pcm_tx) {
86 pcm_close(session->pcm_tx);
87 session->pcm_tx = NULL;
88 }
89
90 uc_info = get_usecase_from_list(adev, usecase_id);
91 if (uc_info == NULL) {
92 ALOGE("%s: Could not find the usecase (%d) in the list",
93 __func__, usecase_id);
94 return -EINVAL;
95 }
96
97 /* 2. Get and set stream specific mixer controls */
Haynes Mathew George1376ca62014-04-24 11:55:48 -070098 disable_audio_route(adev, uc_info);
Shiv Maliyappanahalli34b585f2013-10-01 15:49:05 -070099
100 /* 3. Disable the rx and tx devices */
Haynes Mathew George1376ca62014-04-24 11:55:48 -0700101 disable_snd_device(adev, uc_info->out_snd_device);
102 disable_snd_device(adev, uc_info->in_snd_device);
Shiv Maliyappanahalli34b585f2013-10-01 15:49:05 -0700103
104 list_remove(&uc_info->list);
105 free(uc_info);
106
107 ALOGD("%s: exit: status(%d)", __func__, ret);
108 return ret;
109}
110
111int start_call(struct audio_device *adev, audio_usecase_t usecase_id)
112{
113 int i, ret = 0;
114 struct audio_usecase *uc_info;
115 int pcm_dev_rx_id, pcm_dev_tx_id;
Helen Zeng6a16ad72014-02-23 22:04:44 -0800116 uint32_t sample_rate = 8000;
Shiv Maliyappanahalli34b585f2013-10-01 15:49:05 -0700117 struct voice_session *session = NULL;
Shiv Maliyappanahallida107642013-10-17 11:16:13 -0700118 struct pcm_config voice_config = pcm_config_voice_call;
Shiv Maliyappanahalli3bb73582013-11-05 12:49:15 -0800119
120 ALOGD("%s: enter usecase:%s", __func__, use_case_table[usecase_id]);
Shiv Maliyappanahalli34b585f2013-10-01 15:49:05 -0700121
122 session = (struct voice_session *)voice_get_session_from_use_case(adev, usecase_id);
Haynes Mathew Georgeb51ceb12014-06-30 13:56:18 -0700123 if (!session) {
124 ALOGE("start_call: couldn't find voice session");
125 return -EINVAL;
126 }
127
Shiv Maliyappanahalli34b585f2013-10-01 15:49:05 -0700128 uc_info = (struct audio_usecase *)calloc(1, sizeof(struct audio_usecase));
Haynes Mathew Georgeb51ceb12014-06-30 13:56:18 -0700129 if (!uc_info) {
130 ALOGE("start_call: couldn't allocate mem for audio_usecase");
131 return -ENOMEM;
132 }
133
Shiv Maliyappanahalli34b585f2013-10-01 15:49:05 -0700134 uc_info->id = usecase_id;
135 uc_info->type = VOICE_CALL;
136 uc_info->stream.out = adev->primary_output;
137 uc_info->devices = adev->primary_output->devices;
138 uc_info->in_snd_device = SND_DEVICE_NONE;
139 uc_info->out_snd_device = SND_DEVICE_NONE;
140
141 list_add_tail(&adev->usecase_list, &uc_info->list);
142
143 select_devices(adev, usecase_id);
144
145 pcm_dev_rx_id = platform_get_pcm_device_id(uc_info->id, PCM_PLAYBACK);
146 pcm_dev_tx_id = platform_get_pcm_device_id(uc_info->id, PCM_CAPTURE);
147
148 if (pcm_dev_rx_id < 0 || pcm_dev_tx_id < 0) {
149 ALOGE("%s: Invalid PCM devices (rx: %d tx: %d) for the usecase(%d)",
150 __func__, pcm_dev_rx_id, pcm_dev_tx_id, uc_info->id);
151 ret = -EIO;
152 goto error_start_voice;
153 }
Helen Zeng6a16ad72014-02-23 22:04:44 -0800154 ret = platform_get_sample_rate(adev->platform, &sample_rate);
155 if (ret < 0) {
156 ALOGE("platform_get_sample_rate error %d\n", ret);
157 } else {
158 voice_config.rate = sample_rate;
159 }
160 ALOGD("voice_config.rate %d\n", voice_config.rate);
Shiv Maliyappanahalli34b585f2013-10-01 15:49:05 -0700161
162 ALOGV("%s: Opening PCM playback device card_id(%d) device_id(%d)",
Apoorv Raghuvanshi84fa2fe2013-12-04 11:57:47 -0800163 __func__, adev->snd_card, pcm_dev_rx_id);
164 session->pcm_rx = pcm_open(adev->snd_card,
Shiv Maliyappanahalli34b585f2013-10-01 15:49:05 -0700165 pcm_dev_rx_id,
Shiv Maliyappanahallida107642013-10-17 11:16:13 -0700166 PCM_OUT, &voice_config);
Shiv Maliyappanahalli34b585f2013-10-01 15:49:05 -0700167 if (session->pcm_rx && !pcm_is_ready(session->pcm_rx)) {
168 ALOGE("%s: %s", __func__, pcm_get_error(session->pcm_rx));
169 ret = -EIO;
170 goto error_start_voice;
171 }
172
173 ALOGV("%s: Opening PCM capture device card_id(%d) device_id(%d)",
Apoorv Raghuvanshi84fa2fe2013-12-04 11:57:47 -0800174 __func__, adev->snd_card, pcm_dev_tx_id);
175 session->pcm_tx = pcm_open(adev->snd_card,
Shiv Maliyappanahalli34b585f2013-10-01 15:49:05 -0700176 pcm_dev_tx_id,
Shiv Maliyappanahallida107642013-10-17 11:16:13 -0700177 PCM_IN, &voice_config);
Shiv Maliyappanahalli34b585f2013-10-01 15:49:05 -0700178 if (session->pcm_tx && !pcm_is_ready(session->pcm_tx)) {
179 ALOGE("%s: %s", __func__, pcm_get_error(session->pcm_tx));
180 ret = -EIO;
181 goto error_start_voice;
182 }
183 pcm_start(session->pcm_rx);
184 pcm_start(session->pcm_tx);
185
Shruthi Krishnaace10852013-10-25 14:32:12 -0700186 voice_set_volume(adev, adev->voice.volume);
187
Vidyakumar Athotad9d9ff32013-11-13 11:46:52 -0800188 ret = platform_start_voice_call(adev->platform, session->vsid);
Shiv Maliyappanahalli34b585f2013-10-01 15:49:05 -0700189 if (ret < 0) {
190 ALOGE("%s: platform_start_voice_call error %d\n", __func__, ret);
191 goto error_start_voice;
192 }
193
194 session->state.current = CALL_ACTIVE;
195 return 0;
196
197error_start_voice:
198 stop_call(adev, usecase_id);
199
200 ALOGD("%s: exit: status(%d)", __func__, ret);
201 return ret;
202}
203
204bool voice_is_in_call(struct audio_device *adev)
205{
206 bool in_call = false;
207 int ret = 0;
208
209 ret = voice_extn_is_in_call(adev, &in_call);
210 if (ret == -ENOSYS) {
211 in_call = (adev->voice.session[VOICE_SESS_IDX].state.current == CALL_ACTIVE) ? true : false;
212 }
213
214 return in_call;
215}
216
kunleizc5a639b2014-04-24 18:46:22 +0800217bool voice_is_in_call_rec_stream(struct stream_in *in)
218{
219 bool in_call_rec = false;
220 int ret = 0;
221
222 ret = voice_extn_is_in_call_rec_stream(in, &in_call_rec);
223 if (ret == -ENOSYS) {
224 in_call_rec = false;
225 }
226
227 return in_call_rec;
228}
229
Shiv Maliyappanahallida107642013-10-17 11:16:13 -0700230uint32_t voice_get_active_session_id(struct audio_device *adev)
231{
232 int ret = 0;
233 uint32_t session_id;
234
235 ret = voice_extn_get_active_session_id(adev, &session_id);
236 if (ret == -ENOSYS) {
237 session_id = VOICE_VSID;
238 }
239 return session_id;
240}
241
242int voice_check_and_set_incall_rec_usecase(struct audio_device *adev,
Vidyakumar Athota2850d532013-11-19 16:02:12 -0800243 struct stream_in *in)
Shiv Maliyappanahallida107642013-10-17 11:16:13 -0700244{
245 int ret = 0;
246 uint32_t session_id;
247 int usecase_id;
Vidyakumar Athota2850d532013-11-19 16:02:12 -0800248 int rec_mode = INCALL_REC_NONE;
Shiv Maliyappanahallida107642013-10-17 11:16:13 -0700249
250 if (voice_is_in_call(adev)) {
251 switch (in->source) {
252 case AUDIO_SOURCE_VOICE_UPLINK:
Helen Zenge56b4852013-12-03 16:54:40 -0800253 if (audio_extn_compr_cap_enabled() &&
254 audio_extn_compr_cap_format_supported(in->config.format)) {
255 in->usecase = USECASE_INCALL_REC_UPLINK_COMPRESS;
256 } else
257 in->usecase = USECASE_INCALL_REC_UPLINK;
Vidyakumar Athota2850d532013-11-19 16:02:12 -0800258 rec_mode = INCALL_REC_UPLINK;
Shiv Maliyappanahallida107642013-10-17 11:16:13 -0700259 break;
260 case AUDIO_SOURCE_VOICE_DOWNLINK:
Helen Zenge56b4852013-12-03 16:54:40 -0800261 if (audio_extn_compr_cap_enabled() &&
262 audio_extn_compr_cap_format_supported(in->config.format)) {
263 in->usecase = USECASE_INCALL_REC_DOWNLINK_COMPRESS;
264 } else
265 in->usecase = USECASE_INCALL_REC_DOWNLINK;
Vidyakumar Athota2850d532013-11-19 16:02:12 -0800266 rec_mode = INCALL_REC_DOWNLINK;
Shiv Maliyappanahallida107642013-10-17 11:16:13 -0700267 break;
268 case AUDIO_SOURCE_VOICE_CALL:
Helen Zenge56b4852013-12-03 16:54:40 -0800269 if (audio_extn_compr_cap_enabled() &&
270 audio_extn_compr_cap_format_supported(in->config.format)) {
271 in->usecase = USECASE_INCALL_REC_UPLINK_AND_DOWNLINK_COMPRESS;
272 } else
273 in->usecase = USECASE_INCALL_REC_UPLINK_AND_DOWNLINK;
Vidyakumar Athota2850d532013-11-19 16:02:12 -0800274 rec_mode = INCALL_REC_UPLINK_AND_DOWNLINK;
Shiv Maliyappanahallida107642013-10-17 11:16:13 -0700275 break;
276 default:
277 ALOGV("%s: Source type %d doesnt match incall recording criteria",
278 __func__, in->source);
279 return ret;
280 }
281
Shiv Maliyappanahallida107642013-10-17 11:16:13 -0700282 session_id = voice_get_active_session_id(adev);
Vidyakumar Athota2850d532013-11-19 16:02:12 -0800283 ret = platform_set_incall_recording_session_id(adev->platform,
284 session_id, rec_mode);
Shiv Maliyappanahallida107642013-10-17 11:16:13 -0700285 ALOGV("%s: Update usecase to %d",__func__, in->usecase);
286 } else {
287 ALOGV("%s: voice call not active", __func__);
288 }
289
290 return ret;
291}
292
Vidyakumar Athota2850d532013-11-19 16:02:12 -0800293int voice_check_and_stop_incall_rec_usecase(struct audio_device *adev,
294 struct stream_in *in)
295{
296 int ret = 0;
297
298 if (in->source == AUDIO_SOURCE_VOICE_UPLINK ||
299 in->source == AUDIO_SOURCE_VOICE_DOWNLINK ||
300 in->source == AUDIO_SOURCE_VOICE_CALL) {
301 ret = platform_stop_incall_recording_usecase(adev->platform);
302 ALOGV("%s: Stop In-call recording", __func__);
303 }
304
305 return ret;
306}
307
Shiv Maliyappanahallif3b9a422013-10-22 16:38:08 -0700308int voice_check_and_set_incall_music_usecase(struct audio_device *adev,
309 struct stream_out *out)
310{
311 int ret = 0;
312
313 ret = voice_extn_check_and_set_incall_music_usecase(adev, out);
314 if (ret == -ENOSYS) {
315 /* Incall music delivery is used only for LCH call state */
316 ret = -EINVAL;
317 }
318
319 return ret;
320}
321
Shiv Maliyappanahalli34b585f2013-10-01 15:49:05 -0700322int voice_set_mic_mute(struct audio_device *adev, bool state)
323{
324 int err = 0;
325
Narsinga Rao Chella05573b72013-11-15 15:21:40 -0800326 adev->voice.mic_mute = state;
327 if (adev->mode == AUDIO_MODE_IN_CALL)
328 err = platform_set_mic_mute(adev->platform, state);
329 if (adev->mode == AUDIO_MODE_IN_COMMUNICATION)
330 err = voice_extn_compress_voip_set_mic_mute(adev, state);
Shiv Maliyappanahalli34b585f2013-10-01 15:49:05 -0700331
Shiv Maliyappanahalli34b585f2013-10-01 15:49:05 -0700332 return err;
333}
334
335bool voice_get_mic_mute(struct audio_device *adev)
336{
337 return adev->voice.mic_mute;
338}
339
340int voice_set_volume(struct audio_device *adev, float volume)
341{
342 int vol, err = 0;
343
Shruthi Krishnaace10852013-10-25 14:32:12 -0700344 adev->voice.volume = volume;
Shiv Maliyappanahalli34b585f2013-10-01 15:49:05 -0700345 if (adev->mode == AUDIO_MODE_IN_CALL) {
346 if (volume < 0.0) {
347 volume = 0.0;
348 } else if (volume > 1.0) {
349 volume = 1.0;
350 }
351
352 vol = lrint(volume * 100.0);
353
354 // Voice volume levels from android are mapped to driver volume levels as follows.
355 // 0 -> 5, 20 -> 4, 40 ->3, 60 -> 2, 80 -> 1, 100 -> 0
356 // So adjust the volume to get the correct volume index in driver
357 vol = 100 - vol;
358
359 err = platform_set_voice_volume(adev->platform, vol);
Shiv Maliyappanahalli34b585f2013-10-01 15:49:05 -0700360 }
Narsinga Rao Chella05573b72013-11-15 15:21:40 -0800361 if (adev->mode == AUDIO_MODE_IN_COMMUNICATION)
362 err = voice_extn_compress_voip_set_volume(adev, volume);
363
Shruthi Krishnaace10852013-10-25 14:32:12 -0700364
Shiv Maliyappanahalli34b585f2013-10-01 15:49:05 -0700365 return err;
366}
367
368int voice_start_call(struct audio_device *adev)
369{
370 int ret = 0;
371
Shiv Maliyappanahalli3bb73582013-11-05 12:49:15 -0800372 ret = voice_extn_start_call(adev);
Shiv Maliyappanahalli34b585f2013-10-01 15:49:05 -0700373 if (ret == -ENOSYS) {
374 ret = start_call(adev, USECASE_VOICE_CALL);
375 }
376
377 return ret;
378}
379
380int voice_stop_call(struct audio_device *adev)
381{
382 int ret = 0;
383
Shiv Maliyappanahalli3bb73582013-11-05 12:49:15 -0800384 ret = voice_extn_stop_call(adev);
Shiv Maliyappanahalli34b585f2013-10-01 15:49:05 -0700385 if (ret == -ENOSYS) {
386 ret = stop_call(adev, USECASE_VOICE_CALL);
387 }
388
389 return ret;
390}
391
Shiv Maliyappanahallif9308492013-12-12 12:18:09 -0800392void voice_get_parameters(struct audio_device *adev,
393 struct str_parms *query,
394 struct str_parms *reply)
395{
396 voice_extn_get_parameters(adev, query, reply);
397}
398
Shiv Maliyappanahalli34b585f2013-10-01 15:49:05 -0700399int voice_set_parameters(struct audio_device *adev, struct str_parms *parms)
400{
401 char *str;
402 char value[32];
403 int val;
Shiv Maliyappanahalli3e064fd2013-12-16 15:54:40 -0800404 int ret = 0, err;
Krishnankutty Kolathappilly061a9492014-01-31 18:12:13 -0800405 char *kv_pairs = str_parms_to_str(parms);
Shiv Maliyappanahalli34b585f2013-10-01 15:49:05 -0700406
Krishnankutty Kolathappilly061a9492014-01-31 18:12:13 -0800407 ALOGV_IF(kv_pairs != NULL, "%s: enter: %s", __func__, kv_pairs);
Shiv Maliyappanahalli34b585f2013-10-01 15:49:05 -0700408
Shiv Maliyappanahalli3e064fd2013-12-16 15:54:40 -0800409 ret = voice_extn_set_parameters(adev, parms);
410 if (ret != 0)
411 goto done;
Shiv Maliyappanahalli34b585f2013-10-01 15:49:05 -0700412
Shiv Maliyappanahalli3e064fd2013-12-16 15:54:40 -0800413 ret = voice_extn_compress_voip_set_parameters(adev, parms);
414 if (ret != 0)
415 goto done;
416
417 err = str_parms_get_str(parms, AUDIO_PARAMETER_KEY_TTY_MODE, value, sizeof(value));
418 if (err >= 0) {
Shiv Maliyappanahalli34b585f2013-10-01 15:49:05 -0700419 int tty_mode;
420 str_parms_del(parms, AUDIO_PARAMETER_KEY_TTY_MODE);
421 if (strcmp(value, AUDIO_PARAMETER_VALUE_TTY_OFF) == 0)
422 tty_mode = TTY_MODE_OFF;
423 else if (strcmp(value, AUDIO_PARAMETER_VALUE_TTY_VCO) == 0)
424 tty_mode = TTY_MODE_VCO;
425 else if (strcmp(value, AUDIO_PARAMETER_VALUE_TTY_HCO) == 0)
426 tty_mode = TTY_MODE_HCO;
427 else if (strcmp(value, AUDIO_PARAMETER_VALUE_TTY_FULL) == 0)
428 tty_mode = TTY_MODE_FULL;
429 else {
430 ret = -EINVAL;
431 goto done;
432 }
433
Shiv Maliyappanahalli34b585f2013-10-01 15:49:05 -0700434 if (tty_mode != adev->voice.tty_mode) {
435 adev->voice.tty_mode = tty_mode;
436 adev->acdb_settings = (adev->acdb_settings & TTY_MODE_CLEAR) | tty_mode;
437 if (voice_is_in_call(adev))
Narsinga Rao Chella22d8d7a2014-02-06 14:05:14 -0800438 voice_update_devices_for_all_voice_usecases(adev);
Shiv Maliyappanahalli34b585f2013-10-01 15:49:05 -0700439 }
Shiv Maliyappanahalli34b585f2013-10-01 15:49:05 -0700440 }
441
Shiv Maliyappanahalli3e064fd2013-12-16 15:54:40 -0800442 err = str_parms_get_str(parms, AUDIO_PARAMETER_KEY_INCALLMUSIC,
Vidyakumar Athota2850d532013-11-19 16:02:12 -0800443 value, sizeof(value));
Shiv Maliyappanahalli3e064fd2013-12-16 15:54:40 -0800444 if (err >= 0) {
Vidyakumar Athota2850d532013-11-19 16:02:12 -0800445 str_parms_del(parms, AUDIO_PARAMETER_KEY_INCALLMUSIC);
446 if (strcmp(value, AUDIO_PARAMETER_VALUE_TRUE) == 0)
447 platform_start_incall_music_usecase(adev->platform);
448 else
449 platform_stop_incall_music_usecase(adev->platform);
450 }
451
Shiv Maliyappanahalli34b585f2013-10-01 15:49:05 -0700452done:
453 ALOGV("%s: exit with code(%d)", __func__, ret);
Krishnankutty Kolathappilly061a9492014-01-31 18:12:13 -0800454 free(kv_pairs);
Shiv Maliyappanahalli34b585f2013-10-01 15:49:05 -0700455 return ret;
456}
457
458void voice_init(struct audio_device *adev)
459{
460 int i = 0;
461
462 memset(&adev->voice, 0, sizeof(adev->voice));
463 adev->voice.tty_mode = TTY_MODE_OFF;
464 adev->voice.volume = 1.0f;
465 adev->voice.mic_mute = false;
Shiv Maliyappanahalli07a9ea22014-01-06 14:53:52 -0800466 adev->voice.voice_device_set = false;
Shiv Maliyappanahalli34b585f2013-10-01 15:49:05 -0700467 for (i = 0; i < MAX_VOICE_SESSIONS; i++) {
468 adev->voice.session[i].pcm_rx = NULL;
469 adev->voice.session[i].pcm_tx = NULL;
470 adev->voice.session[i].state.current = CALL_INACTIVE;
471 adev->voice.session[i].state.new = CALL_INACTIVE;
472 adev->voice.session[i].vsid = 0;
473 }
474
475 voice_extn_init(adev);
476}
477
Narsinga Rao Chella22d8d7a2014-02-06 14:05:14 -0800478void voice_update_devices_for_all_voice_usecases(struct audio_device *adev)
479{
480 struct listnode *node;
481 struct audio_usecase *usecase;
482
483 list_for_each(node, &adev->usecase_list) {
484 usecase = node_to_item(node, struct audio_usecase, list);
485 if (usecase->type == VOICE_CALL) {
486 ALOGV("%s: updating device for usecase:%s", __func__,
487 use_case_table[usecase->id]);
488 select_devices(adev, usecase->id);
489 }
490 }
491}
492
Shiv Maliyappanahalli34b585f2013-10-01 15:49:05 -0700493