blob: a30b06beffa233720180b7866ed5667f38aac507 [file] [log] [blame]
Shiv Maliyappanahalli34b585f2013-10-01 15:49:05 -07001/*
Aalique Grahame22e49102018-12-18 14:23:57 -08002 * Copyright (c) 2013-2019, 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>
Sharad Sangleb27354b2015-06-18 15:58:55 +053025#include <stdlib.h>
Shiv Maliyappanahalli34b585f2013-10-01 15:49:05 -070026#include <math.h>
Aalique Grahame22e49102018-12-18 14:23:57 -080027#include <log/log.h>
Shiv Maliyappanahalli34b585f2013-10-01 15:49:05 -070028#include <cutils/str_parms.h>
Pallavi Mishra5627c162020-02-15 19:00:40 +053029#include <cutils/properties.h>
Shiv Maliyappanahalli34b585f2013-10-01 15:49:05 -070030#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 Kandi910e1862013-10-29 13:29:42 -070035#include "audio_extn.h"
Shiv Maliyappanahalli34b585f2013-10-01 15:49:05 -070036
Revathi Uddaraju1eac8b02017-05-18 17:13:33 +053037#ifdef DYNAMIC_LOG_ENABLED
38#include <log_xml_parser.h>
39#define LOG_MASK HAL_MOD_FILE_VOICE
40#include <log_utils.h>
41#endif
42
Shiv Maliyappanahalli34b585f2013-10-01 15:49:05 -070043struct pcm_config pcm_config_voice_call = {
44 .channels = 1,
45 .rate = 8000,
46 .period_size = 160,
47 .period_count = 2,
48 .format = PCM_FORMAT_S16_LE,
49};
50
Suprith Malligere Shankaregowda7400b212019-03-22 19:48:44 +053051struct pcm *voice_loopback_tx = NULL;
52struct pcm *voice_loopback_rx = NULL;
Pallavi Mishra5627c162020-02-15 19:00:40 +053053
54static bool voice_external_baseband_supported(struct audio_device *adev)
55{
56 /* If platform is apq8084 and baseband is MDM, load CSD Client specific
57 * symbols. Voice call is handled by MDM and apps processor talks to
58 * MDM through CSD Client
59 */
60 char * snd_card_name;
61 char baseband[100];
62 snd_card_name = strdup(mixer_get_name(adev->mixer));
63 property_get("ro.baseband", baseband, "");
64 if ((!strncmp("hana55", snd_card_name, sizeof("hana55"))) &&
65 ( !strncmp("mdm", baseband, (sizeof("mdm")-1)) ||
66 !strncmp("sdx", baseband, (sizeof("sdx")-1)))) {
67 return 1;
68 } else
69 return 0;
70}
71
Shiv Maliyappanahalli34b585f2013-10-01 15:49:05 -070072static struct voice_session *voice_get_session_from_use_case(struct audio_device *adev,
73 audio_usecase_t usecase_id)
74{
75 struct voice_session *session = NULL;
76 int ret = 0;
77
78 ret = voice_extn_get_session_from_use_case(adev, usecase_id, &session);
79 if (ret == -ENOSYS) {
80 session = &adev->voice.session[VOICE_SESS_IDX];
81 }
82
83 return session;
84}
85
Bhalchandra Gajare45fee282015-06-09 22:23:45 -070086static bool voice_is_sidetone_device(snd_device_t out_device,
87 char *mixer_path)
88{
89 bool is_sidetone_dev;
90
91 switch (out_device) {
92 case SND_DEVICE_OUT_VOICE_HANDSET:
93 is_sidetone_dev = true;
94 strlcpy(mixer_path, "sidetone-handset", MIXER_PATH_MAX_LENGTH);
95 break;
96 case SND_DEVICE_OUT_VOICE_HEADPHONES:
Samyak Jainfd24f1e2019-04-30 11:58:43 +053097 case SND_DEVICE_OUT_VOICE_HEADSET:
Bhalchandra Gajare45fee282015-06-09 22:23:45 -070098 case SND_DEVICE_OUT_VOICE_ANC_HEADSET:
99 case SND_DEVICE_OUT_VOICE_ANC_FB_HEADSET:
100 is_sidetone_dev = true;
101 strlcpy(mixer_path, "sidetone-headphones", MIXER_PATH_MAX_LENGTH);
102 break;
Aalique Grahame22e49102018-12-18 14:23:57 -0800103 case SND_DEVICE_OUT_VOICE_USB_HEADSET:
Kuirong Wang1cad7142016-05-24 15:21:56 -0700104 case SND_DEVICE_OUT_USB_HEADSET:
Aalique Grahame22e49102018-12-18 14:23:57 -0800105 // USB does not use a QC mixer.
106 mixer_path[0] = '\0';
Kuirong Wang1cad7142016-05-24 15:21:56 -0700107 is_sidetone_dev = true;
108 break;
Bhalchandra Gajare45fee282015-06-09 22:23:45 -0700109 default:
Aalique Grahame22e49102018-12-18 14:23:57 -0800110 ALOGW("%s: %d is not a sidetone device", __func__, out_device);
Bhalchandra Gajare45fee282015-06-09 22:23:45 -0700111 is_sidetone_dev = false;
112 break;
113 }
114
115 return is_sidetone_dev;
116}
117
118void voice_set_sidetone(struct audio_device *adev,
119 snd_device_t out_snd_device, bool enable)
120{
121 char mixer_path[MIXER_PATH_MAX_LENGTH];
Bhalchandra Gajare45fee282015-06-09 22:23:45 -0700122 ALOGD("%s: %s, out_snd_device: %d\n",
123 __func__, (enable ? "enable" : "disable"),
124 out_snd_device);
Kuirong Wang1cad7142016-05-24 15:21:56 -0700125 if (voice_is_sidetone_device(out_snd_device, mixer_path))
126 platform_set_sidetone(adev, out_snd_device, enable, mixer_path);
Bhalchandra Gajare45fee282015-06-09 22:23:45 -0700127 return;
128}
129
Vidyakumar Athotaea269c62016-10-31 09:05:59 -0700130static bool voice_is_aanc_device(snd_device_t out_device,
131 char *mixer_path)
132{
133 bool is_aanc_dev;
134
135 switch (out_device) {
136 case SND_DEVICE_OUT_ANC_HANDSET:
137 is_aanc_dev = true;
138 strlcpy(mixer_path, "aanc-path", MIXER_PATH_MAX_LENGTH);
139 break;
140 default:
141 is_aanc_dev = false;
142 break;
143 }
144
145 return is_aanc_dev;
146}
147
148void voice_check_and_update_aanc_path(struct audio_device *adev,
149 snd_device_t out_snd_device,
150 bool enable)
151{
152 char mixer_path[MIXER_PATH_MAX_LENGTH];
153
154 ALOGV("%s: %s, out_snd_device: %d\n",
155 __func__, (enable ? "enable" : "disable"), out_snd_device);
156
157 if (voice_is_aanc_device(out_snd_device, mixer_path))
158 platform_update_aanc_path(adev, out_snd_device, enable, mixer_path);
159
160 return;
161}
162
Ravi Kumar Alamanda263d80c2014-08-20 16:24:38 -0700163int voice_stop_usecase(struct audio_device *adev, audio_usecase_t usecase_id)
Shiv Maliyappanahalli34b585f2013-10-01 15:49:05 -0700164{
Satya Krishna Pindiprolif1cd92b2016-04-14 19:05:23 +0530165 int ret = 0;
Shiv Maliyappanahalli34b585f2013-10-01 15:49:05 -0700166 struct audio_usecase *uc_info;
167 struct voice_session *session = NULL;
168
Shiv Maliyappanahalli3bb73582013-11-05 12:49:15 -0800169 ALOGD("%s: enter usecase:%s", __func__, use_case_table[usecase_id]);
Shiv Maliyappanahalli34b585f2013-10-01 15:49:05 -0700170
171 session = (struct voice_session *)voice_get_session_from_use_case(adev, usecase_id);
Haynes Mathew Georgeb51ceb12014-06-30 13:56:18 -0700172 if (!session) {
173 ALOGE("stop_call: couldn't find voice session");
174 return -EINVAL;
175 }
176
Bhalchandra Gajare45fee282015-06-09 22:23:45 -0700177 uc_info = get_usecase_from_list(adev, usecase_id);
178 if (uc_info == NULL) {
179 ALOGE("%s: Could not find the usecase (%d) in the list",
180 __func__, usecase_id);
181 return -EINVAL;
182 }
183
Shiv Maliyappanahalli34b585f2013-10-01 15:49:05 -0700184 session->state.current = CALL_INACTIVE;
185
Bhalchandra Gajare45fee282015-06-09 22:23:45 -0700186 /* Disable sidetone only when no calls are active */
187 if (!voice_is_call_state_active(adev))
188 voice_set_sidetone(adev, uc_info->out_snd_device, false);
189
Vidyakumar Athotaea269c62016-10-31 09:05:59 -0700190 /* Disable aanc only when no calls are active */
191 if (!voice_is_call_state_active(adev))
192 voice_check_and_update_aanc_path(adev, uc_info->out_snd_device, false);
193
Vidyakumar Athotad9d9ff32013-11-13 11:46:52 -0800194 ret = platform_stop_voice_call(adev->platform, session->vsid);
Shiv Maliyappanahalli34b585f2013-10-01 15:49:05 -0700195
196 /* 1. Close the PCM devices */
197 if (session->pcm_rx) {
198 pcm_close(session->pcm_rx);
199 session->pcm_rx = NULL;
200 }
201 if (session->pcm_tx) {
202 pcm_close(session->pcm_tx);
203 session->pcm_tx = NULL;
204 }
205
Pallavi Mishra5627c162020-02-15 19:00:40 +0530206 if (voice_external_baseband_supported(adev)) {
207 if(voice_loopback_rx) {
208 pcm_close(voice_loopback_rx);
209 voice_loopback_rx = NULL;
210 }
211 if(voice_loopback_tx) {
212 pcm_close(voice_loopback_tx);
213 voice_loopback_tx = NULL;
214 }
Suprith Malligere Shankaregowda7400b212019-03-22 19:48:44 +0530215 }
Shiv Maliyappanahalli34b585f2013-10-01 15:49:05 -0700216 /* 2. Get and set stream specific mixer controls */
Haynes Mathew George1376ca62014-04-24 11:55:48 -0700217 disable_audio_route(adev, uc_info);
Shiv Maliyappanahalli34b585f2013-10-01 15:49:05 -0700218
219 /* 3. Disable the rx and tx devices */
Haynes Mathew George1376ca62014-04-24 11:55:48 -0700220 disable_snd_device(adev, uc_info->out_snd_device);
221 disable_snd_device(adev, uc_info->in_snd_device);
Shiv Maliyappanahalli34b585f2013-10-01 15:49:05 -0700222
223 list_remove(&uc_info->list);
224 free(uc_info);
225
226 ALOGD("%s: exit: status(%d)", __func__, ret);
227 return ret;
228}
229
Ravi Kumar Alamanda263d80c2014-08-20 16:24:38 -0700230int voice_start_usecase(struct audio_device *adev, audio_usecase_t usecase_id)
Shiv Maliyappanahalli34b585f2013-10-01 15:49:05 -0700231{
Satya Krishna Pindiprolif1cd92b2016-04-14 19:05:23 +0530232 int ret = 0;
Shiv Maliyappanahalli34b585f2013-10-01 15:49:05 -0700233 struct audio_usecase *uc_info;
234 int pcm_dev_rx_id, pcm_dev_tx_id;
Suprith Malligere Shankaregowda7400b212019-03-22 19:48:44 +0530235 int pcm_dev_loopback_rx_id, pcm_dev_loopback_tx_id;
Helen Zeng6a16ad72014-02-23 22:04:44 -0800236 uint32_t sample_rate = 8000;
Shiv Maliyappanahalli34b585f2013-10-01 15:49:05 -0700237 struct voice_session *session = NULL;
Shiv Maliyappanahallida107642013-10-17 11:16:13 -0700238 struct pcm_config voice_config = pcm_config_voice_call;
Shiv Maliyappanahalli3bb73582013-11-05 12:49:15 -0800239
240 ALOGD("%s: enter usecase:%s", __func__, use_case_table[usecase_id]);
Shiv Maliyappanahalli34b585f2013-10-01 15:49:05 -0700241
242 session = (struct voice_session *)voice_get_session_from_use_case(adev, usecase_id);
Haynes Mathew Georgeb51ceb12014-06-30 13:56:18 -0700243 if (!session) {
244 ALOGE("start_call: couldn't find voice session");
245 return -EINVAL;
246 }
247
Shiv Maliyappanahalli34b585f2013-10-01 15:49:05 -0700248 uc_info = (struct audio_usecase *)calloc(1, sizeof(struct audio_usecase));
Haynes Mathew Georgeb51ceb12014-06-30 13:56:18 -0700249 if (!uc_info) {
250 ALOGE("start_call: couldn't allocate mem for audio_usecase");
251 return -ENOMEM;
252 }
253
Shiv Maliyappanahalli34b585f2013-10-01 15:49:05 -0700254 uc_info->id = usecase_id;
255 uc_info->type = VOICE_CALL;
kunleiz3251d232017-11-15 16:28:55 +0800256 uc_info->stream.out = adev->current_call_output;
257 uc_info->devices = adev->current_call_output->devices;
258
259 if (popcount(uc_info->devices) == 2) {
260 ALOGE("%s: Invalid combo device(%#x) for voice call", __func__,
261 uc_info->devices);
262 ret = -EIO;
263 goto error_start_voice;
264 }
265
Shiv Maliyappanahalli34b585f2013-10-01 15:49:05 -0700266 uc_info->in_snd_device = SND_DEVICE_NONE;
267 uc_info->out_snd_device = SND_DEVICE_NONE;
Arun Mirpurief53ce52018-09-11 18:00:09 -0700268 adev->voice.use_device_mute = false;
Shiv Maliyappanahalli34b585f2013-10-01 15:49:05 -0700269
kunleizf175f672017-09-12 17:02:52 +0800270 if (audio_is_bluetooth_sco_device(uc_info->devices) && !adev->bt_sco_on) {
271 ALOGE("start_call: couldn't find BT SCO, SCO is not ready");
272 adev->voice.in_call = false;
273 ret = -EIO;
274 goto error_start_voice;
275 }
276
Shiv Maliyappanahalli34b585f2013-10-01 15:49:05 -0700277 list_add_tail(&adev->usecase_list, &uc_info->list);
278
279 select_devices(adev, usecase_id);
280
Pallavi Mishra5627c162020-02-15 19:00:40 +0530281 if (voice_external_baseband_supported(adev)) {
282 pcm_dev_loopback_rx_id = HOST_LESS_RX_ID;
283 pcm_dev_loopback_tx_id = HOST_LESS_TX_ID;
284 }
285
Shiv Maliyappanahalli34b585f2013-10-01 15:49:05 -0700286 pcm_dev_rx_id = platform_get_pcm_device_id(uc_info->id, PCM_PLAYBACK);
287 pcm_dev_tx_id = platform_get_pcm_device_id(uc_info->id, PCM_CAPTURE);
288
289 if (pcm_dev_rx_id < 0 || pcm_dev_tx_id < 0) {
290 ALOGE("%s: Invalid PCM devices (rx: %d tx: %d) for the usecase(%d)",
291 __func__, pcm_dev_rx_id, pcm_dev_tx_id, uc_info->id);
292 ret = -EIO;
293 goto error_start_voice;
294 }
Helen Zeng6a16ad72014-02-23 22:04:44 -0800295 ret = platform_get_sample_rate(adev->platform, &sample_rate);
296 if (ret < 0) {
297 ALOGE("platform_get_sample_rate error %d\n", ret);
298 } else {
299 voice_config.rate = sample_rate;
300 }
301 ALOGD("voice_config.rate %d\n", voice_config.rate);
Shiv Maliyappanahalli34b585f2013-10-01 15:49:05 -0700302
Vidyakumar Athotab000e0b2015-04-09 17:45:20 -0700303 voice_set_mic_mute(adev, adev->voice.mic_mute);
304
Bhalchandra Gajare45fee282015-06-09 22:23:45 -0700305 ALOGV("%s: Opening PCM capture device card_id(%d) device_id(%d)",
306 __func__, adev->snd_card, pcm_dev_tx_id);
307 session->pcm_tx = pcm_open(adev->snd_card,
308 pcm_dev_tx_id,
309 PCM_IN, &voice_config);
310 if (session->pcm_tx && !pcm_is_ready(session->pcm_tx)) {
311 ALOGE("%s: %s", __func__, pcm_get_error(session->pcm_tx));
312 ret = -EIO;
313 goto error_start_voice;
314 }
315
Shiv Maliyappanahalli34b585f2013-10-01 15:49:05 -0700316 ALOGV("%s: Opening PCM playback device card_id(%d) device_id(%d)",
Apoorv Raghuvanshi84fa2fe2013-12-04 11:57:47 -0800317 __func__, adev->snd_card, pcm_dev_rx_id);
318 session->pcm_rx = pcm_open(adev->snd_card,
Shiv Maliyappanahalli34b585f2013-10-01 15:49:05 -0700319 pcm_dev_rx_id,
Shiv Maliyappanahallida107642013-10-17 11:16:13 -0700320 PCM_OUT, &voice_config);
Shiv Maliyappanahalli34b585f2013-10-01 15:49:05 -0700321 if (session->pcm_rx && !pcm_is_ready(session->pcm_rx)) {
322 ALOGE("%s: %s", __func__, pcm_get_error(session->pcm_rx));
323 ret = -EIO;
324 goto error_start_voice;
325 }
326
Pallavi Mishra5627c162020-02-15 19:00:40 +0530327 if (voice_external_baseband_supported(adev)) {
328 voice_loopback_rx = pcm_open(adev->snd_card,
Suprith Malligere Shankaregowda7400b212019-03-22 19:48:44 +0530329 pcm_dev_loopback_rx_id,
330 PCM_OUT, &voice_config);
Pallavi Mishra5627c162020-02-15 19:00:40 +0530331 if (voice_loopback_rx < 0 || !pcm_is_ready(voice_loopback_rx)) {
332 ALOGE("%s: Either could not open pcm_dev_loopback_rx_id %d or %s",
333 __func__, pcm_dev_loopback_rx_id, pcm_get_error(voice_loopback_rx));
334 ret = -EIO;
335 goto error_start_voice;
336 }
Suprith Malligere Shankaregowda7400b212019-03-22 19:48:44 +0530337
Pallavi Mishra5627c162020-02-15 19:00:40 +0530338 voice_loopback_tx = pcm_open(adev->snd_card,
Suprith Malligere Shankaregowda7400b212019-03-22 19:48:44 +0530339 pcm_dev_loopback_tx_id,
340 PCM_IN, &voice_config);
Pallavi Mishra5627c162020-02-15 19:00:40 +0530341 if (voice_loopback_tx < 0 || !pcm_is_ready(voice_loopback_tx)) {
342 ALOGE("%s: Either could not open pcm_dev_loopback_tx_id %d or %s",
343 __func__, pcm_dev_loopback_tx_id, pcm_get_error(voice_loopback_tx));
344 ret = -EIO;
345 goto error_start_voice;
346 }
Suprith Malligere Shankaregowda7400b212019-03-22 19:48:44 +0530347 }
Suprith Malligere Shankaregowda7400b212019-03-22 19:48:44 +0530348
Weiyin Jiang095e4442019-07-15 11:49:15 +0800349 if (adev->mic_break_enabled)
Vignesh Kulothungan7d374312018-02-21 17:12:00 -0800350 platform_set_mic_break_det(adev->platform, true);
351
Vignesh Kulothungancf4b9322019-05-03 13:52:50 -0700352 ret = pcm_start(session->pcm_tx);
353 if (ret != 0) {
354 ALOGE("%s: %s", __func__, pcm_get_error(session->pcm_tx));
355 goto error_start_voice;
356 }
357
358 ret = pcm_start(session->pcm_rx);
359 if (ret != 0) {
360 ALOGE("%s: %s", __func__, pcm_get_error(session->pcm_rx));
361 goto error_start_voice;
362 }
Bhalchandra Gajare45fee282015-06-09 22:23:45 -0700363
Pallavi Mishra5627c162020-02-15 19:00:40 +0530364 if (voice_external_baseband_supported(adev)) {
365 ret = pcm_start(voice_loopback_tx);
366 if (ret != 0) {
367 ALOGE("%s: %s", __func__, pcm_get_error(voice_loopback_tx));
368 goto error_start_voice;
369 }
Suprith Malligere Shankaregowda7400b212019-03-22 19:48:44 +0530370
Pallavi Mishra5627c162020-02-15 19:00:40 +0530371 ret = pcm_start(voice_loopback_rx);
372 if (ret != 0) {
373 ALOGE("%s: %s", __func__, pcm_get_error(voice_loopback_rx));
374 goto error_start_voice;
375 }
Suprith Malligere Shankaregowda7400b212019-03-22 19:48:44 +0530376 }
Suprith Malligere Shankaregowda7400b212019-03-22 19:48:44 +0530377
Vidyakumar Athotaea269c62016-10-31 09:05:59 -0700378 /* Enable aanc only when no calls are active */
379 if (!voice_is_call_state_active(adev))
380 voice_check_and_update_aanc_path(adev, uc_info->out_snd_device, true);
381
Bhalchandra Gajare45fee282015-06-09 22:23:45 -0700382 /* Enable sidetone only when no calls are already active */
383 if (!voice_is_call_state_active(adev))
384 voice_set_sidetone(adev, uc_info->out_snd_device, true);
Shiv Maliyappanahalli34b585f2013-10-01 15:49:05 -0700385
Shruthi Krishnaace10852013-10-25 14:32:12 -0700386 voice_set_volume(adev, adev->voice.volume);
387
Vidyakumar Athotad9d9ff32013-11-13 11:46:52 -0800388 ret = platform_start_voice_call(adev->platform, session->vsid);
Shiv Maliyappanahalli34b585f2013-10-01 15:49:05 -0700389 if (ret < 0) {
390 ALOGE("%s: platform_start_voice_call error %d\n", __func__, ret);
391 goto error_start_voice;
392 }
393
394 session->state.current = CALL_ACTIVE;
Vidyakumar Athotaad34d572014-08-05 18:20:42 -0700395 goto done;
Shiv Maliyappanahalli34b585f2013-10-01 15:49:05 -0700396
397error_start_voice:
Ravi Kumar Alamanda263d80c2014-08-20 16:24:38 -0700398 voice_stop_usecase(adev, usecase_id);
Shiv Maliyappanahalli34b585f2013-10-01 15:49:05 -0700399
Vidyakumar Athotaad34d572014-08-05 18:20:42 -0700400done:
Shiv Maliyappanahalli34b585f2013-10-01 15:49:05 -0700401 ALOGD("%s: exit: status(%d)", __func__, ret);
402 return ret;
403}
404
Vidyakumar Athotaad34d572014-08-05 18:20:42 -0700405bool voice_is_call_state_active(struct audio_device *adev)
Shiv Maliyappanahalli34b585f2013-10-01 15:49:05 -0700406{
Vidyakumar Athotaad34d572014-08-05 18:20:42 -0700407 bool call_state = false;
Shiv Maliyappanahalli34b585f2013-10-01 15:49:05 -0700408 int ret = 0;
409
Vidyakumar Athotaad34d572014-08-05 18:20:42 -0700410 ret = voice_extn_is_call_state_active(adev, &call_state);
Shiv Maliyappanahalli34b585f2013-10-01 15:49:05 -0700411 if (ret == -ENOSYS) {
Vidyakumar Athotaad34d572014-08-05 18:20:42 -0700412 call_state = (adev->voice.session[VOICE_SESS_IDX].state.current == CALL_ACTIVE) ? true : false;
Shiv Maliyappanahalli34b585f2013-10-01 15:49:05 -0700413 }
414
Vidyakumar Athotaad34d572014-08-05 18:20:42 -0700415 return call_state;
Shiv Maliyappanahalli34b585f2013-10-01 15:49:05 -0700416}
417
Alexy Josephb1379942016-01-29 15:49:38 -0800418bool voice_is_in_call(const struct audio_device *adev)
Ravi Kumar Alamanda060bc5a2014-09-05 13:51:35 -0700419{
420 return adev->voice.in_call;
421}
422
Alexy Josephb1379942016-01-29 15:49:38 -0800423bool voice_is_in_call_rec_stream(const struct stream_in *in)
kunleizc5a639b2014-04-24 18:46:22 +0800424{
425 bool in_call_rec = false;
kunleizc5a639b2014-04-24 18:46:22 +0800426
Anish Kumar50ebcbf2014-12-09 04:01:39 +0530427 if (!in) {
428 ALOGE("%s: input stream is NULL", __func__);
429 return in_call_rec;
430 }
431
Arun Mirpurief53ce52018-09-11 18:00:09 -0700432 if (in->source == AUDIO_SOURCE_VOICE_DOWNLINK ||
433 in->source == AUDIO_SOURCE_VOICE_UPLINK ||
434 in->source == AUDIO_SOURCE_VOICE_CALL) {
435 in_call_rec = true;
kunleizc5a639b2014-04-24 18:46:22 +0800436 }
437
438 return in_call_rec;
439}
440
Shiv Maliyappanahallida107642013-10-17 11:16:13 -0700441uint32_t voice_get_active_session_id(struct audio_device *adev)
442{
443 int ret = 0;
444 uint32_t session_id;
445
446 ret = voice_extn_get_active_session_id(adev, &session_id);
447 if (ret == -ENOSYS) {
448 session_id = VOICE_VSID;
449 }
450 return session_id;
451}
452
Kunlei Zhanga3b3abf2019-06-25 15:42:21 +0800453bool voice_check_voicecall_usecases_active(struct audio_device *adev)
454{
455 struct listnode *node;
456 struct audio_usecase *usecase = NULL;
457
458 list_for_each(node, &adev->usecase_list) {
459 usecase = node_to_item(node, struct audio_usecase, list);
460 if (usecase->type == VOICE_CALL) {
461 ALOGV("%s: voice usecase:%s is active", __func__,
462 use_case_table[usecase->id]);
463 return true;
464 }
465 }
466 return false;
467}
468
Shiv Maliyappanahallida107642013-10-17 11:16:13 -0700469int voice_check_and_set_incall_rec_usecase(struct audio_device *adev,
Vidyakumar Athota2850d532013-11-19 16:02:12 -0800470 struct stream_in *in)
Shiv Maliyappanahallida107642013-10-17 11:16:13 -0700471{
472 int ret = 0;
473 uint32_t session_id;
Vidyakumar Athota2850d532013-11-19 16:02:12 -0800474 int rec_mode = INCALL_REC_NONE;
Shiv Maliyappanahallida107642013-10-17 11:16:13 -0700475
Vidyakumar Athotaad34d572014-08-05 18:20:42 -0700476 if (voice_is_call_state_active(adev)) {
Shiv Maliyappanahallida107642013-10-17 11:16:13 -0700477 switch (in->source) {
478 case AUDIO_SOURCE_VOICE_UPLINK:
Helen Zenge56b4852013-12-03 16:54:40 -0800479 if (audio_extn_compr_cap_enabled() &&
480 audio_extn_compr_cap_format_supported(in->config.format)) {
481 in->usecase = USECASE_INCALL_REC_UPLINK_COMPRESS;
482 } else
483 in->usecase = USECASE_INCALL_REC_UPLINK;
Vidyakumar Athota2850d532013-11-19 16:02:12 -0800484 rec_mode = INCALL_REC_UPLINK;
Shiv Maliyappanahallida107642013-10-17 11:16:13 -0700485 break;
486 case AUDIO_SOURCE_VOICE_DOWNLINK:
Helen Zenge56b4852013-12-03 16:54:40 -0800487 if (audio_extn_compr_cap_enabled() &&
488 audio_extn_compr_cap_format_supported(in->config.format)) {
489 in->usecase = USECASE_INCALL_REC_DOWNLINK_COMPRESS;
490 } else
491 in->usecase = USECASE_INCALL_REC_DOWNLINK;
Vidyakumar Athota2850d532013-11-19 16:02:12 -0800492 rec_mode = INCALL_REC_DOWNLINK;
Shiv Maliyappanahallida107642013-10-17 11:16:13 -0700493 break;
494 case AUDIO_SOURCE_VOICE_CALL:
Helen Zenge56b4852013-12-03 16:54:40 -0800495 if (audio_extn_compr_cap_enabled() &&
496 audio_extn_compr_cap_format_supported(in->config.format)) {
497 in->usecase = USECASE_INCALL_REC_UPLINK_AND_DOWNLINK_COMPRESS;
498 } else
499 in->usecase = USECASE_INCALL_REC_UPLINK_AND_DOWNLINK;
Vidyakumar Athota2850d532013-11-19 16:02:12 -0800500 rec_mode = INCALL_REC_UPLINK_AND_DOWNLINK;
Shiv Maliyappanahallida107642013-10-17 11:16:13 -0700501 break;
502 default:
503 ALOGV("%s: Source type %d doesnt match incall recording criteria",
504 __func__, in->source);
505 return ret;
506 }
507
Shiv Maliyappanahallida107642013-10-17 11:16:13 -0700508 session_id = voice_get_active_session_id(adev);
Vidyakumar Athota2850d532013-11-19 16:02:12 -0800509 ret = platform_set_incall_recording_session_id(adev->platform,
510 session_id, rec_mode);
Yunfei Zhang3714bd12019-04-11 09:04:28 +0800511 platform_set_incall_recording_session_channels(adev->platform,
512 in->config.channels);
Shiv Maliyappanahallida107642013-10-17 11:16:13 -0700513 ALOGV("%s: Update usecase to %d",__func__, in->usecase);
514 } else {
Venkata Narendra Kumar Gutta76440ba2015-03-30 19:16:14 +0530515 /*
516 * Reject the recording instances, where the recording is started
517 * with In-call voice recording source types but voice call is not
518 * active by the time input is started
519 */
520 if ((in->source == AUDIO_SOURCE_VOICE_UPLINK) ||
521 (in->source == AUDIO_SOURCE_VOICE_DOWNLINK) ||
522 (in->source == AUDIO_SOURCE_VOICE_CALL)) {
523 ret = -EINVAL;
524 ALOGE("%s: As voice call is not active, Incall rec usecase can't be \
525 selected for requested source:%d",__func__, in->source);
526 }
Shiv Maliyappanahallida107642013-10-17 11:16:13 -0700527 ALOGV("%s: voice call not active", __func__);
528 }
529
530 return ret;
531}
532
Vidyakumar Athota2850d532013-11-19 16:02:12 -0800533int voice_check_and_stop_incall_rec_usecase(struct audio_device *adev,
534 struct stream_in *in)
535{
536 int ret = 0;
537
538 if (in->source == AUDIO_SOURCE_VOICE_UPLINK ||
539 in->source == AUDIO_SOURCE_VOICE_DOWNLINK ||
540 in->source == AUDIO_SOURCE_VOICE_CALL) {
541 ret = platform_stop_incall_recording_usecase(adev->platform);
542 ALOGV("%s: Stop In-call recording", __func__);
543 }
544
545 return ret;
546}
547
Divya Narayanan Poojary85d0a592018-02-06 14:25:16 +0530548snd_device_t voice_get_incall_rec_backend_device(struct stream_in *in)
549{
550 snd_device_t incall_record_device = {0};
551
Aditya Bavanari9e957d82019-01-29 17:47:13 +0530552 if (!in) {
553 ALOGE("%s: input stream is NULL", __func__);
554 return 0;
555 }
556
Divya Narayanan Poojary85d0a592018-02-06 14:25:16 +0530557 switch(in->source) {
558 case AUDIO_SOURCE_VOICE_UPLINK:
559 incall_record_device = SND_DEVICE_IN_INCALL_REC_TX;
560 break;
561 case AUDIO_SOURCE_VOICE_DOWNLINK:
562 incall_record_device = SND_DEVICE_IN_INCALL_REC_RX;
563 break;
564 case AUDIO_SOURCE_VOICE_CALL:
565 incall_record_device = SND_DEVICE_IN_INCALL_REC_RX_TX;
566 break;
567 default:
568 ALOGI("Invalid source %d", in->source);
569 }
570
571 return incall_record_device;
572}
573
Narsinga Rao Chella212e2542014-11-17 19:57:04 -0800574snd_device_t voice_get_incall_rec_snd_device(snd_device_t in_snd_device)
575{
576 snd_device_t incall_record_device = in_snd_device;
577
578 /*
579 * For incall recording stream, AUDIO_COPP topology will be picked up
580 * from the calibration data of the input sound device which is nothing
581 * but the voice call's input device. But there are requirements to use
582 * AUDIO_COPP_MONO topology even if the voice call's input device is
583 * different. Hence override the input device with the one which uses
584 * the AUDIO_COPP_MONO topology.
585 */
586 switch(in_snd_device) {
587 case SND_DEVICE_IN_HANDSET_MIC:
588 case SND_DEVICE_IN_VOICE_DMIC:
589 case SND_DEVICE_IN_AANC_HANDSET_MIC:
590 incall_record_device = SND_DEVICE_IN_HANDSET_MIC;
Shiv Maliyappanahalli4d2d97c2015-02-19 14:29:01 -0800591 break;
Narsinga Rao Chella212e2542014-11-17 19:57:04 -0800592 case SND_DEVICE_IN_VOICE_SPEAKER_MIC:
593 case SND_DEVICE_IN_VOICE_SPEAKER_DMIC:
594 case SND_DEVICE_IN_VOICE_SPEAKER_DMIC_BROADSIDE:
595 case SND_DEVICE_IN_VOICE_SPEAKER_QMIC:
596 incall_record_device = SND_DEVICE_IN_VOICE_SPEAKER_MIC;
Shiv Maliyappanahalli4d2d97c2015-02-19 14:29:01 -0800597 break;
Narsinga Rao Chella212e2542014-11-17 19:57:04 -0800598 default:
599 incall_record_device = in_snd_device;
600 }
601
Shiv Maliyappanahalli4d2d97c2015-02-19 14:29:01 -0800602 ALOGD("%s: in_snd_device(%d: %s) incall_record_device(%d: %s)", __func__,
603 in_snd_device, platform_get_snd_device_name(in_snd_device),
604 incall_record_device, platform_get_snd_device_name(incall_record_device));
605
Narsinga Rao Chella212e2542014-11-17 19:57:04 -0800606 return incall_record_device;
607}
608
Shiv Maliyappanahalli34b585f2013-10-01 15:49:05 -0700609int voice_set_mic_mute(struct audio_device *adev, bool state)
610{
611 int err = 0;
612
Narsinga Rao Chella05573b72013-11-15 15:21:40 -0800613 adev->voice.mic_mute = state;
Arun Mirpurief53ce52018-09-11 18:00:09 -0700614
Dhanalakshmi Siddani823dc5a2016-09-28 14:47:26 +0530615 if (audio_extn_hfp_is_active(adev)) {
Arun Mirpurie008ed22019-03-21 11:21:04 -0700616 err = audio_extn_hfp_set_mic_mute2(adev, state);
Dhanalakshmi Siddani823dc5a2016-09-28 14:47:26 +0530617 } else if (adev->mode == AUDIO_MODE_IN_CALL) {
Arun Mirpurief53ce52018-09-11 18:00:09 -0700618 /* Use device mute if incall music delivery usecase is in progress */
619 if (adev->voice.use_device_mute)
620 err = platform_set_device_mute(adev->platform, state, "tx");
621 else
622 err = platform_set_mic_mute(adev->platform, state);
623 ALOGV("%s: voice mute status=%d, use_device_mute flag=%d",
624 __func__, state, adev->voice.use_device_mute);
Dhanalakshmi Siddani823dc5a2016-09-28 14:47:26 +0530625 } else if (adev->mode == AUDIO_MODE_IN_COMMUNICATION) {
Narsinga Rao Chella05573b72013-11-15 15:21:40 -0800626 err = voice_extn_compress_voip_set_mic_mute(adev, state);
Dhanalakshmi Siddani823dc5a2016-09-28 14:47:26 +0530627 }
Arun Mirpurief53ce52018-09-11 18:00:09 -0700628
Shiv Maliyappanahalli34b585f2013-10-01 15:49:05 -0700629 return err;
630}
631
632bool voice_get_mic_mute(struct audio_device *adev)
633{
634 return adev->voice.mic_mute;
635}
636
Arun Mirpurief53ce52018-09-11 18:00:09 -0700637/*
638 * Following function is called when incall music uplink usecase is
639 * created or destroyed while mic is muted. If incall music uplink
640 * usecase is active, apply voice device mute to mute only voice Tx
641 * path and not the mixed voice Tx + inncall-music path. Revert to
642 * voice stream mute once incall music uplink usecase is inactive
643 */
644void voice_set_device_mute_flag(struct audio_device *adev, bool state)
645{
646 if (adev->voice.mic_mute) {
647 if (state) {
648 platform_set_device_mute(adev->platform, true, "tx");
649 platform_set_mic_mute(adev->platform, false);
650 } else {
651 platform_set_mic_mute(adev->platform, true);
652 platform_set_device_mute(adev->platform, false, "tx");
653 }
654 }
655 adev->voice.use_device_mute = state;
656}
657
Shiv Maliyappanahalli34b585f2013-10-01 15:49:05 -0700658int voice_set_volume(struct audio_device *adev, float volume)
659{
660 int vol, err = 0;
661
Shruthi Krishnaace10852013-10-25 14:32:12 -0700662 adev->voice.volume = volume;
Shiv Maliyappanahalli34b585f2013-10-01 15:49:05 -0700663 if (adev->mode == AUDIO_MODE_IN_CALL) {
664 if (volume < 0.0) {
665 volume = 0.0;
666 } else if (volume > 1.0) {
667 volume = 1.0;
668 }
669
670 vol = lrint(volume * 100.0);
671
672 // Voice volume levels from android are mapped to driver volume levels as follows.
673 // 0 -> 5, 20 -> 4, 40 ->3, 60 -> 2, 80 -> 1, 100 -> 0
674 // So adjust the volume to get the correct volume index in driver
675 vol = 100 - vol;
676
677 err = platform_set_voice_volume(adev->platform, vol);
Shiv Maliyappanahalli34b585f2013-10-01 15:49:05 -0700678 }
Narsinga Rao Chella05573b72013-11-15 15:21:40 -0800679 if (adev->mode == AUDIO_MODE_IN_COMMUNICATION)
680 err = voice_extn_compress_voip_set_volume(adev, volume);
681
Shruthi Krishnaace10852013-10-25 14:32:12 -0700682
Shiv Maliyappanahalli34b585f2013-10-01 15:49:05 -0700683 return err;
684}
685
686int voice_start_call(struct audio_device *adev)
687{
688 int ret = 0;
689
Ravi Kumar Alamandabe149392014-10-20 17:07:43 -0700690 adev->voice.in_call = true;
Aalique Grahame22e49102018-12-18 14:23:57 -0800691
692 voice_set_mic_mute(adev, adev->voice.mic_mute);
693
Shiv Maliyappanahalli3bb73582013-11-05 12:49:15 -0800694 ret = voice_extn_start_call(adev);
Shiv Maliyappanahalli34b585f2013-10-01 15:49:05 -0700695 if (ret == -ENOSYS) {
Ravi Kumar Alamanda263d80c2014-08-20 16:24:38 -0700696 ret = voice_start_usecase(adev, USECASE_VOICE_CALL);
Shiv Maliyappanahalli34b585f2013-10-01 15:49:05 -0700697 }
698
699 return ret;
700}
701
702int voice_stop_call(struct audio_device *adev)
703{
704 int ret = 0;
705
Vidyakumar Athotaad34d572014-08-05 18:20:42 -0700706 adev->voice.in_call = false;
Shiv Maliyappanahalli3bb73582013-11-05 12:49:15 -0800707 ret = voice_extn_stop_call(adev);
Shiv Maliyappanahalli34b585f2013-10-01 15:49:05 -0700708 if (ret == -ENOSYS) {
Ravi Kumar Alamanda263d80c2014-08-20 16:24:38 -0700709 ret = voice_stop_usecase(adev, USECASE_VOICE_CALL);
Shiv Maliyappanahalli34b585f2013-10-01 15:49:05 -0700710 }
711
712 return ret;
713}
714
Shiv Maliyappanahallif9308492013-12-12 12:18:09 -0800715void voice_get_parameters(struct audio_device *adev,
716 struct str_parms *query,
717 struct str_parms *reply)
718{
719 voice_extn_get_parameters(adev, query, reply);
720}
721
Shiv Maliyappanahalli34b585f2013-10-01 15:49:05 -0700722int voice_set_parameters(struct audio_device *adev, struct str_parms *parms)
723{
Shiv Maliyappanahalli34b585f2013-10-01 15:49:05 -0700724 char value[32];
Shiv Maliyappanahalli3e064fd2013-12-16 15:54:40 -0800725 int ret = 0, err;
Krishnankutty Kolathappilly061a9492014-01-31 18:12:13 -0800726 char *kv_pairs = str_parms_to_str(parms);
Shiv Maliyappanahalli34b585f2013-10-01 15:49:05 -0700727
Krishnankutty Kolathappilly061a9492014-01-31 18:12:13 -0800728 ALOGV_IF(kv_pairs != NULL, "%s: enter: %s", __func__, kv_pairs);
Shiv Maliyappanahalli34b585f2013-10-01 15:49:05 -0700729
Shiv Maliyappanahalli3e064fd2013-12-16 15:54:40 -0800730 ret = voice_extn_set_parameters(adev, parms);
Vidyakumar Athota8d931f02014-07-21 14:51:44 -0700731 if (ret != 0) {
732 if (ret == -ENOSYS)
733 ret = 0;
734 else
735 goto done;
736 }
Shiv Maliyappanahalli34b585f2013-10-01 15:49:05 -0700737
Shiv Maliyappanahalli3e064fd2013-12-16 15:54:40 -0800738 ret = voice_extn_compress_voip_set_parameters(adev, parms);
Vidyakumar Athota8d931f02014-07-21 14:51:44 -0700739 if (ret != 0) {
740 if (ret == -ENOSYS)
741 ret = 0;
742 else
743 goto done;
744 }
Shiv Maliyappanahalli3e064fd2013-12-16 15:54:40 -0800745
746 err = str_parms_get_str(parms, AUDIO_PARAMETER_KEY_TTY_MODE, value, sizeof(value));
747 if (err >= 0) {
Shiv Maliyappanahalli34b585f2013-10-01 15:49:05 -0700748 int tty_mode;
749 str_parms_del(parms, AUDIO_PARAMETER_KEY_TTY_MODE);
750 if (strcmp(value, AUDIO_PARAMETER_VALUE_TTY_OFF) == 0)
751 tty_mode = TTY_MODE_OFF;
752 else if (strcmp(value, AUDIO_PARAMETER_VALUE_TTY_VCO) == 0)
753 tty_mode = TTY_MODE_VCO;
754 else if (strcmp(value, AUDIO_PARAMETER_VALUE_TTY_HCO) == 0)
755 tty_mode = TTY_MODE_HCO;
756 else if (strcmp(value, AUDIO_PARAMETER_VALUE_TTY_FULL) == 0)
757 tty_mode = TTY_MODE_FULL;
758 else {
759 ret = -EINVAL;
760 goto done;
761 }
762
Shiv Maliyappanahalli34b585f2013-10-01 15:49:05 -0700763 if (tty_mode != adev->voice.tty_mode) {
764 adev->voice.tty_mode = tty_mode;
765 adev->acdb_settings = (adev->acdb_settings & TTY_MODE_CLEAR) | tty_mode;
Vidyakumar Athotaad34d572014-08-05 18:20:42 -0700766 if (voice_is_call_state_active(adev))
Narsinga Rao Chella22d8d7a2014-02-06 14:05:14 -0800767 voice_update_devices_for_all_voice_usecases(adev);
Shiv Maliyappanahalli34b585f2013-10-01 15:49:05 -0700768 }
Shiv Maliyappanahalli34b585f2013-10-01 15:49:05 -0700769 }
770
Aalique Grahame22e49102018-12-18 14:23:57 -0800771 err = str_parms_get_str(parms, AUDIO_PARAMETER_KEY_HAC,
772 value, sizeof(value));
773 if (err >= 0) {
774 bool hac = false;
775 str_parms_del(parms, AUDIO_PARAMETER_KEY_HAC);
776 if (strcmp(value, AUDIO_PARAMETER_VALUE_HAC_ON) == 0)
777 hac = true;
778
779 if (hac != adev->voice.hac) {
780 adev->voice.hac = hac;
781 if (voice_is_in_call(adev))
782 voice_update_devices_for_all_voice_usecases(adev);
783 }
784 }
Shiv Maliyappanahalli3e064fd2013-12-16 15:54:40 -0800785 err = str_parms_get_str(parms, AUDIO_PARAMETER_KEY_INCALLMUSIC,
Vidyakumar Athota2850d532013-11-19 16:02:12 -0800786 value, sizeof(value));
Shiv Maliyappanahalli3e064fd2013-12-16 15:54:40 -0800787 if (err >= 0) {
Vidyakumar Athota2850d532013-11-19 16:02:12 -0800788 str_parms_del(parms, AUDIO_PARAMETER_KEY_INCALLMUSIC);
789 if (strcmp(value, AUDIO_PARAMETER_VALUE_TRUE) == 0)
790 platform_start_incall_music_usecase(adev->platform);
791 else
792 platform_stop_incall_music_usecase(adev->platform);
Vidyakumar Athota8d931f02014-07-21 14:51:44 -0700793 }
Vidyakumar Athota2850d532013-11-19 16:02:12 -0800794
Shiv Maliyappanahalli34b585f2013-10-01 15:49:05 -0700795done:
796 ALOGV("%s: exit with code(%d)", __func__, ret);
Krishnankutty Kolathappilly061a9492014-01-31 18:12:13 -0800797 free(kv_pairs);
Shiv Maliyappanahalli34b585f2013-10-01 15:49:05 -0700798 return ret;
799}
800
801void voice_init(struct audio_device *adev)
802{
803 int i = 0;
Weiyin Jiang095e4442019-07-15 11:49:15 +0800804 int max_voice_sessions = MAX_VOICE_SESSIONS;
805
806 if (!voice_extn_is_multi_session_supported())
807 max_voice_sessions = 1;
Shiv Maliyappanahalli34b585f2013-10-01 15:49:05 -0700808
809 memset(&adev->voice, 0, sizeof(adev->voice));
810 adev->voice.tty_mode = TTY_MODE_OFF;
Aalique Grahame22e49102018-12-18 14:23:57 -0800811 adev->voice.hac = false;
Shiv Maliyappanahalli34b585f2013-10-01 15:49:05 -0700812 adev->voice.volume = 1.0f;
813 adev->voice.mic_mute = false;
Vidyakumar Athotaad34d572014-08-05 18:20:42 -0700814 adev->voice.in_call = false;
Weiyin Jiang095e4442019-07-15 11:49:15 +0800815 for (i = 0; i < max_voice_sessions; i++) {
Shiv Maliyappanahalli34b585f2013-10-01 15:49:05 -0700816 adev->voice.session[i].pcm_rx = NULL;
817 adev->voice.session[i].pcm_tx = NULL;
818 adev->voice.session[i].state.current = CALL_INACTIVE;
819 adev->voice.session[i].state.new = CALL_INACTIVE;
Ravi Kumar Alamandabdf14162014-09-05 16:14:17 -0700820 adev->voice.session[i].vsid = VOICE_VSID;
Shiv Maliyappanahalli34b585f2013-10-01 15:49:05 -0700821 }
822
823 voice_extn_init(adev);
824}
825
Narsinga Rao Chella22d8d7a2014-02-06 14:05:14 -0800826void voice_update_devices_for_all_voice_usecases(struct audio_device *adev)
827{
828 struct listnode *node;
829 struct audio_usecase *usecase;
830
831 list_for_each(node, &adev->usecase_list) {
832 usecase = node_to_item(node, struct audio_usecase, list);
833 if (usecase->type == VOICE_CALL) {
834 ALOGV("%s: updating device for usecase:%s", __func__,
835 use_case_table[usecase->id]);
Ravi Kumar Alamanda060bc5a2014-09-05 13:51:35 -0700836 usecase->stream.out = adev->current_call_output;
Narsinga Rao Chella22d8d7a2014-02-06 14:05:14 -0800837 select_devices(adev, usecase->id);
838 }
839 }
840}
841
Shiv Maliyappanahalli34b585f2013-10-01 15:49:05 -0700842
Pallavi Mishra5627c162020-02-15 19:00:40 +0530843