Lines Matching refs:adev

42 static struct voice_session *voice_get_session_from_use_case(struct audio_device *adev,  in voice_get_session_from_use_case()  argument
48 ret = voice_extn_get_session_from_use_case(adev, usecase_id, &session); in voice_get_session_from_use_case()
50 session = &adev->voice.session[VOICE_SESS_IDX]; in voice_get_session_from_use_case()
86 void voice_set_sidetone(struct audio_device *adev, in voice_set_sidetone() argument
97 platform_set_sidetone(adev, out_snd_device, enable, mixer_path); in voice_set_sidetone()
102 int voice_stop_usecase(struct audio_device *adev, audio_usecase_t usecase_id) in voice_stop_usecase() argument
110 session = (struct voice_session *)voice_get_session_from_use_case(adev, usecase_id); in voice_stop_usecase()
112 uc_info = get_usecase_from_list(adev, usecase_id); in voice_stop_usecase()
122 if (!voice_is_call_state_active(adev)) in voice_stop_usecase()
123 voice_set_sidetone(adev, uc_info->out_snd_device, false); in voice_stop_usecase()
125 ret = platform_stop_voice_call(adev->platform, session->vsid); in voice_stop_usecase()
138 disable_audio_route(adev, uc_info); in voice_stop_usecase()
141 disable_snd_device(adev, uc_info->out_snd_device); in voice_stop_usecase()
142 disable_snd_device(adev, uc_info->in_snd_device); in voice_stop_usecase()
144 if (audio_extn_tfa_98xx_is_supported() && voice_get_mic_mute(adev)) { in voice_stop_usecase()
145 voice_set_mic_mute(adev, false); in voice_stop_usecase()
156 int voice_start_usecase(struct audio_device *adev, audio_usecase_t usecase_id) in voice_start_usecase() argument
166 session = (struct voice_session *)voice_get_session_from_use_case(adev, usecase_id); in voice_start_usecase()
170 uc_info->stream.out = adev->current_call_output ; in voice_start_usecase()
171 uc_info->devices = adev->current_call_output ->devices; in voice_start_usecase()
174 adev->use_voice_device_mute = false; in voice_start_usecase()
176 list_add_tail(&adev->usecase_list, &uc_info->list); in voice_start_usecase()
178 select_devices(adev, usecase_id); in voice_start_usecase()
191 __func__, adev->snd_card, pcm_dev_tx_id); in voice_start_usecase()
192 session->pcm_tx = pcm_open(adev->snd_card, in voice_start_usecase()
202 __func__, adev->snd_card, pcm_dev_rx_id); in voice_start_usecase()
203 session->pcm_rx = pcm_open(adev->snd_card, in voice_start_usecase()
212 if (adev->mic_break_enabled) in voice_start_usecase()
213 platform_set_mic_break_det(adev->platform, true); in voice_start_usecase()
226 if (!voice_is_call_state_active(adev)) in voice_start_usecase()
227 voice_set_sidetone(adev, uc_info->out_snd_device, true); in voice_start_usecase()
229 voice_set_volume(adev, adev->voice.volume); in voice_start_usecase()
231 ret = platform_start_voice_call(adev->platform, session->vsid); in voice_start_usecase()
241 voice_stop_usecase(adev, usecase_id); in voice_start_usecase()
248 bool voice_is_call_state_active(struct audio_device *adev) in voice_is_call_state_active() argument
253 ret = voice_extn_is_call_state_active(adev, &call_state); in voice_is_call_state_active()
255 … call_state = (adev->voice.session[VOICE_SESS_IDX].state.current == CALL_ACTIVE) ? true : false; in voice_is_call_state_active()
261 bool voice_is_in_call(struct audio_device *adev) in voice_is_in_call() argument
263 return adev->voice.in_call; in voice_is_in_call()
279 uint32_t voice_get_active_session_id(struct audio_device *adev) in voice_get_active_session_id() argument
284 ret = voice_extn_get_active_session_id(adev, &session_id); in voice_get_active_session_id()
291 int voice_check_and_set_incall_rec_usecase(struct audio_device *adev, in voice_check_and_set_incall_rec_usecase() argument
299 if (voice_is_call_state_active(adev)) { in voice_check_and_set_incall_rec_usecase()
319 session_id = voice_get_active_session_id(adev); in voice_check_and_set_incall_rec_usecase()
320 ret = platform_set_incall_recording_session_id(adev->platform, in voice_check_and_set_incall_rec_usecase()
323 ret = platform_set_incall_recording_session_channels(adev->platform, in voice_check_and_set_incall_rec_usecase()
334 int voice_check_and_stop_incall_rec_usecase(struct audio_device *adev, in voice_check_and_stop_incall_rec_usecase() argument
342 ret = platform_stop_incall_recording_usecase(adev->platform); in voice_check_and_stop_incall_rec_usecase()
349 int voice_check_and_set_incall_music_usecase(struct audio_device *adev, in voice_check_and_set_incall_music_usecase() argument
354 ret = voice_extn_check_and_set_incall_music_usecase(adev, out); in voice_check_and_set_incall_music_usecase()
363 int voice_set_mic_mute(struct audio_device *adev, bool state) in voice_set_mic_mute() argument
368 adev->voice.mic_mute = state; in voice_set_mic_mute()
369 if (adev->mode == AUDIO_MODE_IN_CALL || in voice_set_mic_mute()
370 adev->mode == AUDIO_MODE_IN_COMMUNICATION) { in voice_set_mic_mute()
372 if (adev->use_voice_device_mute) in voice_set_mic_mute()
373 err = platform_set_device_mute(adev->platform, state, "tx"); in voice_set_mic_mute()
375 err = platform_set_mic_mute(adev->platform, state); in voice_set_mic_mute()
377 __func__, state, adev->use_voice_device_mute); in voice_set_mic_mute()
383 bool voice_get_mic_mute(struct audio_device *adev) in voice_get_mic_mute() argument
385 return adev->voice.mic_mute; in voice_get_mic_mute()
393 void voice_set_device_mute_flag (struct audio_device *adev, bool state) in voice_set_device_mute_flag() argument
395 if (adev->voice.mic_mute) { in voice_set_device_mute_flag()
397 platform_set_device_mute(adev->platform, true, "tx"); in voice_set_device_mute_flag()
398 platform_set_mic_mute(adev->platform, false); in voice_set_device_mute_flag()
400 platform_set_mic_mute(adev->platform, true); in voice_set_device_mute_flag()
401 platform_set_device_mute(adev->platform, false, "tx"); in voice_set_device_mute_flag()
404 adev->use_voice_device_mute = state; in voice_set_device_mute_flag()
407 int voice_set_volume(struct audio_device *adev, float volume) in voice_set_volume() argument
411 adev->voice.volume = volume; in voice_set_volume()
412 if (adev->mode == AUDIO_MODE_IN_CALL) { in voice_set_volume()
426 err = platform_set_voice_volume(adev->platform, vol); in voice_set_volume()
432 int voice_start_call(struct audio_device *adev) in voice_start_call() argument
436 adev->voice.in_call = true; in voice_start_call()
438 voice_set_mic_mute(adev, adev->voice.mic_mute); in voice_start_call()
440 ret = voice_extn_start_call(adev); in voice_start_call()
442 ret = voice_start_usecase(adev, USECASE_VOICE_CALL); in voice_start_call()
448 int voice_stop_call(struct audio_device *adev) in voice_stop_call() argument
452 adev->voice.in_call = false; in voice_stop_call()
453 ret = voice_extn_stop_call(adev); in voice_stop_call()
455 ret = voice_stop_usecase(adev, USECASE_VOICE_CALL); in voice_stop_call()
461 void voice_get_parameters(struct audio_device *adev, in voice_get_parameters() argument
465 voice_extn_get_parameters(adev, query, reply); in voice_get_parameters()
468 int voice_set_parameters(struct audio_device *adev, struct str_parms *parms) in voice_set_parameters() argument
478 ret = voice_extn_set_parameters(adev, parms); in voice_set_parameters()
504 if (tty_mode != adev->voice.tty_mode) { in voice_set_parameters()
505 adev->voice.tty_mode = tty_mode; in voice_set_parameters()
506 adev->acdb_settings = (adev->acdb_settings & TTY_MODE_CLEAR) | tty_mode; in voice_set_parameters()
507 if (voice_is_call_state_active(adev)) in voice_set_parameters()
508 voice_update_devices_for_all_voice_usecases(adev); in voice_set_parameters()
520 if (hac != adev->voice.hac) { in voice_set_parameters()
521 adev->voice.hac = hac; in voice_set_parameters()
522 if (voice_is_in_call(adev)) in voice_set_parameters()
523 voice_update_devices_for_all_voice_usecases(adev); in voice_set_parameters()
532 platform_start_incall_music_usecase(adev->platform); in voice_set_parameters()
534 platform_stop_incall_music_usecase(adev->platform); in voice_set_parameters()
543 void voice_init(struct audio_device *adev) in voice_init() argument
547 memset(&adev->voice, 0, sizeof(adev->voice)); in voice_init()
548 adev->voice.tty_mode = TTY_MODE_OFF; in voice_init()
549 adev->voice.hac = false; in voice_init()
550 adev->voice.volume = 1.0f; in voice_init()
551 adev->voice.mic_mute = false; in voice_init()
552 adev->voice.in_call = false; in voice_init()
553 adev->use_voice_device_mute = false; in voice_init()
556 adev->voice.session[i].pcm_rx = NULL; in voice_init()
557 adev->voice.session[i].pcm_tx = NULL; in voice_init()
558 adev->voice.session[i].state.current = CALL_INACTIVE; in voice_init()
559 adev->voice.session[i].state.new = CALL_INACTIVE; in voice_init()
560 adev->voice.session[i].vsid = VOICE_VSID; in voice_init()
563 voice_extn_init(adev); in voice_init()
566 void voice_update_devices_for_all_voice_usecases(struct audio_device *adev) in voice_update_devices_for_all_voice_usecases() argument
571 list_for_each(node, &adev->usecase_list) { in voice_update_devices_for_all_voice_usecases()
576 usecase->stream.out = adev->current_call_output; in voice_update_devices_for_all_voice_usecases()
577 select_devices(adev, usecase->id); in voice_update_devices_for_all_voice_usecases()