Merge "configs: Update default value of DMA Mixer Ctls"
diff --git a/configs/lahaina/audio_tuning_mixer.txt b/configs/lahaina/audio_tuning_mixer.txt
index 7525ce4..6d43d1a 100644
--- a/configs/lahaina/audio_tuning_mixer.txt
+++ b/configs/lahaina/audio_tuning_mixer.txt
@@ -190,8 +190,8 @@
 SpkrRight VISENSE Switch:1
 SpkrLeft SWR DAC_Port Switch:1
 SpkrRight SWR DAC_Port Switch:1
-WSA_RX0 Digital Volume:62
-WSA_RX1 Digital Volume:62
+WSA_RX0 Digital Volume:84
+WSA_RX1 Digital Volume:84
 WSA_CDC_DMA_RX_0 Audio Mixer MultiMedia1:1
 
 disable
@@ -222,7 +222,7 @@
 SpkrLeft COMP Switch:1
 SpkrLeft VISENSE Switch:1
 SpkrLeft SWR DAC_Port Switch:1
-WSA_RX0 Digital Volume:62
+WSA_RX0 Digital Volume:84
 WSA_CDC_DMA_RX_0 Audio Mixer MultiMedia1:1
 
 disable
@@ -248,7 +248,7 @@
 SpkrRight COMP Switch:1
 SpkrRight VISENSE Switch:1
 SpkrRight SWR DAC_Port Switch:1
-WSA_RX1 Digital Volume:62
+WSA_RX1 Digital Volume:84
 WSA_CDC_DMA_RX_0 Audio Mixer MultiMedia1:1
 
 disable
diff --git a/hal/audio_extn/audio_extn.c b/hal/audio_extn/audio_extn.c
index 32051a8..ca06e59 100755
--- a/hal/audio_extn/audio_extn.c
+++ b/hal/audio_extn/audio_extn.c
@@ -1294,6 +1294,12 @@
         set_values[0] = PCM_CHANNEL_FL;
         set_values[1] = PCM_CHANNEL_FR;
         break;
+     case 4:
+        set_values[0] = PCM_CHANNEL_FL;
+        set_values[1] = PCM_CHANNEL_FR;
+        set_values[2] = PCM_CHANNEL_LS;
+        set_values[3] = PCM_CHANNEL_LFE;
+        break;
     case 6:
         set_values[0] = PCM_CHANNEL_FL;
         set_values[1] = PCM_CHANNEL_FR;
@@ -1390,7 +1396,7 @@
     }
     mixer_ctl_set_enum_by_string(ctl, channel_cnt_str);
 
-    if (channel_count == 6 || channel_count == 8 || channel_count == 2) {
+    if (channel_count == 6 || channel_count == 8 || channel_count == 2 || channel_count == 4) {
         ret = afe_proxy_set_channel_mapping(adev, channel_count, snd_device);
     } else {
         ALOGE("%s: set unsupported channel count(%d)",  __func__, channel_count);
diff --git a/hal/audio_hw.c b/hal/audio_hw.c
index fd04f3f..8fb4818 100644
--- a/hal/audio_hw.c
+++ b/hal/audio_hw.c
@@ -894,6 +894,21 @@
     return false;
 }
 
+static bool is_supported_conc_usecase_for_power_mode_call(struct audio_device *adev)
+{
+    struct listnode *node;
+    struct audio_usecase *usecase;
+
+    list_for_each(node, &adev->usecase_list) {
+        usecase = node_to_item(node, struct audio_usecase, list);
+        if (usecase->id == USECASE_AUDIO_PLAYBACK_FM) {
+            ALOGD("%s: FM usecase is active, not setting power mode", __func__);
+            return false;
+        }
+    }
+
+    return true;
+}
 static inline bool is_mmap_usecase(audio_usecase_t uc_id)
 {
     return (uc_id == USECASE_AUDIO_RECORD_AFE_PROXY) ||
@@ -906,25 +921,6 @@
     return ((left >= 0.0f && right >= 0.0f) ? true : false);
 }
 
-static int enable_audio_route_for_voice_usecases(struct audio_device *adev,
-                                                 struct audio_usecase *uc_info)
-{
-    struct listnode *node;
-    struct audio_usecase *usecase;
-
-    if (uc_info == NULL)
-        return -EINVAL;
-
-    /* Re-route all voice usecases on the shared backend other than the
-       specified usecase to new snd devices */
-    list_for_each(node, &adev->usecase_list) {
-        usecase = node_to_item(node, struct audio_usecase, list);
-        if ((usecase->type == VOICE_CALL) && (usecase != uc_info))
-            enable_audio_route(adev, usecase);
-    }
-    return 0;
-}
-
 static void enable_asrc_mode(struct audio_device *adev)
 {
     ALOGV("%s", __func__);
@@ -1820,6 +1816,7 @@
      */
     if (uc_info->type == VOICE_CALL &&
         voice_extn_is_voice_power_mode_supported() &&
+        is_supported_conc_usecase_for_power_mode_call(adev) &&
         platform_check_and_update_island_power_status(adev->platform,
                                              uc_info,
                                              snd_device)) {
@@ -1925,24 +1922,22 @@
             /* Update the out_snd_device only before enabling the audio route */
             if (switch_device[usecase->id]) {
                 usecase->out_snd_device = derive_snd_device[usecase->id];
-                if (usecase->type != VOICE_CALL) {
-                    ALOGD("%s:becf: enabling usecase (%s) on (%s)", __func__,
-                         use_case_table[usecase->id],
-                         platform_get_snd_device_name(usecase->out_snd_device));
-                    /* Update voc calibration before enabling VoIP route */
-                    if (usecase->type == VOIP_CALL)
-                        status = platform_switch_voice_call_device_post(adev->platform,
-                                                           usecase->out_snd_device,
-                                                           platform_get_input_snd_device(
-                                                               adev->platform, NULL,
-                                                               &uc_info->device_list,
-                                                               usecase->type));
-                    enable_audio_route(adev, usecase);
-                    if (usecase->stream.out && usecase->id == USECASE_AUDIO_PLAYBACK_VOIP) {
-                        out_set_voip_volume(&usecase->stream.out->stream,
-                                            usecase->stream.out->volume_l,
-                                            usecase->stream.out->volume_r);
-                    }
+                ALOGD("%s:becf: enabling usecase (%s) on (%s)", __func__,
+                     use_case_table[usecase->id],
+                     platform_get_snd_device_name(usecase->out_snd_device));
+                /* Update voc calibration before enabling Voice/VoIP route */
+                if (usecase->type == VOICE_CALL || usecase->type == VOIP_CALL)
+                    status = platform_switch_voice_call_device_post(adev->platform,
+                                                       usecase->out_snd_device,
+                                                       platform_get_input_snd_device(
+                                                           adev->platform, NULL,
+                                                           &uc_info->device_list,
+                                                           usecase->type));
+                enable_audio_route(adev, usecase);
+                if (usecase->stream.out && usecase->id == USECASE_AUDIO_PLAYBACK_VOIP) {
+                    out_set_voip_volume(&usecase->stream.out->stream,
+                                        usecase->stream.out->volume_l,
+                                        usecase->stream.out->volume_r);
                 }
             }
         }
@@ -1979,6 +1974,7 @@
 
     if (uc_info->type == VOICE_CALL &&
         voice_extn_is_voice_power_mode_supported() &&
+        is_supported_conc_usecase_for_power_mode_call(adev) &&
         platform_check_and_update_island_power_status(adev->platform,
                                              uc_info,
                                              snd_device)) {
@@ -2055,19 +2051,17 @@
             /* Update the in_snd_device only before enabling the audio route */
             if (switch_device[usecase->id] ) {
                 usecase->in_snd_device = snd_device;
-                if (usecase->type != VOICE_CALL) {
-                    /* Update voc calibration before enabling VoIP route */
-                    if (usecase->type == VOIP_CALL) {
-                        snd_device_t voip_snd_device;
-                        voip_snd_device = platform_get_output_snd_device(adev->platform,
-                                                                         uc_info->stream.out,
-                                                                         usecase->type);
-                        status = platform_switch_voice_call_device_post(adev->platform,
-                                                                        voip_snd_device,
-                                                                        usecase->in_snd_device);
-                    }
-                    enable_audio_route(adev, usecase);
+                    /* Update voc calibration before enabling Voice/VoIP route */
+                if (usecase->type == VOICE_CALL || usecase->type == VOIP_CALL) {
+                    snd_device_t voip_snd_device;
+                    voip_snd_device = platform_get_output_snd_device(adev->platform,
+                                                                     usecase->stream.out,
+                                                                     usecase->type);
+                    status = platform_switch_voice_call_device_post(adev->platform,
+                                                                    voip_snd_device,
+                                                                    usecase->in_snd_device);
                 }
+                enable_audio_route(adev, usecase);
             }
         }
     }
@@ -3024,12 +3018,10 @@
         enable_snd_device(adev, in_snd_device);
     }
 
-    if (usecase->type == VOICE_CALL || usecase->type == VOIP_CALL) {
+    if (usecase->type == VOICE_CALL || usecase->type == VOIP_CALL)
         status = platform_switch_voice_call_device_post(adev->platform,
                                                         out_snd_device,
                                                         in_snd_device);
-        enable_audio_route_for_voice_usecases(adev, usecase);
-    }
 
     usecase->in_snd_device = in_snd_device;
     usecase->out_snd_device = out_snd_device;
diff --git a/hal/msm8974/platform.c b/hal/msm8974/platform.c
index 064a9d7..323e51a 100755
--- a/hal/msm8974/platform.c
+++ b/hal/msm8974/platform.c
@@ -74,7 +74,6 @@
 #define PLATFORM_INFO_XML_PATH_TDM_NAME  "audio_platform_info_tdm.xml"
 #define PLATFORM_INFO_XML_PATH_SHIMA_IDP "audio_platform_info_shimaidp.xml"
 #define PLATFORM_INFO_XML_PATH_SHIMA_QRD "audio_platform_info_shimaqrd.xml"
-#define PLATFORM_INFO_XML_PATH_YUPIK_IDP "audio_platform_info_yupikidp.xml"
 #define PLATFORM_INFO_XML_PATH_YUPIK_QRD "audio_platform_info_yupikqrd.xml"
 #define PLATFORM_INFO_XML_PATH_SCUBA_IDP "audio_platform_info_scubaidp.xml"
 #define PLATFORM_INFO_XML_PATH_SCUBA_QRD "audio_platform_info_scubaqrd.xml"
@@ -3489,10 +3488,6 @@
                sizeof("lahaina-shimaqrd-snd-card"))) {
         platform_info_init(get_xml_file_path(PLATFORM_INFO_XML_PATH_SHIMA_QRD),
             my_data, PLATFORM);
-    } else if (!strncmp(snd_card_name, "lahaina-yupikidp-snd-card",
-               sizeof("lahaina-yupikidp-snd-card"))) {
-        platform_info_init(get_xml_file_path(PLATFORM_INFO_XML_PATH_YUPIK_IDP),
-            my_data, PLATFORM);
     } else if (!strncmp(snd_card_name, "lahaina-yupikqrd-snd-card",
                sizeof("lahaina-yupikqrd-snd-card"))) {
         platform_info_init(get_xml_file_path(PLATFORM_INFO_XML_PATH_YUPIK_QRD),