Merge "hal: configs: Modify deprecated perf lock values"
diff --git a/hal/audio_extn/pm.c b/hal/audio_extn/pm.c
index 7b76f60..c52508e 100644
--- a/hal/audio_extn/pm.c
+++ b/hal/audio_extn/pm.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2014, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2014, 2017 The Linux Foundation. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are
@@ -33,15 +33,15 @@
 #include "pm.h"
 #include <cutils/log.h>
 
+/* Device state*/
+#define AUDIO_PARAMETER_KEY_DEV_SHUTDOWN "dev_shutdown"
+
 static s_audio_subsys audio_ss;
 
 int audio_extn_pm_vote(void)
 {
-    int err, intfd, ret;
-    FILE *fd;
+    int ret;
     enum pm_event subsys_state;
-    char halPropVal[PROPERTY_VALUE_MAX];
-    bool prop_unload_image = false;
     bool pm_reg = false;
     bool pm_supp = false;
 
@@ -71,26 +71,6 @@
        pm_reg == true) {
        ALOGD("%s: Voting for subsystem power up", __func__);
        pm_client_connect(audio_ss.pm_handle);
-
-       if (property_get("sys.audio.init", halPropVal, NULL)) {
-           prop_unload_image = !(strncmp("false", halPropVal, sizeof("false")));
-       }
-       /*
-        * adsp-loader loads modem/adsp image at boot up to play boot tone,
-        * before peripheral manager service is up. Once PM is up, vote to PM
-        * and unload the image to give control to PM to load/unload image
-        */
-       if (prop_unload_image) {
-           intfd = open(BOOT_IMG_SYSFS_PATH, O_WRONLY);
-           if (intfd == -1) {
-               ALOGE("failed to open fd in write mode, %d", errno);
-           } else {
-               ALOGD("%s: write to sysfs to unload image", __func__);
-               err = write(intfd, UNLOAD_IMAGE, 1);
-               close(intfd);
-               property_set("sys.audio.init", "true");
-          }
-       }
     }
     return 0;
 }
@@ -120,6 +100,11 @@
 
 void audio_extn_pm_event_notifier(void *client_data, enum pm_event event)
 {
+
+    int err, intfd;
+    char halPropVal[PROPERTY_VALUE_MAX];
+    bool prop_unload_image = false;
+
     pm_client_event_acknowledge(audio_ss.pm_handle, event);
 
     /* Closing and re-opening of session is done based on snd card status given
@@ -140,6 +125,26 @@
 
     case EVENT_PERIPH_IS_ONLINE:
         ALOGV("%s: %s is online", __func__, audio_ss.img_name);
+
+        if (property_get("sys.audio.init", halPropVal, NULL)) {
+           prop_unload_image = !(strncmp("false", halPropVal, sizeof("false")));
+        }
+        /*
+         * adsp-loader loads modem/adsp image at boot up to play boot tone,
+         * before peripheral manager service is up. Once PM is up, vote to PM
+         * and unload the image to give control to PM to load/unload image
+         */
+        if (prop_unload_image) {
+           intfd = open(BOOT_IMG_SYSFS_PATH, O_WRONLY);
+           if (intfd == -1) {
+               ALOGE("failed to open fd in write mode, %d", errno);
+           } else {
+               ALOGD("%s: write to sysfs to unload image", __func__);
+               err = write(intfd, UNLOAD_IMAGE, 1);
+               close(intfd);
+               property_set("sys.audio.init", "true");
+          }
+        }
     break;
 
     default:
diff --git a/hal/audio_hw.c b/hal/audio_hw.c
index 35f7fe6..167bdc7 100644
--- a/hal/audio_hw.c
+++ b/hal/audio_hw.c
@@ -2326,6 +2326,8 @@
                 goto error_open;
             }
         }
+        platform_set_stream_channel_map(adev->platform, out->channel_mask,
+                                    out->pcm_device_id);
     } else {
         platform_set_stream_channel_map(adev->platform, out->channel_mask,
                                     out->pcm_device_id);
diff --git a/hal/msm8916/hw_info.c b/hal/msm8916/hw_info.c
index b2290b7..5060c77 100644
--- a/hal/msm8916/hw_info.c
+++ b/hal/msm8916/hw_info.c
@@ -103,6 +103,9 @@
     } else if (!strcmp(snd_card_name, "msm8909-skue-snd-card")) {
         strlcpy(hw_info->type, "skue", sizeof(hw_info->type));
         strlcpy(hw_info->name, "msm8909", sizeof(hw_info->name));
+    } else if (!strcmp(snd_card_name, "msm8909-skut-snd-card")) {
+        strlcpy(hw_info->type, "skut", sizeof(hw_info->type));
+        strlcpy(hw_info->name, "msm8909", sizeof(hw_info->name));
     } else if (!strcmp(snd_card_name, "msm8939-snd-card-skul")) {
         strlcpy(hw_info->type, "skul", sizeof(hw_info->type));
         strlcpy(hw_info->name, "msm8939", sizeof(hw_info->name));
@@ -167,6 +170,9 @@
         strlcpy(hw_info->name, "apq8009", sizeof(hw_info->name));
     } else if (!strcmp(snd_card_name, "mdm9607-tomtom-i2s-snd-card")) {
         strlcpy(hw_info->name, "mdm9607", sizeof(hw_info->name));
+    } else if (!strcmp(snd_card_name, "msm8909-skuq-snd-card")) {
+        strlcpy(hw_info->type, "skuq", sizeof(hw_info->type));
+        strlcpy(hw_info->name, "msm8909", sizeof(hw_info->name));
     } else {
         ALOGW("%s: Not an 8x16/8909/8917/8920/8937/8939/8940/8952/8953/660 device", __func__);
     }
diff --git a/hal/msm8916/platform.c b/hal/msm8916/platform.c
index 73689eb..098d90c 100644
--- a/hal/msm8916/platform.c
+++ b/hal/msm8916/platform.c
@@ -52,6 +52,7 @@
 #define MIXER_XML_PATH_SKUL "/system/etc/mixer_paths_skul.xml"
 #define MIXER_XML_PATH_SKUS "/system/etc/mixer_paths_skus.xml"
 #define MIXER_XML_PATH_SKUSH "/system/etc/mixer_paths_skush.xml"
+#define MIXER_XML_PATH_QRD_SKUT "/system/etc/mixer_paths_qrd_skut.xml"
 #define MIXER_XML_PATH_SKUM "/system/etc/mixer_paths_qrd_skum.xml"
 #define MIXER_XML_PATH_SKU1 "/system/etc/mixer_paths_qrd_sku1.xml"
 #define MIXER_XML_PATH_SKUN_CAJON "/system/etc/mixer_paths_qrd_skun_cajon.xml"
@@ -1081,7 +1082,21 @@
         msm_device_to_be_id = msm_device_to_be_id_internal_codec;
         msm_be_id_array_len  =
             sizeof(msm_device_to_be_id_internal_codec) / sizeof(msm_device_to_be_id_internal_codec[0]);
+    } else if (!strncmp(snd_card_name, "msm8909-skut-snd-card",
+                 sizeof("msm8909-skut-snd-card"))) {
+        strlcpy(mixer_xml_path, MIXER_XML_PATH_QRD_SKUT,
+                sizeof(MIXER_XML_PATH_QRD_SKUT));
+        msm_device_to_be_id = msm_device_to_be_id_internal_codec;
+        msm_be_id_array_len  =
+            sizeof(msm_device_to_be_id_internal_codec) / sizeof(msm_device_to_be_id_internal_codec[0]);
 
+    }  else if (!strncmp(snd_card_name, "msm8909-skuq-snd-card",
+                 sizeof("msm8909-skuq-snd-card"))) {
+        strlcpy(mixer_xml_path, MIXER_XML_PATH_QRD_SKUT,
+                sizeof(MIXER_XML_PATH_QRD_SKUT));
+        msm_device_to_be_id = msm_device_to_be_id_internal_codec;
+        msm_be_id_array_len  =
+            sizeof(msm_device_to_be_id_internal_codec) / sizeof(msm_device_to_be_id_internal_codec[0]);
     } else if (!strncmp(snd_card_name, "msm8909-pm8916-snd-card",
                  sizeof("msm8909-pm8916-snd-card"))) {
         strlcpy(mixer_xml_path, MIXER_XML_PATH_MSM8909_PM8916,