Merge "a2dp: reset dec format after LC3 playback"
diff --git a/configs/lahaina/audio_platform_info.xml b/configs/lahaina/audio_platform_info.xml
index 8d05776..d987537 100644
--- a/configs/lahaina/audio_platform_info.xml
+++ b/configs/lahaina/audio_platform_info.xml
@@ -48,6 +48,7 @@
<device name="SND_DEVICE_IN_VOCE_RECOG_USB_HEADSET_HEX_MIC" acdb_id="162"/>
<device name="SND_DEVICE_IN_VOICE_HEARING_AID" acdb_id="11"/>
<device name="SND_DEVICE_OUT_VOICE_HANDSET_TMUS" acdb_id="7"/>
+ <device name="SND_DEVICE_IN_BT_A2DP" acdb_id="201"/>
</acdb_ids>
<module_ids>
diff --git a/configs/lahaina/audio_platform_info_hdk.xml b/configs/lahaina/audio_platform_info_hdk.xml
index 04578d4..a79c1cf 100644
--- a/configs/lahaina/audio_platform_info_hdk.xml
+++ b/configs/lahaina/audio_platform_info_hdk.xml
@@ -148,6 +148,7 @@
<device name="SND_DEVICE_IN_VOICE_HEARING_AID" acdb_id="11"/>
<device name="SND_DEVICE_OUT_VOICE_HANDSET_TMUS" acdb_id="7"/>
<device name="SND_DEVICE_IN_UNPROCESSED_USB_HEADSET_MIC" acdb_id="133"/>
+ <device name="SND_DEVICE_IN_BT_A2DP" acdb_id="201"/>
</acdb_ids>
<backend_names>
<device name="SND_DEVICE_OUT_HEADPHONES" backend="headphones" interface="RX_CDC_DMA_RX_0"/>
diff --git a/configs/lahaina/audio_platform_info_intcodec.xml b/configs/lahaina/audio_platform_info_intcodec.xml
index a362b39..6568e46 100644
--- a/configs/lahaina/audio_platform_info_intcodec.xml
+++ b/configs/lahaina/audio_platform_info_intcodec.xml
@@ -148,6 +148,7 @@
<device name="SND_DEVICE_IN_VOICE_HEARING_AID" acdb_id="11"/>
<device name="SND_DEVICE_OUT_VOICE_HANDSET_TMUS" acdb_id="7"/>
<device name="SND_DEVICE_IN_UNPROCESSED_USB_HEADSET_MIC" acdb_id="133"/>
+ <device name="SND_DEVICE_IN_BT_A2DP" acdb_id="201"/>
</acdb_ids>
<backend_names>
<device name="SND_DEVICE_OUT_HEADPHONES" backend="headphones" interface="RX_CDC_DMA_RX_0"/>
diff --git a/configs/lahaina/audio_platform_info_qrd.xml b/configs/lahaina/audio_platform_info_qrd.xml
index 1404423..f0b0279 100644
--- a/configs/lahaina/audio_platform_info_qrd.xml
+++ b/configs/lahaina/audio_platform_info_qrd.xml
@@ -148,6 +148,7 @@
<device name="SND_DEVICE_IN_VOICE_HEARING_AID" acdb_id="11"/>
<device name="SND_DEVICE_OUT_VOICE_HANDSET_TMUS" acdb_id="7"/>
<device name="SND_DEVICE_IN_UNPROCESSED_USB_HEADSET_MIC" acdb_id="133"/>
+ <device name="SND_DEVICE_IN_BT_A2DP" acdb_id="201"/>
</acdb_ids>
<backend_names>
<device name="SND_DEVICE_OUT_HEADPHONES" backend="headphones" interface="RX_CDC_DMA_RX_0"/>
diff --git a/configs/lahaina/audio_platform_info_shimaidp.xml b/configs/lahaina/audio_platform_info_shimaidp.xml
index b1edc20..2b60989 100644
--- a/configs/lahaina/audio_platform_info_shimaidp.xml
+++ b/configs/lahaina/audio_platform_info_shimaidp.xml
@@ -50,6 +50,7 @@
<device name="SND_DEVICE_IN_VOCE_RECOG_USB_HEADSET_HEX_MIC" acdb_id="162"/>
<device name="SND_DEVICE_IN_VOICE_HEARING_AID" acdb_id="11"/>
<device name="SND_DEVICE_OUT_VOICE_HANDSET_TMUS" acdb_id="7"/>
+ <device name="SND_DEVICE_IN_BT_A2DP" acdb_id="201"/>
</acdb_ids>
<module_ids>
diff --git a/configs/lahaina/audio_platform_info_shimaqrd.xml b/configs/lahaina/audio_platform_info_shimaqrd.xml
index de717e9..e87f8d0 100644
--- a/configs/lahaina/audio_platform_info_shimaqrd.xml
+++ b/configs/lahaina/audio_platform_info_shimaqrd.xml
@@ -52,6 +52,7 @@
<device name="SND_DEVICE_IN_VOCE_RECOG_USB_HEADSET_HEX_MIC" acdb_id="162"/>
<device name="SND_DEVICE_IN_VOICE_HEARING_AID" acdb_id="11"/>
<device name="SND_DEVICE_OUT_VOICE_HANDSET_TMUS" acdb_id="7"/>
+ <device name="SND_DEVICE_IN_BT_A2DP" acdb_id="201"/>
</acdb_ids>
<module_ids>
diff --git a/configs/lahaina/audio_platform_info_yupikidp.xml b/configs/lahaina/audio_platform_info_yupikidp.xml
index e04f05a..9f51e6f 100644
--- a/configs/lahaina/audio_platform_info_yupikidp.xml
+++ b/configs/lahaina/audio_platform_info_yupikidp.xml
@@ -148,6 +148,7 @@
<device name="SND_DEVICE_IN_HANDSET_GENERIC_QMIC" acdb_id="191"/>
<device name="SND_DEVICE_IN_VOICE_HEARING_AID" acdb_id="11"/>
<device name="SND_DEVICE_OUT_VOICE_HANDSET_TMUS" acdb_id="7"/>
+ <device name="SND_DEVICE_IN_BT_A2DP" acdb_id="201"/>
</acdb_ids>
<backend_names>
<device name="SND_DEVICE_OUT_HEADPHONES" backend="headphones" interface="RX_CDC_DMA_RX_0"/>
diff --git a/configs/lahaina/audio_platform_info_yupikqrd.xml b/configs/lahaina/audio_platform_info_yupikqrd.xml
index 9bdcf52..2f77410 100644
--- a/configs/lahaina/audio_platform_info_yupikqrd.xml
+++ b/configs/lahaina/audio_platform_info_yupikqrd.xml
@@ -52,6 +52,7 @@
<device name="SND_DEVICE_IN_VOCE_RECOG_USB_HEADSET_HEX_MIC" acdb_id="162"/>
<device name="SND_DEVICE_IN_VOICE_HEARING_AID" acdb_id="11"/>
<device name="SND_DEVICE_OUT_VOICE_HANDSET_TMUS" acdb_id="7"/>
+ <device name="SND_DEVICE_IN_BT_A2DP" acdb_id="201"/>
</acdb_ids>
<module_ids>
diff --git a/configs/lahaina/audio_policy_configuration.xml b/configs/lahaina/audio_policy_configuration.xml
index b7e9e65..cd9f7a6 100644
--- a/configs/lahaina/audio_policy_configuration.xml
+++ b/configs/lahaina/audio_policy_configuration.xml
@@ -332,6 +332,11 @@
</devicePort>
<devicePort tagName="USB Headset In" type="AUDIO_DEVICE_IN_USB_HEADSET" role="source">
</devicePort>
+ <devicePort tagName="A2DP In" type="AUDIO_DEVICE_IN_BLUETOOTH_A2DP" role="source"
+ encodedFormats="VX_AUDIO_FORMAT_LC3">
+ <profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
+ samplingRates="44100,48000" channelMasks="AUDIO_CHANNEL_IN_MONO,AUDIO_CHANNEL_IN_STEREO"/>
+ </devicePort>
</devicePorts>
<!-- route declaration, i.e. list all available sources for a given sink -->
@@ -367,7 +372,7 @@
<route type="mix" sink="voice_rx"
sources="Telephony Rx"/>
<route type="mix" sink="primary input"
- sources="Built-In Mic,Built-In Back Mic,Wired Headset Mic,BT SCO Headset Mic,FM Tuner,Telephony Rx"/>
+ sources="Built-In Mic,Built-In Back Mic,Wired Headset Mic,BT SCO Headset Mic,FM Tuner,Telephony Rx,A2DP In"/>
<route type="mix" sink="usb_surround_sound"
sources="USB Device In,USB Headset In"/>
<route type="mix" sink="fast input"
@@ -377,7 +382,7 @@
<route type="mix" sink="voip_tx"
sources="Built-In Mic,Built-In Back Mic,BT SCO Headset Mic,USB Device In,USB Headset In,Wired Headset Mic"/>
<route type="mix" sink="record_24"
- sources="Built-In Mic,Built-In Back Mic,Wired Headset Mic"/>
+ sources="Built-In Mic,Built-In Back Mic,Wired Headset Mic,A2DP In"/>
<route type="mix" sink="mmap_no_irq_in"
sources="Built-In Mic,Built-In Back Mic,Wired Headset Mic,USB Device In,USB Headset In"/>
<route type="mix" sink="BT A2DP Out"
diff --git a/configs/lahaina/mixer_paths.xml b/configs/lahaina/mixer_paths.xml
index d95558e..840fd8f 100644
--- a/configs/lahaina/mixer_paths.xml
+++ b/configs/lahaina/mixer_paths.xml
@@ -1806,6 +1806,10 @@
<ctl name="MultiMedia1 Mixer SLIM_7_TX" value="1" />
</path>
+ <path name="audio-record bt-a2dp-cap">
+ <ctl name="MultiMedia1 Mixer SLIM_7_TX" value="1" />
+ </path>
+
<path name="audio-record bt-sco-wb">
<path name="audio-record bt-sco" />
</path>
@@ -1830,6 +1834,10 @@
<ctl name="MultiMedia8 Mixer SLIM_7_TX" value="1" />
</path>
+ <path name="audio-record-compress bt-a2dp-cap">
+ <ctl name="MultiMedia8 Mixer SLIM_7_TX" value="1" />
+ </path>
+
<path name="audio-record-compress bt-sco-wb">
<path name="audio-record-compress bt-sco" />
</path>
@@ -1854,6 +1862,10 @@
<ctl name="MultiMedia17 Mixer SLIM_7_TX" value="1" />
</path>
+ <path name="audio-record-compress2 bt-a2dp-cap">
+ <ctl name="MultiMedia17 Mixer SLIM_7_TX" value="1" />
+ </path>
+
<path name="audio-record-compress2 bt-sco-wb">
<path name="audio-record-compress2 bt-sco" />
</path>
@@ -1878,6 +1890,10 @@
<ctl name="MultiMedia8 Mixer SLIM_7_TX" value="1" />
</path>
+ <path name="low-latency-record bt-a2dp-cap">
+ <ctl name="MultiMedia8 Mixer SLIM_7_TX" value="1" />
+ </path>
+
<path name="low-latency-record bt-sco-wb">
<path name="low-latency-record bt-sco" />
</path>
@@ -3607,6 +3623,10 @@
<ctl name="MultiMedia16 Mixer SLIM_7_TX" value="1" />
</path>
+ <path name="mmap-record bt-a2dp-cap">
+ <ctl name="MultiMedia16 Mixer SLIM_7_TX" value="1" />
+ </path>
+
<path name="mmap-record bt-sco-wb">
<path name="mmap-record bt-sco" />
</path>
diff --git a/configs/lahaina/mixer_paths_hhg.xml b/configs/lahaina/mixer_paths_hhg.xml
index f716350..b926a3a 100644
--- a/configs/lahaina/mixer_paths_hhg.xml
+++ b/configs/lahaina/mixer_paths_hhg.xml
@@ -2756,7 +2756,7 @@
</path>
<path name="speaker-mic">
- <path name="dmic5" />
+ <path name="dmic3" />
</path>
<path name="speaker-mic-liquid">
diff --git a/configs/lahaina/mixer_paths_shimaqrd.xml b/configs/lahaina/mixer_paths_shimaqrd.xml
index 2db82d3..89b3c6f 100755
--- a/configs/lahaina/mixer_paths_shimaqrd.xml
+++ b/configs/lahaina/mixer_paths_shimaqrd.xml
@@ -1817,6 +1817,11 @@
<path name="compress-offload-playback9" />
</path>
+ <path name="audio-with-haptics-playback handset">
+ <ctl name="RX_CDC_DMA_RX_6 Audio Mixer MultiMedia32" value="1"/>
+ <ctl name="RX_CDC_DMA_RX_0 Audio Mixer MultiMedia31" value="1"/>
+ </path>
+
<path name="audio-record">
<ctl name="MultiMedia1 Mixer TX_CDC_DMA_TX_3" value="1" />
</path>
diff --git a/configs/lahaina/yupik_overlay/mixer_paths_yupikqrd_overlay.xml b/configs/lahaina/yupik_overlay/mixer_paths_yupikqrd_overlay.xml
index 0dd5a01..0437aef 100644
--- a/configs/lahaina/yupik_overlay/mixer_paths_yupikqrd_overlay.xml
+++ b/configs/lahaina/yupik_overlay/mixer_paths_yupikqrd_overlay.xml
@@ -270,4 +270,8 @@
<path name="mmap-record capture-fm">
<ctl name="MultiMedia16 Mixer SEC_MI2S_TX" value="1"/>
</path>
+ <path name="audio-with-haptics-playback handset">
+ <ctl name="RX_CDC_DMA_RX_6 Audio Mixer MultiMedia32" value="1"/>
+ <ctl name="RX_CDC_DMA_RX_0 Audio Mixer MultiMedia31" value="1"/>
+ </path>
</mixer>
diff --git a/configs/msm8937/msm8937.mk b/configs/msm8937/msm8937.mk
index a801809..5db9969 100644
--- a/configs/msm8937/msm8937.mk
+++ b/configs/msm8937/msm8937.mk
@@ -160,7 +160,8 @@
$(TOPDIR)vendor/qcom/opensource/audio-hal/primary-hal/configs/msm8937/audio_policy_configuration_common.xml:$(TARGET_COPY_OUT_VENDOR)/etc/audio_policy_configuration.xml
else
PRODUCT_COPY_FILES += \
- $(TOPDIR)vendor/qcom/opensource/audio-hal/primary-hal/configs/msm8937/audio_policy_configuration.xml:$(TARGET_COPY_OUT_VENDOR)/etc/audio/audio_policy_configuration.xml
+ $(TOPDIR)vendor/qcom/opensource/audio-hal/primary-hal/configs/msm8937/audio_policy_configuration.xml:$(TARGET_COPY_OUT_VENDOR)/etc/audio/audio_policy_configuration.xml \
+ $(TOPDIR)vendor/qcom/opensource/audio-hal/primary-hal/configs/msm8937/audio_policy_configuration_common.xml:$(TARGET_COPY_OUT_VENDOR)/etc/audio_policy_configuration.xml
endif
PRODUCT_COPY_FILES += \
$(TOPDIR)vendor/qcom/opensource/audio-hal/primary-hal/configs/common/bluetooth_qti_audio_policy_configuration.xml:$(TARGET_COPY_OUT_VENDOR)/etc/a2dp_audio_policy_configuration.xml \
diff --git a/hal/audio_extn/Android.mk b/hal/audio_extn/Android.mk
index db80656..bc8392d 100755
--- a/hal/audio_extn/Android.mk
+++ b/hal/audio_extn/Android.mk
@@ -1160,7 +1160,7 @@
system/media/audio/include
LOCAL_SHARED_LIBRARIES:= \
- android.frameworks.automotive.powerpolicy-ndk_platform \
+ android.frameworks.automotive.powerpolicy-V1-ndk_platform \
libbase \
libbinder_ndk \
libcutils \
diff --git a/hal/audio_hw.c b/hal/audio_hw.c
index 601a63f..32f9ce1 100644
--- a/hal/audio_hw.c
+++ b/hal/audio_hw.c
@@ -3078,6 +3078,30 @@
}
enable_audio_route(adev, usecase);
+ if (uc_id == USECASE_AUDIO_PLAYBACK_VOIP) {
+ struct stream_in *voip_in = get_voice_communication_input(adev);
+ struct audio_usecase *voip_in_usecase = NULL;
+ voip_in_usecase = get_usecase_from_list(adev, USECASE_AUDIO_RECORD_VOIP);
+ if (voip_in != NULL &&
+ voip_in_usecase != NULL &&
+ !(out_snd_device == AUDIO_DEVICE_OUT_SPEAKER ||
+ out_snd_device == AUDIO_DEVICE_OUT_SPEAKER_SAFE) &&
+ (voip_in_usecase->in_snd_device ==
+ platform_get_input_snd_device(adev->platform, voip_in,
+ &usecase->stream.out->device_list,usecase->type))) {
+ /*
+ * if VOIP TX is enabled before VOIP RX, needs to re-route the TX path
+ * for enabling echo-reference-voip with correct port
+ */
+ ALOGD("%s: VOIP TX is enabled before VOIP RX,needs to re-route the TX path",__func__);
+ disable_audio_route(adev, voip_in_usecase);
+ disable_snd_device(adev, voip_in_usecase->in_snd_device);
+ enable_snd_device(adev, voip_in_usecase->in_snd_device);
+ enable_audio_route(adev, voip_in_usecase);
+ }
+ }
+
+
audio_extn_qdsp_set_device(usecase);
/* If input stream is already running then effect needs to be
@@ -8790,12 +8814,14 @@
struct listnode *node;
list_for_each(node, &adev->usecase_list) {
usecase = node_to_item(node, struct audio_usecase, list);
- if (usecase->stream.in && (usecase->type == PCM_CAPTURE) &&
+ if (usecase->stream.in && (usecase->type == PCM_CAPTURE ||
+ usecase->type == VOICE_CALL) &&
(!is_btsco_device(SND_DEVICE_NONE, usecase->in_snd_device))) {
ALOGD("BT_SCO ON, switch all in use case to it");
select_devices(adev, usecase->id);
}
- if (usecase->stream.out && (usecase->type == PCM_PLAYBACK) &&
+ if (usecase->stream.out && (usecase->type == PCM_PLAYBACK ||
+ usecase->type == VOICE_CALL) &&
(!is_btsco_device(usecase->out_snd_device, SND_DEVICE_NONE))) {
ALOGD("BT_SCO ON, switch all out use case to it");
select_devices(adev, usecase->id);
@@ -10478,14 +10504,16 @@
reassign_device_list(&out->device_list, AUDIO_DEVICE_OUT_SPEAKER, "");
list_for_each(node, &adev->usecase_list) {
usecase = node_to_item(node, struct audio_usecase, list);
- if ((usecase != uc_info) &&
- platform_check_backends_match(SND_DEVICE_OUT_SPEAKER,
- usecase->out_snd_device)) {
+ if ((usecase->type != PCM_CAPTURE) && (usecase != uc_info) &&
+ !is_a2dp_out_device_type(&usecase->stream.out->device_list) &&
+ platform_check_backends_match(SND_DEVICE_OUT_SPEAKER,
+ usecase->out_snd_device)) {
assign_devices(&out->device_list, &usecase->stream.out->device_list);
break;
}
}
- if (uc_info->out_snd_device == SND_DEVICE_OUT_BT_A2DP) {
+ if (is_a2dp_out_device_type(&devices) &&
+ list_length(&devices) == 1) {
out->a2dp_muted = true;
if (is_offload_usecase(out->usecase)) {
if (out->offload_state == OFFLOAD_STATE_PLAYING)
@@ -10791,8 +10819,7 @@
configured_low_latency_capture_period_size = trial;
}
}
- if ((property_get("vendor.audio_hal.in_period_size", value, NULL) > 0) ||
- (property_get("audio_hal.in_period_size", value, NULL) > 0)) {
+ if (property_get("vendor.audio_hal.in_period_size", value, NULL) > 0) {
trial = atoi(value);
if (period_size_is_plausible_for_low_latency(trial)) {
configured_low_latency_capture_period_size = trial;
diff --git a/hal/msm8974/platform.c b/hal/msm8974/platform.c
index 0a68567..ca5164f 100755
--- a/hal/msm8974/platform.c
+++ b/hal/msm8974/platform.c
@@ -5488,7 +5488,7 @@
struct audio_backend_cfg backend_cfg = {0};
bool is_bus_dev_usecase = false;
- if (voice_is_in_call_or_call_screen(my_data->adev))
+ if (voice_is_in_call_or_call_screen(my_data->adev) && (usecase->type == PCM_CAPTURE))
is_incall_rec_usecase = voice_is_in_call_rec_stream(usecase->stream.in);
if (compare_device_type(&usecase->device_list, AUDIO_DEVICE_OUT_BUS))
@@ -5496,7 +5496,7 @@
if (usecase->type == PCM_PLAYBACK)
snd_device = usecase->out_snd_device;
- else if ((usecase->type == PCM_CAPTURE) && is_incall_rec_usecase)
+ else if (is_incall_rec_usecase)
snd_device = voice_get_incall_rec_snd_device(usecase->in_snd_device);
else if ((usecase->type == PCM_HFP_CALL) || (usecase->type == PCM_CAPTURE)||
(usecase->type == ICC_CALL) || (usecase->type == SYNTH_LOOPBACK))
@@ -9555,7 +9555,9 @@
ALOGD("%s:becf: afe: %s mixer set to %d bit for %x format", __func__,
my_data->current_backend_cfg[backend_idx].bitwidth_mixer_ctl, bit_width, format);
for (int idx = 0; idx < MAX_CODEC_BACKENDS; idx++) {
- if (my_data->current_backend_cfg[idx].bitwidth_mixer_ctl) {
+ if (my_data->current_backend_cfg[idx].bitwidth_mixer_ctl
+ && strcmp(my_data->current_backend_cfg[idx].bitwidth_mixer_ctl,
+ my_data->current_backend_cfg[backend_idx].bitwidth_mixer_ctl) == 0) {
ctl = mixer_get_ctl_by_name(adev->mixer,
my_data->current_backend_cfg[idx].bitwidth_mixer_ctl);
id_string = platform_get_mixer_control(ctl);
@@ -9660,7 +9662,9 @@
ALOGD("%s:becf: afe: %s set to %s", __func__,
my_data->current_backend_cfg[backend_idx].samplerate_mixer_ctl, rate_str);
for (int idx = 0; idx < MAX_CODEC_BACKENDS; idx++) {
- if (my_data->current_backend_cfg[idx].samplerate_mixer_ctl) {
+ if (my_data->current_backend_cfg[idx].samplerate_mixer_ctl
+ && strcmp(my_data->current_backend_cfg[idx].samplerate_mixer_ctl,
+ my_data->current_backend_cfg[backend_idx].samplerate_mixer_ctl) == 0) {
ctl = mixer_get_ctl_by_name(adev->mixer,
my_data->current_backend_cfg[idx].samplerate_mixer_ctl);
id_string = platform_get_mixer_control(ctl);
@@ -9715,7 +9719,9 @@
ALOGD("%s:becf: afe: %s set to %s", __func__,
my_data->current_backend_cfg[backend_idx].channels_mixer_ctl, channel_cnt_str);
for (int idx = 0; idx < MAX_CODEC_BACKENDS; idx++) {
- if (my_data->current_backend_cfg[idx].channels_mixer_ctl) {
+ if (my_data->current_backend_cfg[idx].channels_mixer_ctl &&
+ strcmp(my_data->current_backend_cfg[idx].channels_mixer_ctl,
+ my_data->current_backend_cfg[backend_idx].channels_mixer_ctl) == 0) {
ctl = mixer_get_ctl_by_name(adev->mixer,
my_data->current_backend_cfg[idx].channels_mixer_ctl);
id_string = platform_get_mixer_control(ctl);