Merge "hal: Fix no Tx issue during multi party HFP calls"
diff --git a/Android.mk b/Android.mk
index c63df05..094165e 100644
--- a/Android.mk
+++ b/Android.mk
@@ -1,4 +1,4 @@
-ifneq ($(filter mpq8092 msm8960 msm8226 msm8x26 msm8610 msm8974 msm8x74 apq8084 msm8916,$(TARGET_BOARD_PLATFORM)),)
+ifneq ($(filter mpq8092 msm8960 msm8226 msm8x26 msm8610 msm8974 msm8x74 apq8084 msm8916 msm8994,$(TARGET_BOARD_PLATFORM)),)
MY_LOCAL_PATH := $(call my-dir)
diff --git a/hal/Android.mk b/hal/Android.mk
index 53b4a09..6239c01 100644
--- a/hal/Android.mk
+++ b/hal/Android.mk
@@ -8,7 +8,7 @@
AUDIO_PLATFORM := $(TARGET_BOARD_PLATFORM)
-ifneq ($(filter msm8974 msm8226 msm8610 apq8084,$(TARGET_BOARD_PLATFORM)),)
+ifneq ($(filter msm8974 msm8226 msm8610 apq8084 msm8994,$(TARGET_BOARD_PLATFORM)),)
# B-family platform uses msm8974 code base
AUDIO_PLATFORM = msm8974
MULTIPLE_HW_VARIANTS_ENABLED := true
@@ -21,6 +21,9 @@
ifneq ($(filter apq8084,$(TARGET_BOARD_PLATFORM)),)
LOCAL_CFLAGS := -DPLATFORM_APQ8084
endif
+ifneq ($(filter msm8994,$(TARGET_BOARD_PLATFORM)),)
+ LOCAL_CFLAGS := -DPLATFORM_MSM8994
+endif
endif
ifneq ($(filter msm8916,$(TARGET_BOARD_PLATFORM)),)
@@ -76,6 +79,7 @@
LOCAL_CFLAGS += -DSSR_ENABLED
LOCAL_SRC_FILES += audio_extn/ssr.c
LOCAL_C_INCLUDES += $(TARGET_OUT_HEADERS)/mm-audio/surround_sound/
+ LOCAL_C_INCLUDES += $(TARGET_OUT_HEADERS)/common/inc/
endif
ifneq ($(strip $(AUDIO_FEATURE_DISABLED_MULTI_VOICE_SESSIONS)),true)
diff --git a/hal/audio_extn/audio_extn.h b/hal/audio_extn/audio_extn.h
index 771d913..ac8896e 100644
--- a/hal/audio_extn/audio_extn.h
+++ b/hal/audio_extn/audio_extn.h
@@ -265,4 +265,7 @@
audio_format_t format,
struct stream_app_type_cfg *app_type_cfg);
int audio_extn_utils_send_app_type_cfg(struct audio_usecase *usecase);
+void audio_extn_utils_send_audio_calibration(struct audio_device *adev,
+ struct audio_usecase *usecase);
+
#endif /* AUDIO_EXTN_H */
diff --git a/hal/audio_extn/spkr_protection.c b/hal/audio_extn/spkr_protection.c
index 91f69f3..cd2a94e 100644
--- a/hal/audio_extn/spkr_protection.c
+++ b/hal/audio_extn/spkr_protection.c
@@ -686,11 +686,6 @@
}
spkr_prot_calib_cancel(adev);
spkr_prot_set_spkrstatus(true);
- if (platform_send_audio_calibration(adev->platform,
- SND_DEVICE_OUT_SPEAKER_PROTECTED) < 0) {
- adev->snd_dev_ref_cnt[snd_device]--;
- return -EINVAL;
- }
ALOGV("%s: snd_device(%d: %s)", __func__, snd_device,
platform_get_snd_device_name(SND_DEVICE_OUT_SPEAKER_PROTECTED));
audio_route_apply_and_update_path(adev->audio_route,
@@ -732,7 +727,8 @@
exit:
/* Clear VI feedback cal and replace with handset MIC */
platform_send_audio_calibration(adev->platform,
- SND_DEVICE_IN_HANDSET_MIC);
+ SND_DEVICE_IN_HANDSET_MIC,
+ platform_get_default_app_type(adev->platform), 8000);
if (ret) {
if (handle.pcm_tx)
pcm_close(handle.pcm_tx);
diff --git a/hal/audio_extn/utils.c b/hal/audio_extn/utils.c
index bb34bf0..6bb1b1b 100644
--- a/hal/audio_extn/utils.c
+++ b/hal/audio_extn/utils.c
@@ -174,7 +174,7 @@
static int parse_app_type_names(void *platform, char *name)
{
- int app_type = 0; /* TODO: default app type from acdb when exposed using "platform" */
+ int app_type = platform_get_default_app_type(platform);
char *str = strtok(name, "|");
if (str != NULL && strcmp(str, DYNAMIC_VALUE_TAG))
@@ -248,7 +248,7 @@
}
if (streams_output_cfg_list == NULL) {
app_type_cfg[length++] = 1;
- app_type_cfg[length++] = 0; /* TODO: default app type from acdb when exposed from "platform" */
+ app_type_cfg[length++] = platform_get_default_app_type(platform);
app_type_cfg[length++] = 48000;
app_type_cfg[length++] = 16;
mixer_ctl_set_array(ctl, app_type_cfg, length);
@@ -383,7 +383,7 @@
}
}
ALOGW("%s: App type could not be selected. Falling back to default", __func__);
- app_type_cfg->app_type = 0; /* TODO: default app type from acdb when exposed from "platform" */
+ app_type_cfg->app_type = platform_get_default_app_type(platform);
app_type_cfg->sample_rate = 48000;
app_type_cfg->bit_width = 16;
}
@@ -444,3 +444,26 @@
exit_send_app_type_cfg:
return rc;
}
+
+void audio_extn_utils_send_audio_calibration(struct audio_device *adev,
+ struct audio_usecase *usecase)
+{
+ int type = usecase->type;
+
+ if (type == PCM_PLAYBACK) {
+ struct stream_out *out = usecase->stream.out;
+ int snd_device = usecase->out_snd_device;
+ snd_device = (snd_device == SND_DEVICE_OUT_SPEAKER) ?
+ audio_extn_get_spkr_prot_snd_device(snd_device) : snd_device;
+ platform_send_audio_calibration(adev->platform, usecase->out_snd_device,
+ out->app_type_cfg.app_type,
+ out->app_type_cfg.sample_rate);
+ }
+ if ((type == PCM_HFP_CALL) || (type == PCM_CAPTURE)) {
+ /* when app type is default. the sample rate is not used to send cal */
+ platform_send_audio_calibration(adev->platform, usecase->in_snd_device,
+ platform_get_default_app_type(adev->platform),
+ 48000);
+ }
+}
+
diff --git a/hal/audio_hw.c b/hal/audio_hw.c
index e93abdb..b54261e 100644
--- a/hal/audio_hw.c
+++ b/hal/audio_hw.c
@@ -257,6 +257,7 @@
audio_extn_dolby_set_dmid(adev);
audio_extn_dolby_set_endpoint(adev);
#endif
+ audio_extn_utils_send_audio_calibration(adev, usecase);
audio_extn_utils_send_app_type_cfg(usecase);
strcpy(mixer_path, use_case_table[usecase->id]);
platform_add_backend_name(mixer_path, snd_device);
@@ -323,6 +324,10 @@
if ((snd_device == SND_DEVICE_OUT_SPEAKER ||
snd_device == SND_DEVICE_OUT_VOICE_SPEAKER) &&
audio_extn_spkr_prot_is_enabled()) {
+ if (audio_extn_spkr_prot_get_acdb_id(snd_device) < 0) {
+ 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__);
return -EINVAL;
@@ -334,7 +339,7 @@
and audio, notify listen hal before audio calibration is sent */
audio_extn_listen_update_status(snd_device,
LISTEN_EVENT_SND_DEVICE_BUSY);
- if (platform_send_audio_calibration(adev->platform, snd_device) < 0) {
+ if (platform_get_snd_device_acdb_id(snd_device) < 0) {
adev->snd_dev_ref_cnt[snd_device]--;
audio_extn_listen_update_status(snd_device,
LISTEN_EVENT_SND_DEVICE_FREE);
@@ -837,11 +842,9 @@
pcm_close(in->pcm);
in->pcm = NULL;
ret = -EIO;
- in->pcm_error_type = PCM_ERROR_EIO;
goto error_open;
}
- in->pcm_error_type = PCM_ERROR_NONE;
ALOGV("%s: exit", __func__);
return ret;
@@ -1238,10 +1241,8 @@
pcm_close(out->pcm);
out->pcm = NULL;
ret = -EIO;
- out->pcm_error_type = PCM_ERROR_EIO;
goto error_open;
}
- out->pcm_error_type = PCM_ERROR_NONE;
} else {
out->pcm = NULL;
out->compr = compress_open(adev->snd_card,
@@ -1540,8 +1541,7 @@
!voice_is_in_call(adev) &&
(out == adev->primary_output)) {
ret = voice_start_call(adev);
- } else if ((adev->mode == AUDIO_MODE_IN_CALL) &&
- voice_is_in_call(adev) &&
+ } else if (voice_is_in_call(adev) &&
(out == adev->primary_output)) {
voice_update_devices_for_all_voice_usecases(adev);
}
@@ -1680,12 +1680,6 @@
ALOGD(" %s: sound card is not active/SSR state", __func__);
ret= -ENETRESET;
goto exit;
- } else if (PCM_ERROR_ENETRESET == out->pcm_error_type) {
- ALOGD(" %s restarting pcm session on post SSR", __func__);
- out->standby = false;
- pthread_mutex_unlock(&out->lock);
- out_standby(&out->stream.common);
- pthread_mutex_lock(&out->lock);
}
}
@@ -1737,12 +1731,11 @@
}
exit:
-
+ /* ToDo: There may be a corner case when SSR happens back to back during
+ start/stop. Need to post different error to handle that. */
if (-ENETRESET == ret) {
pthread_mutex_lock(&adev->snd_card_status.lock);
adev->snd_card_status.state = SND_CARD_STATE_OFFLINE;
- out->pcm_error_type = PCM_ERROR_ENETRESET;
- out->standby = true; /*standby will be called on post SSR */
pthread_mutex_unlock(&adev->snd_card_status.lock);
}
@@ -2098,12 +2091,6 @@
ALOGD(" %s: sound card is not active/SSR state", __func__);
ret= -ENETRESET;
goto exit;
- } else if (PCM_ERROR_ENETRESET == in->pcm_error_type) {
- ALOGD(" %s restarting pcm session on post SSR", __func__);
- in->standby = false;
- pthread_mutex_unlock(&in->lock);
- in_standby(&in->stream.common);
- pthread_mutex_lock(&in->lock);
}
}
@@ -2137,13 +2124,12 @@
memset(buffer, 0, bytes);
exit:
-
+ /* ToDo: There may be a corner case when SSR happens back to back during
+ start/stop. Need to post different error to handle that. */
if (-ENETRESET == ret) {
pthread_mutex_lock(&adev->snd_card_status.lock);
adev->snd_card_status.state = SND_CARD_STATE_OFFLINE;
- in->pcm_error_type = PCM_ERROR_ENETRESET;
memset(buffer, 0, bytes);
- in->standby = true; /*standby will be called on post SSR */
pthread_mutex_unlock(&adev->snd_card_status.lock);
}
pthread_mutex_unlock(&in->lock);
diff --git a/hal/audio_hw.h b/hal/audio_hw.h
index 7d8d924..1b2606c 100644
--- a/hal/audio_hw.h
+++ b/hal/audio_hw.h
@@ -140,12 +140,6 @@
OFFLOAD_STATE_PAUSED,
};
-enum {
- PCM_ERROR_NONE,
- PCM_ERROR_EIO,
- PCM_ERROR_ENETRESET, /* For SSR */
-};
-
struct offload_cmd {
struct listnode node;
int cmd;
@@ -193,7 +187,6 @@
void *offload_cookie;
struct compr_gapless_mdata gapless_mdata;
int send_new_metadata;
- int pcm_error_type;
struct audio_device *dev;
};
@@ -212,7 +205,6 @@
bool enable_aec;
bool enable_ns;
audio_format_t format;
- int pcm_error_type;
struct audio_device *dev;
};
diff --git a/hal/msm8916/hw_info.c b/hal/msm8916/hw_info.c
index 4f35ffc..9ea86ad 100644
--- a/hal/msm8916/hw_info.c
+++ b/hal/msm8916/hw_info.c
@@ -149,8 +149,32 @@
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, "msm8939-snd-card")) {
+ strlcpy(hw_info->type, "", sizeof(hw_info->type));
+ strlcpy(hw_info->name, "msm8939", 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, "msm8939-snd-card-mtp")) {
+ strlcpy(hw_info->type, "", sizeof(hw_info->type));
+ strlcpy(hw_info->name, "msm8939", 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, "msm8939-skuh-snd-card")) {
+ strlcpy(hw_info->type, "skuh", sizeof(hw_info->type));
+ strlcpy(hw_info->name, "msm8939", 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, "msm8939-skui-snd-card")) {
+ strlcpy(hw_info->type, "skui", sizeof(hw_info->type));
+ strlcpy(hw_info->name, "msm8939", 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 8x16 device", __func__);
+ ALOGW("%s: Not an 8x16/8939 device", __func__);
}
}
@@ -160,7 +184,7 @@
hw_info = malloc(sizeof(struct hardware_info));
- if(strstr(snd_card_name, "msm8x16")) {
+ if(strstr(snd_card_name, "msm8x16") || strstr(snd_card_name, "msm8939")) {
ALOGV("8x16 - variant soundcard");
update_hardware_info_8x16(hw_info, snd_card_name);
} else {
diff --git a/hal/msm8916/platform.c b/hal/msm8916/platform.c
index d2a6807..d92f707 100644
--- a/hal/msm8916/platform.c
+++ b/hal/msm8916/platform.c
@@ -70,6 +70,9 @@
/* EDID format ID for LPCM audio */
#define EDID_FORMAT_LPCM 1
+/* fallback app type if the default app type from acdb loader fails */
+#define DEFAULT_APP_TYPE 0x11130
+
/* Retry for delay in FW loading*/
#define RETRY_NUMBER 20
#define RETRY_US 500000
@@ -97,9 +100,10 @@
/* Audio calibration related functions */
typedef void (*acdb_deallocate_t)();
typedef int (*acdb_init_t)(char *);
-typedef void (*acdb_send_audio_cal_t)(int, int);
+typedef void (*acdb_send_audio_cal_t)(int, int, int, int);
typedef void (*acdb_send_voice_cal_t)(int, int);
typedef int (*acdb_reload_vocvoltable_t)(int);
+typedef int (*acdb_get_default_app_type_t)(void);
struct platform_data {
struct audio_device *adev;
@@ -119,6 +123,7 @@
acdb_send_audio_cal_t acdb_send_audio_cal;
acdb_send_voice_cal_t acdb_send_voice_cal;
acdb_reload_vocvoltable_t acdb_reload_vocvoltable;
+ acdb_get_default_app_type_t acdb_get_default_app_type;
void *hw_info;
struct csd_data *csd;
@@ -412,6 +417,10 @@
sizeof("msm8x16-skui-snd-card"))) {
strlcpy(mixer_xml_path, MIXER_XML_PATH_QRD_SKUI,
sizeof(MIXER_XML_PATH_QRD_SKUI));
+ } if (!strncmp(snd_card_name, "msm8939-snd-card-mtp",
+ sizeof("msm8939-snd-card-mtp"))) {
+ strlcpy(mixer_xml_path, MIXER_XML_PATH,
+ sizeof(MIXER_XML_PATH));
} else {
strlcpy(mixer_xml_path, MIXER_XML_PATH,
sizeof(MIXER_XML_PATH));
@@ -680,7 +689,7 @@
__func__, LIB_ACDB_LOADER);
my_data->acdb_send_audio_cal = (acdb_send_audio_cal_t)dlsym(my_data->acdb_handle,
- "acdb_loader_send_audio_cal");
+ "acdb_loader_send_audio_cal_v2");
if (!my_data->acdb_send_audio_cal)
ALOGE("%s: Could not find the symbol acdb_send_audio_cal from %s",
__func__, LIB_ACDB_LOADER);
@@ -697,6 +706,13 @@
ALOGE("%s: Could not find the symbol acdb_loader_reload_vocvoltable from %s",
__func__, LIB_ACDB_LOADER);
+ my_data->acdb_get_default_app_type = (acdb_get_default_app_type_t)dlsym(
+ my_data->acdb_handle,
+ "acdb_loader_get_default_app_type");
+ if (!my_data->acdb_get_default_app_type)
+ ALOGE("%s: Could not find the symbol acdb_get_default_app_type from %s",
+ __func__, LIB_ACDB_LOADER);
+
my_data->acdb_init = (acdb_init_t)dlsym(my_data->acdb_handle,
"acdb_loader_init_v2");
if (my_data->acdb_init == NULL)
@@ -894,6 +910,16 @@
return ret;
}
+int platform_get_default_app_type(void *platform)
+{
+ struct platform_data *my_data = (struct platform_data *)platform;
+
+ if (my_data->acdb_get_default_app_type)
+ return my_data->acdb_get_default_app_type();
+ else
+ return DEFAULT_APP_TYPE;
+}
+
int platform_get_snd_device_acdb_id(snd_device_t snd_device)
{
if ((snd_device < SND_DEVICE_MIN) || (snd_device >= SND_DEVICE_MAX)) {
@@ -903,7 +929,8 @@
return acdb_device_table[snd_device];
}
-int platform_send_audio_calibration(void *platform, snd_device_t snd_device)
+int platform_send_audio_calibration(void *platform, snd_device_t snd_device,
+ int app_type, int sample_rate)
{
struct platform_data *my_data = (struct platform_data *)platform;
int acdb_dev_id, acdb_dev_type;
@@ -915,14 +942,15 @@
return -EINVAL;
}
if (my_data->acdb_send_audio_cal) {
- ("%s: sending audio calibration for snd_device(%d) acdb_id(%d)",
+ ALOGV("%s: sending audio calibration for snd_device(%d) acdb_id(%d)",
__func__, snd_device, acdb_dev_id);
if (snd_device >= SND_DEVICE_OUT_BEGIN &&
snd_device < SND_DEVICE_OUT_END)
acdb_dev_type = ACDB_DEV_TYPE_OUT;
else
acdb_dev_type = ACDB_DEV_TYPE_IN;
- my_data->acdb_send_audio_cal(acdb_dev_id, acdb_dev_type);
+ my_data->acdb_send_audio_cal(acdb_dev_id, acdb_dev_type, app_type,
+ sample_rate);
}
return 0;
}
diff --git a/hal/msm8974/hw_info.c b/hal/msm8974/hw_info.c
index f43a3b0..85a9771 100644
--- a/hal/msm8974/hw_info.c
+++ b/hal/msm8974/hw_info.c
@@ -83,6 +83,31 @@
SND_DEVICE_IN_SPEAKER_STEREO_DMIC,
};
+static const snd_device_t tomtom_msm8994_CDP_variant_devices[] = {
+ SND_DEVICE_IN_HANDSET_MIC,
+};
+
+static const snd_device_t tomtom_liquid_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_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 tomtom_stp_variant_devices[] = {
+ SND_DEVICE_OUT_SPEAKER,
+ SND_DEVICE_OUT_SPEAKER_AND_HEADPHONES,
+ SND_DEVICE_OUT_SPEAKER_AND_ANC_HEADSET,
+};
+
static const snd_device_t taiko_DB_variant_devices[] = {
SND_DEVICE_OUT_SPEAKER,
SND_DEVICE_OUT_SPEAKER_AND_HEADPHONES,
@@ -173,6 +198,37 @@
}
}
+static void update_hardware_info_8994(struct hardware_info *hw_info, const char *snd_card_name)
+{
+ if (!strcmp(snd_card_name, "msm8994-tomtom-mtp-snd-card")) {
+ strlcpy(hw_info->type, " mtp", sizeof(hw_info->type));
+ strlcpy(hw_info->name, "msm8994", 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, "msm8994-tomtom-cdp-snd-card ")) {
+ strlcpy(hw_info->type, " cdp", sizeof(hw_info->type));
+ strlcpy(hw_info->name, "msm8994", sizeof(hw_info->name));
+ hw_info->snd_devices = (snd_device_t *)tomtom_msm8994_CDP_variant_devices;
+ hw_info->num_snd_devices = ARRAY_SIZE(tomtom_msm8994_CDP_variant_devices);
+ strlcpy(hw_info->dev_extn, "-cdp", sizeof(hw_info->dev_extn));
+ } else if (!strcmp(snd_card_name, "msm8994-tomtom-stp-snd-card ")) {
+ strlcpy(hw_info->type, " stp", sizeof(hw_info->type));
+ strlcpy(hw_info->name, "msm8994", sizeof(hw_info->name));
+ hw_info->snd_devices = (snd_device_t *)tomtom_stp_variant_devices;
+ hw_info->num_snd_devices = ARRAY_SIZE(tomtom_stp_variant_devices);
+ strlcpy(hw_info->dev_extn, "-stp", sizeof(hw_info->dev_extn));
+ } else if (!strcmp(snd_card_name, "msm8994-tomtom-liquid-snd-card ")) {
+ strlcpy(hw_info->type, " liquid", sizeof(hw_info->type));
+ strlcpy(hw_info->name, "msm8994", sizeof(hw_info->name));
+ hw_info->snd_devices = (snd_device_t *)tomtom_liquid_variant_devices;
+ hw_info->num_snd_devices = ARRAY_SIZE(tomtom_liquid_variant_devices);
+ strlcpy(hw_info->dev_extn, "-liquid", sizeof(hw_info->dev_extn));
+ } else {
+ ALOGW("%s: Not an 8994 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")) {
@@ -273,6 +329,9 @@
hw_info = malloc(sizeof(struct hardware_info));
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));
if(strstr(snd_card_name, "msm8974") ||
strstr(snd_card_name, "apq8074")) {
@@ -287,6 +346,9 @@
} else if(strstr(snd_card_name, "apq8084")) {
ALOGV("8084 - variant soundcard");
update_hardware_info_8084(hw_info, snd_card_name);
+ } else if(strstr(snd_card_name, "msm8994")) {
+ ALOGV("8994 - variant soundcard");
+ update_hardware_info_8994(hw_info, snd_card_name);
} else {
ALOGE("%s: Unsupported target %s:",__func__, snd_card_name);
free(hw_info);
diff --git a/hal/msm8974/platform.c b/hal/msm8974/platform.c
index b86b15e..ac747e4 100644
--- a/hal/msm8974/platform.c
+++ b/hal/msm8974/platform.c
@@ -74,6 +74,9 @@
/* EDID format ID for LPCM audio */
#define EDID_FORMAT_LPCM 1
+/* fallback app type if the default app type from acdb loader fails */
+#define DEFAULT_APP_TYPE 0x11130
+
/* Retry for delay in FW loading*/
#define RETRY_NUMBER 10
#define RETRY_US 500000
@@ -101,9 +104,10 @@
/* Audio calibration related functions */
typedef void (*acdb_deallocate_t)();
typedef int (*acdb_init_t)(char *);
-typedef void (*acdb_send_audio_cal_t)(int, int);
+typedef void (*acdb_send_audio_cal_t)(int, int, int , int);
typedef void (*acdb_send_voice_cal_t)(int, int);
typedef int (*acdb_reload_vocvoltable_t)(int);
+typedef int (*acdb_get_default_app_type_t)(void);
struct platform_data {
struct audio_device *adev;
@@ -125,6 +129,7 @@
acdb_send_audio_cal_t acdb_send_audio_cal;
acdb_send_voice_cal_t acdb_send_voice_cal;
acdb_reload_vocvoltable_t acdb_reload_vocvoltable;
+ acdb_get_default_app_type_t acdb_get_default_app_type;
void *hw_info;
struct csd_data *csd;
@@ -743,7 +748,7 @@
__func__, LIB_ACDB_LOADER);
my_data->acdb_send_audio_cal = (acdb_send_audio_cal_t)dlsym(my_data->acdb_handle,
- "acdb_loader_send_audio_cal");
+ "acdb_loader_send_audio_cal_v2");
if (!my_data->acdb_send_audio_cal)
ALOGE("%s: Could not find the symbol acdb_send_audio_cal from %s",
__func__, LIB_ACDB_LOADER);
@@ -760,6 +765,13 @@
ALOGE("%s: Could not find the symbol acdb_loader_reload_vocvoltable from %s",
__func__, LIB_ACDB_LOADER);
+ my_data->acdb_get_default_app_type = (acdb_get_default_app_type_t)dlsym(
+ my_data->acdb_handle,
+ "acdb_loader_get_default_app_type");
+ if (!my_data->acdb_get_default_app_type)
+ ALOGE("%s: Could not find the symbol acdb_get_default_app_type from %s",
+ __func__, LIB_ACDB_LOADER);
+
my_data->acdb_init = (acdb_init_t)dlsym(my_data->acdb_handle,
"acdb_loader_init_v2");
if (my_data->acdb_init == NULL)
@@ -970,6 +982,16 @@
return ret;
}
+int platform_get_default_app_type(void *platform)
+{
+ struct platform_data *my_data = (struct platform_data *)platform;
+
+ if (my_data->acdb_get_default_app_type)
+ return my_data->acdb_get_default_app_type();
+ else
+ return DEFAULT_APP_TYPE;
+}
+
int platform_get_snd_device_acdb_id(snd_device_t snd_device)
{
if ((snd_device < SND_DEVICE_MIN) || (snd_device >= SND_DEVICE_MAX)) {
@@ -979,7 +1001,8 @@
return acdb_device_table[snd_device];
}
-int platform_send_audio_calibration(void *platform, snd_device_t snd_device)
+int platform_send_audio_calibration(void *platform, snd_device_t snd_device,
+ int app_type, int sample_rate)
{
struct platform_data *my_data = (struct platform_data *)platform;
int acdb_dev_id, acdb_dev_type;
@@ -991,14 +1014,15 @@
return -EINVAL;
}
if (my_data->acdb_send_audio_cal) {
- ("%s: sending audio calibration for snd_device(%d) acdb_id(%d)",
+ ALOGV("%s: sending audio calibration for snd_device(%d) acdb_id(%d)",
__func__, snd_device, acdb_dev_id);
if (snd_device >= SND_DEVICE_OUT_BEGIN &&
snd_device < SND_DEVICE_OUT_END)
acdb_dev_type = ACDB_DEV_TYPE_OUT;
else
acdb_dev_type = ACDB_DEV_TYPE_IN;
- my_data->acdb_send_audio_cal(acdb_dev_id, acdb_dev_type);
+ my_data->acdb_send_audio_cal(acdb_dev_id, acdb_dev_type, app_type,
+ sample_rate);
}
return 0;
}
diff --git a/hal/msm8974/platform.h b/hal/msm8974/platform.h
index ba89c1b..d7d1944 100644
--- a/hal/msm8974/platform.h
+++ b/hal/msm8974/platform.h
@@ -243,12 +243,18 @@
#define VOLTE_CALL_PCM_DEVICE 15
#define QCHAT_CALL_PCM_DEVICE 14
#define VOWLAN_CALL_PCM_DEVICE -1
+#elif PLATFORM_MSM8994
+#define VOICE_CALL_PCM_DEVICE 2
+#define VOICE2_CALL_PCM_DEVICE 22
+#define VOLTE_CALL_PCM_DEVICE 14
+#define QCHAT_CALL_PCM_DEVICE 20
+#define VOWLAN_CALL_PCM_DEVICE 36
#else
#define VOICE_CALL_PCM_DEVICE 2
#define VOICE2_CALL_PCM_DEVICE 22
#define VOLTE_CALL_PCM_DEVICE 14
#define QCHAT_CALL_PCM_DEVICE 20
-#define VOWLAN_CALL_PCM_DEVICE -1
+#define VOWLAN_CALL_PCM_DEVICE 36
#endif
#ifdef PLATFORM_MSM8x26
diff --git a/hal/platform_api.h b/hal/platform_api.h
index 15deea5..1e97adf 100644
--- a/hal/platform_api.h
+++ b/hal/platform_api.h
@@ -32,7 +32,9 @@
int platform_get_fluence_type(void *platform, char *value, uint32_t len);
int platform_set_snd_device_acdb_id(snd_device_t snd_device, unsigned int acdb_id);
int platform_get_snd_device_acdb_id(snd_device_t snd_device);
-int platform_send_audio_calibration(void *platform, snd_device_t snd_device);
+int platform_send_audio_calibration(void *platform, snd_device_t snd_device,
+ int app_type, int sample_rate);
+int platform_get_default_app_type(void *platform);
int platform_switch_voice_call_device_pre(void *platform);
int platform_switch_voice_call_enable_device_config(void *platform,
snd_device_t out_snd_device,
diff --git a/policy_hal/AudioPolicyManager.cpp b/policy_hal/AudioPolicyManager.cpp
index b679fdb..a8cbcda 100644
--- a/policy_hal/AudioPolicyManager.cpp
+++ b/policy_hal/AudioPolicyManager.cpp
@@ -1558,8 +1558,8 @@
0 /* ignored */);
}
}
- mPrevPhoneState = oldState;
#endif
+ mPrevPhoneState = oldState;
int delayMs = 0;
if (isStateInCall(state)) {
@@ -1609,6 +1609,12 @@
ALOGD(" End of setPhoneState ... mPhoneState: %d ",mPhoneState);
}
+bool AudioPolicyManager::isStateInCall(int state)
+{
+ return ((state == AudioSystem::MODE_IN_CALL) || (state == AudioSystem::MODE_IN_COMMUNICATION) ||
+ ((state == AudioSystem::MODE_RINGTONE) && (mPrevPhoneState == AudioSystem::MODE_IN_CALL)));
+}
+
extern "C" AudioPolicyInterface* createAudioPolicyManager(AudioPolicyClientInterface *clientInterface)
{
return new AudioPolicyManager(clientInterface);
diff --git a/policy_hal/AudioPolicyManager.h b/policy_hal/AudioPolicyManager.h
index dce5bad..ab57768 100644
--- a/policy_hal/AudioPolicyManager.h
+++ b/policy_hal/AudioPolicyManager.h
@@ -61,6 +61,9 @@
virtual bool isOffloadSupported(const audio_offload_info_t& offloadInfo);
virtual void setPhoneState(int state);
+
+ // true if given state represents a device in a telephony or VoIP call
+ virtual bool isStateInCall(int state);
protected:
// return the strategy corresponding to a given stream type
static routing_strategy getStrategy(AudioSystem::stream_type stream);