summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIliyan Malchev <malchev@google.com>2014-08-09 13:07:21 -0700
committerIliyan Malchev <malchev@google.com>2014-08-09 20:22:48 +0000
commitae9a10c15cf960e9b2b1159ade6414f80689db5f (patch)
treec7848b646c0213c9542085b92fe61669c86ce5fd
parentf7c646835daca18cbfc0e060141e4deec8e65e3c (diff)
downloadhardware_qcom_audio-ae9a10c15cf960e9b2b1159ade6414f80689db5f.tar.gz
hardware_qcom_audio-ae9a10c15cf960e9b2b1159ade6414f80689db5f.tar.bz2
hardware_qcom_audio-ae9a10c15cf960e9b2b1159ade6414f80689db5f.zip
audio: rework dependency on libmdmdetect
libmdmdetect is a binary-only library, so we cannot change its API. Instead, make the audio HAL depend on libdetectmodem, which exports a single function, which returns the number of modems, or -1 in the event of error. If the library is not present, or we fail to look up the symbol, or in the event of an error, we assume that there is no modem. extern int32_t count_modems(void); b/16859052 aosp-shamu has dependencies on vendor/ Change-Id: I197dc5386b13fc2cce69fd273a47298517bd8b04 Signed-off-by: Iliyan Malchev <malchev@google.com>
-rw-r--r--hal/Android.mk5
-rw-r--r--hal/msm8974/platform.c46
2 files changed, 31 insertions, 20 deletions
diff --git a/hal/Android.mk b/hal/Android.mk
index c7cb167c..a1ff948c 100644
--- a/hal/Android.mk
+++ b/hal/Android.mk
@@ -43,11 +43,6 @@ LOCAL_C_INCLUDES += \
$(LOCAL_PATH)/voice_extn \
external/expat/lib
-ifneq ($(filter msm8084,$(TARGET_BOARD_PLATFORM)),)
- LOCAL_SHARED_LIBRARIES += libmdmdetect
- LOCAL_C_INCLUDES += $(TARGET_OUT_HEADERS)/libmdmdetect/inc
-endif
-
ifeq ($(strip $(AUDIO_FEATURE_ENABLED_MULTI_VOICE_SESSIONS)),true)
LOCAL_CFLAGS += -DMULTI_VOICE_SESSION_ENABLED
LOCAL_SRC_FILES += voice_extn/voice_extn.c
diff --git a/hal/msm8974/platform.c b/hal/msm8974/platform.c
index ad28f6b3..a068a826 100644
--- a/hal/msm8974/platform.c
+++ b/hal/msm8974/platform.c
@@ -26,9 +26,6 @@
#include <audio_hw.h>
#include <platform_api.h>
#include "platform.h"
-#ifdef PLATFORM_MSM8084
-#include "mdm_detect.h"
-#endif
#define MIXER_XML_PATH "/system/etc/mixer_paths.xml"
#define LIB_ACDB_LOADER "libacdbloader.so"
@@ -516,22 +513,41 @@ void close_csd_client(struct csd_data *csd)
static void platform_csd_init(struct platform_data *my_data)
{
#ifdef PLATFORM_MSM8084
- struct dev_info mdm_detect_info;
- int ret = 0;
+ int32_t modems, (*count_modems)(void);
+ const char *name = "libdetectmodem.so";
+ const char *func = "count_modems";
+ const char *error;
- /* Call ESOC API to get the number of modems.
- * If the number of modems is not zero, load CSD Client specific
- * symbols. Voice call is handled by MDM and apps processor talks to
- * MDM through CSD Client
- */
- ret = get_system_info(&mdm_detect_info);
- if (ret > 0) {
- ALOGE("%s: Failed to get system info, ret %d", __func__, ret);
+ my_data->csd = NULL;
+
+ void *lib = dlopen(name, RTLD_NOW);
+ error = dlerror();
+ if (!lib) {
+ ALOGE("%s: could not find %s: %s", __func__, name, error);
+ return;
+ }
+
+ count_modems = NULL;
+ *(void **)(&count_modems) = dlsym(lib, func);
+ error = dlerror();
+ if (!count_modems) {
+ ALOGE("%s: could not find symbol %s in %s: %s",
+ __func__, func, name, error);
+ goto done;
}
- ALOGD("%s: num_modems %d\n", __func__, mdm_detect_info.num_modems);
- if (mdm_detect_info.num_modems > 0)
+ modems = count_modems();
+ if (modems < 0) {
+ ALOGE("%s: count_modems failed\n", __func__);
+ goto done;
+ }
+
+ ALOGD("%s: num_modems %d\n", __func__, modems);
+ if (modems > 0)
my_data->csd = open_csd_client(false /*is_i2s_ext_modem*/);
+
+done:
+ dlclose(lib);
#else
my_data->csd = NULL;
#endif