hal: Add support for AUXPCM BT

Atheros BT chip uses AUXPCM instead of slimbus. Audio HAL has
to use different mixer paths file depending on whether it's
internal or external BT chip

Change-Id: I78ae70462fed42d4260ae37070ba23e81779c866
This commit is contained in:
Damir Didjusto 2013-11-06 17:59:04 -08:00
parent debeb7b90a
commit f1d46c784a
4 changed files with 48 additions and 1 deletions

View File

@ -90,6 +90,10 @@ ifeq ($(strip $(AUDIO_FEATURE_ENABLED_LISTEN)),true)
LOCAL_SRC_FILES += audio_extn/listen.c
endif
ifeq ($(strip $(AUDIO_FEATURE_ENABLED_AUXPCM_BT)),true)
LOCAL_CFLAGS += -DAUXPCM_BT_ENABLED
endif
LOCAL_MODULE := audio.primary.$(TARGET_BOARD_PLATFORM)
LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)/hw

View File

@ -29,6 +29,9 @@
#include "audio_hw.h"
#include "audio_extn.h"
#define MAX_SLEEP_RETRY 100
#define WIFI_INIT_WAIT_SLEEP 50
struct audio_extn_module {
bool anc_enabled;
bool aanc_enabled;
@ -208,3 +211,31 @@ void audio_extn_get_parameters(const struct audio_device *adev,
ALOGD("%s: returns %s", __func__, str_parms_to_str(reply));
}
#ifdef AUXPCM_BT_ENABLED
int32_t audio_extn_read_xml(struct audio_device *adev, uint32_t mixer_card,
const char* mixer_xml_path,
const char* mixer_xml_path_auxpcm)
{
char bt_soc[128];
bool wifi_init_complete = false;
int sleep_retry = 0;
while (!wifi_init_complete && sleep_retry < MAX_SLEEP_RETRY) {
property_get("qcom.bluetooth.soc", bt_soc, NULL);
if (strncmp(bt_soc, "unknown", sizeof("unknown"))) {
wifi_init_complete = true;
} else {
usleep(WIFI_INIT_WAIT_SLEEP*1000);
sleep_retry++;
}
}
if (!strncmp(bt_soc, "ath3k", sizeof("ath3k")))
adev->audio_route = audio_route_init(mixer_card, mixer_xml_path_auxpcm);
else
adev->audio_route = audio_route_init(mixer_card, mixer_xml_path);
return 0;
}
#endif /* AUXPCM_BT_ENABLED */

View File

@ -117,4 +117,12 @@ void audio_extn_listen_set_parameters(struct audio_device *adev,
#endif /* AUDIO_LISTEN_ENABLED */
#ifndef AUXPCM_BT_ENABLED
#define audio_extn_read_xml(adev, MIXER_CARD, MIXER_XML_PATH, \
MIXER_XML_PATH_AUXPCM) (-ENOSYS)
#else
int32_t audio_extn_read_xml(struct audio_device *adev, uint32_t mixer_card,
const char* mixer_xml_path,
const char* mixer_xml_path_auxpcm);
#endif /* AUXPCM_BT_ENABLED */
#endif /* AUDIO_EXTN_H */

View File

@ -32,6 +32,7 @@
#include "audio_extn.h"
#define MIXER_XML_PATH "/system/etc/mixer_paths.xml"
#define MIXER_XML_PATH_AUXPCM "/system/etc/mixer_paths_auxpcm.xml"
#define LIB_ACDB_LOADER "libacdbloader.so"
#define AUDIO_DATA_BLOCK_MIXER_CTL "HDMI EDID"
@ -324,7 +325,10 @@ void *platform_init(struct audio_device *adev)
return NULL;
}
adev->audio_route = audio_route_init(MIXER_CARD, MIXER_XML_PATH);
if (audio_extn_read_xml(adev, MIXER_CARD, MIXER_XML_PATH,
MIXER_XML_PATH_AUXPCM) == -ENOSYS)
adev->audio_route = audio_route_init(MIXER_CARD, MIXER_XML_PATH);
if (!adev->audio_route) {
ALOGE("%s: Failed to init audio route controls, aborting.", __func__);
return NULL;