hal: edid: Update EDID parsing logic

Previously, the only sample rate that hal stored was the highest
supported sample rate. Hal would return false on Sample Rates(sr)
that were lower than the highest supported sr from the sink.

Streams were forced to be played at the highest sr that the
sink supported. A similar change was done in for bytes per
sample as well.

Change-Id: I41591958739562334d9409cffad4f55e1cc5e0bc
CRs-Fixed: 1084185
diff --git a/hal/msm8974/platform.c b/hal/msm8974/platform.c
index d209359..0489fc9 100644
--- a/hal/msm8974/platform.c
+++ b/hal/msm8974/platform.c
@@ -4562,8 +4562,12 @@
 
         //Check EDID info for supported samplerate
         if (!edid_is_supported_sr(edid_info,sample_rate)) {
-            //reset to current sample rate
-            sample_rate = my_data->current_backend_cfg[backend_idx].sample_rate;
+            //check to see if current BE sample rate is supported by EDID
+            //else assign the highest sample rate supported by EDID
+            if (edid_is_supported_sr(edid_info,my_data->current_backend_cfg[backend_idx].sample_rate))
+                sample_rate = my_data->current_backend_cfg[backend_idx].sample_rate;
+            else
+                sample_rate = edid_get_highest_supported_sr(edid_info);
         }
 
         //Check EDID info for supported bit width
@@ -5347,24 +5351,13 @@
 {
     struct platform_data *my_data = (struct platform_data *)platform;
     edid_audio_info *info = NULL;
-    int i, ret;
+    int ret = 0;
 
     ret = platform_get_edid_info(platform);
     info = (edid_audio_info *)my_data->edid_info;
     if (ret == 0 && info != NULL) {
-        for (i = 0; i < info->audio_blocks && i < MAX_EDID_BLOCKS; i++) {
-             /*
-              * To check
-              *  is there any special for CONFIG_HDMI_PASSTHROUGH_CONVERT
-              *  & DOLBY_DIGITAL_PLUS
-              */
-            if (info->audio_blocks_array[i].sampling_freq == sample_rate) {
-                ALOGV("%s: returns true %d", __func__, sample_rate);
-                return true;
-            }
-        }
+        return edid_is_supported_sr(info, sample_rate);
     }
-    ALOGV("%s: returns false %d", __func__, sample_rate);
 
     return false;
 }