audio: hal: update backend configuration for DTS passthrough

-For DTS passthrough usecase derive IEC61937 transmissing rate and
 channels from DTS frame parser as backend needs to be configured as
 per transmission rate and not based on stream sample rate and channels.

CRs-Fixed: 2049605
Change-Id: I9d5703d4b4d3485df629b9f169487e8be852ad7a
diff --git a/hal/msm8916/platform.c b/hal/msm8916/platform.c
index 3fd13b3..2836974 100644
--- a/hal/msm8916/platform.c
+++ b/hal/msm8916/platform.c
@@ -113,12 +113,6 @@
 #define DEFAULT_RX_BACKEND "SLIMBUS_0_RX"
 
 /*
- * Offload buffer size for compress passthrough
- */
-#define MIN_COMPRESS_PASSTHROUGH_FRAGMENT_SIZE (2 * 1024)
-#define MAX_COMPRESS_PASSTHROUGH_FRAGMENT_SIZE (8 * 1024)
-
-/*
  * This file will have a maximum of 38 bytes:
  *
  * 4 bytes: number of audio blocks
@@ -5448,7 +5442,7 @@
 {
     unsigned int bit_width;
     unsigned int sample_rate;
-    unsigned int channels, max_supported_channels = 0;
+    int channels, max_supported_channels = 0;
     struct platform_data *my_data = (struct platform_data *)adev->platform;
     edid_audio_info *edid_info = (edid_audio_info *)my_data->edid_info;
     bool passthrough_enabled = false;
@@ -5494,17 +5488,18 @@
             channels = max_supported_channels;
 
     } else {
-        /*During pass through set default bit width */
-        if (usecase->stream.out->format == AUDIO_FORMAT_DOLBY_TRUEHD)
-            channels = 8;
-        else
+        channels = audio_extn_passthru_get_channel_count(usecase->stream.out);
+        if (channels <= 0) {
+            ALOGE("%s: becf: afe: HDMI backend using defalut channel %u",
+                  __func__, DEFAULT_HDMI_OUT_CHANNELS);
             channels = DEFAULT_HDMI_OUT_CHANNELS;
+        }
 
         if ((usecase->stream.out->format == AUDIO_FORMAT_E_AC3) ||
             (usecase->stream.out->format == AUDIO_FORMAT_E_AC3_JOC) ||
             (usecase->stream.out->format == AUDIO_FORMAT_DOLBY_TRUEHD)) {
+            sample_rate = sample_rate * 4 ;
 
-            sample_rate = sample_rate * 4;
             if (sample_rate > HDMI_PASSTHROUGH_MAX_SAMPLE_RATE)
                 sample_rate = HDMI_PASSTHROUGH_MAX_SAMPLE_RATE;
         }
@@ -6421,25 +6416,6 @@
     return format;
 }
 
-uint32_t platform_get_compress_passthrough_buffer_size(
-                                          audio_offload_info_t* info)
-{
-    uint32_t fragment_size = MIN_COMPRESS_PASSTHROUGH_FRAGMENT_SIZE;
-    char value[PROPERTY_VALUE_MAX] = {0};
-
-    if (((info->format == AUDIO_FORMAT_DOLBY_TRUEHD) ||
-            (info->format == AUDIO_FORMAT_IEC61937)) &&
-            property_get("vendor.audio.truehd.buffer.size.kb", value, "") &&
-            atoi(value)) {
-        fragment_size = atoi(value) * 1024;
-        goto done;
-    }
-    if (!info->has_video)
-        fragment_size = MIN_COMPRESS_PASSTHROUGH_FRAGMENT_SIZE;
-done:
-    return fragment_size;
-}
-
 void platform_reset_edid_info(void *platform) {
 
     ALOGV("%s:", __func__);