Home | History | Annotate | Download | only in hal

Lines Matching refs:adev

228 static void dummybuf_thread_close(struct audio_device *adev);
299 struct mixer_card *adev_get_mixer_for_card(struct audio_device *adev, int card)
304 list_for_each(node, &adev->mixer_list) {
325 void free_mixer_list(struct audio_device *adev)
331 list_for_each_safe(node, next, &adev->mixer_list) {
339 int mixer_init(struct audio_device *adev)
350 list_init(&adev->mixer_list);
354 if (adev_get_mixer_for_card(adev, card) == NULL) {
379 list_add_tail(&adev->mixer_list, &mixer_card->adev_list_node);
386 free_mixer_list(adev);
425 static struct audio_usecase *get_usecase_from_id(struct audio_device *adev,
431 list_for_each(node, &adev->usecase_list) {
439 static struct audio_usecase *get_usecase_from_type(struct audio_device *adev,
445 list_for_each(node, &adev->usecase_list) {
453 /* always called with adev lock held */
454 static int set_voice_volume_l(struct audio_device *adev, float volume)
459 if (adev->mode == AUDIO_MODE_IN_CALL) {
466 snd_device_t get_output_snd_device(struct audio_device *adev, audio_devices_t devices)
469 audio_mode_t mode = adev->mode;
482 if (adev->tty_mode == TTY_MODE_FULL)
484 else if (adev->tty_mode == TTY_MODE_VCO)
486 else if (adev->tty_mode == TTY_MODE_HCO)
540 snd_device_t get_input_snd_device(struct audio_device *adev, audio_devices_t out_device)
543 audio_mode_t mode = adev->mode;
550 usecase = get_usecase_from_type(adev, PCM_CAPTURE|VOICE_CALL);
570 if (adev->tty_mode != TTY_MODE_OFF) {
573 switch (adev->tty_mode) {
584 ALOGE("%s: Invalid TTY mode (%#x)", __func__, adev->tty_mode);
606 if (adev->dualmic_config == DUALMIC_CONFIG_1) {
609 else if (adev->ns_in_voice_rec)
687 int set_hdmi_channels(struct audio_device *adev, int channel_count)
691 (void)adev;
698 int edid_get_max_channels(struct audio_device *adev)
702 (void)adev;
716 static int enable_snd_device(struct audio_device *adev,
728 adev->snd_dev_ref_cnt[snd_device]++;
729 if (adev->snd_dev_ref_cnt[snd_device] > 1) {
748 static int disable_snd_device(struct audio_device *adev,
760 if (adev->snd_dev_ref_cnt[snd_device] <= 0) {
764 adev->snd_dev_ref_cnt[snd_device]--;
765 if (adev->snd_dev_ref_cnt[snd_device] == 0) {
778 static int select_devices(struct audio_device *adev,
795 usecase = get_usecase_from_type(adev, PCM_CAPTURE|VOICE_CALL);
800 usecase = get_usecase_from_id(adev, uc_id);
808 out_snd_device = get_output_snd_device(adev, active_out->devices);
809 in_snd_device = get_input_snd_device(adev, active_out->devices);
818 if (adev->in_call) {
819 vc_usecase = get_usecase_from_id(adev, USECASE_VOICE_CALL);
831 out_snd_device = get_output_snd_device(adev, active_out->devices);
832 if (active_out == adev->primary_output &&
835 select_devices(adev, active_input->usecase);
843 adev->primary_output && !adev->primary_output->standby) {
844 in_snd_device = get_input_snd_device(adev, adev->primary_output->devices);
846 in_snd_device = get_input_snd_device(adev, AUDIO_DEVICE_NONE);
864 pthread_mutex_lock(&adev->tfa9895_lock);
865 disable_snd_device(adev, usecase, usecase->out_snd_device, false);
866 pthread_mutex_unlock(&adev->tfa9895_lock);
870 disable_snd_device(adev, usecase, usecase->in_snd_device, false);
875 enable_snd_device(adev, usecase, out_snd_device, false);
879 enable_snd_device(adev, usecase, in_snd_device, false);
892 if (adev->htc_acoustic_set_rt5506_amp != NULL)
893 adev->htc_acoustic_set_rt5506_amp(adev->mode, usecase->devices);
1109 static void put_echo_reference(struct audio_device *adev,
1113 int32_t prev_generation = adev->echo_reference_generation;
1114 struct stream_out *out = adev->primary_output;
1116 if (adev->echo_reference != NULL &&
1117 reference == adev->echo_reference) {
1120 adev->echo_reference = NULL;
1121 android_atomic_inc(&adev->echo_reference_generation);
1136 static struct echo_reference_itfe *get_echo_reference(struct audio_device *adev,
1142 put_echo_reference(adev, adev->echo_reference);
1145 if (adev->primary_output!= NULL && adev->primary_output->usecase == USECASE_AUDIO_PLAYBACK &&
1146 !adev->primary_output->standby) {
1148 &adev->primary_output->stream.common;
1158 &adev->echo_reference);
1160 android_atomic_inc(&adev->echo_reference_generation);
1162 return adev->echo_reference;
1170 struct audio_device *adev = in->dev;
1174 if (adev->primary_output!= NULL &&
1175 !adev->primary_output->standby &&
1176 adev->primary_output->usecase == USECASE_AUDIO_PLAYBACK &&
1177 adev->primary_output->devices == AUDIO_DEVICE_OUT_SPEAKER) {
1178 struct audio_stream *stream = &adev->primary_output->stream.common;
1890 struct audio_device *adev = in->dev;
1892 adev->active_input = NULL;
1895 uc_info = get_usecase_from_id(adev, in->usecase);
1903 disable_snd_device(adev, uc_info, uc_info->in_snd_device, true);
1933 struct audio_device *adev = in->dev;
1938 adev->active_input = in;
1969 &adev_get_mixer_for_card(adev,
1972 list_add_tail(&adev->usecase_list, &uc_info->adev_list_node);
1974 select_devices(adev, in->usecase);
2013 in->echo_reference = get_echo_reference(adev,
2042 if (!adev->sound_trigger_open_for_streaming) {
2048 pcm_device->sound_trigger_handle = adev->sound_trigger_open_for_streaming();
2093 adev->active_input = NULL;
2278 struct audio_device *adev = out->dev;
2283 adev->sound_trigger_close_for_streaming(pcm_device->sound_trigger_handle);
2351 struct audio_device *adev = out->dev;
2354 uc_info = get_usecase_from_id(adev, out->usecase);
2360 disable_snd_device(adev, uc_info, uc_info->out_snd_device, true);
2370 struct audio_device *adev = out->dev;
2382 list_add_tail(&adev->usecase_list, &uc_info->adev_list_node);
2384 select_devices(adev, out->usecase);
2390 struct audio_device *adev = out->dev;
2397 adev->offload_fx_stop_output != NULL) {
2398 adev->offload_fx_stop_output(out->handle);
2415 struct audio_device *adev = out->dev;
2429 out->echo_reference_generation = adev->echo_reference_generation;
2430 if (adev->echo_reference != NULL)
2431 out->echo_reference = adev->echo_reference;
2446 if (adev->offload_fx_start_output != NULL)
2447 adev->offload_fx_start_output(out->handle);
2457 static int stop_voice_call(struct audio_device *adev)
2462 adev->in_call = false;
2466 uc_info = get_usecase_from_id(adev, USECASE_VOICE_CALL);
2473 disable_snd_device(adev, uc_info, uc_info->out_snd_device, false);
2474 disable_snd_device(adev, uc_info, uc_info->in_snd_device, true);
2484 /* always called with adev lock held */
2485 static int start_voice_call(struct audio_device *adev)
2494 uc_info->stream = (struct audio_stream *)adev->primary_output;
2495 uc_info->devices = adev->primary_output->devices;
2501 list_add_tail(&adev->usecase_list, &uc_info->adev_list_node);
2503 select_devices(adev, USECASE_VOICE_CALL);
2509 set_voice_volume_l(adev, adev->voice_volume);
2511 adev->in_call = true;
2618 struct audio_device *adev = out->dev;
2628 if (out->echo_reference_generation != adev->echo_reference_generation) {
2631 out->echo_reference_generation = adev->echo_reference_generation;
2653 struct audio_device *adev = out->dev;
2659 pthread_mutex_lock(&adev->lock);
2661 pthread_mutex_unlock(&adev->lock);
2712 struct audio_device *adev = out->dev;
2726 adev->mode(%d)",
2727 __func__, out->usecase, use_case_table[out->usecase], kvpairs, out->devices, adev->mode);
2732 pthread_mutex_lock(&adev->lock_inputs);
2734 pthread_mutex_lock(&adev->lock);
2741 if (adev->active_input && (adev->active_input->source == AUDIO_SOURCE_VOICE_COMMUNICATION ||
2742 adev->active_input->source == AUDIO_SOURCE_MIC)) {
2743 in = adev->active_input;
2751 uc_info = get_usecase_from_id(adev, out->usecase);
2768 select_devices(adev, out->usecase);
2771 if ((adev->mode == AUDIO_MODE_IN_CALL) && !adev->in_call &&
2772 (out == adev->primary_output)) {
2773 start_voice_call(adev);
2774 } else if ((adev->mode == AUDIO_MODE_IN_CALL) && adev->in_call &&
2775 (out == adev->primary_output)) {
2776 select_devices(adev, USECASE_VOICE_CALL);
2780 if ((adev->mode == AUDIO_MODE_NORMAL) && adev->in_call &&
2781 (out == adev->primary_output)) {
2782 stop_voice_call(adev);
2784 pthread_mutex_unlock(&adev->lock);
2788 /* The lock on adev->lock_inputs prevents input stream from being closed */
2790 pthread_mutex_lock(&adev->lock);
2791 LOG_ALWAYS_FATAL_IF(in != adev->active_input);
2793 pthread_mutex_unlock(&adev->lock);
2797 pthread_mutex_unlock(&adev->lock_inputs);
2863 struct audio_device *adev = out->dev;
2904 struct audio_device *adev = (struct audio_device *)context;
2905 pthread_mutex_lock(&adev->tfa9895_lock);
2906 adev->tfa9895_init =
2907 adev->htc_acoustic_set_amp_mode(adev->mode, AUDIO_DEVICE_OUT_SPEAKER, 0, 0, false);
2908 if (!adev->tfa9895_init) {
2910 adev->tfa9895_mode_change |= 0x1;
2912 ALOGI("@@##tfa9895_config_thread Done!! tfa9895_mode_change=%d", adev->tfa9895_mode_change);
2913 pthread_mutex_unlock(&adev->tfa9895_lock);
2914 dummybuf_thread_close(adev);
2922 struct audio_device *adev = out->dev;
2941 pthread_mutex_lock(&adev->lock_inputs);
2944 pthread_mutex_unlock(&adev->lock_inputs);
2948 pthread_mutex_lock(&adev->lock);
2952 pthread_mutex_unlock(&adev->lock);
2954 pthread_mutex_unlock(&adev->lock_inputs);
2962 if (adev->active_input &&
2963 (adev->active_input->source == AUDIO_SOURCE_VOICE_COMMUNICATION ||
2964 adev->active_input->source == AUDIO_SOURCE_MIC)) {
2965 in = adev->active_input;
2969 pthread_mutex_unlock(&adev->lock);
2973 pthread_mutex_unlock(&adev->lock_inputs);
2984 pthread_mutex_lock(&adev->lock);
2986 pthread_mutex_unlock(&adev->lock);
3008 pthread_mutex_unlock(&adev->lock_inputs);
3014 if (android_atomic_acquire_load(&adev->echo_reference_generation)
3016 pthread_mutex_lock(&adev->lock);
3021 // note that adev->echo_reference_generation here can be different from the one
3022 // tested above but it doesn't matter as we now have the adev mutex and it is consistent
3024 out->echo_reference_generation = adev->echo_reference_generation;
3025 out->echo_reference = adev->echo_reference;
3028 pthread_mutex_unlock(&adev->lock);
3065 if (adev->tfa9895_mode_change == 0x1) {
3067 pthread_mutex_lock(&adev->tfa9895_lock);
3102 adev->tfa9895_mode_change &= ~0x1;
3104 "adev->tfa9895_mode_change=%d", adev->tfa9895_mode_change);
3105 adev->tfa9895_init =
3106 adev->htc_acoustic_set_amp_mode(
3107 adev->mode, AUDIO_DEVICE_OUT_SPEAKER, 0, 0, false);
3126 pthread_mutex_unlock(&adev->tfa9895_lock);
3132 pthread_mutex_unlock(&adev->tfa9895_lock);
3165 /* The lock on adev->lock_inputs prevents input stream from being closed */
3167 pthread_mutex_lock(&adev->lock);
3168 LOG_ALWAYS_FATAL_IF(in != adev->active_input);
3170 pthread_mutex_unlock(&adev->lock);
3173 pthread_mutex_unlock(&adev->lock_inputs);
3409 struct audio_device *adev = in->dev;
3418 adev->sound_trigger_close_for_streaming(pcm_device->sound_trigger_handle);
3432 struct audio_device *adev = in->dev;
3442 put_echo_reference(adev, in->echo_reference);
3468 // called with adev->lock_inputs locked
3471 struct audio_device *adev = in->dev;
3475 pthread_mutex_lock(&adev->lock);
3477 pthread_mutex_unlock(&adev->lock);
3486 struct audio_device *adev = in->dev;
3489 pthread_mutex_lock(&adev->lock_inputs);
3491 pthread_mutex_unlock(&adev->lock_inputs);
3507 struct audio_device *adev = in->dev;
3523 pthread_mutex_lock(&adev->lock_inputs);
3525 pthread_mutex_lock(&adev->lock);
3541 uc_info = get_usecase_from_id(adev, in->usecase);
3559 ret = select_devices(adev, in->usecase);
3563 pthread_mutex_unlock(&adev->lock);
3565 pthread_mutex_unlock(&adev->lock_inputs);
3592 struct audio_device *adev = in->dev;
3598 return adev->sound_trigger_read_samples(pcm_device->sound_trigger_handle, buffer, bytes);
3607 struct audio_device *adev = in->dev;
3614 /* no need to acquire adev->lock_inputs because API contract prevents a close */
3618 pthread_mutex_lock(&adev->lock_inputs);
3621 pthread_mutex_unlock(&adev->lock_inputs);
3624 pthread_mutex_lock(&adev->lock);
3626 pthread_mutex_unlock(&adev->lock);
3627 pthread_mutex_unlock(&adev->lock_inputs);
3657 if (read_and_process_successful == true && adev->mic_mute)
3684 struct audio_device *adev = in->dev;
3696 pthread_mutex_lock(&adev->lock_inputs);
3770 pthread_mutex_unlock(&adev->lock_inputs);
3796 struct audio_device *adev = (struct audio_device *)dev;
3811 out->dev = adev;
3888 if (adev->primary_output == NULL)
3889 adev->primary_output = out;
3898 pthread_mutex_lock(&adev->lock);
3899 if (get_usecase_from_id(adev, out->usecase) != NULL) {
3901 pthread_mutex_unlock(&adev->lock);
3905 pthread_mutex_unlock(&adev->lock);
3952 struct audio_device *adev = out->dev;
3971 struct audio_device *adev = (struct audio_device *)dev;
3996 pthread_mutex_lock(&adev->lock);
3997 if (tty_mode != adev->tty_mode) {
3998 adev->tty_mode = tty_mode;
3999 if (adev->in_call)
4000 select_devices(adev, USECASE_VOICE_CALL);
4002 pthread_mutex_unlock(&adev->lock);
4011 adev->bluetooth_nrec = true;
4013 adev->bluetooth_nrec = false;
4019 adev->screen_off = false;
4021 adev->screen_off = true;
4041 pthread_mutex_lock(&adev->lock);
4042 if (adev->speaker_lr_swap != reverse_speakers) {
4043 adev->speaker_lr_swap = reverse_speakers;
4047 list_for_each(node, &adev->usecase_list) {
4050 select_devices(adev, usecase->id);
4051 if (adev->htc_acoustic_spk_reverse)
4052 adev->htc_acoustic_spk_reverse(adev->speaker_lr_swap);
4057 pthread_mutex_unlock(&adev->lock);
4084 struct audio_device *adev = (struct audio_device *)dev;
4085 pthread_mutex_lock(&adev->lock);
4087 adev->voice_volume = volume;
4088 ret = set_voice_volume_l(adev, adev->voice_volume);
4089 pthread_mutex_unlock(&adev->lock);
4128 struct audio_device *adev = (struct audio_device *)dev;
4130 pthread_mutex_lock(&adev->lock);
4131 if (adev->mode != mode) {
4133 adev->mode = mode;
4134 pthread_mutex_lock(&adev->tfa9895_lock);
4135 adev->tfa9895_mode_change |= 0x1;
4136 pthread_mutex_unlock(&adev->tfa9895_lock);
4138 pthread_mutex_unlock(&adev->lock);
4144 struct audio_device *adev = (struct audio_device *)dev;
4147 pthread_mutex_lock(&adev->lock);
4148 adev->mic_mute = state;
4150 if (adev->mode == AUDIO_MODE_IN_CALL) {
4154 pthread_mutex_unlock(&adev->lock);
4160 struct audio_device *adev = (struct audio_device *)dev;
4162 *state = adev->mic_mute;
4190 struct audio_device *adev = (struct audio_device *)dev;
4229 in->dev = adev;
4255 struct audio_device *adev = (struct audio_device *)dev;
4260 pthread_mutex_lock(&adev->lock_inputs);
4298 pthread_mutex_unlock(&adev->lock_inputs);
4313 struct audio_device *adev = (struct audio_device *)device;
4315 free(adev->snd_dev_ref_cnt);
4316 free_mixer_list(adev);
4325 struct audio_device *adev = (struct audio_device *)context;
4335 if (adev->dummybuf_thread_devices == AUDIO_DEVICE_OUT_WIRED_HEADPHONE) {
4346 pthread_mutex_lock(&adev->dummybuf_thread_lock);
4363 adev->dummybuf_thread_active = 1;
4369 pthread_mutex_unlock(&adev->dummybuf_thread_lock);
4373 pthread_mutex_unlock(&adev->dummybuf_thread_lock);
4376 pthread_mutex_lock(&adev->dummybuf_thread_lock);
4383 adev->dummybuf_thread_active = 1;
4400 if (adev->dummybuf_thread_cancel || adev->dummybuf_thread_timeout-- <= 0) {
4401 adev->dummybuf_thread_active = 0;
4402 adev->dummybuf_thread_cancel = 0;
4413 pthread_mutex_unlock(&adev->dummybuf_thread_lock);
4418 pthread_mutex_unlock(&adev->dummybuf_thread_lock);
4428 static void dummybuf_thread_open(struct audio_device *adev)
4430 adev->dummybuf_thread_timeout = 6000; /* in 18 sec */
4431 adev->dummybuf_thread_cancel = 0;
4432 adev->dummybuf_thread_active = 0;
4433 pthread_mutex_init(&adev->dummybuf_thread_lock, (const pthread_mutexattr_t *) NULL);
4434 if (!adev->dummybuf_thread)
4435 pthread_create(&adev->dummybuf_thread, (const pthread_attr_t *) NULL, dummybuf_thread, adev);
4438 static void dummybuf_thread_close(struct audio_device *adev)
4443 if (adev->dummybuf_thread == 0)
4446 pthread_mutex_lock(&adev->dummybuf_thread_lock);
4447 adev->dummybuf_thread_cancel = 1;
4448 pthread_mutex_unlock(&adev->dummybuf_thread_lock);
4451 pthread_mutex_lock(&adev->dummybuf_thread_lock);
4452 if (adev->dummybuf_thread_active == 0) {
4453 pthread_mutex_unlock(&adev->dummybuf_thread_lock);
4456 pthread_mutex_unlock(&adev->dummybuf_thread_lock);
4461 pthread_join(adev->dummybuf_thread, (void **) NULL);
4462 pthread_mutex_destroy(&adev->dummybuf_thread_lock);
4463 adev->dummybuf_thread = 0;
4469 struct audio_device *adev;
4475 adev = calloc(1, sizeof(struct audio_device));
4477 adev->device.common.tag = HARDWARE_DEVICE_TAG;
4478 adev->device.common.version = AUDIO_DEVICE_API_VERSION_2_0;
4479 adev->device.common.module = (struct hw_module_t *)module;
4480 adev->device.common.close = adev_close;
4482 adev->device.init_check = adev_init_check;
4483 adev->device.set_voice_volume = adev_set_voice_volume;
4484 adev->device.set_master_volume = adev_set_master_volume;
4485 adev->device.get_master_volume = adev_get_master_volume;
4486 adev->device.set_master_mute = adev_set_master_mute;
4487 adev->device.get_master_mute = adev_get_master_mute;
4488 adev->device.set_mode = adev_set_mode;
4489 adev->device.set_mic_mute = adev_set_mic_mute;
4490 adev->device.get_mic_mute = adev_get_mic_mute;
4491 adev->device.set_parameters = adev_set_parameters;
4492 adev->device.get_parameters = adev_get_parameters;
4493 adev->device.get_input_buffer_size = adev_get_input_buffer_size;
4494 adev->device.open_output_stream = adev_open_output_stream;
4495 adev->device.close_output_stream = adev_close_output_stream;
4496 adev->device.open_input_stream = adev_open_input_stream;
4497 adev->device.close_input_stream = adev_close_input_stream;
4498 adev->device.dump = adev_dump;
4501 adev->mode = AUDIO_MODE_NORMAL;
4502 adev->active_input = NULL;
4503 adev->primary_output = NULL;
4504 adev->voice_volume = 1.0f;
4505 adev->tty_mode = TTY_MODE_OFF;
4506 adev->bluetooth_nrec = true;
4507 adev->in_call = false;
4508 /* adev->cur_hdmi_channels = 0; by calloc() */
4509 adev->snd_dev_ref_cnt = calloc(SND_DEVICE_MAX, sizeof(int));
4511 adev->dualmic_config = DUALMIC_CONFIG_NONE;
4512 adev->ns_in_voice_rec = false;
4514 list_init(&adev->usecase_list);
4516 if (mixer_init(adev) != 0) {
4517 free(adev->snd_dev_ref_cnt);
4518 free(adev);
4525 adev->offload_fx_lib = dlopen(OFFLOAD_FX_LIBRARY_PATH, RTLD_NOW);
4526 if (adev->offload_fx_lib == NULL) {
4530 adev->offload_fx_start_output =
4531 (int (*)(audio_io_handle_t))dlsym(adev->offload_fx_lib,
4533 adev->offload_fx_stop_output =
4534 (int (*)(audio_io_handle_t))dlsym(adev->offload_fx_lib,
4540 adev->htc_acoustic_lib = dlopen(HTC_ACOUSTIC_LIBRARY_PATH, RTLD_NOW);
4541 if (adev->htc_acoustic_lib == NULL) {
4545 adev->htc_acoustic_init_rt5506 =
4546 (int (*)())dlsym(adev->htc_acoustic_lib,
4548 adev->htc_acoustic_set_rt5506_amp =
4549 (int (*)(int, int))dlsym(adev->htc_acoustic_lib,
4551 adev->htc_acoustic_set_amp_mode =
4552 (int (*)(int , int, int, int, bool))dlsym(adev->htc_acoustic_lib,
4554 adev
4555 (int (*)(bool))dlsym(adev->htc_acoustic_lib,
4557 if (adev->htc_acoustic_spk_reverse)
4558 adev->htc_acoustic_spk_reverse(adev->speaker_lr_swap);
4563 adev->sound_trigger_lib = dlopen(SOUND_TRIGGER_HAL_LIBRARY_PATH, RTLD_NOW);
4564 if (adev->sound_trigger_lib == NULL) {
4568 adev->sound_trigger_open_for_streaming =
4569 (int (*)(void))dlsym(adev->sound_trigger_lib,
4571 adev->sound_trigger_read_samples =
4572 (int (*)(audio_io_handle_t, int))dlsym(adev->sound_trigger_lib,
4574 adev->sound_trigger_close_for_streaming =
4575 (int (*)(int))dlsym(adev->sound_trigger_lib,
4577 if (!adev->sound_trigger_open_for_streaming ||
4578 !adev->sound_trigger_read_samples ||
4579 !adev->sound_trigger_close_for_streaming) {
4582 adev->sound_trigger_open_for_streaming = 0;
4583 adev->sound_trigger_read_samples = 0;
4584 adev->sound_trigger_close_for_streaming = 0;
4590 *device = &adev->device.common;
4592 if (adev->htc_acoustic_init_rt5506 != NULL)
4593 adev->htc_acoustic_init_rt5506();
4597 adev->dummybuf_thread_devices = AUDIO_DEVICE_OUT_WIRED_HEADPHONE;
4598 dummybuf_thread_open(adev);
4601 pthread_mutex_lock(&adev->dummybuf_thread_lock);
4602 if (adev->dummybuf_thread_active != 0) {
4603 pthread_mutex_unlock(&adev->dummybuf_thread_lock);
4606 pthread_mutex_unlock(&adev->dummybuf_thread_lock);
4609 dummybuf_thread_close(adev);
4612 if (adev->htc_acoustic_set_amp_mode) {
4614 adev->dummybuf_thread_devices = AUDIO_DEVICE_OUT_SPEAKER;
4615 dummybuf_thread_open(adev);
4616 pthread_mutex_lock(&adev->dummybuf_thread_lock);
4619 if (adev->dummybuf_thread_active) {
4622 pthread_mutex_unlock(&adev->dummybuf_thread_lock);
4624 pthread_mutex_lock(&adev->dummybuf_thread_lock);
4626 if (adev->dummybuf_thread_active) {
4628 if (pthread_create(&th, NULL, tfa9895_config_thread, (void* )adev) != 0) {
4632 pthread_mutex_unlock(&adev->dummybuf_thread_lock);