hal: QCV changes for remaining HAL compile time feature
flags
Removed all feature flags except those that are hardware
specific, legacy features, non-LA features.
Moved following features to runtime enable:
- HFP
- EXT_HW_PLUGIN
- HDMI_PASSTHROUGH
- BATTERY_LISTENER
- INCALL_MUSIC
- CONCURRENT_CAPTURE
- COMPRESS_IN_CAPTURE
- HWDEP_CAL
- RECORD_PLAY_CONCURRENCY
Disabled AUTO_HAL compiletime flag temporarily after
discussing with Derek Chen. Will be re-enabled as
runtime flag later.
Change-Id: I55a58ca405b58be99e1873a5198fa201c0525725
diff --git a/hal/audio_extn/Android.mk b/hal/audio_extn/Android.mk
index 5c65268..c11956b 100755
--- a/hal/audio_extn/Android.mk
+++ b/hal/audio_extn/Android.mk
@@ -5,7 +5,7 @@
include $(CLEAR_VARS)
-LOCAL_MODULE:= libsndmonitor
+LOCAL_MODULE := libsndmonitor
LOCAL_MODULE_OWNER := third_party
LOCAL_VENDOR_MODULE := true
@@ -57,7 +57,7 @@
#--------------------------------------------
include $(CLEAR_VARS)
-LOCAL_MODULE:= libcomprcapture
+LOCAL_MODULE := libcomprcapture
LOCAL_MODULE_OWNER := third_party
LOCAL_VENDOR_MODULE := true
@@ -65,7 +65,7 @@
ifneq ($(filter sdm845 sdm710 qcs605 msmnile kona lito $(MSMSTEPPE),$(TARGET_BOARD_PLATFORM)),)
# B-family platform uses msm8974 code base
- AUDIO_PLATFORM = msm8974
+ AUDIO_PLATFORM := msm8974
MULTIPLE_HW_VARIANTS_ENABLED := true
endif
@@ -116,14 +116,14 @@
#-------------------------------------------
include $(CLEAR_VARS)
-LOCAL_MODULE:= libssrec
+LOCAL_MODULE := libssrec
LOCAL_VENDOR_MODULE := true
AUDIO_PLATFORM := $(TARGET_BOARD_PLATFORM)
ifneq ($(filter sdm845 sdm710 msmnile kona lito $(MSMSTEPPE),$(TARGET_BOARD_PLATFORM)),)
# B-family platform uses msm8974 code base
- AUDIO_PLATFORM = msm8974
+ AUDIO_PLATFORM := msm8974
MULTIPLE_HW_VARIANTS_ENABLED := true
endif
@@ -175,7 +175,7 @@
#--------------------------------------------
include $(CLEAR_VARS)
-LOCAL_MODULE:= libhdmiedid
+LOCAL_MODULE := libhdmiedid
LOCAL_MODULE_OWNER := third_party
LOCAL_VENDOR_MODULE := true
@@ -184,7 +184,7 @@
ifneq ($(filter sdm845 sdm710 msmnile kona lito $(MSMSTEPPE) $(TRINKET),$(TARGET_BOARD_PLATFORM)),)
# B-family platform uses msm8974 code base
- AUDIO_PLATFORM = msm8974
+ AUDIO_PLATFORM := msm8974
endif
LOCAL_SRC_FILES:= \
@@ -236,10 +236,10 @@
ifneq ($(filter sdm845 sdm710 msmnile kona lito $(MSMSTEPPE) $(TRINKET),$(TARGET_BOARD_PLATFORM)),)
# B-family platform uses msm8974 code base
- AUDIO_PLATFORM = msm8974
+ AUDIO_PLATFORM := msm8974
endif
-LOCAL_MODULE:= libspkrprot
+LOCAL_MODULE := libspkrprot
LOCAL_MODULE_OWNER := third_party
LOCAL_VENDOR_MODULE := true
@@ -290,10 +290,10 @@
ifneq ($(filter sdm845 sdm710 msmnile kona lito $(MSMSTEPPE) $(TRINKET),$(TARGET_BOARD_PLATFORM)),)
# B-family platform uses msm8974 code base
- AUDIO_PLATFORM = msm8974
+ AUDIO_PLATFORM := msm8974
endif
-LOCAL_MODULE:= libcirrusspkrprot
+LOCAL_MODULE := libcirrusspkrprot
LOCAL_MODULE_OWNER := third_party
LOCAL_VENDOR_MODULE := true
@@ -342,7 +342,7 @@
#-------------------------------------------
include $(CLEAR_VARS)
-LOCAL_MODULE:= liba2dpoffload
+LOCAL_MODULE := liba2dpoffload
LOCAL_VENDOR_MODULE := true
PRIMARY_HAL_PATH := vendor/qcom/opensource/audio-hal/primary-hal/hal
@@ -350,7 +350,7 @@
ifneq ($(filter sdm845 sdm710 msmnile kona lito $(MSMSTEPPE),$(TARGET_BOARD_PLATFORM)),)
# B-family platform uses msm8974 code base
- AUDIO_PLATFORM = msm8974
+ AUDIO_PLATFORM := msm8974
MULTIPLE_HW_VARIANTS_ENABLED := true
endif
@@ -394,3 +394,313 @@
LOCAL_HEADER_LIBRARIES += libhardware_headers
LOCAL_HEADER_LIBRARIES += libsystem_headers
include $(BUILD_SHARED_LIBRARY)
+
+#-------------------------------------------
+# Build EXT_HW_PLUGIN LIB
+#-------------------------------------------
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := libexthwplugin
+LOCAL_VENDOR_MODULE := true
+
+PRIMARY_HAL_PATH := vendor/qcom/opensource/audio-hal/primary-hal/hal
+AUDIO_PLATFORM := $(TARGET_BOARD_PLATFORM)
+
+ifneq ($(filter sdm845 sdm710 msmnile kona $(MSMSTEPPE),$(TARGET_BOARD_PLATFORM)),)
+ # B-family platform uses msm8974 code base
+ AUDIO_PLATFORM := msm8974
+ MULTIPLE_HW_VARIANTS_ENABLED := true
+endif
+
+LOCAL_SRC_FILES:= \
+ ext_hw_plugin.c
+
+LOCAL_CFLAGS += \
+ -Wall \
+ -Werror \
+ -Wno-unused-function \
+ -Wno-unused-variable
+
+LOCAL_SHARED_LIBRARIES := \
+ libaudioroute \
+ libaudioutils \
+ libcutils \
+ libdl \
+ libexpat \
+ liblog \
+ libtinyalsa \
+ libtinycompress
+
+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)
+
+#-------------------------------------------
+# Build HFP LIB
+#-------------------------------------------
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := libhfp
+LOCAL_VENDOR_MODULE := true
+
+PRIMARY_HAL_PATH := vendor/qcom/opensource/audio-hal/primary-hal/hal
+AUDIO_PLATFORM := $(TARGET_BOARD_PLATFORM)
+
+ifneq ($(filter sdm845 sdm710 msmnile kona $(MSMSTEPPE),$(TARGET_BOARD_PLATFORM)),)
+ # B-family platform uses msm8974 code base
+ AUDIO_PLATFORM := msm8974
+ MULTIPLE_HW_VARIANTS_ENABLED := true
+endif
+
+LOCAL_SRC_FILES:= \
+ hfp.c
+
+LOCAL_CFLAGS += \
+ -Wall \
+ -Werror \
+ -Wno-unused-function \
+ -Wno-unused-variable
+
+LOCAL_SHARED_LIBRARIES := \
+ libaudioroute \
+ libaudioutils \
+ libcutils \
+ libdl \
+ libexpat \
+ liblog \
+ libtinyalsa \
+ libtinycompress
+
+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)
+
+#-------------------------------------------
+# Build HDMI PASSTHROUGH
+#-------------------------------------------
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := libhdmipassthru
+LOCAL_VENDOR_MODULE := true
+
+PRIMARY_HAL_PATH := vendor/qcom/opensource/audio-hal/primary-hal/hal
+AUDIO_PLATFORM := $(TARGET_BOARD_PLATFORM)
+
+ifneq ($(filter sdm845 sdm710 msmnile kona $(MSMSTEPPE),$(TARGET_BOARD_PLATFORM)),)
+ # B-family platform uses msm8974 code base
+ AUDIO_PLATFORM := msm8974
+ MULTIPLE_HW_VARIANTS_ENABLED := true
+endif
+
+LOCAL_SRC_FILES:= \
+ passthru.c
+
+LOCAL_CFLAGS += \
+ -Wall \
+ -Werror \
+ -Wno-unused-function \
+ -Wno-unused-variable \
+ -DDTSHD_PARSER_ENABLED
+
+LOCAL_SHARED_LIBRARIES := \
+ libaudioparsers \
+ libaudioroute \
+ libaudioutils \
+ libcutils \
+ libdl \
+ libexpat \
+ liblog \
+ libtinyalsa \
+ libtinycompress
+
+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 \
+ vendor/qcom/proprietary/mm-audio/audio-parsers/inc \
+ $(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)
+
+#-------------------------------------------
+# Build BATTERY_LISTENER
+#-------------------------------------------
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := libbatterylistener
+LOCAL_VENDOR_MODULE := true
+
+PRIMARY_HAL_PATH := vendor/qcom/opensource/audio-hal/primary-hal/hal
+AUDIO_PLATFORM := $(TARGET_BOARD_PLATFORM)
+
+ifneq ($(filter sdm845 sdm710 msmnile kona $(MSMSTEPPE),$(TARGET_BOARD_PLATFORM)),)
+ # B-family platform uses msm8974 code base
+ AUDIO_PLATFORM := msm8974
+ MULTIPLE_HW_VARIANTS_ENABLED := true
+endif
+
+LOCAL_SRC_FILES:= \
+ battery_listener.cpp
+
+LOCAL_CFLAGS += \
+ -Wall \
+ -Werror \
+ -Wno-unused-function \
+ -Wno-unused-variable \
+ -DDTSHD_PARSER_ENABLED
+
+LOCAL_SHARED_LIBRARIES := \
+ android.hardware.health@1.0 \
+ android.hardware.health@2.0 \
+ android.hardware.power@1.2 \
+ libaudioroute \
+ libaudioutils \
+ libbase \
+ libcutils \
+ libdl \
+ libexpat \
+ libhidlbase \
+ libhidltransport \
+ liblog \
+ libtinyalsa \
+ libtinycompress \
+ libutils \
+
+LOCAL_STATIC_LIBRARIES := \
+ libhealthhalutils
+
+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 \
+ vendor/qcom/proprietary/mm-audio/audio-parsers/inc \
+ $(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)
+
+#-------------------------------------------
+# Build HWDEP_CAL
+#-------------------------------------------
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := libhwdepcal
+LOCAL_VENDOR_MODULE := true
+
+PRIMARY_HAL_PATH := vendor/qcom/opensource/audio-hal/primary-hal/hal
+AUDIO_PLATFORM := $(TARGET_BOARD_PLATFORM)
+
+ifneq ($(filter sdm845 sdm710 msmnile kona $(MSMSTEPPE),$(TARGET_BOARD_PLATFORM)),)
+ # B-family platform uses msm8974 code base
+ AUDIO_PLATFORM := msm8974
+ MULTIPLE_HW_VARIANTS_ENABLED := true
+endif
+
+# LOCAL_SRC_FILES:= \
+# hwdep_cal.c
+
+LOCAL_CFLAGS += \
+ -Wall \
+ -Werror \
+ -Wno-unused-function \
+ -Wno-unused-variable
+
+LOCAL_SHARED_LIBRARIES := \
+ libaudioroute \
+ libaudioutils \
+ libcutils \
+ libdl \
+ libexpat \
+ liblog \
+ libtinyalsa \
+ libtinycompress
+
+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)
diff --git a/hal/audio_extn/audio_extn.c b/hal/audio_extn/audio_extn.c
index f440362..99df5ac 100644
--- a/hal/audio_extn/audio_extn.c
+++ b/hal/audio_extn/audio_extn.c
@@ -93,6 +93,17 @@
int keep_alive_set_parameters(struct audio_device *adev,
struct str_parms *parms);
+bool cin_applicable_stream(struct stream_in *in);
+bool cin_attached_usecase(audio_usecase_t uc_id);
+bool cin_format_supported(audio_format_t format);
+size_t cin_get_buffer_size(struct stream_in *in);
+int cin_start_input_stream(struct stream_in *in);
+void cin_stop_input_stream(struct stream_in *in);
+void cin_close_input_stream(struct stream_in *in);
+int cin_read(struct stream_in *in, void *buffer,
+ size_t bytes, size_t *bytes_read);
+int cin_configure_input_stream(struct stream_in *in);
+
void audio_extn_set_snd_card_split(const char* in_snd_card_name)
{
/* sound card name follows below mentioned convention
@@ -164,6 +175,11 @@
static bool audio_extn_custom_stereo_feature_enabled = false;
static bool audio_extn_anc_headset_feature_enabled = false;
static bool audio_extn_vbat_enabled = false;
+static bool audio_extn_record_play_concurrency_enabled = false;
+static bool audio_extn_hdmi_passthru_enabled = false;
+static bool audio_extn_concurrent_capture_enabled = false;
+static bool audio_extn_compress_in_enabled = false;
+static bool audio_extn_battery_listener_enabled = false;
#define AUDIO_PARAMETER_KEY_AANC_NOISE_LEVEL "aanc_noise_level"
#define AUDIO_PARAMETER_KEY_ANC "anc_enabled"
@@ -491,7 +507,7 @@
void anc_headset_feature_init(bool is_feature_enabled)
{
audio_extn_anc_headset_feature_enabled = is_feature_enabled;
- ALOGD(":: %s: ---- Feature FM_POWER_OPT is %s----", __func__,
+ ALOGD(":: %s: ---- Feature ANC_HEADSET is %s----", __func__,
is_feature_enabled? "ENABLED": "NOT ENABLED");
}
@@ -1185,7 +1201,7 @@
goto feature_disabled;
}
- // options functions, can be NULL
+ // optional functions, can be NULL
spkr_prot_set_parameters = NULL;
fbsp_set_parameters = NULL;
@@ -1758,6 +1774,9 @@
typedef void (*hwdep_cal_send_t)(int, void*);
static hwdep_cal_send_t hwdep_cal_send;
+
+//If feature is enabled, please copy hwdep_cal.c in the audio_extn dir
+//Current lib doesn't have any src files
void hwdep_cal_feature_init(bool is_feature_enabled)
{
ALOGD("%s: Called with feature %s", __func__, is_feature_enabled?"Enabled":"NOT Enabled");
@@ -2948,21 +2967,25 @@
void fm_feature_init(bool is_feature_enabled)
{
audio_extn_fm_power_opt_enabled = is_feature_enabled;
- ALOGD(":: %s: ---- Feature FM_POWER_OPT is %s----", __func__, is_feature_enabled? "ENABLED": "NOT ENABLED");
+ ALOGD("%s: ---- Feature FM_POWER_OPT is %s----", __func__, is_feature_enabled? "ENABLED": "NOT ENABLED");
}
void audio_extn_fm_get_parameters(struct str_parms *query, struct str_parms *reply)
{
- if(audio_extn_fm_power_opt_enabled)
- fm_get_parameters(query, reply);
+ if(audio_extn_fm_power_opt_enabled) {
+ ALOGD("%s: Enter", __func__);
+ fm_get_parameters(query, reply);
+ }
}
void audio_extn_fm_set_parameters(struct audio_device *adev,
struct str_parms *parms)
{
- if(audio_extn_fm_power_opt_enabled)
- fm_set_parameters(adev, parms);
+ if(audio_extn_fm_power_opt_enabled) {
+ ALOGD("%s: Enter", __func__);
+ fm_set_parameters(adev, parms);
+ }
}
//END: FM_POWER_OPT_FEATURE ================================================================
@@ -3718,6 +3741,763 @@
}
// END: A2DP_OFFLOAD =====================================================================
+
+// START: HFP ======================================================================
+#ifdef __LP64__
+#define HFP_LIB_PATH "/vendor/lib64/libhfp.so"
+#else
+#define HFP_LIB_PATH "/vendor/lib/libhfp.so"
+#endif
+
+static void *hfp_lib_handle = NULL;
+
+typedef void (*hfp_init_t)(hfp_init_config_t);
+static hfp_init_t hfp_init;
+
+typedef bool (*hfp_is_active_t)(struct audio_device *adev);
+static hfp_is_active_t hfp_is_active;
+
+typedef audio_usecase_t (*hfp_get_usecase_t)();
+static hfp_get_usecase_t hfp_get_usecase;
+
+typedef int (*hfp_set_mic_mute_t)(struct audio_device *dev, bool state);
+static hfp_set_mic_mute_t hfp_set_mic_mute;
+
+typedef void (*hfp_set_parameters_t)(struct audio_device *adev,
+ struct str_parms *parms);
+static hfp_set_parameters_t hfp_set_parameters;
+
+typedef int (*hfp_set_mic_mute2_t)(struct audio_device *adev, bool state);
+static hfp_set_mic_mute2_t hfp_set_mic_mute2;
+
+int hfp_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
+ hfp_lib_handle = dlopen(HFP_LIB_PATH, RTLD_NOW);
+
+ if (!hfp_lib_handle) {
+ ALOGE("%s: dlopen failed", __func__);
+ goto feature_disabled;
+ }
+ if (!(hfp_init = (hfp_init_t)dlsym(
+ hfp_lib_handle, "hfp_init")) ||
+ !(hfp_is_active =
+ (hfp_is_active_t)dlsym(
+ hfp_lib_handle, "hfp_is_active")) ||
+ !(hfp_get_usecase =
+ (hfp_get_usecase_t)dlsym(
+ hfp_lib_handle, "hfp_get_usecase")) ||
+ !(hfp_set_mic_mute =
+ (hfp_set_mic_mute_t)dlsym(
+ hfp_lib_handle, "hfp_set_mic_mute")) ||
+ !(hfp_set_mic_mute2 =
+ (hfp_set_mic_mute2_t)dlsym(
+ hfp_lib_handle, "hfp_set_mic_mute2")) ||
+ !(hfp_set_parameters =
+ (hfp_set_parameters_t)dlsym(
+ hfp_lib_handle, "hfp_set_parameters"))) {
+ ALOGE("%s: dlsym failed", __func__);
+ goto feature_disabled;
+ }
+ hfp_init_config_t init_config;
+ init_config.fp_platform_set_mic_mute = platform_set_mic_mute;
+ init_config.fp_platform_get_pcm_device_id = platform_get_pcm_device_id;
+ init_config.fp_platform_set_echo_reference = platform_set_echo_reference;
+ init_config.fp_platform_set_mic_mute = platform_set_mic_mute;
+ init_config.fp_select_devices = select_devices;
+ init_config.fp_audio_extn_ext_hw_plugin_usecase_start =
+ audio_extn_ext_hw_plugin_usecase_start;
+ init_config.fp_audio_extn_ext_hw_plugin_usecase_stop =
+ audio_extn_ext_hw_plugin_usecase_stop;
+ init_config.fp_get_usecase_from_list = get_usecase_from_list;
+ init_config.fp_disable_audio_route = disable_audio_route;
+ init_config.fp_disable_snd_device = disable_snd_device;
+ init_config.fp_voice_get_mic_mute = voice_get_mic_mute;
+
+ hfp_init(init_config);
+ ALOGD("%s:: ---- Feature HFP is Enabled ----", __func__);
+ return 0;
+ }
+
+feature_disabled:
+ if (hfp_lib_handle) {
+ dlclose(hfp_lib_handle);
+ hfp_lib_handle = NULL;
+ }
+
+ hfp_init = NULL;
+ hfp_is_active = NULL;
+ hfp_get_usecase = NULL;
+ hfp_set_mic_mute = NULL;
+ hfp_set_mic_mute2 = NULL;
+ hfp_set_parameters = NULL;
+
+ ALOGW(":: %s: ---- Feature HFP is disabled ----", __func__);
+ return -ENOSYS;
+}
+
+bool audio_extn_hfp_is_active(struct audio_device *adev)
+{
+ return ((hfp_is_active) ?
+ hfp_is_active(adev): false);
+}
+
+audio_usecase_t audio_extn_hfp_get_usecase()
+{
+ return ((hfp_get_usecase) ?
+ hfp_get_usecase(): -1);
+}
+
+int audio_extn_hfp_set_mic_mute(struct audio_device *adev, bool state)
+{
+ return ((hfp_set_mic_mute) ?
+ hfp_set_mic_mute(adev, state): -1);
+}
+
+void audio_extn_hfp_set_parameters(struct audio_device *adev,
+ struct str_parms *parms)
+{
+ ((hfp_set_parameters) ?
+ hfp_set_parameters(adev, parms): NULL);
+}
+
+int audio_extn_hfp_set_mic_mute2(struct audio_device *adev, bool state)
+{
+ return ((hfp_set_mic_mute2) ?
+ hfp_set_mic_mute2(adev, state): -1);
+}
+// END: HFP ========================================================================
+
+// START: EXT_HW_PLUGIN ===================================================================
+#ifdef __LP64__
+#define EXT_HW_PLUGIN_LIB_PATH "/vendor/lib64/libexthwplugin.so"
+#else
+#define EXT_HW_PLUGIN_LIB_PATH "/vendor/lib/libexthwplugin.so"
+#endif
+
+static void *ext_hw_plugin_lib_handle = NULL;
+
+typedef void* (*ext_hw_plugin_init_t)(struct audio_device*,
+ ext_hw_plugin_init_config_t init_config);
+static ext_hw_plugin_init_t ext_hw_plugin_init;
+
+typedef int (*ext_hw_plugin_deinit_t)(void*);
+static ext_hw_plugin_deinit_t ext_hw_plugin_deinit;
+
+typedef int(*ext_hw_plugin_usecase_start_t)(void*, struct audio_usecase*);
+static ext_hw_plugin_usecase_start_t ext_hw_plugin_usecase_start;
+
+typedef int(*ext_hw_plugin_usecase_stop_t)(void*, struct audio_usecase*);
+static ext_hw_plugin_usecase_stop_t ext_hw_plugin_usecase_stop;
+
+typedef int(*ext_hw_plugin_set_parameters_t)(void*, struct str_parms*);
+static ext_hw_plugin_set_parameters_t ext_hw_plugin_set_parameters;
+
+typedef int(*ext_hw_plugin_get_parameters_t)(void*,
+ struct str_parms*, struct str_parms*);
+static ext_hw_plugin_get_parameters_t ext_hw_plugin_get_parameters;
+
+typedef int(*ext_hw_plugin_set_mic_mute_t)(void*, bool);
+static ext_hw_plugin_set_mic_mute_t ext_hw_plugin_set_mic_mute;
+
+typedef int(*ext_hw_plugin_get_mic_mute_t)(void*, bool*);
+static ext_hw_plugin_get_mic_mute_t ext_hw_plugin_get_mic_mute;
+
+typedef int(*ext_hw_plugin_set_audio_gain_t)(void*, struct audio_usecase*, uint32_t);
+static ext_hw_plugin_set_audio_gain_t ext_hw_plugin_set_audio_gain;
+
+
+int ext_hw_plugin_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
+ ext_hw_plugin_lib_handle = dlopen(EXT_HW_PLUGIN_LIB_PATH, RTLD_NOW);
+
+ if (!ext_hw_plugin_lib_handle) {
+ ALOGE("%s: dlopen failed", __func__);
+ goto feature_disabled;
+ }
+ if (!(ext_hw_plugin_init = (ext_hw_plugin_init_t)dlsym(
+ ext_hw_plugin_lib_handle, "ext_hw_plugin_init")) ||
+ !(ext_hw_plugin_deinit =
+ (ext_hw_plugin_deinit_t)dlsym(
+ ext_hw_plugin_lib_handle, "ext_hw_plugin_deinit")) ||
+ !(ext_hw_plugin_usecase_start =
+ (ext_hw_plugin_usecase_start_t)dlsym(
+ ext_hw_plugin_lib_handle, "ext_hw_plugin_usecase_start")) ||
+ !(ext_hw_plugin_usecase_stop =
+ (ext_hw_plugin_usecase_stop_t)dlsym(
+ ext_hw_plugin_lib_handle, "ext_hw_plugin_usecase_stop")) ||
+ !(ext_hw_plugin_set_parameters =
+ (ext_hw_plugin_set_parameters_t)dlsym(
+ ext_hw_plugin_lib_handle, "ext_hw_plugin_set_parameters")) ||
+ !(ext_hw_plugin_get_parameters =
+ (ext_hw_plugin_get_parameters_t)dlsym(
+ ext_hw_plugin_lib_handle, "ext_hw_plugin_get_parameters")) ||
+ !(ext_hw_plugin_set_mic_mute =
+ (ext_hw_plugin_set_mic_mute_t)dlsym(
+ ext_hw_plugin_lib_handle, "ext_hw_plugin_set_mic_mute")) ||
+ !(ext_hw_plugin_get_mic_mute =
+ (ext_hw_plugin_get_mic_mute_t)dlsym(
+ ext_hw_plugin_lib_handle, "ext_hw_plugin_get_mic_mute")) ||
+ !(ext_hw_plugin_set_audio_gain =
+ (ext_hw_plugin_set_audio_gain_t)dlsym(
+ ext_hw_plugin_lib_handle, "ext_hw_plugin_set_audio_gain"))) {
+ ALOGE("%s: dlsym failed", __func__);
+ goto feature_disabled;
+ }
+ ALOGD("%s:: ---- Feature EXT_HW_PLUGIN is Enabled ----", __func__);
+ return 0;
+ }
+
+feature_disabled:
+ if (ext_hw_plugin_lib_handle) {
+ dlclose(ext_hw_plugin_lib_handle);
+ ext_hw_plugin_lib_handle = NULL;
+ }
+
+ ext_hw_plugin_init = NULL;
+ ext_hw_plugin_deinit = NULL;
+ ext_hw_plugin_usecase_start = NULL;
+ ext_hw_plugin_usecase_stop = NULL;
+ ext_hw_plugin_set_parameters = NULL;
+ ext_hw_plugin_get_parameters = NULL;
+ ext_hw_plugin_set_mic_mute = NULL;
+ ext_hw_plugin_get_mic_mute = NULL;
+ ext_hw_plugin_set_audio_gain = NULL;
+
+ ALOGW(":: %s: ---- Feature EXT_HW_PLUGIN is disabled ----", __func__);
+ return -ENOSYS;
+}
+
+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;
+ return ext_hw_plugin_init(adev, ext_hw_plugin_init_config);
+ }
+ else
+ return NULL;
+}
+
+int audio_extn_ext_hw_plugin_deinit(void *plugin)
+{
+ return ((ext_hw_plugin_deinit) ?
+ ext_hw_plugin_deinit(plugin): -1);
+}
+
+int audio_extn_ext_hw_plugin_usecase_start(void *plugin, struct audio_usecase *usecase)
+{
+ return ((ext_hw_plugin_usecase_start) ?
+ ext_hw_plugin_usecase_start(plugin, usecase): -1);
+}
+
+int audio_extn_ext_hw_plugin_usecase_stop(void *plugin, struct audio_usecase *usecase)
+{
+ return ((ext_hw_plugin_usecase_stop) ?
+ ext_hw_plugin_usecase_stop(plugin, usecase): -1);
+}
+
+int audio_extn_ext_hw_plugin_set_parameters(void *plugin,
+ struct str_parms *parms)
+{
+ return ((ext_hw_plugin_set_parameters) ?
+ ext_hw_plugin_set_parameters(plugin, parms): -1);
+}
+
+int audio_extn_ext_hw_plugin_get_parameters(void *plugin,
+ struct str_parms *query, struct str_parms *reply)
+{
+ return ((ext_hw_plugin_get_parameters) ?
+ ext_hw_plugin_get_parameters(plugin, query, reply): -1);
+}
+
+int audio_extn_ext_hw_plugin_set_mic_mute(void *plugin, bool mute)
+{
+ return ((ext_hw_plugin_set_mic_mute) ?
+ ext_hw_plugin_set_mic_mute(plugin, mute): -1);
+}
+
+int audio_extn_ext_hw_plugin_get_mic_mute(void *plugin, bool *mute)
+{
+ return ((ext_hw_plugin_get_mic_mute) ?
+ ext_hw_plugin_get_mic_mute(plugin, mute): -1);
+}
+
+int audio_extn_ext_hw_plugin_set_audio_gain(void *plugin,
+ struct audio_usecase *usecase, uint32_t gain)
+{
+ return ((ext_hw_plugin_set_audio_gain) ?
+ ext_hw_plugin_set_audio_gain(plugin, usecase, gain): -1);
+}
+// END: EXT_HW_PLUGIN ===================================================================
+
+// START: RECORD_PLAY_CONCURRENCY =======================================================
+void record_play_concurency_feature_init(bool is_feature_enabled)
+{
+ audio_extn_record_play_concurrency_enabled = is_feature_enabled;
+ ALOGD("%s: ---- Feature RECORD_PLAY_CONCURRENCY is %s----", __func__,
+ is_feature_enabled? "ENABLED": "NOT ENABLED");
+}
+
+bool audio_extn_is_record_play_concurrency_enabled()
+{
+ return audio_extn_record_play_concurrency_enabled;
+}
+// END: RECORD_PLAY_CONCURRENCY =========================================================
+
+// START: HDMI_PASSTHROUGH ==================================================
+#ifdef __LP64__
+#define HDMI_PASSTHRU_LIB_PATH "/vendor/lib64/libhdmipassthru.so"
+#else
+#define HDMI_PASSTHRU_LIB_PATH "/vendor/lib/libhdmipassthru.so"
+#endif
+
+static void *hdmi_passthru_lib_handle = NULL;
+
+typedef bool (*passthru_is_convert_supported_t)(struct audio_device *,
+ struct stream_out *);
+static passthru_is_convert_supported_t passthru_is_convert_supported;
+
+typedef bool (*passthru_is_passt_supported_t)(struct stream_out *);
+static passthru_is_passt_supported_t passthru_is_passt_supported;
+
+typedef void (*passthru_update_stream_configuration_t)(
+ struct audio_device *, struct stream_out *, const void *, size_t);
+static passthru_update_stream_configuration_t passthru_update_stream_configuration;
+
+typedef bool (*passthru_is_passthrough_stream_t)(struct stream_out *);
+static passthru_is_passthrough_stream_t passthru_is_passthrough_stream;
+
+typedef int (*passthru_get_buffer_size_t)(audio_offload_info_t*);
+static passthru_get_buffer_size_t passthru_get_buffer_size;
+
+typedef int (*passthru_set_volume_t)(struct stream_out *, int);
+static passthru_set_volume_t passthru_set_volume;
+
+typedef int (*passthru_set_latency_t)(struct stream_out *, int);
+static passthru_set_latency_t passthru_set_latency;
+
+typedef bool (*passthru_is_supported_format_t)(audio_format_t);
+static passthru_is_supported_format_t passthru_is_supported_format;
+
+typedef bool (*passthru_should_drop_data_t)(struct stream_out * out);
+static passthru_should_drop_data_t passthru_should_drop_data;
+
+typedef void (*passthru_on_start_t)(struct stream_out *out);
+static passthru_on_start_t passthru_on_start;
+
+typedef void (*passthru_on_stop_t)(struct stream_out *out);
+static passthru_on_stop_t passthru_on_stop;
+
+typedef void (*passthru_on_pause_t)(struct stream_out *out);
+static passthru_on_pause_t passthru_on_pause;
+
+typedef int (*passthru_set_parameters_t)(struct audio_device *adev,
+ struct str_parms *parms);
+static passthru_set_parameters_t passthru_set_parameters;
+
+typedef bool (*passthru_is_enabled_t)();
+static passthru_is_enabled_t passthru_is_enabled;
+
+typedef bool (*passthru_is_active_t)();
+static passthru_is_active_t passthru_is_active;
+
+typedef void (*passthru_init_t)(passthru_init_config_t);
+static passthru_init_t passthru_init;
+
+typedef bool (*passthru_should_standby_t)(struct stream_out *out);
+static passthru_should_standby_t passthru_should_standby;
+
+typedef int (*passthru_get_channel_count_t)(struct stream_out *out);
+static passthru_get_channel_count_t passthru_get_channel_count;
+
+typedef int (*passthru_update_dts_stream_configuration_t)(struct stream_out *out,
+ const void *buffer, size_t bytes);
+static passthru_update_dts_stream_configuration_t passthru_update_dts_stream_configuration;
+
+typedef bool (*passthru_is_direct_passthrough_t)(struct stream_out *out);
+static passthru_is_direct_passthrough_t passthru_is_direct_passthrough;
+
+typedef bool (*passthru_is_supported_backend_edid_cfg_t)(struct audio_device *adev,
+ struct stream_out *out);
+static passthru_is_supported_backend_edid_cfg_t passthru_is_supported_backend_edid_cfg;
+
+bool audio_extn_passthru_is_convert_supported(struct audio_device *adev,
+ struct stream_out *out)
+{
+ return (passthru_is_convert_supported ? passthru_is_convert_supported(adev, out) : false);
+}
+
+bool audio_extn_passthru_is_passthrough_stream(struct stream_out *out)
+{
+ return (passthru_is_passthrough_stream ?
+ passthru_is_passthrough_stream(out) : false);
+}
+
+void audio_extn_passthru_update_stream_configuration(
+ struct audio_device *adev, struct stream_out *out,
+ const void *buffer, size_t bytes)
+{
+ (passthru_update_stream_configuration ?
+ passthru_update_stream_configuration(adev, out, buffer, bytes) : 0);
+}
+
+bool audio_extn_passthru_is_passt_supported(struct stream_out *out)
+{
+ return (passthru_is_passt_supported)? passthru_is_passt_supported(out): false;
+}
+
+int audio_extn_passthru_get_buffer_size(audio_offload_info_t* info)
+{
+ return (passthru_get_buffer_size)? passthru_get_buffer_size(info): 0;
+}
+
+int audio_extn_passthru_set_volume(struct stream_out *out, int mute)
+{
+ return (passthru_set_volume)? passthru_set_volume(out, mute): 0;
+}
+
+int audio_extn_passthru_set_latency(struct stream_out *out, int latency)
+{
+ return (passthru_set_latency)? passthru_set_latency(out, latency): 0;
+}
+
+bool audio_extn_passthru_is_supported_format(audio_format_t format)
+{
+ return (passthru_is_supported_format)? passthru_is_supported_format(format): false;
+}
+
+bool audio_extn_passthru_should_drop_data(struct stream_out * out)
+{
+ return (passthru_should_drop_data)? passthru_should_drop_data(out): false;
+}
+
+void audio_extn_passthru_on_start(struct stream_out *out)
+{
+ (passthru_on_start)? passthru_on_start(out): 0;
+}
+
+void audio_extn_passthru_on_stop(struct stream_out *out)
+{
+ (passthru_on_stop)? passthru_on_stop(out): 0;
+}
+
+void audio_extn_passthru_on_pause(struct stream_out *out)
+{
+ (passthru_on_pause)? passthru_on_pause(out): 0;
+}
+
+int audio_extn_passthru_set_parameters(struct audio_device *adev,
+ struct str_parms *parms)
+{
+ return (passthru_set_parameters)?
+ passthru_set_parameters(adev, parms): false;
+}
+
+bool audio_extn_passthru_is_enabled()
+{
+ return (passthru_is_enabled)? passthru_is_enabled(): false;
+}
+
+bool audio_extn_passthru_is_active()
+{
+ return (passthru_is_active)? passthru_is_active(): false;
+}
+
+bool audio_extn_passthru_should_standby(struct stream_out *out)
+{
+ return (passthru_should_standby)? passthru_should_standby(out): false;
+}
+int audio_extn_passthru_get_channel_count(struct stream_out *out)
+{
+ return (passthru_get_channel_count)? passthru_get_channel_count(out): 0;
+}
+
+int audio_extn_passthru_update_dts_stream_configuration(struct stream_out *out,
+ const void *buffer, size_t bytes)
+{
+ return (passthru_update_dts_stream_configuration)?
+ passthru_update_dts_stream_configuration(out, buffer, bytes): 0;
+}
+
+bool audio_extn_passthru_is_direct_passthrough(struct stream_out *out)
+{
+ return (passthru_is_direct_passthrough)? passthru_is_direct_passthrough(out): false;
+}
+
+bool audio_extn_passthru_is_supported_backend_edid_cfg(struct audio_device *adev,
+ struct stream_out *out)
+{
+ return (passthru_is_supported_backend_edid_cfg)?
+ passthru_is_supported_backend_edid_cfg(adev, out): false;
+}
+bool audio_extn_is_hdmi_passthru_enabled()
+{
+ return audio_extn_hdmi_passthru_enabled;
+}
+
+void hdmi_passthrough_feature_init(bool is_feature_enabled)
+{
+ ALOGD("%s: Called with feature %s", __func__,
+ is_feature_enabled ? "Enabled" : "NOT Enabled");
+
+ audio_extn_hdmi_passthru_enabled = is_feature_enabled;
+ if (is_feature_enabled) {
+ // dlopen lib
+ hdmi_passthru_lib_handle = dlopen(HDMI_PASSTHRU_LIB_PATH, RTLD_NOW);
+
+ if (!hdmi_passthru_lib_handle) {
+ ALOGE("%s: dlopen failed", __func__);
+ goto feature_disabled;
+ }
+ if (!(passthru_init = (passthru_init_t)dlsym(
+ hdmi_passthru_lib_handle, "passthru_init")) ||
+ !(passthru_is_convert_supported =
+ (passthru_is_convert_supported_t)dlsym(
+ hdmi_passthru_lib_handle, "passthru_is_convert_supported")) ||
+ !(passthru_is_passthrough_stream =
+ (passthru_is_passthrough_stream_t)dlsym(
+ hdmi_passthru_lib_handle, "passthru_is_passthrough_stream")) ||
+ !(passthru_get_buffer_size =
+ (passthru_get_buffer_size_t)dlsym(
+ hdmi_passthru_lib_handle, "passthru_get_buffer_size")) ||
+ !(passthru_set_volume =
+ (passthru_set_volume_t)dlsym(
+ hdmi_passthru_lib_handle, "passthru_set_volume")) ||
+ !(passthru_set_latency =
+ (passthru_set_latency_t)dlsym(
+ hdmi_passthru_lib_handle, "passthru_set_latency")) ||
+ !(passthru_is_supported_format =
+ (passthru_is_supported_format_t)dlsym(
+ hdmi_passthru_lib_handle, "passthru_is_supported_format")) ||
+ !(passthru_should_drop_data =
+ (passthru_should_drop_data_t)dlsym(
+ hdmi_passthru_lib_handle, "passthru_should_drop_data")) ||
+ !(passthru_on_start =
+ (passthru_on_start_t)dlsym(
+ hdmi_passthru_lib_handle, "passthru_on_start")) ||
+ !(passthru_on_stop =
+ (passthru_on_stop_t)dlsym(
+ hdmi_passthru_lib_handle, "passthru_on_stop")) ||
+ !(passthru_on_pause =
+ (passthru_on_pause_t)dlsym(
+ hdmi_passthru_lib_handle, "passthru_on_pause")) ||
+ !(passthru_set_parameters =
+ (passthru_set_parameters_t)dlsym(
+ hdmi_passthru_lib_handle, "passthru_set_parameters")) ||
+ (passthru_is_enabled =
+ (passthru_is_enabled_t)dlsym(
+ hdmi_passthru_lib_handle, "passthru_is_enabled")) ||
+ (passthru_is_active =
+ (passthru_is_active_t)dlsym(
+ hdmi_passthru_lib_handle, "passthru_is_active")) ||
+ (passthru_should_standby =
+ (passthru_should_standby_t)dlsym(
+ hdmi_passthru_lib_handle, "passthru_should_standby")) ||
+ (passthru_get_channel_count =
+ (passthru_get_channel_count_t)dlsym(
+ hdmi_passthru_lib_handle, "passthru_get_channel_count")) ||
+ (passthru_update_dts_stream_configuration =
+ (passthru_update_dts_stream_configuration_t)dlsym(
+ hdmi_passthru_lib_handle,
+ "passthru_update_dts_stream_configuration")) ||
+ (passthru_is_direct_passthrough =
+ (passthru_is_direct_passthrough_t)dlsym(
+ hdmi_passthru_lib_handle, "passthru_is_direct_passthrough")) ||
+ (passthru_is_supported_backend_edid_cfg =
+ (passthru_is_supported_backend_edid_cfg_t)dlsym(
+ hdmi_passthru_lib_handle,
+ "passthru_is_supported_backend_edid_cfg"))) {
+ ALOGE("%s: dlsym failed", __func__);
+ goto feature_disabled;
+ }
+
+ passthru_init_config_t init_config;
+ init_config.fp_platform_is_edid_supported_format =
+ platform_is_edid_supported_format;
+ init_config.fp_platform_set_device_params = platform_set_device_params;
+ init_config.fp_platform_edid_get_max_channels = platform_edid_get_max_channels;
+ init_config.fp_platform_get_output_snd_device = platform_get_output_snd_device;
+ init_config.fp_platform_get_codec_backend_cfg = platform_get_codec_backend_cfg;
+ init_config.fp_platform_get_snd_device_name = platform_get_snd_device_name;
+ init_config.fp_platform_is_edid_supported_sample_rate =
+ platform_is_edid_supported_sample_rate;
+ init_config.fp_audio_extn_keep_alive_start = audio_extn_keep_alive_start;
+ init_config.fp_audio_extn_keep_alive_stop = audio_extn_keep_alive_stop;
+ init_config.fp_audio_extn_utils_is_dolby_format =
+ audio_extn_utils_is_dolby_format;
+ passthru_init(init_config);
+ ALOGD("%s:: ---- Feature HDMI_PASSTHROUGH is Enabled ----", __func__);
+ }
+
+feature_disabled:
+ if (hdmi_passthru_lib_handle) {
+ dlclose(hdmi_passthru_lib_handle);
+ hdmi_passthru_lib_handle = NULL;
+ }
+
+ passthru_init = NULL;
+ passthru_is_convert_supported = NULL;
+ passthru_is_passthrough_stream = NULL;
+ passthru_get_buffer_size = NULL;
+ passthru_set_volume = NULL;
+ passthru_set_latency = NULL;
+ passthru_is_supported_format = NULL;
+ passthru_should_drop_data = NULL;
+ passthru_on_start = NULL;
+ passthru_on_stop = NULL;
+ passthru_on_pause = NULL;
+ passthru_set_parameters = NULL;
+ passthru_is_enabled = NULL;
+ passthru_is_active = NULL;
+ passthru_should_standby = NULL;
+ passthru_get_channel_count = NULL;
+ passthru_update_dts_stream_configuration = NULL;
+ passthru_is_direct_passthrough = NULL;
+ passthru_is_supported_backend_edid_cfg = NULL;
+
+ ALOGW(":: %s: ---- Feature HDMI_PASSTHROUGH is disabled ----", __func__);
+}
+// END: HDMI_PASSTHROUGH ==================================================
+
+// START: CONCURRENT_CAPTURE ==================================================
+bool audio_extn_is_concurrent_capture_enabled()
+{
+ return audio_extn_concurrent_capture_enabled;
+}
+
+void concurrent_capture_feature_init(bool is_feature_enabled)
+{
+ audio_extn_concurrent_capture_enabled = is_feature_enabled;
+ ALOGD("%s: ---- Feature CONCURRENT_CAPTURE is %s----", __func__, is_feature_enabled? "ENABLED": "NOT ENABLED");
+}
+// END: CONCURRENT_CAPTURE ====================================================
+
+// START: COMPRESS_IN ==================================================
+void compress_in_feature_init(bool is_feature_enabled)
+{
+ audio_extn_compress_in_enabled = is_feature_enabled;
+ ALOGD("%s: ---- Feature COMPRESS_IN is %s----", __func__, is_feature_enabled? "ENABLED": "NOT ENABLED");
+}
+
+bool audio_extn_cin_applicable_stream(struct stream_in *in)
+{
+ return (audio_extn_compress_in_enabled? cin_applicable_stream(in): false);
+}
+bool audio_extn_cin_attached_usecase(audio_usecase_t uc_id)
+{
+ return (audio_extn_compress_in_enabled? cin_attached_usecase(uc_id): false);
+}
+bool audio_extn_cin_format_supported(audio_format_t format)
+{
+ return (audio_extn_compress_in_enabled? cin_format_supported(format): false);
+}
+size_t audio_extn_cin_get_buffer_size(struct stream_in *in)
+{
+ return (audio_extn_compress_in_enabled? cin_get_buffer_size(in): 0);
+}
+int audio_extn_cin_start_input_stream(struct stream_in *in)
+{
+ return (audio_extn_compress_in_enabled? cin_start_input_stream(in): -1);
+}
+void audio_extn_cin_stop_input_stream(struct stream_in *in)
+{
+ (audio_extn_compress_in_enabled? cin_stop_input_stream(in): NULL);
+}
+void audio_extn_cin_close_input_stream(struct stream_in *in)
+{
+ (audio_extn_compress_in_enabled? cin_close_input_stream(in): NULL);
+}
+int audio_extn_cin_read(struct stream_in *in, void *buffer,
+ size_t bytes, size_t *bytes_read)
+{
+ return (audio_extn_compress_in_enabled?
+ cin_read(in, buffer, bytes, bytes_read): -1);
+}
+int audio_extn_cin_configure_input_stream(struct stream_in *in)
+{
+ return (audio_extn_compress_in_enabled? cin_configure_input_stream(in): -1);
+}
+// END: COMPRESS_IN ====================================================
+
+// START: BATTERY_LISTENER ==================================================
+#ifdef __LP64__
+#define BATTERY_LISTENER_LIB_PATH "/vendor/lib64/libbatterylistener.so"
+#else
+#define BATTERY_LISTENER_LIB_PATH "/vendor/lib/libbatterylistener.so"
+#endif
+
+static void *batt_listener_lib_handle = NULL;
+
+typedef void (*batt_listener_init_t)(battery_status_change_fn_t);
+static batt_listener_init_t batt_listener_init;
+
+typedef void (*batt_listener_deinit_t)();
+static batt_listener_deinit_t batt_listener_deinit;
+
+typedef bool (*batt_prop_is_charging_t)();
+static batt_prop_is_charging_t batt_prop_is_charging;
+
+void battery_listener_feature_init(bool is_feature_enabled)
+{
+ audio_extn_battery_listener_enabled = is_feature_enabled;
+ ALOGD("%s: ---- Feature BATTERY_LISTENER is %s----", __func__, is_feature_enabled? "ENABLED": "NOT ENABLED");
+ if (is_feature_enabled) {
+ // dlopen lib
+ batt_listener_lib_handle = dlopen(BATTERY_LISTENER_LIB_PATH, RTLD_NOW);
+
+ if (!batt_listener_lib_handle) {
+ ALOGE("%s: dlopen failed", __func__);
+ goto feature_disabled;
+ }
+ if (!(batt_listener_init = (batt_listener_init_t)dlsym(
+ batt_listener_lib_handle, "battery_properties_listener_init")) ||
+ !(batt_listener_deinit =
+ (batt_listener_deinit_t)dlsym(
+ batt_listener_lib_handle, "battery_properties_listener_deinit")) ||
+ !(batt_prop_is_charging =
+ (batt_prop_is_charging_t)dlsym(
+ batt_listener_lib_handle, "battery_properties_is_charging"))) {
+ ALOGE("%s: dlsym failed", __func__);
+ goto feature_disabled;
+ }
+ }
+
+ feature_disabled:
+ if (batt_listener_lib_handle) {
+ dlclose(batt_listener_lib_handle);
+ batt_listener_lib_handle = NULL;
+ }
+
+ batt_listener_init = NULL;
+ batt_listener_deinit = NULL;
+ batt_prop_is_charging = NULL;
+ ALOGW(":: %s: ---- Feature BATTERY_LISTENER is disabled ----", __func__);
+}
+
+void audio_extn_battery_properties_listener_init(battery_status_change_fn_t fn)
+{
+ if(batt_listener_init)
+ batt_listener_init(fn);
+}
+void audio_extn_battery_properties_listener_deinit()
+{
+ if(batt_listener_deinit)
+ batt_listener_deinit();
+}
+bool audio_extn_battery_properties_is_charging()
+{
+ return (batt_prop_is_charging)? batt_prop_is_charging(): false;
+}
+
void audio_extn_feature_init(int is_running_with_enhanced_fwk)
{
is_running_vendor_enhanced_fwk = is_running_with_enhanced_fwk;
@@ -3802,6 +4582,27 @@
case HWDEP_CAL:
hwdep_cal_feature_init(enable);
break;
+ case HFP:
+ hfp_feature_init(enable);
+ break;
+ case EXT_HW_PLUGIN:
+ ext_hw_plugin_feature_init(enable);
+ break;
+ case RECORD_PLAY_CONCURRENCY:
+ record_play_concurency_feature_init(enable);
+ break;
+ case HDMI_PASSTHROUGH:
+ hdmi_passthrough_feature_init(enable);
+ break;
+ case CONCURRENT_CAPTURE:
+ concurrent_capture_feature_init(enable);
+ break;
+ case COMPRESS_IN_CAPTURE:
+ compress_in_feature_init(enable);
+ break;
+ case BATTERY_LISTENER:
+ battery_listener_feature_init(enable);
+ break;
default:
break;
}
diff --git a/hal/audio_extn/audio_extn.h b/hal/audio_extn/audio_extn.h
index 863916b..7b5695c 100644
--- a/hal/audio_extn/audio_extn.h
+++ b/hal/audio_extn/audio_extn.h
@@ -42,10 +42,9 @@
#include "adsp_hdlr.h"
#include "audio_hidl.h"
#include "ip_hdlr_intf.h"
-#include "battery_listener.h"
#include "platform_api.h"
#include "edid.h"
-
+#include "battery_listener.h"
#define AUDIO_PARAMETER_DUAL_MONO "dual_mono"
@@ -57,44 +56,14 @@
#define AUDIO_DEVICE_IN_HDMI_ARC (AUDIO_DEVICE_BIT_IN | 0x8000000)
#endif
-#ifndef INCALL_MUSIC_ENABLED
-#define AUDIO_OUTPUT_FLAG_INCALL_MUSIC 0x80000000 //0x8000
-#endif
+// #ifndef INCALL_MUSIC_ENABLED
+// #define AUDIO_OUTPUT_FLAG_INCALL_MUSIC 0x80000000 //0x8000
+// #endif
#ifndef AUDIO_DEVICE_OUT_FM_TX
#define AUDIO_DEVICE_OUT_FM_TX 0x8000000
#endif
-#if 0
-// these formats should have been enabled by default now
-#ifndef FLAC_OFFLOAD_ENABLED
-#define AUDIO_FORMAT_FLAC 0x1B000000UL
-#endif
-
-#ifndef WMA_OFFLOAD_ENABLED
-#define AUDIO_FORMAT_WMA 0x12000000UL
-#define AUDIO_FORMAT_WMA_PRO 0x13000000UL
-#endif
-
-#ifndef ALAC_OFFLOAD_ENABLED
-#define AUDIO_FORMAT_ALAC 0x1C000000UL
-#endif
-
-#ifndef APE_OFFLOAD_ENABLED
-#define AUDIO_FORMAT_APE 0x1D000000UL
-#endif
-
-#ifndef AAC_ADTS_OFFLOAD_ENABLED
-#define AUDIO_FORMAT_AAC_ADTS 0x1E000000UL
-#define AUDIO_FORMAT_AAC_ADTS_LC (AUDIO_FORMAT_AAC_ADTS |\
- AUDIO_FORMAT_AAC_SUB_LC)
-#define AUDIO_FORMAT_AAC_ADTS_HE_V1 (AUDIO_FORMAT_AAC_ADTS |\
- AUDIO_FORMAT_AAC_SUB_HE_V1)
-#define AUDIO_FORMAT_AAC_ADTS_HE_V2 (AUDIO_FORMAT_AAC_ADTS |\
- AUDIO_FORMAT_AAC_SUB_HE_V2)
-#endif
-#endif
-
#ifndef AUDIO_FORMAT_AAC_LATM
#define AUDIO_FORMAT_AAC_LATM 0x80000000UL
#define AUDIO_FORMAT_AAC_LATM_LC (AUDIO_FORMAT_AAC_LATM |\
@@ -136,13 +105,8 @@
int audio_extn_parse_compress_metadata(struct stream_out *out,
struct str_parms *parms);
-#ifdef AUDIO_EXTN_FORMATS_ENABLED
#define AUDIO_OUTPUT_BIT_WIDTH ((config->offload_info.bit_width == 32) ? 24\
:config->offload_info.bit_width)
-#else
-#define AUDIO_OUTPUT_BIT_WIDTH (CODEC_BACKEND_DEFAULT_BIT_WIDTH)
-#define compress_set_next_track_param(compress, codec_options) (0)
-#endif
#ifndef AUDIO_HW_EXTN_API_ENABLED
#define compress_set_metadata(compress, metadata) (0)
@@ -199,7 +163,6 @@
typedef int (*fp_platform_get_snd_device_t)(snd_device_t);
typedef bool(*fp_platform_check_and_set_codec_backend_cfg_t)(struct audio_device*,
struct audio_usecase *, snd_device_t);
-
typedef struct snd_card_split *(*fp_audio_extn_get_snd_card_split_t)();
typedef bool (*fp_audio_extn_is_vbat_enabled_t)(void);
@@ -277,7 +240,6 @@
bool audio_extn_is_hifi_audio_enabled(void);
-bool audio_extn_is_hifi_audio_enabled(void);
bool audio_extn_is_hifi_audio_supported(void);
//START: AFE_PROXY_FEATURE
@@ -581,37 +543,39 @@
EXT_DISPLAY_TYPE_HDMI,
EXT_DISPLAY_TYPE_DP
};
-
+// START: HDMI_PASSTHROUGH ==================================================
/* Used to limit sample rate for TrueHD & EC3 */
#define HDMI_PASSTHROUGH_MAX_SAMPLE_RATE 192000
-#ifndef HDMI_PASSTHROUGH_ENABLED
-#define audio_extn_passthru_update_stream_configuration(adev, out, buffer, bytes) (0)
-#define audio_extn_passthru_is_convert_supported(adev, out) (0)
-#define audio_extn_passthru_is_passt_supported(adev, out) (0)
-#define audio_extn_passthru_is_passthrough_stream(out) (0)
-#define audio_extn_passthru_get_buffer_size(info) (0)
-#define audio_extn_passthru_set_volume(out, mute) (0)
-#define audio_extn_passthru_set_latency(out, latency) (0)
-#define audio_extn_passthru_is_supported_format(f) (0)
-#define audio_extn_passthru_should_drop_data(o) (0)
-#define audio_extn_passthru_on_start(o) do {} while(0)
-#define audio_extn_passthru_on_stop(o) do {} while(0)
-#define audio_extn_passthru_on_pause(o) do {} while(0)
-#define audio_extn_passthru_is_enabled() (0)
-#define audio_extn_passthru_is_active() (0)
-#define audio_extn_passthru_set_parameters(a, p) (-ENOSYS)
-#define audio_extn_passthru_init(a) do {} while(0)
-#define audio_extn_passthru_should_standby(o) (1)
-#define audio_extn_passthru_get_channel_count(out) (0)
-#define audio_extn_passthru_update_dts_stream_configuration(out, buffer, bytes) (-ENOSYS)
-#define audio_extn_passthru_is_direct_passthrough(out) (0)
-#define audio_extn_passthru_is_supported_backend_edid_cfg(adev, out) (0)
-#else
+typedef bool (*fp_platform_is_edid_supported_format_t)(void*, int);
+typedef int (*fp_platform_set_device_params_t)(struct stream_out*, int, int);
+typedef int (*fp_platform_edid_get_max_channels_t)(void*);
+typedef snd_device_t (*fp_platform_get_output_snd_device_t)(void*, struct stream_out*);
+typedef int (*fp_platform_get_codec_backend_cfg_t)(struct audio_device*,
+ snd_device_t, struct audio_backend_cfg*);
+typedef bool (*fp_platform_is_edid_supported_sample_rate_t)(void*, int);
+
+typedef void (*fp_audio_extn_keep_alive_start_t)(ka_mode_t);
+typedef void (*fp_audio_extn_keep_alive_stop_t)(ka_mode_t);
+typedef bool (*fp_audio_extn_utils_is_dolby_format_t)(audio_format_t);
+
+
+typedef struct passthru_init_config {
+ fp_platform_is_edid_supported_format_t fp_platform_is_edid_supported_format;
+ fp_platform_set_device_params_t fp_platform_set_device_params;
+ fp_platform_edid_get_max_channels_t fp_platform_edid_get_max_channels;
+ fp_platform_get_output_snd_device_t fp_platform_get_output_snd_device;
+ fp_platform_get_codec_backend_cfg_t fp_platform_get_codec_backend_cfg;
+ fp_platform_get_snd_device_name_t fp_platform_get_snd_device_name;
+ fp_platform_is_edid_supported_sample_rate_t fp_platform_is_edid_supported_sample_rate;
+ fp_audio_extn_keep_alive_start_t fp_audio_extn_keep_alive_start;
+ fp_audio_extn_keep_alive_stop_t fp_audio_extn_keep_alive_stop;
+ fp_audio_extn_utils_is_dolby_format_t fp_audio_extn_utils_is_dolby_format;
+} passthru_init_config_t;
+
bool audio_extn_passthru_is_convert_supported(struct audio_device *adev,
struct stream_out *out);
-bool audio_extn_passthru_is_passt_supported(struct audio_device *adev,
- struct stream_out *out);
+bool audio_extn_passthru_is_passt_supported(struct stream_out *out);
void audio_extn_passthru_update_stream_configuration(
struct audio_device *adev, struct stream_out *out,
const void *buffer, size_t bytes);
@@ -628,7 +592,6 @@
struct str_parms *parms);
bool audio_extn_passthru_is_enabled();
bool audio_extn_passthru_is_active();
-void audio_extn_passthru_init(struct audio_device *adev);
bool audio_extn_passthru_should_standby(struct stream_out *out);
int audio_extn_passthru_get_channel_count(struct stream_out *out);
int audio_extn_passthru_update_dts_stream_configuration(struct stream_out *out,
@@ -636,22 +599,75 @@
bool audio_extn_passthru_is_direct_passthrough(struct stream_out *out);
bool audio_extn_passthru_is_supported_backend_edid_cfg(struct audio_device *adev,
struct stream_out *out);
-#endif
+bool audio_extn_is_hdmi_passthru_enabled();
-#ifndef HFP_ENABLED
-#define audio_extn_hfp_is_active(adev) (0)
-#define audio_extn_hfp_get_usecase() (-1)
-#define hfp_set_mic_mute(dev, state) (0)
-#define audio_extn_hfp_set_parameters(adev, parms) (0)
-#define audio_extn_hfp_set_mic_mute(adev, state) (0)
-#else
+// END: HDMI_PASSTHROUGH ==================================================
+// START: HFP FEATURE ==================================================
bool audio_extn_hfp_is_active(struct audio_device *adev);
audio_usecase_t audio_extn_hfp_get_usecase();
-int hfp_set_mic_mute(struct audio_device *dev, bool state);
+int audio_extn_hfp_set_mic_mute(struct audio_device *adev, bool state);
void audio_extn_hfp_set_parameters(struct audio_device *adev,
struct str_parms *parms);
-int audio_extn_hfp_set_mic_mute(struct audio_device *adev, bool state);
-#endif
+int audio_extn_hfp_set_mic_mute2(struct audio_device *adev, bool state);
+
+typedef int (*fp_platform_set_mic_mute_t)(void *, bool);
+//typedef int (*fp_platform_get_pcm_device_id_t)(audio_usecase_t, int);
+typedef void (*fp_platform_set_echo_reference_t)(struct audio_device *, bool,
+ audio_devices_t);
+typedef int (*fp_select_devices_t)(struct audio_device *, audio_usecase_t);
+typedef int (*fp_audio_extn_ext_hw_plugin_usecase_start_t)(void *,
+ struct audio_usecase *);
+typedef int (*fp_audio_extn_ext_hw_plugin_usecase_stop_t)(void *,
+ struct audio_usecase *);
+//typedef struct audio_usecase (*fp_get_usecase_from_list_t)(const struct audio_device *,
+// audio_usecase_t);
+typedef int (*fp_disable_audio_route_t)(struct audio_device *,
+ struct audio_usecase *);
+typedef int (*fp_disable_snd_device_t)(struct audio_device *, snd_device_t);
+typedef bool (*fp_voice_get_mic_mute_t)(struct audio_device *);
+
+typedef struct hfp_init_config {
+ fp_platform_set_mic_mute_t fp_platform_set_mic_mute;
+ fp_platform_get_pcm_device_id_t fp_platform_get_pcm_device_id;
+ fp_platform_set_echo_reference_t fp_platform_set_echo_reference;
+ fp_select_devices_t fp_select_devices;
+ 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_disable_audio_route_t fp_disable_audio_route;
+ fp_disable_snd_device_t fp_disable_snd_device;
+ fp_voice_get_mic_mute_t fp_voice_get_mic_mute;
+} hfp_init_config_t;
+
+
+// END: HFP FEATURE ==================================================
+
+// START: EXT_HW_PLUGIN FEATURE ==================================================
+void* audio_extn_ext_hw_plugin_init(struct audio_device *adev);
+int audio_extn_ext_hw_plugin_deinit(void *plugin);
+int audio_extn_ext_hw_plugin_usecase_start(void *plugin, struct audio_usecase *usecase);
+int audio_extn_ext_hw_plugin_usecase_stop(void *plugin, struct audio_usecase *usecase);
+int audio_extn_ext_hw_plugin_set_parameters(void *plugin,
+ struct str_parms *parms);
+int audio_extn_ext_hw_plugin_get_parameters(void *plugin,
+ struct str_parms *query, struct str_parms *reply);
+int audio_extn_ext_hw_plugin_set_mic_mute(void *plugin, bool mute);
+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 struct ext_hw_plugin_init_config {
+ fp_audio_route_apply_and_update_path_t fp_audio_route_apply_and_update_path;
+} ext_hw_plugin_init_config_t;
+// END: EXT_HW_PLUGIN FEATURE ==================================================
+
+// START: BATTERY_LISTENER FEATURE ==================================================
+void audio_extn_battery_properties_listener_init(battery_status_change_fn_t fn);
+void audio_extn_battery_properties_listener_deinit();
+bool audio_extn_battery_properties_is_charging();
+// END: BATTERY_LISTENER FEATURE ==================================================
int audio_extn_utils_send_app_type_gain(struct audio_device *adev,
int app_type,
@@ -941,7 +957,7 @@
#endif /* AUDIO_GENERIC_EFFECT_FRAMEWORK_ENABLED */
-#ifdef COMPRESS_INPUT_ENABLED
+// START: COMPRESS_INPUT_ENABLED ===============================
bool audio_extn_cin_applicable_stream(struct stream_in *in);
bool audio_extn_cin_attached_usecase(audio_usecase_t uc_id);
bool audio_extn_cin_format_supported(audio_format_t format);
@@ -952,17 +968,7 @@
int audio_extn_cin_read(struct stream_in *in, void *buffer,
size_t bytes, size_t *bytes_read);
int audio_extn_cin_configure_input_stream(struct stream_in *in);
-#else
-#define audio_extn_cin_applicable_stream(in) (false)
-#define audio_extn_cin_attached_usecase(uc_id) (false)
-#define audio_extn_cin_format_supported(format) (false)
-#define audio_extn_cin_get_buffer_size(in) (0)
-#define audio_extn_cin_start_input_stream(in) (0)
-#define audio_extn_cin_stop_input_stream(in) (0)
-#define audio_extn_cin_close_input_stream(in) (0)
-#define audio_extn_cin_read(in, buffer, bytes, bytes_read) (0)
-#define audio_extn_cin_configure_input_stream(in) (0)
-#endif
+// END: COMPRESS_INPUT_ENABLED ===============================
//START: SOURCE_TRACKING_FEATURE ==============================================
int audio_extn_get_soundfocus_data(const struct audio_device *adev,
@@ -1146,6 +1152,9 @@
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)
@@ -1169,31 +1178,6 @@
audio_patch_handle_t handle);
#endif
-#ifndef EXT_HW_PLUGIN_ENABLED
-#define audio_extn_ext_hw_plugin_init(adev) (0)
-#define audio_extn_ext_hw_plugin_deinit(plugin) (0)
-#define audio_extn_ext_hw_plugin_usecase_start(plugin, usecase) (0)
-#define audio_extn_ext_hw_plugin_usecase_stop(plugin, usecase) (0)
-#define audio_extn_ext_hw_plugin_set_parameters(plugin, parms) (0)
-#define audio_extn_ext_hw_plugin_get_parameters(plugin, query, reply) (0)
-#define audio_extn_ext_hw_plugin_set_mic_mute(plugin, mute) (0)
-#define audio_extn_ext_hw_plugin_get_mic_mute(plugin, mute) (0)
-#define audio_extn_ext_hw_plugin_set_audio_gain(plugin, usecase, gain) (0)
-#else
-void* audio_extn_ext_hw_plugin_init(struct audio_device *adev);
-int audio_extn_ext_hw_plugin_deinit(void *plugin);
-int audio_extn_ext_hw_plugin_usecase_start(void *plugin, struct audio_usecase *usecase);
-int audio_extn_ext_hw_plugin_usecase_stop(void *plugin, struct audio_usecase *usecase);
-int audio_extn_ext_hw_plugin_set_parameters(void *plugin,
- struct str_parms *parms);
-int audio_extn_ext_hw_plugin_get_parameters(void *plugin,
- struct str_parms *query, struct str_parms *reply);
-int audio_extn_ext_hw_plugin_set_mic_mute(void *plugin, bool mute);
-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);
-#endif
-
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);
int audio_extn_edid_get_highest_supported_sr(edid_audio_info* info);
@@ -1211,4 +1195,6 @@
void audio_extn_send_dual_mono_mixing_coefficients(struct stream_out *out);
void audio_extn_set_cpu_affinity();
+bool audio_extn_is_record_play_concurrency_enabled();
+bool audio_extn_is_concurrent_capture_enabled();
#endif /* AUDIO_EXTN_H */
diff --git a/hal/audio_extn/battery_listener.cpp b/hal/audio_extn/battery_listener.cpp
index 5f19443..55db095 100644
--- a/hal/audio_extn/battery_listener.cpp
+++ b/hal/audio_extn/battery_listener.cpp
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2018, The Linux Foundation. All rights reserved.
+* Copyright (c) 2019, The Linux Foundation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -228,19 +228,19 @@
} // namespace android
extern "C" {
-void audio_extn_battery_properties_listener_init(battery_status_change_fn_t fn)
+void battery_properties_listener_init(battery_status_change_fn_t fn)
{
android::batteryPropertiesListenerInit([=](bool charging) {
fn(charging);
});
}
-void audio_extn_battery_properties_listener_deinit()
+void battery_properties_listener_deinit()
{
android::batteryPropertiesListenerDeinit();
}
-bool audio_extn_battery_properties_is_charging()
+bool battery_properties_is_charging()
{
return android::batteryPropertiesListenerIsCharging();
}
diff --git a/hal/audio_extn/battery_listener.h b/hal/audio_extn/battery_listener.h
index 2fcd010..a34b358 100644
--- a/hal/audio_extn/battery_listener.h
+++ b/hal/audio_extn/battery_listener.h
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2018, The Linux Foundation. All rights reserved.
+* Copyright (c) 2019, The Linux Foundation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -26,19 +26,13 @@
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifdef BATTERY_LISTENER_ENABLED
#ifdef __cplusplus
extern "C" {
#endif
typedef void (* battery_status_change_fn_t)(bool);
-void audio_extn_battery_properties_listener_init(battery_status_change_fn_t fn);
-void audio_extn_battery_properties_listener_deinit();
-bool audio_extn_battery_properties_is_charging();
+void battery_properties_listener_init(battery_status_change_fn_t fn);
+void battery_properties_listener_deinit();
+bool battery_properties_is_charging();
#ifdef __cplusplus
}
#endif
-#else
-#define audio_extn_battery_properties_listener_init(fn) do { } while(0)
-#define audio_extn_battery_properties_listener_deinit() do { } while(0)
-#define audio_extn_battery_properties_is_charging() (false)
-#endif
diff --git a/hal/audio_extn/compress_in.c b/hal/audio_extn/compress_in.c
index 3066f3c..56905d6 100644
--- a/hal/audio_extn/compress_in.c
+++ b/hal/audio_extn/compress_in.c
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2016-2018, The Linux Foundation. All rights reserved.
+* Copyright (c) 2016-2019, The Linux Foundation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -31,11 +31,11 @@
/*#define LOG_NDEBUG 0*/
#define LOG_NDDEBUG 0
-#ifdef COMPRESS_INPUT_ENABLED
#include <cutils/log.h>
#include <cutils/properties.h>
#include <cutils/str_parms.h>
#include <cutils/log.h>
+#include <pthread.h>
#include "audio_hw.h"
#include "platform.h"
@@ -89,7 +89,7 @@
static pthread_mutex_t cin_lock = PTHREAD_MUTEX_INITIALIZER;
-bool audio_extn_cin_applicable_stream(struct stream_in *in)
+bool cin_applicable_stream(struct stream_in *in)
{
if (in->flags & (AUDIO_INPUT_FLAG_COMPRESS | AUDIO_INPUT_FLAG_TIMESTAMP))
return true;
@@ -97,14 +97,14 @@
return false;
}
-/* all audio_extn_cin_xxx calls must be made on an input
- * only after validating that input against audio_extn_cin_attached_usecase
+/* all cin_xxx calls must be made on an input
+ * only after validating that input against cin_attached_usecase
* except below calls
- * 1. audio_extn_cin_applicable_stream(in)
- * 2. audio_extn_cin_configure_input_stream(in)
+ * 1. cin_applicable_stream(in)
+ * 2. cin_configure_input_stream(in)
*/
-bool audio_extn_cin_attached_usecase(audio_usecase_t uc_id)
+bool cin_attached_usecase(audio_usecase_t uc_id)
{
unsigned int i;
@@ -157,7 +157,7 @@
pthread_mutex_unlock(&cin_lock);
}
-bool audio_extn_cin_format_supported(audio_format_t format)
+bool cin_format_supported(audio_format_t format)
{
if (format == AUDIO_FORMAT_IEC61937)
return true;
@@ -165,7 +165,7 @@
return false;
}
-size_t audio_extn_cin_get_buffer_size(struct stream_in *in)
+size_t cin_get_buffer_size(struct stream_in *in)
{
size_t sz = 0;
cin_private_data_t *cin_data = (cin_private_data_t *) in->cin_extn;
@@ -180,7 +180,7 @@
return sz;
}
-int audio_extn_cin_start_input_stream(struct stream_in *in)
+int cin_start_input_stream(struct stream_in *in)
{
int ret = -EINVAL;
struct audio_device *adev = in->dev;
@@ -203,7 +203,7 @@
return ret;
}
-void audio_extn_cin_stop_input_stream(struct stream_in *in)
+void cin_stop_input_stream(struct stream_in *in)
{
cin_private_data_t *cin_data = (cin_private_data_t *) in->cin_extn;
@@ -214,7 +214,7 @@
}
}
-void audio_extn_cin_close_input_stream(struct stream_in *in)
+void cin_close_input_stream(struct stream_in *in)
{
cin_private_data_t *cin_data = (cin_private_data_t *) in->cin_extn;
@@ -226,7 +226,7 @@
free_cin_usecase(in->usecase);
}
-int audio_extn_cin_read(struct stream_in *in, void *buffer,
+int cin_read(struct stream_in *in, void *buffer,
size_t bytes, size_t *bytes_read)
{
int ret = -EINVAL;
@@ -266,7 +266,7 @@
return ret;
}
-int audio_extn_cin_configure_input_stream(struct stream_in *in)
+int cin_configure_input_stream(struct stream_in *in)
{
struct audio_device *adev = in->dev;
struct audio_config config = {.format = 0};
@@ -333,7 +333,6 @@
return ret;
err_config:
- audio_extn_cin_close_input_stream(in);
+ cin_close_input_stream(in);
return ret;
}
-#endif /* COMPRESS_INPUT_ENABLED end */
diff --git a/hal/audio_extn/ext_hw_plugin.c b/hal/audio_extn/ext_hw_plugin.c
index 67ac3e7..f6c4799 100644
--- a/hal/audio_extn/ext_hw_plugin.c
+++ b/hal/audio_extn/ext_hw_plugin.c
@@ -41,6 +41,20 @@
#include "audio_hal_plugin.h"
+// - external function dependency -
+static fp_read_line_from_file_t fp_read_line_from_file;
+static fp_get_usecase_from_list_t fp_get_usecase_from_list;
+static fp_enable_disable_snd_device_t fp_disable_snd_device;
+static fp_enable_disable_snd_device_t fp_enable_snd_device;
+static fp_enable_disable_audio_route_t fp_disable_audio_route;
+static fp_enable_disable_audio_route_t fp_enable_audio_route;
+static fp_platform_set_snd_device_backend_t fp_platform_set_snd_device_backend;
+static fp_platform_get_snd_device_name_extn_t fp_platform_get_snd_device_name_extn;
+static fp_platform_get_default_app_type_v2_t fp_platform_get_default_app_type_v2;
+static fp_platform_send_audio_calibration_t fp_platform_send_audio_calibration;
+
+fp_audio_route_apply_and_update_path_t fp_audio_route_apply_and_update_path;
+
#ifdef EXT_HW_PLUGIN_ENABLED
typedef int32_t (*audio_hal_plugin_init_t)(void);
@@ -63,7 +77,86 @@
/* This can be defined in platform specific file or use compile flag */
#define LIB_PLUGIN_DRIVER "libaudiohalplugin.so"
-void* audio_extn_ext_hw_plugin_init(struct audio_device *adev)
+/* Note: Due to ADP H/W design, SoC TERT/SEC TDM CLK and FSYNC lines are
+ * both connected with CODEC and a single master is needed to provide
+ * consistent CLK and FSYNC to slaves, hence configuring SoC TERT TDM as
+ * single master and bring up a dummy hostless from TERT to SEC to ensure
+ * both slave SoC SEC TDM and CODEC are driven upon system boot. */
+static void ext_hw_plugin_enable_adev_hostless(void *plugin)
+{
+ struct ext_hw_plugin_data *my_plugin =
+ (struct ext_hw_plugin_data *)plugin;
+ char mixer_path[MIXER_PATH_MAX_LENGTH];
+
+ ALOGI("%s: Enable TERT -> SEC Hostless", __func__);
+
+ strlcpy(mixer_path, "dummy-hostless", MIXER_PATH_MAX_LENGTH);
+ ALOGD("%s: apply mixer and update path: %s", __func__, mixer_path);
+ if (audio_route_apply_and_update_path(my_plugin->adev->audio_route,
+ mixer_path)) {
+ ALOGE("%s: %s not supported, continue", __func__, mixer_path);
+ return;
+ }
+
+ /* TERT TDM TX 7 HOSTLESS to SEC TDM RX 7 HOSTLESS */
+ int pcm_dev_rx = 48, pcm_dev_tx = 49;
+ struct pcm_config pcm_config_lb = {
+ .channels = 1,
+ .rate = 48000,
+ .period_size = 240,
+ .period_count = 2,
+ .format = PCM_FORMAT_S16_LE,
+ .start_threshold = 0,
+ .stop_threshold = INT_MAX,
+ .avail_min = 0,
+ };
+
+ my_plugin->adev_hostless.pcm_tx = pcm_open(my_plugin->adev->snd_card,
+ pcm_dev_tx,
+ PCM_IN, &pcm_config_lb);
+ if (my_plugin->adev_hostless.pcm_tx &&
+ !pcm_is_ready(my_plugin->adev_hostless.pcm_tx)) {
+ ALOGE("%s: %s", __func__,
+ pcm_get_error(my_plugin->adev_hostless.pcm_tx));
+ return;
+ }
+ my_plugin->adev_hostless.pcm_rx = pcm_open(my_plugin->adev->snd_card,
+ pcm_dev_rx,
+ PCM_OUT, &pcm_config_lb);
+ if (my_plugin->adev_hostless.pcm_rx &&
+ !pcm_is_ready(my_plugin->adev_hostless.pcm_rx)) {
+ ALOGE("%s: %s", __func__,
+ pcm_get_error(my_plugin->adev_hostless.pcm_rx));
+ return;
+ }
+
+ if (pcm_start(my_plugin->adev_hostless.pcm_tx) < 0) {
+ ALOGE("%s: pcm start for pcm tx failed", __func__);
+ return;
+ }
+ if (pcm_start(my_plugin->adev_hostless.pcm_rx) < 0) {
+ ALOGE("%s: pcm start for pcm rx failed", __func__);
+ return;
+ }
+}
+
+static void ext_hw_plugin_disable_adev_hostless(void *plugin)
+{
+ struct ext_hw_plugin_data *my_plugin = (struct ext_hw_plugin_data *)plugin;
+
+ ALOGI("%s: Disable TERT -> SEC Hostless", __func__);
+
+ if (my_plugin->adev_hostless.pcm_tx) {
+ pcm_close(my_plugin->adev_hostless.pcm_tx);
+ my_plugin->adev_hostless.pcm_tx = NULL;
+ }
+ if (my_plugin->adev_hostless.pcm_rx) {
+ pcm_close(my_plugin->adev_hostless.pcm_rx);
+ my_plugin->adev_hostless.pcm_rx = NULL;
+ }
+}
+
+void* ext_hw_plugin_init(struct audio_device *adev, ext_hw_plugin_init_config_t init_config)
{
int32_t ret = 0;
struct ext_hw_plugin_data *my_plugin = NULL;
@@ -76,7 +169,7 @@
}
my_plugin->adev = adev;
-
+ fp_audio_route_apply_and_update_path = init_config.fp_audio_route_apply_and_update_path;
(void)audio_extn_auto_hal_enable_hostless();
my_plugin->plugin_handle = dlopen(LIB_PLUGIN_DRIVER, RTLD_NOW);
@@ -116,7 +209,7 @@
goto plugin_init_fail;
}
}
-
+ ext_hw_plugin_enable_adev_hostless(my_plugin);
my_plugin->mic_mute = false;
return my_plugin;
@@ -127,7 +220,7 @@
return NULL;
}
-int32_t audio_extn_ext_hw_plugin_deinit(void *plugin)
+int32_t ext_hw_plugin_deinit(void *plugin)
{
int32_t ret = 0;
struct ext_hw_plugin_data *my_plugin = (struct ext_hw_plugin_data *)plugin;
@@ -136,7 +229,7 @@
ALOGE("[%s] NULL plugin pointer",__func__);
return -EINVAL;
}
-
+ ext_hw_plugin_disable_adev_hostless(my_plugin);
if (my_plugin->audio_hal_plugin_deinit) {
ret = my_plugin->audio_hal_plugin_deinit();
if (ret) {
@@ -195,7 +288,7 @@
return ret;
}
-int32_t audio_extn_ext_hw_plugin_usecase_start(void *plugin, struct audio_usecase *usecase)
+int32_t ext_hw_plugin_usecase_start(void *plugin, struct audio_usecase *usecase)
{
int32_t ret = 0;
struct ext_hw_plugin_data *my_plugin = (struct ext_hw_plugin_data *)plugin;
@@ -332,7 +425,7 @@
return ret;
}
-int32_t audio_extn_ext_hw_plugin_usecase_stop(void *plugin, struct audio_usecase *usecase)
+int32_t ext_hw_plugin_usecase_stop(void *plugin, struct audio_usecase *usecase)
{
int32_t ret = 0;
struct ext_hw_plugin_data *my_plugin = (struct ext_hw_plugin_data *)plugin;
@@ -531,7 +624,7 @@
}
-int32_t audio_extn_ext_hw_plugin_set_parameters(void *plugin, struct str_parms *parms)
+int32_t ext_hw_plugin_set_parameters(void *plugin, struct str_parms *parms)
{
char *value = NULL;
@@ -975,7 +1068,7 @@
return ret;
}
-int audio_extn_ext_hw_plugin_get_parameters(void *plugin,
+int ext_hw_plugin_get_parameters(void *plugin,
struct str_parms *query, struct str_parms *reply)
{
char *value = NULL;
@@ -1412,7 +1505,7 @@
return ret;
}
-int audio_extn_ext_hw_plugin_set_mic_mute(void *plugin, bool mute)
+int ext_hw_plugin_set_mic_mute(void *plugin, bool mute)
{
struct ext_hw_plugin_data *my_plugin = NULL;
audio_hal_plugin_codec_set_pp_mute_t pp_mute;
@@ -1454,7 +1547,7 @@
return ret;
}
-int audio_extn_ext_hw_plugin_get_mic_mute(void *plugin, bool *mute)
+int ext_hw_plugin_get_mic_mute(void *plugin, bool *mute)
{
struct ext_hw_plugin_data *my_plugin = (struct ext_hw_plugin_data *)plugin;
@@ -1469,7 +1562,7 @@
return 0;
}
-int audio_extn_ext_hw_plugin_set_audio_gain(void *plugin,
+int ext_hw_plugin_set_audio_gain(void *plugin,
struct audio_usecase *usecase, uint32_t gain)
{
int32_t ret = 0;
diff --git a/hal/audio_extn/fm.c b/hal/audio_extn/fm.c
index 3c1ec68..f4b9d8f 100644
--- a/hal/audio_extn/fm.c
+++ b/hal/audio_extn/fm.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013-2018, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2013-2019, The Linux Foundation. All rights reserved.
* Not a Contribution.
*
* Copyright (C) 2013 The Android Open Source Project
@@ -31,6 +31,7 @@
#include "platform_api.h"
#include <stdlib.h>
#include <cutils/str_parms.h>
+#include <audio_extn.h>
#ifdef DYNAMIC_LOG_ENABLED
#include <log_xml_parser.h>
@@ -368,21 +369,21 @@
ALOGV("%s: set_fm_volume from param restore volume", __func__);
}
-#ifdef RECORD_PLAY_CONCURRENCY
- ret = str_parms_get_str(parms, AUDIO_PARAMETER_KEY_REC_PLAY_CONC,
+ if(audio_extn_is_record_play_concurrency_enabled()) {
+ ret = str_parms_get_str(parms, AUDIO_PARAMETER_KEY_REC_PLAY_CONC,
value, sizeof(value));
- if ((ret >= 0)
- && (fmmod.is_fm_running == true)) {
+ if ((ret >= 0)
+ && (fmmod.is_fm_running == true)) {
- if (!strncmp("true", value, sizeof("true")))
- ALOGD("Record play concurrency ON Forcing FM device reroute");
- else
- ALOGD("Record play concurrency OFF Forcing FM device reroute");
+ if (!strncmp("true", value, sizeof("true")))
+ ALOGD("Record play concurrency ON Forcing FM device reroute");
+ else
+ ALOGD("Record play concurrency OFF Forcing FM device reroute");
- select_devices(adev, USECASE_AUDIO_PLAYBACK_FM);
- fm_set_volume(adev, fmmod.fm_volume, false);
+ select_devices(adev, USECASE_AUDIO_PLAYBACK_FM);
+ fm_set_volume(adev, fmmod.fm_volume, false);
+ }
}
-#endif
exit:
ALOGV("%s: exit", __func__);
}
diff --git a/hal/audio_extn/hfp.c b/hal/audio_extn/hfp.c
index c82e875..55551dc 100644
--- a/hal/audio_extn/hfp.c
+++ b/hal/audio_extn/hfp.c
@@ -46,7 +46,6 @@
#include <log_utils.h>
#endif
-#ifdef HFP_ENABLED
#define AUDIO_PARAMETER_HFP_ENABLE "hfp_enable"
#define AUDIO_PARAMETER_HFP_SET_SAMPLING_RATE "hfp_set_sampling_rate"
#define AUDIO_PARAMETER_KEY_HFP_VOLUME "hfp_volume"
@@ -115,6 +114,18 @@
.avail_min = 0,
};
+//external feature dependency
+static fp_platform_set_mic_mute_t fp_platform_set_mic_mute;
+static fp_platform_get_pcm_device_id_t fp_platform_get_pcm_device_id;
+static fp_platform_set_echo_reference_t fp_platform_set_echo_reference;
+static fp_select_devices_t fp_select_devices;
+static fp_audio_extn_ext_hw_plugin_usecase_start_t fp_audio_extn_ext_hw_plugin_usecase_start;
+static fp_audio_extn_ext_hw_plugin_usecase_stop_t fp_audio_extn_ext_hw_plugin_usecase_stop;
+static fp_get_usecase_from_list_t fp_get_usecase_from_list;
+static fp_disable_audio_route_t fp_disable_audio_route;
+static fp_disable_snd_device_t fp_disable_snd_device;
+static fp_voice_get_mic_mute_t fp_voice_get_mic_mute;
+
static int32_t hfp_set_volume(struct audio_device *adev, float value)
{
int32_t vol, ret = 0;
@@ -167,6 +178,8 @@
struct mixer_ctl *ctl;
int pcm_device_id = HFP_ASM_RX_TX;
+ ALOGD("%s: enter, value=%f", __func__, value);
+
if (!hfpmod.is_hfp_running) {
ALOGE("%s: HFP not active, ignoring set_hfp_mic_volume call", __func__);
return -EIO;
@@ -209,6 +222,8 @@
int pcm_device_id = HFP_ASM_RX_TX;
float value = 0.0;
+ ALOGD("%s: enter", __func__);
+
if (!hfpmod.is_hfp_running) {
ALOGE("%s: HFP not active, ignoring set_hfp_mic_volume call", __func__);
return -EIO;
@@ -247,7 +262,7 @@
*
* This interface is used for mic mute state control
*/
-int audio_extn_hfp_set_mic_mute(struct audio_device *adev, bool state)
+int hfp_set_mic_mute(struct audio_device *adev, bool state)
{
int rc = 0;
@@ -278,7 +293,7 @@
return 0;
}
adev->enable_hfp = true;
- platform_set_mic_mute(adev->platform, false);
+ fp_platform_set_mic_mute(adev->platform, false);
uc_info = (struct audio_usecase *)calloc(1, sizeof(struct audio_usecase));
@@ -294,16 +309,16 @@
list_add_tail(&adev->usecase_list, &uc_info->list);
- select_devices(adev, hfpmod.ucid);
+ fp_select_devices(adev, hfpmod.ucid);
if ((uc_info->out_snd_device != SND_DEVICE_NONE) ||
(uc_info->in_snd_device != SND_DEVICE_NONE)) {
- if (audio_extn_ext_hw_plugin_usecase_start(adev->ext_hw_plugin, uc_info))
+ if (fp_audio_extn_ext_hw_plugin_usecase_start(adev->ext_hw_plugin, uc_info))
ALOGE("%s: failed to start ext hw plugin", __func__);
}
- pcm_dev_rx_id = platform_get_pcm_device_id(uc_info->id, PCM_PLAYBACK);
- pcm_dev_tx_id = platform_get_pcm_device_id(uc_info->id, PCM_CAPTURE);
+ pcm_dev_rx_id = fp_platform_get_pcm_device_id(uc_info->id, PCM_PLAYBACK);
+ pcm_dev_tx_id = fp_platform_get_pcm_device_id(uc_info->id, PCM_CAPTURE);
pcm_dev_asm_rx_id = hfpmod.hfp_pcm_dev_id;
pcm_dev_asm_tx_id = hfpmod.hfp_pcm_dev_id;
if (pcm_dev_rx_id < 0 || pcm_dev_tx_id < 0 ||
@@ -380,7 +395,7 @@
/* Set mic volume by mute status, we don't provide set mic volume in phone app, only
provide mute and unmute. */
- audio_extn_hfp_set_mic_mute(adev, adev->mic_muted);
+ hfp_set_mic_mute(adev, adev->mic_muted);
ALOGD("%s: exit: status(%d)", __func__, ret);
return 0;
@@ -417,7 +432,7 @@
hfpmod.hfp_pcm_tx = NULL;
}
- uc_info = get_usecase_from_list(adev, hfpmod.ucid);
+ uc_info = fp_get_usecase_from_list(adev, hfpmod.ucid);
if (uc_info == NULL) {
ALOGE("%s: Could not find the usecase (%d) in the list",
__func__, hfpmod.ucid);
@@ -426,23 +441,23 @@
if ((uc_info->out_snd_device != SND_DEVICE_NONE) ||
(uc_info->in_snd_device != SND_DEVICE_NONE)) {
- if (audio_extn_ext_hw_plugin_usecase_stop(adev->ext_hw_plugin, uc_info))
+ if (fp_audio_extn_ext_hw_plugin_usecase_stop(adev->ext_hw_plugin, uc_info))
ALOGE("%s: failed to stop ext hw plugin", __func__);
}
/* 2. Disable echo reference while stopping hfp */
- platform_set_echo_reference(adev, false, uc_info->devices);
+ fp_platform_set_echo_reference(adev, false, uc_info->devices);
/* 3. Get and set stream specific mixer controls */
- disable_audio_route(adev, uc_info);
+ fp_disable_audio_route(adev, uc_info);
/* 4. Disable the rx and tx devices */
- disable_snd_device(adev, uc_info->out_snd_device);
- disable_snd_device(adev, uc_info->in_snd_device);
+ fp_disable_snd_device(adev, uc_info->out_snd_device);
+ fp_disable_snd_device(adev, uc_info->in_snd_device);
/* Set the unmute Tx mixer control */
- if (voice_get_mic_mute(adev)) {
- platform_set_mic_mute(adev->platform, false);
+ if (fp_voice_get_mic_mute(adev)) {
+ fp_platform_set_mic_mute(adev->platform, false);
ALOGD("%s: unMute HFP Tx", __func__);
}
adev->enable_hfp = false;
@@ -454,10 +469,26 @@
return ret;
}
-bool audio_extn_hfp_is_active(struct audio_device *adev)
+void hfp_init(hfp_init_config_t init_config)
+{
+ fp_platform_set_mic_mute = init_config.fp_platform_set_mic_mute;
+ fp_platform_get_pcm_device_id = init_config.fp_platform_get_pcm_device_id;
+ fp_platform_set_echo_reference = init_config.fp_platform_set_echo_reference;
+ fp_select_devices = init_config.fp_select_devices;
+ fp_audio_extn_ext_hw_plugin_usecase_start =
+ init_config.fp_audio_extn_ext_hw_plugin_usecase_start;
+ fp_audio_extn_ext_hw_plugin_usecase_stop =
+ init_config.fp_audio_extn_ext_hw_plugin_usecase_stop;
+ fp_get_usecase_from_list = init_config.fp_get_usecase_from_list;
+ fp_disable_audio_route = init_config.fp_disable_audio_route;
+ fp_disable_snd_device = init_config.fp_disable_snd_device;
+ fp_voice_get_mic_mute = init_config.fp_voice_get_mic_mute;
+}
+
+bool hfp_is_active(struct audio_device *adev)
{
struct audio_usecase *hfp_usecase = NULL;
- hfp_usecase = get_usecase_from_list(adev, hfpmod.ucid);
+ hfp_usecase = fp_get_usecase_from_list(adev, hfpmod.ucid);
if (hfp_usecase != NULL)
return true;
@@ -465,13 +496,13 @@
return false;
}
-int hfp_set_mic_mute(struct audio_device *adev, bool state)
+int hfp_set_mic_mute2(struct audio_device *adev, bool state)
{
struct mixer_ctl *ctl;
const char *mixer_ctl_name = "HFP TX Mute";
long set_values[ ] = {0};
- ALOGI("%s: enter, state=%d", __func__, state);
+ ALOGD("%s: enter, state=%d", __func__, state);
set_values[0] = state;
ctl = mixer_get_ctl_by_name(adev->mixer, mixer_ctl_name);
@@ -485,12 +516,12 @@
return 0;
}
-audio_usecase_t audio_extn_hfp_get_usecase()
+audio_usecase_t hfp_get_usecase()
{
return hfpmod.ucid;
}
-void audio_extn_hfp_set_parameters(struct audio_device *adev, struct str_parms *parms)
+void hfp_set_parameters(struct audio_device *adev, struct str_parms *parms)
{
int ret;
int rate;
@@ -498,6 +529,8 @@
float vol;
char value[32]={0};
+ ALOGD("%s: enter", __func__);
+
ret = str_parms_get_str(parms, AUDIO_PARAMETER_HFP_ENABLE, value,
sizeof(value));
if (ret >= 0) {
@@ -530,7 +563,7 @@
if (ret >= 0) {
val = atoi(value);
if (val > 0)
- select_devices(adev, hfpmod.ucid);
+ fp_select_devices(adev, hfpmod.ucid);
}
}
@@ -571,4 +604,3 @@
exit:
ALOGV("%s Exit",__func__);
}
-#endif /*HFP_ENABLED*/
diff --git a/hal/audio_extn/passthru.c b/hal/audio_extn/passthru.c
index 9180391..14f8b72 100644
--- a/hal/audio_extn/passthru.c
+++ b/hal/audio_extn/passthru.c
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2014-2018, The Linux Foundation. All rights reserved.
+* Copyright (c) 2014-2019, The Linux Foundation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -34,6 +34,7 @@
#include <cutils/str_parms.h>
#include <cutils/log.h>
#include <unistd.h>
+#include <pthread.h>
#include "audio_hw.h"
#include "audio_extn.h"
#include "platform_api.h"
@@ -82,6 +83,18 @@
AUDIO_FORMAT_IEC61937
};
+//external function depedency
+static fp_platform_is_edid_supported_format_t fp_platform_is_edid_supported_format;
+static fp_platform_set_device_params_t fp_platform_set_device_params;
+static fp_platform_edid_get_max_channels_t fp_platform_edid_get_max_channels;
+static fp_platform_get_output_snd_device_t fp_platform_get_output_snd_device;
+static fp_platform_get_codec_backend_cfg_t fp_platform_get_codec_backend_cfg;
+static fp_platform_get_snd_device_name_t fp_platform_get_snd_device_name;
+static fp_platform_is_edid_supported_sample_rate_t fp_platform_is_edid_supported_sample_rate;
+static fp_audio_extn_keep_alive_start_t fp_audio_extn_keep_alive_start;
+static fp_audio_extn_keep_alive_stop_t fp_audio_extn_keep_alive_stop;
+static fp_audio_extn_utils_is_dolby_format_t fp_audio_extn_utils_is_dolby_format;
+
/*
* This atomic var is incremented/decremented by the offload stream to notify
* other pcm playback streams that a pass thru session is about to start or has
@@ -92,8 +105,7 @@
*/
static volatile int32_t compress_passthru_active;
-#ifdef DTSHD_PARSER_ENABLED
-int audio_extn_passthru_update_dts_stream_configuration(struct stream_out *out,
+int passthru_update_dts_stream_configuration(struct stream_out *out,
const void *buffer, size_t bytes)
{
struct audio_parser_codec_info codec_info;
@@ -115,8 +127,8 @@
}
if (!buffer || bytes <= 0) {
- ALOGD("Invalid buffer %p size %d skipping dts stream conf update",
- buffer, bytes);
+ ALOGD("Invalid buffer %p size %lu skipping dts stream conf update",
+ buffer, (unsigned long)bytes);
out->sample_rate = 48000;
out->compr_config.codec->sample_rate = out->sample_rate;
out->compr_config.codec->ch_in = 2;
@@ -137,7 +149,7 @@
ALOGD("dts new sample rate %d and channels %d\n",
dtshd_tr_info.sample_rate,
dtshd_tr_info.num_channels);
- for (i = 0; i < sizeof(dts_transmission_sample_rates); i++) {
+ for (i = 0; i < (sizeof(dts_transmission_sample_rates)/sizeof(int)); i++) {
if (dts_transmission_sample_rates[i] ==
dtshd_tr_info.sample_rate) {
out->sample_rate = dtshd_tr_info.sample_rate;
@@ -160,7 +172,7 @@
if (!is_valid_transmission_rate) {
ALOGE("%s:: Invalid dts transmission rate %d\n using default sample rate 48000",
- dtshd_tr_info.sample_rate);
+ __func__, dtshd_tr_info.sample_rate);
out->sample_rate = 48000;
out->compr_config.codec->sample_rate = out->sample_rate;
}
@@ -173,17 +185,24 @@
}
return 0;
}
-#else
-int audio_extn_passthru_update_dts_stream_configuration(
- struct stream_out *out __unused,
- const void *buffer __unused,
- size_t bytes __unused)
-{
- return -ENOSYS;
-}
-#endif
-int audio_extn_passthru_get_channel_count(struct stream_out *out)
+bool passthru_is_supported_format(audio_format_t format)
+{
+ int32_t num_passthru_formats = sizeof(audio_passthru_formats) /
+ sizeof(audio_passthru_formats[0]);
+ int32_t i;
+
+ for (i = 0; i < num_passthru_formats; i++) {
+ if (format == audio_passthru_formats[i]) {
+ ALOGD("%s : pass through format is true", __func__);
+ return true;
+ }
+ }
+ ALOGD("%s : pass through format is false", __func__);
+ return false;
+}
+
+int passthru_get_channel_count(struct stream_out *out)
{
int channel_count = DEFAULT_HDMI_OUT_CHANNELS;
@@ -192,7 +211,7 @@
return -EINVAL;
}
- if (!audio_extn_passthru_is_supported_format(out->format)) {
+ if (!passthru_is_supported_format(out->format)) {
ALOGE("%s:: not a passthrough format %d", __func__, out->format);
return -EINVAL;
}
@@ -218,28 +237,12 @@
return channel_count;
}
-bool audio_extn_passthru_is_supported_format(audio_format_t format)
-{
- int32_t num_passthru_formats = sizeof(audio_passthru_formats) /
- sizeof(audio_passthru_formats[0]);
- int32_t i;
-
- for (i = 0; i < num_passthru_formats; i++) {
- if (format == audio_passthru_formats[i]) {
- ALOGD("%s : pass through format is true", __func__);
- return true;
- }
- }
- ALOGD("%s : pass through format is false", __func__);
- return false;
-}
-
/*
* must be called with stream lock held
* This function decides based on some rules whether the data
* coming on stream out must be rendered or dropped.
*/
-bool audio_extn_passthru_should_drop_data(struct stream_out * out)
+bool passthru_should_drop_data(struct stream_out * out)
{
/*Drop data only
*stream is routed to HDMI and
@@ -259,7 +262,7 @@
}
/* called with adev lock held */
-void audio_extn_passthru_on_start(struct stream_out * out)
+void passthru_on_start(struct stream_out * out)
{
uint64_t max_period_us = 0;
@@ -301,7 +304,7 @@
}
/* called with adev lock held */
-void audio_extn_passthru_on_stop(struct stream_out * out)
+void passthru_on_stop(struct stream_out * out)
{
if (android_atomic_acquire_load(&compress_passthru_active) > 0) {
/*
@@ -313,17 +316,22 @@
if (out->devices & AUDIO_DEVICE_OUT_AUX_DIGITAL) {
ALOGD("%s: passthru on aux digital, start keep alive", __func__);
- audio_extn_keep_alive_start(KEEP_ALIVE_OUT_HDMI);
+ fp_audio_extn_keep_alive_start(KEEP_ALIVE_OUT_HDMI);
}
}
-void audio_extn_passthru_on_pause(struct stream_out * out __unused)
+void passthru_on_pause(struct stream_out * out __unused)
{
if (android_atomic_acquire_load(&compress_passthru_active) == 0)
return;
}
-int audio_extn_passthru_set_parameters(struct audio_device *adev __unused,
+bool passthru_is_active()
+{
+ return android_atomic_acquire_load(&compress_passthru_active) > 0;
+}
+
+int passthru_set_parameters(struct audio_device *adev __unused,
struct str_parms *parms)
{
char value[32];
@@ -332,9 +340,9 @@
if (ret >= 0) {
int val = atoi(value);
if (val & AUDIO_DEVICE_OUT_AUX_DIGITAL) {
- if (!audio_extn_passthru_is_active()) {
+ if (!passthru_is_active()) {
ALOGV("%s: start keep alive on aux digital", __func__);
- audio_extn_keep_alive_start(KEEP_ALIVE_OUT_HDMI);
+ fp_audio_extn_keep_alive_start(KEEP_ALIVE_OUT_HDMI);
}
}
}
@@ -345,29 +353,38 @@
int val = atoi(value);
if (val & AUDIO_DEVICE_OUT_AUX_DIGITAL) {
ALOGV("%s: stop keep_alive on aux digital on device", __func__);
- audio_extn_keep_alive_stop(KEEP_ALIVE_OUT_HDMI);
+ fp_audio_extn_keep_alive_stop(KEEP_ALIVE_OUT_HDMI);
}
}
return 0;
}
-bool audio_extn_passthru_is_active()
+bool passthru_is_enabled() { return true; }
+
+void passthru_init(passthru_init_config_t init_config)
{
- return android_atomic_acquire_load(&compress_passthru_active) > 0;
+ fp_platform_is_edid_supported_format =
+ init_config.fp_platform_is_edid_supported_format;
+ fp_platform_set_device_params = init_config.fp_platform_set_device_params;
+ fp_platform_edid_get_max_channels =
+ init_config.fp_platform_edid_get_max_channels;
+ fp_platform_get_output_snd_device = init_config.fp_platform_get_output_snd_device;
+ fp_platform_get_codec_backend_cfg =
+ init_config.fp_platform_get_codec_backend_cfg;
+ fp_platform_get_snd_device_name = init_config.fp_platform_get_snd_device_name;
+ fp_platform_is_edid_supported_sample_rate =
+ init_config.fp_platform_is_edid_supported_sample_rate;
+ fp_audio_extn_keep_alive_start = init_config.fp_audio_extn_keep_alive_start;
+ fp_audio_extn_keep_alive_stop = init_config.fp_audio_extn_keep_alive_stop;
+ fp_audio_extn_utils_is_dolby_format = init_config.fp_audio_extn_utils_is_dolby_format;
}
-bool audio_extn_passthru_is_enabled() { return true; }
-
-void audio_extn_passthru_init(struct audio_device *adev __unused)
-{
-}
-
-bool audio_extn_passthru_should_standby(struct stream_out * out __unused)
+bool passthru_should_standby(struct stream_out * out __unused)
{
return true;
}
-bool audio_extn_passthru_is_convert_supported(struct audio_device *adev,
+bool passthru_is_convert_supported(struct audio_device *adev,
struct stream_out *out)
{
@@ -375,9 +392,9 @@
switch (out->format) {
case AUDIO_FORMAT_E_AC3:
case AUDIO_FORMAT_E_AC3_JOC:
- if (!platform_is_edid_supported_format(adev->platform,
+ if (!fp_platform_is_edid_supported_format(adev->platform,
out->format)) {
- if (platform_is_edid_supported_format(adev->platform,
+ if (fp_platform_is_edid_supported_format(adev->platform,
AUDIO_FORMAT_AC3)) {
ALOGD("%s:PASSTHROUGH_CONVERT supported", __func__);
convert = true;
@@ -393,7 +410,7 @@
return convert;
}
-bool audio_extn_passthru_is_passt_supported(struct audio_device *adev,
+bool passthru_is_passt_supported(struct audio_device *adev,
struct stream_out *out)
{
bool passt = false;
@@ -401,15 +418,15 @@
case AUDIO_FORMAT_E_AC3:
case AUDIO_FORMAT_DTS_HD:
case AUDIO_FORMAT_DOLBY_TRUEHD:
- if (platform_is_edid_supported_format(adev->platform, out->format)) {
+ if (fp_platform_is_edid_supported_format(adev->platform, out->format)) {
ALOGV("%s:PASSTHROUGH supported for format %x",
__func__, out->format);
passt = true;
}
break;
case AUDIO_FORMAT_AC3:
- if (platform_is_edid_supported_format(adev->platform, AUDIO_FORMAT_AC3)
- || platform_is_edid_supported_format(adev->platform,
+ if (fp_platform_is_edid_supported_format(adev->platform, AUDIO_FORMAT_AC3)
+ || fp_platform_is_edid_supported_format(adev->platform,
AUDIO_FORMAT_E_AC3)) {
ALOGV("%s:PASSTHROUGH supported for format %x",
__func__, out->format);
@@ -418,7 +435,7 @@
break;
case AUDIO_FORMAT_E_AC3_JOC:
/* Check for DDP capability in edid for JOC contents.*/
- if (platform_is_edid_supported_format(adev->platform,
+ if (fp_platform_is_edid_supported_format(adev->platform,
AUDIO_FORMAT_E_AC3)) {
ALOGV("%s:PASSTHROUGH supported for format %x",
__func__, out->format);
@@ -426,8 +443,8 @@
}
break;
case AUDIO_FORMAT_DTS:
- if (platform_is_edid_supported_format(adev->platform, AUDIO_FORMAT_DTS)
- || platform_is_edid_supported_format(adev->platform,
+ if (fp_platform_is_edid_supported_format(adev->platform, AUDIO_FORMAT_DTS)
+ || fp_platform_is_edid_supported_format(adev->platform,
AUDIO_FORMAT_DTS_HD)) {
ALOGV("%s:PASSTHROUGH supported for format %x",
__func__, out->format);
@@ -440,15 +457,15 @@
return passt;
}
-void audio_extn_passthru_update_stream_configuration(
+void passthru_update_stream_configuration(
struct audio_device *adev, struct stream_out *out,
const void *buffer __unused, size_t bytes __unused)
{
if(out->compr_config.codec != NULL) {
- if (audio_extn_passthru_is_passt_supported(adev, out)) {
+ if (passthru_is_passt_supported(adev, out)) {
ALOGV("%s:PASSTHROUGH", __func__);
out->compr_config.codec->compr_passthr = PASSTHROUGH;
- } else if (audio_extn_passthru_is_convert_supported(adev, out)) {
+ } else if (passthru_is_convert_supported(adev, out)) {
ALOGV("%s:PASSTHROUGH CONVERT", __func__);
out->compr_config.codec->compr_passthr = PASSTHROUGH_CONVERT;
} else if (out->format == AUDIO_FORMAT_IEC61937) {
@@ -461,7 +478,7 @@
}
}
-bool audio_extn_passthru_is_passthrough_stream(struct stream_out *out)
+bool passthru_is_passthrough_stream(struct stream_out *out)
{
//check passthrough system property
if (!property_get_bool("vendor.audio.offload.passthrough", false)) {
@@ -475,13 +492,13 @@
return true;
//direct flag, check supported formats.
if (out->flags & AUDIO_OUTPUT_FLAG_DIRECT) {
- if (audio_extn_passthru_is_supported_format(out->format)) {
- if (platform_is_edid_supported_format(out->dev->platform,
+ if (passthru_is_supported_format(out->format)) {
+ if (fp_platform_is_edid_supported_format(out->dev->platform,
out->format)) {
ALOGV("%s : return true",__func__);
return true;
- } else if (audio_extn_utils_is_dolby_format(out->format) &&
- platform_is_edid_supported_format(out->dev->platform,
+ } else if (fp_audio_extn_utils_is_dolby_format(out->format) &&
+ fp_platform_is_edid_supported_format(out->dev->platform,
AUDIO_FORMAT_AC3)){
//return true for EAC3/EAC3_JOC formats
//if sink supports only AC3
@@ -495,16 +512,16 @@
return false;
}
-bool audio_extn_passthru_is_direct_passthrough(struct stream_out *out)
+bool passthru_is_direct_passthrough(struct stream_out *out)
{
- if (((out != NULL) && audio_extn_passthru_is_passthrough_stream(out)) &&
- !audio_extn_passthru_is_convert_supported(out->dev, out))
+ if (((out != NULL) && passthru_is_passthrough_stream(out)) &&
+ !passthru_is_convert_supported(out->dev, out))
return true;
else
return false;
}
-int audio_extn_passthru_get_buffer_size(audio_offload_info_t* info)
+int passthru_get_buffer_size(audio_offload_info_t* info)
{
uint32_t fragment_size = MIN_COMPRESS_PASSTHROUGH_FRAGMENT_SIZE;
char value[PROPERTY_VALUE_MAX] = {0};
@@ -532,17 +549,17 @@
}
-int audio_extn_passthru_set_volume(struct stream_out *out, int mute)
+int passthru_set_volume(struct stream_out *out, int mute)
{
- return platform_set_device_params(out, DEVICE_PARAM_MUTE_ID, mute);
+ return fp_platform_set_device_params(out, DEVICE_PARAM_MUTE_ID, mute);
}
-int audio_extn_passthru_set_latency(struct stream_out *out, int latency)
+int passthru_set_latency(struct stream_out *out, int latency)
{
- return platform_set_device_params(out, DEVICE_PARAM_LATENCY_ID, latency);
+ return fp_platform_set_device_params(out, DEVICE_PARAM_LATENCY_ID, latency);
}
-bool audio_extn_passthru_is_supported_backend_edid_cfg(struct audio_device *adev,
+bool passthru_is_supported_backend_edid_cfg(struct audio_device *adev,
struct stream_out *out)
{
struct audio_backend_cfg backend_cfg;
@@ -553,11 +570,11 @@
backend_cfg.passthrough_enabled = false;
snd_device_t out_snd_device = SND_DEVICE_NONE;
- int max_edid_channels = platform_edid_get_max_channels(out->dev->platform);
+ int max_edid_channels = fp_platform_edid_get_max_channels(out->dev->platform);
- out_snd_device = platform_get_output_snd_device(adev->platform, out);
+ out_snd_device = fp_platform_get_output_snd_device(adev->platform, out);
- if (platform_get_codec_backend_cfg(adev, out_snd_device, &backend_cfg)) {
+ if (fp_platform_get_codec_backend_cfg(adev, out_snd_device, &backend_cfg)) {
ALOGE("%s: ERROR: Unable to get current backend config!!!", __func__);
return false;
}
@@ -565,7 +582,7 @@
ALOGV("%s:becf: afe: bitwidth %d, samplerate %d channels %d format %d"
", device (%s)", __func__, backend_cfg.bit_width,
backend_cfg.sample_rate, backend_cfg.channels, backend_cfg.format,
- platform_get_snd_device_name(out_snd_device));
+ fp_platform_get_snd_device_name(out_snd_device));
/* Check if the channels are supported */
if (max_edid_channels < (int)backend_cfg.channels) {
@@ -577,7 +594,7 @@
}
/* Check if the sample rate supported */
- if (!platform_is_edid_supported_sample_rate(adev->platform,
+ if (!fp_platform_is_edid_supported_sample_rate(adev->platform,
backend_cfg.sample_rate)) {
ALOGE("%s: ERROR: Unsupported sample rate in passthru mode!!!"
diff --git a/hal/audio_extn/utils.c b/hal/audio_extn/utils.c
index c7d3bd4..6a74a4c 100644
--- a/hal/audio_extn/utils.c
+++ b/hal/audio_extn/utils.c
@@ -48,10 +48,8 @@
#endif
#ifdef AUDIO_EXTERNAL_HDMI_ENABLED
-#ifdef HDMI_PASSTHROUGH_ENABLED
#include "audio_parsers.h"
#endif
-#endif
#ifdef LINUX_ENABLED
#define AUDIO_OUTPUT_POLICY_VENDOR_CONFIG_FILE "/etc/audio_output_policy.conf"
@@ -129,9 +127,7 @@
STRING_TO_ENUM(AUDIO_OUTPUT_FLAG_COMPRESS_OFFLOAD),
STRING_TO_ENUM(AUDIO_OUTPUT_FLAG_NON_BLOCKING),
STRING_TO_ENUM(AUDIO_OUTPUT_FLAG_HW_AV_SYNC),
-#ifdef INCALL_MUSIC_ENABLED
STRING_TO_ENUM(AUDIO_OUTPUT_FLAG_INCALL_MUSIC),
-#endif
STRING_TO_ENUM(AUDIO_OUTPUT_FLAG_COMPRESS_PASSTHROUGH),
STRING_TO_ENUM(AUDIO_OUTPUT_FLAG_TIMESTAMP),
STRING_TO_ENUM(AUDIO_OUTPUT_FLAG_VOIP_RX),
@@ -1786,7 +1782,6 @@
channel_status[3] |= SR_48000;
}
-#ifdef HDMI_PASSTHROUGH_ENABLED
int32_t get_compressed_channel_status(void *audio_stream_data,
uint32_t audio_frame_size,
unsigned char *channel_status,
@@ -1815,8 +1810,6 @@
}
-#endif
-
void get_lpcm_channel_status(uint32_t sampleRate,
unsigned char *channel_status)
{
@@ -1873,15 +1866,14 @@
const char *mixer_ctl_name = "IEC958 Playback PCM Stream";
struct mixer_ctl *ctl;
ALOGV("%s: buffer %s bytes %zd", __func__, buffer, bytes);
-#ifdef HDMI_PASSTHROUGH_ENABLED
+
if (audio_extn_utils_is_dolby_format(out->format) &&
/*TODO:Extend code to support DTS passthrough*/
/*set compressed channel status bits*/
- audio_extn_passthru_is_passthrough_stream(out)){
+ audio_extn_passthru_is_passthrough_stream(out) &&
+ audio_extn_is_hdmi_passthru_enabled()) {
get_compressed_channel_status(buffer, bytes, channel_status, AUDIO_PARSER_CODEC_AC3);
- } else
-#endif
- {
+ } else {
/*set channel status bit for LPCM*/
get_lpcm_channel_status(out->sample_rate, channel_status);
}