summaryrefslogtreecommitdiffstats
path: root/hal/platform_info.c
diff options
context:
space:
mode:
authorApoorv Raghuvanshi <apoorvr@codeaurora.org>2015-02-19 18:19:36 -0800
committerApoorv Raghuvanshi <apoorvr@codeaurora.org>2015-06-05 12:14:36 -0700
commit214921673edd45471163c0a6d436dfbbb8a0931f (patch)
tree5ace412569b1a4ee26164a53923b7c4a268eb542 /hal/platform_info.c
parentf59bb22e6d83b9ff56e88e35e6fd7329676ae2fb (diff)
downloadandroid_hardware_qcom_audio-214921673edd45471163c0a6d436dfbbb8a0931f.tar.gz
android_hardware_qcom_audio-214921673edd45471163c0a6d436dfbbb8a0931f.tar.bz2
android_hardware_qcom_audio-214921673edd45471163c0a6d436dfbbb8a0931f.zip
hal: native audio backward compatibility
- all changes for native audio backward compatibility and related - add set parameters from UI - enable dynamic device switching - featurize the code - various backend concurrency changes Change-Id: Id0f824c4b4c033f42008a4e8868652c8f6fe5c42
Diffstat (limited to 'hal/platform_info.c')
-rw-r--r--hal/platform_info.c39
1 files changed, 39 insertions, 0 deletions
diff --git a/hal/platform_info.c b/hal/platform_info.c
index b65411fc..02f4988a 100644
--- a/hal/platform_info.c
+++ b/hal/platform_info.c
@@ -44,6 +44,7 @@ typedef enum {
ROOT,
ACDB,
BITWIDTH,
+ NATIVESUPPORT,
PCM_ID,
BACKEND_NAME,
INTERFACE_NAME,
@@ -53,6 +54,7 @@ typedef void (* section_process_fn)(const XML_Char **attr);
static void process_acdb_id(const XML_Char **attr);
static void process_bit_width(const XML_Char **attr);
+static void process_native_support(const XML_Char **attr);
static void process_pcm_id(const XML_Char **attr);
static void process_backend_name(const XML_Char **attr);
static void process_interface_name(const XML_Char **attr);
@@ -62,6 +64,7 @@ static section_process_fn section_table[] = {
[ROOT] = process_root,
[ACDB] = process_acdb_id,
[BITWIDTH] = process_bit_width,
+ [NATIVESUPPORT] = process_native_support,
[PCM_ID] = process_pcm_id,
[BACKEND_NAME] = process_backend_name,
[INTERFACE_NAME] = process_interface_name,
@@ -273,7 +276,31 @@ static void process_interface_name(const XML_Char **attr)
(char *)attr[5]);
if (ret < 0) {
ALOGE("%s: Audio Interface not set!", __func__);
+ goto done;
+ }
+
+done:
+ return;
+}
+static void process_native_support(const XML_Char **attr)
+{
+ int index;
+
+ if (strcmp(attr[0], "name") != 0) {
+ ALOGE("%s: 'name' not found, no NATIVE_AUDIO_44.1 set!", __func__);
+ goto done;
+ }
+
+ if (strcmp(attr[2], "codec_support") != 0) {
+ ALOGE("%s: NATIVE_AUDIO_44.1 in platform info xml has no codec_support set!",
+ __func__);
+ goto done;
+ }
+
+ if (platform_set_native_support(atoi((char *)attr[3])) < 0) {
+ ALOGE("%s: Device %s, ACDB ID %d was not set!",
+ __func__, attr[1], atoi((char *)attr[3]));
goto done;
}
@@ -298,6 +325,8 @@ static void start_tag(void *userdata __unused, const XML_Char *tag_name,
section = BACKEND_NAME;
} else if (strcmp(tag_name, "interface_names") == 0) {
section = INTERFACE_NAME;
+ } else if (strcmp(tag_name, "native_configs") == 0) {
+ section = NATIVESUPPORT;
} else if (strcmp(tag_name, "device") == 0) {
if ((section != ACDB) && (section != BACKEND_NAME) && (section != BITWIDTH) &&
(section != INTERFACE_NAME)) {
@@ -316,6 +345,14 @@ static void start_tag(void *userdata __unused, const XML_Char *tag_name,
section_process_fn fn = section_table[PCM_ID];
fn(attr);
+ } else if (strcmp(tag_name, "feature") == 0) {
+ if (section != NATIVESUPPORT) {
+ ALOGE("usecase tag only supported with NATIVESUPPORT section");
+ return;
+ }
+
+ section_process_fn fn = section_table[NATIVESUPPORT];
+ fn(attr);
}
return;
@@ -333,6 +370,8 @@ static void end_tag(void *userdata __unused, const XML_Char *tag_name)
section = ROOT;
} else if (strcmp(tag_name, "interface_names") == 0) {
section = ROOT;
+ } else if (strcmp(tag_name, "native_configs") == 0) {
+ section = ROOT;
}
}