Skip to content

Commit

Permalink
Audio: Bear(8916) Audio HAL bringup changes
Browse files Browse the repository at this point in the history
- Added 8916 audio HAL spacific changes
  Merged 8916 BU changes to mainline

Change-Id: I8bfb06f328f1851d924d1b1219bc7317afa38b0d
  • Loading branch information
Naresh Tanniru authored and hyperb1iss committed Oct 4, 2014
1 parent a904df8 commit 380a6f7
Show file tree
Hide file tree
Showing 4 changed files with 1,436 additions and 364 deletions.
7 changes: 6 additions & 1 deletion hal/Android.mk
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ LOCAL_ARM_MODE := arm

AUDIO_PLATFORM := $(TARGET_BOARD_PLATFORM)

ifneq ($(filter msm8974 msm8226 msm8610 apq8084 msm8916,$(TARGET_BOARD_PLATFORM)),)
ifneq ($(filter msm8974 msm8226 msm8610 apq8084,$(TARGET_BOARD_PLATFORM)),)
# B-family platform uses msm8974 code base
AUDIO_PLATFORM = msm8974
MULTIPLE_HW_VARIANTS_ENABLED := true
Expand All @@ -33,6 +33,11 @@ ifeq ($(TARGET_BOARD_PLATFORM),msm8960)
endif
endif

ifneq ($(filter msm8916,$(TARGET_BOARD_PLATFORM)),)
AUDIO_PLATFORM = msm8916
MULTIPLE_HW_VARIANTS_ENABLED := true
LOCAL_CFLAGS := -DPLATFORM_MSM8916
endif

LOCAL_SRC_FILES := \
audio_hw.c \
Expand Down
162 changes: 35 additions & 127 deletions hal/msm8916/hw_info.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,6 @@ struct hardware_info {

#define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0]))

#define LITERAL_TO_STRING(x) #x
#define CHECK(condition) LOG_ALWAYS_FATAL_IF(!(condition), "%s",\
__FILE__ ":" LITERAL_TO_STRING(__LINE__)\
" ASSERT_FATAL(" #condition ") failed.")

static const snd_device_t taiko_fluid_variant_devices[] = {
SND_DEVICE_OUT_SPEAKER,
SND_DEVICE_OUT_SPEAKER_AND_HEADPHONES,
Expand All @@ -66,6 +61,11 @@ static const snd_device_t taiko_CDP_variant_devices[] = {
SND_DEVICE_OUT_SPEAKER,
SND_DEVICE_OUT_SPEAKER_AND_HEADPHONES,
SND_DEVICE_OUT_SPEAKER_AND_ANC_HEADSET,
SND_DEVICE_IN_QUAD_MIC,
};

static const snd_device_t taiko_apq8084_CDP_variant_devices[] = {
SND_DEVICE_IN_HANDSET_MIC,
};

static const snd_device_t taiko_liquid_variant_devices[] = {
Expand All @@ -74,35 +74,47 @@ static const snd_device_t taiko_liquid_variant_devices[] = {
SND_DEVICE_OUT_SPEAKER_AND_ANC_HEADSET,
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,
SND_DEVICE_IN_HANDSET_STEREO_DMIC,
SND_DEVICE_IN_SPEAKER_STEREO_DMIC,
};

static const snd_device_t taiko_DB_variant_devices[] = {
SND_DEVICE_OUT_SPEAKER,
SND_DEVICE_OUT_SPEAKER_AND_HEADPHONES,
SND_DEVICE_OUT_SPEAKER_AND_ANC_HEADSET,
SND_DEVICE_IN_SPEAKER_MIC,
SND_DEVICE_IN_HEADSET_MIC,
SND_DEVICE_IN_QUAD_MIC,
};

static const snd_device_t tapan_lite_variant_devices[] = {
SND_DEVICE_OUT_SPEAKER,
SND_DEVICE_OUT_HEADPHONES,
SND_DEVICE_OUT_SPEAKER_AND_HEADPHONES,
SND_DEVICE_OUT_SPEAKER_AND_ANC_HEADSET,
SND_DEVICE_OUT_VOICE_HEADPHONES,
SND_DEVICE_OUT_VOICE_TTY_FULL_HEADPHONES,
SND_DEVICE_OUT_VOICE_TTY_VCO_HEADPHONES,
};

static const snd_device_t tapan_skuf_variant_devices[] = {
SND_DEVICE_OUT_SPEAKER,
SND_DEVICE_OUT_SPEAKER_AND_HEADPHONES,
SND_DEVICE_OUT_SPEAKER_AND_ANC_HEADSET,
/*SND_DEVICE_OUT_SPEAKER_AND_ANC_FB_HEADSET,*/
};

static const snd_device_t tapan_lite_skuf_variant_devices[] = {
SND_DEVICE_OUT_SPEAKER,
SND_DEVICE_OUT_ANC_HANDSET,
SND_DEVICE_OUT_ANC_HEADSET,
SND_DEVICE_OUT_ANC_FB_HEADSET,
SND_DEVICE_OUT_HEADPHONES,
SND_DEVICE_OUT_SPEAKER_AND_HEADPHONES,
SND_DEVICE_OUT_SPEAKER_AND_ANC_HEADSET,
SND_DEVICE_IN_AANC_HANDSET_MIC,
SND_DEVICE_OUT_VOICE_HEADPHONES,
SND_DEVICE_OUT_VOICE_TTY_FULL_HEADPHONES,
SND_DEVICE_OUT_VOICE_TTY_VCO_HEADPHONES,
};

static const snd_device_t helicon_skuab_variant_devices[] = {
Expand All @@ -111,121 +123,28 @@ static const snd_device_t helicon_skuab_variant_devices[] = {
SND_DEVICE_OUT_SPEAKER_AND_ANC_HEADSET,
};

static void update_hardware_info_8084(struct hardware_info *hw_info, const char *snd_card_name)
static void update_hardware_info_8x16(struct hardware_info *hw_info, const char *snd_card_name)
{
if (!strcmp(snd_card_name, "apq8084-taiko-mtp-snd-card")) {
strlcpy(hw_info->type, "mtp", sizeof(hw_info->type));
strlcpy(hw_info->name, "apq8084", sizeof(hw_info->name));
hw_info->snd_devices = NULL;
hw_info->num_snd_devices = 0;
strlcpy(hw_info->dev_extn, "", sizeof(hw_info->dev_extn));
} else if (!strcmp(snd_card_name, "apq8084-taiko-cdp-snd-card")) {
strlcpy(hw_info->type, " cdp", sizeof(hw_info->type));
strlcpy(hw_info->name, "apq8084", sizeof(hw_info->name));
hw_info->snd_devices = (snd_device_t *)taiko_CDP_variant_devices;
hw_info->num_snd_devices = ARRAY_SIZE(taiko_CDP_variant_devices);
strlcpy(hw_info->dev_extn, "", sizeof(hw_info->dev_extn));
} else if (!strcmp(snd_card_name, "apq8084-taiko-liquid-snd-card")) {
strlcpy(hw_info->type , " liquid", sizeof(hw_info->type));
strlcpy(hw_info->name, "apq8084", sizeof(hw_info->type));
hw_info->snd_devices = (snd_device_t *)taiko_liquid_variant_devices;
hw_info->num_snd_devices = ARRAY_SIZE(taiko_liquid_variant_devices);
strlcpy(hw_info->dev_extn, "", sizeof(hw_info->dev_extn));
} else {
ALOGW("%s: Not an 8084 device", __func__);
}
}

static void update_hardware_info_8974(struct hardware_info *hw_info, const char *snd_card_name)
{
if (!strcmp(snd_card_name, "msm8974-taiko-mtp-snd-card")) {
strlcpy(hw_info->type, " mtp", sizeof(hw_info->type));
strlcpy(hw_info->name, "msm8974", sizeof(hw_info->name));
hw_info->snd_devices = NULL;
hw_info->num_snd_devices = 0;
strlcpy(hw_info->dev_extn, "", sizeof(hw_info->dev_extn));
} else if (!strcmp(snd_card_name, "msm8974-taiko-cdp-snd-card")) {
strlcpy(hw_info->type, " cdp", sizeof(hw_info->type));
strlcpy(hw_info->name, "msm8974", sizeof(hw_info->name));
hw_info->snd_devices = (snd_device_t *)taiko_CDP_variant_devices;
hw_info->num_snd_devices = ARRAY_SIZE(taiko_CDP_variant_devices);
strlcpy(hw_info->dev_extn, "-fluid", sizeof(hw_info->dev_extn));
} else if (!strcmp(snd_card_name, "msm8974-taiko-fluid-snd-card")) {
strlcpy(hw_info->type, " fluid", sizeof(hw_info->type));
strlcpy(hw_info->name, "msm8974", sizeof(hw_info->name));
hw_info->snd_devices = (snd_device_t *) taiko_fluid_variant_devices;
hw_info->num_snd_devices = ARRAY_SIZE(taiko_fluid_variant_devices);
strlcpy(hw_info->dev_extn, "-fluid", sizeof(hw_info->dev_extn));
} else if (!strcmp(snd_card_name, "msm8974-taiko-liquid-snd-card")) {
strlcpy(hw_info->type, " liquid", sizeof(hw_info->type));
strlcpy(hw_info->name, "msm8974", sizeof(hw_info->name));
hw_info->snd_devices = (snd_device_t *)taiko_liquid_variant_devices;
hw_info->num_snd_devices = ARRAY_SIZE(taiko_liquid_variant_devices);
strlcpy(hw_info->dev_extn, "-liquid", sizeof(hw_info->dev_extn));
} else if (!strcmp(snd_card_name, "apq8074-taiko-db-snd-card")) {
strlcpy(hw_info->type, " dragon-board", sizeof(hw_info->type));
strlcpy(hw_info->name, "msm8974", sizeof(hw_info->name));
hw_info->snd_devices = (snd_device_t *)taiko_DB_variant_devices;
hw_info->num_snd_devices = ARRAY_SIZE(taiko_DB_variant_devices);
strlcpy(hw_info->dev_extn, "-DB", sizeof(hw_info->dev_extn));
} else {
ALOGW("%s: Not an 8974 device", __func__);
}
}

static void update_hardware_info_8610(struct hardware_info *hw_info, const char *snd_card_name)
{
if (!strcmp(snd_card_name, "msm8x10-snd-card")) {
if (!strcmp(snd_card_name, "msm8x16-snd-card")) {
strlcpy(hw_info->type, "", sizeof(hw_info->type));
strlcpy(hw_info->name, "msm8x10", sizeof(hw_info->name));
strlcpy(hw_info->name, "msm8x16", sizeof(hw_info->name));
hw_info->snd_devices = NULL;
hw_info->num_snd_devices = 0;
strlcpy(hw_info->dev_extn, "", sizeof(hw_info->dev_extn));
} else if (!strcmp(snd_card_name, "msm8x10-skuab-snd-card")) {
} else if (!strcmp(snd_card_name, "msm8x16-skuab-snd-card")) {
strlcpy(hw_info->type, "skuab", sizeof(hw_info->type));
strlcpy(hw_info->name, "msm8x10", sizeof(hw_info->name));
strlcpy(hw_info->name, "msm8x16", sizeof(hw_info->name));
hw_info->snd_devices = (snd_device_t *)helicon_skuab_variant_devices;
hw_info->num_snd_devices = ARRAY_SIZE(helicon_skuab_variant_devices);
strlcpy(hw_info->dev_extn, "-skuab", sizeof(hw_info->dev_extn));
} else if (!strcmp(snd_card_name, "msm8x10-skuaa-snd-card")) {
} else if (!strcmp(snd_card_name, "msm8x16-skuaa-snd-card")) {
strlcpy(hw_info->type, " skuaa", sizeof(hw_info->type));
strlcpy(hw_info->name, "msm8x10", sizeof(hw_info->name));
hw_info->snd_devices = NULL;
hw_info->num_snd_devices = 0;
strlcpy(hw_info->dev_extn, "", sizeof(hw_info->dev_extn));
} else {
ALOGW("%s: Not an 8x10 device", __func__);
}
}

static void update_hardware_info_8226(struct hardware_info *hw_info, const char *snd_card_name)
{
if (!strcmp(snd_card_name, "msm8226-tapan-snd-card")) {
strlcpy(hw_info->type, "", sizeof(hw_info->type));
strlcpy(hw_info->name, "msm8226", sizeof(hw_info->name));
strlcpy(hw_info->name, "msm8x16", sizeof(hw_info->name));
hw_info->snd_devices = NULL;
hw_info->num_snd_devices = 0;
strlcpy(hw_info->dev_extn, "", sizeof(hw_info->dev_extn));
} else if (!strcmp(snd_card_name, "msm8226-tapan9302-snd-card")) {
strlcpy(hw_info->type, "tapan_lite", sizeof(hw_info->type));
strlcpy(hw_info->name, "msm8226", sizeof(hw_info->name));
hw_info->snd_devices = (snd_device_t *)tapan_lite_variant_devices;
hw_info->num_snd_devices = ARRAY_SIZE(tapan_lite_variant_devices);
strlcpy(hw_info->dev_extn, "-lite", sizeof(hw_info->dev_extn));
} else if (!strcmp(snd_card_name, "msm8226-tapan-skuf-snd-card")) {
strlcpy(hw_info->type, " skuf", sizeof(hw_info->type));
strlcpy(hw_info->name, "msm8226", sizeof(hw_info->name));
hw_info->snd_devices = (snd_device_t *) tapan_skuf_variant_devices;
hw_info->num_snd_devices = ARRAY_SIZE(tapan_skuf_variant_devices);
strlcpy(hw_info->dev_extn, "-skuf", sizeof(hw_info->dev_extn));
} else if (!strcmp(snd_card_name, "msm8226-tapan9302-skuf-snd-card")) {
strlcpy(hw_info->type, " tapan9302-skuf", sizeof(hw_info->type));
strlcpy(hw_info->name, "msm8226", sizeof(hw_info->name));
hw_info->snd_devices = (snd_device_t *)tapan_lite_skuf_variant_devices;
hw_info->num_snd_devices = ARRAY_SIZE(tapan_lite_skuf_variant_devices);
strlcpy(hw_info->dev_extn, "-skuf-lite", sizeof(hw_info->dev_extn));
} else {
ALOGW("%s: Not an 8x26 device", __func__);
ALOGW("%s: Not an 8x16 device", __func__);
}
}

Expand All @@ -235,22 +154,11 @@ void *hw_info_init(const char *snd_card_name)

hw_info = malloc(sizeof(struct hardware_info));

if(strstr(snd_card_name, "msm8974") ||
strstr(snd_card_name, "apq8074")) {
ALOGV("8974 - variant soundcard");
update_hardware_info_8974(hw_info, snd_card_name);
} else if(strstr(snd_card_name, "msm8226")) {
ALOGV("8x26 - variant soundcard");
update_hardware_info_8226(hw_info, snd_card_name);
} else if(strstr(snd_card_name, "msm8x10")) {
ALOGV("8x10 - variant soundcard");
update_hardware_info_8610(hw_info, snd_card_name);
} else if(strstr(snd_card_name, "apq8084")) {
ALOGV("8084 - variant soundcard");
update_hardware_info_8084(hw_info, snd_card_name);
if(strstr(snd_card_name, "msm8x16")) {
ALOGV("8x16 - variant soundcard");
update_hardware_info_8x16(hw_info, snd_card_name);
} else {
ALOGE("%s: Unupported target %s:",__func__, snd_card_name);
CHECK(0);
ALOGE("%s: Unsupported target %s:",__func__, snd_card_name);
free(hw_info);
hw_info = NULL;
}
Expand Down
Loading

0 comments on commit 380a6f7

Please sign in to comment.