audio: Add support to enable audio over bg

Add support for BG sound card. Add changes to send BG
codec cal stored in ACDB.

Bug: 73666907
Test: Compile test for 8974 platform, manual test for audio
playback/capture on BG.

Change-Id: I425224efdc2e3d43662f4d4bd521c436daa40ee9
diff --git a/hal/platform_info.c b/hal/platform_info.c
index 181460e..f5fbe3f 100644
--- a/hal/platform_info.c
+++ b/hal/platform_info.c
@@ -41,6 +41,7 @@
     INPUT_SND_DEVICE_TO_MIC_MAPPING,
     SND_DEV,
     MIC_INFO,
+    ACDB_METAINFO_KEY,
 } section_t;
 
 typedef void (* section_process_fn)(const XML_Char **attr);
@@ -56,6 +57,7 @@
 static void process_microphone_characteristic(const XML_Char **attr);
 static void process_snd_dev(const XML_Char **attr);
 static void process_mic_info(const XML_Char **attr);
+static void process_acdb_metainfo_key(const XML_Char **attr);
 
 static section_process_fn section_table[] = {
     [ROOT] = process_root,
@@ -69,6 +71,7 @@
     [MICROPHONE_CHARACTERISTIC] = process_microphone_characteristic,
     [SND_DEV] = process_snd_dev,
     [MIC_INFO] = process_mic_info,
+    [ACDB_METAINFO_KEY] = process_acdb_metainfo_key,
 };
 
 static set_parameters_fn set_parameters = &platform_set_parameters;
@@ -737,6 +740,28 @@
     return;
 }
 
+/* process acdb meta info key value */
+static void process_acdb_metainfo_key(const XML_Char **attr)
+{
+    if (strcmp(attr[0], "name") != 0) {
+        ALOGE("%s: 'name' not found", __func__);
+        goto done;
+    }
+    if (strcmp(attr[2], "value") != 0) {
+        ALOGE("%s: 'value' not found", __func__);
+        goto done;
+    }
+
+    int key = atoi((char *)attr[3]);
+    if (platform_set_acdb_metainfo_key(my_data.platform,
+                                       (char*)attr[1], key) < 0) {
+        ALOGE("%s: key %d was not set!", __func__, key);
+    }
+
+done:
+    return;
+}
+
 static void start_tag(void *userdata __unused, const XML_Char *tag_name,
                       const XML_Char **attr)
 {
@@ -764,6 +789,8 @@
             section = MICROPHONE_CHARACTERISTIC;
         } else if (strcmp(tag_name, "snd_devices") == 0) {
             section = SND_DEVICES;
+        } else if(strcmp(tag_name, "acdb_metainfo_key") == 0) {
+            section = ACDB_METAINFO_KEY;
         } else if (strcmp(tag_name, "device") == 0) {
             if ((section != ACDB) && (section != BACKEND_NAME) && (section != OPERATOR_SPECIFIC)) {
                 ALOGE("device tag only supported for acdb/backend names");
@@ -782,7 +809,7 @@
             section_process_fn fn = section_table[PCM_ID];
             fn(attr);
         } else if (strcmp(tag_name, "param") == 0) {
-            if (section != CONFIG_PARAMS) {
+            if ((section != CONFIG_PARAMS) && (section != ACDB_METAINFO_KEY)) {
                 ALOGE("param tag only supported with CONFIG_PARAMS section");
                 return;
             }
@@ -884,6 +911,8 @@
         section = SND_DEVICES;
     } else if (strcmp(tag_name, "input_snd_device_mic_mapping") == 0) {
         section = INPUT_SND_DEVICE;
+    } else if (strcmp(tag_name, "acdb_metainfo_key") == 0) {
+        section = ROOT;
     }
 }