hal: enable form factor based configuration
- for 8996 enable form factor based mixer path configuration
Change-Id: Ib3cc1bdb2b0427c9d98cfaa9cbae21b91dc38bd2
diff --git a/hal/platform_info.c b/hal/platform_info.c
index 4556294..7432230 100644
--- a/hal/platform_info.c
+++ b/hal/platform_info.c
@@ -25,8 +25,6 @@
#include "platform_api.h"
#include <platform.h>
-#define PLATFORM_INFO_XML_PATH "/system/etc/audio_platform_info.xml"
-
typedef enum {
ROOT,
ACDB,
@@ -344,7 +342,7 @@
}
}
-int platform_info_init(void *platform)
+int platform_info_init(const char *filename, void *platform)
{
XML_Parser parser;
FILE *file;
@@ -352,13 +350,22 @@
int bytes_read;
void *buf;
static const uint32_t kBufSize = 1024;
-
+ char platform_info_file_name[MIXER_PATH_MAX_LENGTH]= {0};
section = ROOT;
- file = fopen(PLATFORM_INFO_XML_PATH, "r");
+ if (filename == NULL) {
+ strlcpy(platform_info_file_name, PLATFORM_INFO_XML_PATH, MIXER_PATH_MAX_LENGTH);
+ } else {
+ strlcpy(platform_info_file_name, filename, MIXER_PATH_MAX_LENGTH);
+ }
+
+ ALOGV("%s: platform info file name is %s", __func__, platform_info_file_name);
+
+ file = fopen(platform_info_file_name, "r");
+
if (!file) {
ALOGD("%s: Failed to open %s, using defaults.",
- __func__, PLATFORM_INFO_XML_PATH);
+ __func__, platform_info_file_name);
ret = -ENODEV;
goto done;
}
@@ -393,7 +400,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__, platform_info_file_name);
ret = -EINVAL;
goto err_free_parser;
}