hal: Enable parsing of interface tag independent of backend_tag

- Current platform_info file parsing assumes backend tag to be present
always with hw_interface tag.
-With multiCopp changes as we have to have hw_interface entry for
all supported device, it should not be mandatory to have backend_tag.
-Decouple hw_interface from backend_tag.

Change-Id: I1c1163273d92305deac787ccecdcceb1f6943532
diff --git a/hal/msm8916/platform.c b/hal/msm8916/platform.c
index fad2c04..0870bde 100644
--- a/hal/msm8916/platform.c
+++ b/hal/msm8916/platform.c
@@ -5323,10 +5323,13 @@
           platform_get_snd_device_name(device),
           backend_tag_table[device] != NULL ? backend_tag_table[device]: "null",
           backend_tag);
-    if (backend_tag_table[device]) {
-        free(backend_tag_table[device]);
+
+    if (backend_tag != NULL ) {
+        if (backend_tag_table[device]) {
+           free(backend_tag_table[device]);
+        }
+        backend_tag_table[device] = strdup(backend_tag);
     }
-    backend_tag_table[device] = strdup(backend_tag);
 
     if (hw_interface != NULL) {
         if (hw_interface_table[device])
diff --git a/hal/msm8974/platform.c b/hal/msm8974/platform.c
index 1028e2d..06fb1fb 100755
--- a/hal/msm8974/platform.c
+++ b/hal/msm8974/platform.c
@@ -5200,10 +5200,13 @@
           platform_get_snd_device_name(device),
           backend_tag_table[device] != NULL ? backend_tag_table[device]: "null",
           backend_tag);
-    if (backend_tag_table[device]) {
-        free(backend_tag_table[device]);
+
+    if (backend_tag != NULL ) {
+        if (backend_tag_table[device]) {
+           free(backend_tag_table[device]);
+        }
+        backend_tag_table[device] = strdup(backend_tag);
     }
-    backend_tag_table[device] = strdup(backend_tag);
 
     if (hw_interface != NULL) {
         if (hw_interface_table[device])
diff --git a/hal/platform_info.c b/hal/platform_info.c
index a63b215..6b64261 100644
--- a/hal/platform_info.c
+++ b/hal/platform_info.c
@@ -176,6 +176,7 @@
 {
     int index;
     char *hw_interface = NULL;
+    char *backend = NULL;
 
     if (strcmp(attr[0], "name") != 0) {
         ALOGE("%s: 'name' not found, no ACDB ID set!", __func__);
@@ -190,9 +191,10 @@
     }
 
     if (strcmp(attr[2], "backend") != 0) {
-        ALOGE("%s: Device %s has no backend set!",
-              __func__, attr[1]);
-        goto done;
+        if (strcmp(attr[2], "interface") == 0)
+            hw_interface = (char *)attr[3];
+    } else {
+        backend = (char *)attr[3];
     }
 
     if (attr[4] != NULL) {
@@ -203,7 +205,7 @@
         }
     }
 
-    if (platform_set_snd_device_backend(index, attr[3], hw_interface) < 0) {
+    if (platform_set_snd_device_backend(index, backend, hw_interface) < 0) {
         ALOGE("%s: Device %s backend %s was not set!",
               __func__, attr[1], attr[3]);
         goto done;