Lines Matching refs:adev
42 static struct voice_session *voice_get_session_from_use_case(struct audio_device *adev,
48 ret = voice_extn_get_session_from_use_case(adev, usecase_id, &session);
50 session = &adev->voice.session[VOICE_SESS_IDX];
85 void voice_set_sidetone(struct audio_device *adev,
96 platform_set_sidetone(adev, out_snd_device, enable, mixer_path);
101 int voice_stop_usecase(struct audio_device *adev, audio_usecase_t usecase_id)
109 session = (struct voice_session *)voice_get_session_from_use_case(adev, usecase_id);
111 uc_info = get_usecase_from_list(adev, usecase_id);
121 if (!voice_is_call_state_active(adev))
122 voice_set_sidetone(adev, uc_info->out_snd_device, false);
124 ret = platform_stop_voice_call(adev->platform, session->vsid);
137 disable_audio_route(adev, uc_info);
140 disable_snd_device(adev, uc_info->out_snd_device);
141 disable_snd_device(adev, uc_info->in_snd_device);
143 if (audio_extn_tfa_98xx_is_supported() && voice_get_mic_mute(adev)) {
144 voice_set_mic_mute(adev, false);
155 int voice_start_usecase(struct audio_device *adev, audio_usecase_t usecase_id)
165 session = (struct voice_session *)voice_get_session_from_use_case(adev, usecase_id);
169 uc_info->stream.out = adev->current_call_output ;
170 uc_info->devices = adev->current_call_output ->devices;
174 list_add_tail(&adev->usecase_list, &uc_info->list);
176 select_devices(adev, usecase_id);
189 __func__, adev->snd_card, pcm_dev_tx_id);
190 session->pcm_tx = pcm_open(adev->snd_card,
200 __func__, adev->snd_card, pcm_dev_rx_id);
201 session->pcm_rx = pcm_open(adev->snd_card,
216 if (!voice_is_call_state_active(adev))
217 voice_set_sidetone(adev, uc_info->out_snd_device, true);
219 voice_set_volume(adev, adev->voice.volume);
221 ret = platform_start_voice_call(adev->platform, session->vsid);
231 voice_stop_usecase(adev, usecase_id);
238 bool voice_is_call_state_active(struct audio_device *adev)
243 ret = voice_extn_is_call_state_active(adev, &call_state);
245 call_state = (adev->voice.session[VOICE_SESS_IDX].state.current == CALL_ACTIVE) ? true : false;
251 bool voice_is_in_call(struct audio_device *adev)
253 return adev->voice.in_call;
269 uint32_t voice_get_active_session_id(struct audio_device *adev)
274 ret = voice_extn_get_active_session_id(adev, &session_id);
281 int voice_check_and_set_incall_rec_usecase(struct audio_device *adev,
289 if (voice_is_call_state_active(adev)) {
309 session_id = voice_get_active_session_id(adev);
310 ret = platform_set_incall_recording_session_id(adev->platform,
320 int voice_check_and_stop_incall_rec_usecase(struct audio_device *adev,
328 ret = platform_stop_incall_recording_usecase(adev->platform);
335 int voice_check_and_set_incall_music_usecase(struct audio_device *adev,
340 ret = voice_extn_check_and_set_incall_music_usecase(adev, out);
349 int voice_set_mic_mute(struct audio_device *adev, bool state)
353 adev->voice.mic_mute = state;
354 if (adev->mode == AUDIO_MODE_IN_CALL ||
355 adev->mode == AUDIO_MODE_IN_COMMUNICATION)
356 err = platform_set_mic_mute(adev->platform, state);
361 bool voice_get_mic_mute(struct audio_device *adev)
363 return adev->voice.mic_mute;
366 int voice_set_volume(struct audio_device *adev, float volume)
370 adev->voice.volume = volume;
371 if (adev->mode == AUDIO_MODE_IN_CALL) {
385 err = platform_set_voice_volume(adev->platform, vol);
391 int voice_start_call(struct audio_device *adev)
395 adev->voice.in_call = true;
397 voice_set_mic_mute(adev, adev->voice.mic_mute);
399 ret = voice_extn_start_call(adev);
401 ret = voice_start_usecase(adev, USECASE_VOICE_CALL);
407 int voice_stop_call(struct audio_device *adev)
411 adev->voice.in_call = false;
412 ret = voice_extn_stop_call(adev);
414 ret = voice_stop_usecase(adev, USECASE_VOICE_CALL);
420 void voice_get_parameters(struct audio_device *adev,
424 voice_extn_get_parameters(adev, query, reply);
427 int voice_set_parameters(struct audio_device *adev, struct str_parms *parms)
437 ret = voice_extn_set_parameters(adev, parms);
463 if (tty_mode != adev->voice.tty_mode) {
464 adev->voice.tty_mode = tty_mode;
465 adev->acdb_settings = (adev->acdb_settings & TTY_MODE_CLEAR) | tty_mode;
466 if (voice_is_call_state_active(adev))
467 voice_update_devices_for_all_voice_usecases(adev);
479 if (hac != adev->voice.hac) {
480 adev->voice.hac = hac;
481 if (voice_is_in_call(adev))
482 voice_update_devices_for_all_voice_usecases(adev);
491 platform_start_incall_music_usecase(adev->platform);
493 platform_stop_incall_music_usecase(adev->platform);
502 void voice_init(struct audio_device *adev)
506 memset(&adev->voice, 0, sizeof(adev->voice));
507 adev->voice.tty_mode = TTY_MODE_OFF;
508 adev->voice.hac = false;
509 adev->voice.volume = 1.0f;
510 adev->voice.mic_mute = false;
511 adev->voice.in_call = false;
513 adev->voice.session[i].pcm_rx = NULL;
514 adev->voice.session[i].pcm_tx = NULL;
515 adev->voice.session[i].state.current = CALL_INACTIVE;
516 adev->voice.session[i].state.new = CALL_INACTIVE;
517 adev->voice.session[i].vsid = VOICE_VSID;
520 voice_extn_init(adev);
523 void voice_update_devices_for_all_voice_usecases(struct audio_device *adev)
528 list_for_each(node, &adev->usecase_list) {
533 usecase->stream.out = adev->current_call_output;
534 select_devices(adev, usecase->id);