Loading hal/Android.mk +0 −5 Original line number Diff line number Diff line Loading @@ -347,11 +347,6 @@ ifeq ($(strip $(AUDIO_FEATURE_ENABLED_GCOV)),true) LOCAL_STATIC_LIBRARIES += libprofile_rt endif #ifeq ($(strip $(AUDIO_FEATURE_ENABLED_AUTO_HAL)),true) # LOCAL_CFLAGS += -DAUDIO_EXTN_AUTO_HAL_ENABLED # LOCAL_SRC_FILES += audio_extn/auto_hal.c #endif LOCAL_SHARED_LIBRARIES += libbase libhidlbase libhwbinder libutils android.hardware.power@1.2 liblog LOCAL_SRC_FILES += audio_perf.cpp Loading hal/audio_extn/Android.mk +56 −0 Original line number Diff line number Diff line Loading @@ -823,4 +823,60 @@ LOCAL_HEADER_LIBRARIES += libhardware_headers LOCAL_HEADER_LIBRARIES += libsystem_headers include $(BUILD_SHARED_LIBRARY) #------------------------------------------- # Build AUTO_HAL LIB #------------------------------------------- include $(CLEAR_VARS) LOCAL_MODULE := libautohal LOCAL_VENDOR_MODULE := true PRIMARY_HAL_PATH := vendor/qcom/opensource/audio-hal/primary-hal/hal AUDIO_PLATFORM := $(TARGET_BOARD_PLATFORM) ifneq ($(filter sdm845 sdm710 sdmshrike msmnile kona lito atoll sdm660 msm8937 msm8998 $(MSMSTEPPE) $(TRINKET),$(TARGET_BOARD_PLATFORM)),) # B-family platform uses msm8974 code base AUDIO_PLATFORM := msm8974 MULTIPLE_HW_VARIANTS_ENABLED := true endif LOCAL_SRC_FILES:= \ auto_hal.c LOCAL_CFLAGS += \ -Wall \ -Werror \ -Wno-unused-function \ -Wno-unused-variable LOCAL_SHARED_LIBRARIES := \ libaudioutils \ libcutils \ libdl \ libexpat \ liblog LOCAL_C_INCLUDES := \ $(PRIMARY_HAL_PATH) \ $(PRIMARY_HAL_PATH)/$(AUDIO_PLATFORM) \ external/tinyalsa/include \ external/tinycompress/include \ external/expat/lib \ system/media/audio_utils/include \ $(call include-path-for, audio-route) \ LOCAL_C_INCLUDES += $(TARGET_OUT_INTERMEDIATES)/KERNEL_OBJ/usr/include LOCAL_C_INCLUDES += $(TARGET_OUT_INTERMEDIATES)/KERNEL_OBJ/usr/techpack/audio/include LOCAL_ADDITIONAL_DEPENDENCIES += $(TARGET_OUT_INTERMEDIATES)/KERNEL_OBJ/usr ifeq ($(strip $(AUDIO_FEATURE_ENABLED_DLKM)),true) LOCAL_HEADER_LIBRARIES += audio_kernel_headers LOCAL_C_INCLUDES += $(TARGET_OUT_INTERMEDIATES)/vendor/qcom/opensource/audio-kernel/include LOCAL_ADDITIONAL_DEPENDENCIES += $(BOARD_VENDOR_KERNEL_MODULES) endif LOCAL_HEADER_LIBRARIES += libhardware_headers LOCAL_HEADER_LIBRARIES += libsystem_headers include $(BUILD_SHARED_LIBRARY) hal/audio_extn/audio_extn.c +223 −2 Original line number Diff line number Diff line Loading @@ -4639,8 +4639,8 @@ void* audio_extn_ext_hw_plugin_init(struct audio_device *adev) { if(ext_hw_plugin_init) { ext_hw_plugin_init_config_t ext_hw_plugin_init_config; ext_hw_plugin_init_config.fp_audio_route_apply_and_update_path = audio_route_apply_and_update_path; ext_hw_plugin_init_config.fp_b64decode = b64decode; ext_hw_plugin_init_config.fp_b64encode = b64encode; return ext_hw_plugin_init(adev, ext_hw_plugin_init_config); } else Loading Loading @@ -5391,6 +5391,224 @@ bool audio_extn_ma_supported_usb() } // END: MAXX_AUDIO ===================================================================== // START: AUTO_HAL =================================================================== #ifdef __LP64__ #define AUTO_HAL_LIB_PATH "/vendor/lib64/libautohal.so" #else #define AUTO_HAL_LIB_PATH "/vendor/lib/libautohal.so" #endif static void *auto_hal_lib_handle = NULL; typedef int (*auto_hal_init_t)(struct audio_device*, auto_hal_init_config_t); static auto_hal_init_t auto_hal_init; typedef void (*auto_hal_deinit_t)(); static auto_hal_deinit_t auto_hal_deinit; typedef int (*auto_hal_create_audio_patch_t)(struct audio_hw_device*, unsigned int, const struct audio_port_config*, unsigned int, const struct audio_port_config*, audio_patch_handle_t*); static auto_hal_create_audio_patch_t auto_hal_create_audio_patch; typedef int (*auto_hal_release_audio_patch_t)(struct audio_hw_device*, audio_patch_handle_t); static auto_hal_release_audio_patch_t auto_hal_release_audio_patch; typedef int (*auto_hal_get_car_audio_stream_from_address_t)(const char*); static auto_hal_get_car_audio_stream_from_address_t auto_hal_get_car_audio_stream_from_address; typedef int (*auto_hal_open_output_stream_t)(struct stream_out*); static auto_hal_open_output_stream_t auto_hal_open_output_stream; typedef bool (*auto_hal_is_bus_device_usecase_t)(audio_usecase_t); static auto_hal_is_bus_device_usecase_t auto_hal_is_bus_device_usecase; typedef snd_device_t (*auto_hal_get_snd_device_for_car_audio_stream_t)( struct stream_out*); static auto_hal_get_snd_device_for_car_audio_stream_t auto_hal_get_snd_device_for_car_audio_stream; typedef int (*auto_hal_get_audio_port_t)(struct audio_hw_device*, struct audio_port*); static auto_hal_get_audio_port_t auto_hal_get_audio_port; typedef int (*auto_hal_set_audio_port_config_t)(struct audio_hw_device*, const struct audio_port_config*); static auto_hal_set_audio_port_config_t auto_hal_set_audio_port_config; typedef void (*auto_hal_set_parameters_t)(struct audio_device*, struct str_parms*); static auto_hal_set_parameters_t auto_hal_set_parameters; int auto_hal_feature_init(bool is_feature_enabled) { ALOGD("%s: Called with feature %s", __func__, is_feature_enabled ? "Enabled" : "NOT Enabled"); if (is_feature_enabled) { // dlopen lib auto_hal_lib_handle = dlopen(AUTO_HAL_LIB_PATH, RTLD_NOW); if (!auto_hal_lib_handle) { ALOGE("%s: dlopen failed", __func__); goto feature_disabled; } if (!(auto_hal_init = (auto_hal_init_t)dlsym( auto_hal_lib_handle, "auto_hal_init")) || !(auto_hal_deinit = (auto_hal_deinit_t)dlsym( auto_hal_lib_handle, "auto_hal_deinit")) || !(auto_hal_create_audio_patch = (auto_hal_create_audio_patch_t)dlsym( auto_hal_lib_handle, "auto_hal_create_audio_patch")) || !(auto_hal_release_audio_patch = (auto_hal_release_audio_patch_t)dlsym( auto_hal_lib_handle, "auto_hal_release_audio_patch")) || !(auto_hal_get_car_audio_stream_from_address = (auto_hal_get_car_audio_stream_from_address_t)dlsym( auto_hal_lib_handle, "auto_hal_get_car_audio_stream_from_address")) || !(auto_hal_open_output_stream = (auto_hal_open_output_stream_t)dlsym( auto_hal_lib_handle, "auto_hal_open_output_stream")) || !(auto_hal_is_bus_device_usecase = (auto_hal_is_bus_device_usecase_t)dlsym( auto_hal_lib_handle, "auto_hal_is_bus_device_usecase")) || !(auto_hal_get_snd_device_for_car_audio_stream = (auto_hal_get_snd_device_for_car_audio_stream_t)dlsym( auto_hal_lib_handle, "auto_hal_get_snd_device_for_car_audio_stream")) || !(auto_hal_get_audio_port = (auto_hal_get_audio_port_t)dlsym( auto_hal_lib_handle, "auto_hal_get_audio_port")) || !(auto_hal_set_audio_port_config = (auto_hal_set_audio_port_config_t)dlsym( auto_hal_lib_handle, "auto_hal_set_audio_port_config")) || !(auto_hal_set_parameters = (auto_hal_set_parameters_t)dlsym( auto_hal_lib_handle, "auto_hal_set_parameters"))) { ALOGE("%s: dlsym failed", __func__); goto feature_disabled; } ALOGD("%s:: ---- Feature AUTO_HAL is Enabled ----", __func__); return 0; } feature_disabled: if (auto_hal_lib_handle) { dlclose(auto_hal_lib_handle); auto_hal_lib_handle = NULL; } auto_hal_init = NULL; auto_hal_deinit = NULL; auto_hal_create_audio_patch = NULL; auto_hal_release_audio_patch = NULL; auto_hal_get_car_audio_stream_from_address = NULL; auto_hal_open_output_stream = NULL; auto_hal_is_bus_device_usecase = NULL; auto_hal_get_snd_device_for_car_audio_stream = NULL; auto_hal_get_audio_port = NULL; auto_hal_set_audio_port_config = NULL; auto_hal_set_parameters = NULL; ALOGW(":: %s: ---- Feature AUTO_HAL is disabled ----", __func__); return -ENOSYS; } int audio_extn_auto_hal_init(struct audio_device *adev) { if(auto_hal_init) { auto_hal_init_config_t auto_hal_init_config; auto_hal_init_config.fp_in_get_stream = in_get_stream; auto_hal_init_config.fp_out_get_stream = out_get_stream; auto_hal_init_config.fp_audio_extn_ext_hw_plugin_usecase_start = audio_extn_ext_hw_plugin_usecase_start; auto_hal_init_config.fp_audio_extn_ext_hw_plugin_usecase_stop = audio_extn_ext_hw_plugin_usecase_stop; auto_hal_init_config.fp_get_usecase_from_list = get_usecase_from_list; auto_hal_init_config.fp_get_output_period_size = get_output_period_size; auto_hal_init_config.fp_audio_extn_ext_hw_plugin_set_audio_gain = audio_extn_ext_hw_plugin_set_audio_gain; return auto_hal_init(adev, auto_hal_init_config); } else return 0; } void audio_extn_auto_hal_deinit() { if (auto_hal_deinit) auto_hal_deinit(); } int audio_extn_auto_hal_create_audio_patch(struct audio_hw_device *dev, unsigned int num_sources, const struct audio_port_config *sources, unsigned int num_sinks, const struct audio_port_config *sinks, audio_patch_handle_t *handle) { return ((auto_hal_create_audio_patch) ? auto_hal_create_audio_patch(dev, num_sources, sources, num_sinks, sinks, handle): 0); } int audio_extn_auto_hal_release_audio_patch(struct audio_hw_device *dev, audio_patch_handle_t handle) { return ((auto_hal_release_audio_patch) ? auto_hal_release_audio_patch(dev, handle): 0); } int audio_extn_auto_hal_get_car_audio_stream_from_address(const char *address) { return ((auto_hal_get_car_audio_stream_from_address) ? auto_hal_get_car_audio_stream_from_address(address): 0); } int audio_extn_auto_hal_open_output_stream(struct stream_out *out) { return ((auto_hal_open_output_stream) ? auto_hal_open_output_stream(out): 0); } bool audio_extn_auto_hal_is_bus_device_usecase(audio_usecase_t uc_id) { return ((auto_hal_is_bus_device_usecase) ? auto_hal_is_bus_device_usecase(uc_id): 0); } snd_device_t audio_extn_auto_hal_get_snd_device_for_car_audio_stream(struct stream_out *out) { return ((auto_hal_get_snd_device_for_car_audio_stream) ? auto_hal_get_snd_device_for_car_audio_stream(out): 0); } int audio_extn_auto_hal_get_audio_port(struct audio_hw_device *dev, struct audio_port *config) { return ((auto_hal_get_audio_port) ? auto_hal_get_audio_port(dev, config): 0); } int audio_extn_auto_hal_set_audio_port_config(struct audio_hw_device *dev, const struct audio_port_config *config) { return ((auto_hal_set_audio_port_config) ? auto_hal_set_audio_port_config(dev, config): 0); } void audio_extn_auto_hal_set_parameters(struct audio_device *adev, struct str_parms *parms) { if (auto_hal_set_parameters) auto_hal_set_parameters(adev, parms); } // END: AUTO_HAL =================================================================== void audio_extn_feature_init() { is_running_vendor_enhanced_fwk = audio_extn_utils_is_vendor_enhanced_fwk(); Loading Loading @@ -5506,6 +5724,9 @@ void audio_extn_feature_init() audiozoom_feature_init( property_get_bool("vendor.audio.feature.audiozoom.enable", true)); auto_hal_feature_init( property_get_bool("vendor.audio.feature.auto_hal.enable", false)); } void audio_extn_set_parameters(struct audio_device *adev, Loading hal/audio_extn/audio_extn.h +33 −24 Original line number Diff line number Diff line Loading @@ -706,10 +706,12 @@ int audio_extn_ext_hw_plugin_get_mic_mute(void *plugin, bool *mute); int audio_extn_ext_hw_plugin_set_audio_gain(void *plugin, struct audio_usecase *usecase, uint32_t gain); typedef int (*fp_audio_route_apply_and_update_path_t)(struct audio_route*, const char*); typedef int (*fp_b64decode_t)(char *inp, int ilen, uint8_t* outp); typedef int (*fp_b64encode_t)(uint8_t *inp, int ilen, char* outp); typedef struct ext_hw_plugin_init_config { fp_audio_route_apply_and_update_path_t fp_audio_route_apply_and_update_path; fp_b64decode_t fp_b64decode; fp_b64encode_t fp_b64encode; } ext_hw_plugin_init_config_t; // END: EXT_HW_PLUGIN FEATURE ================================================== Loading Loading @@ -1271,28 +1273,20 @@ void audio_extn_ffv_append_ec_ref_dev_name(char *device_name); int audio_extn_utils_get_license_params(const struct audio_device *adev, struct audio_license_params *lic_params); /* * TODO: AUTO TEAM to convert following feature flag to runtime flag enable */ #ifndef AUDIO_EXTN_AUTO_HAL_ENABLED #define audio_extn_auto_hal_init(adev) (0) #define audio_extn_auto_hal_deinit() (0) #define audio_extn_auto_hal_create_audio_patch(dev, num_sources,\ sources, num_sinks, sinks, handle) (0) #define audio_extn_auto_hal_release_audio_patch(dev, handle) (0) #define audio_extn_auto_hal_get_car_audio_stream_from_address(address) (-1) #define audio_extn_auto_hal_open_output_stream(out) (0) #define audio_extn_auto_hal_is_bus_device_usecase(uc_id) (0) #define audio_extn_auto_hal_get_snd_device_for_car_audio_stream(out) (0) #define audio_extn_auto_hal_get_audio_port(dev, config) (0) #define audio_extn_auto_hal_set_audio_port_config(dev, config) (0) #define audio_extn_auto_hal_set_parameters(adev, parms) (0) #else // START: AUTO_HAL FEATURE ================================================== #ifndef AUDIO_OUTPUT_FLAG_MEDIA #define AUDIO_OUTPUT_FLAG_MEDIA 0x100000 #endif #ifndef AUDIO_OUTPUT_FLAG_SYS_NOTIFICATION #define AUDIO_OUTPUT_FLAG_SYS_NOTIFICATION 0x200000 #endif #ifndef AUDIO_OUTPUT_FLAG_NAV_GUIDANCE #define AUDIO_OUTPUT_FLAG_NAV_GUIDANCE 0x400000 #endif #ifndef AUDIO_OUTPUT_FLAG_PHONE #define AUDIO_OUTPUT_FLAG_PHONE 0x800000 int32_t audio_extn_auto_hal_init(struct audio_device *adev); #endif int audio_extn_auto_hal_init(struct audio_device *adev); void audio_extn_auto_hal_deinit(void); int audio_extn_auto_hal_create_audio_patch(struct audio_hw_device *dev, unsigned int num_sources, Loading @@ -1302,8 +1296,8 @@ int audio_extn_auto_hal_create_audio_patch(struct audio_hw_device *dev, audio_patch_handle_t *handle); int audio_extn_auto_hal_release_audio_patch(struct audio_hw_device *dev, audio_patch_handle_t handle); int32_t audio_extn_auto_hal_get_car_audio_stream_from_address(const char *address); int32_t audio_extn_auto_hal_open_output_stream(struct stream_out *out); int audio_extn_auto_hal_get_car_audio_stream_from_address(const char *address); int audio_extn_auto_hal_open_output_stream(struct stream_out *out); bool audio_extn_auto_hal_is_bus_device_usecase(audio_usecase_t uc_id); snd_device_t audio_extn_auto_hal_get_snd_device_for_car_audio_stream(struct stream_out *out); int audio_extn_auto_hal_get_audio_port(struct audio_hw_device *dev, Loading @@ -1312,7 +1306,22 @@ int audio_extn_auto_hal_set_audio_port_config(struct audio_hw_device *dev, const struct audio_port_config *config); void audio_extn_auto_hal_set_parameters(struct audio_device *adev, struct str_parms *parms); #endif typedef streams_input_ctxt_t* (*fp_in_get_stream_t)(struct audio_device*, audio_io_handle_t); typedef streams_output_ctxt_t* (*fp_out_get_stream_t)(struct audio_device*, audio_io_handle_t); typedef size_t (*fp_get_output_period_size_t)(uint32_t, audio_format_t, int, int); typedef int (*fp_audio_extn_ext_hw_plugin_set_audio_gain_t)(void*, struct audio_usecase*, uint32_t); typedef struct auto_hal_init_config { fp_in_get_stream_t fp_in_get_stream; fp_out_get_stream_t fp_out_get_stream; fp_audio_extn_ext_hw_plugin_usecase_start_t fp_audio_extn_ext_hw_plugin_usecase_start; fp_audio_extn_ext_hw_plugin_usecase_stop_t fp_audio_extn_ext_hw_plugin_usecase_stop; fp_get_usecase_from_list_t fp_get_usecase_from_list; fp_get_output_period_size_t fp_get_output_period_size; fp_audio_extn_ext_hw_plugin_set_audio_gain_t fp_audio_extn_ext_hw_plugin_set_audio_gain; } auto_hal_init_config_t; // END: AUTO_HAL FEATURE ================================================== bool audio_extn_edid_is_supported_sr(edid_audio_info* info, int sr); bool audio_extn_edid_is_supported_bps(edid_audio_info* info, int bps); Loading hal/audio_extn/audio_feature_manager.c +2 −0 Original line number Diff line number Diff line Loading @@ -150,6 +150,8 @@ bool audio_feature_manager_is_feature_enabled(audio_ext_feature feature) return confValues->dynamic_ecns_enabled; case AUDIO_ZOOM: return confValues->audio_zoom_enabled; case AUTO_HAL: return confValues->auto_hal_enabled; default: return false; } Loading Loading
hal/Android.mk +0 −5 Original line number Diff line number Diff line Loading @@ -347,11 +347,6 @@ ifeq ($(strip $(AUDIO_FEATURE_ENABLED_GCOV)),true) LOCAL_STATIC_LIBRARIES += libprofile_rt endif #ifeq ($(strip $(AUDIO_FEATURE_ENABLED_AUTO_HAL)),true) # LOCAL_CFLAGS += -DAUDIO_EXTN_AUTO_HAL_ENABLED # LOCAL_SRC_FILES += audio_extn/auto_hal.c #endif LOCAL_SHARED_LIBRARIES += libbase libhidlbase libhwbinder libutils android.hardware.power@1.2 liblog LOCAL_SRC_FILES += audio_perf.cpp Loading
hal/audio_extn/Android.mk +56 −0 Original line number Diff line number Diff line Loading @@ -823,4 +823,60 @@ LOCAL_HEADER_LIBRARIES += libhardware_headers LOCAL_HEADER_LIBRARIES += libsystem_headers include $(BUILD_SHARED_LIBRARY) #------------------------------------------- # Build AUTO_HAL LIB #------------------------------------------- include $(CLEAR_VARS) LOCAL_MODULE := libautohal LOCAL_VENDOR_MODULE := true PRIMARY_HAL_PATH := vendor/qcom/opensource/audio-hal/primary-hal/hal AUDIO_PLATFORM := $(TARGET_BOARD_PLATFORM) ifneq ($(filter sdm845 sdm710 sdmshrike msmnile kona lito atoll sdm660 msm8937 msm8998 $(MSMSTEPPE) $(TRINKET),$(TARGET_BOARD_PLATFORM)),) # B-family platform uses msm8974 code base AUDIO_PLATFORM := msm8974 MULTIPLE_HW_VARIANTS_ENABLED := true endif LOCAL_SRC_FILES:= \ auto_hal.c LOCAL_CFLAGS += \ -Wall \ -Werror \ -Wno-unused-function \ -Wno-unused-variable LOCAL_SHARED_LIBRARIES := \ libaudioutils \ libcutils \ libdl \ libexpat \ liblog LOCAL_C_INCLUDES := \ $(PRIMARY_HAL_PATH) \ $(PRIMARY_HAL_PATH)/$(AUDIO_PLATFORM) \ external/tinyalsa/include \ external/tinycompress/include \ external/expat/lib \ system/media/audio_utils/include \ $(call include-path-for, audio-route) \ LOCAL_C_INCLUDES += $(TARGET_OUT_INTERMEDIATES)/KERNEL_OBJ/usr/include LOCAL_C_INCLUDES += $(TARGET_OUT_INTERMEDIATES)/KERNEL_OBJ/usr/techpack/audio/include LOCAL_ADDITIONAL_DEPENDENCIES += $(TARGET_OUT_INTERMEDIATES)/KERNEL_OBJ/usr ifeq ($(strip $(AUDIO_FEATURE_ENABLED_DLKM)),true) LOCAL_HEADER_LIBRARIES += audio_kernel_headers LOCAL_C_INCLUDES += $(TARGET_OUT_INTERMEDIATES)/vendor/qcom/opensource/audio-kernel/include LOCAL_ADDITIONAL_DEPENDENCIES += $(BOARD_VENDOR_KERNEL_MODULES) endif LOCAL_HEADER_LIBRARIES += libhardware_headers LOCAL_HEADER_LIBRARIES += libsystem_headers include $(BUILD_SHARED_LIBRARY)
hal/audio_extn/audio_extn.c +223 −2 Original line number Diff line number Diff line Loading @@ -4639,8 +4639,8 @@ void* audio_extn_ext_hw_plugin_init(struct audio_device *adev) { if(ext_hw_plugin_init) { ext_hw_plugin_init_config_t ext_hw_plugin_init_config; ext_hw_plugin_init_config.fp_audio_route_apply_and_update_path = audio_route_apply_and_update_path; ext_hw_plugin_init_config.fp_b64decode = b64decode; ext_hw_plugin_init_config.fp_b64encode = b64encode; return ext_hw_plugin_init(adev, ext_hw_plugin_init_config); } else Loading Loading @@ -5391,6 +5391,224 @@ bool audio_extn_ma_supported_usb() } // END: MAXX_AUDIO ===================================================================== // START: AUTO_HAL =================================================================== #ifdef __LP64__ #define AUTO_HAL_LIB_PATH "/vendor/lib64/libautohal.so" #else #define AUTO_HAL_LIB_PATH "/vendor/lib/libautohal.so" #endif static void *auto_hal_lib_handle = NULL; typedef int (*auto_hal_init_t)(struct audio_device*, auto_hal_init_config_t); static auto_hal_init_t auto_hal_init; typedef void (*auto_hal_deinit_t)(); static auto_hal_deinit_t auto_hal_deinit; typedef int (*auto_hal_create_audio_patch_t)(struct audio_hw_device*, unsigned int, const struct audio_port_config*, unsigned int, const struct audio_port_config*, audio_patch_handle_t*); static auto_hal_create_audio_patch_t auto_hal_create_audio_patch; typedef int (*auto_hal_release_audio_patch_t)(struct audio_hw_device*, audio_patch_handle_t); static auto_hal_release_audio_patch_t auto_hal_release_audio_patch; typedef int (*auto_hal_get_car_audio_stream_from_address_t)(const char*); static auto_hal_get_car_audio_stream_from_address_t auto_hal_get_car_audio_stream_from_address; typedef int (*auto_hal_open_output_stream_t)(struct stream_out*); static auto_hal_open_output_stream_t auto_hal_open_output_stream; typedef bool (*auto_hal_is_bus_device_usecase_t)(audio_usecase_t); static auto_hal_is_bus_device_usecase_t auto_hal_is_bus_device_usecase; typedef snd_device_t (*auto_hal_get_snd_device_for_car_audio_stream_t)( struct stream_out*); static auto_hal_get_snd_device_for_car_audio_stream_t auto_hal_get_snd_device_for_car_audio_stream; typedef int (*auto_hal_get_audio_port_t)(struct audio_hw_device*, struct audio_port*); static auto_hal_get_audio_port_t auto_hal_get_audio_port; typedef int (*auto_hal_set_audio_port_config_t)(struct audio_hw_device*, const struct audio_port_config*); static auto_hal_set_audio_port_config_t auto_hal_set_audio_port_config; typedef void (*auto_hal_set_parameters_t)(struct audio_device*, struct str_parms*); static auto_hal_set_parameters_t auto_hal_set_parameters; int auto_hal_feature_init(bool is_feature_enabled) { ALOGD("%s: Called with feature %s", __func__, is_feature_enabled ? "Enabled" : "NOT Enabled"); if (is_feature_enabled) { // dlopen lib auto_hal_lib_handle = dlopen(AUTO_HAL_LIB_PATH, RTLD_NOW); if (!auto_hal_lib_handle) { ALOGE("%s: dlopen failed", __func__); goto feature_disabled; } if (!(auto_hal_init = (auto_hal_init_t)dlsym( auto_hal_lib_handle, "auto_hal_init")) || !(auto_hal_deinit = (auto_hal_deinit_t)dlsym( auto_hal_lib_handle, "auto_hal_deinit")) || !(auto_hal_create_audio_patch = (auto_hal_create_audio_patch_t)dlsym( auto_hal_lib_handle, "auto_hal_create_audio_patch")) || !(auto_hal_release_audio_patch = (auto_hal_release_audio_patch_t)dlsym( auto_hal_lib_handle, "auto_hal_release_audio_patch")) || !(auto_hal_get_car_audio_stream_from_address = (auto_hal_get_car_audio_stream_from_address_t)dlsym( auto_hal_lib_handle, "auto_hal_get_car_audio_stream_from_address")) || !(auto_hal_open_output_stream = (auto_hal_open_output_stream_t)dlsym( auto_hal_lib_handle, "auto_hal_open_output_stream")) || !(auto_hal_is_bus_device_usecase = (auto_hal_is_bus_device_usecase_t)dlsym( auto_hal_lib_handle, "auto_hal_is_bus_device_usecase")) || !(auto_hal_get_snd_device_for_car_audio_stream = (auto_hal_get_snd_device_for_car_audio_stream_t)dlsym( auto_hal_lib_handle, "auto_hal_get_snd_device_for_car_audio_stream")) || !(auto_hal_get_audio_port = (auto_hal_get_audio_port_t)dlsym( auto_hal_lib_handle, "auto_hal_get_audio_port")) || !(auto_hal_set_audio_port_config = (auto_hal_set_audio_port_config_t)dlsym( auto_hal_lib_handle, "auto_hal_set_audio_port_config")) || !(auto_hal_set_parameters = (auto_hal_set_parameters_t)dlsym( auto_hal_lib_handle, "auto_hal_set_parameters"))) { ALOGE("%s: dlsym failed", __func__); goto feature_disabled; } ALOGD("%s:: ---- Feature AUTO_HAL is Enabled ----", __func__); return 0; } feature_disabled: if (auto_hal_lib_handle) { dlclose(auto_hal_lib_handle); auto_hal_lib_handle = NULL; } auto_hal_init = NULL; auto_hal_deinit = NULL; auto_hal_create_audio_patch = NULL; auto_hal_release_audio_patch = NULL; auto_hal_get_car_audio_stream_from_address = NULL; auto_hal_open_output_stream = NULL; auto_hal_is_bus_device_usecase = NULL; auto_hal_get_snd_device_for_car_audio_stream = NULL; auto_hal_get_audio_port = NULL; auto_hal_set_audio_port_config = NULL; auto_hal_set_parameters = NULL; ALOGW(":: %s: ---- Feature AUTO_HAL is disabled ----", __func__); return -ENOSYS; } int audio_extn_auto_hal_init(struct audio_device *adev) { if(auto_hal_init) { auto_hal_init_config_t auto_hal_init_config; auto_hal_init_config.fp_in_get_stream = in_get_stream; auto_hal_init_config.fp_out_get_stream = out_get_stream; auto_hal_init_config.fp_audio_extn_ext_hw_plugin_usecase_start = audio_extn_ext_hw_plugin_usecase_start; auto_hal_init_config.fp_audio_extn_ext_hw_plugin_usecase_stop = audio_extn_ext_hw_plugin_usecase_stop; auto_hal_init_config.fp_get_usecase_from_list = get_usecase_from_list; auto_hal_init_config.fp_get_output_period_size = get_output_period_size; auto_hal_init_config.fp_audio_extn_ext_hw_plugin_set_audio_gain = audio_extn_ext_hw_plugin_set_audio_gain; return auto_hal_init(adev, auto_hal_init_config); } else return 0; } void audio_extn_auto_hal_deinit() { if (auto_hal_deinit) auto_hal_deinit(); } int audio_extn_auto_hal_create_audio_patch(struct audio_hw_device *dev, unsigned int num_sources, const struct audio_port_config *sources, unsigned int num_sinks, const struct audio_port_config *sinks, audio_patch_handle_t *handle) { return ((auto_hal_create_audio_patch) ? auto_hal_create_audio_patch(dev, num_sources, sources, num_sinks, sinks, handle): 0); } int audio_extn_auto_hal_release_audio_patch(struct audio_hw_device *dev, audio_patch_handle_t handle) { return ((auto_hal_release_audio_patch) ? auto_hal_release_audio_patch(dev, handle): 0); } int audio_extn_auto_hal_get_car_audio_stream_from_address(const char *address) { return ((auto_hal_get_car_audio_stream_from_address) ? auto_hal_get_car_audio_stream_from_address(address): 0); } int audio_extn_auto_hal_open_output_stream(struct stream_out *out) { return ((auto_hal_open_output_stream) ? auto_hal_open_output_stream(out): 0); } bool audio_extn_auto_hal_is_bus_device_usecase(audio_usecase_t uc_id) { return ((auto_hal_is_bus_device_usecase) ? auto_hal_is_bus_device_usecase(uc_id): 0); } snd_device_t audio_extn_auto_hal_get_snd_device_for_car_audio_stream(struct stream_out *out) { return ((auto_hal_get_snd_device_for_car_audio_stream) ? auto_hal_get_snd_device_for_car_audio_stream(out): 0); } int audio_extn_auto_hal_get_audio_port(struct audio_hw_device *dev, struct audio_port *config) { return ((auto_hal_get_audio_port) ? auto_hal_get_audio_port(dev, config): 0); } int audio_extn_auto_hal_set_audio_port_config(struct audio_hw_device *dev, const struct audio_port_config *config) { return ((auto_hal_set_audio_port_config) ? auto_hal_set_audio_port_config(dev, config): 0); } void audio_extn_auto_hal_set_parameters(struct audio_device *adev, struct str_parms *parms) { if (auto_hal_set_parameters) auto_hal_set_parameters(adev, parms); } // END: AUTO_HAL =================================================================== void audio_extn_feature_init() { is_running_vendor_enhanced_fwk = audio_extn_utils_is_vendor_enhanced_fwk(); Loading Loading @@ -5506,6 +5724,9 @@ void audio_extn_feature_init() audiozoom_feature_init( property_get_bool("vendor.audio.feature.audiozoom.enable", true)); auto_hal_feature_init( property_get_bool("vendor.audio.feature.auto_hal.enable", false)); } void audio_extn_set_parameters(struct audio_device *adev, Loading
hal/audio_extn/audio_extn.h +33 −24 Original line number Diff line number Diff line Loading @@ -706,10 +706,12 @@ int audio_extn_ext_hw_plugin_get_mic_mute(void *plugin, bool *mute); int audio_extn_ext_hw_plugin_set_audio_gain(void *plugin, struct audio_usecase *usecase, uint32_t gain); typedef int (*fp_audio_route_apply_and_update_path_t)(struct audio_route*, const char*); typedef int (*fp_b64decode_t)(char *inp, int ilen, uint8_t* outp); typedef int (*fp_b64encode_t)(uint8_t *inp, int ilen, char* outp); typedef struct ext_hw_plugin_init_config { fp_audio_route_apply_and_update_path_t fp_audio_route_apply_and_update_path; fp_b64decode_t fp_b64decode; fp_b64encode_t fp_b64encode; } ext_hw_plugin_init_config_t; // END: EXT_HW_PLUGIN FEATURE ================================================== Loading Loading @@ -1271,28 +1273,20 @@ void audio_extn_ffv_append_ec_ref_dev_name(char *device_name); int audio_extn_utils_get_license_params(const struct audio_device *adev, struct audio_license_params *lic_params); /* * TODO: AUTO TEAM to convert following feature flag to runtime flag enable */ #ifndef AUDIO_EXTN_AUTO_HAL_ENABLED #define audio_extn_auto_hal_init(adev) (0) #define audio_extn_auto_hal_deinit() (0) #define audio_extn_auto_hal_create_audio_patch(dev, num_sources,\ sources, num_sinks, sinks, handle) (0) #define audio_extn_auto_hal_release_audio_patch(dev, handle) (0) #define audio_extn_auto_hal_get_car_audio_stream_from_address(address) (-1) #define audio_extn_auto_hal_open_output_stream(out) (0) #define audio_extn_auto_hal_is_bus_device_usecase(uc_id) (0) #define audio_extn_auto_hal_get_snd_device_for_car_audio_stream(out) (0) #define audio_extn_auto_hal_get_audio_port(dev, config) (0) #define audio_extn_auto_hal_set_audio_port_config(dev, config) (0) #define audio_extn_auto_hal_set_parameters(adev, parms) (0) #else // START: AUTO_HAL FEATURE ================================================== #ifndef AUDIO_OUTPUT_FLAG_MEDIA #define AUDIO_OUTPUT_FLAG_MEDIA 0x100000 #endif #ifndef AUDIO_OUTPUT_FLAG_SYS_NOTIFICATION #define AUDIO_OUTPUT_FLAG_SYS_NOTIFICATION 0x200000 #endif #ifndef AUDIO_OUTPUT_FLAG_NAV_GUIDANCE #define AUDIO_OUTPUT_FLAG_NAV_GUIDANCE 0x400000 #endif #ifndef AUDIO_OUTPUT_FLAG_PHONE #define AUDIO_OUTPUT_FLAG_PHONE 0x800000 int32_t audio_extn_auto_hal_init(struct audio_device *adev); #endif int audio_extn_auto_hal_init(struct audio_device *adev); void audio_extn_auto_hal_deinit(void); int audio_extn_auto_hal_create_audio_patch(struct audio_hw_device *dev, unsigned int num_sources, Loading @@ -1302,8 +1296,8 @@ int audio_extn_auto_hal_create_audio_patch(struct audio_hw_device *dev, audio_patch_handle_t *handle); int audio_extn_auto_hal_release_audio_patch(struct audio_hw_device *dev, audio_patch_handle_t handle); int32_t audio_extn_auto_hal_get_car_audio_stream_from_address(const char *address); int32_t audio_extn_auto_hal_open_output_stream(struct stream_out *out); int audio_extn_auto_hal_get_car_audio_stream_from_address(const char *address); int audio_extn_auto_hal_open_output_stream(struct stream_out *out); bool audio_extn_auto_hal_is_bus_device_usecase(audio_usecase_t uc_id); snd_device_t audio_extn_auto_hal_get_snd_device_for_car_audio_stream(struct stream_out *out); int audio_extn_auto_hal_get_audio_port(struct audio_hw_device *dev, Loading @@ -1312,7 +1306,22 @@ int audio_extn_auto_hal_set_audio_port_config(struct audio_hw_device *dev, const struct audio_port_config *config); void audio_extn_auto_hal_set_parameters(struct audio_device *adev, struct str_parms *parms); #endif typedef streams_input_ctxt_t* (*fp_in_get_stream_t)(struct audio_device*, audio_io_handle_t); typedef streams_output_ctxt_t* (*fp_out_get_stream_t)(struct audio_device*, audio_io_handle_t); typedef size_t (*fp_get_output_period_size_t)(uint32_t, audio_format_t, int, int); typedef int (*fp_audio_extn_ext_hw_plugin_set_audio_gain_t)(void*, struct audio_usecase*, uint32_t); typedef struct auto_hal_init_config { fp_in_get_stream_t fp_in_get_stream; fp_out_get_stream_t fp_out_get_stream; fp_audio_extn_ext_hw_plugin_usecase_start_t fp_audio_extn_ext_hw_plugin_usecase_start; fp_audio_extn_ext_hw_plugin_usecase_stop_t fp_audio_extn_ext_hw_plugin_usecase_stop; fp_get_usecase_from_list_t fp_get_usecase_from_list; fp_get_output_period_size_t fp_get_output_period_size; fp_audio_extn_ext_hw_plugin_set_audio_gain_t fp_audio_extn_ext_hw_plugin_set_audio_gain; } auto_hal_init_config_t; // END: AUTO_HAL FEATURE ================================================== bool audio_extn_edid_is_supported_sr(edid_audio_info* info, int sr); bool audio_extn_edid_is_supported_bps(edid_audio_info* info, int bps); Loading
hal/audio_extn/audio_feature_manager.c +2 −0 Original line number Diff line number Diff line Loading @@ -150,6 +150,8 @@ bool audio_feature_manager_is_feature_enabled(audio_ext_feature feature) return confValues->dynamic_ecns_enabled; case AUDIO_ZOOM: return confValues->audio_zoom_enabled; case AUTO_HAL: return confValues->auto_hal_enabled; default: return false; } Loading