Merge "  hal: Fix device disable/enable sequence"
diff --git a/hal/audio_hw.c b/hal/audio_hw.c
index c41759c..f7d88ae 100644
--- a/hal/audio_hw.c
+++ b/hal/audio_hw.c
@@ -300,10 +300,12 @@
      * control in use-case does not work because rate update takes place after
      * AFE port open due to the limitation of mixer control order execution.
      */
-    if (snd_device == SND_DEVICE_OUT_BT_SCO) {
+    if ((snd_device == SND_DEVICE_OUT_BT_SCO) ||
+        (snd_device == SND_DEVICE_IN_BT_SCO_MIC)) {
         audio_route_apply_path(adev->audio_route, BT_SCO_SAMPLE_RATE);
         audio_route_update_mixer(adev->audio_route);
-    } else if (snd_device == SND_DEVICE_OUT_BT_SCO_WB) {
+    } else if ((snd_device == SND_DEVICE_OUT_BT_SCO_WB) ||
+               (snd_device == SND_DEVICE_IN_BT_SCO_MIC_WB)) {
         audio_route_apply_path(adev->audio_route, BT_SCO_WB_SAMPLE_RATE);
         audio_route_update_mixer(adev->audio_route);
     }
diff --git a/hal/msm8974/platform.c b/hal/msm8974/platform.c
index a303a30..5315e78 100644
--- a/hal/msm8974/platform.c
+++ b/hal/msm8974/platform.c
@@ -1433,6 +1433,7 @@
             }
         } else if (out_device & AUDIO_DEVICE_OUT_WIRED_HEADSET) {
             snd_device = SND_DEVICE_IN_VOICE_HEADSET_MIC;
+            set_echo_reference(adev->mixer, EC_REF_RX);
         } else if (out_device & AUDIO_DEVICE_OUT_ALL_SCO) {
             if (my_data->btsco_sample_rate == SAMPLE_RATE_16KHZ)
                 snd_device = SND_DEVICE_IN_BT_SCO_MIC_WB;
@@ -1454,6 +1455,7 @@
                 }
             } else {
                 snd_device = SND_DEVICE_IN_VOICE_SPEAKER_MIC;
+                set_echo_reference(adev->mixer, EC_REF_RX);
             }
         }
     } else if (source == AUDIO_SOURCE_CAMCORDER) {
diff --git a/hal/msm8974/platform.h b/hal/msm8974/platform.h
index 1f25aa2..3bd218c 100644
--- a/hal/msm8974/platform.h
+++ b/hal/msm8974/platform.h
@@ -221,7 +221,7 @@
 #define VOICE_CALL_PCM_DEVICE 20
 #define VOICE2_CALL_PCM_DEVICE 25
 #define VOLTE_CALL_PCM_DEVICE 21
-#define QCHAT_CALL_PCM_DEVICE 06
+#define QCHAT_CALL_PCM_DEVICE 33
 #define VOWLAN_CALL_PCM_DEVICE -1
 #elif PLATFORM_MSM8610
 #define VOICE_CALL_PCM_DEVICE 2