Lines Matching refs:adev
316 static int set_voice_volume_l(struct audio_device *adev, float volume);
317 static struct audio_device *adev = NULL;
323 static bool may_use_noirq_mode(struct audio_device *adev, audio_usecase_t uc_id,
338 if (adev->adm_is_noirq_avail)
339 return adev->adm_is_noirq_avail(adev->adm_data,
340 adev->snd_card, dev_id, dir);
346 struct audio_device *adev = out->dev;
350 if (!adev->adm_register_output_stream)
353 adev->adm_register_output_stream(adev->adm_data,
357 if (!adev->adm_set_config)
361 adev->adm_set_config(adev->adm_data,
369 struct audio_device *adev = in->dev;
370 if (!adev->adm_register_input_stream)
373 adev->adm_register_input_stream(adev->adm_data,
377 if (!adev->adm_set_config)
381 adev->adm_set_config(adev->adm_data,
390 struct audio_device *adev = out->dev;
392 if (adev->adm_request_focus_v2) {
393 adev->adm_request_focus_v2(adev->adm_data, out->handle, ns);
394 } else if (adev->adm_request_focus) {
395 adev->adm_request_focus(adev->adm_data, out->handle);
401 struct audio_device *adev = in->dev;
403 if (adev->adm_request_focus_v2) {
404 adev->adm_request_focus_v2(adev->adm_data, in->capture_handle, ns);
405 } else if (adev->adm_request_focus) {
406 adev->adm_request_focus(adev->adm_data, in->capture_handle);
412 struct audio_device *adev = out->dev;
414 if (adev->adm_abandon_focus)
415 adev->adm_abandon_focus(adev->adm_data, out->handle);
420 struct audio_device *adev = in->dev;
421 if (adev->adm_abandon_focus)
422 adev->adm_abandon_focus(adev->adm_data, in->capture_handle);
446 // always call with adev lock held
449 platform_send_gain_dep_cal(adev->platform, last_known_cal_step);
459 if (adev != NULL && adev->platform != NULL) {
460 pthread_mutex_lock(&adev->lock);
463 pthread_mutex_unlock(&adev->lock);
465 ALOGE("%s: %s is NULL", __func__, adev == NULL ? "adev" : "adev->platform");
481 if (adev == NULL) {
482 ALOGW("%s: adev is NULL .... ", __func__);
486 pthread_mutex_lock(&adev->lock);
488 pthread_mutex_unlock(&adev->lock);
533 static int audio_ssr_status(struct audio_device *adev)
539 ctl = mixer_get_ctl_by_name(adev->mixer, mixer_ctl_name);
550 int enable_audio_route(struct audio_device *adev,
566 audio_extn_utils_send_app_type_cfg(adev, usecase);
567 audio_extn_utils_send_audio_calibration(adev, usecase);
569 platform_add_backend_name(adev->platform, mixer_path, snd_device);
571 audio_route_apply_and_update_path(adev->audio_route, mixer_path);
577 int disable_audio_route(struct audio_device *adev,
592 platform_add_backend_name(adev->platform, mixer_path, snd_device);
594 audio_route_reset_and_update_path(adev->audio_route, mixer_path);
600 int enable_snd_device(struct audio_device *adev,
612 platform_send_audio_calibration(adev->platform, snd_device);
614 if (adev->snd_dev_ref_cnt[snd_device] >= 1) {
626 audio_extn_spkr_prot_calib_cancel(adev);
628 audio_extn_dsm_feedback_enable(adev, snd_device, true);
644 enable_snd_device(adev, new_snd_devices[i]);
646 platform_set_speaker_gain_in_combo(adev, snd_device, true);
649 if (platform_get_snd_device_name_extn(adev->platform, snd_device, device_name) < 0 ) {
655 audio_route_apply_and_update_path(adev->audio_route, device_name);
658 adev->snd_dev_ref_cnt[snd_device]++;
664 int disable_snd_device(struct audio_device *adev,
675 if (adev->snd_dev_ref_cnt[snd_device] <= 0) {
681 adev->snd_dev_ref_cnt[snd_device]--;
682 if (adev->snd_dev_ref_cnt[snd_device] == 0) {
683 audio_extn_dsm_feedback_enable(adev, snd_device, false);
695 // platform_set_swap_channels(adev, false);
701 disable_snd_device(adev, new_snd_devices[i]);
703 platform_set_speaker_gain_in_combo(adev, snd_device, false);
706 if (platform_get_snd_device_name_extn(adev->platform, snd_device, device_name) < 0 ) {
712 audio_route_reset_and_update_path(adev->audio_route, device_name);
829 static void check_and_route_playback_usecases(struct audio_device *adev,
838 bool force_routing = platform_check_and_set_playback_backend_cfg(adev,
857 list_for_each(node, &adev->usecase_list) {
870 disable_audio_route(adev, usecase);
877 list_for_each(node, &adev->usecase_list) {
880 disable_snd_device(adev, usecase->out_snd_device);
885 list_for_each(node, &adev->usecase_list) {
890 enable_snd_device(adev, d_device);
898 list_for_each(node, &adev->usecase_list) {
901 enable_audio_route(adev, usecase);
907 static void check_and_route_capture_usecases(struct audio_device *adev,
916 platform_check_and_set_capture_backend_cfg(adev, uc_info, snd_device);
931 list_for_each(node, &adev->usecase_list) {
940 disable_audio_route(adev, usecase);
947 list_for_each(node, &adev->usecase_list) {
950 disable_snd_device(adev, usecase->in_snd_device);
954 list_for_each(node, &adev->usecase_list) {
957 enable_snd_device(adev, snd_device);
963 list_for_each(node, &adev->usecase_list) {
968 enable_audio_route(adev, usecase);
1114 static bool is_usb_ready(struct audio_device *adev, bool is_playback)
1120 pthread_mutex_lock(&adev->lock);
1126 pthread_mutex_unlock(&adev->lock);
1130 static audio_usecase_t get_voice_usecase_id_from_list(struct audio_device *adev)
1135 list_for_each(node, &adev->usecase_list) {
1145 struct audio_usecase *get_usecase_from_list(struct audio_device *adev,
1151 list_for_each(node, &adev->usecase_list) {
1159 int select_devices(struct audio_device *adev,
1170 struct audio_usecase *voip_usecase = get_usecase_from_list(adev,
1173 usecase = get_usecase_from_list(adev, uc_id);
1181 out_snd_device = platform_get_output_snd_device(adev->platform,
1183 in_snd_device = platform_get_input_snd_device(adev->platform, usecase->stream.out->devices);
1193 if (voice_is_in_call(adev)) {
1194 vc_usecase = get_usecase_from_list(adev,
1195 get_voice_usecase_id_from_list(adev));
1202 } else if (audio_extn_hfp_is_active(adev)) {
1204 hfp_usecase = get_usecase_from_list(adev, hfp_ucid);
1214 struct stream_out *voip_out = adev->primary_output;
1216 out_snd_device = platform_get_output_snd_device(adev->platform,
1223 adev->active_input &&
1224 (adev->active_input->source == AUDIO_SOURCE_VOICE_COMMUNICATION ||
1225 adev->mode == AUDIO_MODE_IN_COMMUNICATION)) {
1226 select_devices(adev, adev->active_input->usecase);
1234 if (adev->active_input &&
1235 (adev->active_input->source == AUDIO_SOURCE_VOICE_COMMUNICATION ||
1236 adev->mode == AUDIO_MODE_IN_COMMUNICATION)) {
1238 struct audio_usecase *voip_usecase = get_usecase_from_list(adev,
1241 platform_set_echo_reference(adev, false, AUDIO_DEVICE_NONE);
1246 } else if (adev->primary_output) {
1247 out_device = adev->primary_output->devices;
1250 in_snd_device = platform_get_input_snd_device(adev->platform, out_device);
1261 out_snd_device != adev->last_logged_snd_device[uc_id][0]) {
1265 adev->last_logged_snd_device[uc_id][0],
1266 platform_get_snd_device_name(adev->last_logged_snd_device[uc_id][0]),
1267 adev->last_logged_snd_device[uc_id][0] != SND_DEVICE_NONE ?
1268 platform_get_snd_device_acdb_id(adev->last_logged_snd_device[uc_id][0]) :
1273 adev->last_logged_snd_device[uc_id][0] = out_snd_device;
1276 in_snd_device != adev->last_logged_snd_device[uc_id][1]) {
1280 adev->last_logged_snd_device[uc_id][1],
1281 platform_get_snd_device_name(adev->last_logged_snd_device[uc_id][1]),
1282 adev->last_logged_snd_device[uc_id][1] != SND_DEVICE_NONE ?
1283 platform_get_snd_device_acdb_id(adev->last_logged_snd_device[uc_id][1]) :
1288 adev->last_logged_snd_device[uc_id][1] = in_snd_device;
1299 status = platform_switch_voice_call_device_pre(adev->platform);
1301 if (voice_is_call_state_active(adev))
1302 voice_set_sidetone(adev, usecase->out_snd_device, false);
1307 disable_audio_route(adev, usecase);
1308 disable_snd_device(adev, usecase->out_snd_device);
1312 disable_audio_route(adev, usecase);
1313 disable_snd_device(adev, usecase->in_snd_device);
1323 status = platform_switch_voice_call_enable_device_config(adev->platform,
1332 check_and_route_playback_usecases(adev, usecase, out_snd_device);
1333 enable_snd_device(adev, out_snd_device);
1337 check_and_route_capture_usecases(adev, usecase, in_snd_device);
1338 enable_snd_device(adev, in_snd_device);
1342 status = platform_switch_voice_call_device_post(adev->platform,
1351 enable_audio_route(adev, usecase);
1358 status = platform_switch_voice_call_usecase_route_post(adev->platform,
1362 if (voice_is_call_state_active(adev))
1363 voice_set_sidetone(adev, out_snd_device, true);
1368 audio_extn_utils_send_app_type_gain(adev,
1379 struct audio_device *adev = in->dev;
1384 if (adev->active_input) {
1385 if (adev->active_input->usecase == in->usecase) {
1386 adev->active_input = NULL;
1388 ALOGW("%s adev->active_input->usecase %s, v/s in->usecase %s",
1390 use_case_table[adev->active_input->usecase],
1395 uc_info = get_usecase_from_list(adev, in->usecase);
1403 voice_check_and_stop_incall_rec_usecase(adev, in);
1406 disable_audio_route(adev, uc_info);
1409 disable_snd_device(adev, uc_info->in_snd_device);
1423 struct audio_device *adev = in->dev;
1427 if (audio_extn_tfa_98xx_is_supported() && !audio_ssr_status(adev))
1431 adev->card_status == CARD_STATUS_OFFLINE) {
1432 ALOGW("in->card_status or adev->card_status offline, try again");
1438 ret = voice_check_and_set_incall_rec_usecase(adev, in);
1452 adev->active_input = in;
1461 list_add_tail(&adev->usecase_list, &uc_info->list);
1465 select_devices(adev, in->usecase);
1489 __func__, adev->snd_card, in->pcm_device_id, in->config.channels);
1492 in->pcm = pcm_open(adev->snd_card, in->pcm_device_id,
1539 adev->active_input = NULL;
1705 static bool allow_hdmi_channel_config(struct audio_device *adev)
1711 list_for_each(node, &adev->usecase_list) {
1736 static int check_and_set_hdmi_channels(struct audio_device *adev,
1743 if (!allow_hdmi_channel_config(adev))
1746 if (channels == adev->cur_hdmi_channels) {
1751 platform_set_hdmi_channels(adev->platform, channels);
1752 adev->cur_hdmi_channels = channels;
1759 list_for_each(node, &adev->usecase_list) {
1763 disable_audio_route(adev, usecase);
1771 list_for_each(node, &adev->usecase_list) {
1775 enable_audio_route(adev, usecase);
1786 struct audio_device *adev = out->dev;
1790 uc_info = get_usecase_from_list(adev, out->usecase);
1798 if (adev->visualizer_stop_output != NULL)
1799 adev->visualizer_stop_output(out->handle, out->pcm_device_id);
1800 if (adev->offload_effects_stop_output != NULL)
1801 adev->offload_effects_stop_output(out->handle, out->pcm_device_id);
1805 disable_audio_route(adev, uc_info);
1808 disable_snd_device(adev, uc_info->out_snd_device);
1813 audio_extn_extspk_update(adev->extspk);
1817 check_and_set_hdmi_channels(adev, DEFAULT_HDMI_OUT_CHANNELS);
1821 list_for_each(node, &adev->usecase_list) {
1824 select_devices(adev, usecase->id);
1836 struct audio_device *adev = out->dev;
1842 adev->card_status == CARD_STATUS_OFFLINE) {
1843 ALOGW("out->card_status or adev->card_status offline, try again");
1866 check_and_set_hdmi_channels(adev, out->config.channels);
1868 list_add_tail(&adev->usecase_list, &uc_info->list);
1872 select_devices(adev, out->usecase);
1874 audio_extn_extspk_update(adev->extspk);
1877 __func__, adev->snd_card, out->pcm_device_id, out->config.format);
1880 out->compr = compress_open(adev->snd_card, out->pcm_device_id,
1892 if (adev->visualizer_start_output != NULL)
1893 adev->visualizer_start_output(out->handle, out->pcm_device_id);
1894 if (adev->offload_effects_start_output != NULL)
1895 adev->offload_effects_start_output(out->handle, out->pcm_device_id);
1918 out->pcm = pcm_open(adev->snd_card, out->pcm_device_id,
1964 platform_set_swap_channels(adev, true);
2085 struct audio_device *adev = out->dev;
2089 if (adev->adm_deregister_stream)
2090 adev->adm_deregister_stream(adev->adm_data, out->handle);
2091 pthread_mutex_lock(&adev->lock);
2114 pthread_mutex_unlock(&adev->lock);
2136 struct audio_device *adev = out->dev;
2209 static bool output_drives_call(struct audio_device *adev, struct stream_out *out)
2211 return out == adev->primary_output || out == adev->voice_tx_output;
2226 struct audio_device *adev = out->dev;
2254 pthread_mutex_lock(&adev->lock);
2277 pthread_mutex_unlock(&adev->lock);
2305 if (output_drives_call(adev, out)) {
2306 if (!voice_is_in_call(adev)) {
2307 if (adev->mode == AUDIO_MODE_IN_CALL) {
2308 adev->current_call_output = out;
2309 ret = voice_start_call(adev);
2312 adev->current_call_output = out;
2313 voice_update_devices_for_all_voice_usecases(adev);
2321 if (adev->adm_on_routing_change) {
2322 adev->adm_on_routing_change(adev->adm_data,
2326 select_devices(adev, out->usecase);
2333 adev, true);
2338 pthread_mutex_unlock(&adev->lock);
2342 audio_extn_extspk_update(adev->extspk);
2511 struct audio_device *adev = out->dev;
2513 ctl = mixer_get_ctl_by_name(adev->mixer, mixer_ctl_name);
2521 ctl = mixer_get_ctl_by_name(adev->mixer, ctl_name);
2554 struct audio_device *adev = out->dev;
2561 pthread_mutex_lock(&adev->lock);
2562 bool valid_cb = (card == adev->snd_card);
2563 pthread_mutex_unlock(&adev->lock);
2605 struct audio_device *adev = out->dev;
2620 pthread_mutex_lock(&adev->lock);
2626 pthread_mutex_unlock(&adev->lock);
2634 pthread_mutex_unlock(&adev->lock);
2907 struct audio_device *adev = out->dev;
2911 pthread_mutex_lock(&adev->lock);
2918 pthread_mutex_unlock(&adev->lock);
2925 struct audio_device *adev = out->dev;
2929 pthread_mutex_lock(&adev->lock);
2937 pthread_mutex_unlock(&adev->lock);
2966 struct audio_device *adev = out->dev;
2975 pthread_mutex_lock(&adev->lock);
2998 __func__, adev->snd_card, out->pcm_device_id, out->config.channels);
2999 out->pcm = pcm_open(adev->snd_card, out->pcm_device_id,
3014 ret = platform_get_mmap_data_fd(adev->platform,
3053 pthread_mutex_unlock(&adev->lock);
3124 struct audio_device *adev = in->dev;
3139 if (adev->adm_deregister_stream)
3140 adev->adm_deregister_stream(adev->adm_data, in->capture_handle);
3142 pthread_mutex_lock(&adev->lock);
3152 adev->enable_voicerx = false;
3153 platform_set_echo_reference(adev, false, AUDIO_DEVICE_NONE );
3157 pthread_mutex_unlock(&adev->lock);
3189 struct audio_device *adev = in->dev;
3203 pthread_mutex_lock(&adev->lock);
3233 if (adev->adm_on_routing_change) {
3234 adev->adm_on_routing_change(adev->adm_data,
3237 select_devices(adev, in->usecase);
3243 pthread_mutex_unlock(&adev->lock);
3289 struct audio_device *adev = in->dev;
3296 pthread_mutex_lock(&adev->lock);
3297 bool valid_cb = (card == adev->snd_card);
3298 pthread_mutex_unlock(&adev->lock);
3324 struct audio_device *adev = in->dev;
3347 pthread_mutex_lock(&adev->lock);
3349 pthread_mutex_unlock(&adev->lock);
3395 * No need to acquire adev->lock to read mic_muted here as we don't change its state.
3397 if (ret == 0 && adev->mic_muted && in->usecase != USECASE_AUDIO_RECORD_AFE_PROXY) {
3452 struct audio_device *adev = in->dev;
3464 adev->mode == AUDIO_MODE_IN_COMMUNICATION) &&
3471 adev->mode == AUDIO_MODE_IN_COMMUNICATION) {
3472 adev->enable_voicerx = enable;
3475 list_for_each(node, &adev->usecase_list) {
3478 select_devices(adev, usecase->id);
3513 struct audio_device *adev = in->dev;
3517 pthread_mutex_lock(&adev->lock);
3524 pthread_mutex_unlock(&adev->lock);
3531 struct audio_device *adev = in->dev;
3535 pthread_mutex_lock(&adev->lock);
3545 pthread_mutex_unlock(&adev->lock);
3554 struct audio_device *adev = in->dev;
3562 pthread_mutex_lock(&adev->lock);
3587 __func__, adev->snd_card, in->pcm_device_id, in->config.channels);
3588 in->pcm = pcm_open(adev->snd_card, in->pcm_device_id,
3604 ret = platform_get_mmap_data_fd(adev->platform,
3644 pthread_mutex_unlock(&adev->lock);
3681 struct audio_device *adev = (struct audio_device *)dev;
3689 if (is_usb_dev && !is_usb_ready(adev, true /* is_playback */)) {
3703 out->dev = adev;
3714 pthread_mutex_lock(&adev->lock);
3738 pthread_mutex_unlock(&adev->lock);
3754 pthread_mutex_lock(&adev->lock);
3755 bool offline = (adev->card_status == CARD_STATUS_OFFLINE);
3756 pthread_mutex_unlock(&adev->lock);
3826 adev->voice_tx_output = out;
3852 out->realtime = may_use_noirq_mode(adev, USECASE_AUDIO_PLAYBACK_ULL, out->flags);
3887 if (adev->primary_output == NULL)
3888 adev->primary_output = out;
3897 pthread_mutex_lock(&adev->lock);
3898 if (get_usecase_from_list(adev, out->usecase) != NULL) {
3900 pthread_mutex_unlock(&adev->lock);
3904 pthread_mutex_unlock(&adev->lock);
3953 adev state.
3957 pthread_mutex_lock(&adev->lock);
3958 out->card_status = adev->card_status;
3959 pthread_mutex_unlock(&adev->lock);
3980 struct audio_device *adev = out->dev;
3995 if (adev->voice_tx_output == out)
3996 adev->voice_tx_output = NULL;
4009 struct audio_device *adev = (struct audio_device *)dev;
4019 pthread_mutex_lock(&adev->lock);
4022 status = voice_set_parameters(adev, parms);
4031 adev->bluetooth_nrec = true;
4033 adev->bluetooth_nrec = false;
4039 adev->screen_off = false;
4041 adev->screen_off = true;
4066 platform_check_and_set_swap_lr_channels(adev, reverse_speakers);
4072 adev->bt_wb_speech_enabled = !strcmp(value, AUDIO_PARAMETER_VALUE_ON);
4112 audio_extn_hfp_set_parameters(adev, parms);
4115 pthread_mutex_unlock(&adev->lock);
4123 struct audio_device *adev = (struct audio_device *)dev;
4128 pthread_mutex_lock(&adev->lock);
4130 voice_get_parameters(adev, query, reply);
4135 pthread_mutex_unlock(&adev->lock);
4148 struct audio_device *adev = (struct audio_device *)dev;
4150 audio_extn_extspk_set_voice_vol(adev->extspk, volume);
4152 pthread_mutex_lock(&adev->lock);
4153 ret = voice_set_volume(adev, volume);
4154 pthread_mutex_unlock(&adev->lock);
4182 struct audio_device *adev = (struct audio_device *)dev;
4184 pthread_mutex_lock(&adev->lock);
4185 if (adev->mode != mode) {
4187 adev->mode = mode;
4189 voice_is_in_call(adev)) {
4190 voice_stop_call(adev);
4191 adev->current_call_output = NULL;
4194 pthread_mutex_unlock(&adev->lock);
4196 audio_extn_extspk_set_mode(adev->extspk, mode);
4204 struct audio_device *adev = (struct audio_device *)dev;
4207 pthread_mutex_lock(&adev->lock);
4208 if (audio_extn_tfa_98xx_is_supported() && adev->enable_hfp) {
4209 ret = audio_extn_hfp_set_mic_mute(adev, state);
4211 ret = voice_set_mic_mute(adev, state);
4213 adev->mic_muted = state;
4214 pthread_mutex_unlock(&adev->lock);
4241 static bool adev_input_allow_hifi_record(struct audio_device *adev,
4267 switch (adev->mode) {
4286 struct audio_device *adev = (struct audio_device *)dev;
4292 bool may_use_hifi_record = adev_input_allow_hifi_record(adev,
4299 if (is_usb_dev && !is_usb_ready(adev, false /* is_playback */)) {
4318 (audio_extn_hfp_is_active(adev) || voice_is_in_call(adev)))
4345 in->dev = adev;
4441 in->realtime = may_use_noirq_mode(adev, in->usecase, in->flags);
4516 pthread_mutex_lock(&adev->lock);
4517 in->card_status = adev->card_status;
4518 pthread_mutex_unlock(&adev->lock);
4570 static int adev_verify_devices(struct audio_device *adev)
4609 const unsigned card_id = adev->snd_card;
4632 pparams = &adev->use_case_table[audio_usecase];
4646 adev->active_input = ∈
4652 adev->active_input = NULL;
4660 list_add_tail(&adev->usecase_list, &uc_info.list);
4663 retval = select_devices(adev, audio_usecase);
4679 retval = disable_audio_route(adev, &uc_info);
4681 retval = disable_snd_device(adev,
4686 adev->active_input = NULL; /* restore adev state */
4693 struct audio_device *adev = (struct audio_device *)device;
4695 if (!adev)
4701 audio_extn_snd_mon_unregister_listener(adev);
4703 audio_route_free(adev->audio_route);
4704 free(adev->snd_dev_ref_cnt);
4705 platform_deinit(adev->platform);
4706 audio_extn_extspk_deinit(adev->extspk);
4707 audio_extn_sound_trigger_deinit(adev);
4709 for (i = 0; i < ARRAY_SIZE(adev->use_case_table); ++i) {
4710 pcm_params_free(adev->use_case_table[i]);
4712 if (adev->adm_deinit)
4713 adev->adm_deinit(adev->adm_data);
4754 pthread_mutex_lock(&adev->lock);
4755 bool valid_cb = (card == adev->snd_card);
4757 if (adev->card_status != status) {
4758 adev->card_status = status;
4759 platform_snd_card_update(adev->platform, status);
4762 pthread_mutex_unlock(&adev->lock);
4775 *device = &adev->device.common;
4777 ALOGV("%s: returning existing instance of adev", __func__);
4782 adev = calloc(1, sizeof(struct audio_device));
4784 pthread_mutex_init(&adev->lock, (const pthread_mutexattr_t *) NULL);
4786 adev->device.common.tag = HARDWARE_DEVICE_TAG;
4787 adev->device.common.version = AUDIO_DEVICE_API_VERSION_2_0;
4788 adev->device.common.module = (struct hw_module_t *)module;
4789 adev->device.common.close = adev_close;
4791 adev->device.init_check = adev_init_check;
4792 adev->device.set_voice_volume = adev_set_voice_volume;
4793 adev->device.set_master_volume = adev_set_master_volume;
4794 adev->device.get_master_volume = adev_get_master_volume;
4795 adev->device.set_master_mute = adev_set_master_mute;
4796 adev->device.get_master_mute = adev_get_master_mute;
4797 adev->device.set_mode = adev_set_mode;
4798 adev->device.set_mic_mute = adev_set_mic_mute;
4799 adev->device.get_mic_mute = adev_get_mic_mute;
4800 adev->device.set_parameters = adev_set_parameters;
4801 adev->device.get_parameters = adev_get_parameters;
4802 adev->device.get_input_buffer_size = adev_get_input_buffer_size;
4803 adev->device.open_output_stream = adev_open_output_stream;
4804 adev->device.close_output_stream = adev_close_output_stream;
4805 adev->device.open_input_stream = adev_open_input_stream;
4807 adev->device.close_input_stream = adev_close_input_stream;
4808 adev->device.dump = adev_dump;
4811 pthread_mutex_lock(&adev->lock);
4812 adev->mode = AUDIO_MODE_NORMAL;
4813 adev->active_input = NULL;
4814 adev->primary_output = NULL;
4815 adev->bluetooth_nrec = true;
4816 adev->acdb_settings = TTY_MODE_OFF;
4817 /* adev->cur_hdmi_channels = 0; by calloc() */
4818 adev->snd_dev_ref_cnt = calloc(SND_DEVICE_MAX, sizeof(int));
4819 voice_init(adev);
4820 list_init(&adev->usecase_list);
4821 pthread_mutex_unlock(&adev->lock);
4824 adev->platform = platform_init(adev);
4825 if (!adev->platform) {
4826 free(adev->snd_dev_ref_cnt);
4827 free(adev);
4833 adev->extspk = audio_extn_extspk_init(adev);
4835 adev->visualizer_lib = dlopen(VISUALIZER_LIBRARY_PATH, RTLD_NOW);
4836 if (adev->visualizer_lib == NULL) {
4840 adev->visualizer_start_output =
4841 (int (*)(audio_io_handle_t, int))dlsym(adev->visualizer_lib,
4843 adev->visualizer_stop_output =
4844 (int (*)(audio_io_handle_t, int))dlsym(adev->visualizer_lib,
4848 adev->offload_effects_lib = dlopen(OFFLOAD_EFFECTS_BUNDLE_LIBRARY_PATH, RTLD_NOW);
4849 if (adev->offload_effects_lib == NULL) {
4855 adev->offload_effects_start_output =
4856 (int (*)(audio_io_handle_t, int))dlsym(adev->offload_effects_lib,
4858 adev->offload_effects_stop_output =
4859 (int (*)(audio_io_handle_t, int))dlsym(adev->offload_effects_lib,
4863 adev->adm_lib = dlopen(ADM_LIBRARY_PATH, RTLD_NOW);
4864 if (adev->adm_lib == NULL) {
4868 adev->adm_init = (adm_init_t)
4869 dlsym(adev->adm_lib, "adm_init");
4870 adev->adm_deinit = (adm_deinit_t)
4871 dlsym(adev->adm_lib, "adm_deinit");
4872 adev->adm_register_input_stream = (adm_register_input_stream_t)
4873 dlsym(adev->adm_lib, "adm_register_input_stream");
4874 adev->adm_register_output_stream = (adm_register_output_stream_t)
4875 dlsym(adev->adm_lib, "adm_register_output_stream");
4876 adev->adm_deregister_stream = (adm_deregister_stream_t)
4877 dlsym(adev->adm_lib, "adm_deregister_stream");
4878 adev->adm_request_focus = (adm_request_focus_t)
4879 dlsym(adev->adm_lib, "adm_request_focus");
4880 adev->adm_abandon_focus = (adm_abandon_focus_t)
4881 dlsym(adev->adm_lib, "adm_abandon_focus");
4882 adev->adm_set_config = (adm_set_config_t)
4883 dlsym(adev->adm_lib, "adm_set_config");
4884 adev->adm_request_focus_v2 = (adm_request_focus_v2_t)
4885 dlsym(adev->adm_lib, "adm_request_focus_v2");
4886 adev->adm_is_noirq_avail = (adm_is_noirq_avail_t)
4887 dlsym(adev->adm_lib, "adm_is_noirq_avail");
4888 adev->adm_on_routing_change = (adm_on_routing_change_t)
4889 dlsym(adev->adm_lib, "adm_on_routing_change");
4892 adev->bt_wb_speech_enabled = false;
4893 adev->enable_voicerx = false;
4895 *device = &adev->device.common;
4898 adev_verify_devices(adev);
4919 // audio_extn_utils_send_default_app_type_cfg(adev->platform, adev->mixer);
4932 audio_extn_tfa_98xx_init(adev);
4936 if (adev->adm_init)
4937 adev->adm_data = adev->adm_init();
4941 pthread_mutex_lock(&adev->lock);
4943 adev->card_status = CARD_STATUS_ONLINE;
4944 pthread_mutex_unlock(&adev->lock);
4945 audio_extn_sound_trigger_init(adev);/* dependent on snd_mon_init() */