hal: add support for I2S based external modem
There are specific xml files used for I2S based external modem.
Add check to load the correct xml file.
For I2S based external modem, voice sample rate can be 8k or
16k based on vocoder type. Call csd client api to get the
correct sample rate to configure voice call.
Change-Id: Ie9799336620f49a890355be74fe1830eb348cabe
diff --git a/hal/platform_info.c b/hal/platform_info.c
index 8f56107..85a05eb 100644
--- a/hal/platform_info.c
+++ b/hal/platform_info.c
@@ -38,7 +38,6 @@
#include "platform_api.h"
#include <platform.h>
-#define PLATFORM_INFO_XML_PATH "/system/etc/audio_platform_info.xml"
#define BUF_SIZE 1024
static void process_device(const XML_Char **attr)
@@ -52,20 +51,20 @@
index = platform_get_snd_device_index((char *)attr[1]);
if (index < 0) {
- ALOGE("%s: Device %s in %s not found, no ACDB ID set!",
- __func__, attr[1], PLATFORM_INFO_XML_PATH);
+ ALOGE("%s: Device %s in platform info xml not found, no ACDB ID set!",
+ __func__, attr[1]);
goto done;
}
if (strcmp(attr[2], "acdb_id") != 0) {
- ALOGE("%s: Device %s in %s has no acdb_id, no ACDB ID set!",
- __func__, attr[1], PLATFORM_INFO_XML_PATH);
+ ALOGE("%s: Device %s in platform info xml has no acdb_id, no ACDB ID set!",
+ __func__, attr[1]);
goto done;
}
if(platform_set_snd_device_acdb_id(index, atoi((char *)attr[3])) < 0) {
- ALOGE("%s: Device %s in %s, ACDB ID %d was not set!",
- __func__, attr[1], PLATFORM_INFO_XML_PATH, atoi((char *)attr[3]));
+ ALOGE("%s: Device %s in platform info xml ACDB ID %d was not set!",
+ __func__, attr[1], atoi((char *)attr[3]));
goto done;
}
@@ -91,7 +90,7 @@
}
-int platform_info_init(void)
+int platform_info_init(const char *filename)
{
XML_Parser parser;
FILE *file;
@@ -99,10 +98,10 @@
int bytes_read;
void *buf;
- file = fopen(PLATFORM_INFO_XML_PATH, "r");
+ file = fopen(filename, "r");
if (!file) {
ALOGD("%s: Failed to open %s, using defaults.",
- __func__, PLATFORM_INFO_XML_PATH);
+ __func__, filename);
ret = -ENODEV;
goto done;
}
@@ -134,7 +133,7 @@
if (XML_ParseBuffer(parser, bytes_read,
bytes_read == 0) == XML_STATUS_ERROR) {
ALOGE("%s: XML_ParseBuffer failed, for %s",
- __func__, PLATFORM_INFO_XML_PATH);
+ __func__, filename);
ret = -EINVAL;
goto err_free_parser;
}