Merge "hal: Fix incorrect fluence devices selection for VoIP calls"
diff --git a/hal/msm8916/platform.c b/hal/msm8916/platform.c
index 65accc0..4a4c6a1 100644
--- a/hal/msm8916/platform.c
+++ b/hal/msm8916/platform.c
@@ -141,6 +141,19 @@
#define AUDIO_PARAMETER_KEY_REC_PLAY_CONC "rec_play_conc_on"
+#define AUDIO_PARAMETER_IS_HW_DECODER_SESSION_ALLOWED "is_hw_dec_session_allowed"
+
+#define MAX_DSP_ONLY_DECODERS 6
+
+char * dsp_only_decoders_mime[] = {
+ "audio/x-ms-wma" /* wma*/ ,
+ "audio/x-ms-wma-lossless" /* wma lossless */ ,
+ "audio/x-ms-wma-pro" /* wma prop */ ,
+ "audio/amr-wb-plus" /* amr wb plus */ ,
+ "audio/alac" /*alac */ ,
+ "audio/x-ape" /*ape */,
+};
+
enum {
VOICE_FEATURE_SET_DEFAULT,
VOICE_FEATURE_SET_VOLUME_BOOST
@@ -709,7 +722,9 @@
!strncmp(snd_card_name, "msm8939-tapan9302-snd-card",
sizeof("msm8939-tapan9302-snd-card"))||
!strncmp(snd_card_name, "msm8939-tomtom9330-snd-card",
- sizeof("msm8939-tomtom9330-snd-card"))) {
+ sizeof("msm8939-tomtom9330-snd-card")) ||
+ !strncmp(snd_card_name, "msm8952-tomtom-snd-card",
+ sizeof("msm8952-tomtom-snd-card"))) {
ALOGI("%s: snd_card_name: %s",__func__,snd_card_name);
is_external_codec = true;
}
@@ -1192,6 +1207,8 @@
const char *snd_card_name;
char mixer_xml_path[100],ffspEnable[PROPERTY_VALUE_MAX];
char *cvd_version = NULL;
+ const char *mixer_ctl_name = "Set HPX ActiveBe";
+ struct mixer_ctl *ctl = NULL;
my_data = calloc(1, sizeof(struct platform_data));
if (!my_data) {
@@ -1399,6 +1416,13 @@
closedir(dir);
}
+ /* Configure active back end for HPX*/
+ ctl = mixer_get_ctl_by_name(adev->mixer, mixer_ctl_name);
+ if (ctl) {
+ ALOGE(" sending HPX Active BE information ");
+ mixer_ctl_set_value(ctl, 0, is_external_codec);
+ }
+
acdb_init_fail:
set_platform_defaults();
@@ -3069,6 +3093,32 @@
str_parms_add_str(reply, AUDIO_PARAMETER_KEY_VOLUME_BOOST, value);
}
+ ret = str_parms_get_str(query, AUDIO_PARAMETER_IS_HW_DECODER_SESSION_ALLOWED,
+ value, sizeof(value));
+
+ if (ret >= 0) {
+ int isallowed = 1; /*true*/
+
+ if(voice_is_in_call(my_data->adev)) {
+ char *decoder_mime_type = value;
+
+ //check if unsupported mime type or not
+ if(decoder_mime_type) {
+ int i = 0;
+ for (i = 0; i < sizeof(dsp_only_decoders_mime)/sizeof(dsp_only_decoders_mime[0]); i++) {
+ if (!strncmp(decoder_mime_type, dsp_only_decoders_mime[i],
+ strlen(dsp_only_decoders_mime[i]))) {
+ ALOGE("Rejecting request for DSP only session from HAL during voice call");
+ isallowed = 0;
+ break;
+ }
+ }
+ }
+ }
+ str_parms_add_int(reply, AUDIO_PARAMETER_IS_HW_DECODER_SESSION_ALLOWED, isallowed);
+ }
+
+
/* Handle audio calibration keys */
kv_pairs = str_parms_to_str(reply);
ALOGV("%s: exit: returns - %s", __func__, kv_pairs);
@@ -4019,32 +4069,33 @@
/*
* This is a lookup table to map android audio input device to audio h/w interface (backend).
* The table can be extended for other input devices by adding appropriate entries.
- * Also the audio interface for a particular input device can be overriden by adding
- * corresponding entry in audio_platform_info.xml file.
+ * The audio interface for a particular input device need to be added in
+ * audio_platform_info.xml file.
*/
struct audio_device_to_audio_interface audio_device_to_interface_table[] = {
- {AUDIO_DEVICE_IN_BUILTIN_MIC, ENUM_TO_STRING(AUDIO_DEVICE_IN_BUILTIN_MIC), "TERT_MI2S"},
- {AUDIO_DEVICE_IN_BACK_MIC, ENUM_TO_STRING(AUDIO_DEVICE_IN_BACK_MIC), "TERT_MI2S"},
+ {AUDIO_DEVICE_IN_BUILTIN_MIC, ENUM_TO_STRING(AUDIO_DEVICE_IN_BUILTIN_MIC), ""},
+ {AUDIO_DEVICE_IN_BACK_MIC, ENUM_TO_STRING(AUDIO_DEVICE_IN_BACK_MIC), ""},
};
int audio_device_to_interface_table_len =
sizeof(audio_device_to_interface_table) / sizeof(audio_device_to_interface_table[0]);
-
int platform_set_audio_device_interface(const char * device_name,
- const char *intf_name)
+ const char *intf_name,
+ const char *codec_type)
{
int ret = 0;
int i;
- if (device_name == NULL || intf_name == NULL) {
+ if (device_name == NULL || intf_name == NULL || codec_type == NULL) {
ALOGE("%s: Invalid input", __func__);
ret = -EINVAL;
goto done;
}
- ALOGD("%s: Enter, device name:%s, intf name:%s", __func__, device_name, intf_name);
+ ALOGD("%s: Enter, device name:%s, intf name:%s, codec_type:%s", __func__,
+ device_name, intf_name, codec_type);
size_t device_name_len = strlen(device_name);
for (i = 0; i < audio_device_to_interface_table_len; i++) {
@@ -4052,11 +4103,22 @@
size_t name_len = strlen(name);
if ((name_len == device_name_len) &&
(strncmp(device_name, name, name_len) == 0)) {
- ALOGD("%s: Matched device name:%s, overwrite intf name with %s",
+ if (is_external_codec &&
+ (strncmp(codec_type, "external", strlen(codec_type)) == 0)) {
+ ALOGD("%s: Matched device name:%s, overwrite intf name with %s",
__func__, device_name, intf_name);
- strlcpy(audio_device_to_interface_table[i].interface_name, intf_name,
+ strlcpy(audio_device_to_interface_table[i].interface_name, intf_name,
sizeof(audio_device_to_interface_table[i].interface_name));
+ } else if (!is_external_codec &&
+ (strncmp(codec_type, "internal", strlen(codec_type)) == 0)) {
+ ALOGD("%s: Matched device name:%s, overwrite intf name with %s",
+ __func__, device_name, intf_name);
+
+ strlcpy(audio_device_to_interface_table[i].interface_name, intf_name,
+ sizeof(audio_device_to_interface_table[i].interface_name));
+ } else
+ ALOGE("Invalid codec_type specified. Ignoring this interface entry.");
goto done;
}
}
diff --git a/hal/msm8960/platform.c b/hal/msm8960/platform.c
index bbfa042..e5ecda1 100644
--- a/hal/msm8960/platform.c
+++ b/hal/msm8960/platform.c
@@ -230,6 +230,8 @@
char value[PROPERTY_VALUE_MAX];
struct platform_data *my_data;
const char *snd_card_name;
+ const char *mixer_ctl_name = "Set HPX ActiveBe";
+ struct mixer_ctl *ctl = NULL;
adev->mixer = mixer_open(MIXER_CARD);
@@ -340,6 +342,13 @@
}
}
+ /* Configure active back end for HPX*/
+ ctl = mixer_get_ctl_by_name(adev->mixer, mixer_ctl_name);
+ if (ctl) {
+ ALOGI(" sending HPX Active BE information ");
+ mixer_ctl_set_value(ctl, 0, false);
+ }
+
return my_data;
}
@@ -1155,7 +1164,8 @@
}
int platform_set_audio_device_interface(const char * device_name __unused,
- const char *intf_name __unused)
+ const char *intf_name __unused,
+ const char *codec_type __unused)
{
return -ENOSYS;
}
diff --git a/hal/msm8974/platform.c b/hal/msm8974/platform.c
index 24e23e6..9c1115c 100644
--- a/hal/msm8974/platform.c
+++ b/hal/msm8974/platform.c
@@ -1028,6 +1028,8 @@
char *snd_internal_name = NULL;
char *tmp = NULL;
char mixer_xml_file[MIXER_PATH_MAX_LENGTH]= {0};
+ const char *mixer_ctl_name = "Set HPX ActiveBe";
+ struct mixer_ctl *ctl = NULL;
my_data = calloc(1, sizeof(struct platform_data));
@@ -1250,6 +1252,13 @@
free(cvd_version);
}
+ /* Configure active back end for HPX*/
+ ctl = mixer_get_ctl_by_name(adev->mixer, mixer_ctl_name);
+ if (ctl) {
+ ALOGI(" sending HPX Active BE information ");
+ mixer_ctl_set_value(ctl, 0, true);
+ }
+
acdb_init_fail:
set_platform_defaults();
@@ -3757,7 +3766,8 @@
int audio_device_to_interface_table_len =
sizeof(audio_device_to_interface_table) / sizeof(audio_device_to_interface_table[0]);
-int platform_set_audio_device_interface(const char *device_name, const char *intf_name)
+int platform_set_audio_device_interface(const char *device_name, const char *intf_name,
+ const char *codec_type __unused)
{
int ret = 0;
int i;
diff --git a/hal/platform_api.h b/hal/platform_api.h
index 3808b14..4ecdd36 100644
--- a/hal/platform_api.h
+++ b/hal/platform_api.h
@@ -109,5 +109,6 @@
void platform_invalidate_edid(void * platform);
int platform_set_hdmi_config(struct stream_out *out);
int platform_set_device_params(struct stream_out *out, int param, int value);
-int platform_set_audio_device_interface(const char * device_name, const char *intf_name);
+int platform_set_audio_device_interface(const char * device_name, const char *intf_name,
+ const char * codec_type);
#endif // AUDIO_PLATFORM_API_H
diff --git a/hal/platform_info.c b/hal/platform_info.c
index 13a314e..b65411f 100644
--- a/hal/platform_info.c
+++ b/hal/platform_info.c
@@ -87,7 +87,7 @@
* ...
* </pcm_ids>
* <interface_names>
- * <device name="Use audio device name here, not sound device name" interface="PRIMARY_I2S"/>
+ * <device name="Use audio device name here, not sound device name" interface="PRIMARY_I2S" codec_type="external/internal"/>
* ...
* ...
* </interface_names>
@@ -262,7 +262,15 @@
goto done;
}
- ret = platform_set_audio_device_interface((char *)attr[1], (char *)attr[3]);
+ if (strcmp(attr[4], "codec_type") != 0) {
+ ALOGE("%s: Device %s has no codec type set!",
+ __func__, attr[1]);
+
+ goto done;
+ }
+
+ ret = platform_set_audio_device_interface((char *)attr[1], (char *)attr[3],
+ (char *)attr[5]);
if (ret < 0) {
ALOGE("%s: Audio Interface not set!", __func__);