Revert "hal: enable form factor based configuration"
Build fix.
This reverts commit 62dd1dcd291e52fb47255ca2b912ada6f6dfa73a.
Change-Id: I629314021b51d6baa0145b32241ff0be97713bd4
diff --git a/hal/Android.mk b/hal/Android.mk
index ba59efc..d55e37a 100644
--- a/hal/Android.mk
+++ b/hal/Android.mk
@@ -13,35 +13,34 @@
ifneq ($(filter msm8974 msm8226 msm8084 msm8992 msm8994 msm8996,$(TARGET_BOARD_PLATFORM)),)
# B-family platform uses msm8974 code base
AUDIO_PLATFORM = msm8974
- LOCAL_CFLAGS := -DPLATFORM_BFAMILY
ifneq ($(filter msm8974,$(TARGET_BOARD_PLATFORM)),)
- LOCAL_CFLAGS += -DPLATFORM_MSM8974
+ LOCAL_CFLAGS := -DPLATFORM_MSM8974
LOCAL_CFLAGS += -DMAX_TARGET_SPECIFIC_CHANNEL_CNT="2"
endif
ifneq ($(filter msm8226,$(TARGET_BOARD_PLATFORM)),)
- LOCAL_CFLAGS += -DPLATFORM_MSM8x26
+ LOCAL_CFLAGS := -DPLATFORM_MSM8x26
LOCAL_CFLAGS += -DMAX_TARGET_SPECIFIC_CHANNEL_CNT="2"
endif
ifneq ($(filter msm8084,$(TARGET_BOARD_PLATFORM)),)
- LOCAL_CFLAGS += -DPLATFORM_MSM8084
+ LOCAL_CFLAGS := -DPLATFORM_MSM8084
LOCAL_CFLAGS += -DMAX_TARGET_SPECIFIC_CHANNEL_CNT="2"
endif
ifneq ($(filter msm8992,$(TARGET_BOARD_PLATFORM)),)
- LOCAL_CFLAGS += -DPLATFORM_MSM8994
+ LOCAL_CFLAGS := -DPLATFORM_MSM8994
LOCAL_CFLAGS += -DMAX_TARGET_SPECIFIC_CHANNEL_CNT="4"
LOCAL_CFLAGS += -DKPI_OPTIMIZE_ENABLED
endif
ifneq ($(filter msm8994,$(TARGET_BOARD_PLATFORM)),)
- LOCAL_CFLAGS += -DPLATFORM_MSM8994
+ LOCAL_CFLAGS := -DPLATFORM_MSM8994
LOCAL_CFLAGS += -DMAX_TARGET_SPECIFIC_CHANNEL_CNT="4"
LOCAL_CFLAGS += -DKPI_OPTIMIZE_ENABLED
endif
ifneq ($(filter msm8996,$(TARGET_BOARD_PLATFORM)),)
- LOCAL_CFLAGS += -DPLATFORM_MSM8996
+ LOCAL_CFLAGS := -DPLATFORM_MSM8996
LOCAL_CFLAGS += -DMAX_TARGET_SPECIFIC_CHANNEL_CNT="4"
LOCAL_CFLAGS += -DKPI_OPTIMIZE_ENABLED
- MULTIPLE_HW_VARIANTS_ENABLED := true
endif
+
endif
LOCAL_SRC_FILES := \
@@ -50,12 +49,7 @@
platform_info.c \
audio_extn/ext_speaker.c \
audio_extn/audio_extn.c \
- $(AUDIO_PLATFORM)/platform.c \
-
-ifdef MULTIPLE_HW_VARIANTS_ENABLED
- LOCAL_CFLAGS += -DHW_VARIANTS_ENABLED
- LOCAL_SRC_FILES += $(AUDIO_PLATFORM)/hw_info.c \
-endif
+ $(AUDIO_PLATFORM)/platform.c
LOCAL_SHARED_LIBRARIES := \
liblog \
diff --git a/hal/audio_extn/audio_extn.h b/hal/audio_extn/audio_extn.h
index 961b1c5..c518faa 100644
--- a/hal/audio_extn/audio_extn.h
+++ b/hal/audio_extn/audio_extn.h
@@ -19,14 +19,6 @@
#include <cutils/str_parms.h>
-#define HW_INFO_ARRAY_MAX_SIZE 32
-
-struct snd_card_split {
- char device[HW_INFO_ARRAY_MAX_SIZE];
- char snd_card[HW_INFO_ARRAY_MAX_SIZE];
- char form_factor[HW_INFO_ARRAY_MAX_SIZE];
-};
-
void *audio_extn_extspk_init(struct audio_device *adev);
void audio_extn_extspk_deinit(void *extn);
void audio_extn_extspk_update(void* extn);
@@ -118,24 +110,4 @@
void audio_extn_perf_lock_acquire(void);
void audio_extn_perf_lock_release(void);
#endif /* KPI_OPTIMIZE_ENABLED */
-
-#ifndef HW_VARIANTS_ENABLED
-#define hw_info_init(snd_card_name) (0)
-#define hw_info_deinit(hw_info) (0)
-#define hw_info_append_hw_type(hw_info,\
- snd_device, device_name) (0)
-#else
-void *hw_info_init(const char *snd_card_name);
-void hw_info_deinit(void *hw_info);
-void hw_info_append_hw_type(void *hw_info, snd_device_t snd_device,
- char *device_name);
-#endif
-
-#ifndef PLATFORM_BFAMILY
-#define get_snd_card_split() (0)
-#define set_snd_card_split(snd_card_name) (0)
-#else
-struct snd_card_split *get_snd_card_split();
-void set_snd_card_split(const char* snd_card_name);
-#endif
#endif /* AUDIO_EXTN_H */
diff --git a/hal/audio_hw.c b/hal/audio_hw.c
index 297ddd4..a4ea34c 100644
--- a/hal/audio_hw.c
+++ b/hal/audio_hw.c
@@ -307,19 +307,20 @@
{
int i, num_devices = 0;
snd_device_t new_snd_devices[2];
- int ret_val = -EINVAL;
+
if (snd_device < SND_DEVICE_MIN ||
snd_device >= SND_DEVICE_MAX) {
ALOGE("%s: Invalid sound device %d", __func__, snd_device);
- goto on_error;
+ return -EINVAL;
}
platform_send_audio_calibration(adev->platform, snd_device);
- if (adev->snd_dev_ref_cnt[snd_device] >= 1) {
+ adev->snd_dev_ref_cnt[snd_device]++;
+ if (adev->snd_dev_ref_cnt[snd_device] > 1) {
ALOGV("%s: snd_device(%d: %s) is already active",
__func__, snd_device, platform_get_snd_device_name(snd_device));
- goto on_success;
+ return 0;
}
/* due to the possibility of calibration overwrite between listen
@@ -336,11 +337,12 @@
snd_device == SND_DEVICE_OUT_VOICE_SPEAKER) &&
audio_extn_spkr_prot_is_enabled()) {
if (audio_extn_spkr_prot_get_acdb_id(snd_device) < 0) {
- goto on_error;
+ adev->snd_dev_ref_cnt[snd_device]--;
+ return -EINVAL;
}
if (audio_extn_spkr_prot_start_processing(snd_device)) {
ALOGE("%s: spkr_start_processing failed", __func__);
- goto on_error;
+ return -EINVAL;
}
} else if (platform_can_split_snd_device(snd_device, &num_devices, new_snd_devices)) {
for (i = 0; i < num_devices; i++) {
@@ -348,20 +350,12 @@
}
platform_set_speaker_gain_in_combo(adev, snd_device, true);
} else {
- char device_name[DEVICE_NAME_MAX_SIZE] = {0};
- if (platform_get_snd_device_name_extn(adev->platform, snd_device, device_name) < 0 ) {
- ALOGE(" %s: Invalid sound device returned", __func__);
- goto on_error;
- }
-
- ALOGV("%s: snd_device(%d: %s)", __func__, snd_device, device_name);
- audio_route_apply_and_update_path(adev->audio_route, device_name);
+ const char * dev_path = platform_get_snd_device_name(snd_device);
+ ALOGV("%s: snd_device(%d: %s)", __func__, snd_device, dev_path);
+ audio_route_apply_and_update_path(adev->audio_route, dev_path);
}
-on_success:
- adev->snd_dev_ref_cnt[snd_device]++;
- ret_val = 0;
-on_error:
- return ret_val;
+
+ return 0;
}
int disable_snd_device(struct audio_device *adev,
@@ -395,14 +389,7 @@
}
platform_set_speaker_gain_in_combo(adev, snd_device, false);
} else {
- char device_name[DEVICE_NAME_MAX_SIZE] = {0};
- if (platform_get_snd_device_name_extn(adev->platform, snd_device, device_name) < 0 ) {
- ALOGE(" %s: Invalid sound device returned", __func__);
- return -EINVAL;
- }
-
- ALOGD("%s: snd_device(%d: %s)", __func__, snd_device, device_name);
- audio_route_reset_and_update_path(adev->audio_route, device_name);
+ audio_route_reset_and_update_path(adev->audio_route, dev_path);
}
audio_extn_sound_trigger_update_device_status(snd_device,
ST_EVENT_SND_DEVICE_FREE);
diff --git a/hal/audio_hw.h b/hal/audio_hw.h
index 7955894..0fc26ff 100644
--- a/hal/audio_hw.h
+++ b/hal/audio_hw.h
@@ -45,6 +45,8 @@
#define MAX_SUPPORTED_CHANNEL_MASKS 2
#define DEFAULT_HDMI_OUT_CHANNELS 2
+typedef int snd_device_t;
+
/* These are the supported use cases by the hardware.
* Each usecase is mapped to a specific PCM device.
* Refer to pcm_device_table[].
diff --git a/hal/msm8960/platform.c b/hal/msm8960/platform.c
index b2d4e04..0ffe8a9 100644
--- a/hal/msm8960/platform.c
+++ b/hal/msm8960/platform.c
@@ -1087,12 +1087,3 @@
{
return true;
}
-
-int platform_get_snd_device_name_extn(void *platform __unused,
- snd_device_t snd_device,
- char *device_name)
-{
- device_name = platform_get_snd_device_name(snd_device);
- return 0;
-}
-
diff --git a/hal/msm8974/hw_info.c b/hal/msm8974/hw_info.c
deleted file mode 100644
index 52ae974..0000000
--- a/hal/msm8974/hw_info.c
+++ /dev/null
@@ -1,206 +0,0 @@
-/*
- * Copyright (C) 2016 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#define LOG_TAG "hardware_info"
-/*#define LOG_NDEBUG 0*/
-#define LOG_NDDEBUG 0
-
-#include <stdlib.h>
-#include <cutils/log.h>
-#include "audio_hw.h"
-#include "platform.h"
-#include "audio_extn.h"
-
-struct hardware_info {
- char name[HW_INFO_ARRAY_MAX_SIZE];
- char type[HW_INFO_ARRAY_MAX_SIZE];
- /* variables for handling target variants */
- uint32_t num_snd_devices;
- char dev_extn[HW_INFO_ARRAY_MAX_SIZE];
- snd_device_t *snd_devices;
-};
-
-#define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0]))
-
-
-static const snd_device_t tasha_db_variant_devices[] = {
- SND_DEVICE_OUT_SPEAKER
-};
-
-static const snd_device_t tasha_fluid_variant_devices[] = {
- SND_DEVICE_OUT_SPEAKER,
- SND_DEVICE_OUT_SPEAKER_AND_HEADPHONES,
- SND_DEVICE_OUT_VOICE_SPEAKER,
- SND_DEVICE_OUT_SPEAKER_AND_HDMI,
- SND_DEVICE_OUT_SPEAKER_PROTECTED,
- SND_DEVICE_OUT_VOICE_SPEAKER_PROTECTED,
-};
-
-static const snd_device_t tasha_liquid_variant_devices[] = {
- SND_DEVICE_OUT_SPEAKER,
- SND_DEVICE_OUT_SPEAKER_AND_HEADPHONES,
- SND_DEVICE_IN_SPEAKER_MIC,
- SND_DEVICE_IN_HEADSET_MIC,
- SND_DEVICE_IN_VOICE_DMIC,
- SND_DEVICE_IN_VOICE_SPEAKER_DMIC,
- SND_DEVICE_IN_VOICE_REC_DMIC_STEREO,
- SND_DEVICE_IN_VOICE_REC_DMIC_FLUENCE,
- SND_DEVICE_IN_QUAD_MIC,
-};
-
-struct snd_card_split cur_snd_card_split = {
- .device = {0},
- .snd_card = {0},
- .form_factor = {0},
-};
-
-static void update_hardware_info_8996(struct hardware_info *hw_info)
-{
- struct snd_card_split *tmp_handle = get_snd_card_split();
- ALOGV("%s: device %s snd_card %s form_factor %s",
- __func__, tmp_handle->device, tmp_handle->snd_card, tmp_handle->form_factor);
-
- strlcpy(hw_info->name, tmp_handle->device, sizeof(hw_info->name));
- snprintf(hw_info->type, sizeof(hw_info->type), " %s", tmp_handle->form_factor);
- snprintf(hw_info->dev_extn, sizeof(hw_info->dev_extn), "-%s", tmp_handle->form_factor);
-
- if (!strncmp(tmp_handle->form_factor, "fluid", sizeof("fluid"))) {
- hw_info->snd_devices = (snd_device_t *)tasha_fluid_variant_devices;
- hw_info->num_snd_devices = ARRAY_SIZE(tasha_fluid_variant_devices);
- } else if (!strncmp(tmp_handle->form_factor, "liquid", sizeof("liquid"))) {
- hw_info->snd_devices = (snd_device_t *)tasha_liquid_variant_devices;
- hw_info->num_snd_devices = ARRAY_SIZE(tasha_liquid_variant_devices);
- } else if (!strncmp(tmp_handle->form_factor, "db", sizeof("db"))) {
- hw_info->snd_devices = (snd_device_t *)tasha_db_variant_devices;
- hw_info->num_snd_devices = ARRAY_SIZE(tasha_db_variant_devices);
- } else {
- ALOGW("%s: %s form factor doesnt need mixer path over ride", __func__, tmp_handle->form_factor);
- }
-
- ALOGV("name %s type %s dev_extn %s", hw_info->name, hw_info->type, hw_info->dev_extn);
-}
-
-
-void *hw_info_init(const char *snd_card_name)
-{
- struct hardware_info *hw_info = NULL;
- bool hw_supported = false;
-
- if (strstr(snd_card_name, "msm8996")) {
- ALOGD("8996 - variant soundcard");
- hw_supported = true;
- } else {
- ALOGE("%s: Unsupported target %s:",__func__, snd_card_name);
- }
-
- if (hw_supported) {
- hw_info = malloc(sizeof(struct hardware_info));
- if (!hw_info) {
- ALOGE("failed to allocate mem for hardware info");
- goto on_finish;
- }
-
- hw_info->snd_devices = NULL;
- hw_info->num_snd_devices = 0;
- strlcpy(hw_info->dev_extn, "", sizeof(hw_info->dev_extn));
- strlcpy(hw_info->type, "", sizeof(hw_info->type));
- strlcpy(hw_info->name, "", sizeof(hw_info->name));
- update_hardware_info_8996(hw_info);
- }
-
-on_finish:
- return hw_info;
-}
-
-void hw_info_deinit(void *hw_info)
-{
- free(hw_info);
-}
-
-void hw_info_append_hw_type(void *hw_info, snd_device_t snd_device,
- char *device_name)
-{
- struct hardware_info *my_data = (struct hardware_info*) hw_info;
- uint32_t i = 0;
-
- snd_device_t *snd_devices =
- (snd_device_t *) my_data->snd_devices;
-
- if (snd_devices != NULL) {
- for (i = 0; i < my_data->num_snd_devices; i++) {
- if (snd_device == (snd_device_t)snd_devices[i]) {
- ALOGV("extract dev_extn device %d, device_name %s extn = %s ",
- (snd_device_t)snd_devices[i], device_name, my_data->dev_extn);
- CHECK(strlcat(device_name, my_data->dev_extn,
- DEVICE_NAME_MAX_SIZE) < DEVICE_NAME_MAX_SIZE);
- break;
- }
- }
- }
- ALOGD("%s : device_name = %s", __func__,device_name);
-}
-
-struct snd_card_split *get_snd_card_split()
-{
- return &cur_snd_card_split;
-}
-
-void set_snd_card_split(const char* in_snd_card_name)
-{
- /* sound card name follows below mentioned convention
- <target name>-<sound card name>-<form factor>-snd-card
- parse target name, sound card name and form factor
- */
- char *snd_card_name = strdup(in_snd_card_name);
- char *tmp = NULL;
- char *device = NULL;
- char *snd_card = NULL;
- char *form_factor = NULL;
-
- if (in_snd_card_name == NULL) {
- ALOGE("%s: snd_card_name passed is NULL", __func__);
- goto on_error;
- }
-
- device = strtok_r(snd_card_name, "-", &tmp);
- if (device == NULL) {
- ALOGE("%s: called on invalid snd card name", __func__);
- goto on_error;
- }
- strlcpy(cur_snd_card_split.device, device, HW_INFO_ARRAY_MAX_SIZE);
-
- snd_card = strtok_r(NULL, "-", &tmp);
- if (snd_card == NULL) {
- ALOGE("%s: called on invalid snd card name", __func__);
- goto on_error;
- }
- strlcpy(cur_snd_card_split.snd_card, snd_card, HW_INFO_ARRAY_MAX_SIZE);
-
- form_factor = strtok_r(NULL, "-", &tmp);
- if (form_factor == NULL) {
- ALOGE("%s: called on invalid snd card name", __func__);
- goto on_error;
- }
- strlcpy(cur_snd_card_split.form_factor, form_factor, HW_INFO_ARRAY_MAX_SIZE);
-
- ALOGV("%s: snd_card_name(%s) device(%s) snd_card(%s) form_factor(%s)",
- __func__, in_snd_card_name, device, snd_card, form_factor);
-
-on_error:
- if (snd_card_name)
- free(snd_card_name);
-}
-
diff --git a/hal/msm8974/platform.c b/hal/msm8974/platform.c
index 7dc755c..49e6801 100644
--- a/hal/msm8974/platform.c
+++ b/hal/msm8974/platform.c
@@ -129,8 +129,6 @@
char *snd_card_name;
int max_vol_index;
int max_mic_count;
-
- void *hw_info;
};
static int pcm_device_table[AUDIO_USECASE_MAX][2] = {
@@ -934,8 +932,7 @@
char *snd_internal_name = NULL;
char *tmp = NULL;
char mixer_xml_file[MIXER_PATH_MAX_LENGTH]= {0};
- char platform_info_file[MIXER_PATH_MAX_LENGTH]= {0};
- struct snd_card_split *snd_split_handle = NULL;
+
my_data = calloc(1, sizeof(struct platform_data));
my_data->adev = adev;
@@ -944,6 +941,9 @@
set_platform_defaults(my_data);
+ /* Initialize platform specific ids and/or backends*/
+ platform_info_init(my_data);
+
while (snd_card_num < MAX_SND_CARD) {
adev->mixer = mixer_open(snd_card_num);
@@ -973,67 +973,41 @@
continue;
}
- set_snd_card_split(snd_card_name);
- snd_split_handle = get_snd_card_split();
+ if ((snd_internal_name = strtok_r(snd_card_name, "-", &tmp)) != NULL) {
+ /* Get the codec internal name from the sound card name
+ * and form the mixer paths file name dynamically. This
+ * is generic way of picking any codec name based mixer
+ * files in future with no code change. This code
+ * assumes mixer files are formed with format as
+ * mixer_paths_internalcodecname.xml
- my_data->hw_info = hw_info_init(snd_card_name);
+ * If this dynamically read mixer files fails to open then it
+ * falls back to default mixer file i.e mixer_paths.xml. This is
+ * done to preserve backward compatibility but not mandatory as
+ * long as the mixer files are named as per above assumption.
+ */
- /* Get the codec internal name from the sound card and/or form factor
- * name and form the mixer paths and platfor info file name dynamically.
- * This is generic way of picking any codec and forma factor name based
- * mixer and platform info files in future with no code change.
-
- * current code extends and looks for any of the exteneded mixer path and
- * platform info file present based on codec and form factor.
-
- * order of picking appropriate file is
- * <i> mixer_paths_<codec_name>_<form_factor>.xml, if file not present
- * <ii> mixer_paths_<codec_name>.xml, if file not present
- * <iii> mixer_paths.xml
-
- * same order is followed for audio_platform_info.xml as well
- */
-
- // need to carryforward old file name
- if (!strncmp(snd_card_name, TOMTOM_8226_SND_CARD_NAME,
+ if ((snd_internal_name = strtok_r(NULL, "-", &tmp)) != NULL) {
+ // need to carryforward old file name
+ if (!strncmp(snd_card_name, TOMTOM_8226_SND_CARD_NAME,
sizeof(TOMTOM_8226_SND_CARD_NAME))) {
- snprintf(mixer_xml_file, sizeof(mixer_xml_file), "%s_%s.xml",
+ snprintf(mixer_xml_file, sizeof(mixer_xml_file), "%s_%s.xml",
MIXER_XML_BASE_STRING, TOMTOM_MIXER_FILE_SUFFIX );
- } else {
-
- snprintf(mixer_xml_file, sizeof(mixer_xml_file), "%s_%s_%s.xml",
- MIXER_XML_BASE_STRING, snd_split_handle->snd_card,
- snd_split_handle->form_factor);
-
- if (F_OK != access(mixer_xml_file, 0)) {
- memset(mixer_xml_file, 0, sizeof(mixer_xml_file));
- snprintf(mixer_xml_file, sizeof(mixer_xml_file), "%s_%s.xml",
- MIXER_XML_BASE_STRING, snd_split_handle->snd_card);
-
- if (F_OK != access(mixer_xml_file, 0)) {
- memset(mixer_xml_file, 0, sizeof(mixer_xml_file));
- strlcpy(mixer_xml_file, MIXER_XML_DEFAULT_PATH, MIXER_PATH_MAX_LENGTH);
+ } else {
+ snprintf(mixer_xml_file, sizeof(mixer_xml_file), "%s_%s.xml",
+ MIXER_XML_BASE_STRING, snd_internal_name);
}
- }
- snprintf(platform_info_file, sizeof(platform_info_file), "%s_%s_%s.xml",
- PLATFORM_INFO_XML_BASE_STRING, snd_split_handle->snd_card,
- snd_split_handle->form_factor);
-
- if (F_OK != access(platform_info_file, 0)) {
- memset(platform_info_file, 0, sizeof(platform_info_file));
- snprintf(platform_info_file, sizeof(platform_info_file), "%s_%s.xml",
- PLATFORM_INFO_XML_BASE_STRING, snd_split_handle->snd_card);
-
- if (F_OK != access(platform_info_file, 0)) {
- memset(platform_info_file, 0, sizeof(platform_info_file));
- strlcpy(platform_info_file, PLATFORM_INFO_XML_PATH, MIXER_PATH_MAX_LENGTH);
+ if (F_OK == access(mixer_xml_file, 0)) {
+ use_default_mixer_path = false;
}
}
}
- /* Initialize platform specific ids and/or backends*/
- platform_info_init(platform_info_file, my_data);
+ if (use_default_mixer_path) {
+ memset(mixer_xml_file, 0, sizeof(mixer_xml_file));
+ strlcpy(mixer_xml_file, MIXER_XML_DEFAULT_PATH, MIXER_PATH_MAX_LENGTH);
+ }
ALOGD("%s: Loading mixer file: %s", __func__, mixer_xml_file);
adev->audio_route = audio_route_init(snd_card_num, mixer_xml_file);
@@ -1221,8 +1195,6 @@
struct platform_data *my_data = (struct platform_data *)platform;
close_csd_client(my_data->csd);
- hw_info_deinit(my_data->hw_info);
-
for (dev = 0; dev < SND_DEVICE_MAX; dev++) {
if (backend_tag_table[dev])
free(backend_tag_table[dev]);
@@ -1267,29 +1239,6 @@
return "none";
}
-int platform_get_snd_device_name_extn(void *platform, snd_device_t snd_device,
- char *device_name)
-{
- struct platform_data *my_data = (struct platform_data *)platform;
-
- if (platform == NULL || device_name == NULL) {
- ALOGW("%s: something wrong, use legacy get_snd_device name", __func__);
- device_name = platform_get_snd_device_name(snd_device);
- } else if (snd_device >= SND_DEVICE_MIN && snd_device < SND_DEVICE_MAX) {
- if (operator_specific_device_table[snd_device] != NULL) {
- strlcpy(device_name, get_operator_specific_device_mixer_path(snd_device),
- DEVICE_NAME_MAX_SIZE);
- } else {
- strlcpy(device_name, device_table[snd_device], DEVICE_NAME_MAX_SIZE);
- }
- hw_info_append_hw_type(my_data->hw_info, snd_device, device_name);
- } else {
- strlcpy(device_name, "none", DEVICE_NAME_MAX_SIZE);
- }
-
- return 0;
-}
-
void platform_add_backend_name(void *platform, char *mixer_path,
snd_device_t snd_device)
{
diff --git a/hal/msm8974/platform.h b/hal/msm8974/platform.h
index 53474f6..d6c9e8e 100644
--- a/hal/msm8974/platform.h
+++ b/hal/msm8974/platform.h
@@ -149,9 +149,6 @@
};
-#define DEVICE_NAME_MAX_SIZE 128
-#define HW_INFO_ARRAY_MAX_SIZE 32
-
#define DEFAULT_OUTPUT_SAMPLING_RATE 48000
#define ALL_SESSION_VSID 0xFFFFFFFF
@@ -306,6 +303,4 @@
get_sample_rate_t get_sample_rate;
};
-#define PLATFORM_INFO_XML_PATH "/system/etc/audio_platform_info.xml"
-#define PLATFORM_INFO_XML_BASE_STRING "/system/etc/audio_platform_info"
#endif // QCOM_AUDIO_PLATFORM_H
diff --git a/hal/platform_api.h b/hal/platform_api.h
index 9bd55b1..1e41358 100644
--- a/hal/platform_api.h
+++ b/hal/platform_api.h
@@ -20,8 +20,6 @@
void *platform_init(struct audio_device *adev);
void platform_deinit(void *platform);
const char *platform_get_snd_device_name(snd_device_t snd_device);
-int platform_get_snd_device_name_extn(void *platform, snd_device_t snd_device,
- char *device_name);
void platform_add_backend_name(void *platform, char *mixer_path,
snd_device_t snd_device);
bool platform_send_gain_dep_cal(void *platform, int level);
@@ -71,7 +69,7 @@
const char * hw_interface);
/* From platform_info.c */
-int platform_info_init(const char *filename, void *);
+int platform_info_init(void *);
int platform_get_usecase_index(const char * usecase);
int platform_set_usecase_pcm_id(audio_usecase_t usecase, int32_t type, int32_t pcm_id);
diff --git a/hal/platform_info.c b/hal/platform_info.c
index 7432230..4556294 100644
--- a/hal/platform_info.c
+++ b/hal/platform_info.c
@@ -25,6 +25,8 @@
#include "platform_api.h"
#include <platform.h>
+#define PLATFORM_INFO_XML_PATH "/system/etc/audio_platform_info.xml"
+
typedef enum {
ROOT,
ACDB,
@@ -342,7 +344,7 @@
}
}
-int platform_info_init(const char *filename, void *platform)
+int platform_info_init(void *platform)
{
XML_Parser parser;
FILE *file;
@@ -350,22 +352,13 @@
int bytes_read;
void *buf;
static const uint32_t kBufSize = 1024;
- char platform_info_file_name[MIXER_PATH_MAX_LENGTH]= {0};
+
section = ROOT;
- 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");
-
+ file = fopen(PLATFORM_INFO_XML_PATH, "r");
if (!file) {
ALOGD("%s: Failed to open %s, using defaults.",
- __func__, platform_info_file_name);
+ __func__, PLATFORM_INFO_XML_PATH);
ret = -ENODEV;
goto done;
}
@@ -400,7 +393,7 @@
if (XML_ParseBuffer(parser, bytes_read,
bytes_read == 0) == XML_STATUS_ERROR) {
ALOGE("%s: XML_ParseBuffer failed, for %s",
- __func__, platform_info_file_name);
+ __func__, PLATFORM_INFO_XML_PATH);
ret = -EINVAL;
goto err_free_parser;
}