diff options
| author | Iliyan Malchev <malchev@google.com> | 2014-08-09 13:07:21 -0700 |
|---|---|---|
| committer | Tony Layher <layhertony@gmail.com> | 2014-11-19 17:50:56 -0500 |
| commit | 16b7edab179a77cb17f4b0e057a2a6602933daa6 (patch) | |
| tree | 969ddae8bfd72190f07282150656febf4eb122e8 | |
| parent | d9adf7d3df701f07eda00c88e834de12e487e28d (diff) | |
| download | hardware_qcom_audio-16b7edab179a77cb17f4b0e057a2a6602933daa6.tar.gz hardware_qcom_audio-16b7edab179a77cb17f4b0e057a2a6602933daa6.tar.bz2 hardware_qcom_audio-16b7edab179a77cb17f4b0e057a2a6602933daa6.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.mk | 6 | ||||
| -rw-r--r-- | hal/msm8974/platform.c | 63 |
2 files changed, 32 insertions, 37 deletions
diff --git a/hal/Android.mk b/hal/Android.mk index 907e5e71..c7d1a8a2 100644 --- a/hal/Android.mk +++ b/hal/Android.mk @@ -142,8 +142,7 @@ LOCAL_SHARED_LIBRARIES := \ libtinycompress \ libaudioroute \ libdl \ - libexpat \ - libmdmdetect + libexpat LOCAL_C_INCLUDES += \ external/tinyalsa/include \ @@ -153,8 +152,7 @@ LOCAL_C_INCLUDES += \ $(call include-path-for, audio-effects) \ $(LOCAL_PATH)/$(AUDIO_PLATFORM) \ $(LOCAL_PATH)/audio_extn \ - $(LOCAL_PATH)/voice_extn \ - $(TARGET_OUT_HEADERS)/libmdmdetect/inc + $(LOCAL_PATH)/voice_extn ifeq ($(strip $(AUDIO_FEATURE_ENABLED_LISTEN)),true) LOCAL_CFLAGS += -DAUDIO_LISTEN_ENABLED diff --git a/hal/msm8974/platform.c b/hal/msm8974/platform.c index 637f1f1f..f6225c79 100644 --- a/hal/msm8974/platform.c +++ b/hal/msm8974/platform.c @@ -39,7 +39,6 @@ #include "audio_extn.h" #include "voice_extn.h" #include "edid.h" -#include "mdm_detect.h" #include "sound/compress_params.h" #define MIXER_XML_PATH "/system/etc/mixer_paths.xml" @@ -628,38 +627,41 @@ void close_csd_client(struct csd_data *csd) static void platform_csd_init(struct platform_data *plat_data) { - 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); - } - ALOGD("%s: num_modems %d\n", __func__, mdm_detect_info.num_modems); + plat_data->csd = NULL; - if (mdm_detect_info.num_modems > 0) - plat_data->csd = open_csd_client(plat_data->is_i2s_ext_modem); -} + void *lib = dlopen(name, RTLD_NOW); + error = dlerror(); + if (!lib) { + ALOGE("%s: could not find %s: %s", __func__, name, error); + return; + } -static bool platform_is_i2s_ext_modem(const char *snd_card_name, - struct platform_data *plat_data) -{ - plat_data->is_i2s_ext_modem = false; + 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; + } - if (!strncmp(snd_card_name, "apq8084-taiko-i2s-mtp-snd-card", - sizeof("apq8084-taiko-i2s-mtp-snd-card")) || - !strncmp(snd_card_name, "apq8084-taiko-i2s-cdp-snd-card", - sizeof("apq8084-taiko-i2s-cdp-snd-card"))) { - plat_data->is_i2s_ext_modem = true; + modems = count_modems(); + if (modems < 0) { + ALOGE("%s: count_modems failed\n", __func__); + goto done; } - ALOGV("%s, is_i2s_ext_modem:%d",__func__, plat_data->is_i2s_ext_modem); - return plat_data->is_i2s_ext_modem; + ALOGD("%s: num_modems %d\n", __func__, modems); + if (modems > 0) + plat_data->csd = open_csd_client(false /*is_i2s_ext_modem*/); + +done: + dlclose(lib); } static void set_platform_defaults() @@ -721,12 +723,7 @@ void *platform_init(struct audio_device *adev) if (!my_data->hw_info) { ALOGE("%s: Failed to init hardware info", __func__); } else { - if (platform_is_i2s_ext_modem(snd_card_name, my_data)) { - ALOGD("%s: Call MIXER_XML_PATH_I2S", __func__); - - adev->audio_route = audio_route_init(snd_card_num, - MIXER_XML_PATH_I2S); - } else if (audio_extn_read_xml(adev, snd_card_num, MIXER_XML_PATH, + if (audio_extn_read_xml(adev, snd_card_num, MIXER_XML_PATH, MIXER_XML_PATH_AUXPCM) == -ENOSYS) { adev->audio_route = audio_route_init(snd_card_num, MIXER_XML_PATH); |
