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/msm8974/platform.c b/hal/msm8974/platform.c
index 36a1d3a..d423919 100644
--- a/hal/msm8974/platform.c
+++ b/hal/msm8974/platform.c
@@ -87,12 +87,6 @@
 
 
 /*
- * 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
@@ -5323,7 +5317,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;
@@ -5369,12 +5363,12 @@
             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)) {
@@ -6248,25 +6242,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_check_and_update_copp_sample_rate(void* platform, snd_device_t snd_device,
                                                 unsigned int stream_sr, int* sample_rate)
 {