diff options
author | Eric Laurent <elaurent@google.com> | 2015-09-16 02:18:36 +0000 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2015-09-16 02:18:36 +0000 |
commit | 3640a390dcb5c3c046300de13727ae813aaa1cb8 (patch) | |
tree | 7df4da48a4ca59ee8b8b687dbc0f8301d50c3333 | |
parent | 456b5c07d4e80d95eb3b3c1636c335d23757a7e5 (diff) | |
parent | 1b49155ca2a0b056d09f159861ad0d251a36116d (diff) | |
download | hardware_qcom_audio-3640a390dcb5c3c046300de13727ae813aaa1cb8.tar.gz hardware_qcom_audio-3640a390dcb5c3c046300de13727ae813aaa1cb8.tar.bz2 hardware_qcom_audio-3640a390dcb5c3c046300de13727ae813aaa1cb8.zip |
am 1b49155c: hal: change sequence of selecting output device
* commit '1b49155ca2a0b056d09f159861ad0d251a36116d':
hal: change sequence of selecting output device
-rw-r--r-- | hal/msm8974/platform.c | 68 |
1 files changed, 34 insertions, 34 deletions
diff --git a/hal/msm8974/platform.c b/hal/msm8974/platform.c index ff92d0fb..011a6b8d 100644 --- a/hal/msm8974/platform.c +++ b/hal/msm8974/platform.c @@ -1716,6 +1716,40 @@ snd_device_t platform_get_output_snd_device(void *platform, audio_devices_t devi goto exit; } + if (popcount(devices) == 2) { + if (devices == (AUDIO_DEVICE_OUT_WIRED_HEADPHONE | + AUDIO_DEVICE_OUT_SPEAKER) || + devices == (AUDIO_DEVICE_OUT_WIRED_HEADSET | + AUDIO_DEVICE_OUT_SPEAKER)) { + snd_device = SND_DEVICE_OUT_SPEAKER_AND_HEADPHONES; + } else if (devices == (AUDIO_DEVICE_OUT_LINE | + AUDIO_DEVICE_OUT_SPEAKER)) { + snd_device = SND_DEVICE_OUT_SPEAKER_AND_LINE; + } else if (devices == (AUDIO_DEVICE_OUT_WIRED_HEADPHONE | + AUDIO_DEVICE_OUT_SPEAKER_SAFE) || + devices == (AUDIO_DEVICE_OUT_WIRED_HEADSET | + AUDIO_DEVICE_OUT_SPEAKER_SAFE)) { + snd_device = SND_DEVICE_OUT_SPEAKER_SAFE_AND_HEADPHONES; + } else if (devices == (AUDIO_DEVICE_OUT_LINE | + AUDIO_DEVICE_OUT_SPEAKER_SAFE)) { + snd_device = SND_DEVICE_OUT_SPEAKER_SAFE_AND_LINE; + } else if (devices == (AUDIO_DEVICE_OUT_AUX_DIGITAL | + AUDIO_DEVICE_OUT_SPEAKER)) { + snd_device = SND_DEVICE_OUT_SPEAKER_AND_HDMI; + } else { + ALOGE("%s: Invalid combo device(%#x)", __func__, devices); + goto exit; + } + if (snd_device != SND_DEVICE_NONE) { + goto exit; + } + } + + if (popcount(devices) != 1) { + ALOGE("%s: Invalid output devices(%#x)", __func__, devices); + goto exit; + } + if (voice_is_in_call(adev) || adev->enable_voicerx) { if (devices & AUDIO_DEVICE_OUT_WIRED_HEADPHONE || devices & AUDIO_DEVICE_OUT_WIRED_HEADSET || @@ -1758,40 +1792,6 @@ snd_device_t platform_get_output_snd_device(void *platform, audio_devices_t devi } } - if (popcount(devices) == 2) { - if (devices == (AUDIO_DEVICE_OUT_WIRED_HEADPHONE | - AUDIO_DEVICE_OUT_SPEAKER) || - devices == (AUDIO_DEVICE_OUT_WIRED_HEADSET | - AUDIO_DEVICE_OUT_SPEAKER)) { - snd_device = SND_DEVICE_OUT_SPEAKER_AND_HEADPHONES; - } else if (devices == (AUDIO_DEVICE_OUT_LINE | - AUDIO_DEVICE_OUT_SPEAKER)) { - snd_device = SND_DEVICE_OUT_SPEAKER_AND_LINE; - } else if (devices == (AUDIO_DEVICE_OUT_WIRED_HEADPHONE | - AUDIO_DEVICE_OUT_SPEAKER_SAFE) || - devices == (AUDIO_DEVICE_OUT_WIRED_HEADSET | - AUDIO_DEVICE_OUT_SPEAKER_SAFE)) { - snd_device = SND_DEVICE_OUT_SPEAKER_SAFE_AND_HEADPHONES; - } else if (devices == (AUDIO_DEVICE_OUT_LINE | - AUDIO_DEVICE_OUT_SPEAKER_SAFE)) { - snd_device = SND_DEVICE_OUT_SPEAKER_SAFE_AND_LINE; - } else if (devices == (AUDIO_DEVICE_OUT_AUX_DIGITAL | - AUDIO_DEVICE_OUT_SPEAKER)) { - snd_device = SND_DEVICE_OUT_SPEAKER_AND_HDMI; - } else { - ALOGE("%s: Invalid combo device(%#x)", __func__, devices); - goto exit; - } - if (snd_device != SND_DEVICE_NONE) { - goto exit; - } - } - - if (popcount(devices) != 1) { - ALOGE("%s: Invalid output devices(%#x)", __func__, devices); - goto exit; - } - if (devices & AUDIO_DEVICE_OUT_WIRED_HEADPHONE || devices & AUDIO_DEVICE_OUT_WIRED_HEADSET) { snd_device = SND_DEVICE_OUT_HEADPHONES; |