Home | History | Annotate | Download | only in hal

Lines Matching refs:adev

41 static struct voice_session *voice_get_session_from_use_case(struct audio_device *adev,
47 ret = voice_extn_get_session_from_use_case(adev, usecase_id, &session);
49 session = &adev->voice.session[VOICE_SESS_IDX];
78 void voice_set_sidetone(struct audio_device *adev,
100 audio_route_apply_and_update_path(adev->audio_route, mixer_path);
102 audio_route_reset_and_update_path(adev->audio_route, mixer_path);
107 int voice_stop_usecase(struct audio_device *adev, audio_usecase_t usecase_id)
115 session = (struct voice_session *)voice_get_session_from_use_case(adev, usecase_id);
117 uc_info = get_usecase_from_list(adev, usecase_id);
127 if (!voice_is_call_state_active(adev))
128 voice_set_sidetone(adev, uc_info->out_snd_device, false);
130 ret = platform_stop_voice_call(adev->platform, session->vsid);
143 disable_audio_route(adev, uc_info);
146 disable_snd_device(adev, uc_info->out_snd_device);
147 disable_snd_device(adev, uc_info->in_snd_device);
156 int voice_start_usecase(struct audio_device *adev, audio_usecase_t usecase_id)
166 session = (struct voice_session *)voice_get_session_from_use_case(adev, usecase_id);
170 uc_info->stream.out = adev->current_call_output ;
171 uc_info->devices = adev->current_call_output ->devices;
175 list_add_tail(&adev->usecase_list, &uc_info->list);
177 select_devices(adev, usecase_id);
190 __func__, adev->snd_card, pcm_dev_tx_id);
191 session->pcm_tx = pcm_open(adev->snd_card,
201 __func__, adev->snd_card, pcm_dev_rx_id);
202 session->pcm_rx = pcm_open(adev->snd_card,
215 if (!voice_is_call_state_active(adev))
216 voice_set_sidetone(adev, uc_info->out_snd_device, true);
218 voice_set_volume(adev, adev->voice.volume);
220 ret = platform_start_voice_call(adev->platform, session->vsid);
230 voice_stop_usecase(adev, usecase_id);
237 bool voice_is_call_state_active(struct audio_device *adev)
242 ret = voice_extn_is_call_state_active(adev, &call_state);
244 call_state = (adev->voice.session[VOICE_SESS_IDX].state.current == CALL_ACTIVE) ? true : false;
250 bool voice_is_in_call(struct audio_device *adev)
252 return adev->voice.in_call;
268 uint32_t voice_get_active_session_id(struct audio_device *adev)
273 ret = voice_extn_get_active_session_id(adev, &session_id);
280 int voice_check_and_set_incall_rec_usecase(struct audio_device *adev,
288 if (voice_is_call_state_active(adev)) {
308 session_id = voice_get_active_session_id(adev);
309 ret = platform_set_incall_recording_session_id(adev->platform,
319 int voice_check_and_stop_incall_rec_usecase(struct audio_device *adev,
327 ret = platform_stop_incall_recording_usecase(adev->platform);
334 int voice_check_and_set_incall_music_usecase(struct audio_device *adev,
339 ret = voice_extn_check_and_set_incall_music_usecase(adev, out);
348 int voice_set_mic_mute(struct audio_device *adev, bool state)
352 adev->voice.mic_mute = state;
353 if (adev->mode == AUDIO_MODE_IN_CALL ||
354 adev->mode == AUDIO_MODE_IN_COMMUNICATION)
355 err = platform_set_mic_mute(adev->platform, state);
360 bool voice_get_mic_mute(struct audio_device *adev)
362 return adev->voice.mic_mute;
365 int voice_set_volume(struct audio_device *adev, float volume)
369 adev->voice.volume = volume;
370 if (adev->mode == AUDIO_MODE_IN_CALL) {
384 err = platform_set_voice_volume(adev->platform, vol);
390 int voice_start_call(struct audio_device *adev)
394 adev->voice.in_call = true;
396 voice_set_mic_mute(adev, adev->voice.mic_mute);
398 ret = voice_extn_start_call(adev);
400 ret = voice_start_usecase(adev, USECASE_VOICE_CALL);
406 int voice_stop_call(struct audio_device *adev)
410 adev->voice.in_call = false;
411 ret = voice_extn_stop_call(adev);
413 ret = voice_stop_usecase(adev, USECASE_VOICE_CALL);
419 void voice_get_parameters(struct audio_device *adev,
423 voice_extn_get_parameters(adev, query, reply);
426 int voice_set_parameters(struct audio_device *adev, struct str_parms *parms)
436 ret = voice_extn_set_parameters(adev, parms);
462 if (tty_mode != adev->voice.tty_mode) {
463 adev->voice.tty_mode = tty_mode;
464 adev->acdb_settings = (adev->acdb_settings & TTY_MODE_CLEAR) | tty_mode;
465 if (voice_is_call_state_active(adev))
466 voice_update_devices_for_all_voice_usecases(adev);
478 if (hac != adev->voice.hac) {
479 adev->voice.hac = hac;
480 if (voice_is_in_call(adev))
481 voice_update_devices_for_all_voice_usecases(adev);
490 platform_start_incall_music_usecase(adev->platform);
492 platform_stop_incall_music_usecase(adev->platform);
501 void voice_init(struct audio_device *adev)
505 memset(&adev->voice, 0, sizeof(adev->voice));
506 adev->voice.tty_mode = TTY_MODE_OFF;
507 adev->voice.hac = false;
508 adev->voice.volume = 1.0f;
509 adev->voice.mic_mute = false;
510 adev->voice.in_call = false;
512 adev->voice.session[i].pcm_rx = NULL;
513 adev->voice.session[i].pcm_tx = NULL;
514 adev->voice.session[i].state.current = CALL_INACTIVE;
515 adev->voice.session[i].state.new = CALL_INACTIVE;
516 adev->voice.session[i].vsid = VOICE_VSID;
519 voice_extn_init(adev);
522 void voice_update_devices_for_all_voice_usecases(struct audio_device *adev)
527 list_for_each(node, &adev->usecase_list) {
532 usecase->stream.out = adev->current_call_output;
533 select_devices(adev, usecase->id);