hal: audio: add tz_names extn to support from audio platform_info xml
To add Speaker TZ names from audio_platform_info xml, add required
support.
Change-Id: Idd31ed9e7b7235245c3dda4ccb11b47762db5ee8
diff --git a/hal/platform_info.c b/hal/platform_info.c
index 02f4988..e6cc15d 100644
--- a/hal/platform_info.c
+++ b/hal/platform_info.c
@@ -48,6 +48,7 @@
PCM_ID,
BACKEND_NAME,
INTERFACE_NAME,
+ TZ_NAME,
} section_t;
typedef void (* section_process_fn)(const XML_Char **attr);
@@ -58,6 +59,7 @@
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);
+static void process_tz_name(const XML_Char **attr);
static void process_root(const XML_Char **attr);
static section_process_fn section_table[] = {
@@ -68,6 +70,7 @@
[PCM_ID] = process_pcm_id,
[BACKEND_NAME] = process_backend_name,
[INTERFACE_NAME] = process_interface_name,
+ [TZ_NAME] = process_tz_name,
};
static section_t section;
@@ -94,6 +97,11 @@
* ...
* ...
* </interface_names>
+ * <tz_names>
+ * <device name="???" spkr_1_tz_name="???" spkr_2_tz_name="???"/>
+ * ...
+ * ...
+ * </tz_names>
* </audio_platform_info>
*/
@@ -308,6 +316,42 @@
return;
}
+static void process_tz_name(const XML_Char **attr)
+{
+ int ret, index;
+
+ if (strcmp(attr[0], "name") != 0) {
+ ALOGE("%s: 'name' not found, no Audio Interface set!", __func__);
+ goto done;
+ }
+
+ index = platform_get_snd_device_index((char *)attr[1]);
+ if (index < 0) {
+ ALOGE("%s: Device %s not found, no snd device set!",
+ __func__, attr[1]);
+ goto done;
+ }
+
+ if (strcmp(attr[2], "spkr_1_tz_name") != 0) {
+ ALOGE("%s: Device %s has no spkr_1_tz_name set!",
+ __func__, attr[1]);
+ }
+
+ if (strcmp(attr[4], "spkr_2_tz_name") != 0) {
+ ALOGE("%s: Device %s has no spkr_2_tz_name set!",
+ __func__, attr[1]);
+ }
+
+ ret = platform_set_spkr_device_tz_names(index, (char *)attr[3], (char *)attr[5]);
+ if (ret < 0) {
+ ALOGE("%s: Audio Interface not set!", __func__);
+ goto done;
+ }
+
+done:
+ return;
+}
+
static void start_tag(void *userdata __unused, const XML_Char *tag_name,
const XML_Char **attr)
{
@@ -327,10 +371,12 @@
section = INTERFACE_NAME;
} else if (strcmp(tag_name, "native_configs") == 0) {
section = NATIVESUPPORT;
+ } else if (strcmp(tag_name, "tz_names") == 0) {
+ section = TZ_NAME;
} else if (strcmp(tag_name, "device") == 0) {
if ((section != ACDB) && (section != BACKEND_NAME) && (section != BITWIDTH) &&
- (section != INTERFACE_NAME)) {
- ALOGE("device tag only supported for acdb/backend names/bitwitdh/interface names");
+ (section != INTERFACE_NAME) && (section != TZ_NAME)) {
+ ALOGE("device tag only supported for acdb/backend names/bitwitdh/interface/tz names");
return;
}