hal: limit AFE sample rate at 48Khz for non-44.1-support devices

After VoIP is closed, Music playback will resume. After
this behavior, DUT will crash after a period.

When VOIP entered standby, the VoIP use case is left to
mantain active state, then Music only can select VoIP
device. If VoIP device is handset, and sample rate of
playback is 44.1Khz, then AFE Sample Rate is configured
as 44.1Khz for handset. While COPP is set to 48Khz for
handset. This would cause sampling rate mismatch.

Limit AFE Sample Rate at 48Khz for non-44.1-support devices.

CRs-Fixed: 1038106
Change-Id: I07f7a12f07f6fedfd65e1d456e7c57e9ed819d3e
diff --git a/hal/msm8974/platform.c b/hal/msm8974/platform.c
index 44bcbc8..54f2a73 100644
--- a/hal/msm8974/platform.c
+++ b/hal/msm8974/platform.c
@@ -2209,6 +2209,19 @@
 
     return ret;
 }
+
+int check_44100_support_device(audio_devices_t out_device)
+{
+    int ret = true;
+
+    if (out_device & AUDIO_DEVICE_OUT_WIRED_HEADPHONE ||
+        out_device & AUDIO_DEVICE_OUT_WIRED_HEADSET ||
+        out_device & AUDIO_DEVICE_OUT_LINE)
+        ret = false;
+
+    return ret;
+}
+
 static int platform_get_backend_index(snd_device_t snd_device)
 {
     int32_t port = DEFAULT_CODEC_BACKEND;
@@ -4184,14 +4197,12 @@
     }
 
     /*
-     * hifi playback not supported on spkr devices, limit the Sample Rate
+     * hifi playback not supported on non-44.1-support devices, limit the Sample Rate
      * to 48 khz.
      */
-    if (SND_DEVICE_OUT_SPEAKER == snd_device ||
-        SND_DEVICE_OUT_SPEAKER_WSA == snd_device ||
-        SND_DEVICE_OUT_SPEAKER_VBAT == snd_device) {
+    if (check_44100_support_device(usecase->devices)) {
         sample_rate = CODEC_BACKEND_DEFAULT_SAMPLE_RATE;
-        ALOGD("%s:becf: afe: playback on speaker device Configure afe to "
+        ALOGD("%s:becf: afe: playback on non-44.1-support device Configure afe to "
             "default Sample Rate(48k)", __func__);
     }