Loading hal/audio_hw.c +11 −17 Original line number Diff line number Diff line /* * Copyright (c) 2013-2017, The Linux Foundation. All rights reserved. * Copyright (c) 2013-2018, The Linux Foundation. All rights reserved. * Not a Contribution. * * Copyright (C) 2013 The Android Open Source Project Loading Loading @@ -6296,6 +6296,7 @@ static int adev_set_parameters(struct audio_hw_device *dev, const char *kvpairs) ret = str_parms_get_str(parms, AUDIO_PARAMETER_DEVICE_CONNECT, value, sizeof(value)); if (ret >= 0) { val = atoi(value); audio_devices_t device = (audio_devices_t) val; if (audio_is_output_device(val) && (val & AUDIO_DEVICE_OUT_AUX_DIGITAL)) { ALOGV("cache new ext disp type and edid"); Loading @@ -6306,8 +6307,7 @@ static int adev_set_parameters(struct audio_hw_device *dev, const char *kvpairs) goto done; } platform_cache_edid(adev->platform); } else if (((audio_devices_t)val == AUDIO_DEVICE_OUT_USB_DEVICE) || ((audio_devices_t)val == AUDIO_DEVICE_IN_USB_DEVICE)) { } else if (audio_is_usb_out_device(device) || audio_is_usb_in_device(device)) { /* * Do not allow AFE proxy port usage by WFD source when USB headset is connected. * Per AudioPolicyManager, USB device is higher priority than WFD. Loading @@ -6316,12 +6316,9 @@ static int adev_set_parameters(struct audio_hw_device *dev, const char *kvpairs) * starting voice call on USB */ ret = str_parms_get_str(parms, "card", value, sizeof(value)); if (ret >= 0) { if (audio_is_output_device(val)) audio_extn_usb_add_device(AUDIO_DEVICE_OUT_USB_DEVICE, atoi(value)); else audio_extn_usb_add_device(AUDIO_DEVICE_IN_USB_DEVICE, atoi(value)); } if (ret >= 0) audio_extn_usb_add_device(device, atoi(value)); if (!audio_extn_usb_is_tunnel_supported()) { ALOGV("detected USB connect .. disable proxy"); adev->allow_afe_proxy_usage = false; Loading @@ -6332,21 +6329,18 @@ static int adev_set_parameters(struct audio_hw_device *dev, const char *kvpairs) ret = str_parms_get_str(parms, AUDIO_PARAMETER_DEVICE_DISCONNECT, value, sizeof(value)); if (ret >= 0) { val = atoi(value); audio_devices_t device = (audio_devices_t) val; /* * The HDMI / Displayport disconnect handling has been moved to * audio extension to ensure that its parameters are not * invalidated prior to updating sysfs of the disconnect event * Invalidate will be handled by audio_extn_ext_disp_set_parameters() */ if (((audio_devices_t)val == AUDIO_DEVICE_OUT_USB_DEVICE) || ((audio_devices_t)val == AUDIO_DEVICE_IN_USB_DEVICE)) { if (audio_is_usb_out_device(device) || audio_is_usb_in_device(device)) { ret = str_parms_get_str(parms, "card", value, sizeof(value)); if (ret >= 0) { if (audio_is_output_device(val)) audio_extn_usb_remove_device(AUDIO_DEVICE_OUT_USB_DEVICE, atoi(value)); else audio_extn_usb_remove_device(AUDIO_DEVICE_IN_USB_DEVICE, atoi(value)); } if (ret >= 0) audio_extn_usb_remove_device(device, atoi(value)); if (!audio_extn_usb_is_tunnel_supported()) { ALOGV("detected USB disconnect .. enable proxy"); adev->allow_afe_proxy_usage = true; Loading hal/msm8916/platform.c +23 −11 Original line number Diff line number Diff line Loading @@ -942,6 +942,7 @@ static int msm_device_to_be_id_internal_codec [][NO_COLS] = { {AUDIO_DEVICE_OUT_DGTL_DOCK_HEADSET , 9}, {AUDIO_DEVICE_OUT_USB_ACCESSORY , -1}, {AUDIO_DEVICE_OUT_USB_DEVICE , -1}, {AUDIO_DEVICE_OUT_USB_HEADSET , -1}, {AUDIO_DEVICE_OUT_REMOTE_SUBMIX , 9}, {AUDIO_DEVICE_OUT_PROXY , 9}, {AUDIO_DEVICE_OUT_FM , 7}, Loading @@ -967,6 +968,7 @@ static int msm_device_to_be_id_external_codec [][NO_COLS] = { {AUDIO_DEVICE_OUT_DGTL_DOCK_HEADSET , 9}, {AUDIO_DEVICE_OUT_USB_ACCESSORY , -1}, {AUDIO_DEVICE_OUT_USB_DEVICE , -1}, {AUDIO_DEVICE_OUT_USB_HEADSET , -1}, {AUDIO_DEVICE_OUT_REMOTE_SUBMIX , 9}, {AUDIO_DEVICE_OUT_PROXY , 9}, {AUDIO_DEVICE_OUT_FM , 7}, Loading Loading @@ -3915,8 +3917,10 @@ snd_device_t platform_get_output_snd_device(void *platform, struct stream_out *o } else if (devices == (AUDIO_DEVICE_OUT_ANLG_DOCK_HEADSET | AUDIO_DEVICE_OUT_SPEAKER)) { snd_device = SND_DEVICE_OUT_SPEAKER_AND_USB_HEADSET; } else if (devices == (AUDIO_DEVICE_OUT_USB_DEVICE | AUDIO_DEVICE_OUT_SPEAKER)) { } else if ((devices == (AUDIO_DEVICE_OUT_USB_DEVICE | AUDIO_DEVICE_OUT_SPEAKER)) || (devices == (AUDIO_DEVICE_OUT_USB_HEADSET | AUDIO_DEVICE_OUT_SPEAKER))){ snd_device = SND_DEVICE_OUT_SPEAKER_AND_USB_HEADSET; } else if ((devices & AUDIO_DEVICE_OUT_SPEAKER) && (devices & AUDIO_DEVICE_OUT_ALL_A2DP)) { Loading Loading @@ -3972,7 +3976,9 @@ snd_device_t platform_get_output_snd_device(void *platform, struct stream_out *o } else { snd_device = SND_DEVICE_OUT_VOICE_HEADPHONES; } } else if (devices & AUDIO_DEVICE_OUT_USB_DEVICE) { } else if (devices & (AUDIO_DEVICE_OUT_USB_DEVICE | AUDIO_DEVICE_OUT_USB_HEADSET)) { if (snd_device == SND_DEVICE_NONE) { snd_device = audio_extn_usb_is_capture_supported() ? SND_DEVICE_OUT_VOICE_USB_HEADSET : Loading Loading @@ -4107,7 +4113,9 @@ snd_device_t platform_get_output_snd_device(void *platform, struct stream_out *o ALOGD("%s: setting USB hadset channel capability(2) for Proxy", __func__); audio_extn_set_afe_proxy_channel_mixer(adev, 2); snd_device = SND_DEVICE_OUT_USB_HEADSET; } else if (devices & AUDIO_DEVICE_OUT_USB_DEVICE) { } else if (devices & (AUDIO_DEVICE_OUT_USB_DEVICE | AUDIO_DEVICE_OUT_USB_HEADSET)) { if (audio_extn_usb_is_capture_supported()) snd_device = SND_DEVICE_OUT_USB_HEADSET; else Loading Loading @@ -4207,7 +4215,7 @@ static snd_device_t get_snd_device_for_voice_comm(struct platform_data *my_data, snd_device = SND_DEVICE_IN_HANDSET_MIC_AEC_NS; } else if (in_device & AUDIO_DEVICE_IN_WIRED_HEADSET) { snd_device = SND_DEVICE_IN_HEADSET_MIC_FLUENCE; } else if (in_device & AUDIO_DEVICE_IN_USB_DEVICE) { } else if (audio_is_usb_in_device(in_device | AUDIO_DEVICE_BIT_IN)) { snd_device = SND_DEVICE_IN_USB_HEADSET_MIC_AEC; } platform_set_echo_reference(adev, true, out_device); Loading Loading @@ -4237,7 +4245,7 @@ static snd_device_t get_snd_device_for_voice_comm(struct platform_data *my_data, snd_device = SND_DEVICE_IN_HANDSET_MIC_AEC; } else if (in_device & AUDIO_DEVICE_IN_WIRED_HEADSET) { snd_device = SND_DEVICE_IN_HEADSET_MIC_FLUENCE; } else if (in_device & AUDIO_DEVICE_IN_USB_DEVICE) { } else if (audio_is_usb_in_device(in_device | AUDIO_DEVICE_BIT_IN)) { snd_device = SND_DEVICE_IN_USB_HEADSET_MIC_AEC; } platform_set_echo_reference(adev, true, out_device); Loading Loading @@ -4405,7 +4413,9 @@ snd_device_t platform_get_input_snd_device(void *platform, audio_devices_t out_d } } else if (out_device & AUDIO_DEVICE_OUT_TELEPHONY_TX) { snd_device = SND_DEVICE_IN_VOICE_RX; } else if (out_device & AUDIO_DEVICE_OUT_USB_DEVICE) { } else if (out_device & (AUDIO_DEVICE_OUT_USB_DEVICE | AUDIO_DEVICE_OUT_USB_HEADSET)) { if (audio_extn_usb_is_capture_supported()) { snd_device = SND_DEVICE_IN_VOICE_USB_HEADSET_MIC; } Loading Loading @@ -4484,7 +4494,7 @@ snd_device_t platform_get_input_snd_device(void *platform, audio_devices_t out_d else snd_device = SND_DEVICE_IN_VOICE_REC_MIC; } } else if (in_device & AUDIO_DEVICE_IN_USB_DEVICE) { } else if (audio_is_usb_in_device(in_device | AUDIO_DEVICE_BIT_IN)) { snd_device = SND_DEVICE_IN_VOICE_RECOG_USB_HEADSET_MIC; } } else if (source == AUDIO_SOURCE_UNPROCESSED) { Loading @@ -4504,7 +4514,7 @@ snd_device_t platform_get_input_snd_device(void *platform, audio_devices_t out_d } } else if (in_device & AUDIO_DEVICE_IN_WIRED_HEADSET) { snd_device = SND_DEVICE_IN_UNPROCESSED_HEADSET_MIC; } else if (in_device & AUDIO_DEVICE_IN_USB_DEVICE) { } else if (audio_is_usb_in_device(in_device | AUDIO_DEVICE_BIT_IN)) { snd_device = SND_DEVICE_IN_UNPROCESSED_USB_HEADSET_MIC; } } else if ((source == AUDIO_SOURCE_VOICE_COMMUNICATION) || Loading Loading @@ -4583,7 +4593,7 @@ snd_device_t platform_get_input_snd_device(void *platform, audio_devices_t out_d snd_device = SND_DEVICE_IN_USB_HEADSET_MIC; } else if (in_device & AUDIO_DEVICE_IN_FM_TUNER) { snd_device = SND_DEVICE_IN_CAPTURE_FM; } else if (in_device & AUDIO_DEVICE_IN_USB_DEVICE ) { } else if (audio_is_usb_in_device(in_device | AUDIO_DEVICE_BIT_IN)) { snd_device = SND_DEVICE_IN_USB_HEADSET_MIC; } else { ALOGE("%s: Unknown input device(s) %#x", __func__, in_device); Loading Loading @@ -4620,7 +4630,9 @@ snd_device_t platform_get_input_snd_device(void *platform, audio_devices_t out_d } else if (out_device & AUDIO_DEVICE_OUT_ANLG_DOCK_HEADSET || out_device & AUDIO_DEVICE_OUT_DGTL_DOCK_HEADSET) { snd_device = SND_DEVICE_IN_USB_HEADSET_MIC; } else if (out_device & AUDIO_DEVICE_OUT_USB_DEVICE) { } else if (out_device & (AUDIO_DEVICE_OUT_USB_DEVICE | AUDIO_DEVICE_OUT_USB_HEADSET)) { if (audio_extn_usb_is_capture_supported()) snd_device = SND_DEVICE_IN_USB_HEADSET_MIC; else Loading hal/msm8974/platform.c +28 −12 Original line number Diff line number Diff line Loading @@ -915,6 +915,7 @@ static int msm_device_to_be_id [][NO_COLS] = { {AUDIO_DEVICE_OUT_DGTL_DOCK_HEADSET , 9}, {AUDIO_DEVICE_OUT_USB_ACCESSORY , -1}, {AUDIO_DEVICE_OUT_USB_DEVICE , -1}, {AUDIO_DEVICE_OUT_USB_HEADSET , -1}, {AUDIO_DEVICE_OUT_REMOTE_SUBMIX , 9}, {AUDIO_DEVICE_OUT_PROXY , 9}, {AUDIO_DEVICE_OUT_FM , 7}, Loading @@ -940,6 +941,7 @@ static int msm_device_to_be_id [][NO_COLS] = { {AUDIO_DEVICE_OUT_DGTL_DOCK_HEADSET , 9}, {AUDIO_DEVICE_OUT_USB_ACCESSORY , -1}, {AUDIO_DEVICE_OUT_USB_DEVICE , -1}, {AUDIO_DEVICE_OUT_USB_HEADSET , -1}, {AUDIO_DEVICE_OUT_REMOTE_SUBMIX , 9}, {AUDIO_DEVICE_OUT_PROXY , 9}, /* Add the correct be ids */ Loading @@ -966,6 +968,7 @@ static int msm_device_to_be_id [][NO_COLS] = { {AUDIO_DEVICE_OUT_DGTL_DOCK_HEADSET , 9}, {AUDIO_DEVICE_OUT_USB_ACCESSORY , -1}, {AUDIO_DEVICE_OUT_USB_DEVICE , -1}, {AUDIO_DEVICE_OUT_USB_HEADSET , -1}, {AUDIO_DEVICE_OUT_REMOTE_SUBMIX , 9}, {AUDIO_DEVICE_OUT_PROXY , 9}, /* Add the correct be ids */ Loading @@ -992,6 +995,7 @@ static int msm_device_to_be_id [][NO_COLS] = { {AUDIO_DEVICE_OUT_DGTL_DOCK_HEADSET , 9}, {AUDIO_DEVICE_OUT_USB_ACCESSORY , -1}, {AUDIO_DEVICE_OUT_USB_DEVICE , -1}, {AUDIO_DEVICE_OUT_USB_HEADSET , -1}, {AUDIO_DEVICE_OUT_REMOTE_SUBMIX , 9}, {AUDIO_DEVICE_OUT_PROXY , 9}, /* Add the correct be ids */ Loading Loading @@ -3712,8 +3716,10 @@ snd_device_t platform_get_output_snd_device(void *platform, struct stream_out *o } else if (devices == (AUDIO_DEVICE_OUT_ANLG_DOCK_HEADSET | AUDIO_DEVICE_OUT_SPEAKER)) { snd_device = SND_DEVICE_OUT_SPEAKER_AND_USB_HEADSET; } else if (devices == (AUDIO_DEVICE_OUT_USB_DEVICE | AUDIO_DEVICE_OUT_SPEAKER)) { } else if ((devices == (AUDIO_DEVICE_OUT_USB_DEVICE | AUDIO_DEVICE_OUT_SPEAKER)) || (devices == (AUDIO_DEVICE_OUT_USB_HEADSET | AUDIO_DEVICE_OUT_SPEAKER))) { snd_device = SND_DEVICE_OUT_SPEAKER_AND_USB_HEADSET; } else if ((devices & AUDIO_DEVICE_OUT_SPEAKER) && (devices & AUDIO_DEVICE_OUT_ALL_A2DP)) { Loading Loading @@ -3769,7 +3775,9 @@ snd_device_t platform_get_output_snd_device(void *platform, struct stream_out *o } else { snd_device = SND_DEVICE_OUT_VOICE_HEADPHONES; } } else if (devices & AUDIO_DEVICE_OUT_USB_DEVICE) { } else if (devices & (AUDIO_DEVICE_OUT_USB_DEVICE | AUDIO_DEVICE_OUT_USB_HEADSET)) { if (voice_is_in_call(adev)) { switch (adev->voice.tty_mode) { case TTY_MODE_FULL: Loading Loading @@ -3905,7 +3913,9 @@ snd_device_t platform_get_output_snd_device(void *platform, struct stream_out *o ALOGD("%s: setting USB hadset channel capability(2) for Proxy", __func__); audio_extn_set_afe_proxy_channel_mixer(adev, 2); snd_device = SND_DEVICE_OUT_USB_HEADSET; } else if (devices & AUDIO_DEVICE_OUT_USB_DEVICE) { } else if (devices & (AUDIO_DEVICE_OUT_USB_DEVICE | AUDIO_DEVICE_OUT_USB_HEADSET)) { if (audio_extn_usb_is_capture_supported()) snd_device = SND_DEVICE_OUT_USB_HEADSET; else Loading Loading @@ -4008,7 +4018,7 @@ static snd_device_t get_snd_device_for_voice_comm(struct platform_data *my_data, snd_device = SND_DEVICE_IN_HANDSET_MIC_AEC_NS; } else if (in_device & AUDIO_DEVICE_IN_WIRED_HEADSET) { snd_device = SND_DEVICE_IN_HEADSET_MIC_FLUENCE; } else if (in_device & AUDIO_DEVICE_IN_USB_DEVICE) { } else if (audio_is_usb_in_device(in_device | AUDIO_DEVICE_BIT_IN)) { snd_device = SND_DEVICE_IN_USB_HEADSET_MIC_AEC; } platform_set_echo_reference(adev, true, out_device); Loading Loading @@ -4042,7 +4052,7 @@ static snd_device_t get_snd_device_for_voice_comm(struct platform_data *my_data, snd_device = SND_DEVICE_IN_HANDSET_MIC_AEC; } else if (in_device & AUDIO_DEVICE_IN_WIRED_HEADSET) { snd_device = SND_DEVICE_IN_HEADSET_MIC_FLUENCE; } else if (in_device & AUDIO_DEVICE_IN_USB_DEVICE) { } else if (audio_is_usb_in_device(in_device | AUDIO_DEVICE_BIT_IN)) { snd_device = SND_DEVICE_IN_USB_HEADSET_MIC_AEC; } platform_set_echo_reference(adev, true, out_device); Loading Loading @@ -4146,7 +4156,9 @@ snd_device_t platform_get_input_snd_device(void *platform, audio_devices_t out_d ALOGE("%s: Invalid TTY mode (%#x)", __func__, adev->voice.tty_mode); } goto exit; } else if (out_device & AUDIO_DEVICE_OUT_USB_DEVICE) { } else if (out_device & (AUDIO_DEVICE_OUT_USB_DEVICE | AUDIO_DEVICE_OUT_USB_HEADSET)) { switch (adev->voice.tty_mode) { case TTY_MODE_FULL: snd_device = SND_DEVICE_IN_VOICE_TTY_FULL_USB_MIC; Loading Loading @@ -4243,7 +4255,9 @@ snd_device_t platform_get_input_snd_device(void *platform, audio_devices_t out_d } } else if (out_device & AUDIO_DEVICE_OUT_TELEPHONY_TX) { snd_device = SND_DEVICE_IN_VOICE_RX; } else if (out_device & AUDIO_DEVICE_OUT_USB_DEVICE) { } else if (out_device & (AUDIO_DEVICE_OUT_USB_DEVICE | AUDIO_DEVICE_OUT_USB_HEADSET)) { if (audio_extn_usb_is_capture_supported()) { snd_device = SND_DEVICE_IN_VOICE_USB_HEADSET_MIC; } Loading Loading @@ -4322,7 +4336,7 @@ snd_device_t platform_get_input_snd_device(void *platform, audio_devices_t out_d else snd_device = SND_DEVICE_IN_VOICE_REC_MIC; } } else if (in_device & AUDIO_DEVICE_IN_USB_DEVICE) { } else if (audio_is_usb_in_device(in_device | AUDIO_DEVICE_BIT_IN)) { snd_device = SND_DEVICE_IN_VOICE_RECOG_USB_HEADSET_MIC; } } else if (source == AUDIO_SOURCE_UNPROCESSED) { Loading @@ -4342,7 +4356,7 @@ snd_device_t platform_get_input_snd_device(void *platform, audio_devices_t out_d } } else if (in_device & AUDIO_DEVICE_IN_WIRED_HEADSET) { snd_device = SND_DEVICE_IN_UNPROCESSED_HEADSET_MIC; } else if (in_device & AUDIO_DEVICE_IN_USB_DEVICE) { } else if (audio_is_usb_in_device(in_device | AUDIO_DEVICE_BIT_IN)) { snd_device = SND_DEVICE_IN_UNPROCESSED_USB_HEADSET_MIC; } } else if ((source == AUDIO_SOURCE_VOICE_COMMUNICATION) || Loading Loading @@ -4420,7 +4434,7 @@ snd_device_t platform_get_input_snd_device(void *platform, audio_devices_t out_d snd_device = SND_DEVICE_IN_USB_HEADSET_MIC; } else if (in_device & AUDIO_DEVICE_IN_FM_TUNER) { snd_device = SND_DEVICE_IN_CAPTURE_FM; } else if (in_device & AUDIO_DEVICE_IN_USB_DEVICE ) { } else if (audio_is_usb_in_device(in_device | AUDIO_DEVICE_BIT_IN)) { snd_device = SND_DEVICE_IN_USB_HEADSET_MIC; } else { ALOGE("%s: Unknown input device(s) %#x", __func__, in_device); Loading Loading @@ -4465,7 +4479,9 @@ snd_device_t platform_get_input_snd_device(void *platform, audio_devices_t out_d } else if (out_device & AUDIO_DEVICE_OUT_ANLG_DOCK_HEADSET || out_device & AUDIO_DEVICE_OUT_DGTL_DOCK_HEADSET) { snd_device = SND_DEVICE_IN_USB_HEADSET_MIC; } else if (out_device & AUDIO_DEVICE_OUT_USB_DEVICE) { } else if (out_device & (AUDIO_DEVICE_OUT_USB_DEVICE | AUDIO_DEVICE_OUT_USB_HEADSET)) { if (audio_extn_usb_is_capture_supported()) snd_device = SND_DEVICE_IN_USB_HEADSET_MIC; else Loading Loading
hal/audio_hw.c +11 −17 Original line number Diff line number Diff line /* * Copyright (c) 2013-2017, The Linux Foundation. All rights reserved. * Copyright (c) 2013-2018, The Linux Foundation. All rights reserved. * Not a Contribution. * * Copyright (C) 2013 The Android Open Source Project Loading Loading @@ -6296,6 +6296,7 @@ static int adev_set_parameters(struct audio_hw_device *dev, const char *kvpairs) ret = str_parms_get_str(parms, AUDIO_PARAMETER_DEVICE_CONNECT, value, sizeof(value)); if (ret >= 0) { val = atoi(value); audio_devices_t device = (audio_devices_t) val; if (audio_is_output_device(val) && (val & AUDIO_DEVICE_OUT_AUX_DIGITAL)) { ALOGV("cache new ext disp type and edid"); Loading @@ -6306,8 +6307,7 @@ static int adev_set_parameters(struct audio_hw_device *dev, const char *kvpairs) goto done; } platform_cache_edid(adev->platform); } else if (((audio_devices_t)val == AUDIO_DEVICE_OUT_USB_DEVICE) || ((audio_devices_t)val == AUDIO_DEVICE_IN_USB_DEVICE)) { } else if (audio_is_usb_out_device(device) || audio_is_usb_in_device(device)) { /* * Do not allow AFE proxy port usage by WFD source when USB headset is connected. * Per AudioPolicyManager, USB device is higher priority than WFD. Loading @@ -6316,12 +6316,9 @@ static int adev_set_parameters(struct audio_hw_device *dev, const char *kvpairs) * starting voice call on USB */ ret = str_parms_get_str(parms, "card", value, sizeof(value)); if (ret >= 0) { if (audio_is_output_device(val)) audio_extn_usb_add_device(AUDIO_DEVICE_OUT_USB_DEVICE, atoi(value)); else audio_extn_usb_add_device(AUDIO_DEVICE_IN_USB_DEVICE, atoi(value)); } if (ret >= 0) audio_extn_usb_add_device(device, atoi(value)); if (!audio_extn_usb_is_tunnel_supported()) { ALOGV("detected USB connect .. disable proxy"); adev->allow_afe_proxy_usage = false; Loading @@ -6332,21 +6329,18 @@ static int adev_set_parameters(struct audio_hw_device *dev, const char *kvpairs) ret = str_parms_get_str(parms, AUDIO_PARAMETER_DEVICE_DISCONNECT, value, sizeof(value)); if (ret >= 0) { val = atoi(value); audio_devices_t device = (audio_devices_t) val; /* * The HDMI / Displayport disconnect handling has been moved to * audio extension to ensure that its parameters are not * invalidated prior to updating sysfs of the disconnect event * Invalidate will be handled by audio_extn_ext_disp_set_parameters() */ if (((audio_devices_t)val == AUDIO_DEVICE_OUT_USB_DEVICE) || ((audio_devices_t)val == AUDIO_DEVICE_IN_USB_DEVICE)) { if (audio_is_usb_out_device(device) || audio_is_usb_in_device(device)) { ret = str_parms_get_str(parms, "card", value, sizeof(value)); if (ret >= 0) { if (audio_is_output_device(val)) audio_extn_usb_remove_device(AUDIO_DEVICE_OUT_USB_DEVICE, atoi(value)); else audio_extn_usb_remove_device(AUDIO_DEVICE_IN_USB_DEVICE, atoi(value)); } if (ret >= 0) audio_extn_usb_remove_device(device, atoi(value)); if (!audio_extn_usb_is_tunnel_supported()) { ALOGV("detected USB disconnect .. enable proxy"); adev->allow_afe_proxy_usage = true; Loading
hal/msm8916/platform.c +23 −11 Original line number Diff line number Diff line Loading @@ -942,6 +942,7 @@ static int msm_device_to_be_id_internal_codec [][NO_COLS] = { {AUDIO_DEVICE_OUT_DGTL_DOCK_HEADSET , 9}, {AUDIO_DEVICE_OUT_USB_ACCESSORY , -1}, {AUDIO_DEVICE_OUT_USB_DEVICE , -1}, {AUDIO_DEVICE_OUT_USB_HEADSET , -1}, {AUDIO_DEVICE_OUT_REMOTE_SUBMIX , 9}, {AUDIO_DEVICE_OUT_PROXY , 9}, {AUDIO_DEVICE_OUT_FM , 7}, Loading @@ -967,6 +968,7 @@ static int msm_device_to_be_id_external_codec [][NO_COLS] = { {AUDIO_DEVICE_OUT_DGTL_DOCK_HEADSET , 9}, {AUDIO_DEVICE_OUT_USB_ACCESSORY , -1}, {AUDIO_DEVICE_OUT_USB_DEVICE , -1}, {AUDIO_DEVICE_OUT_USB_HEADSET , -1}, {AUDIO_DEVICE_OUT_REMOTE_SUBMIX , 9}, {AUDIO_DEVICE_OUT_PROXY , 9}, {AUDIO_DEVICE_OUT_FM , 7}, Loading Loading @@ -3915,8 +3917,10 @@ snd_device_t platform_get_output_snd_device(void *platform, struct stream_out *o } else if (devices == (AUDIO_DEVICE_OUT_ANLG_DOCK_HEADSET | AUDIO_DEVICE_OUT_SPEAKER)) { snd_device = SND_DEVICE_OUT_SPEAKER_AND_USB_HEADSET; } else if (devices == (AUDIO_DEVICE_OUT_USB_DEVICE | AUDIO_DEVICE_OUT_SPEAKER)) { } else if ((devices == (AUDIO_DEVICE_OUT_USB_DEVICE | AUDIO_DEVICE_OUT_SPEAKER)) || (devices == (AUDIO_DEVICE_OUT_USB_HEADSET | AUDIO_DEVICE_OUT_SPEAKER))){ snd_device = SND_DEVICE_OUT_SPEAKER_AND_USB_HEADSET; } else if ((devices & AUDIO_DEVICE_OUT_SPEAKER) && (devices & AUDIO_DEVICE_OUT_ALL_A2DP)) { Loading Loading @@ -3972,7 +3976,9 @@ snd_device_t platform_get_output_snd_device(void *platform, struct stream_out *o } else { snd_device = SND_DEVICE_OUT_VOICE_HEADPHONES; } } else if (devices & AUDIO_DEVICE_OUT_USB_DEVICE) { } else if (devices & (AUDIO_DEVICE_OUT_USB_DEVICE | AUDIO_DEVICE_OUT_USB_HEADSET)) { if (snd_device == SND_DEVICE_NONE) { snd_device = audio_extn_usb_is_capture_supported() ? SND_DEVICE_OUT_VOICE_USB_HEADSET : Loading Loading @@ -4107,7 +4113,9 @@ snd_device_t platform_get_output_snd_device(void *platform, struct stream_out *o ALOGD("%s: setting USB hadset channel capability(2) for Proxy", __func__); audio_extn_set_afe_proxy_channel_mixer(adev, 2); snd_device = SND_DEVICE_OUT_USB_HEADSET; } else if (devices & AUDIO_DEVICE_OUT_USB_DEVICE) { } else if (devices & (AUDIO_DEVICE_OUT_USB_DEVICE | AUDIO_DEVICE_OUT_USB_HEADSET)) { if (audio_extn_usb_is_capture_supported()) snd_device = SND_DEVICE_OUT_USB_HEADSET; else Loading Loading @@ -4207,7 +4215,7 @@ static snd_device_t get_snd_device_for_voice_comm(struct platform_data *my_data, snd_device = SND_DEVICE_IN_HANDSET_MIC_AEC_NS; } else if (in_device & AUDIO_DEVICE_IN_WIRED_HEADSET) { snd_device = SND_DEVICE_IN_HEADSET_MIC_FLUENCE; } else if (in_device & AUDIO_DEVICE_IN_USB_DEVICE) { } else if (audio_is_usb_in_device(in_device | AUDIO_DEVICE_BIT_IN)) { snd_device = SND_DEVICE_IN_USB_HEADSET_MIC_AEC; } platform_set_echo_reference(adev, true, out_device); Loading Loading @@ -4237,7 +4245,7 @@ static snd_device_t get_snd_device_for_voice_comm(struct platform_data *my_data, snd_device = SND_DEVICE_IN_HANDSET_MIC_AEC; } else if (in_device & AUDIO_DEVICE_IN_WIRED_HEADSET) { snd_device = SND_DEVICE_IN_HEADSET_MIC_FLUENCE; } else if (in_device & AUDIO_DEVICE_IN_USB_DEVICE) { } else if (audio_is_usb_in_device(in_device | AUDIO_DEVICE_BIT_IN)) { snd_device = SND_DEVICE_IN_USB_HEADSET_MIC_AEC; } platform_set_echo_reference(adev, true, out_device); Loading Loading @@ -4405,7 +4413,9 @@ snd_device_t platform_get_input_snd_device(void *platform, audio_devices_t out_d } } else if (out_device & AUDIO_DEVICE_OUT_TELEPHONY_TX) { snd_device = SND_DEVICE_IN_VOICE_RX; } else if (out_device & AUDIO_DEVICE_OUT_USB_DEVICE) { } else if (out_device & (AUDIO_DEVICE_OUT_USB_DEVICE | AUDIO_DEVICE_OUT_USB_HEADSET)) { if (audio_extn_usb_is_capture_supported()) { snd_device = SND_DEVICE_IN_VOICE_USB_HEADSET_MIC; } Loading Loading @@ -4484,7 +4494,7 @@ snd_device_t platform_get_input_snd_device(void *platform, audio_devices_t out_d else snd_device = SND_DEVICE_IN_VOICE_REC_MIC; } } else if (in_device & AUDIO_DEVICE_IN_USB_DEVICE) { } else if (audio_is_usb_in_device(in_device | AUDIO_DEVICE_BIT_IN)) { snd_device = SND_DEVICE_IN_VOICE_RECOG_USB_HEADSET_MIC; } } else if (source == AUDIO_SOURCE_UNPROCESSED) { Loading @@ -4504,7 +4514,7 @@ snd_device_t platform_get_input_snd_device(void *platform, audio_devices_t out_d } } else if (in_device & AUDIO_DEVICE_IN_WIRED_HEADSET) { snd_device = SND_DEVICE_IN_UNPROCESSED_HEADSET_MIC; } else if (in_device & AUDIO_DEVICE_IN_USB_DEVICE) { } else if (audio_is_usb_in_device(in_device | AUDIO_DEVICE_BIT_IN)) { snd_device = SND_DEVICE_IN_UNPROCESSED_USB_HEADSET_MIC; } } else if ((source == AUDIO_SOURCE_VOICE_COMMUNICATION) || Loading Loading @@ -4583,7 +4593,7 @@ snd_device_t platform_get_input_snd_device(void *platform, audio_devices_t out_d snd_device = SND_DEVICE_IN_USB_HEADSET_MIC; } else if (in_device & AUDIO_DEVICE_IN_FM_TUNER) { snd_device = SND_DEVICE_IN_CAPTURE_FM; } else if (in_device & AUDIO_DEVICE_IN_USB_DEVICE ) { } else if (audio_is_usb_in_device(in_device | AUDIO_DEVICE_BIT_IN)) { snd_device = SND_DEVICE_IN_USB_HEADSET_MIC; } else { ALOGE("%s: Unknown input device(s) %#x", __func__, in_device); Loading Loading @@ -4620,7 +4630,9 @@ snd_device_t platform_get_input_snd_device(void *platform, audio_devices_t out_d } else if (out_device & AUDIO_DEVICE_OUT_ANLG_DOCK_HEADSET || out_device & AUDIO_DEVICE_OUT_DGTL_DOCK_HEADSET) { snd_device = SND_DEVICE_IN_USB_HEADSET_MIC; } else if (out_device & AUDIO_DEVICE_OUT_USB_DEVICE) { } else if (out_device & (AUDIO_DEVICE_OUT_USB_DEVICE | AUDIO_DEVICE_OUT_USB_HEADSET)) { if (audio_extn_usb_is_capture_supported()) snd_device = SND_DEVICE_IN_USB_HEADSET_MIC; else Loading
hal/msm8974/platform.c +28 −12 Original line number Diff line number Diff line Loading @@ -915,6 +915,7 @@ static int msm_device_to_be_id [][NO_COLS] = { {AUDIO_DEVICE_OUT_DGTL_DOCK_HEADSET , 9}, {AUDIO_DEVICE_OUT_USB_ACCESSORY , -1}, {AUDIO_DEVICE_OUT_USB_DEVICE , -1}, {AUDIO_DEVICE_OUT_USB_HEADSET , -1}, {AUDIO_DEVICE_OUT_REMOTE_SUBMIX , 9}, {AUDIO_DEVICE_OUT_PROXY , 9}, {AUDIO_DEVICE_OUT_FM , 7}, Loading @@ -940,6 +941,7 @@ static int msm_device_to_be_id [][NO_COLS] = { {AUDIO_DEVICE_OUT_DGTL_DOCK_HEADSET , 9}, {AUDIO_DEVICE_OUT_USB_ACCESSORY , -1}, {AUDIO_DEVICE_OUT_USB_DEVICE , -1}, {AUDIO_DEVICE_OUT_USB_HEADSET , -1}, {AUDIO_DEVICE_OUT_REMOTE_SUBMIX , 9}, {AUDIO_DEVICE_OUT_PROXY , 9}, /* Add the correct be ids */ Loading @@ -966,6 +968,7 @@ static int msm_device_to_be_id [][NO_COLS] = { {AUDIO_DEVICE_OUT_DGTL_DOCK_HEADSET , 9}, {AUDIO_DEVICE_OUT_USB_ACCESSORY , -1}, {AUDIO_DEVICE_OUT_USB_DEVICE , -1}, {AUDIO_DEVICE_OUT_USB_HEADSET , -1}, {AUDIO_DEVICE_OUT_REMOTE_SUBMIX , 9}, {AUDIO_DEVICE_OUT_PROXY , 9}, /* Add the correct be ids */ Loading @@ -992,6 +995,7 @@ static int msm_device_to_be_id [][NO_COLS] = { {AUDIO_DEVICE_OUT_DGTL_DOCK_HEADSET , 9}, {AUDIO_DEVICE_OUT_USB_ACCESSORY , -1}, {AUDIO_DEVICE_OUT_USB_DEVICE , -1}, {AUDIO_DEVICE_OUT_USB_HEADSET , -1}, {AUDIO_DEVICE_OUT_REMOTE_SUBMIX , 9}, {AUDIO_DEVICE_OUT_PROXY , 9}, /* Add the correct be ids */ Loading Loading @@ -3712,8 +3716,10 @@ snd_device_t platform_get_output_snd_device(void *platform, struct stream_out *o } else if (devices == (AUDIO_DEVICE_OUT_ANLG_DOCK_HEADSET | AUDIO_DEVICE_OUT_SPEAKER)) { snd_device = SND_DEVICE_OUT_SPEAKER_AND_USB_HEADSET; } else if (devices == (AUDIO_DEVICE_OUT_USB_DEVICE | AUDIO_DEVICE_OUT_SPEAKER)) { } else if ((devices == (AUDIO_DEVICE_OUT_USB_DEVICE | AUDIO_DEVICE_OUT_SPEAKER)) || (devices == (AUDIO_DEVICE_OUT_USB_HEADSET | AUDIO_DEVICE_OUT_SPEAKER))) { snd_device = SND_DEVICE_OUT_SPEAKER_AND_USB_HEADSET; } else if ((devices & AUDIO_DEVICE_OUT_SPEAKER) && (devices & AUDIO_DEVICE_OUT_ALL_A2DP)) { Loading Loading @@ -3769,7 +3775,9 @@ snd_device_t platform_get_output_snd_device(void *platform, struct stream_out *o } else { snd_device = SND_DEVICE_OUT_VOICE_HEADPHONES; } } else if (devices & AUDIO_DEVICE_OUT_USB_DEVICE) { } else if (devices & (AUDIO_DEVICE_OUT_USB_DEVICE | AUDIO_DEVICE_OUT_USB_HEADSET)) { if (voice_is_in_call(adev)) { switch (adev->voice.tty_mode) { case TTY_MODE_FULL: Loading Loading @@ -3905,7 +3913,9 @@ snd_device_t platform_get_output_snd_device(void *platform, struct stream_out *o ALOGD("%s: setting USB hadset channel capability(2) for Proxy", __func__); audio_extn_set_afe_proxy_channel_mixer(adev, 2); snd_device = SND_DEVICE_OUT_USB_HEADSET; } else if (devices & AUDIO_DEVICE_OUT_USB_DEVICE) { } else if (devices & (AUDIO_DEVICE_OUT_USB_DEVICE | AUDIO_DEVICE_OUT_USB_HEADSET)) { if (audio_extn_usb_is_capture_supported()) snd_device = SND_DEVICE_OUT_USB_HEADSET; else Loading Loading @@ -4008,7 +4018,7 @@ static snd_device_t get_snd_device_for_voice_comm(struct platform_data *my_data, snd_device = SND_DEVICE_IN_HANDSET_MIC_AEC_NS; } else if (in_device & AUDIO_DEVICE_IN_WIRED_HEADSET) { snd_device = SND_DEVICE_IN_HEADSET_MIC_FLUENCE; } else if (in_device & AUDIO_DEVICE_IN_USB_DEVICE) { } else if (audio_is_usb_in_device(in_device | AUDIO_DEVICE_BIT_IN)) { snd_device = SND_DEVICE_IN_USB_HEADSET_MIC_AEC; } platform_set_echo_reference(adev, true, out_device); Loading Loading @@ -4042,7 +4052,7 @@ static snd_device_t get_snd_device_for_voice_comm(struct platform_data *my_data, snd_device = SND_DEVICE_IN_HANDSET_MIC_AEC; } else if (in_device & AUDIO_DEVICE_IN_WIRED_HEADSET) { snd_device = SND_DEVICE_IN_HEADSET_MIC_FLUENCE; } else if (in_device & AUDIO_DEVICE_IN_USB_DEVICE) { } else if (audio_is_usb_in_device(in_device | AUDIO_DEVICE_BIT_IN)) { snd_device = SND_DEVICE_IN_USB_HEADSET_MIC_AEC; } platform_set_echo_reference(adev, true, out_device); Loading Loading @@ -4146,7 +4156,9 @@ snd_device_t platform_get_input_snd_device(void *platform, audio_devices_t out_d ALOGE("%s: Invalid TTY mode (%#x)", __func__, adev->voice.tty_mode); } goto exit; } else if (out_device & AUDIO_DEVICE_OUT_USB_DEVICE) { } else if (out_device & (AUDIO_DEVICE_OUT_USB_DEVICE | AUDIO_DEVICE_OUT_USB_HEADSET)) { switch (adev->voice.tty_mode) { case TTY_MODE_FULL: snd_device = SND_DEVICE_IN_VOICE_TTY_FULL_USB_MIC; Loading Loading @@ -4243,7 +4255,9 @@ snd_device_t platform_get_input_snd_device(void *platform, audio_devices_t out_d } } else if (out_device & AUDIO_DEVICE_OUT_TELEPHONY_TX) { snd_device = SND_DEVICE_IN_VOICE_RX; } else if (out_device & AUDIO_DEVICE_OUT_USB_DEVICE) { } else if (out_device & (AUDIO_DEVICE_OUT_USB_DEVICE | AUDIO_DEVICE_OUT_USB_HEADSET)) { if (audio_extn_usb_is_capture_supported()) { snd_device = SND_DEVICE_IN_VOICE_USB_HEADSET_MIC; } Loading Loading @@ -4322,7 +4336,7 @@ snd_device_t platform_get_input_snd_device(void *platform, audio_devices_t out_d else snd_device = SND_DEVICE_IN_VOICE_REC_MIC; } } else if (in_device & AUDIO_DEVICE_IN_USB_DEVICE) { } else if (audio_is_usb_in_device(in_device | AUDIO_DEVICE_BIT_IN)) { snd_device = SND_DEVICE_IN_VOICE_RECOG_USB_HEADSET_MIC; } } else if (source == AUDIO_SOURCE_UNPROCESSED) { Loading @@ -4342,7 +4356,7 @@ snd_device_t platform_get_input_snd_device(void *platform, audio_devices_t out_d } } else if (in_device & AUDIO_DEVICE_IN_WIRED_HEADSET) { snd_device = SND_DEVICE_IN_UNPROCESSED_HEADSET_MIC; } else if (in_device & AUDIO_DEVICE_IN_USB_DEVICE) { } else if (audio_is_usb_in_device(in_device | AUDIO_DEVICE_BIT_IN)) { snd_device = SND_DEVICE_IN_UNPROCESSED_USB_HEADSET_MIC; } } else if ((source == AUDIO_SOURCE_VOICE_COMMUNICATION) || Loading Loading @@ -4420,7 +4434,7 @@ snd_device_t platform_get_input_snd_device(void *platform, audio_devices_t out_d snd_device = SND_DEVICE_IN_USB_HEADSET_MIC; } else if (in_device & AUDIO_DEVICE_IN_FM_TUNER) { snd_device = SND_DEVICE_IN_CAPTURE_FM; } else if (in_device & AUDIO_DEVICE_IN_USB_DEVICE ) { } else if (audio_is_usb_in_device(in_device | AUDIO_DEVICE_BIT_IN)) { snd_device = SND_DEVICE_IN_USB_HEADSET_MIC; } else { ALOGE("%s: Unknown input device(s) %#x", __func__, in_device); Loading Loading @@ -4465,7 +4479,9 @@ snd_device_t platform_get_input_snd_device(void *platform, audio_devices_t out_d } else if (out_device & AUDIO_DEVICE_OUT_ANLG_DOCK_HEADSET || out_device & AUDIO_DEVICE_OUT_DGTL_DOCK_HEADSET) { snd_device = SND_DEVICE_IN_USB_HEADSET_MIC; } else if (out_device & AUDIO_DEVICE_OUT_USB_DEVICE) { } else if (out_device & (AUDIO_DEVICE_OUT_USB_DEVICE | AUDIO_DEVICE_OUT_USB_HEADSET)) { if (audio_extn_usb_is_capture_supported()) snd_device = SND_DEVICE_IN_USB_HEADSET_MIC; else Loading