Merge "hal: reset backend sample rate if device backend is not supported"
diff --git a/hal/audio_hw.c b/hal/audio_hw.c
index c208298..cef64a7 100644
--- a/hal/audio_hw.c
+++ b/hal/audio_hw.c
@@ -1362,9 +1362,7 @@
               platform_get_snd_device_name(snd_device),
               platform_get_snd_device_name(usecase->out_snd_device),
               platform_check_backends_match(snd_device, usecase->out_snd_device));
-        if ((usecase->type != PCM_CAPTURE) &&
-            (usecase->type != VOICE_CALL) &&
-            (usecase != uc_info)) {
+        if ((usecase->type != PCM_CAPTURE) && (usecase != uc_info)) {
             uc_derive_snd_device = derive_playback_snd_device(adev->platform,
                                                usecase, uc_info, snd_device);
             if (((uc_derive_snd_device != usecase->out_snd_device) || force_routing) &&
diff --git a/hal/msm8974/platform.c b/hal/msm8974/platform.c
index 8a71b31..3337e10 100644
--- a/hal/msm8974/platform.c
+++ b/hal/msm8974/platform.c
@@ -6254,10 +6254,11 @@
             ALOGD("%s:becf: afe: napb not active - set non fractional rate",
                        __func__);
         }
-        /*ensure AFE set to 48khz when sample rate less than 44.1khz*/
-        if (sample_rate < OUTPUT_SAMPLING_RATE_44100) {
-            sample_rate = CODEC_BACKEND_DEFAULT_SAMPLE_RATE;
-            ALOGD("%s:becf: afe: napb set sample rate to default Sample Rate(48k)",__func__);
+        /*reset sample rate to 48khz if sample rate less than 44.1khz, or device backend dose not support 44.1 khz*/
+        if ((sample_rate == OUTPUT_SAMPLING_RATE_44100 && backend_idx != HEADPHONE_44_1_BACKEND)
+            || sample_rate < OUTPUT_SAMPLING_RATE_44100) {
+                sample_rate = CODEC_BACKEND_DEFAULT_SAMPLE_RATE;
+            ALOGD("%s:becf: afe: reset sample rate to default Sample Rate(48k)",__func__);
         }
     }
 
@@ -6384,13 +6385,6 @@
     /*this is populated by check_codec_backend_cfg hence set default value to false*/
     backend_cfg.passthrough_enabled = false;
 
-     /*check if the stream sample 44.1Khz rate is supported of configured device sample rate. If not
-       open afe at default sample rate.
-      */
-    if (backend_idx != HEADPHONE_44_1_BACKEND &&
-        usecase->stream.out->sample_rate == OUTPUT_SAMPLING_RATE_44100)
-        backend_cfg.sample_rate = DEFAULT_OUTPUT_SAMPLING_RATE;
-
     /* Set Backend sampling rate to 176.4 for DSD64 and
      * 352.8Khz for DSD128.
      * Set Bit Width to 16
@@ -6419,9 +6413,7 @@
     for (i = 0; i < num_devices; i++) {
         ALOGI("%s: new_snd_devices[%d] is %d", __func__, i, new_snd_devices[i]);
         if ((platform_check_codec_backend_cfg(adev, usecase, new_snd_devices[i],
-                                             &backend_cfg)) ||
-            ((usecase->out_snd_device != SND_DEVICE_NONE) &&
-             !platform_check_backends_match(usecase->out_snd_device, snd_device))) {
+                                             &backend_cfg))) {
             ret = platform_set_codec_backend_cfg(adev, new_snd_devices[i],
                                            backend_cfg);
             if (!ret) {