hal: Check to ensure that backend is configured with correct sample rate

- Backend sample rates of greater than 48Khz are only supported on
platform having external codec.
- With internal codec, the supported sample rate is only 48Khz.
- Add a check to ensure that the sample rate is set to default sample
rate for devices having internal codec.

Change-Id: I0fa43bab085ee35bb51cd849788c4fac8abeb422
diff --git a/hal/msm8916/platform.c b/hal/msm8916/platform.c
index 3a8f314..5ca3c7c 100644
--- a/hal/msm8916/platform.c
+++ b/hal/msm8916/platform.c
@@ -1760,7 +1760,7 @@
 {
     if ((snd_device < SND_DEVICE_MIN) || (snd_device >= SND_DEVICE_MAX)) {
         ALOGE("%s: Invalid snd_device = %d", __func__, snd_device);
-        return DEFAULT_OUTPUT_SAMPLING_RATE;
+        return CODEC_BACKEND_DEFAULT_BIT_WIDTH;
     }
     return backend_bit_width_table[snd_device];
 }
@@ -3695,6 +3695,16 @@
             sample_rate = CODEC_BACKEND_DEFAULT_SAMPLE_RATE;
         }
     }
+
+    /*
+     * Sample rate greater than 48K is only supported by external codecs on
+     * specific devices e.g. Headphones, reset the sample rate to
+     * default value if not external codec.
+     */
+    if (!is_external_codec)
+        sample_rate = CODEC_BACKEND_DEFAULT_SAMPLE_RATE;
+
+
     ALOGI("%s Codec selected backend: %d updated bit width: %d and sample rate: %d",
                __func__, backend_idx, bit_width, sample_rate);
     // Force routing if the expected bitwdith or samplerate