Audio: DLKM support for all audio modules
Switch to DLKM for all audio kernel modules.
Change-Id: I6a96023a21f655f873531af9ace81f2b01eb0f58
Signed-off-by: Laxminath Kasam <lkasam@codeaurora.org>
diff --git a/dsp/Android.mk b/dsp/Android.mk
new file mode 100644
index 0000000..428901c
--- /dev/null
+++ b/dsp/Android.mk
@@ -0,0 +1,86 @@
+# Android makefile for audio kernel modules
+
+# Assume no targets will be supported
+
+# Check if this driver needs be built for current target
+ifeq ($(call is-board-platform,sdm845),true)
+AUDIO_SELECT := CONFIG_SND_SOC_SDM845=m
+endif
+
+ifeq ($(call is-board-platform,sdm670),true)
+AUDIO_SELECT := CONFIG_SND_SOC_SDM670=m
+endif
+
+AUDIO_CHIPSET := audio
+# Build/Package only in case of supported target
+ifeq ($(call is-board-platform-in-list,sdm845 sdm670),true)
+
+LOCAL_PATH := $(call my-dir)
+
+# This makefile is only for DLKM
+ifneq ($(findstring vendor,$(LOCAL_PATH)),)
+
+ifneq ($(findstring opensource,$(LOCAL_PATH)),)
+ AUDIO_BLD_DIR := $(ANDROID_BUILD_TOP)/vendor/qcom/opensource/audio-kernel
+endif # opensource
+
+DLKM_DIR := $(TOP)/device/qcom/common/dlkm
+
+# Build audio.ko as $(AUDIO_CHIPSET)_audio.ko
+###########################################################
+# This is set once per LOCAL_PATH, not per (kernel) module
+KBUILD_OPTIONS := AUDIO_ROOT=$(AUDIO_BLD_DIR)
+
+# We are actually building audio.ko here, as per the
+# requirement we are specifying <chipset>_audio.ko as LOCAL_MODULE.
+# This means we need to rename the module to <chipset>_audio.ko
+# after audio.ko is built.
+KBUILD_OPTIONS += MODNAME=q6_dlkm
+KBUILD_OPTIONS += BOARD_PLATFORM=$(TARGET_BOARD_PLATFORM)
+KBUILD_OPTIONS += $(AUDIO_SELECT)
+
+###########################################################
+include $(CLEAR_VARS)
+LOCAL_MODULE := $(AUDIO_CHIPSET)_q6.ko
+LOCAL_MODULE_KBUILD_NAME := q6_dlkm.ko
+LOCAL_MODULE_TAGS := optional
+LOCAL_MODULE_DEBUG_ENABLE := true
+LOCAL_MODULE_PATH := $(KERNEL_MODULES_OUT)
+include $(DLKM_DIR)/AndroidKernelModule.mk
+###########################################################
+include $(CLEAR_VARS)
+LOCAL_MODULE := $(AUDIO_CHIPSET)_usf.ko
+LOCAL_MODULE_KBUILD_NAME := usf_dlkm.ko
+LOCAL_MODULE_TAGS := optional
+LOCAL_MODULE_DEBUG_ENABLE := true
+LOCAL_MODULE_PATH := $(KERNEL_MODULES_OUT)
+include $(DLKM_DIR)/AndroidKernelModule.mk
+###########################################################
+include $(CLEAR_VARS)
+LOCAL_MODULE := $(AUDIO_CHIPSET)_adsp_loader.ko
+LOCAL_MODULE_KBUILD_NAME := adsp_loader_dlkm.ko
+LOCAL_MODULE_TAGS := optional
+LOCAL_MODULE_DEBUG_ENABLE := true
+LOCAL_MODULE_PATH := $(KERNEL_MODULES_OUT)
+include $(DLKM_DIR)/AndroidKernelModule.mk
+###########################################################
+include $(CLEAR_VARS)
+LOCAL_MODULE := $(AUDIO_CHIPSET)_q6_notifier.ko
+LOCAL_MODULE_KBUILD_NAME := q6_notifier_dlkm.ko
+LOCAL_MODULE_TAGS := optional
+LOCAL_MODULE_DEBUG_ENABLE := true
+LOCAL_MODULE_PATH := $(KERNEL_MODULES_OUT)
+include $(DLKM_DIR)/AndroidKernelModule.mk
+###########################################################
+include $(CLEAR_VARS)
+LOCAL_MODULE := $(AUDIO_CHIPSET)_q6_pdr.ko
+LOCAL_MODULE_KBUILD_NAME := q6_pdr_dlkm.ko
+LOCAL_MODULE_TAGS := optional
+LOCAL_MODULE_DEBUG_ENABLE := true
+LOCAL_MODULE_PATH := $(KERNEL_MODULES_OUT)
+include $(DLKM_DIR)/AndroidKernelModule.mk
+###########################################################
+###########################################################
+
+endif # DLKM check
+endif # supported target check
diff --git a/dsp/Kbuild b/dsp/Kbuild
new file mode 100644
index 0000000..8772085
--- /dev/null
+++ b/dsp/Kbuild
@@ -0,0 +1,149 @@
+# We can build either as part of a standalone Kernel build or as
+# an external module. Determine which mechanism is being used
+KERNEL_BUILD := 0
+
+
+ifeq ($(KERNEL_BUILD), 0)
+ # These are configurable via Kconfig for kernel-based builds
+ # Need to explicitly configure for Android-based builds
+ ifeq ($(CONFIG_ARCH_SDM845), y)
+ include $(AUDIO_ROOT)/config/sdm845auto.conf
+ export
+ endif
+ ifeq ($(CONFIG_ARCH_SDM670), y)
+ include $(AUDIO_ROOT)/config/sdm670auto.conf
+ export
+ endif
+endif
+
+
+# As per target team, build is done as follows:
+# Defconfig : build with default flags
+# Slub : defconfig + CONFIG_SLUB_DEBUG := y +
+# CONFIG_SLUB_DEBUG_ON := y + CONFIG_PAGE_POISONING := y
+# Perf : Using appropriate msmXXXX-perf_defconfig
+#
+# Shipment builds (user variants) should not have any debug feature
+# enabled. This is identified using 'TARGET_BUILD_VARIANT'. Slub builds
+# are identified using the CONFIG_SLUB_DEBUG_ON configuration. Since
+# there is no other way to identify defconfig builds, QTI internal
+# representation of perf builds (identified using the string 'perf'),
+# is used to identify if the build is a slub or defconfig one. This
+# way no critical debug feature will be enabled for perf and shipment
+# builds. Other OEMs are also protected using the TARGET_BUILD_VARIANT
+# config.
+
+############ UAPI ############
+UAPI_DIR := uapi
+UAPI_INC := -I$(AUDIO_ROOT)/include/$(UAPI_DIR)
+
+############ COMMON ############
+COMMON_DIR := include
+COMMON_INC := -I$(AUDIO_ROOT)/$(COMMON_DIR)
+
+############ QDSP6V2 ############
+
+ifeq ($(CONFIG_SND_SOC_MSM_QDSP6V2_INTF), m)
+ Q6_OBJS += audio_calibration.o
+ Q6_OBJS += audio_cal_utils.o
+ Q6_OBJS += msm-dts-srs-tm-config.o
+ Q6_OBJS += q6adm.o
+ Q6_OBJS += q6afe.o
+ Q6_OBJS += q6asm.o
+ Q6_OBJS += q6audio-v2.o
+ Q6_OBJS += q6voice.o
+ Q6_OBJS += q6core.o
+ Q6_OBJS += rtac.o
+ Q6_OBJS += q6lsm.o
+ Q6_OBJS += audio_slimslave.o
+ Q6_OBJS += adsp_err.o
+ Q6_OBJS += msm_audio_ion.o
+ Q6_OBJS += avtimer.o
+ Q6_OBJS += q6_init.o
+endif
+ifeq ($(CONFIG_MSM_ADSP_LOADER), m)
+ADSP_LOADER_OBJS += adsp-loader.o
+endif
+
+ifeq ($(CONFIG_MSM_QDSP6_NOTIFIER), m)
+QDSP6_NOTIFIER_OBJS += audio_notifier.o audio_ssr.o
+endif
+
+ifeq ($(CONFIG_MSM_QDSP6_PDR), m)
+QDSP6_PDR_OBJS += audio_pdr.o
+endif
+
+ifeq ($(CONFIG_MSM_ULTRASOUND), m)
+USF_OBJS += usf.o usfcdev.o q6usm.o
+endif
+
+LINUX_INC += -Iinclude/linux
+
+INCS := $(COMMON_INC) \
+ $(UAPI_INC)
+
+ifeq ($(CONFIG_ARCH_SDM845), y)
+INCS += -include $(AUDIO_ROOT)/config/sdm845autoconf.h
+endif
+ifeq ($(CONFIG_ARCH_SDM670), y)
+INCS += -include $(AUDIO_ROOT)/config/sdm670autoconf.h
+endif
+
+EXTRA_CFLAGS += $(INCS)
+
+
+CDEFINES += -DANI_LITTLE_BYTE_ENDIAN \
+ -DANI_LITTLE_BIT_ENDIAN \
+ -DDOT11F_LITTLE_ENDIAN_HOST \
+ -DANI_COMPILER_TYPE_GCC \
+ -DANI_OS_TYPE_ANDROID=6 \
+ -DPTT_SOCK_SVC_ENABLE \
+ -Wall\
+ -Werror\
+ -D__linux__
+
+KBUILD_CPPFLAGS += $(CDEFINES)
+
+# Currently, for versions of gcc which support it, the kernel Makefile
+# is disabling the maybe-uninitialized warning. Re-enable it for the
+# AUDIO driver. Note that we must use EXTRA_CFLAGS here so that it
+# will override the kernel settings.
+ifeq ($(call cc-option-yn, -Wmaybe-uninitialized),y)
+EXTRA_CFLAGS += -Wmaybe-uninitialized
+endif
+#EXTRA_CFLAGS += -Wmissing-prototypes
+
+ifeq ($(call cc-option-yn, -Wheader-guard),y)
+EXTRA_CFLAGS += -Wheader-guard
+endif
+
+# If the module name is not "wlan", then the define MULTI_IF_NAME to be the
+# same a the QCA CHIP name. The host driver will then append MULTI_IF_NAME to
+# any string that must be unique for all instances of the driver on the system.
+# This allows multiple instances of the driver with different module names.
+# If the module name is wlan, leave MULTI_IF_NAME undefined and the code will
+# treat the driver as the primary driver.
+ifneq ($(MODNAME), qdsp6v2)
+CHIP_NAME ?= $(MODNAME)
+CDEFINES += -DMULTI_IF_NAME=\"$(CHIP_NAME)\"
+endif
+
+KBUILD_EXTRA_SYMBOLS +=$(OUT)/obj/vendor/qcom/opensource/audio-kernel/ipc/Module.symvers
+
+obj-$(CONFIG_SND_SOC_MSM_QDSP6V2_INTF) += q6_dlkm.o
+q6_dlkm-y := $(Q6_OBJS)
+
+obj-$(CONFIG_MSM_ULTRASOUND) += usf_dlkm.o
+usf_dlkm-y := $(USF_OBJS)
+
+obj-$(CONFIG_MSM_ADSP_LOADER) += adsp_loader_dlkm.o
+adsp_loader_dlkm-y := $(ADSP_LOADER_OBJS)
+
+obj-$(CONFIG_MSM_QDSP6_NOTIFIER) += q6_notifier_dlkm.o
+q6_notifier_dlkm-y := $(QDSP6_NOTIFIER_OBJS)
+
+obj-$(CONFIG_MSM_QDSP6_PDR) += q6_pdr_dlkm.o
+q6_pdr_dlkm-y := $(QDSP6_PDR_OBJS)
+
+# inject some build related information
+DEFINES += -DBUILD_TIMESTAMP=\"$(shell date -u +'%Y-%m-%dT%H:%M:%SZ')\"
diff --git a/dsp/adsp_err.c b/dsp/adsp_err.c
index 319efc3..7ad80dc 100644
--- a/dsp/adsp_err.c
+++ b/dsp/adsp_err.c
@@ -63,7 +63,7 @@
/* Unexpected error code. */
#define ADSP_ERR_MAX_STR "ADSP_ERR_MAX"
-#ifdef CONFIG_SND_SOC_QDSP_DEBUG
+#if IS_ENABLED(CONFIG_SND_SOC_QDSP_DEBUG)
static bool adsp_err_panic;
#ifdef CONFIG_DEBUG_FS
@@ -123,7 +123,7 @@
{ -EADV, ADSP_ERR_MAX_STR},
};
-#ifdef CONFIG_SND_SOC_QDSP_DEBUG
+#if IS_ENABLED(CONFIG_SND_SOC_QDSP_DEBUG)
static inline void adsp_err_check_panic(u32 adsp_error)
{
if (adsp_err_panic && adsp_error != ADSP_EALREADY)
@@ -151,8 +151,8 @@
return adsp_err_code_info[adsp_error].adsp_err_str;
}
-#if defined(CONFIG_SND_SOC_QDSP_DEBUG) && defined(CONFIG_DEBUG_FS)
-static int __init adsp_err_init(void)
+#if IS_ENABLED(CONFIG_SND_SOC_QDSP_DEBUG) && defined(CONFIG_DEBUG_FS)
+int __init adsp_err_init(void)
{
@@ -162,6 +162,12 @@
return 0;
}
+#else
+int __init adsp_err_init(void) { return 0; }
-device_initcall(adsp_err_init);
#endif
+
+void __exit adsp_err_exit(void)
+{
+ return;
+}
diff --git a/dsp/audio_cal_utils.c b/dsp/audio_cal_utils.c
index 9a9a96a..ffd3929 100644
--- a/dsp/audio_cal_utils.c
+++ b/dsp/audio_cal_utils.c
@@ -481,6 +481,14 @@
return;
}
+/**
+ * cal_utils_destroy_cal_types -
+ * Destroys cal types and deregister from cal info
+ *
+ * @num_cal_types: number of cal types
+ * @cal_type: cal type pointer with cal info
+ *
+ */
void cal_utils_destroy_cal_types(int num_cal_types,
struct cal_type_data **cal_type)
{
@@ -506,6 +514,7 @@
done:
return;
}
+EXPORT_SYMBOL(cal_utils_destroy_cal_types);
/**
* cal_utils_get_only_cal_block
diff --git a/dsp/audio_calibration.c b/dsp/audio_calibration.c
index 59fd464..f812c98 100644
--- a/dsp/audio_calibration.c
+++ b/dsp/audio_calibration.c
@@ -593,7 +593,7 @@
.fops = &audio_cal_fops,
};
-static int __init audio_cal_init(void)
+int __init audio_cal_init(void)
{
int i = 0;
@@ -609,7 +609,7 @@
return misc_register(&audio_cal_misc);
}
-static void __exit audio_cal_exit(void)
+void __exit audio_cal_exit(void)
{
int i = 0;
struct list_head *ptr, *next;
@@ -627,10 +627,9 @@
client_info_node = NULL;
}
}
+ misc_deregister(&audio_cal_misc);
}
-subsys_initcall(audio_cal_init);
-module_exit(audio_cal_exit);
MODULE_DESCRIPTION("SoC QDSP6v2 Audio Calibration driver");
MODULE_LICENSE("GPL v2");
diff --git a/dsp/audio_notifier.c b/dsp/audio_notifier.c
index a1b5d1e..485c703 100644
--- a/dsp/audio_notifier.c
+++ b/dsp/audio_notifier.c
@@ -12,7 +12,6 @@
#include <linux/module.h>
#include <linux/slab.h>
-#include <soc/qcom/scm.h>
#include <soc/qcom/subsystem_notif.h>
#include <soc/qcom/service-notifier.h>
#include <dsp/audio_notifier.h>
@@ -489,9 +488,6 @@
static int audio_notifer_ssr_adsp_cb(struct notifier_block *this,
unsigned long opcode, void *data)
{
- if (opcode == SUBSYS_BEFORE_SHUTDOWN)
- audio_ssr_send_nmi(data);
-
return audio_notifer_service_cb(opcode,
AUDIO_NOTIFIER_SSR_SERVICE,
AUDIO_NOTIFIER_ADSP_DOMAIN);
@@ -602,23 +598,6 @@
return 0;
}
-subsys_initcall(audio_notifier_subsys_init);
-
-static int __init audio_notifier_init(void)
-{
- int ret;
-
- ret = audio_pdr_register(&pdr_nb);
- if (ret < 0) {
- pr_debug("%s: PDR register failed, ret = %d, disable service\n",
- __func__, ret);
- audio_notifer_disable_service(AUDIO_NOTIFIER_PDR_SERVICE);
- }
-
- /* Do not return error since PDR enablement is not critical */
- return 0;
-}
-module_init(audio_notifier_init);
static int __init audio_notifier_late_init(void)
{
@@ -633,4 +612,32 @@
mutex_unlock(¬ifier_mutex);
return 0;
}
-late_initcall(audio_notifier_late_init);
+
+static int __init audio_notifier_init(void)
+{
+ int ret;
+
+ audio_notifier_subsys_init();
+
+ ret = audio_pdr_register(&pdr_nb);
+ if (ret < 0) {
+ pr_err("%s: PDR register failed, ret = %d, disable service\n",
+ __func__, ret);
+ audio_notifer_disable_service(AUDIO_NOTIFIER_PDR_SERVICE);
+ }
+
+ /* Do not return error since PDR enablement is not critical */
+ audio_notifier_late_init();
+
+ return 0;
+}
+module_init(audio_notifier_init);
+
+static void __exit audio_notifier_exit(void)
+{
+ audio_pdr_deregister(&pdr_nb);
+}
+module_exit(audio_notifier_exit);
+
+MODULE_DESCRIPTION("Audio notifier driver");
+MODULE_LICENSE("GPL v2");
diff --git a/dsp/audio_pdr.c b/dsp/audio_pdr.c
index 0edcf02..75f3bbb 100644
--- a/dsp/audio_pdr.c
+++ b/dsp/audio_pdr.c
@@ -63,6 +63,14 @@
.priority = 0,
};
+/**
+ * audio_pdr_register -
+ * register to PDR framework
+ *
+ * @nb: notifier block
+ *
+ * Returns 0 on success or error on failure
+ */
int audio_pdr_register(struct notifier_block *nb)
{
if (nb == NULL) {
@@ -73,6 +81,24 @@
}
EXPORT_SYMBOL(audio_pdr_register);
+/**
+ * audio_pdr_deregister -
+ * Deregister from PDR framework
+ *
+ * @nb: notifier block
+ *
+ * Returns 0 on success or error on failure
+ */
+int audio_pdr_deregister(struct notifier_block *nb)
+{
+ if (nb == NULL) {
+ pr_err("%s: Notifier block is NULL\n", __func__);
+ return -EINVAL;
+ }
+ return srcu_notifier_chain_unregister(&audio_pdr_cb_list, nb);
+}
+EXPORT_SYMBOL(audio_pdr_deregister);
+
void *audio_pdr_service_register(int domain_id,
struct notifier_block *nb, int *curr_state)
{
@@ -125,12 +151,13 @@
srcu_init_notifier_head(&audio_pdr_cb_list);
return 0;
}
-subsys_initcall(audio_pdr_subsys_init);
static int __init audio_pdr_late_init(void)
{
int ret;
+ audio_pdr_subsys_init();
+
ret = get_service_location(
audio_pdr_services[AUDIO_PDR_DOMAIN_ADSP].client_name,
audio_pdr_services[AUDIO_PDR_DOMAIN_ADSP].service_name,
@@ -144,4 +171,12 @@
return ret;
}
-late_initcall(audio_pdr_late_init);
+module_init(audio_pdr_late_init);
+
+static void __exit audio_pdr_late_exit(void)
+{
+}
+module_exit(audio_pdr_late_exit);
+
+MODULE_DESCRIPTION("PDR framework driver");
+MODULE_LICENSE("GPL v2");
diff --git a/dsp/audio_pdr.h b/dsp/audio_pdr.h
index ebfd366..2a45c6a 100644
--- a/dsp/audio_pdr.h
+++ b/dsp/audio_pdr.h
@@ -41,6 +41,7 @@
* Failure: Error code
*/
int audio_pdr_register(struct notifier_block *nb);
+int audio_pdr_deregister(struct notifier_block *nb);
/*
* Use audio_pdr_service_register to register with a PDR service
diff --git a/dsp/audio_slimslave.c b/dsp/audio_slimslave.c
index e9ecfd5..f9e9cdc 100644
--- a/dsp/audio_slimslave.c
+++ b/dsp/audio_slimslave.c
@@ -160,17 +160,15 @@
.suspend = audio_slimslave_suspend,
};
-static int __init audio_slimslave_init(void)
+int __init audio_slimslave_init(void)
{
return slim_driver_register(&audio_slimslave_driver);
}
-module_init(audio_slimslave_init);
-static void __exit audio_slimslave_exit(void)
+void __exit audio_slimslave_exit(void)
{
}
-module_exit(audio_slimslave_exit);
/* Module information */
MODULE_DESCRIPTION("Audio side Slimbus slave driver");
diff --git a/dsp/audio_ssr.c b/dsp/audio_ssr.c
index d3880c9..b1acb91 100644
--- a/dsp/audio_ssr.c
+++ b/dsp/audio_ssr.c
@@ -11,18 +11,24 @@
*/
#include <linux/module.h>
-#include <soc/qcom/scm.h>
#include <soc/qcom/subsystem_restart.h>
#include <soc/qcom/subsystem_notif.h>
#include "audio_ssr.h"
-#define SCM_Q6_NMI_CMD 0x1
-
static char *audio_ssr_domains[] = {
"adsp",
"modem"
};
+/**
+ * audio_ssr_register -
+ * register to SSR framework
+ *
+ * @domain_id: Domain ID to register with
+ * @nb: notifier block
+ *
+ * Returns handle pointer on success or error PTR on failure
+ */
void *audio_ssr_register(int domain_id, struct notifier_block *nb)
{
if ((domain_id < 0) ||
@@ -36,31 +42,18 @@
}
EXPORT_SYMBOL(audio_ssr_register);
+/**
+ * audio_ssr_deregister -
+ * Deregister handle from SSR framework
+ *
+ * @handle: SSR handle
+ * @nb: notifier block
+ *
+ * Returns 0 on success or error on failure
+ */
int audio_ssr_deregister(void *handle, struct notifier_block *nb)
{
return subsys_notif_unregister_notifier(handle, nb);
}
EXPORT_SYMBOL(audio_ssr_deregister);
-void audio_ssr_send_nmi(void *ssr_cb_data)
-{
- struct notif_data *data = (struct notif_data *)ssr_cb_data;
- struct scm_desc desc;
-
- if (data && data->crashed) {
- /* Send NMI to QDSP6 via an SCM call. */
- if (!is_scm_armv8()) {
- scm_call_atomic1(SCM_SVC_UTIL,
- SCM_Q6_NMI_CMD, 0x1);
- } else {
- desc.args[0] = 0x1;
- desc.arginfo = SCM_ARGS(1);
- scm_call2_atomic(SCM_SIP_FNID(SCM_SVC_UTIL,
- SCM_Q6_NMI_CMD), &desc);
- }
- /* The write should go through before q6 is shutdown */
- mb();
- pr_debug("%s: Q6 NMI was sent.\n", __func__);
- }
-}
-EXPORT_SYMBOL(audio_ssr_send_nmi);
diff --git a/dsp/avtimer.c b/dsp/avtimer.c
index 63044db..184e0e9 100644
--- a/dsp/avtimer.c
+++ b/dsp/avtimer.c
@@ -517,7 +517,7 @@
},
};
-static int __init avtimer_init(void)
+int __init avtimer_init(void)
{
s32 rc;
@@ -535,14 +535,10 @@
return rc;
}
-static void __exit avtimer_exit(void)
+void __exit avtimer_exit(void)
{
- pr_debug("%s: avtimer_exit\n", __func__);
platform_driver_unregister(&dev_avtimer_driver);
}
-module_init(avtimer_init);
-module_exit(avtimer_exit);
-
MODULE_DESCRIPTION("avtimer driver");
MODULE_LICENSE("GPL v2");
diff --git a/dsp/codecs/Android.mk b/dsp/codecs/Android.mk
new file mode 100644
index 0000000..865ace1
--- /dev/null
+++ b/dsp/codecs/Android.mk
@@ -0,0 +1,54 @@
+# Android makefile for audio kernel modules
+
+# Assume no targets will be supported
+
+# Check if this driver needs be built for current target
+ifeq ($(call is-board-platform,sdm845),true)
+AUDIO_SELECT := CONFIG_SND_SOC_SDM845=m
+endif
+
+ifeq ($(call is-board-platform,sdm670),true)
+AUDIO_SELECT := CONFIG_SND_SOC_SDM670=m
+endif
+
+AUDIO_CHIPSET := audio
+# Build/Package only in case of supported target
+ifeq ($(call is-board-platform-in-list,sdm845 sdm670),true)
+
+LOCAL_PATH := $(call my-dir)
+
+# This makefile is only for DLKM
+ifneq ($(findstring vendor,$(LOCAL_PATH)),)
+
+ifneq ($(findstring opensource,$(LOCAL_PATH)),)
+ AUDIO_BLD_DIR := $(ANDROID_BUILD_TOP)/vendor/qcom/opensource/audio-kernel
+endif # opensource
+
+DLKM_DIR := $(TOP)/device/qcom/common/dlkm
+
+# Build audio.ko as $(AUDIO_CHIPSET)_audio.ko
+###########################################################
+# This is set once per LOCAL_PATH, not per (kernel) module
+KBUILD_OPTIONS := AUDIO_ROOT=$(AUDIO_BLD_DIR)
+
+# We are actually building audio.ko here, as per the
+# requirement we are specifying <chipset>_audio.ko as LOCAL_MODULE.
+# This means we need to rename the module to <chipset>_audio.ko
+# after audio.ko is built.
+KBUILD_OPTIONS += MODNAME=native_dlkm
+KBUILD_OPTIONS += BOARD_PLATFORM=$(TARGET_BOARD_PLATFORM)
+KBUILD_OPTIONS += $(AUDIO_SELECT)
+
+###########################################################
+include $(CLEAR_VARS)
+LOCAL_MODULE := $(AUDIO_CHIPSET)_native.ko
+LOCAL_MODULE_KBUILD_NAME := native_dlkm.ko
+LOCAL_MODULE_TAGS := optional
+LOCAL_MODULE_DEBUG_ENABLE := true
+LOCAL_MODULE_PATH := $(KERNEL_MODULES_OUT)
+include $(DLKM_DIR)/AndroidKernelModule.mk
+###########################################################
+###########################################################
+
+endif # DLKM check
+endif # supported target check
diff --git a/dsp/codecs/Kbuild b/dsp/codecs/Kbuild
new file mode 100644
index 0000000..683f599
--- /dev/null
+++ b/dsp/codecs/Kbuild
@@ -0,0 +1,133 @@
+# We can build either as part of a standalone Kernel build or as
+# an external module. Determine which mechanism is being used
+KERNEL_BUILD := 0
+
+
+ifeq ($(KERNEL_BUILD), 0)
+ # These are configurable via Kconfig for kernel-based builds
+ # Need to explicitly configure for Android-based builds
+ ifeq ($(CONFIG_ARCH_SDM845), y)
+ include $(AUDIO_ROOT)/config/sdm845auto.conf
+ export
+ endif
+ ifeq ($(CONFIG_ARCH_SDM670), y)
+ include $(AUDIO_ROOT)/config/sdm670auto.conf
+ export
+ endif
+endif
+
+
+# As per target team, build is done as follows:
+# Defconfig : build with default flags
+# Slub : defconfig + CONFIG_SLUB_DEBUG := y +
+# CONFIG_SLUB_DEBUG_ON := y + CONFIG_PAGE_POISONING := y
+# Perf : Using appropriate msmXXXX-perf_defconfig
+#
+# Shipment builds (user variants) should not have any debug feature
+# enabled. This is identified using 'TARGET_BUILD_VARIANT'. Slub builds
+# are identified using the CONFIG_SLUB_DEBUG_ON configuration. Since
+# there is no other way to identify defconfig builds, QTI internal
+# representation of perf builds (identified using the string 'perf'),
+# is used to identify if the build is a slub or defconfig one. This
+# way no critical debug feature will be enabled for perf and shipment
+# builds. Other OEMs are also protected using the TARGET_BUILD_VARIANT
+# config.
+
+############ UAPI ############
+UAPI_DIR := uapi
+UAPI_INC := -I$(AUDIO_ROOT)/include/$(UAPI_DIR)
+
+############ COMMON ############
+COMMON_DIR := include
+COMMON_INC := -I$(AUDIO_ROOT)/$(COMMON_DIR)
+
+############ Native Enc/Dec ############
+
+ifeq ($(CONFIG_MSM_QDSP6V2_CODECS), m)
+ NATIVE_OBJS += q6audio_v2.o q6audio_v2_aio.o
+ NATIVE_OBJS += audio_utils_aio.o
+ NATIVE_OBJS += audio_utils.o
+ NATIVE_OBJS += audio_native.o
+ NATIVE_OBJS += aac_in.o
+ NATIVE_OBJS += amrnb_in.o
+ NATIVE_OBJS += amrwb_in.o
+ NATIVE_OBJS += audio_aac.o
+ NATIVE_OBJS += audio_alac.o
+ NATIVE_OBJS += audio_amrnb.o
+ NATIVE_OBJS += audio_amrwb.o
+ NATIVE_OBJS += audio_amrwbplus.o
+ NATIVE_OBJS += audio_ape.o
+ NATIVE_OBJS += audio_evrc.o
+ NATIVE_OBJS += audio_g711alaw.o
+ NATIVE_OBJS += audio_g711mlaw.o
+ NATIVE_OBJS += audio_hwacc_effects.o
+ NATIVE_OBJS += audio_mp3.o
+ NATIVE_OBJS += audio_multi_aac.o
+ NATIVE_OBJS += audio_qcelp.o
+ NATIVE_OBJS += audio_wma.o
+ NATIVE_OBJS += audio_wmapro.o
+ NATIVE_OBJS += evrc_in.o
+ NATIVE_OBJS += g711alaw_in.o
+ NATIVE_OBJS += g711mlaw_in.o
+ NATIVE_OBJS += qcelp_in.o
+endif
+
+LINUX_INC += -Iinclude/linux
+
+INCS := $(COMMON_INC) \
+ $(UAPI_INC)
+
+ifeq ($(CONFIG_ARCH_SDM845), y)
+INCS += -include $(AUDIO_ROOT)/config/sdm845autoconf.h
+endif
+ifeq ($(CONFIG_ARCH_SDM670), y)
+INCS += -include $(AUDIO_ROOT)/config/sdm670autoconf.h
+endif
+
+EXTRA_CFLAGS += $(INCS)
+
+
+CDEFINES += -DANI_LITTLE_BYTE_ENDIAN \
+ -DANI_LITTLE_BIT_ENDIAN \
+ -DDOT11F_LITTLE_ENDIAN_HOST \
+ -DANI_COMPILER_TYPE_GCC \
+ -DANI_OS_TYPE_ANDROID=6 \
+ -DPTT_SOCK_SVC_ENABLE \
+ -Wall\
+ -Werror\
+ -D__linux__
+
+KBUILD_CPPFLAGS += $(CDEFINES)
+
+# Currently, for versions of gcc which support it, the kernel Makefile
+# is disabling the maybe-uninitialized warning. Re-enable it for the
+# AUDIO driver. Note that we must use EXTRA_CFLAGS here so that it
+# will override the kernel settings.
+ifeq ($(call cc-option-yn, -Wmaybe-uninitialized),y)
+EXTRA_CFLAGS += -Wmaybe-uninitialized
+endif
+#EXTRA_CFLAGS += -Wmissing-prototypes
+
+ifeq ($(call cc-option-yn, -Wheader-guard),y)
+EXTRA_CFLAGS += -Wheader-guard
+endif
+
+KBUILD_EXTRA_SYMBOLS +=$(OUT)/obj/vendor/qcom/opensource/audio-kernel/dsp/Module.symvers
+KBUILD_EXTRA_SYMBOLS +=$(OUT)/obj/vendor/qcom/opensource/audio-kernel/asoc/Module.symvers
+# If the module name is not "wlan", then the define MULTI_IF_NAME to be the
+# same a the QCA CHIP name. The host driver will then append MULTI_IF_NAME to
+# any string that must be unique for all instances of the driver on the system.
+# This allows multiple instances of the driver with different module names.
+# If the module name is wlan, leave MULTI_IF_NAME undefined and the code will
+# treat the driver as the primary driver.
+ifneq ($(MODNAME), qdsp6v2)
+CHIP_NAME ?= $(MODNAME)
+CDEFINES += -DMULTI_IF_NAME=\"$(CHIP_NAME)\"
+endif
+
+# Module information used by KBuild framework
+obj-$(CONFIG_MSM_QDSP6V2_CODECS) += native_dlkm.o
+native_dlkm-y := $(NATIVE_OBJS)
+
+# inject some build related information
+DEFINES += -DBUILD_TIMESTAMP=\"$(shell date -u +'%Y-%m-%dT%H:%M:%SZ')\"
diff --git a/dsp/codecs/aac_in.c b/dsp/codecs/aac_in.c
index c0828dc..5c07141 100644
--- a/dsp/codecs/aac_in.c
+++ b/dsp/codecs/aac_in.c
@@ -702,8 +702,12 @@
.fops = &audio_in_fops,
};
-static int __init aac_in_init(void)
+int __init aac_in_init(void)
{
return misc_register(&audio_aac_in_misc);
}
-device_initcall(aac_in_init);
+
+void __exit aac_in_exit(void)
+{
+ misc_deregister(&audio_aac_in_misc);
+}
diff --git a/dsp/codecs/amrnb_in.c b/dsp/codecs/amrnb_in.c
index b24764c..d9a019d 100644
--- a/dsp/codecs/amrnb_in.c
+++ b/dsp/codecs/amrnb_in.c
@@ -394,9 +394,12 @@
.fops = &audio_in_fops,
};
-static int __init amrnb_in_init(void)
+int __init amrnb_in_init(void)
{
return misc_register(&audio_amrnb_in_misc);
}
-device_initcall(amrnb_in_init);
+void __exit amrnb_in_exit(void)
+{
+ misc_deregister(&audio_amrnb_in_misc);
+}
diff --git a/dsp/codecs/amrwb_in.c b/dsp/codecs/amrwb_in.c
index 77b4be5..d1d4ab7 100644
--- a/dsp/codecs/amrwb_in.c
+++ b/dsp/codecs/amrwb_in.c
@@ -392,9 +392,12 @@
.fops = &audio_in_fops,
};
-static int __init amrwb_in_init(void)
+int __init amrwb_in_init(void)
{
return misc_register(&audio_amrwb_in_misc);
}
-device_initcall(amrwb_in_init);
+void __exit amrwb_in_exit(void)
+{
+ misc_deregister(&audio_amrwb_in_misc);
+}
diff --git a/dsp/codecs/audio_aac.c b/dsp/codecs/audio_aac.c
index 006b21c..ea7506f 100644
--- a/dsp/codecs/audio_aac.c
+++ b/dsp/codecs/audio_aac.c
@@ -461,7 +461,7 @@
.fops = &audio_aac_fops,
};
-static int __init audio_aac_init(void)
+int __init audio_aac_init(void)
{
int ret = misc_register(&audio_aac_misc);
@@ -473,4 +473,8 @@
return ret;
}
-device_initcall(audio_aac_init);
+void __exit audio_aac_exit(void)
+{
+ mutex_destroy(&audio_aac_ws_mgr.ws_lock);
+ misc_deregister(&audio_aac_misc);
+}
diff --git a/dsp/codecs/audio_alac.c b/dsp/codecs/audio_alac.c
index d0b86c6..50a0bf7 100644
--- a/dsp/codecs/audio_alac.c
+++ b/dsp/codecs/audio_alac.c
@@ -420,7 +420,7 @@
.fops = &audio_alac_fops,
};
-static int __init audio_alac_init(void)
+int __init audio_alac_init(void)
{
int ret = misc_register(&audio_alac_misc);
@@ -432,4 +432,8 @@
return ret;
}
-device_initcall(audio_alac_init);
+void __exit audio_alac_exit(void)
+{
+ mutex_destroy(&audio_alac_ws_mgr.ws_lock);
+ misc_deregister(&audio_alac_misc);
+}
diff --git a/dsp/codecs/audio_amrnb.c b/dsp/codecs/audio_amrnb.c
index 950098b..0417742 100644
--- a/dsp/codecs/audio_amrnb.c
+++ b/dsp/codecs/audio_amrnb.c
@@ -211,7 +211,7 @@
.fops = &audio_amrnb_fops,
};
-static int __init audio_amrnb_init(void)
+int __init audio_amrnb_init(void)
{
int ret = misc_register(&audio_amrnb_misc);
@@ -223,4 +223,8 @@
return ret;
}
-device_initcall(audio_amrnb_init);
+void __exit audio_amrnb_exit(void)
+{
+ mutex_destroy(&audio_amrnb_ws_mgr.ws_lock);
+ misc_deregister(&audio_amrnb_misc);
+}
diff --git a/dsp/codecs/audio_amrwb.c b/dsp/codecs/audio_amrwb.c
index cb5db0d..091bee4 100644
--- a/dsp/codecs/audio_amrwb.c
+++ b/dsp/codecs/audio_amrwb.c
@@ -216,7 +216,7 @@
.fops = &audio_amrwb_fops,
};
-static int __init audio_amrwb_init(void)
+int __init audio_amrwb_init(void)
{
int ret = misc_register(&audio_amrwb_misc);
@@ -228,4 +228,8 @@
return ret;
}
-device_initcall(audio_amrwb_init);
+void __exit audio_amrwb_exit(void)
+{
+ mutex_destroy(&audio_amrwb_ws_mgr.ws_lock);
+ misc_deregister(&audio_amrwb_misc);
+}
diff --git a/dsp/codecs/audio_amrwbplus.c b/dsp/codecs/audio_amrwbplus.c
index 458a80c..566aee7 100644
--- a/dsp/codecs/audio_amrwbplus.c
+++ b/dsp/codecs/audio_amrwbplus.c
@@ -382,7 +382,7 @@
.fops = &audio_amrwbplus_fops,
};
-static int __init audio_amrwbplus_init(void)
+int __init audio_amrwbplus_init(void)
{
int ret = misc_register(&audio_amrwbplus_misc);
@@ -394,4 +394,8 @@
return ret;
}
-device_initcall(audio_amrwbplus_init);
+void __exit audio_amrwbplus_exit(void)
+{
+ mutex_destroy(&audio_amrwbplus_ws_mgr.ws_lock);
+ misc_deregister(&audio_amrwbplus_misc);
+}
diff --git a/dsp/codecs/audio_ape.c b/dsp/codecs/audio_ape.c
index d7dc064..b11f83e 100644
--- a/dsp/codecs/audio_ape.c
+++ b/dsp/codecs/audio_ape.c
@@ -344,7 +344,7 @@
.fops = &audio_ape_fops,
};
-static int __init audio_ape_init(void)
+int __init audio_ape_init(void)
{
int ret = misc_register(&audio_ape_misc);
@@ -356,4 +356,8 @@
return ret;
}
-device_initcall(audio_ape_init);
+void __exit audio_ape_exit(void)
+{
+ mutex_destroy(&audio_ape_ws_mgr.ws_lock);
+ misc_deregister(&audio_ape_misc);
+}
diff --git a/dsp/codecs/audio_evrc.c b/dsp/codecs/audio_evrc.c
index 8776231..78bbde6 100644
--- a/dsp/codecs/audio_evrc.c
+++ b/dsp/codecs/audio_evrc.c
@@ -169,7 +169,7 @@
.fops = &audio_evrc_fops,
};
-static int __init audio_evrc_init(void)
+int __init audio_evrc_init(void)
{
int ret = misc_register(&audio_evrc_misc);
@@ -181,4 +181,8 @@
return ret;
}
-device_initcall(audio_evrc_init);
+void __exit audio_evrc_exit(void)
+{
+ mutex_destroy(&audio_evrc_ws_mgr.ws_lock);
+ misc_deregister(&audio_evrc_misc);
+}
diff --git a/dsp/codecs/audio_g711alaw.c b/dsp/codecs/audio_g711alaw.c
index 24f87e4..a6e0a6e 100644
--- a/dsp/codecs/audio_g711alaw.c
+++ b/dsp/codecs/audio_g711alaw.c
@@ -375,7 +375,7 @@
.fops = &audio_g711_fops,
};
-static int __init audio_g711alaw_init(void)
+int __init audio_g711alaw_init(void)
{
int ret = misc_register(&audio_g711alaw_misc);
@@ -386,11 +386,9 @@
return ret;
}
-static void __exit audio_g711alaw_exit(void)
-{
- misc_deregister(&audio_g711alaw_misc);
- mutex_destroy(&audio_g711_ws_mgr.ws_lock);
-}
-device_initcall(audio_g711alaw_init);
-__exitcall(audio_g711alaw_exit);
+void __exit audio_g711alaw_exit(void)
+{
+ mutex_destroy(&audio_g711_ws_mgr.ws_lock);
+ misc_deregister(&audio_g711alaw_misc);
+}
diff --git a/dsp/codecs/audio_g711mlaw.c b/dsp/codecs/audio_g711mlaw.c
index 10d3680..2a2598c 100644
--- a/dsp/codecs/audio_g711mlaw.c
+++ b/dsp/codecs/audio_g711mlaw.c
@@ -374,7 +374,7 @@
.fops = &audio_g711_fops,
};
-static int __init audio_g711mlaw_init(void)
+int __init audio_g711mlaw_init(void)
{
int ret = misc_register(&audio_g711mlaw_misc);
@@ -386,11 +386,9 @@
return ret;
}
-static void __exit audio_g711mlaw_exit(void)
+void __exit audio_g711mlaw_exit(void)
{
- misc_deregister(&audio_g711mlaw_misc);
mutex_destroy(&audio_g711_ws_mgr.ws_lock);
+ misc_deregister(&audio_g711mlaw_misc);
}
-device_initcall(audio_g711mlaw_init);
-__exitcall(audio_g711mlaw_exit);
diff --git a/dsp/codecs/audio_hwacc_effects.c b/dsp/codecs/audio_hwacc_effects.c
index 9444aa7..c285511 100644
--- a/dsp/codecs/audio_hwacc_effects.c
+++ b/dsp/codecs/audio_hwacc_effects.c
@@ -768,11 +768,15 @@
.fops = &audio_effects_fops,
};
-static int __init audio_effects_init(void)
+int __init audio_effects_init(void)
{
return misc_register(&audio_effects_misc);
}
-device_initcall(audio_effects_init);
+void __exit audio_effects_exit(void)
+{
+ misc_deregister(&audio_effects_misc);
+}
+
MODULE_DESCRIPTION("Audio hardware accelerated effects driver");
MODULE_LICENSE("GPL v2");
diff --git a/dsp/codecs/audio_mp3.c b/dsp/codecs/audio_mp3.c
index 0b10c7a..81e8486 100644
--- a/dsp/codecs/audio_mp3.c
+++ b/dsp/codecs/audio_mp3.c
@@ -173,7 +173,7 @@
.fops = &audio_mp3_fops,
};
-static int __init audio_mp3_init(void)
+int __init audio_mp3_init(void)
{
int ret = misc_register(&audio_mp3_misc);
@@ -185,4 +185,8 @@
return ret;
}
-device_initcall(audio_mp3_init);
+void __exit audio_mp3_exit(void)
+{
+ mutex_destroy(&audio_mp3_ws_mgr.ws_lock);
+ misc_deregister(&audio_mp3_misc);
+}
diff --git a/dsp/codecs/audio_multi_aac.c b/dsp/codecs/audio_multi_aac.c
index 5d407e0..c3e616a 100644
--- a/dsp/codecs/audio_multi_aac.c
+++ b/dsp/codecs/audio_multi_aac.c
@@ -508,7 +508,7 @@
.fops = &audio_aac_fops,
};
-static int __init audio_aac_init(void)
+int __init audio_multiaac_init(void)
{
int ret = misc_register(&audio_multiaac_misc);
@@ -520,4 +520,8 @@
return ret;
}
-device_initcall(audio_aac_init);
+void __exit audio_multiaac_exit(void)
+{
+ mutex_destroy(&audio_multiaac_ws_mgr.ws_lock);
+ misc_deregister(&audio_multiaac_misc);
+}
diff --git a/dsp/codecs/audio_native.c b/dsp/codecs/audio_native.c
new file mode 100644
index 0000000..8f21cc7
--- /dev/null
+++ b/dsp/codecs/audio_native.c
@@ -0,0 +1,75 @@
+/*
+Copyright (c) 2017, The Linux Foundation. All rights reserved.
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License version 2 and
+only version 2 as published by the Free Software Foundation.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+*
+*/
+
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include "audio_utils.h"
+
+static int __init audio_native_init(void)
+{
+ aac_in_init();
+ amrnb_in_init();
+ amrwb_in_init();
+ audio_aac_init();
+ audio_alac_init();
+ audio_amrnb_init();
+ audio_amrwb_init();
+ audio_amrwbplus_init();
+ audio_ape_init();
+ audio_evrc_init();
+ audio_g711alaw_init();
+ audio_g711mlaw_init();
+ audio_effects_init();
+ audio_mp3_init();
+ audio_multiaac_init();
+ audio_qcelp_init();
+ audio_wma_init();
+ audio_wmapro_init();
+ evrc_in_init();
+ g711alaw_in_init();
+ g711mlaw_in_init();
+ qcelp_in_init();
+ return 0;
+}
+
+static void __exit audio_native_exit(void)
+{
+ aac_in_exit();
+ amrnb_in_exit();
+ amrwb_in_exit();
+ audio_aac_exit();
+ audio_alac_exit();
+ audio_amrnb_exit();
+ audio_amrwb_exit();
+ audio_amrwbplus_exit();
+ audio_ape_exit();
+ audio_evrc_exit();
+ audio_g711alaw_exit();
+ audio_g711mlaw_exit();
+ audio_effects_exit();
+ audio_mp3_exit();
+ audio_multiaac_exit();
+ audio_qcelp_exit();
+ audio_wma_exit();
+ audio_wmapro_exit();
+ evrc_in_exit();
+ g711alaw_in_exit();
+ g711mlaw_in_exit();
+ qcelp_in_exit();
+}
+
+module_init(audio_native_init);
+module_exit(audio_native_exit);
+MODULE_LICENSE("GPL v2");
+MODULE_DESCRIPTION("Native Encoder/Decoder module");
diff --git a/dsp/codecs/audio_qcelp.c b/dsp/codecs/audio_qcelp.c
index 8f2511c..8690294 100644
--- a/dsp/codecs/audio_qcelp.c
+++ b/dsp/codecs/audio_qcelp.c
@@ -176,7 +176,7 @@
.fops = &audio_qcelp_fops,
};
-static int __init audio_qcelp_init(void)
+int audio_qcelp_init(void)
{
int ret = misc_register(&audio_qcelp_misc);
@@ -188,4 +188,8 @@
return ret;
}
-device_initcall(audio_qcelp_init);
+void __exit audio_qcelp_exit(void)
+{
+ mutex_destroy(&audio_qcelp_ws_mgr.ws_lock);
+ misc_deregister(&audio_qcelp_misc);
+}
diff --git a/dsp/codecs/audio_utils.h b/dsp/codecs/audio_utils.h
index f5517d8..3ad6903 100644
--- a/dsp/codecs/audio_utils.h
+++ b/dsp/codecs/audio_utils.h
@@ -112,3 +112,47 @@
size_t count, loff_t *pos);
int audio_in_release(struct inode *inode, struct file *file);
int audio_in_set_config(struct file *file, struct msm_audio_config *cfg);
+int aac_in_init(void);
+int amrnb_in_init(void);
+int amrwb_in_init(void);
+int audio_aac_init(void);
+int audio_alac_init(void);
+int audio_amrnb_init(void);
+int audio_amrwb_init(void);
+int audio_amrwbplus_init(void);
+int audio_ape_init(void);
+int audio_evrc_init(void);
+int audio_g711alaw_init(void);
+int audio_g711mlaw_init(void);
+int audio_effects_init(void);
+int audio_mp3_init(void);
+int audio_multiaac_init(void);
+int audio_qcelp_init(void);
+int audio_wma_init(void);
+int audio_wmapro_init(void);
+int evrc_in_init(void);
+int g711alaw_in_init(void);
+int g711mlaw_in_init(void);
+int qcelp_in_init(void);
+void aac_in_exit(void);
+void amrnb_in_exit(void);
+void amrwb_in_exit(void);
+void audio_aac_exit(void);
+void audio_alac_exit(void);
+void audio_amrnb_exit(void);
+void audio_amrwb_exit(void);
+void audio_amrwbplus_exit(void);
+void audio_ape_exit(void);
+void audio_evrc_exit(void);
+void audio_g711alaw_exit(void);
+void audio_g711mlaw_exit(void);
+void audio_effects_exit(void);
+void audio_mp3_exit(void);
+void audio_multiaac_exit(void);
+void audio_qcelp_exit(void);
+void audio_wma_exit(void);
+void audio_wmapro_exit(void);
+void evrc_in_exit(void);
+void g711alaw_in_exit(void);
+void g711mlaw_in_exit(void);
+void qcelp_in_exit(void);
diff --git a/dsp/codecs/audio_wma.c b/dsp/codecs/audio_wma.c
index e35334a..975dc0b 100644
--- a/dsp/codecs/audio_wma.c
+++ b/dsp/codecs/audio_wma.c
@@ -330,7 +330,7 @@
.fops = &audio_wma_fops,
};
-static int __init audio_wma_init(void)
+int __init audio_wma_init(void)
{
int ret = misc_register(&audio_wma_misc);
@@ -342,4 +342,8 @@
return ret;
}
-device_initcall(audio_wma_init);
+void __exit audio_wma_exit(void)
+{
+ mutex_destroy(&audio_wma_ws_mgr.ws_lock);
+ misc_deregister(&audio_wma_misc);
+}
diff --git a/dsp/codecs/audio_wmapro.c b/dsp/codecs/audio_wmapro.c
index 3cb9db1..3ce4cdc 100644
--- a/dsp/codecs/audio_wmapro.c
+++ b/dsp/codecs/audio_wmapro.c
@@ -403,7 +403,7 @@
.fops = &audio_wmapro_fops,
};
-static int __init audio_wmapro_init(void)
+int __init audio_wmapro_init(void)
{
int ret = misc_register(&audio_wmapro_misc);
@@ -415,4 +415,8 @@
return ret;
}
-device_initcall(audio_wmapro_init);
+void __exit audio_wmapro_exit(void)
+{
+ mutex_destroy(&audio_wmapro_ws_mgr.ws_lock);
+ misc_deregister(&audio_wmapro_misc);
+}
diff --git a/dsp/codecs/evrc_in.c b/dsp/codecs/evrc_in.c
index e30271d..158ff6f 100644
--- a/dsp/codecs/evrc_in.c
+++ b/dsp/codecs/evrc_in.c
@@ -402,9 +402,12 @@
.fops = &audio_in_fops,
};
-static int __init evrc_in_init(void)
+int __init evrc_in_init(void)
{
return misc_register(&audio_evrc_in_misc);
}
-device_initcall(evrc_in_init);
+void __exit evrc_in_exit(void)
+{
+ misc_deregister(&audio_evrc_in_misc);
+}
diff --git a/dsp/codecs/g711alaw_in.c b/dsp/codecs/g711alaw_in.c
index bc8c0a3..bd49bc9 100644
--- a/dsp/codecs/g711alaw_in.c
+++ b/dsp/codecs/g711alaw_in.c
@@ -374,9 +374,12 @@
.fops = &audio_in_fops,
};
-static int __init g711alaw_in_init(void)
+int __init g711alaw_in_init(void)
{
return misc_register(&audio_g711alaw_in_misc);
}
-device_initcall(g711alaw_in_init);
+void __exit g711alaw_in_exit(void)
+{
+ misc_deregister(&audio_g711alaw_in_misc);
+}
diff --git a/dsp/codecs/g711mlaw_in.c b/dsp/codecs/g711mlaw_in.c
index b92c449..d646bd1 100644
--- a/dsp/codecs/g711mlaw_in.c
+++ b/dsp/codecs/g711mlaw_in.c
@@ -377,9 +377,12 @@
.fops = &audio_in_fops,
};
-static int __init g711mlaw_in_init(void)
+int __init g711mlaw_in_init(void)
{
return misc_register(&audio_g711mlaw_in_misc);
}
-device_initcall(g711mlaw_in_init);
+void __exit g711mlaw_in_exit(void)
+{
+ misc_deregister(&audio_g711mlaw_in_misc);
+}
diff --git a/dsp/codecs/qcelp_in.c b/dsp/codecs/qcelp_in.c
index da5520f..050c95f 100644
--- a/dsp/codecs/qcelp_in.c
+++ b/dsp/codecs/qcelp_in.c
@@ -402,9 +402,12 @@
.fops = &audio_in_fops,
};
-static int __init qcelp_in_init(void)
+int __init qcelp_in_init(void)
{
return misc_register(&audio_qcelp_in_misc);
}
-device_initcall(qcelp_in_init);
+void __exit qcelp_in_exit(void)
+{
+ misc_deregister(&audio_qcelp_in_misc);
+}
diff --git a/dsp/msm-dts-srs-tm-config.c b/dsp/msm-dts-srs-tm-config.c
new file mode 100644
index 0000000..cd3da4d
--- /dev/null
+++ b/dsp/msm-dts-srs-tm-config.c
@@ -0,0 +1,381 @@
+/*
+ * Copyright (c) 2012-2014, 2016-2017, The Linux Foundation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 and
+ * only version 2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+#include <linux/err.h>
+#include <linux/module.h>
+#include <linux/bitops.h>
+#include <linux/mutex.h>
+#include <linux/atomic.h>
+#include <sound/asound.h>
+#include <sound/control.h>
+#include <dsp/msm_audio_ion.h>
+#include <dsp/q6adm-v2.h>
+#include <dsp/msm-dts-srs-tm-config.h>
+
+static int srs_port_id[AFE_MAX_PORTS] = {-1};
+static int srs_copp_idx[AFE_MAX_PORTS] = {-1};
+static union srs_trumedia_params_u msm_srs_trumedia_params;
+static struct ion_client *ion_client;
+static struct ion_handle *ion_handle;
+static struct param_outband po;
+static atomic_t ref_cnt;
+#define ION_MEM_SIZE (8 * 1024)
+
+static int set_port_id(int port_id, int copp_idx)
+{
+ int index = adm_validate_and_get_port_index(port_id);
+
+ if (index < 0) {
+ pr_err("%s: Invalid port idx %d port_id %#x\n", __func__, index,
+ port_id);
+ return -EINVAL;
+ }
+ srs_port_id[index] = port_id;
+ srs_copp_idx[index] = copp_idx;
+ return 0;
+}
+
+static void msm_dts_srs_tm_send_params(__s32 port_id, __u32 techs)
+{
+ __s32 index = adm_validate_and_get_port_index(port_id);
+
+ if (index < 0) {
+ pr_err("%s: Invalid port idx %d port_id 0x%x\n",
+ __func__, index, port_id);
+ return;
+ }
+ if ((srs_copp_idx[index] < 0) ||
+ (srs_copp_idx[index] >= MAX_COPPS_PER_PORT)) {
+ pr_debug("%s: send params called before copp open. so, caching\n",
+ __func__);
+ return;
+ }
+ pr_debug("SRS %s: called, port_id = %d, techs flags = %u\n",
+ __func__, port_id, techs);
+ /* force all if techs is set to 1 */
+ if (techs == 1)
+ techs = 0xFFFFFFFF;
+
+ if (techs & (1 << SRS_ID_WOWHD))
+ srs_trumedia_open(port_id, srs_copp_idx[index], SRS_ID_WOWHD,
+ (void *)&msm_srs_trumedia_params.srs_params.wowhd);
+ if (techs & (1 << SRS_ID_CSHP))
+ srs_trumedia_open(port_id, srs_copp_idx[index], SRS_ID_CSHP,
+ (void *)&msm_srs_trumedia_params.srs_params.cshp);
+ if (techs & (1 << SRS_ID_HPF))
+ srs_trumedia_open(port_id, srs_copp_idx[index], SRS_ID_HPF,
+ (void *)&msm_srs_trumedia_params.srs_params.hpf);
+ if (techs & (1 << SRS_ID_AEQ))
+ srs_trumedia_open(port_id, srs_copp_idx[index], SRS_ID_AEQ,
+ (void *)&msm_srs_trumedia_params.srs_params.aeq);
+ if (techs & (1 << SRS_ID_HL))
+ srs_trumedia_open(port_id, srs_copp_idx[index], SRS_ID_HL,
+ (void *)&msm_srs_trumedia_params.srs_params.hl);
+ if (techs & (1 << SRS_ID_GEQ))
+ srs_trumedia_open(port_id, srs_copp_idx[index], SRS_ID_GEQ,
+ (void *)&msm_srs_trumedia_params.srs_params.geq);
+ if (techs & (1 << SRS_ID_GLOBAL))
+ srs_trumedia_open(port_id, srs_copp_idx[index], SRS_ID_GLOBAL,
+ (void *)&msm_srs_trumedia_params.srs_params.global);
+}
+
+
+static int msm_dts_srs_trumedia_control_get(struct snd_kcontrol *kcontrol,
+ struct snd_ctl_elem_value *ucontrol)
+{
+ ucontrol->value.integer.value[0] = 0;
+ return 0;
+}
+
+static int msm_dts_srs_trumedia_control_set_(int port_id,
+ struct snd_kcontrol *kcontrol,
+ struct snd_ctl_elem_value *ucontrol)
+{
+
+ __u16 offset, value, max = sizeof(msm_srs_trumedia_params) >> 1;
+
+ if (SRS_CMD_UPLOAD ==
+ (ucontrol->value.integer.value[0] & SRS_CMD_UPLOAD)) {
+ __u32 techs = ucontrol->value.integer.value[0] & 0xFF;
+ __s32 index = adm_validate_and_get_port_index(port_id);
+
+ if (index < 0) {
+ pr_err("%s: Invalid port idx %d port_id 0x%x\n",
+ __func__, index, port_id);
+ return -EINVAL;
+ }
+ pr_debug("SRS %s: send params request, flag = %u\n",
+ __func__, techs);
+ if (srs_port_id[index] >= 0 && techs)
+ msm_dts_srs_tm_send_params(port_id, techs);
+ return 0;
+ }
+ offset = (__u16)((ucontrol->value.integer.value[0] &
+ SRS_PARAM_OFFSET_MASK) >> 16);
+ value = (__u16)(ucontrol->value.integer.value[0] &
+ SRS_PARAM_VALUE_MASK);
+ if (offset < max) {
+ msm_srs_trumedia_params.raw_params[offset] = value;
+ pr_debug("SRS %s: index set... (max %d, requested %d, value 0x%X)\n",
+ __func__, max, offset, value);
+ } else {
+ pr_err("SRS %s: index out of bounds! (max %d, requested %d)\n",
+ __func__, max, offset);
+ }
+ return 0;
+}
+
+static int msm_dts_srs_trumedia_control_set(struct snd_kcontrol *kcontrol,
+ struct snd_ctl_elem_value *ucontrol)
+{
+ int ret, port_id;
+
+ pr_debug("SRS control normal called\n");
+ msm_dts_srs_acquire_lock();
+ port_id = SLIMBUS_0_RX;
+ ret = msm_dts_srs_trumedia_control_set_(port_id, kcontrol, ucontrol);
+ msm_dts_srs_release_lock();
+ return ret;
+}
+
+static int msm_dts_srs_trumedia_control_i2s_set(struct snd_kcontrol *kcontrol,
+ struct snd_ctl_elem_value *ucontrol)
+{
+ int ret, port_id;
+
+ pr_debug("SRS control I2S called\n");
+ msm_dts_srs_acquire_lock();
+ port_id = PRIMARY_I2S_RX;
+ ret = msm_dts_srs_trumedia_control_set_(port_id, kcontrol, ucontrol);
+ msm_dts_srs_release_lock();
+ return ret;
+}
+
+static int msm_dts_srs_trumedia_control_mi2s_set(struct snd_kcontrol *kcontrol,
+ struct snd_ctl_elem_value *ucontrol)
+{
+ int ret, port_id;
+
+ pr_debug("SRS control MI2S called\n");
+ msm_dts_srs_acquire_lock();
+ port_id = AFE_PORT_ID_PRIMARY_MI2S_RX;
+ ret = msm_dts_srs_trumedia_control_set_(port_id, kcontrol, ucontrol);
+ msm_dts_srs_release_lock();
+ return ret;
+}
+
+static int msm_dts_srs_trumedia_control_hdmi_set(struct snd_kcontrol *kcontrol,
+ struct snd_ctl_elem_value *ucontrol)
+{
+ int ret, port_id;
+
+ pr_debug("SRS control HDMI called\n");
+ msm_dts_srs_acquire_lock();
+ port_id = HDMI_RX;
+ ret = msm_dts_srs_trumedia_control_set_(port_id, kcontrol, ucontrol);
+ msm_dts_srs_release_lock();
+ return ret;
+}
+
+static const struct snd_kcontrol_new lpa_srs_trumedia_controls[] = {
+ {.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
+ .name = "SRS TruMedia",
+ .access = SNDRV_CTL_ELEM_ACCESS_TLV_READ |
+ SNDRV_CTL_ELEM_ACCESS_READWRITE,
+ .info = snd_soc_info_volsw,
+ .get = msm_dts_srs_trumedia_control_get,
+ .put = msm_dts_srs_trumedia_control_set,
+ .private_value = ((unsigned long)&(struct soc_mixer_control)
+ {.reg = SND_SOC_NOPM,
+ .rreg = SND_SOC_NOPM,
+ .shift = 0,
+ .rshift = 0,
+ .max = 0xFFFFFFFF,
+ .platform_max = 0xFFFFFFFF,
+ .invert = 0
+ })
+ }
+};
+
+static const struct snd_kcontrol_new lpa_srs_trumedia_controls_hdmi[] = {
+ {.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
+ .name = "SRS TruMedia HDMI",
+ .access = SNDRV_CTL_ELEM_ACCESS_TLV_READ |
+ SNDRV_CTL_ELEM_ACCESS_READWRITE,
+ .info = snd_soc_info_volsw,
+ .get = msm_dts_srs_trumedia_control_get,
+ .put = msm_dts_srs_trumedia_control_hdmi_set,
+ .private_value = ((unsigned long)&(struct soc_mixer_control)
+ {.reg = SND_SOC_NOPM,
+ .rreg = SND_SOC_NOPM,
+ .shift = 0,
+ .rshift = 0,
+ .max = 0xFFFFFFFF,
+ .platform_max = 0xFFFFFFFF,
+ .invert = 0
+ })
+ }
+};
+
+static const struct snd_kcontrol_new lpa_srs_trumedia_controls_i2s[] = {
+ {.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
+ .name = "SRS TruMedia I2S",
+ .access = SNDRV_CTL_ELEM_ACCESS_TLV_READ |
+ SNDRV_CTL_ELEM_ACCESS_READWRITE,
+ .info = snd_soc_info_volsw,
+ .get = msm_dts_srs_trumedia_control_get,
+ .put = msm_dts_srs_trumedia_control_i2s_set,
+ .private_value = ((unsigned long)&(struct soc_mixer_control)
+ {.reg = SND_SOC_NOPM,
+ .rreg = SND_SOC_NOPM,
+ .shift = 0,
+ .rshift = 0,
+ .max = 0xFFFFFFFF,
+ .platform_max = 0xFFFFFFFF,
+ .invert = 0
+ })
+ }
+};
+
+static const struct snd_kcontrol_new lpa_srs_trumedia_controls_mi2s[] = {
+ {
+ .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
+ .name = "SRS TruMedia MI2S",
+ .access = SNDRV_CTL_ELEM_ACCESS_TLV_READ |
+ SNDRV_CTL_ELEM_ACCESS_READWRITE,
+ .info = snd_soc_info_volsw,
+ .get = msm_dts_srs_trumedia_control_get,
+ .put = msm_dts_srs_trumedia_control_mi2s_set,
+ .private_value = ((unsigned long)&(struct soc_mixer_control)
+ {
+ .reg = SND_SOC_NOPM,
+ .rreg = SND_SOC_NOPM,
+ .shift = 0,
+ .rshift = 0,
+ .max = 0xFFFFFFFF,
+ .platform_max = 0xFFFFFFFF,
+ .invert = 0
+ })
+ }
+};
+
+/**
+ * msm_dts_srs_tm_add_controls -
+ * Add DTS SRS module controls
+ *
+ * @platform: component to which controls can be registered
+ *
+ */
+void msm_dts_srs_tm_add_controls(struct snd_soc_platform *platform)
+{
+ snd_soc_add_platform_controls(platform,
+ lpa_srs_trumedia_controls,
+ ARRAY_SIZE(lpa_srs_trumedia_controls));
+
+ snd_soc_add_platform_controls(platform,
+ lpa_srs_trumedia_controls_hdmi,
+ ARRAY_SIZE(lpa_srs_trumedia_controls_hdmi));
+
+ snd_soc_add_platform_controls(platform,
+ lpa_srs_trumedia_controls_i2s,
+ ARRAY_SIZE(lpa_srs_trumedia_controls_i2s));
+ snd_soc_add_platform_controls(platform,
+ lpa_srs_trumedia_controls_mi2s,
+ ARRAY_SIZE(lpa_srs_trumedia_controls_mi2s));
+}
+EXPORT_SYMBOL(msm_dts_srs_tm_add_controls);
+
+static int reg_ion_mem(void)
+{
+ int rc;
+
+ rc = msm_audio_ion_alloc("SRS_TRUMEDIA", &ion_client, &ion_handle,
+ ION_MEM_SIZE, &po.paddr, (size_t *)&po.size,
+ &po.kvaddr);
+ if (rc != 0)
+ pr_err("%s: failed to allocate memory.\n", __func__);
+ pr_debug("%s: exited ion_client = %pK, ion_handle = %pK, phys_addr = %lu, length = %d, vaddr = %pK, rc = 0x%x\n",
+ __func__, ion_client, ion_handle, (long)po.paddr,
+ (unsigned int)po.size, po.kvaddr, rc);
+ return rc;
+}
+
+void msm_dts_srs_tm_ion_memmap(struct param_outband *po_)
+{
+ if (po.kvaddr == NULL) {
+ pr_debug("%s: callingreg_ion_mem()\n", __func__);
+ reg_ion_mem();
+ }
+ po_->size = ION_MEM_SIZE;
+ po_->kvaddr = po.kvaddr;
+ po_->paddr = po.paddr;
+}
+
+static void unreg_ion_mem(void)
+{
+ msm_audio_ion_free(ion_client, ion_handle);
+ po.kvaddr = NULL;
+ po.paddr = 0;
+ po.size = 0;
+}
+
+/**
+ * msm_dts_srs_tm_deinit -
+ * De-Initializes DTS SRS module
+ *
+ * @port_id: Port ID number
+ *
+ */
+void msm_dts_srs_tm_deinit(int port_id)
+{
+ set_port_id(port_id, -1);
+ atomic_dec(&ref_cnt);
+ if (po.kvaddr != NULL) {
+ if (!atomic_read(&ref_cnt)) {
+ pr_debug("%s: calling unreg_ion_mem()\n", __func__);
+ unreg_ion_mem();
+ }
+ }
+}
+EXPORT_SYMBOL(msm_dts_srs_tm_deinit);
+
+/**
+ * msm_dts_srs_tm_init -
+ * Initializes DTS SRS module
+ *
+ * @port_id: Port ID number
+ * @copp_idx: COPP index
+ *
+ */
+void msm_dts_srs_tm_init(int port_id, int copp_idx)
+{
+ int cur_ref_cnt = 0;
+
+ if (set_port_id(port_id, copp_idx) < 0) {
+ pr_err("%s: Invalid port_id: %d\n", __func__, port_id);
+ return;
+ }
+
+ cur_ref_cnt = atomic_read(&ref_cnt);
+ atomic_inc(&ref_cnt);
+ if (!cur_ref_cnt && po.kvaddr == NULL) {
+ pr_debug("%s: calling reg_ion_mem()\n", __func__);
+ if (reg_ion_mem() != 0) {
+ atomic_dec(&ref_cnt);
+ po.kvaddr = NULL;
+ return;
+ }
+ }
+ msm_dts_srs_tm_send_params(port_id, 1);
+}
+EXPORT_SYMBOL(msm_dts_srs_tm_init);
diff --git a/dsp/msm_audio_ion.c b/dsp/msm_audio_ion.c
index 24df1aa..0baca8d 100644
--- a/dsp/msm_audio_ion.c
+++ b/dsp/msm_audio_ion.c
@@ -89,6 +89,20 @@
mutex_unlock(&(msm_audio_ion_data->list_mutex));
}
+/**
+ * msm_audio_ion_alloc -
+ * Allocs ION memory for given client name
+ *
+ * @name: Name of audio ION client
+ * @client: ION client to be assigned
+ * @handle: ION handle to be assigned
+ * @bufsz: buffer size
+ * @paddr: Physical address to be assigned with allocated region
+ * @pa_len: length of allocated region to be assigned
+ * vaddr: virtual address to be assigned
+ *
+ * Returns 0 on success or error on failure
+ */
int msm_audio_ion_alloc(const char *name, struct ion_client **client,
struct ion_handle **handle, size_t bufsz,
ion_phys_addr_t *paddr, size_t *pa_len, void **vaddr)
@@ -243,6 +257,15 @@
return rc;
}
+/**
+ * msm_audio_ion_free -
+ * fress ION memory for given client and handle
+ *
+ * @client: ION client
+ * @handle: ION handle
+ *
+ * Returns 0 on success or error on failure
+ */
int msm_audio_ion_free(struct ion_client *client, struct ion_handle *handle)
{
if (!client || !handle) {
@@ -260,6 +283,15 @@
}
EXPORT_SYMBOL(msm_audio_ion_free);
+/**
+ * msm_audio_ion_mmap -
+ * Audio ION memory map
+ *
+ * @ab: audio buf pointer
+ * @vma: virtual mem area
+ *
+ * Returns 0 on success or error on failure
+ */
int msm_audio_ion_mmap(struct audio_buffer *ab,
struct vm_area_struct *vma)
{
@@ -351,6 +383,7 @@
}
return 0;
}
+EXPORT_SYMBOL(msm_audio_ion_mmap);
bool msm_audio_ion_is_smmu_available(void)
@@ -366,8 +399,15 @@
pclient = msm_ion_client_create(name);
return pclient;
}
+EXPORT_SYMBOL(msm_audio_ion_client_create);
-
+/**
+ * msm_audio_ion_client_destroy -
+ * Removes ION client handle
+ *
+ * @client: ION client
+ *
+ */
void msm_audio_ion_client_destroy(struct ion_client *client)
{
pr_debug("%s: client = %pK smmu_enabled = %d\n", __func__,
@@ -375,7 +415,24 @@
ion_client_destroy(client);
}
+EXPORT_SYMBOL(msm_audio_ion_client_destroy);
+/**
+ * msm_audio_ion_import_legacy -
+ * Alloc ION memory for given size
+ *
+ * @name: ION client name
+ * @client: ION client
+ * @handle: ION handle to be updated
+ * @fd: ION fd
+ * @ionflag: Flags for ION handle
+ * @bufsz: buffer size
+ * @paddr: pointer to be updated with physical address of allocated ION memory
+ * @pa_len: pointer to be updated with size of physical memory
+ * @vaddr: pointer to be updated with virtual address
+ *
+ * Returns 0 on success or error on failure
+ */
int msm_audio_ion_import_legacy(const char *name, struct ion_client *client,
struct ion_handle **handle, int fd,
unsigned long *ionflag, size_t bufsz,
@@ -438,7 +495,16 @@
err:
return rc;
}
+EXPORT_SYMBOL(msm_audio_ion_import_legacy);
+/**
+ * msm_audio_ion_free_legacy -
+ * Frees ION memory for given handle
+ *
+ * @client: ION client
+ * @handle: ION handle
+ *
+ */
int msm_audio_ion_free_legacy(struct ion_client *client,
struct ion_handle *handle)
{
@@ -451,6 +517,7 @@
/* no client_destrody in legacy*/
return 0;
}
+EXPORT_SYMBOL(msm_audio_ion_free_legacy);
int msm_audio_ion_cache_operations(struct audio_buffer *abuff, int cache_op)
{
@@ -710,6 +777,13 @@
return 0;
}
+/**
+ * msm_audio_populate_upper_32_bits -
+ * retrieve upper 32bits of 64bit address
+ *
+ * @pa: 64bit physical address
+ *
+ */
u32 msm_audio_populate_upper_32_bits(ion_phys_addr_t pa)
{
if (sizeof(ion_phys_addr_t) == sizeof(u32))
@@ -717,6 +791,7 @@
else
return upper_32_bits(pa);
}
+EXPORT_SYMBOL(msm_audio_populate_upper_32_bits);
static int msm_audio_ion_probe(struct platform_device *pdev)
{
@@ -837,17 +912,15 @@
.remove = msm_audio_ion_remove,
};
-static int __init msm_audio_ion_init(void)
+int __init msm_audio_ion_init(void)
{
return platform_driver_register(&msm_audio_ion_driver);
}
-module_init(msm_audio_ion_init);
-static void __exit msm_audio_ion_exit(void)
+void __exit msm_audio_ion_exit(void)
{
platform_driver_unregister(&msm_audio_ion_driver);
}
-module_exit(msm_audio_ion_exit);
MODULE_DESCRIPTION("MSM Audio ION module");
MODULE_LICENSE("GPL v2");
diff --git a/dsp/q6_init.c b/dsp/q6_init.c
new file mode 100644
index 0000000..3b885dc
--- /dev/null
+++ b/dsp/q6_init.c
@@ -0,0 +1,55 @@
+/*
+Copyright (c) 2017, The Linux Foundation. All rights reserved.
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License version 2 and
+only version 2 as published by the Free Software Foundation.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+*
+*/
+
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include "q6_init.h"
+
+static int __init audio_q6_init(void)
+{
+ adsp_err_init();
+ audio_cal_init();
+ rtac_init();
+ adm_init();
+ afe_init();
+ q6asm_init();
+ q6lsm_init();
+ voice_init();
+ core_init();
+ msm_audio_ion_init();
+ audio_slimslave_init();
+ avtimer_init();
+ return 0;
+}
+
+static void __exit audio_q6_exit(void)
+{
+ avtimer_exit();
+ audio_slimslave_exit();
+ msm_audio_ion_exit();
+ core_exit();
+ voice_exit();
+ q6lsm_exit();
+ q6asm_exit();
+ afe_exit();
+ adm_exit();
+ rtac_exit();
+ audio_cal_exit();
+ adsp_err_exit();
+}
+
+module_init(audio_q6_init);
+module_exit(audio_q6_exit);
+MODULE_DESCRIPTION("Q6 module");
+MODULE_LICENSE("GPL v2");
diff --git a/dsp/q6_init.h b/dsp/q6_init.h
new file mode 100644
index 0000000..971e9b2
--- /dev/null
+++ b/dsp/q6_init.h
@@ -0,0 +1,43 @@
+/*
+Copyright (c) 2017, The Linux Foundation. All rights reserved.
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License version 2 and
+only version 2 as published by the Free Software Foundation.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+*
+*/
+
+#ifndef __Q6_INIT_H__
+#define __Q6_INIT_H__
+int adsp_err_init(void);
+int adm_init(void);
+int afe_init(void);
+int q6asm_init(void);
+int q6lsm_init(void);
+int voice_init(void);
+int audio_cal_init(void);
+int core_init(void);
+int rtac_init(void);
+int msm_audio_ion_init(void);
+int audio_slimslave_init(void);
+int avtimer_init(void);
+
+void avtimer_exit(void);
+void audio_slimslave_exit(void);
+void msm_audio_ion_exit(void);
+void rtac_exit(void);
+void core_exit(void);
+void audio_cal_exit(void);
+void voice_exit(void);
+void q6lsm_exit(void);
+void q6asm_exit(void);
+void afe_exit(void);
+void adm_exit(void);
+void adsp_err_exit(void);
+#endif
+
diff --git a/dsp/q6adm.c b/dsp/q6adm.c
index 461e155..77c2897 100644
--- a/dsp/q6adm.c
+++ b/dsp/q6adm.c
@@ -18,7 +18,7 @@
#include <linux/atomic.h>
#include <linux/wait.h>
#include <sound/asound.h>
-#include <asoc/msm-dts-srs-tm-config.h>
+#include <dsp/msm-dts-srs-tm-config.h>
#include <dsp/apr_audio-v2.h>
#include <dsp/q6adm-v2.h>
#include <dsp/q6audio-v2.h>
@@ -127,7 +127,26 @@
static int adm_get_parameters[MAX_COPPS_PER_PORT * ADM_GET_PARAMETER_LENGTH];
static int adm_module_topo_list[
MAX_COPPS_PER_PORT * ADM_GET_TOPO_MODULE_LIST_LENGTH];
+static struct mutex dts_srs_lock;
+void msm_dts_srs_acquire_lock(void)
+{
+ mutex_lock(&dts_srs_lock);
+}
+
+void msm_dts_srs_release_lock(void)
+{
+ mutex_unlock(&dts_srs_lock);
+}
+
+/**
+ * adm_validate_and_get_port_index -
+ * validate given port id
+ *
+ * @port_id: Port ID number
+ *
+ * Returns valid index on success or error on failure
+ */
int adm_validate_and_get_port_index(int port_id)
{
int index;
@@ -150,7 +169,16 @@
pr_debug("%s: port_idx- %d\n", __func__, index);
return index;
}
+EXPORT_SYMBOL(adm_validate_and_get_port_index);
+/**
+ * adm_get_default_copp_idx -
+ * retrieve default copp_idx for given port
+ *
+ * @port_id: Port ID number
+ *
+ * Returns valid value on success or error on failure
+ */
int adm_get_default_copp_idx(int port_id)
{
int port_idx = adm_validate_and_get_port_index(port_id), idx;
@@ -167,6 +195,7 @@
}
return -EINVAL;
}
+EXPORT_SYMBOL(adm_get_default_copp_idx);
int adm_get_topology_for_port_from_copp_id(int port_id, int copp_id)
{
@@ -185,6 +214,15 @@
return 0;
}
+/**
+ * adm_get_topology_for_port_copp_idx -
+ * retrieve topology of given port/copp_idx
+ *
+ * @port_id: Port ID number
+ * @copp_idx: copp index of ADM copp
+ *
+ * Returns valid value on success or 0 on failure
+ */
int adm_get_topology_for_port_copp_idx(int port_id, int copp_idx)
{
int port_idx = adm_validate_and_get_port_index(port_id);
@@ -196,6 +234,7 @@
}
return atomic_read(&this_adm.copp.topology[port_idx][copp_idx]);
}
+EXPORT_SYMBOL(adm_get_topology_for_port_copp_idx);
int adm_get_indexes_from_copp_id(int copp_id, int *copp_idx, int *port_idx)
{
@@ -264,6 +303,17 @@
return idx;
}
+/**
+ * srs_trumedia_open -
+ * command to set SRS trumedia open
+ *
+ * @port_id: Port ID number
+ * @copp_idx: copp index of ADM copp
+ * @srs_tech_id: SRS tech index
+ * @srs_params: params pointer
+ *
+ * Returns 0 on success or error on failure
+ */
int srs_trumedia_open(int port_id, int copp_idx, __s32 srs_tech_id,
void *srs_params)
{
@@ -529,6 +579,7 @@
kfree(adm_params);
return ret;
}
+EXPORT_SYMBOL(srs_trumedia_open);
static int adm_populate_channel_weight(u16 *ptr,
struct msm_pcm_channel_mixer *ch_mixer,
@@ -790,7 +841,20 @@
return ret;
}
+EXPORT_SYMBOL(adm_programable_channel_mixer);
+/**
+ * adm_set_stereo_to_custom_stereo -
+ * command to update custom stereo
+ *
+ * @port_id: Port ID number
+ * @copp_idx: copp index of ADM copp
+ * @session_id: session id to be updated
+ * @params: params pointer
+ * @param_length: length of params
+ *
+ * Returns 0 on success or error on failure
+ */
int adm_set_stereo_to_custom_stereo(int port_id, int copp_idx,
unsigned int session_id, char *params,
uint32_t params_length)
@@ -876,7 +940,19 @@
kfree(adm_params);
return rc;
}
+EXPORT_SYMBOL(adm_set_stereo_to_custom_stereo);
+/**
+ * adm_dolby_dap_send_params -
+ * command to send dolby dap params
+ *
+ * @port_id: Port ID number
+ * @copp_idx: copp index of ADM copp
+ * @params: params pointer
+ * @param_length: length of params
+ *
+ * Returns 0 on success or error on failure
+ */
int adm_dolby_dap_send_params(int port_id, int copp_idx, char *params,
uint32_t params_length)
{
@@ -951,7 +1027,19 @@
kfree(adm_params);
return rc;
}
+EXPORT_SYMBOL(adm_dolby_dap_send_params);
+/**
+ * adm_get_params_v5 -
+ * command to retrieve ADM params for given module
+ *
+ * @port_id: Port ID number
+ * @copp_idx: copp index of ADM copp
+ * @params: params pointer
+ * @param_length: length of params
+ *
+ * Returns 0 on success or error on failure
+ */
int adm_send_params_v5(int port_id, int copp_idx, char *params,
uint32_t params_length)
{
@@ -1026,6 +1114,7 @@
kfree(adm_params);
return rc;
}
+EXPORT_SYMBOL(adm_send_params_v5);
int adm_get_params_v2(int port_id, int copp_idx, uint32_t module_id,
uint32_t param_id, uint32_t params_length,
@@ -1142,13 +1231,38 @@
return rc;
}
+/**
+ * adm_get_params -
+ * command to retrieve ADM params for given module
+ *
+ * @port_id: Port ID number
+ * @copp_idx: copp index of ADM copp
+ * @module_id: module ID
+ * @param_id: Param index
+ * @param_length: length of params
+ * @params: params pointer
+ *
+ * Returns 0 on success or error on failure
+ */
int adm_get_params(int port_id, int copp_idx, uint32_t module_id,
uint32_t param_id, uint32_t params_length, char *params)
{
return adm_get_params_v2(port_id, copp_idx, module_id, param_id,
params_length, params, 0);
}
+EXPORT_SYMBOL(adm_get_params);
+/**
+ * adm_get_pp_topo_module_list -
+ * command to update PP top module list
+ *
+ * @port_id: Port ID number
+ * @copp_idx: copp index of ADM copp
+ * @param_length: length of params
+ * @params: pointer with PP top module params
+ *
+ * Returns 0 on success or error on failure
+ */
int adm_get_pp_topo_module_list(int port_id, int copp_idx, int32_t param_length,
char *params)
{
@@ -1245,6 +1359,8 @@
pr_debug("%s : rc = %d ", __func__, rc);
return rc;
}
+EXPORT_SYMBOL(adm_get_pp_topo_module_list);
+
static void adm_callback_debug_print(struct apr_client_data *data)
{
uint32_t *payload;
@@ -1264,6 +1380,15 @@
__func__, data->opcode, data->payload_size);
}
+/**
+ * adm_set_multi_ch_map -
+ * Update multi channel map info
+ *
+ * @channel_map: pointer with channel map info
+ * @path: direction or ADM path type
+ *
+ * Returns 0 on success or error on failure
+ */
int adm_set_multi_ch_map(char *channel_map, int path)
{
int idx;
@@ -1283,7 +1408,17 @@
return 0;
}
+EXPORT_SYMBOL(adm_set_multi_ch_map);
+/**
+ * adm_get_multi_ch_map -
+ * Retrieves multi channel map info
+ *
+ * @channel_map: pointer to be updated with channel map
+ * @path: direction or ADM path type
+ *
+ * Returns 0 on success or error on failure
+ */
int adm_get_multi_ch_map(char *channel_map, int path)
{
int idx;
@@ -1304,6 +1439,7 @@
return 0;
}
+EXPORT_SYMBOL(adm_get_multi_ch_map);
static int32_t adm_callback(struct apr_client_data *data, void *priv)
{
@@ -2170,6 +2306,16 @@
app_type, acdb_id, sample_rate);
}
+/**
+ * adm_connect_afe_port -
+ * command to send ADM connect AFE port
+ *
+ * @mode: value of mode for ADM connect AFE
+ * @session_id: session active to connect
+ * @port_id: Port ID number
+ *
+ * Returns 0 on success or error on failure
+ */
int adm_connect_afe_port(int mode, int session_id, int port_id)
{
struct adm_cmd_connect_afe_port_v5 cmd;
@@ -2249,6 +2395,7 @@
return ret;
}
+EXPORT_SYMBOL(adm_connect_afe_port);
int adm_arrange_mch_map(struct adm_cmd_device_open_v5 *open, int path,
int channel_mode)
@@ -2382,6 +2529,22 @@
return rc;
}
+/**
+ * adm_open -
+ * command to send ADM open
+ *
+ * @port_id: port id number
+ * @path: direction or ADM path type
+ * @rate: sample rate of session
+ * @channel_mode: number of channels set
+ * @topology: topology active for this session
+ * @perf_mode: performance mode like LL/ULL/..
+ * @bit_width: bit width to set for copp
+ * @app_type: App type used for this session
+ * @acdb_id: ACDB ID of this device
+ *
+ * Returns 0 on success or error on failure
+ */
int adm_open(int port_id, int path, int rate, int channel_mode, int topology,
int perf_mode, uint16_t bit_width, int app_type, int acdb_id)
{
@@ -2621,7 +2784,17 @@
atomic_inc(&this_adm.copp.cnt[port_idx][copp_idx]);
return copp_idx;
}
+EXPORT_SYMBOL(adm_open);
+/**
+ * adm_copp_mfc_cfg -
+ * command to send ADM MFC config
+ *
+ * @port_id: Port ID number
+ * @copp_idx: copp index assigned
+ * @dst_sample_rate: sink sample rate
+ *
+ */
void adm_copp_mfc_cfg(int port_id, int copp_idx, int dst_sample_rate)
{
struct audproc_mfc_output_media_fmt mfc_cfg;
@@ -2723,6 +2896,7 @@
fail_cmd:
return;
}
+EXPORT_SYMBOL(adm_copp_mfc_cfg);
static void route_set_opcode_matrix_id(
struct adm_cmd_matrix_map_routings_v5 **route_addr,
@@ -2763,6 +2937,17 @@
__func__, route->hdr.opcode, route->matrix_id);
}
+/**
+ * adm_matrix_map -
+ * command to send ADM matrix map for ADM copp list
+ *
+ * @path: direction or ADM path type
+ * @payload_map: have info of session id and associated copp_idx/num_copps
+ * @perf_mode: performance mode like LL/ULL/..
+ * @passthr_mode: flag to indicate passthrough mode
+ *
+ * Returns 0 on success or error on failure
+ */
int adm_matrix_map(int path, struct route_payload payload_map, int perf_mode,
uint32_t passthr_mode)
{
@@ -2892,34 +3077,69 @@
kfree(matrix_map);
return ret;
}
+EXPORT_SYMBOL(adm_matrix_map);
+/**
+ * adm_ec_ref_rx_id -
+ * Update EC ref port ID
+ *
+ */
void adm_ec_ref_rx_id(int port_id)
{
this_adm.ec_ref_rx = port_id;
pr_debug("%s: ec_ref_rx:%d\n", __func__, this_adm.ec_ref_rx);
}
+EXPORT_SYMBOL(adm_ec_ref_rx_id);
+/**
+ * adm_num_ec_ref_rx_chans -
+ * Update EC ref number of channels
+ *
+ */
void adm_num_ec_ref_rx_chans(int num_chans)
{
this_adm.num_ec_ref_rx_chans = num_chans;
pr_debug("%s: num_ec_ref_rx_chans:%d\n",
__func__, this_adm.num_ec_ref_rx_chans);
}
+EXPORT_SYMBOL(adm_num_ec_ref_rx_chans);
+/**
+ * adm_ec_ref_rx_bit_width -
+ * Update EC ref bit_width
+ *
+ */
void adm_ec_ref_rx_bit_width(int bit_width)
{
this_adm.ec_ref_rx_bit_width = bit_width;
pr_debug("%s: ec_ref_rx_bit_width:%d\n",
__func__, this_adm.ec_ref_rx_bit_width);
}
+EXPORT_SYMBOL(adm_ec_ref_rx_bit_width);
+/**
+ * adm_ec_ref_rx_sampling_rate -
+ * Update EC ref sample rate
+ *
+ */
void adm_ec_ref_rx_sampling_rate(int sampling_rate)
{
this_adm.ec_ref_rx_sampling_rate = sampling_rate;
pr_debug("%s: ec_ref_rx_sampling_rate:%d\n",
__func__, this_adm.ec_ref_rx_sampling_rate);
}
+EXPORT_SYMBOL(adm_ec_ref_rx_sampling_rate);
+/**
+ * adm_close -
+ * command to close ADM copp
+ *
+ * @port_id: Port ID number
+ * @perf_mode: performance mode like LL/ULL/..
+ * @copp_idx: copp index assigned
+ *
+ * Returns 0 on success or error on failure
+ */
int adm_close(int port_id, int perf_mode, int copp_idx)
{
struct apr_hdr close;
@@ -3053,6 +3273,7 @@
}
return 0;
}
+EXPORT_SYMBOL(adm_close);
int send_rtac_audvol_cal(void)
{
@@ -3474,6 +3695,16 @@
return ret;
}
+/**
+ * adm_set_volume -
+ * command to set volume on ADM copp
+ *
+ * @port_id: Port ID number
+ * @copp_idx: copp index assigned
+ * @volume: gain value to set
+ *
+ * Returns 0 on success or error on failure
+ */
int adm_set_volume(int port_id, int copp_idx, int volume)
{
struct audproc_volume_ctrl_master_gain audproc_vol;
@@ -3552,7 +3783,18 @@
fail_cmd:
return rc;
}
+EXPORT_SYMBOL(adm_set_volume);
+/**
+ * adm_set_softvolume -
+ * command to set softvolume
+ *
+ * @port_id: Port ID number
+ * @copp_idx: copp index assigned
+ * @softvol_param: Params to set for softvolume
+ *
+ * Returns 0 on success or error on failure
+ */
int adm_set_softvolume(int port_id, int copp_idx,
struct audproc_softvolume_params *softvol_param)
{
@@ -3644,7 +3886,18 @@
fail_cmd:
return rc;
}
+EXPORT_SYMBOL(adm_set_softvolume);
+/**
+ * adm_set_mic_gain -
+ * command to set MIC gain
+ *
+ * @port_id: Port ID number
+ * @copp_idx: copp index assigned
+ * @volume: gain value to set
+ *
+ * Returns 0 on success or error on failure
+ */
int adm_set_mic_gain(int port_id, int copp_idx, int volume)
{
struct adm_set_mic_gain_params mic_gain_params;
@@ -3722,7 +3975,18 @@
fail_cmd:
return rc;
}
+EXPORT_SYMBOL(adm_set_mic_gain);
+/**
+ * adm_send_set_multichannel_ec_primary_mic_ch -
+ * command to set multi-ch EC primary mic
+ *
+ * @port_id: Port ID number
+ * @copp_idx: copp index assigned
+ * @primary_mic_ch: channel number of primary mic
+ *
+ * Returns 0 on success or error on failure
+ */
int adm_send_set_multichannel_ec_primary_mic_ch(int port_id, int copp_idx,
int primary_mic_ch)
{
@@ -3810,7 +4074,19 @@
fail_cmd:
return rc;
}
+EXPORT_SYMBOL(adm_send_set_multichannel_ec_primary_mic_ch);
+/**
+ * adm_param_enable -
+ * command to send params to ADM for given module
+ *
+ * @port_id: Port ID number
+ * @copp_idx: copp index assigned
+ * @module_id: ADM module
+ * @enable: flag to enable or disable module
+ *
+ * Returns 0 on success or error on failure
+ */
int adm_param_enable(int port_id, int copp_idx, int module_id, int enable)
{
struct audproc_enable_param_t adm_mod_enable;
@@ -3896,7 +4172,22 @@
return rc;
}
+EXPORT_SYMBOL(adm_param_enable);
+/**
+ * adm_send_calibration -
+ * send ADM calibration to DSP
+ *
+ * @port_id: Port ID number
+ * @copp_idx: copp index assigned
+ * @path: direction or ADM path type
+ * @perf_mode: performance mode like LL/ULL/..
+ * @cal_type: calibration type to use
+ * @params: pointer with cal data
+ * @size: cal size
+ *
+ * Returns 0 on success or error on failure
+ */
int adm_send_calibration(int port_id, int copp_idx, int path, int perf_mode,
int cal_type, char *params, int size)
{
@@ -3988,6 +4279,7 @@
kfree(adm_params);
return rc;
}
+EXPORT_SYMBOL(adm_send_calibration);
/*
* adm_update_wait_parameters must be called with routing driver locks.
@@ -4024,7 +4316,17 @@
return ret;
}
+EXPORT_SYMBOL(adm_set_wait_parameters);
+/**
+ * adm_reset_wait_parameters -
+ * reset wait parameters or ADM delay value
+ *
+ * @port_id: Port ID number
+ * @copp_idx: copp index assigned
+ *
+ * Returns 0 on success or error on failure
+ */
int adm_reset_wait_parameters(int port_id, int copp_idx)
{
int ret = 0, port_idx;
@@ -4050,7 +4352,18 @@
end:
return ret;
}
+EXPORT_SYMBOL(adm_reset_wait_parameters);
+/**
+ * adm_wait_timeout -
+ * ADM wait command after command send to DSP
+ *
+ * @port_id: Port ID number
+ * @copp_idx: copp index assigned
+ * @wait_time: value in ms for command timeout
+ *
+ * Returns 0 on success or error on failure
+ */
int adm_wait_timeout(int port_id, int copp_idx, int wait_time)
{
int ret = 0, port_idx;
@@ -4081,7 +4394,22 @@
pr_debug("%s: return %d--\n", __func__, ret);
return ret;
}
+EXPORT_SYMBOL(adm_wait_timeout);
+/**
+ * adm_store_cal_data -
+ * Retrieve calibration data for ADM copp device
+ *
+ * @port_id: Port ID number
+ * @copp_idx: copp index assigned
+ * @path: direction or copp type
+ * @perf_mode: performance mode like LL/ULL/..
+ * @cal_index: calibration index to use
+ * @params: pointer to store cal data
+ * @size: pointer to fill with cal size
+ *
+ * Returns 0 on success or error on failure
+ */
int adm_store_cal_data(int port_id, int copp_idx, int path, int perf_mode,
int cal_index, char *params, int *size)
{
@@ -4165,7 +4493,18 @@
end:
return rc;
}
+EXPORT_SYMBOL(adm_store_cal_data);
+/**
+ * adm_send_compressed_device_mute -
+ * command to send mute for compressed device
+ *
+ * @port_id: Port ID number
+ * @copp_idx: copp index assigned
+ * @mute_on: flag to indicate mute or unmute
+ *
+ * Returns 0 on success or error on failure
+ */
int adm_send_compressed_device_mute(int port_id, int copp_idx, bool mute_on)
{
struct adm_set_compressed_device_mute mute_params;
@@ -4242,7 +4581,18 @@
end:
return ret;
}
+EXPORT_SYMBOL(adm_send_compressed_device_mute);
+/**
+ * adm_send_compressed_device_latency -
+ * command to send latency for compressed device
+ *
+ * @port_id: Port ID number
+ * @copp_idx: copp index assigned
+ * @latency: latency value to pass
+ *
+ * Returns 0 on success or error on failure
+ */
int adm_send_compressed_device_latency(int port_id, int copp_idx, int latency)
{
struct adm_set_compressed_device_latency latency_params;
@@ -4319,6 +4669,7 @@
end:
return ret;
}
+EXPORT_SYMBOL(adm_send_compressed_device_latency);
/**
* adm_swap_speaker_channels
@@ -4450,6 +4801,16 @@
}
EXPORT_SYMBOL(adm_swap_speaker_channels);
+/**
+ * adm_set_sound_focus -
+ * Update sound focus info
+ *
+ * @port_id: Port ID number
+ * @copp_idx: copp index assigned
+ * @soundFocusData: sound focus data to pass
+ *
+ * Returns 0 on success or error on failure
+ */
int adm_set_sound_focus(int port_id, int copp_idx,
struct sound_focus_param soundFocusData)
{
@@ -4559,7 +4920,18 @@
return ret;
}
+EXPORT_SYMBOL(adm_set_sound_focus);
+/**
+ * adm_get_sound_focus -
+ * Retrieve sound focus info
+ *
+ * @port_id: Port ID number
+ * @copp_idx: copp index assigned
+ * @soundFocusData: pointer for sound focus data to be updated with
+ *
+ * Returns 0 on success or error on failure
+ */
int adm_get_sound_focus(int port_id, int copp_idx,
struct sound_focus_param *soundFocusData)
{
@@ -4623,6 +4995,7 @@
return ret;
}
+EXPORT_SYMBOL(adm_get_sound_focus);
static int adm_source_tracking_alloc_map_memory(void)
{
@@ -4682,6 +5055,16 @@
return ret;
}
+/**
+ * adm_get_source_tracking -
+ * Retrieve source tracking info
+ *
+ * @port_id: Port ID number
+ * @copp_idx: copp index assigned
+ * @sourceTrackingData: pointer for source track data to be updated with
+ *
+ * Returns 0 on success or error on failure
+ */
int adm_get_source_tracking(int port_id, int copp_idx,
struct source_tracking_param *sourceTrackingData)
{
@@ -4808,8 +5191,9 @@
return ret;
}
+EXPORT_SYMBOL(adm_get_source_tracking);
-static int __init adm_init(void)
+int __init adm_init(void)
{
int i = 0, j;
@@ -4857,14 +5241,13 @@
this_adm.sourceTrackingData.apr_cmd_status = -1;
atomic_set(&this_adm.mem_map_handles[ADM_MEM_MAP_INDEX_SOURCE_TRACKING],
0);
+ mutex_init(&dts_srs_lock);
return 0;
}
-static void __exit adm_exit(void)
+void __exit adm_exit(void)
{
+ mutex_destroy(&dts_srs_lock);
adm_delete_cal_data();
}
-
-device_initcall(adm_init);
-module_exit(adm_exit);
diff --git a/dsp/q6afe.c b/dsp/q6afe.c
index b6a7aa3..631a123 100644
--- a/dsp/q6afe.c
+++ b/dsp/q6afe.c
@@ -157,6 +157,13 @@
return topology;
}
+/**
+ * afe_set_aanc_info -
+ * Update AFE AANC info
+ *
+ * @q6_aanc_info: AFE AANC info params
+ *
+ */
void afe_set_aanc_info(struct aanc_data *q6_aanc_info)
{
this_afe.aanc_info.aanc_active = q6_aanc_info->aanc_active;
@@ -169,6 +176,7 @@
this_afe.aanc_info.aanc_rx_port,
this_afe.aanc_info.aanc_tx_port);
}
+EXPORT_SYMBOL(afe_set_aanc_info);
static void afe_callback_debug_print(struct apr_client_data *data)
{
@@ -457,6 +465,14 @@
return 0;
}
+/**
+ * afe_get_port_type -
+ * Retrieve AFE port type whether RX or TX
+ *
+ * @port_id: AFE Port ID number
+ *
+ * Returns RX/TX type on success or -EINVAL on failure.
+ */
int afe_get_port_type(u16 port_id)
{
int ret;
@@ -635,6 +651,7 @@
return ret;
}
+EXPORT_SYMBOL(afe_get_port_type);
int afe_sizeof_cfg_cmd(u16 port_id)
{
@@ -712,6 +729,12 @@
return ret_size;
}
+/**
+ * afe_q6_interface_prepare -
+ * wrapper API to check Q6 AFE registered to APR otherwise registers
+ *
+ * Returns 0 on success or error on failure.
+ */
int afe_q6_interface_prepare(void)
{
int ret = 0;
@@ -729,6 +752,7 @@
}
return ret;
}
+EXPORT_SYMBOL(afe_q6_interface_prepare);
/*
* afe_apr_send_pkt : returns 0 on success, negative otherwise.
@@ -2059,6 +2083,15 @@
return ret;
}
+/**
+ * afe_port_set_mad_type -
+ * to update mad type
+ *
+ * @port_id: AFE port id number
+ * @mad_type: MAD type enum value
+ *
+ * Returns 0 on success or error on failure.
+ */
int afe_port_set_mad_type(u16 port_id, enum afe_mad_type mad_type)
{
int i;
@@ -2077,7 +2110,16 @@
atomic_set(&afe_ports_mad_type[i], mad_type);
return 0;
}
+EXPORT_SYMBOL(afe_port_set_mad_type);
+/**
+ * afe_port_get_mad_type -
+ * to retrieve mad type
+ *
+ * @port_id: AFE port id number
+ *
+ * Returns valid enum value on success or MAD_HW_NONE on failure.
+ */
enum afe_mad_type afe_port_get_mad_type(u16 port_id)
{
int i;
@@ -2093,7 +2135,19 @@
}
return (enum afe_mad_type) atomic_read(&afe_ports_mad_type[i]);
}
+EXPORT_SYMBOL(afe_port_get_mad_type);
+/**
+ * afe_set_config -
+ * to configure AFE session with
+ * specified configuration for given config type
+ *
+ * @config_type: config type
+ * @config_data: configuration to pass to AFE session
+ * @arg: argument used in specific config types
+ *
+ * Returns 0 on success or error value on port start failure.
+ */
int afe_set_config(enum afe_config_type config_type, void *config_data, int arg)
{
int ret;
@@ -2247,6 +2301,16 @@
return ret;
}
+/**
+ * afe_send_spdif_ch_status_cfg -
+ * to configure AFE session with
+ * specified channel status configuration
+ *
+ * @ch_status_cfg: channel status configutation
+ * @port_id: AFE port id number
+ *
+ * Returns 0 on success or error value on port start failure.
+ */
int afe_send_spdif_ch_status_cfg(struct afe_param_id_spdif_ch_status_cfg
*ch_status_cfg, u16 port_id)
{
@@ -2326,6 +2390,7 @@
fail_cmd:
return ret;
}
+EXPORT_SYMBOL(afe_send_spdif_ch_status_cfg);
static int afe_send_cmd_port_start(u16 port_id)
{
@@ -2388,6 +2453,16 @@
return ret;
}
+/**
+ * afe_spdif_port_start - to configure AFE session with
+ * specified port configuration
+ *
+ * @port_id: AFE port id number
+ * @spdif_port: spdif port configutation
+ * @rate: sampling rate of port
+ *
+ * Returns 0 on success or error value on port start failure.
+ */
int afe_spdif_port_start(u16 port_id, struct afe_spdif_port_config *spdif_port,
u32 rate)
{
@@ -2463,6 +2538,7 @@
fail_cmd:
return ret;
}
+EXPORT_SYMBOL(afe_spdif_port_start);
int afe_send_slot_mapping_cfg(
struct afe_param_id_slot_mapping_cfg *slot_mapping_cfg,
@@ -2622,6 +2698,17 @@
return ret;
}
+/**
+ * afe_tdm_port_start - to configure AFE session with
+ * specified port configuration
+ *
+ * @port_id: AFE port id number
+ * @tdm_port: TDM port configutation
+ * @rate: sampling rate of port
+ * @num_groups: number of TDM groups
+ *
+ * Returns 0 on success or error value on port start failure.
+ */
int afe_tdm_port_start(u16 port_id, struct afe_tdm_port_config *tdm_port,
u32 rate, u16 num_groups)
{
@@ -2749,7 +2836,16 @@
fail_cmd:
return ret;
}
+EXPORT_SYMBOL(afe_tdm_port_start);
+/**
+ * afe_set_cal_mode -
+ * set cal mode for AFE calibration
+ *
+ * @port_id: AFE port id number
+ * @afe_cal_mode: AFE calib mode
+ *
+ */
void afe_set_cal_mode(u16 port_id, enum afe_cal_mode afe_cal_mode)
{
uint16_t port_index;
@@ -2757,11 +2853,20 @@
port_index = afe_get_port_index(port_id);
this_afe.afe_cal_mode[port_index] = afe_cal_mode;
}
+EXPORT_SYMBOL(afe_set_cal_mode);
+/**
+ * afe_set_routing_callback -
+ * Update callback function for routing
+ *
+ * @cb: callback function to update with
+ *
+ */
void afe_set_routing_callback(routing_cb cb)
{
this_afe.rt_cb = cb;
}
+EXPORT_SYMBOL(afe_set_routing_callback);
int afe_port_send_usb_dev_param(u16 port_id, union afe_port_config *afe_config)
{
@@ -3590,6 +3695,16 @@
}
}
+/**
+ * afe_open -
+ * command to open AFE port
+ *
+ * @port_id: AFE port id
+ * @afe_config: AFE port config to pass
+ * @rate: sample rate
+ *
+ * Returns 0 on success or error on failure
+ */
int afe_open(u16 port_id,
union afe_port_config *afe_config, int rate)
{
@@ -3767,7 +3882,18 @@
mutex_unlock(&this_afe.afe_cmd_lock);
return ret;
}
+EXPORT_SYMBOL(afe_open);
+/**
+ * afe_loopback -
+ * command to set loopback between AFE ports
+ *
+ * @enable: enable or disable loopback
+ * @rx_port: AFE RX port ID
+ * @tx_port: AFE TX port ID
+ *
+ * Returns 0 on success or error on failure
+ */
int afe_loopback(u16 enable, u16 rx_port, u16 tx_port)
{
struct afe_loopback_cfg_v1 lb_cmd;
@@ -3825,7 +3951,17 @@
pr_err("%s: AFE loopback failed %d\n", __func__, ret);
return ret;
}
+EXPORT_SYMBOL(afe_loopback);
+/**
+ * afe_loopback_gain -
+ * command to set gain for AFE loopback
+ *
+ * @port_id: AFE port id
+ * @volume: gain value to set
+ *
+ * Returns 0 on success or error on failure
+ */
int afe_loopback_gain(u16 port_id, u16 volume)
{
struct afe_loopback_gain_per_path_param set_param;
@@ -3908,6 +4044,7 @@
fail_cmd:
return ret;
}
+EXPORT_SYMBOL(afe_loopback_gain);
int afe_pseudo_port_start_nowait(u16 port_id)
{
@@ -4094,6 +4231,16 @@
return ret;
}
+/**
+ * afe_port_group_enable -
+ * command to enable AFE port group
+ *
+ * @group_id: group ID for AFE port group
+ * @afe_group_config: config for AFE group
+ * @enable: flag to indicate enable or disable
+ *
+ * Returns 0 on success or error on failure
+ */
int afe_port_group_enable(u16 group_id,
union afe_port_group_config *afe_group_config,
u16 enable)
@@ -4146,6 +4293,7 @@
return ret;
}
+EXPORT_SYMBOL(afe_port_group_enable);
int afe_stop_pseudo_port(u16 port_id)
{
@@ -4191,11 +4339,28 @@
return ret;
}
+/**
+ * afe_req_mmap_handle -
+ * Retrieve AFE memory map handle
+ *
+ * @ac: AFE audio client
+ *
+ * Returns memory map handle
+ */
uint32_t afe_req_mmap_handle(struct afe_audio_client *ac)
{
return ac->mem_map_handle;
}
+EXPORT_SYMBOL(afe_req_mmap_handle);
+/**
+ * q6afe_audio_client_alloc -
+ * Assign new AFE audio client
+ *
+ * @priv: privata data to hold for audio client
+ *
+ * Returns ac pointer on success or NULL on failure
+ */
struct afe_audio_client *q6afe_audio_client_alloc(void *priv)
{
struct afe_audio_client *ac;
@@ -4220,7 +4385,19 @@
return ac;
}
+EXPORT_SYMBOL(q6afe_audio_client_alloc);
+/**
+ * q6afe_audio_client_buf_alloc_contiguous -
+ * Allocate contiguous shared buffers
+ *
+ * @dir: RX or TX direction of AFE port
+ * @ac: AFE audio client handle
+ * @bufsz: size of each shared buffer
+ * @bufcnt: number of buffers
+ *
+ * Returns 0 on success or error on failure
+ */
int q6afe_audio_client_buf_alloc_contiguous(unsigned int dir,
struct afe_audio_client *ac,
unsigned int bufsz,
@@ -4299,7 +4476,18 @@
q6afe_audio_client_buf_free_contiguous(dir, ac);
return -EINVAL;
}
+EXPORT_SYMBOL(q6afe_audio_client_buf_alloc_contiguous);
+/**
+ * afe_memory_map -
+ * command to map shared buffers to AFE
+ *
+ * @dma_addr_p: DMA physical address
+ * @dma_buf_sz: shared DMA buffer size
+ * @ac: AFE audio client handle
+ *
+ * Returns 0 on success or error on failure
+ */
int afe_memory_map(phys_addr_t dma_addr_p, u32 dma_buf_sz,
struct afe_audio_client *ac)
{
@@ -4320,6 +4508,7 @@
return ret;
}
+EXPORT_SYMBOL(afe_memory_map);
int afe_cmd_memory_map(phys_addr_t dma_addr_p, u32 dma_buf_sz)
{
@@ -4494,6 +4683,15 @@
kfree(mmap_region_cmd);
return ret;
}
+
+/**
+ * q6afe_audio_client_buf_free_contiguous -
+ * frees the shared contiguous memory
+ *
+ * @dir: RX or TX direction of port
+ * @ac: AFE audio client handle
+ *
+ */
int q6afe_audio_client_buf_free_contiguous(unsigned int dir,
struct afe_audio_client *ac)
{
@@ -4533,7 +4731,15 @@
mutex_unlock(&ac->cmd_lock);
return 0;
}
+EXPORT_SYMBOL(q6afe_audio_client_buf_free_contiguous);
+/**
+ * q6afe_audio_client_free -
+ * frees the audio client from AFE
+ *
+ * @ac: AFE audio client handle
+ *
+ */
void q6afe_audio_client_free(struct afe_audio_client *ac)
{
int loopcnt;
@@ -4552,7 +4758,16 @@
}
kfree(ac);
}
+EXPORT_SYMBOL(q6afe_audio_client_free);
+/**
+ * afe_cmd_memory_unmap -
+ * command to unmap memory for AFE shared buffer
+ *
+ * @mem_map_handle: memory map handle to be unmapped
+ *
+ * Returns 0 on success or error on failure
+ */
int afe_cmd_memory_unmap(u32 mem_map_handle)
{
int ret = 0;
@@ -4593,6 +4808,7 @@
return ret;
}
+EXPORT_SYMBOL(afe_cmd_memory_unmap);
int afe_cmd_memory_unmap_nowait(u32 mem_map_handle)
{
@@ -4629,6 +4845,16 @@
return ret;
}
+/**
+ * afe_register_get_events -
+ * register for events from proxy port
+ *
+ * @port_id: Port ID to register events
+ * @cb: callback function to invoke for events from proxy port
+ * @private_data: private data to sent back in callback fn
+ *
+ * Returns 0 on success or error on failure
+ */
int afe_register_get_events(u16 port_id,
void (*cb)(uint32_t opcode,
uint32_t token, uint32_t *payload, void *priv),
@@ -4681,7 +4907,16 @@
__func__, ret);
return ret;
}
+EXPORT_SYMBOL(afe_register_get_events);
+/**
+ * afe_unregister_get_events -
+ * unregister for events from proxy port
+ *
+ * @port_id: Port ID to unregister events
+ *
+ * Returns 0 on success or error on failure
+ */
int afe_unregister_get_events(u16 port_id)
{
int ret = 0;
@@ -4748,7 +4983,19 @@
__func__, ret);
return ret;
}
+EXPORT_SYMBOL(afe_unregister_get_events);
+/**
+ * afe_rt_proxy_port_write -
+ * command for AFE RT proxy port write
+ *
+ * @buf_addr_p: Physical buffer address with
+ * playback data to proxy port
+ * @mem_map_handle: memory map handle of write buffer
+ * @bytes: number of bytes to write
+ *
+ * Returns 0 on success or error on failure
+ */
int afe_rt_proxy_port_write(phys_addr_t buf_addr_p,
u32 mem_map_handle, int bytes)
{
@@ -4785,7 +5032,18 @@
return ret;
}
+EXPORT_SYMBOL(afe_rt_proxy_port_write);
+/**
+ * afe_rt_proxy_port_read -
+ * command for AFE RT proxy port read
+ *
+ * @buf_addr_p: Physical buffer address to fill read data
+ * @mem_map_handle: memory map handle for buffer read
+ * @bytes: number of bytes to read
+ *
+ * Returns 0 on success or error on failure
+ */
int afe_rt_proxy_port_read(phys_addr_t buf_addr_p,
u32 mem_map_handle, int bytes)
{
@@ -4820,6 +5078,7 @@
__func__, afecmd_rd.port_id, ret);
return ret;
}
+EXPORT_SYMBOL(afe_rt_proxy_port_read);
#ifdef CONFIG_DEBUG_FS
static struct dentry *debugfs_afelb;
@@ -4985,6 +5244,14 @@
}
#endif
+/**
+ * afe_set_dtmf_gen_rx_portid -
+ * Set port_id for DTMF tone generation
+ *
+ * @port_id: AFE port id
+ * @set: set or reset port id value for dtmf gen
+ *
+ */
void afe_set_dtmf_gen_rx_portid(u16 port_id, int set)
{
if (set)
@@ -4992,7 +5259,18 @@
else if (this_afe.dtmf_gen_rx_portid == port_id)
this_afe.dtmf_gen_rx_portid = -1;
}
+EXPORT_SYMBOL(afe_set_dtmf_gen_rx_portid);
+/**
+ * afe_dtmf_generate_rx - command to generate AFE DTMF RX
+ *
+ * @duration_in_ms: Duration in ms for dtmf tone
+ * @high_freq: Higher frequency for dtmf
+ * @low_freq: lower frequency for dtmf
+ * @gain: Gain value for DTMF tone
+ *
+ * Returns 0 on success, appropriate error code otherwise
+ */
int afe_dtmf_generate_rx(int64_t duration_in_ms,
uint16_t high_freq,
uint16_t low_freq, uint16_t gain)
@@ -5079,6 +5357,7 @@
pr_err("%s: failed %d\n", __func__, ret);
return ret;
}
+EXPORT_SYMBOL(afe_dtmf_generate_rx);
static int afe_sidetone_iir(u16 tx_port_id)
{
@@ -5556,6 +5835,13 @@
}
+/**
+ * afe_close - command to close AFE port
+ *
+ * @port_id: AFE port id
+ *
+ * Returns 0 on success, appropriate error code otherwise
+ */
int afe_close(int port_id)
{
struct afe_port_cmd_device_stop stop;
@@ -5678,6 +5964,7 @@
fail_cmd:
return ret;
}
+EXPORT_SYMBOL(afe_close);
int afe_set_digital_codec_core_clock(u16 port_id,
struct afe_digital_clk_cfg *cfg)
@@ -5754,6 +6041,14 @@
return ret;
}
+/**
+ * afe_set_lpass_clock - Enable AFE lpass clock
+ *
+ * @port_id: AFE port id
+ * @cfg: pointer to clk set struct
+ *
+ * Returns 0 on success, appropriate error code otherwise
+ */
int afe_set_lpass_clock(u16 port_id, struct afe_clk_cfg *cfg)
{
struct afe_lpass_clk_config_command clk_cfg;
@@ -5844,6 +6139,7 @@
mutex_unlock(&this_afe.afe_cmd_lock);
return ret;
}
+EXPORT_SYMBOL(afe_set_lpass_clock);
/**
* afe_set_lpass_clk_cfg - Set AFE clk config
@@ -6325,6 +6621,15 @@
return ret;
}
+/**
+ * afe_get_av_dev_drift -
+ * command to retrieve AV drift
+ *
+ * @timing_stats: timing stats to be updated with AV drift values
+ * @port: AFE port ID
+ *
+ * Returns 0 on success or error on failure
+ */
int afe_get_av_dev_drift(struct afe_param_id_dev_timing_stats *timing_stats,
u16 port)
{
@@ -6406,6 +6711,7 @@
exit:
return ret;
}
+EXPORT_SYMBOL(afe_get_av_dev_drift);
int afe_spk_prot_get_calib_data(struct afe_spkr_prot_get_vi_calib *calib_resp)
{
@@ -6486,6 +6792,18 @@
return ret;
}
+/**
+ * afe_spk_prot_feed_back_cfg -
+ * command to setup spk protection feedback config
+ *
+ * @src_port: source port id
+ * @dst_port: destination port id
+ * @l_ch: left speaker active or not
+ * @r_ch: right speaker active or not
+ * @enable: flag to enable or disable
+ *
+ * Returns 0 on success or error on failure
+ */
int afe_spk_prot_feed_back_cfg(int src_port, int dst_port,
int l_ch, int r_ch, u32 enable)
{
@@ -6531,6 +6849,7 @@
fail_cmd:
return ret;
}
+EXPORT_SYMBOL(afe_spk_prot_feed_back_cfg);
static int get_cal_type_index(int32_t cal_type)
{
@@ -7200,7 +7519,7 @@
return result;
}
-static int __init afe_init(void)
+int __init afe_init(void)
{
int i = 0, ret;
@@ -7231,7 +7550,7 @@
return 0;
}
-static void __exit afe_exit(void)
+void __exit afe_exit(void)
{
afe_delete_cal_data();
@@ -7239,6 +7558,3 @@
mutex_destroy(&this_afe.afe_cmd_lock);
wakeup_source_trash(&wl.ws);
}
-
-device_initcall(afe_init);
-__exitcall(afe_exit);
diff --git a/dsp/q6asm.c b/dsp/q6asm.c
index 0a4216a..4e988ee 100644
--- a/dsp/q6asm.c
+++ b/dsp/q6asm.c
@@ -981,6 +981,15 @@
return 0;
}
+/**
+ * q6asm_audio_client_buf_free_contiguous -
+ * frees the memory buffers for ASM
+ *
+ * @dir: RX or TX direction
+ * @ac: audio client handle
+ *
+ * Returns 0 on success or error on failure
+ */
int q6asm_audio_client_buf_free_contiguous(unsigned int dir,
struct audio_client *ac)
{
@@ -1030,7 +1039,15 @@
mutex_unlock(&ac->cmd_lock);
return 0;
}
+EXPORT_SYMBOL(q6asm_audio_client_buf_free_contiguous);
+/**
+ * q6asm_audio_client_free -
+ * frees the audio client for ASM
+ *
+ * @ac: audio client handle
+ *
+ */
void q6asm_audio_client_free(struct audio_client *ac)
{
int loopcnt;
@@ -1075,7 +1092,17 @@
ac = NULL;
mutex_unlock(&session_lock);
}
+EXPORT_SYMBOL(q6asm_audio_client_free);
+/**
+ * q6asm_set_io_mode -
+ * Update IO mode for ASM
+ *
+ * @ac: audio client handle
+ * @mode1: IO mode to update
+ *
+ * Returns 0 on success or error on failure
+ */
int q6asm_set_io_mode(struct audio_client *ac, uint32_t mode1)
{
uint32_t mode;
@@ -1102,6 +1129,7 @@
return ret;
}
+EXPORT_SYMBOL(q6asm_set_io_mode);
void *q6asm_mmap_apr_reg(void)
{
@@ -1123,6 +1151,15 @@
return NULL;
}
+/**
+ * q6asm_send_stream_cmd -
+ * command to send for ASM stream
+ *
+ * @ac: audio client handle
+ * @data: event data
+ *
+ * Returns 0 on success or error on failure
+ */
int q6asm_send_stream_cmd(struct audio_client *ac,
struct msm_adsp_event_data *data)
{
@@ -1188,7 +1225,17 @@
done:
return rc;
}
+EXPORT_SYMBOL(q6asm_send_stream_cmd);
+/**
+ * q6asm_audio_client_alloc -
+ * Alloc audio client for ASM
+ *
+ * @cb: callback fn
+ * @priv: private data
+ *
+ * Returns ac pointer on success or NULL on failure
+ */
struct audio_client *q6asm_audio_client_alloc(app_cb cb, void *priv)
{
struct audio_client *ac;
@@ -1284,7 +1331,16 @@
kfree(ac);
return NULL;
}
+EXPORT_SYMBOL(q6asm_audio_client_alloc);
+/**
+ * q6asm_get_audio_client -
+ * Retrieve audio client for ASM
+ *
+ * @session_id: ASM session id
+ *
+ * Returns valid pointer on success or NULL on failure
+ */
struct audio_client *q6asm_get_audio_client(int session_id)
{
if (session_id == ASM_CONTROL_SESSION)
@@ -1303,7 +1359,19 @@
err:
return NULL;
}
+EXPORT_SYMBOL(q6asm_get_audio_client);
+/**
+ * q6asm_audio_client_buf_alloc -
+ * Allocs memory from ION for ASM
+ *
+ * @dir: RX or TX direction
+ * @ac: Audio client handle
+ * @bufsz: size of each buffer
+ * @bufcnt: number of buffers to alloc
+ *
+ * Returns 0 on success or error on failure
+ */
int q6asm_audio_client_buf_alloc(unsigned int dir,
struct audio_client *ac,
unsigned int bufsz,
@@ -1393,7 +1461,19 @@
q6asm_audio_client_buf_free(dir, ac);
return -EINVAL;
}
+EXPORT_SYMBOL(q6asm_audio_client_buf_alloc);
+/**
+ * q6asm_audio_client_buf_alloc_contiguous -
+ * Alloc contiguous memory from ION for ASM
+ *
+ * @dir: RX or TX direction
+ * @ac: Audio client handle
+ * @bufsz: size of each buffer
+ * @bufcnt: number of buffers to alloc
+ *
+ * Returns 0 on success or error on failure
+ */
int q6asm_audio_client_buf_alloc_contiguous(unsigned int dir,
struct audio_client *ac,
unsigned int bufsz,
@@ -1496,6 +1576,7 @@
q6asm_audio_client_buf_free_contiguous(dir, ac);
return -EINVAL;
}
+EXPORT_SYMBOL(q6asm_audio_client_buf_alloc_contiguous);
static int32_t q6asm_srvc_callback(struct apr_client_data *data, void *priv)
{
@@ -2134,6 +2215,18 @@
return 0;
}
+/**
+ * q6asm_is_cpu_buf_avail -
+ * retrieve next CPU buf avail
+ *
+ * @dir: RX or TX direction
+ * @ac: Audio client handle
+ * @size: size pointer to be updated with size of buffer
+ * @index: index pointer to be updated with
+ * CPU buffer index available
+ *
+ * Returns buffer pointer on success or NULL on failure
+ */
void *q6asm_is_cpu_buf_avail(int dir, struct audio_client *ac, uint32_t *size,
uint32_t *index)
{
@@ -2188,7 +2281,17 @@
}
return NULL;
}
+EXPORT_SYMBOL(q6asm_is_cpu_buf_avail);
+/**
+ * q6asm_cpu_buf_release -
+ * releases cpu buffer for ASM
+ *
+ * @dir: RX or TX direction
+ * @ac: Audio client handle
+ *
+ * Returns 0 on success or error on failure
+ */
int q6asm_cpu_buf_release(int dir, struct audio_client *ac)
{
struct audio_port_data *port;
@@ -2222,7 +2325,20 @@
exit:
return ret;
}
+EXPORT_SYMBOL(q6asm_cpu_buf_release);
+/**
+ * q6asm_is_cpu_buf_avail_nolock -
+ * retrieve next CPU buf avail without lock acquire
+ *
+ * @dir: RX or TX direction
+ * @ac: Audio client handle
+ * @size: size pointer to be updated with size of buffer
+ * @index: index pointer to be updated with
+ * CPU buffer index available
+ *
+ * Returns buffer pointer on success or NULL on failure
+ */
void *q6asm_is_cpu_buf_avail_nolock(int dir, struct audio_client *ac,
uint32_t *size, uint32_t *index)
{
@@ -2271,6 +2387,7 @@
port->max_buf_cnt);
return data;
}
+EXPORT_SYMBOL(q6asm_is_cpu_buf_avail_nolock);
int q6asm_is_dsp_buf_avail(int dir, struct audio_client *ac)
{
@@ -2559,6 +2676,15 @@
return rc;
}
+/**
+ * q6asm_open_read -
+ * command to open ASM in read mode
+ *
+ * @ac: Audio client handle
+ * @format: capture format for ASM
+ *
+ * Returns 0 on success or error on failure
+ */
int q6asm_open_read(struct audio_client *ac,
uint32_t format)
{
@@ -2566,6 +2692,7 @@
PCM_MEDIA_FORMAT_V2 /*media fmt block ver*/,
false/*ts_mode*/);
}
+EXPORT_SYMBOL(q6asm_open_read);
int q6asm_open_read_v2(struct audio_client *ac, uint32_t format,
uint16_t bits_per_sample)
@@ -2608,6 +2735,16 @@
}
EXPORT_SYMBOL(q6asm_open_read_v4);
+/**
+ * q6asm_open_write_compressed -
+ * command to open ASM in compressed write mode
+ *
+ * @ac: Audio client handle
+ * @format: playback format for ASM
+ * @passthrough_flag: flag to indicate passthrough option
+ *
+ * Returns 0 on success or error on failure
+ */
int q6asm_open_write_compressed(struct audio_client *ac, uint32_t format,
uint32_t passthrough_flag)
{
@@ -2711,6 +2848,7 @@
fail_cmd:
return rc;
}
+EXPORT_SYMBOL(q6asm_open_write_compressed);
static int __q6asm_open_write(struct audio_client *ac, uint32_t format,
uint16_t bits_per_sample, uint32_t stream_id,
@@ -2871,6 +3009,7 @@
false /*gapless*/,
PCM_MEDIA_FORMAT_V2 /*pcm_format_block_ver*/);
}
+EXPORT_SYMBOL(q6asm_open_write);
int q6asm_open_write_v2(struct audio_client *ac, uint32_t format,
uint16_t bits_per_sample)
@@ -3128,6 +3267,16 @@
return rc;
}
+/**
+ * q6asm_open_read_write -
+ * command to open ASM in read/write mode
+ *
+ * @ac: Audio client handle
+ * @rd_format: capture format for ASM
+ * @wr_format: playback format for ASM
+ *
+ * Returns 0 on success or error on failure
+ */
int q6asm_open_read_write(struct audio_client *ac, uint32_t rd_format,
uint32_t wr_format)
{
@@ -3136,7 +3285,22 @@
16 /*bits_per_sample*/,
false /*overwrite_topology*/, 0);
}
+EXPORT_SYMBOL(q6asm_open_read_write);
+/**
+ * q6asm_open_read_write_v2 -
+ * command to open ASM in bi-directional read/write mode
+ *
+ * @ac: Audio client handle
+ * @rd_format: capture format for ASM
+ * @wr_format: playback format for ASM
+ * @is_meta_data_mode: mode to indicate if meta data present
+ * @bits_per_sample: number of bits per sample
+ * @overwrite_topology: topology to be overwritten flag
+ * @topology: Topology for ASM
+ *
+ * Returns 0 on success or error on failure
+ */
int q6asm_open_read_write_v2(struct audio_client *ac, uint32_t rd_format,
uint32_t wr_format, bool is_meta_data_mode,
uint32_t bits_per_sample, bool overwrite_topology,
@@ -3146,7 +3310,17 @@
is_meta_data_mode, bits_per_sample,
overwrite_topology, topology);
}
+EXPORT_SYMBOL(q6asm_open_read_write_v2);
+/**
+ * q6asm_open_loopback_v2 -
+ * command to open ASM in loopback mode
+ *
+ * @ac: Audio client handle
+ * @bits_per_sample: number of bits per sample
+ *
+ * Returns 0 on success or error on failure
+ */
int q6asm_open_loopback_v2(struct audio_client *ac, uint16_t bits_per_sample)
{
int rc = 0x00;
@@ -3243,8 +3417,19 @@
fail_cmd:
return rc;
}
+EXPORT_SYMBOL(q6asm_open_loopback_v2);
-
+/**
+ * q6asm_open_transcode_loopback -
+ * command to open ASM in transcode loopback mode
+ *
+ * @ac: Audio client handle
+ * @bits_per_sample: number of bits per sample
+ * @source_format: Format of clip
+ * @sink_format: end device supported format
+ *
+ * Returns 0 on success or error on failure
+ */
int q6asm_open_transcode_loopback(struct audio_client *ac,
uint16_t bits_per_sample,
uint32_t source_format, uint32_t sink_format)
@@ -3339,6 +3524,7 @@
fail_cmd:
return rc;
}
+EXPORT_SYMBOL(q6asm_open_transcode_loopback);
static
int q6asm_set_shared_circ_buff(struct audio_client *ac,
@@ -3719,7 +3905,19 @@
__func__);
return -EAGAIN;
}
+EXPORT_SYMBOL(q6asm_get_shared_pos);
+/**
+ * q6asm_run -
+ * command to set ASM to run state
+ *
+ * @ac: Audio client handle
+ * @flags: Flags for session
+ * @msw_ts: upper 32bits timestamp
+ * @lsw_ts: lower 32bits timestamp
+ *
+ * Returns 0 on success or error on failure
+ */
int q6asm_run(struct audio_client *ac, uint32_t flags,
uint32_t msw_ts, uint32_t lsw_ts)
{
@@ -3775,6 +3973,7 @@
fail_cmd:
return rc;
}
+EXPORT_SYMBOL(q6asm_run);
static int __q6asm_run_nowait(struct audio_client *ac, uint32_t flags,
uint32_t msw_ts, uint32_t lsw_ts, uint32_t stream_id)
@@ -3807,11 +4006,23 @@
return 0;
}
+/**
+ * q6asm_run_nowait -
+ * command to set ASM to run state with no wait for ack
+ *
+ * @ac: Audio client handle
+ * @flags: Flags for session
+ * @msw_ts: upper 32bits timestamp
+ * @lsw_ts: lower 32bits timestamp
+ *
+ * Returns 0 on success or error on failure
+ */
int q6asm_run_nowait(struct audio_client *ac, uint32_t flags,
uint32_t msw_ts, uint32_t lsw_ts)
{
return __q6asm_run_nowait(ac, flags, msw_ts, lsw_ts, ac->stream_id);
}
+EXPORT_SYMBOL(q6asm_run_nowait);
int q6asm_stream_run_nowait(struct audio_client *ac, uint32_t flags,
uint32_t msw_ts, uint32_t lsw_ts, uint32_t stream_id)
@@ -3819,6 +4030,20 @@
return __q6asm_run_nowait(ac, flags, msw_ts, lsw_ts, stream_id);
}
+/**
+ * q6asm_enc_cfg_blk_aac -
+ * command to set encode cfg block for aac
+ *
+ * @ac: Audio client handle
+ * @frames_per_buf: number of frames per buffer
+ * @sample_rate: Sample rate
+ * @channels: number of ASM channels
+ * @bit_rate: Bit rate info
+ * @mode: mode of AAC stream encode
+ * @format: aac format flag
+ *
+ * Returns 0 on success or error on failure
+ */
int q6asm_enc_cfg_blk_aac(struct audio_client *ac,
uint32_t frames_per_buf,
uint32_t sample_rate, uint32_t channels,
@@ -3874,7 +4099,18 @@
fail_cmd:
return rc;
}
+EXPORT_SYMBOL(q6asm_enc_cfg_blk_aac);
+/**
+ * q6asm_enc_cfg_blk_g711 -
+ * command to set encode cfg block for g711
+ *
+ * @ac: Audio client handle
+ * @frames_per_buf: number of frames per buffer
+ * @sample_rate: Sample rate
+ *
+ * Returns 0 on success or error on failure
+ */
int q6asm_enc_cfg_blk_g711(struct audio_client *ac,
uint32_t frames_per_buf,
uint32_t sample_rate)
@@ -3925,7 +4161,17 @@
fail_cmd:
return rc;
}
+EXPORT_SYMBOL(q6asm_enc_cfg_blk_g711);
+/**
+ * q6asm_set_encdec_chan_map -
+ * command to set encdec channel map
+ *
+ * @ac: Audio client handle
+ * @channels: number of channels
+ *
+ * Returns 0 on success or error on failure
+ */
int q6asm_set_encdec_chan_map(struct audio_client *ac,
uint32_t num_channels)
{
@@ -3978,6 +4224,7 @@
fail_cmd:
return rc;
}
+EXPORT_SYMBOL(q6asm_set_encdec_chan_map);
/*
* q6asm_enc_cfg_blk_pcm_v4 - sends encoder configuration parameters
@@ -4178,6 +4425,20 @@
}
EXPORT_SYMBOL(q6asm_enc_cfg_blk_pcm_v3);
+/**
+ * q6asm_enc_cfg_blk_pcm_v2 -
+ * command to set encode config block for pcm_v2
+ *
+ * @ac: Audio client handle
+ * @rate: sample rate
+ * @channels: number of channels
+ * @bits_per_sample: number of bits per sample
+ * @use_default_chmap: Flag indicating to use default ch_map or not
+ * @use_back_flavor: back flavor flag
+ * @channel_map: Custom channel map settings
+ *
+ * Returns 0 on success or error on failure
+ */
int q6asm_enc_cfg_blk_pcm_v2(struct audio_client *ac,
uint32_t rate, uint32_t channels, uint16_t bits_per_sample,
bool use_default_chmap, bool use_back_flavor, u8 *channel_map)
@@ -4256,6 +4517,7 @@
fail_cmd:
return rc;
}
+EXPORT_SYMBOL(q6asm_enc_cfg_blk_pcm_v2);
static int __q6asm_enc_cfg_blk_pcm_v4(struct audio_client *ac,
uint32_t rate, uint32_t channels,
@@ -4286,11 +4548,22 @@
bits_per_sample, true, false, NULL);
}
+/**
+ * q6asm_enc_cfg_blk_pcm -
+ * command to set encode config block for pcm
+ *
+ * @ac: Audio client handle
+ * @rate: sample rate
+ * @channels: number of channels
+ *
+ * Returns 0 on success or error on failure
+ */
int q6asm_enc_cfg_blk_pcm(struct audio_client *ac,
uint32_t rate, uint32_t channels)
{
return __q6asm_enc_cfg_blk_pcm(ac, rate, channels, 16);
}
+EXPORT_SYMBOL(q6asm_enc_cfg_blk_pcm);
int q6asm_enc_cfg_blk_pcm_format_support(struct audio_client *ac,
uint32_t rate, uint32_t channels, uint16_t bits_per_sample)
@@ -4343,6 +4616,16 @@
}
EXPORT_SYMBOL(q6asm_enc_cfg_blk_pcm_format_support_v4);
+/**
+ * q6asm_enc_cfg_blk_pcm_native -
+ * command to set encode config block for pcm_native
+ *
+ * @ac: Audio client handle
+ * @rate: sample rate
+ * @channels: number of channels
+ *
+ * Returns 0 on success or error on failure
+ */
int q6asm_enc_cfg_blk_pcm_native(struct audio_client *ac,
uint32_t rate, uint32_t channels)
{
@@ -4405,6 +4688,7 @@
fail_cmd:
return rc;
}
+EXPORT_SYMBOL(q6asm_enc_cfg_blk_pcm_native);
static int q6asm_map_channels(u8 *channel_mapping, uint32_t channels,
bool use_back_flavor)
@@ -4477,6 +4761,15 @@
return 0;
}
+/**
+ * q6asm_enable_sbrps -
+ * command to enable sbrps for ASM
+ *
+ * @ac: Audio client handle
+ * @sbr_ps_enable: flag for sbr_ps enable or disable
+ *
+ * Returns 0 on success or error on failure
+ */
int q6asm_enable_sbrps(struct audio_client *ac,
uint32_t sbr_ps_enable)
{
@@ -4528,7 +4821,18 @@
fail_cmd:
return rc;
}
+EXPORT_SYMBOL(q6asm_enable_sbrps);
+/**
+ * q6asm_cfg_dual_mono_aac -
+ * command to set config for dual mono aac
+ *
+ * @ac: Audio client handle
+ * @sce_left: left sce val
+ * @sce_right: right sce val
+ *
+ * Returns 0 on success or error on failure
+ */
int q6asm_cfg_dual_mono_aac(struct audio_client *ac,
uint16_t sce_left, uint16_t sce_right)
{
@@ -4577,6 +4881,7 @@
fail_cmd:
return rc;
}
+EXPORT_SYMBOL(q6asm_cfg_dual_mono_aac);
/* Support for selecting stereo mixing coefficients for B family not done */
int q6asm_cfg_aac_sel_mix_coef(struct audio_client *ac, uint32_t mix_coeff)
@@ -4622,7 +4927,21 @@
fail_cmd:
return rc;
}
+EXPORT_SYMBOL(q6asm_cfg_aac_sel_mix_coef);
+/**
+ * q6asm_enc_cfg_blk_qcelp -
+ * command to set encode config block for QCELP
+ *
+ * @ac: Audio client handle
+ * @frames_per_buf: Number of frames per buffer
+ * @min_rate: Minimum Enc rate
+ * @max_rate: Maximum Enc rate
+ * reduced_rate_level: Reduced rate level
+ * @rate_modulation_cmd: rate modulation command
+ *
+ * Returns 0 on success or error on failure
+ */
int q6asm_enc_cfg_blk_qcelp(struct audio_client *ac, uint32_t frames_per_buf,
uint16_t min_rate, uint16_t max_rate,
uint16_t reduced_rate_level, uint16_t rate_modulation_cmd)
@@ -4677,7 +4996,20 @@
fail_cmd:
return rc;
}
+EXPORT_SYMBOL(q6asm_enc_cfg_blk_qcelp);
+/**
+ * q6asm_enc_cfg_blk_evrc -
+ * command to set encode config block for EVRC
+ *
+ * @ac: Audio client handle
+ * @frames_per_buf: Number of frames per buffer
+ * @min_rate: Minimum Enc rate
+ * @max_rate: Maximum Enc rate
+ * @rate_modulation_cmd: rate modulation command
+ *
+ * Returns 0 on success or error on failure
+ */
int q6asm_enc_cfg_blk_evrc(struct audio_client *ac, uint32_t frames_per_buf,
uint16_t min_rate, uint16_t max_rate,
uint16_t rate_modulation_cmd)
@@ -4730,7 +5062,19 @@
fail_cmd:
return rc;
}
+EXPORT_SYMBOL(q6asm_enc_cfg_blk_evrc);
+/**
+ * q6asm_enc_cfg_blk_amrnb -
+ * command to set encode config block for AMRNB
+ *
+ * @ac: Audio client handle
+ * @frames_per_buf: Number of frames per buffer
+ * @band_mode: Band mode used
+ * @dtx_enable: DTX en flag
+ *
+ * Returns 0 on success or error on failure
+ */
int q6asm_enc_cfg_blk_amrnb(struct audio_client *ac, uint32_t frames_per_buf,
uint16_t band_mode, uint16_t dtx_enable)
{
@@ -4779,7 +5123,19 @@
fail_cmd:
return rc;
}
+EXPORT_SYMBOL(q6asm_enc_cfg_blk_amrnb);
+/**
+ * q6asm_enc_cfg_blk_amrwb -
+ * command to set encode config block for AMRWB
+ *
+ * @ac: Audio client handle
+ * @frames_per_buf: Number of frames per buffer
+ * @band_mode: Band mode used
+ * @dtx_enable: DTX en flag
+ *
+ * Returns 0 on success or error on failure
+ */
int q6asm_enc_cfg_blk_amrwb(struct audio_client *ac, uint32_t frames_per_buf,
uint16_t band_mode, uint16_t dtx_enable)
{
@@ -4828,6 +5184,7 @@
fail_cmd:
return rc;
}
+EXPORT_SYMBOL(q6asm_enc_cfg_blk_amrwb);
static int __q6asm_media_format_block_pcm(struct audio_client *ac,
@@ -5075,6 +5432,16 @@
return rc;
}
+/**
+ * q6asm_media_format_block_pcm -
+ * command to set mediafmt block for PCM on ASM stream
+ *
+ * @ac: Audio client handle
+ * @rate: sample rate
+ * @channels: number of ASM channels
+ *
+ * Returns 0 on success or error on failure
+ */
int q6asm_media_format_block_pcm(struct audio_client *ac,
uint32_t rate, uint32_t channels)
{
@@ -5082,7 +5449,19 @@
channels, 16, ac->stream_id,
true, NULL);
}
+EXPORT_SYMBOL(q6asm_media_format_block_pcm);
+/**
+ * q6asm_media_format_block_pcm_format_support -
+ * command to set mediafmt block for PCM format support
+ *
+ * @ac: Audio client handle
+ * @rate: sample rate
+ * @channels: number of ASM channels
+ * @bits_per_sample: number of bits per sample
+ *
+ * Returns 0 on success or error on failure
+ */
int q6asm_media_format_block_pcm_format_support(struct audio_client *ac,
uint32_t rate, uint32_t channels,
uint16_t bits_per_sample)
@@ -5091,6 +5470,7 @@
channels, bits_per_sample, ac->stream_id,
true, NULL);
}
+EXPORT_SYMBOL(q6asm_media_format_block_pcm_format_support);
int q6asm_media_format_block_pcm_format_support_v2(struct audio_client *ac,
uint32_t rate, uint32_t channels,
@@ -5668,24 +6048,65 @@
return rc;
}
+/**
+ * q6asm_media_format_block_multi_aac -
+ * command to set mediafmt block for multi_aac on ASM stream
+ *
+ * @ac: Audio client handle
+ * @cfg: multi_aac config
+ *
+ * Returns 0 on success or error on failure
+ */
int q6asm_media_format_block_multi_aac(struct audio_client *ac,
struct asm_aac_cfg *cfg)
{
return __q6asm_media_format_block_multi_aac(ac, cfg, ac->stream_id);
}
+EXPORT_SYMBOL(q6asm_media_format_block_multi_aac);
+/**
+ * q6asm_media_format_block_aac -
+ * command to set mediafmt block for aac on ASM
+ *
+ * @ac: Audio client handle
+ * @cfg: aac config
+ *
+ * Returns 0 on success or error on failure
+ */
int q6asm_media_format_block_aac(struct audio_client *ac,
struct asm_aac_cfg *cfg)
{
return __q6asm_media_format_block_multi_aac(ac, cfg, ac->stream_id);
}
+EXPORT_SYMBOL(q6asm_media_format_block_aac);
+/**
+ * q6asm_stream_media_format_block_aac -
+ * command to set mediafmt block for aac on ASM stream
+ *
+ * @ac: Audio client handle
+ * @cfg: aac config
+ * @stream_id: stream ID info
+ *
+ * Returns 0 on success or error on failure
+ */
int q6asm_stream_media_format_block_aac(struct audio_client *ac,
struct asm_aac_cfg *cfg, int stream_id)
{
return __q6asm_media_format_block_multi_aac(ac, cfg, stream_id);
}
+EXPORT_SYMBOL(q6asm_stream_media_format_block_aac);
+/**
+ * q6asm_media_format_block_wma -
+ * command to set mediafmt block for wma on ASM stream
+ *
+ * @ac: Audio client handle
+ * @cfg: wma config
+ * @stream_id: stream ID info
+ *
+ * Returns 0 on success or error on failure
+ */
int q6asm_media_format_block_wma(struct audio_client *ac,
void *cfg, int stream_id)
{
@@ -5740,7 +6161,18 @@
fail_cmd:
return rc;
}
+EXPORT_SYMBOL(q6asm_media_format_block_wma);
+/**
+ * q6asm_media_format_block_wmapro -
+ * command to set mediafmt block for wmapro on ASM stream
+ *
+ * @ac: Audio client handle
+ * @cfg: wmapro config
+ * @stream_id: stream ID info
+ *
+ * Returns 0 on success or error on failure
+ */
int q6asm_media_format_block_wmapro(struct audio_client *ac,
void *cfg, int stream_id)
{
@@ -5800,7 +6232,18 @@
fail_cmd:
return rc;
}
+EXPORT_SYMBOL(q6asm_media_format_block_wmapro);
+/**
+ * q6asm_media_format_block_amrwbplus -
+ * command to set mediafmt block for amrwbplus on ASM stream
+ *
+ * @ac: Audio client handle
+ * @cfg: amrwbplus config
+ * @stream_id: stream ID info
+ *
+ * Returns 0 on success or error on failure
+ */
int q6asm_media_format_block_amrwbplus(struct audio_client *ac,
struct asm_amrwbplus_cfg *cfg)
{
@@ -5848,7 +6291,18 @@
fail_cmd:
return rc;
}
+EXPORT_SYMBOL(q6asm_media_format_block_amrwbplus);
+/**
+ * q6asm_stream_media_format_block_flac -
+ * command to set mediafmt block for flac on ASM stream
+ *
+ * @ac: Audio client handle
+ * @cfg: FLAC config
+ * @stream_id: stream ID info
+ *
+ * Returns 0 on success or error on failure
+ */
int q6asm_stream_media_format_block_flac(struct audio_client *ac,
struct asm_flac_cfg *cfg, int stream_id)
{
@@ -5901,7 +6355,18 @@
fail_cmd:
return rc;
}
+EXPORT_SYMBOL(q6asm_stream_media_format_block_flac);
+/**
+ * q6asm_media_format_block_alac -
+ * command to set mediafmt block for alac on ASM stream
+ *
+ * @ac: Audio client handle
+ * @cfg: ALAC config
+ * @stream_id: stream ID info
+ *
+ * Returns 0 on success or error on failure
+ */
int q6asm_media_format_block_alac(struct audio_client *ac,
struct asm_alac_cfg *cfg, int stream_id)
{
@@ -5957,6 +6422,7 @@
fail_cmd:
return rc;
}
+EXPORT_SYMBOL(q6asm_media_format_block_alac);
/*
* q6asm_media_format_block_g711 - sends g711 decoder configuration
@@ -6027,6 +6493,16 @@
}
EXPORT_SYMBOL(q6asm_media_format_block_g711);
+/**
+ * q6asm_stream_media_format_block_vorbis -
+ * command to set mediafmt block for vorbis on ASM stream
+ *
+ * @ac: Audio client handle
+ * @cfg: vorbis config
+ * @stream_id: stream ID info
+ *
+ * Returns 0 on success or error on failure
+ */
int q6asm_stream_media_format_block_vorbis(struct audio_client *ac,
struct asm_vorbis_cfg *cfg, int stream_id)
{
@@ -6071,7 +6547,18 @@
fail_cmd:
return rc;
}
+EXPORT_SYMBOL(q6asm_stream_media_format_block_vorbis);
+/**
+ * q6asm_media_format_block_ape -
+ * command to set mediafmt block for APE on ASM stream
+ *
+ * @ac: Audio client handle
+ * @cfg: APE config
+ * @stream_id: stream ID info
+ *
+ * Returns 0 on success or error on failure
+ */
int q6asm_media_format_block_ape(struct audio_client *ac,
struct asm_ape_cfg *cfg, int stream_id)
{
@@ -6125,6 +6612,7 @@
fail_cmd:
return rc;
}
+EXPORT_SYMBOL(q6asm_media_format_block_ape);
/*
* q6asm_media_format_block_dsd- Sends DSD Decoder
@@ -6186,6 +6674,16 @@
}
EXPORT_SYMBOL(q6asm_media_format_block_dsd);
+/**
+ * q6asm_stream_media_format_block_aptx_dec -
+ * command to set mediafmt block for APTX dec on ASM stream
+ *
+ * @ac: Audio client handle
+ * @srate: sample rate
+ * @stream_id: stream ID info
+ *
+ * Returns 0 on success or error on failure
+ */
int q6asm_stream_media_format_block_aptx_dec(struct audio_client *ac,
uint32_t srate, int stream_id)
{
@@ -6236,6 +6734,7 @@
fail_cmd:
return rc;
}
+EXPORT_SYMBOL(q6asm_stream_media_format_block_aptx_dec);
static int __q6asm_ds1_set_endp_params(struct audio_client *ac, int param_id,
int param_value, int stream_id)
@@ -6294,6 +6793,16 @@
return rc;
}
+/**
+ * q6asm_ds1_set_endp_params -
+ * command to set DS1 params for ASM
+ *
+ * @ac: Audio client handle
+ * @param_id: param id
+ * @param_value: value of param
+ *
+ * Returns 0 on success or error on failure
+ */
int q6asm_ds1_set_endp_params(struct audio_client *ac,
int param_id, int param_value)
{
@@ -6301,6 +6810,17 @@
ac->stream_id);
}
+/**
+ * q6asm_ds1_set_stream_endp_params -
+ * command to set DS1 params for ASM stream
+ *
+ * @ac: Audio client handle
+ * @param_id: param id
+ * @param_value: value of param
+ * @stream_id: stream ID info
+ *
+ * Returns 0 on success or error on failure
+ */
int q6asm_ds1_set_stream_endp_params(struct audio_client *ac,
int param_id, int param_value,
int stream_id)
@@ -6308,7 +6828,20 @@
return __q6asm_ds1_set_endp_params(ac, param_id, param_value,
stream_id);
}
+EXPORT_SYMBOL(q6asm_ds1_set_stream_endp_params);
+/**
+ * q6asm_memory_map -
+ * command to send memory map for ASM
+ *
+ * @ac: Audio client handle
+ * @buf_add: buffer address to map
+ * @dir: RX or TX session
+ * @bufsz: size of each buffer
+ * @bufcnt: buffer count
+ *
+ * Returns 0 on success or error on failure
+ */
int q6asm_memory_map(struct audio_client *ac, phys_addr_t buf_add, int dir,
uint32_t bufsz, uint32_t bufcnt)
{
@@ -6402,7 +6935,18 @@
kfree(mmap_region_cmd);
return rc;
}
+EXPORT_SYMBOL(q6asm_memory_map);
+/**
+ * q6asm_memory_unmap -
+ * command to send memory unmap for ASM
+ *
+ * @ac: Audio client handle
+ * @buf_add: buffer address to unmap
+ * @dir: RX or TX session
+ *
+ * Returns 0 on success or error on failure
+ */
int q6asm_memory_unmap(struct audio_client *ac, phys_addr_t buf_add, int dir)
{
struct avs_cmd_shared_mem_unmap_regions mem_unmap;
@@ -6487,8 +7031,20 @@
}
return rc;
}
+EXPORT_SYMBOL(q6asm_memory_unmap);
-
+/**
+ * q6asm_memory_map_regions -
+ * command to send memory map regions for ASM
+ *
+ * @ac: Audio client handle
+ * @dir: RX or TX session
+ * @bufsz: size of each buffer
+ * @bufcnt: buffer count
+ * @is_contiguous: alloc contiguous mem or not
+ *
+ * Returns 0 on success or error on failure
+ */
static int q6asm_memory_map_regions(struct audio_client *ac, int dir,
uint32_t bufsz, uint32_t bufcnt,
bool is_contiguous)
@@ -6628,7 +7184,17 @@
kfree(mmap_region_cmd);
return rc;
}
+EXPORT_SYMBOL(q6asm_memory_map_regions);
+/**
+ * q6asm_memory_unmap_regions -
+ * command to send memory unmap regions for ASM
+ *
+ * @ac: Audio client handle
+ * @dir: RX or TX session
+ *
+ * Returns 0 on success or error on failure
+ */
static int q6asm_memory_unmap_regions(struct audio_client *ac, int dir)
{
struct avs_cmd_shared_mem_unmap_regions mem_unmap;
@@ -6715,6 +7281,7 @@
}
return rc;
}
+EXPORT_SYMBOL(q6asm_memory_unmap_regions);
int q6asm_set_lrgain(struct audio_client *ac, int left_gain, int right_gain)
{
@@ -6886,7 +7453,17 @@
done:
return rc;
}
+EXPORT_SYMBOL(q6asm_set_multich_gain);
+/**
+ * q6asm_set_mute -
+ * command to set mute for ASM
+ *
+ * @ac: Audio client handle
+ * @muteflag: mute value
+ *
+ * Returns 0 on success or error on failure
+ */
int q6asm_set_mute(struct audio_client *ac, int muteflag)
{
struct asm_volume_ctrl_mute_config mute;
@@ -6948,6 +7525,7 @@
fail_cmd:
return rc;
}
+EXPORT_SYMBOL(q6asm_set_mute);
static int __q6asm_set_volume(struct audio_client *ac, int volume, int instance)
{
@@ -7023,16 +7601,35 @@
return rc;
}
+/**
+ * q6asm_set_volume -
+ * command to set volume for ASM
+ *
+ * @ac: Audio client handle
+ * @volume: volume level
+ *
+ * Returns 0 on success or error on failure
+ */
int q6asm_set_volume(struct audio_client *ac, int volume)
{
return __q6asm_set_volume(ac, volume, SOFT_VOLUME_INSTANCE_1);
}
+EXPORT_SYMBOL(q6asm_set_volume);
int q6asm_set_volume_v2(struct audio_client *ac, int volume, int instance)
{
return __q6asm_set_volume(ac, volume, instance);
}
+/**
+ * q6asm_set_aptx_dec_bt_addr -
+ * command to aptx decoder BT addr for ASM
+ *
+ * @ac: Audio client handle
+ * @cfg: APTX decoder bt addr config
+ *
+ * Returns 0 on success or error on failure
+ */
int q6asm_set_aptx_dec_bt_addr(struct audio_client *ac,
struct aptx_dec_bt_addr_cfg *cfg)
{
@@ -7095,7 +7692,17 @@
fail_cmd:
return rc;
}
+EXPORT_SYMBOL(q6asm_set_aptx_dec_bt_addr);
+/**
+ * q6asm_send_ion_fd -
+ * command to send ION memory map for ASM
+ *
+ * @ac: Audio client handle
+ * @fd: ION file desc
+ *
+ * Returns 0 on success or error on failure
+ */
int q6asm_send_ion_fd(struct audio_client *ac, int fd)
{
struct ion_client *client;
@@ -7181,7 +7788,18 @@
fail_cmd:
return ret;
}
+EXPORT_SYMBOL(q6asm_send_ion_fd);
+/**
+ * q6asm_send_rtic_event_ack -
+ * command to send RTIC event ack
+ *
+ * @ac: Audio client handle
+ * @param: params for event ack
+ * @params_length: length of params
+ *
+ * Returns 0 on success or error on failure
+ */
int q6asm_send_rtic_event_ack(struct audio_client *ac,
void *param, uint32_t params_length)
{
@@ -7245,7 +7863,17 @@
done:
return rc;
}
+EXPORT_SYMBOL(q6asm_send_rtic_event_ack);
+/**
+ * q6asm_set_softpause -
+ * command to set pause for ASM
+ *
+ * @ac: Audio client handle
+ * @pause_param: params for pause
+ *
+ * Returns 0 on success or error on failure
+ */
int q6asm_set_softpause(struct audio_client *ac,
struct asm_softpause_params *pause_param)
{
@@ -7313,6 +7941,7 @@
fail_cmd:
return rc;
}
+EXPORT_SYMBOL(q6asm_set_softpause);
static int __q6asm_set_softvolume(struct audio_client *ac,
struct asm_softvolume_params *softvol_param,
@@ -7392,20 +8021,50 @@
return rc;
}
+/**
+ * q6asm_set_softvolume -
+ * command to set softvolume for ASM
+ *
+ * @ac: Audio client handle
+ * @softvol_param: params for softvol
+ *
+ * Returns 0 on success or error on failure
+ */
int q6asm_set_softvolume(struct audio_client *ac,
struct asm_softvolume_params *softvol_param)
{
return __q6asm_set_softvolume(ac, softvol_param,
SOFT_VOLUME_INSTANCE_1);
}
+EXPORT_SYMBOL(q6asm_set_softvolume);
+/**
+ * q6asm_set_softvolume_v2 -
+ * command to set softvolume V2 for ASM
+ *
+ * @ac: Audio client handle
+ * @softvol_param: params for softvol
+ * @instance: instance to apply softvol
+ *
+ * Returns 0 on success or error on failure
+ */
int q6asm_set_softvolume_v2(struct audio_client *ac,
struct asm_softvolume_params *softvol_param,
int instance)
{
return __q6asm_set_softvolume(ac, softvol_param, instance);
}
+EXPORT_SYMBOL(q6asm_set_softvolume_v2);
+/**
+ * q6asm_equalizer -
+ * command to set equalizer for ASM
+ *
+ * @ac: Audio client handle
+ * @eq_p: Equalizer params
+ *
+ * Returns 0 on success or error on failure
+ */
int q6asm_equalizer(struct audio_client *ac, void *eq_p)
{
struct asm_eq_params eq;
@@ -7498,6 +8157,7 @@
fail_cmd:
return rc;
}
+EXPORT_SYMBOL(q6asm_equalizer);
static int __q6asm_read(struct audio_client *ac, bool is_custom_len_reqd,
int len)
@@ -7580,15 +8240,45 @@
return -EINVAL;
}
+/**
+ * q6asm_read -
+ * command to read buffer data from DSP
+ *
+ * @ac: Audio client handle
+ *
+ * Returns 0 on success or error on failure
+ */
int q6asm_read(struct audio_client *ac)
{
return __q6asm_read(ac, false/*is_custom_len_reqd*/, 0);
}
+EXPORT_SYMBOL(q6asm_read);
+
+
+/**
+ * q6asm_read_v2 -
+ * command to read buffer data from DSP
+ *
+ * @ac: Audio client handle
+ * @len: buffer size to read
+ *
+ * Returns 0 on success or error on failure
+ */
int q6asm_read_v2(struct audio_client *ac, uint32_t len)
{
return __q6asm_read(ac, true /*is_custom_len_reqd*/, len);
}
+EXPORT_SYMBOL(q6asm_read_v2);
+/**
+ * q6asm_read_nolock -
+ * command to read buffer data from DSP
+ * with no wait for ack.
+ *
+ * @ac: Audio client handle
+ *
+ * Returns 0 on success or error on failure
+ */
int q6asm_read_nolock(struct audio_client *ac)
{
struct asm_data_cmd_read_v2 read;
@@ -7662,7 +8352,17 @@
fail_cmd:
return -EINVAL;
}
+EXPORT_SYMBOL(q6asm_read_nolock);
+/**
+ * q6asm_async_write -
+ * command to write DSP buffer
+ *
+ * @ac: Audio client handle
+ * @param: params for async write
+ *
+ * Returns 0 on success or error on failure
+ */
int q6asm_async_write(struct audio_client *ac,
struct audio_aio_write_param *param)
{
@@ -7747,7 +8447,17 @@
fail_cmd:
return -EINVAL;
}
+EXPORT_SYMBOL(q6asm_async_write);
+/**
+ * q6asm_async_read -
+ * command to read DSP buffer
+ *
+ * @ac: Audio client handle
+ * @param: params for async read
+ *
+ * Returns 0 on success or error on failure
+ */
int q6asm_async_read(struct audio_client *ac,
struct audio_aio_read_param *param)
{
@@ -7815,7 +8525,20 @@
fail_cmd:
return -EINVAL;
}
+EXPORT_SYMBOL(q6asm_async_read);
+/**
+ * q6asm_write -
+ * command to write buffer data to DSP
+ *
+ * @ac: Audio client handle
+ * @len: buffer size
+ * @msw_ts: upper 32bits of timestamp
+ * @lsw_ts: lower 32bits of timestamp
+ * @flags: Flags for timestamp mode
+ *
+ * Returns 0 on success or error on failure
+ */
int q6asm_write(struct audio_client *ac, uint32_t len, uint32_t msw_ts,
uint32_t lsw_ts, uint32_t flags)
{
@@ -7895,7 +8618,21 @@
fail_cmd:
return -EINVAL;
}
+EXPORT_SYMBOL(q6asm_write);
+/**
+ * q6asm_write_nolock -
+ * command to write buffer data to DSP
+ * with no wait for ack.
+ *
+ * @ac: Audio client handle
+ * @len: buffer size
+ * @msw_ts: upper 32bits of timestamp
+ * @lsw_ts: lower 32bits of timestamp
+ * @flags: Flags for timestamp mode
+ *
+ * Returns 0 on success or error on failure
+ */
int q6asm_write_nolock(struct audio_client *ac, uint32_t len, uint32_t msw_ts,
uint32_t lsw_ts, uint32_t flags)
{
@@ -7972,7 +8709,17 @@
fail_cmd:
return -EINVAL;
}
+EXPORT_SYMBOL(q6asm_write_nolock);
+/**
+ * q6asm_get_session_time -
+ * command to retrieve timestamp info
+ *
+ * @ac: Audio client handle
+ * @tstamp: pointer to fill with timestamp info
+ *
+ * Returns 0 on success or error on failure
+ */
int q6asm_get_session_time(struct audio_client *ac, uint64_t *tstamp)
{
struct asm_mtmx_strtr_get_params mtmx_params;
@@ -8029,7 +8776,17 @@
fail_cmd:
return -EINVAL;
}
+EXPORT_SYMBOL(q6asm_get_session_time);
+/**
+ * q6asm_get_session_time_legacy -
+ * command to retrieve timestamp info
+ *
+ * @ac: Audio client handle
+ * @tstamp: pointer to fill with timestamp info
+ *
+ * Returns 0 on success or error on failure
+ */
int q6asm_get_session_time_legacy(struct audio_client *ac, uint64_t *tstamp)
{
struct apr_hdr hdr;
@@ -8075,8 +8832,18 @@
fail_cmd:
return -EINVAL;
}
+EXPORT_SYMBOL(q6asm_get_session_time_legacy);
-
+/**
+ * q6asm_send_audio_effects_params -
+ * command to send audio effects params
+ *
+ * @ac: Audio client handle
+ * @params: audio effects params
+ * @params_length: size of params
+ *
+ * Returns 0 on success or error on failure
+ */
int q6asm_send_audio_effects_params(struct audio_client *ac, char *params,
uint32_t params_length)
{
@@ -8148,7 +8915,18 @@
kfree(asm_params);
return rc;
}
+EXPORT_SYMBOL(q6asm_send_audio_effects_params);
+/**
+ * q6asm_send_mtmx_strtr_window -
+ * command to send matrix for window params
+ *
+ * @ac: Audio client handle
+ * @window_param: window params
+ * @param_id: param id for window
+ *
+ * Returns 0 on success or error on failure
+ */
int q6asm_send_mtmx_strtr_window(struct audio_client *ac,
struct asm_session_mtmx_strtr_param_window_v2_t *window_param,
uint32_t param_id)
@@ -8222,7 +9000,17 @@
fail_cmd:
return rc;
}
+EXPORT_SYMBOL(q6asm_send_mtmx_strtr_window);
+/**
+ * q6asm_send_mtmx_strtr_render_mode -
+ * command to send matrix for render mode
+ *
+ * @ac: Audio client handle
+ * @render_mode: rendering mode
+ *
+ * Returns 0 on success or error on failure
+ */
int q6asm_send_mtmx_strtr_render_mode(struct audio_client *ac,
uint32_t render_mode)
{
@@ -8307,7 +9095,17 @@
exit:
return rc;
}
+EXPORT_SYMBOL(q6asm_send_mtmx_strtr_render_mode);
+/**
+ * q6asm_send_mtmx_strtr_clk_rec_mode -
+ * command to send matrix for clock rec
+ *
+ * @ac: Audio client handle
+ * @clk_rec_mode: mode for clock rec
+ *
+ * Returns 0 on success or error on failure
+ */
int q6asm_send_mtmx_strtr_clk_rec_mode(struct audio_client *ac,
uint32_t clk_rec_mode)
{
@@ -8392,7 +9190,17 @@
exit:
return rc;
}
+EXPORT_SYMBOL(q6asm_send_mtmx_strtr_clk_rec_mode);
+/**
+ * q6asm_send_mtmx_strtr_enable_adjust_session_clock -
+ * command to send matrix for adjust time
+ *
+ * @ac: Audio client handle
+ * @enable: flag to adjust time or not
+ *
+ * Returns 0 on success or error on failure
+ */
int q6asm_send_mtmx_strtr_enable_adjust_session_clock(struct audio_client *ac,
bool enable)
{
@@ -8465,6 +9273,7 @@
exit:
return rc;
}
+EXPORT_SYMBOL(q6asm_send_mtmx_strtr_enable_adjust_session_clock);
static int __q6asm_cmd(struct audio_client *ac, int cmd, uint32_t stream_id)
@@ -8588,16 +9397,50 @@
return rc;
}
+/**
+ * q6asm_cmd -
+ * Function used to send commands for
+ * ASM with wait for ack.
+ *
+ * @ac: Audio client handle
+ * @cmd: command to send
+ *
+ * Returns 0 on success or error on failure
+ */
int q6asm_cmd(struct audio_client *ac, int cmd)
{
return __q6asm_cmd(ac, cmd, ac->stream_id);
}
+EXPORT_SYMBOL(q6asm_cmd);
+/**
+ * q6asm_stream_cmd -
+ * Function used to send commands for
+ * ASM stream with wait for ack.
+ *
+ * @ac: Audio client handle
+ * @cmd: command to send
+ * @stream_id: Stream ID
+ *
+ * Returns 0 on success or error on failure
+ */
int q6asm_stream_cmd(struct audio_client *ac, int cmd, uint32_t stream_id)
{
return __q6asm_cmd(ac, cmd, stream_id);
}
+EXPORT_SYMBOL(q6asm_stream_cmd);
+/**
+ * q6asm_cmd_nowait -
+ * Function used to send commands for
+ * ASM stream without wait for ack.
+ *
+ * @ac: Audio client handle
+ * @cmd: command to send
+ * @stream_id: Stream ID
+ *
+ * Returns 0 on success or error on failure
+ */
static int __q6asm_cmd_nowait(struct audio_client *ac, int cmd,
uint32_t stream_id)
{
@@ -8666,13 +9509,26 @@
pr_debug("%s: stream_id: %d\n", __func__, ac->stream_id);
return __q6asm_cmd_nowait(ac, cmd, ac->stream_id);
}
+EXPORT_SYMBOL(q6asm_cmd_nowait);
+/**
+ * q6asm_stream_cmd_nowait -
+ * Function used to send commands for
+ * ASM stream without wait for ack.
+ *
+ * @ac: Audio client handle
+ * @cmd: command to send
+ * @stream_id: Stream ID
+ *
+ * Returns 0 on success or error on failure
+ */
int q6asm_stream_cmd_nowait(struct audio_client *ac, int cmd,
uint32_t stream_id)
{
pr_debug("%s: stream_id: %d\n", __func__, stream_id);
return __q6asm_cmd_nowait(ac, cmd, stream_id);
}
+EXPORT_SYMBOL(q6asm_stream_cmd_nowait);
int __q6asm_send_meta_data(struct audio_client *ac, uint32_t stream_id,
uint32_t initial_samples, uint32_t trailing_samples)
@@ -8732,12 +9588,24 @@
return -EINVAL;
}
+/**
+ * q6asm_stream_send_meta_data -
+ * command to send meta data for stream
+ *
+ * @ac: Audio client handle
+ * @stream_id: Stream ID
+ * @initial_samples: Initial samples of stream
+ * @trailing_samples: Trailing samples of stream
+ *
+ * Returns 0 on success or error on failure
+ */
int q6asm_stream_send_meta_data(struct audio_client *ac, uint32_t stream_id,
uint32_t initial_samples, uint32_t trailing_samples)
{
return __q6asm_send_meta_data(ac, stream_id, initial_samples,
trailing_samples);
}
+EXPORT_SYMBOL(q6asm_stream_send_meta_data);
int q6asm_send_meta_data(struct audio_client *ac, uint32_t initial_samples,
uint32_t trailing_samples)
@@ -8772,6 +9640,15 @@
}
}
+/**
+ * q6asm_reg_tx_overflow -
+ * command to register for TX overflow events
+ *
+ * @ac: Audio client handle
+ * @enable: flag to enable or disable events
+ *
+ * Returns 0 on success or error on failure
+ */
int q6asm_reg_tx_overflow(struct audio_client *ac, uint16_t enable)
{
struct asm_session_cmd_regx_overflow tx_overflow;
@@ -8822,6 +9699,7 @@
fail_cmd:
return rc;
}
+EXPORT_SYMBOL(q6asm_reg_tx_overflow);
int q6asm_reg_rx_underflow(struct audio_client *ac, uint16_t enable)
{
@@ -8856,6 +9734,16 @@
return -EINVAL;
}
+/**
+ * q6asm_adjust_session_clock -
+ * command to adjust session clock
+ *
+ * @ac: Audio client handle
+ * @adjust_time_lsw: lower 32bits
+ * @adjust_time_msw: upper 32bits
+ *
+ * Returns 0 on success or error on failure
+ */
int q6asm_adjust_session_clock(struct audio_client *ac,
uint32_t adjust_time_lsw,
uint32_t adjust_time_msw)
@@ -8917,6 +9805,7 @@
fail_cmd:
return rc;
}
+EXPORT_SYMBOL(q6asm_adjust_session_clock);
/*
* q6asm_get_path_delay() - get the path delay for an audio session
@@ -8966,6 +9855,7 @@
return 0;
}
+EXPORT_SYMBOL(q6asm_get_path_delay);
int q6asm_get_apr_service_id(int session_id)
{
@@ -9062,6 +9952,14 @@
return app_type;
}
+/**
+ * q6asm_send_cal -
+ * command to send ASM calibration
+ *
+ * @ac: Audio client handle
+ *
+ * Returns 0 on success or error on failure
+ */
int q6asm_send_cal(struct audio_client *ac)
{
struct cal_block_data *cal_block = NULL;
@@ -9176,6 +10074,7 @@
done:
return rc;
}
+EXPORT_SYMBOL(q6asm_send_cal);
static int get_cal_type_index(int32_t cal_type)
{
@@ -9350,7 +10249,7 @@
return 0;
}
-static int __init q6asm_init(void)
+int __init q6asm_init(void)
{
int lcnt, ret;
@@ -9387,10 +10286,7 @@
return 0;
}
-static void __exit q6asm_exit(void)
+void __exit q6asm_exit(void)
{
q6asm_delete_cal_data();
}
-
-device_initcall(q6asm_init);
-__exitcall(q6asm_exit);
diff --git a/dsp/q6audio-v2.c b/dsp/q6audio-v2.c
index 6e31c36..55e7244 100644
--- a/dsp/q6audio-v2.c
+++ b/dsp/q6audio-v2.c
@@ -650,6 +650,14 @@
return ret;
}
+/**
+ * q6audio_validate_port -
+ * validates port id
+ *
+ * @port_id: port id to validate
+ *
+ * Returns 0 on success or error on invalid port
+ */
int q6audio_validate_port(u16 port_id)
{
int ret;
@@ -805,3 +813,4 @@
return ret;
}
+EXPORT_SYMBOL(q6audio_validate_port);
diff --git a/dsp/q6core.c b/dsp/q6core.c
index 9f1d9e4..b807862 100644
--- a/dsp/q6core.c
+++ b/dsp/q6core.c
@@ -454,6 +454,15 @@
}
EXPORT_SYMBOL(q6core_get_fwk_version_size);
+/**
+ * core_set_license -
+ * command to set license for module
+ *
+ * @key: license key hash
+ * @module_id: DSP Module ID
+ *
+ * Returns 0 on success or error on failure
+ */
int32_t core_set_license(uint32_t key, uint32_t module_id)
{
struct avcs_cmd_set_license *cmd_setl = NULL;
@@ -528,7 +537,16 @@
return rc;
}
+EXPORT_SYMBOL(core_set_license);
+/**
+ * core_get_license_status -
+ * command to retrieve license status for module
+ *
+ * @module_id: DSP Module ID
+ *
+ * Returns 0 on success or error on failure
+ */
int32_t core_get_license_status(uint32_t module_id)
{
struct avcs_cmd_get_license_validation_result get_lvr_cmd;
@@ -586,7 +604,16 @@
__func__, ret, module_id);
return ret;
}
+EXPORT_SYMBOL(core_get_license_status);
+/**
+ * core_set_dolby_manufacturer_id -
+ * command to set dolby manufacturer id
+ *
+ * @manufacturer_id: Dolby manufacturer id
+ *
+ * Returns 0 on success or error on failure
+ */
uint32_t core_set_dolby_manufacturer_id(int manufacturer_id)
{
struct adsp_dolby_manufacturer_id payload;
@@ -617,6 +644,7 @@
mutex_unlock(&(q6core_lcl.cmd_lock));
return rc;
}
+EXPORT_SYMBOL(core_set_dolby_manufacturer_id);
/**
* q6core_is_adsp_ready - check adsp ready status
@@ -1062,7 +1090,7 @@
return ret;
}
-static int __init core_init(void)
+int __init core_init(void)
{
memset(&q6core_lcl, 0, sizeof(struct q6core_str));
init_waitqueue_head(&q6core_lcl.bus_bw_req_wait);
@@ -1076,14 +1104,12 @@
return 0;
}
-module_init(core_init);
-static void __exit core_exit(void)
+void __exit core_exit(void)
{
mutex_destroy(&q6core_lcl.cmd_lock);
mutex_destroy(&q6core_lcl.ver_lock);
q6core_delete_cal_data();
}
-module_exit(core_exit);
MODULE_DESCRIPTION("ADSP core driver");
MODULE_LICENSE("GPL v2");
diff --git a/dsp/q6lsm.c b/dsp/q6lsm.c
index 848f2cd..e34bff9 100644
--- a/dsp/q6lsm.c
+++ b/dsp/q6lsm.c
@@ -293,6 +293,15 @@
return 0;
}
+/**
+ * q6lsm_client_alloc -
+ * Allocate session for LSM client
+ *
+ * @cb: callback fn
+ * @priv: private data
+ *
+ * Returns LSM client handle on success or NULL on failure
+ */
struct lsm_client *q6lsm_client_alloc(lsm_app_cb cb, void *priv)
{
struct lsm_client *client;
@@ -341,7 +350,15 @@
q6lsm_client_free(client);
return NULL;
}
+EXPORT_SYMBOL(q6lsm_client_alloc);
+/**
+ * q6lsm_client_free -
+ * Performs LSM client free
+ *
+ * @client: LSM client handle
+ *
+ */
void q6lsm_client_free(struct lsm_client *client)
{
if (!client)
@@ -358,6 +375,7 @@
kfree(client);
client = NULL;
}
+EXPORT_SYMBOL(q6lsm_client_free);
/*
* q6lsm_apr_send_pkt : If wait == true, hold mutex to prevent from preempting
@@ -593,6 +611,15 @@
}
+/**
+ * q6lsm_sm_set_param_data -
+ * Update sound model param data
+ *
+ * @client: LSM client handle
+ * @p_info: param info
+ * @offset: pointer to retrieve size
+ *
+ */
void q6lsm_sm_set_param_data(struct lsm_client *client,
struct lsm_params_info *p_info,
size_t *offset)
@@ -606,7 +633,17 @@
param->p_size.param_size = client->sound_model.size;
*offset = sizeof(*param);
}
+EXPORT_SYMBOL(q6lsm_sm_set_param_data);
+/**
+ * q6lsm_open -
+ * command to open LSM session
+ *
+ * @client: LSM client handle
+ * @app_id: App ID for LSM
+ *
+ * Returns 0 on success or error on failure
+ */
int q6lsm_open(struct lsm_client *client, uint16_t app_id)
{
int rc = 0;
@@ -654,6 +691,7 @@
pr_debug("%s: leave %d\n", __func__, rc);
return rc;
}
+EXPORT_SYMBOL(q6lsm_open);
static int q6lsm_send_confidence_levels(
struct lsm_client *client,
@@ -760,16 +798,30 @@
return rc;
}
+/**
+ * set_lsm_port -
+ * Update LSM AFE port
+ *
+ */
void set_lsm_port(int lsm_port)
{
lsm_afe_port = lsm_port;
}
+EXPORT_SYMBOL(set_lsm_port);
int get_lsm_port(void)
{
return lsm_afe_port;
}
+/**
+ * q6lsm_set_port_connected -
+ * command to set LSM port connected
+ *
+ * @client: LSM client handle
+ *
+ * Returns 0 on success or error on failure
+ */
int q6lsm_set_port_connected(struct lsm_client *client)
{
int rc;
@@ -819,6 +871,8 @@
return rc;
}
+EXPORT_SYMBOL(q6lsm_set_port_connected);
+
static int q6lsm_send_param_polling_enable(struct lsm_client *client,
bool poll_en,
struct lsm_module_param_ids *poll_enable_ids,
@@ -859,6 +913,15 @@
return rc;
}
+/**
+ * q6lsm_set_fwk_mode_cfg -
+ * command to set LSM fwk mode cfg
+ *
+ * @client: LSM client handle
+ * @event_mode: mode for fwk cfg
+ *
+ * Returns 0 on success or error on failure
+ */
int q6lsm_set_fwk_mode_cfg(struct lsm_client *client,
uint32_t event_mode)
{
@@ -906,6 +969,7 @@
__func__, msg_hdr->opcode, rc);
return rc;
}
+EXPORT_SYMBOL(q6lsm_set_fwk_mode_cfg);
static int q6lsm_arrange_mch_map(struct lsm_param_media_fmt *media_fmt,
int channel_count)
@@ -941,6 +1005,14 @@
return rc;
}
+/**
+ * q6lsm_set_media_fmt_params -
+ * command to set LSM media fmt params
+ *
+ * @client: LSM client handle
+ *
+ * Returns 0 on success or error on failure
+ */
int q6lsm_set_media_fmt_params(struct lsm_client *client)
{
int rc = 0;
@@ -998,7 +1070,18 @@
err_ret:
return rc;
}
+EXPORT_SYMBOL(q6lsm_set_media_fmt_params);
+/**
+ * q6lsm_set_data -
+ * Command to set LSM data
+ *
+ * @client: LSM client handle
+ * @mode: LSM detection mode value
+ * @detectfailure: flag for detect failure
+ *
+ * Returns 0 on success or error on failure
+ */
int q6lsm_set_data(struct lsm_client *client,
enum lsm_detection_mode mode,
bool detectfailure)
@@ -1061,7 +1144,16 @@
err_ret:
return rc;
}
+EXPORT_SYMBOL(q6lsm_set_data);
+/**
+ * q6lsm_register_sound_model -
+ * Register LSM snd model
+ *
+ * @client: LSM client handle
+ *
+ * Returns 0 on success or error on failure
+ */
int q6lsm_register_sound_model(struct lsm_client *client,
enum lsm_detection_mode mode,
bool detectfailure)
@@ -1098,7 +1190,16 @@
return rc;
}
+EXPORT_SYMBOL(q6lsm_register_sound_model);
+/**
+ * q6lsm_deregister_sound_model -
+ * De-register LSM snd model
+ *
+ * @client: LSM client handle
+ *
+ * Returns 0 on success or error on failure
+ */
int q6lsm_deregister_sound_model(struct lsm_client *client)
{
int rc;
@@ -1134,6 +1235,7 @@
return rc;
}
+EXPORT_SYMBOL(q6lsm_deregister_sound_model);
static void q6lsm_add_mmaphdr(struct lsm_client *client, struct apr_hdr *hdr,
u32 pkt_size, u32 cmd_flg, u32 token)
@@ -1285,7 +1387,14 @@
return rc;
}
-
+/**
+ * q6lsm_snd_model_buf_free -
+ * Free memory for LSM snd model
+ *
+ * @client: LSM client handle
+ *
+ * Returns 0 on success or error on failure
+ */
int q6lsm_snd_model_buf_free(struct lsm_client *client)
{
int rc;
@@ -1316,6 +1425,7 @@
mutex_unlock(&client->cmd_lock);
return rc;
}
+EXPORT_SYMBOL(q6lsm_snd_model_buf_free);
static struct lsm_client *q6lsm_get_lsm_client(int session_id)
{
@@ -1420,6 +1530,16 @@
return 0;
}
+/**
+ * q6lsm_snd_model_buf_alloc -
+ * Allocate memory for LSM snd model
+ *
+ * @client: LSM client handle
+ * @len: size of sound model
+ * @allocate_module_data: flag to allocate for set_param payload
+ *
+ * Returns 0 on success or error on failure
+ */
int q6lsm_snd_model_buf_alloc(struct lsm_client *client, size_t len,
bool allocate_module_data)
{
@@ -1523,6 +1643,7 @@
q6lsm_snd_model_buf_free(client);
return rc;
}
+EXPORT_SYMBOL(q6lsm_snd_model_buf_alloc);
static int q6lsm_cmd(struct lsm_client *client, int opcode, bool wait)
{
@@ -1613,6 +1734,17 @@
return rc;
}
+/**
+ * q6lsm_set_one_param -
+ * command for LSM set params
+ *
+ * @client: LSM client handle
+ * p_info: Params info
+ * data: payload based on param type
+ * param_type: LSM param type
+ *
+ * Returns 0 on success or error on failure
+ */
int q6lsm_set_one_param(struct lsm_client *client,
struct lsm_params_info *p_info, void *data,
uint32_t param_type)
@@ -1798,23 +1930,60 @@
return rc;
}
+EXPORT_SYMBOL(q6lsm_set_one_param);
+/**
+ * q6lsm_start -
+ * command for LSM start
+ *
+ * @client: LSM client handle
+ *
+ * Returns 0 on success or error on failure
+ */
int q6lsm_start(struct lsm_client *client, bool wait)
{
return q6lsm_cmd(client, LSM_SESSION_CMD_START, wait);
}
+EXPORT_SYMBOL(q6lsm_start);
+/**
+ * q6lsm_stop -
+ * command for LSM stop
+ *
+ * @client: LSM client handle
+ *
+ * Returns 0 on success or error on failure
+ */
int q6lsm_stop(struct lsm_client *client, bool wait)
{
return q6lsm_cmd(client, LSM_SESSION_CMD_STOP, wait);
}
+EXPORT_SYMBOL(q6lsm_stop);
+/**
+ * q6lsm_close -
+ * command for LSM close
+ *
+ * @client: LSM client handle
+ *
+ * Returns 0 on success or error on failure
+ */
int q6lsm_close(struct lsm_client *client)
{
return q6lsm_cmd(client, LSM_SESSION_CMD_CLOSE_TX, true);
}
+EXPORT_SYMBOL(q6lsm_close);
+/**
+ * q6lsm_lab_control -
+ * command to set LSM LAB control params
+ *
+ * @client: LSM client handle
+ * @enable: bool flag to enable or disable LAB on DSP
+ *
+ * Returns 0 on success or error on failure
+ */
int q6lsm_lab_control(struct lsm_client *client, u32 enable)
{
int rc = 0;
@@ -1876,7 +2045,16 @@
exit:
return rc;
}
+EXPORT_SYMBOL(q6lsm_lab_control);
+/**
+ * q6lsm_stop_lab -
+ * command to stop LSM LAB
+ *
+ * @client: LSM client handle
+ *
+ * Returns 0 on success or error on failure
+ */
int q6lsm_stop_lab(struct lsm_client *client)
{
int rc = 0;
@@ -1890,7 +2068,17 @@
pr_err("%s: Lab stop failed %d\n", __func__, rc);
return rc;
}
+EXPORT_SYMBOL(q6lsm_stop_lab);
+/**
+ * q6lsm_read -
+ * command for LSM read
+ *
+ * @client: LSM client handle
+ * @lsm_cmd_read: LSM read command
+ *
+ * Returns 0 on success or error on failure
+ */
int q6lsm_read(struct lsm_client *client, struct lsm_cmd_read *read)
{
int rc = 0;
@@ -1910,7 +2098,17 @@
pr_err("%s: read buffer call failed rc %d\n", __func__, rc);
return rc;
}
+EXPORT_SYMBOL(q6lsm_read);
+/**
+ * q6lsm_lab_buffer_alloc -
+ * Lab buffer allocation or de-alloc
+ *
+ * @client: LSM client handle
+ * @alloc: Allocate or free ion memory
+ *
+ * Returns 0 on success or error on failure
+ */
int q6lsm_lab_buffer_alloc(struct lsm_client *client, bool alloc)
{
int ret = 0, i = 0;
@@ -2000,6 +2198,7 @@
}
return ret;
}
+EXPORT_SYMBOL(q6lsm_lab_buffer_alloc);
static int get_cal_type_index(int32_t cal_type)
{
@@ -2155,7 +2354,7 @@
return ret;
}
-static int __init q6lsm_init(void)
+int __init q6lsm_init(void)
{
int i = 0;
@@ -2177,10 +2376,7 @@
return 0;
}
-static void __exit q6lsm_exit(void)
+void __exit q6lsm_exit(void)
{
lsm_delete_cal_data();
}
-
-device_initcall(q6lsm_init);
-__exitcall(q6lsm_exit);
diff --git a/dsp/q6usm.c b/dsp/q6usm.c
index 5b822ae..1ed74a9 100644
--- a/dsp/q6usm.c
+++ b/dsp/q6usm.c
@@ -1455,12 +1455,10 @@
return rc;
}
-static int __init q6usm_init(void)
+int __init q6usm_init(void)
{
pr_debug("%s\n", __func__);
init_waitqueue_head(&this_mmap.cmd_wait);
memset(session, 0, sizeof(session));
return 0;
}
-
-device_initcall(q6usm_init);
diff --git a/dsp/q6usm.h b/dsp/q6usm.h
index 2e9d7c9..fa2cd62 100644
--- a/dsp/q6usm.h
+++ b/dsp/q6usm.h
@@ -126,5 +126,6 @@
uint32_t module_id, uint32_t param_id, uint32_t buf_size);
int q6usm_get_us_stream_param(int dir, struct us_client *usc,
uint32_t module_id, uint32_t param_id, uint32_t buf_size);
+int q6usm_init(void);
#endif /* __Q6_USM_H__ */
diff --git a/dsp/q6voice.c b/dsp/q6voice.c
index 983e0a2..985e959 100644
--- a/dsp/q6voice.c
+++ b/dsp/q6voice.c
@@ -292,6 +292,14 @@
return session_name;
}
+/**
+ * voc_get_session_id -
+ * Get session ID of given voice session name
+ *
+ * @name: voice session name
+ *
+ * Returns session id for valid session or 0 if invalid.
+ */
uint32_t voc_get_session_id(char *name)
{
u32 session_id = 0;
@@ -326,6 +334,7 @@
return session_id;
}
+EXPORT_SYMBOL(voc_get_session_id);
static struct voice_data *voice_get_session(u32 session_id)
{
@@ -1802,6 +1811,11 @@
return ret;
}
+/**
+ * voc_disable_dtmf_det_on_active_sessions -
+ * command to disable DTMF detection for voice sessions
+ *
+ */
void voc_disable_dtmf_det_on_active_sessions(void)
{
struct voice_data *v = NULL;
@@ -1818,7 +1832,17 @@
}
}
}
+EXPORT_SYMBOL(voc_disable_dtmf_det_on_active_sessions);
+/**
+ * voc_enable_dtmf_rx_detection -
+ * command to set DTMF RX detection
+ *
+ * @session_id: voice session ID to send this command
+ * @enable: Enable or Disable detection
+ *
+ * Returns 0 on success or error on failure
+ */
int voc_enable_dtmf_rx_detection(uint32_t session_id, uint32_t enable)
{
struct voice_data *v = voice_get_session(session_id);
@@ -1840,13 +1864,29 @@
return ret;
}
+EXPORT_SYMBOL(voc_enable_dtmf_rx_detection);
+/**
+ * voc_set_destroy_cvd_flag -
+ * set flag for destroy CVD session
+ *
+ * @is_destroy_cvd: bool value used to indicate
+ * destroy CVD session or not.
+ *
+ */
void voc_set_destroy_cvd_flag(bool is_destroy_cvd)
{
pr_debug("%s: %d\n", __func__, is_destroy_cvd);
common.is_destroy_cvd = is_destroy_cvd;
}
+EXPORT_SYMBOL(voc_set_destroy_cvd_flag);
+/**
+ * voc_alloc_cal_shared_memory -
+ * Alloc mem map table for calibration
+ *
+ * Returns 0 on success or error on failure
+ */
int voc_alloc_cal_shared_memory(void)
{
int rc = 0;
@@ -1867,7 +1907,14 @@
return rc;
}
+EXPORT_SYMBOL(voc_alloc_cal_shared_memory);
+/**
+ * voc_alloc_voip_shared_memory -
+ * Alloc mem map table for OOB
+ *
+ * Returns 0 on success or error on failure
+ */
int voc_alloc_voip_shared_memory(void)
{
int rc = 0;
@@ -1890,6 +1937,7 @@
return rc;
}
+EXPORT_SYMBOL(voc_alloc_voip_shared_memory);
static int is_cal_memory_allocated(void)
{
@@ -2218,6 +2266,14 @@
return ret;
}
+/**
+ * voc_update_amr_vocoder_rate -
+ * command to update AMR rate for voice session
+ *
+ * @session_id: voice session ID to send this command
+ *
+ * Returns 0 on success or error on failure
+ */
int voc_update_amr_vocoder_rate(uint32_t session_id)
{
int ret = 0;
@@ -2242,6 +2298,7 @@
done:
return ret;
}
+EXPORT_SYMBOL(voc_update_amr_vocoder_rate);
static int voice_send_start_voice_cmd(struct voice_data *v)
{
@@ -5640,6 +5697,16 @@
return ret;
}
+/**
+ * voc_start_record -
+ * command to set record for voice session
+ *
+ * @port_id: Pseudo Port ID for record data
+ * @set: Enable or Disable for record start/stop
+ * @session_id: voice session ID to send this command
+ *
+ * Returns 0 on success or error on failure
+ */
int voc_start_record(uint32_t port_id, uint32_t set, uint32_t session_id)
{
int ret = 0;
@@ -5774,6 +5841,7 @@
return ret;
}
+EXPORT_SYMBOL(voc_start_record);
static int voice_cvs_start_playback(struct voice_data *v)
{
@@ -5962,6 +6030,15 @@
return ret;
}
+/**
+ * voc_start_playback -
+ * command to set playback for voice session
+ *
+ * @set: Enable or Disable for playback start/stop
+ * @port_id: Pseudo Port ID for playback data
+ *
+ * Returns 0 on success or error on failure
+ */
int voc_start_playback(uint32_t set, uint16_t port_id)
{
struct voice_data *v = NULL;
@@ -6004,7 +6081,17 @@
return ret;
}
+EXPORT_SYMBOL(voc_start_playback);
+/**
+ * voc_disable_topology -
+ * disable topology for voice session
+ *
+ * @session_id: voice session ID to send this command
+ * @disable: disable value
+ *
+ * Returns 0 on success or error on failure
+ */
int voc_disable_topology(uint32_t session_id, uint32_t disable)
{
struct voice_data *v = voice_get_session(session_id);
@@ -6024,6 +6111,7 @@
return ret;
}
+EXPORT_SYMBOL(voc_disable_topology);
static int voice_set_packet_exchange_mode_and_config(uint32_t session_id,
uint32_t mode)
@@ -6057,6 +6145,17 @@
return -EINVAL;
}
+/**
+ * voc_set_tx_mute -
+ * command to send TX mute for voice session
+ *
+ * @session_id: voice session ID to send this command
+ * @dir: RX or TX
+ * @mute: TX mute value
+ * @ramp_duration: Ramp duration in ms
+ *
+ * Returns 0 on success or error on failure
+ */
int voc_set_tx_mute(uint32_t session_id, uint32_t dir, uint32_t mute,
uint32_t ramp_duration)
{
@@ -6089,7 +6188,19 @@
return ret;
}
+EXPORT_SYMBOL(voc_set_tx_mute);
+/**
+ * voc_set_device_mute -
+ * command to set device mute for voice session
+ *
+ * @session_id: voice session ID to send this command
+ * @dir: RX or TX
+ * @mute: mute value
+ * @ramp_duration: Ramp duration in ms
+ *
+ * Returns 0 on success or error on failure
+ */
int voc_set_device_mute(uint32_t session_id, uint32_t dir, uint32_t mute,
uint32_t ramp_duration)
{
@@ -6130,6 +6241,7 @@
return ret;
}
+EXPORT_SYMBOL(voc_set_device_mute);
int voc_get_rx_device_mute(uint32_t session_id)
{
@@ -6151,6 +6263,15 @@
return ret;
}
+/**
+ * voc_set_tty_mode -
+ * Update tty mode for voice session
+ *
+ * @session_id: voice session ID
+ * @tty_mode: TTY mode value
+ *
+ * Returns 0 on success or error on failure
+ */
int voc_set_tty_mode(uint32_t session_id, uint8_t tty_mode)
{
struct voice_data *v = voice_get_session(session_id);
@@ -6170,7 +6291,16 @@
return ret;
}
+EXPORT_SYMBOL(voc_set_tty_mode);
+/**
+ * voc_get_tty_mode -
+ * Retrieve tty mode for voice session
+ *
+ * @session_id: voice session ID
+ *
+ * Returns 0 on success or error on failure
+ */
uint8_t voc_get_tty_mode(uint32_t session_id)
{
struct voice_data *v = voice_get_session(session_id);
@@ -6190,7 +6320,18 @@
return ret;
}
+EXPORT_SYMBOL(voc_get_tty_mode);
+/**
+ * voc_set_pp_enable -
+ * Command to set PP for voice module
+ *
+ * @session_id: voice session ID to send this command
+ * @module_id: voice module id
+ * @enable: enable/disable flag
+ *
+ * Returns 0 on success or error on failure
+ */
int voc_set_pp_enable(uint32_t session_id, uint32_t module_id, uint32_t enable)
{
struct voice_data *v = NULL;
@@ -6225,7 +6366,17 @@
return ret;
}
+EXPORT_SYMBOL(voc_set_pp_enable);
+/**
+ * voc_set_hd_enable -
+ * Command to set HD for voice session
+ *
+ * @session_id: voice session ID to send this command
+ * @enable: enable/disable flag
+ *
+ * Returns 0 on success or error on failure
+ */
int voc_set_hd_enable(uint32_t session_id, uint32_t enable)
{
struct voice_data *v = NULL;
@@ -6252,7 +6403,17 @@
return ret;
}
+EXPORT_SYMBOL(voc_set_hd_enable);
+/**
+ * voc_set_afe_sidetone -
+ * Command to set sidetone at AFE
+ *
+ * @session_id: voice session ID to send this command
+ * @sidetone_enable: enable/disable flag for sidetone
+ *
+ * Returns 0 on success or error on failure
+ */
int voc_set_afe_sidetone(uint32_t session_id, bool sidetone_enable)
{
struct voice_data *v = NULL;
@@ -6286,7 +6447,14 @@
}
return ret;
}
+EXPORT_SYMBOL(voc_set_afe_sidetone);
+/**
+ * voc_get_afe_sidetone -
+ * Retrieve sidetone status at AFE
+ *
+ * Returns sidetone enable status
+ */
bool voc_get_afe_sidetone(void)
{
bool ret;
@@ -6294,6 +6462,7 @@
ret = common.sidetone_enable;
return ret;
}
+EXPORT_SYMBOL(voc_get_afe_sidetone);
int voc_get_pp_enable(uint32_t session_id, uint32_t module_id)
{
@@ -6314,6 +6483,17 @@
return ret;
}
+/**
+ * voc_set_rx_vol_step -
+ * command to send voice RX volume in step value
+ *
+ * @session_id: voice session ID
+ * @dir: direction RX or TX
+ * @vol_step: Volume step value
+ * @ramp_duration: Ramp duration in ms
+ *
+ * Returns 0 on success or -EINVAL on failure
+ */
int voc_set_rx_vol_step(uint32_t session_id, uint32_t dir, uint32_t vol_step,
uint32_t ramp_duration)
{
@@ -6344,7 +6524,18 @@
return ret;
}
+EXPORT_SYMBOL(voc_set_rx_vol_step);
+/**
+ * voc_set_device_config -
+ * Set voice path config for RX or TX
+ *
+ * @session_id: voice session ID
+ * @path_dir: direction RX or TX
+ * @finfo: format config info
+ *
+ * Returns 0 on success or -EINVAL on failure
+ */
int voc_set_device_config(uint32_t session_id, uint8_t path_dir,
struct media_format_info *finfo)
{
@@ -6387,7 +6578,15 @@
return 0;
}
+EXPORT_SYMBOL(voc_set_device_config);
+/**
+ * voc_set_ext_ec_ref_media_fmt_info -
+ * Update voice EC media format info
+ *
+ * @finfo: media format info
+ *
+ */
int voc_set_ext_ec_ref_media_fmt_info(struct media_format_info *finfo)
{
mutex_lock(&common.common_lock);
@@ -6404,7 +6603,18 @@
mutex_unlock(&common.common_lock);
return 0;
}
+EXPORT_SYMBOL(voc_set_ext_ec_ref_media_fmt_info);
+/**
+ * voc_set_route_flag -
+ * Set voice route state for RX or TX
+ *
+ * @session_id: voice session ID
+ * @path_dir: direction RX or TX
+ * @set: Value of route state to set
+ *
+ * Returns 0 on success or -EINVAL on failure
+ */
int voc_set_route_flag(uint32_t session_id, uint8_t path_dir, uint8_t set)
{
struct voice_data *v = voice_get_session(session_id);
@@ -6428,7 +6638,17 @@
return 0;
}
+EXPORT_SYMBOL(voc_set_route_flag);
+/**
+ * voc_get_route_flag -
+ * Retrieve voice route state for RX or TX
+ *
+ * @session_id: voice session ID
+ * @path_dir: direction RX or TX
+ *
+ * Returns route state on success or 0 on failure
+ */
uint8_t voc_get_route_flag(uint32_t session_id, uint8_t path_dir)
{
struct voice_data *v = voice_get_session(session_id);
@@ -6451,7 +6671,16 @@
return ret;
}
+EXPORT_SYMBOL(voc_get_route_flag);
+/**
+ * voc_end_voice_call -
+ * command to end voice call
+ *
+ * @session_id: voice session ID to send this command
+ *
+ * Returns 0 on success or error on failure
+ */
int voc_end_voice_call(uint32_t session_id)
{
struct voice_data *v = voice_get_session(session_id);
@@ -6488,7 +6717,16 @@
mutex_unlock(&v->lock);
return ret;
}
+EXPORT_SYMBOL(voc_end_voice_call);
+/**
+ * voc_standby_voice_call -
+ * command to standy voice call
+ *
+ * @session_id: voice session ID to send this command
+ *
+ * Returns 0 on success or error on failure
+ */
int voc_standby_voice_call(uint32_t session_id)
{
struct voice_data *v = voice_get_session(session_id);
@@ -6537,7 +6775,16 @@
fail:
return ret;
}
+EXPORT_SYMBOL(voc_standby_voice_call);
+/**
+ * voc_disable_device -
+ * command to pause call and disable voice path
+ *
+ * @session_id: voice session ID to send this command
+ *
+ * Returns 0 on success or error on failure
+ */
int voc_disable_device(uint32_t session_id)
{
struct voice_data *v = voice_get_session(session_id);
@@ -6574,7 +6821,16 @@
return ret;
}
+EXPORT_SYMBOL(voc_disable_device);
+/**
+ * voc_enable_device -
+ * command to enable voice path and start call
+ *
+ * @session_id: voice session ID to send this command
+ *
+ * Returns 0 on success or error on failure
+ */
int voc_enable_device(uint32_t session_id)
{
struct voice_data *v = voice_get_session(session_id);
@@ -6662,7 +6918,17 @@
return ret;
}
+EXPORT_SYMBOL(voc_enable_device);
+/**
+ * voc_set_lch -
+ * command to set hold/unhold call state
+ *
+ * @session_id: voice session ID to send this command
+ * @lch_mode: LCH mode to set
+ *
+ * Returns 0 on success or error on failure
+ */
int voc_set_lch(uint32_t session_id, enum voice_lch_mode lch_mode)
{
struct voice_data *v = voice_get_session(session_id);
@@ -6696,7 +6962,16 @@
done:
return ret;
}
+EXPORT_SYMBOL(voc_set_lch);
+/**
+ * voc_resume_voice_call -
+ * command to resume voice call
+ *
+ * @session_id: voice session ID to send this command
+ *
+ * Returns 0 on success or error on failure
+ */
int voc_resume_voice_call(uint32_t session_id)
{
struct voice_data *v = voice_get_session(session_id);
@@ -6712,7 +6987,16 @@
fail:
return -EINVAL;
}
+EXPORT_SYMBOL(voc_resume_voice_call);
+/**
+ * voc_start_voice_call -
+ * command to start voice call
+ *
+ * @session_id: voice session ID to send this command
+ *
+ * Returns 0 on success or error on failure
+ */
int voc_start_voice_call(uint32_t session_id)
{
struct voice_data *v = voice_get_session(session_id);
@@ -6819,7 +7103,14 @@
mutex_unlock(&v->lock);
return ret;
}
+EXPORT_SYMBOL(voc_start_voice_call);
+/**
+ * voc_set_ext_ec_ref_port_id -
+ * Set EC ref port id
+ *
+ * Returns 0 on success or -EINVAL on failure
+ */
int voc_set_ext_ec_ref_port_id(uint16_t port_id, bool state)
{
int ret = 0;
@@ -6841,7 +7132,15 @@
mutex_unlock(&common.common_lock);
return ret;
}
+EXPORT_SYMBOL(voc_set_ext_ec_ref_port_id);
+/**
+ * voc_get_ext_ec_ref_port_id -
+ * Retrieve EC ref port id
+ *
+ * Returns EC Ref port id if present
+ * otherwise AFE_PORT_INVALID
+ */
int voc_get_ext_ec_ref_port_id(void)
{
if (common.ec_ref_ext)
@@ -6849,7 +7148,18 @@
else
return AFE_PORT_INVALID;
}
+EXPORT_SYMBOL(voc_get_ext_ec_ref_port_id);
+/**
+ * voc_register_mvs_cb -
+ * Update callback info for mvs
+ *
+ * @ul_cb: Uplink callback fn
+ * @dl_cb: downlink callback fn
+ * ssr_cb: SSR callback fn
+ * @private_data: private data of mvs
+ *
+ */
void voc_register_mvs_cb(ul_cb_fn ul_cb,
dl_cb_fn dl_cb,
voip_ssr_cb ssr_cb,
@@ -6860,14 +7170,28 @@
common.mvs_info.ssr_cb = ssr_cb;
common.mvs_info.private_data = private_data;
}
+EXPORT_SYMBOL(voc_register_mvs_cb);
+/**
+ * voc_register_dtmf_rx_detection_cb -
+ * Update callback info for dtmf
+ *
+ * @dtmf_rx_ul_cb: DTMF uplink RX callback fn
+ * @private_data: private data of dtmf info
+ *
+ */
void voc_register_dtmf_rx_detection_cb(dtmf_rx_det_cb_fn dtmf_rx_ul_cb,
void *private_data)
{
common.dtmf_info.dtmf_rx_ul_cb = dtmf_rx_ul_cb;
common.dtmf_info.private_data = private_data;
}
+EXPORT_SYMBOL(voc_register_dtmf_rx_detection_cb);
+/**
+ * voc_config_vocoder -
+ * Update config for mvs params.
+ */
void voc_config_vocoder(uint32_t media_type,
uint32_t rate,
uint32_t network_type,
@@ -6882,6 +7206,7 @@
common.mvs_info.evrc_min_rate = evrc_min_rate;
common.mvs_info.evrc_max_rate = evrc_max_rate;
}
+EXPORT_SYMBOL(voc_config_vocoder);
static int32_t qdsp_mvm_callback(struct apr_client_data *data, void *priv)
{
@@ -7753,6 +8078,14 @@
return rc;
}
+/**
+ * voc_send_cvp_start_vocpcm -
+ * command to start voice hpcm
+ *
+ * @session_id: voice session ID to send this command
+ *
+ * Returns 0 on success or error on failure
+ */
int voc_send_cvp_start_vocpcm(uint32_t session_id,
struct vss_ivpcm_tap_point *vpcm_tp,
uint32_t no_of_tp)
@@ -7831,7 +8164,16 @@
done:
return ret;
}
+EXPORT_SYMBOL(voc_send_cvp_start_vocpcm);
+/**
+ * voc_send_cvp_stop_vocpcm -
+ * command to stop voice hpcm
+ *
+ * @session_id: voice session ID to send this command
+ *
+ * Returns 0 on success or error on failure
+ */
int voc_send_cvp_stop_vocpcm(uint32_t session_id)
{
struct cvp_command vpcm_stop_cmd;
@@ -7892,7 +8234,19 @@
done:
return ret;
}
+EXPORT_SYMBOL(voc_send_cvp_stop_vocpcm);
+/**
+ * voc_send_cvp_map_vocpcm_memory -
+ * command to map memory for voice hpcm
+ *
+ * @session_id: voice session ID to send this command
+ * @tp_mem_table: tap point memory table of hpcm
+ * paddr: Physical address of hpcm memory mapped area.
+ * bufsize: Buffer size of memory mapped area
+ *
+ * Returns 0 on success or error on failure
+ */
int voc_send_cvp_map_vocpcm_memory(uint32_t session_id,
struct mem_map_table *tp_mem_table,
phys_addr_t paddr, uint32_t bufsize)
@@ -7902,7 +8256,16 @@
(dma_addr_t) paddr, bufsize,
VOC_VOICE_HOST_PCM_MAP_TOKEN);
}
+EXPORT_SYMBOL(voc_send_cvp_map_vocpcm_memory);
+/**
+ * voc_send_cvp_unmap_vocpcm_memory -
+ * command to unmap memory for voice hpcm
+ *
+ * @session_id: voice session ID to send this command
+ *
+ * Returns 0 on success or error on failure
+ */
int voc_send_cvp_unmap_vocpcm_memory(uint32_t session_id)
{
int ret = 0;
@@ -7916,7 +8279,16 @@
return ret;
}
+EXPORT_SYMBOL(voc_send_cvp_unmap_vocpcm_memory);
+/**
+ * voc_send_cvp_vocpcm_push_buf_evt - Send buf event command
+ *
+ * @session_id: voice session ID to send this command
+ * @push_buff_evt: pointer with buffer event details
+ *
+ * Returns 0 on success or error on failure
+ */
int voc_send_cvp_vocpcm_push_buf_evt(uint32_t session_id,
struct vss_ivpcm_evt_push_buffer_v2_t *push_buff_evt)
{
@@ -7979,20 +8351,41 @@
done:
return ret;
}
+EXPORT_SYMBOL(voc_send_cvp_vocpcm_push_buf_evt);
+/**
+ * voc_register_hpcm_evt_cb - Updates hostpcm info.
+ *
+ * @hostpcm_cb: callback function for hostpcm event
+ * @private_data: private data for hostpcm
+ *
+ */
void voc_register_hpcm_evt_cb(hostpcm_cb_fn hostpcm_cb,
void *private_data)
{
common.hostpcm_info.hostpcm_evt_cb = hostpcm_cb;
common.hostpcm_info.private_data = private_data;
}
+EXPORT_SYMBOL(voc_register_hpcm_evt_cb);
+/**
+ * voc_deregister_hpcm_evt_cb - resets hostpcm info.
+ *
+ */
void voc_deregister_hpcm_evt_cb(void)
{
common.hostpcm_info.hostpcm_evt_cb = NULL;
common.hostpcm_info.private_data = NULL;
}
+EXPORT_SYMBOL(voc_deregister_hpcm_evt_cb);
+/**
+ * voc_get_cvd_version - retrieve CVD version.
+ *
+ * @cvd_version: pointer to be updated with CVD version info.
+ *
+ * Returns 0 on success or error on failure
+ */
int voc_get_cvd_version(char *cvd_version)
{
int ret = 0;
@@ -8041,6 +8434,7 @@
return ret;
}
+EXPORT_SYMBOL(voc_get_cvd_version);
static int voice_alloc_cal_mem_map_table(void)
{
@@ -8598,6 +8992,13 @@
return ret;
}
+/**
+ * voc_set_sound_focus - sends sound focus data.
+ *
+ * @soundFocusData: sound focus data.
+ *
+ * Returns 0 on success or error on failure
+ */
int voc_set_sound_focus(struct sound_focus_param soundFocusData)
{
struct voice_data *v = NULL;
@@ -8629,6 +9030,7 @@
return ret;
}
+EXPORT_SYMBOL(voc_set_sound_focus);
static int voice_send_get_sound_focus_cmd(struct voice_data *v,
struct sound_focus_param *soundFocusData)
@@ -8727,6 +9129,13 @@
return ret;
}
+/**
+ * voc_get_sound_focus - retrieves sound focus data.
+ *
+ * @soundFocusData: pointer to be updated with sound focus data.
+ *
+ * Returns 0 on success or error on failure
+ */
int voc_get_sound_focus(struct sound_focus_param *soundFocusData)
{
struct voice_data *v = NULL;
@@ -8758,6 +9167,7 @@
return ret;
}
+EXPORT_SYMBOL(voc_get_sound_focus);
static int is_source_tracking_shared_memomry_allocated(void)
{
@@ -9045,6 +9455,13 @@
return ret;
}
+/**
+ * voc_get_source_tracking - retrieves source track data.
+ *
+ * @sourceTrackingData: pointer to be updated with source track data.
+ *
+ * Returns 0 on success or error on failure
+ */
int voc_get_source_tracking(struct source_tracking_param *sourceTrackingData)
{
struct voice_data *v = NULL;
@@ -9077,13 +9494,21 @@
return ret;
}
+EXPORT_SYMBOL(voc_get_source_tracking);
+/**
+ * is_voc_initialized:
+ *
+ * Returns voice module init status
+ *
+ */
int is_voc_initialized(void)
{
return module_initialized;
}
+EXPORT_SYMBOL(is_voc_initialized);
-static int __init voice_init(void)
+int __init voice_init(void)
{
int rc = 0, i = 0;
@@ -9180,12 +9605,9 @@
return rc;
}
-device_initcall(voice_init);
-static void __exit voice_exit(void)
+void __exit voice_exit(void)
{
voice_delete_cal_data();
free_cal_map_table();
}
-
-__exitcall(voice_exit);
diff --git a/dsp/rtac.c b/dsp/rtac.c
index 84ef835..806bbc5 100644
--- a/dsp/rtac.c
+++ b/dsp/rtac.c
@@ -1875,7 +1875,7 @@
.fops = &rtac_fops,
};
-static int __init rtac_init(void)
+int __init rtac_init(void)
{
int i = 0;
@@ -1949,7 +1949,13 @@
return -ENOMEM;
}
-module_init(rtac_init);
+void __exit rtac_exit(void)
+{
+ kzfree(rtac_adm_buffer);
+ kzfree(rtac_asm_buffer);
+ kzfree(rtac_afe_buffer);
+ misc_deregister(&rtac_misc);
+}
MODULE_DESCRIPTION("SoC QDSP6v2 Real-Time Audio Calibration driver");
MODULE_LICENSE("GPL v2");
diff --git a/dsp/usf.c b/dsp/usf.c
index f75439d..263ba1f 100644
--- a/dsp/usf.c
+++ b/dsp/usf.c
@@ -27,6 +27,7 @@
#include "q6usm.h"
#include "usf.h"
#include "usfcdev.h"
+#include "q6_init.h"
/* The driver version*/
#define DRV_VERSION "1.7.1"
@@ -2455,10 +2456,19 @@
break;
}
}
+ if (!rc) q6usm_init();
return rc;
}
+module_init(usf_init);
-device_initcall(usf_init);
+static void __exit usf_exit(void)
+{
+ uint16_t ind = 0;
+ for (ind = 0; ind < MAX_DEVS_NUMBER; ++ind)
+ misc_deregister(&usf_misc[ind]);
+}
+module_exit(usf_exit);
MODULE_DESCRIPTION("Ultrasound framework driver");
+MODULE_LICENSE("GPL v2");
diff --git a/dsp/usfcdev.c b/dsp/usfcdev.c
index 6b8aae0..2896166 100644
--- a/dsp/usfcdev.c
+++ b/dsp/usfcdev.c
@@ -217,7 +217,7 @@
uint16_t ind = (uint16_t)handle->handler->minor;
bool rc = (s_usfcdev_events[ind].event_status != USFCDEV_EVENT_ENABLED);
- if (s_usf_pid == sys_getpid()) {
+ if (s_usf_pid == current->pid) {
/* Pass events from usfcdev driver */
rc = false;
pr_debug("%s: event_type=%d; type=%d; code=%d; val=%d",
@@ -395,7 +395,7 @@
if (filter) {
s_usfcdev_events[event_type_ind].event_status =
USFCDEV_EVENT_DISABLING;
- s_usf_pid = sys_getpid();
+ s_usf_pid = current->pid;
usfcdev_clean_dev(event_type_ind);
s_usfcdev_events[event_type_ind].event_status =
USFCDEV_EVENT_DISABLED;
@@ -411,12 +411,3 @@
return rc;
}
-
-static int __init usfcdev_init(void)
-{
- return 0;
-}
-
-device_initcall(usfcdev_init);
-
-MODULE_DESCRIPTION("Handle of events from devices, conflicting with USF");