Loading hal/msm8916/platform.c +25 −11 Original line number Diff line number Diff line Loading @@ -709,7 +709,9 @@ static void update_codec_type(const char *snd_card_name) { !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; } Loading Loading @@ -4016,32 +4018,33 @@ int platform_get_subsys_image_name(char *buf) /* * 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++) { Loading @@ -4049,11 +4052,22 @@ int platform_set_audio_device_interface(const char * device_name, size_t name_len = strlen(name); if ((name_len == device_name_len) && (strncmp(device_name, name, name_len) == 0)) { 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, 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; } } Loading hal/msm8960/platform.c +2 −1 Original line number Diff line number Diff line Loading @@ -1155,7 +1155,8 @@ int platform_set_device_params(struct stream_out *out __unused, } 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; } hal/msm8974/platform.c +2 −1 Original line number Diff line number Diff line Loading @@ -3757,7 +3757,8 @@ struct audio_device_to_audio_interface audio_device_to_interface_table[] = { 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; Loading hal/platform_api.h +2 −1 Original line number Diff line number Diff line Loading @@ -109,5 +109,6 @@ void platform_cache_edid(void * platform); 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 hal/platform_info.c +10 −2 Original line number Diff line number Diff line Loading @@ -87,7 +87,7 @@ static section_t section; * ... * </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> Loading Loading @@ -262,7 +262,15 @@ static void process_interface_name(const XML_Char **attr) 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__); Loading Loading
hal/msm8916/platform.c +25 −11 Original line number Diff line number Diff line Loading @@ -709,7 +709,9 @@ static void update_codec_type(const char *snd_card_name) { !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; } Loading Loading @@ -4016,32 +4018,33 @@ int platform_get_subsys_image_name(char *buf) /* * 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++) { Loading @@ -4049,11 +4052,22 @@ int platform_set_audio_device_interface(const char * device_name, size_t name_len = strlen(name); if ((name_len == device_name_len) && (strncmp(device_name, name, name_len) == 0)) { 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, 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; } } Loading
hal/msm8960/platform.c +2 −1 Original line number Diff line number Diff line Loading @@ -1155,7 +1155,8 @@ int platform_set_device_params(struct stream_out *out __unused, } 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; }
hal/msm8974/platform.c +2 −1 Original line number Diff line number Diff line Loading @@ -3757,7 +3757,8 @@ struct audio_device_to_audio_interface audio_device_to_interface_table[] = { 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; Loading
hal/platform_api.h +2 −1 Original line number Diff line number Diff line Loading @@ -109,5 +109,6 @@ void platform_cache_edid(void * platform); 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
hal/platform_info.c +10 −2 Original line number Diff line number Diff line Loading @@ -87,7 +87,7 @@ static section_t section; * ... * </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> Loading Loading @@ -262,7 +262,15 @@ static void process_interface_name(const XML_Char **attr) 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__); Loading