diff options
author | Ethan Chen <intervigil@gmail.com> | 2015-07-03 21:35:30 -0700 |
---|---|---|
committer | Rashed Abdel-Tawab <rashed@linux.com> | 2015-10-09 18:28:29 -0400 |
commit | 995c450ee4f679978ada2b74d6ee39a1eb620666 (patch) | |
tree | 15319e021dee0be7a5ab79cc42fbaa6772335c99 | |
parent | 8cced8fc980ec27d05ec39f20586d58f84d64e8c (diff) | |
download | hardware_qcom_audio-995c450ee4f679978ada2b74d6ee39a1eb620666.tar.gz hardware_qcom_audio-995c450ee4f679978ada2b74d6ee39a1eb620666.tar.bz2 hardware_qcom_audio-995c450ee4f679978ada2b74d6ee39a1eb620666.zip |
hal: Notify amplifier of device enable/disable
Change-Id: Ice808c9b55a9e3bc8bafe5ca3ff555377d38dd8f
-rw-r--r-- | hal/audio_hw.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/hal/audio_hw.c b/hal/audio_hw.c index a73c69ae..084a71d5 100644 --- a/hal/audio_hw.c +++ b/hal/audio_hw.c @@ -310,6 +310,20 @@ static int amplifier_set_output_devices(uint32_t devices) return 0; } +static int amplifier_enable_devices(uint32_t devices, bool enable) +{ + amplifier_device_t *amp = get_amplifier_device(); + bool is_output = devices < SND_DEVICE_OUT_END; + + if (amp && amp->enable_output_devices && is_output) + return amp->enable_output_devices(amp, devices, enable); + + if (amp && amp->enable_input_devices && !is_output) + return amp->enable_input_devices(amp, devices, enable); + + return 0; +} + static int amplifier_set_mode(audio_mode_t mode) { amplifier_device_t *amp = get_amplifier_device(); @@ -632,6 +646,7 @@ int enable_snd_device(struct audio_device *adev, return -EINVAL; } audio_extn_dev_arbi_acquire(snd_device); + amplifier_enable_devices(snd_device, true); audio_route_apply_and_update_path(adev->audio_route, device_name); } return 0; @@ -677,6 +692,7 @@ int disable_snd_device(struct audio_device *adev, audio_extn_spkr_prot_stop_processing(snd_device); } else { audio_route_reset_and_update_path(adev->audio_route, device_name); + amplifier_enable_devices(snd_device, false); } audio_extn_dev_arbi_release(snd_device); |