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>
This commit is contained in:
Laxminath Kasam
2017-10-05 01:44:16 +05:30
parent 97c9da7a1e
commit 8b1366a648
115 changed files with 5347 additions and 353 deletions

22
Android.mk Normal file
View File

@@ -0,0 +1,22 @@
# Android makefile for audio kernel modules
MY_LOCAL_PATH := $(call my-dir)
UAPI_OUT := $(OUT)/obj/vendor/qcom/opensource/audio-kernel/include
ifeq ($(call is-board-platform-in-list,sdm845 sdm670),true)
$(shell mkdir -p $(UAPI_OUT)/linux;)
$(shell mkdir -p $(UAPI_OUT)/sound;)
include $(MY_LOCAL_PATH)/ipc/Android.mk
include $(MY_LOCAL_PATH)/dsp/Android.mk
include $(MY_LOCAL_PATH)/dsp/codecs/Android.mk
include $(MY_LOCAL_PATH)/soc/Android.mk
include $(MY_LOCAL_PATH)/asoc/Android.mk
include $(MY_LOCAL_PATH)/asoc/codecs/Android.mk
include $(MY_LOCAL_PATH)/asoc/codecs/wcd934x/Android.mk
endif
ifeq ($(call is-board-platform,sdm670),true)
include $(MY_LOCAL_PATH)/asoc/codecs/sdm660_cdc/Android.mk
include $(MY_LOCAL_PATH)/asoc/codecs/msm_sdw/Android.mk
endif

73
asoc/Android.mk Normal file
View File

@@ -0,0 +1,73 @@
# 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)
TARGET := sdm845
AUDIO_SELECT := CONFIG_SND_SOC_SDM845=m
endif
ifeq ($(call is-board-platform,sdm670),true)
TARGET := sdm670
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=platform_dlkm
KBUILD_OPTIONS += BOARD_PLATFORM=$(TARGET_BOARD_PLATFORM)
KBUILD_OPTIONS += $(AUDIO_SELECT)
###########################################################
include $(CLEAR_VARS)
LOCAL_MODULE := $(AUDIO_CHIPSET)_platform.ko
LOCAL_MODULE_KBUILD_NAME := platform_dlkm.ko
LOCAL_MODULE_TAGS := optional
LOCAL_MODULE_DEBUG_ENABLE := true
LOCAL_MODULE_PATH := $(KERNEL_MODULES_OUT)
include $(DLKM_DIR)/AndroidKernelModule.mk
###########################################################
ifeq ($(call is-board-platform,sdm670),true)
include $(CLEAR_VARS)
LOCAL_MODULE := $(AUDIO_CHIPSET)_cpe_lsm.ko
LOCAL_MODULE_KBUILD_NAME := cpe_lsm_dlkm.ko
LOCAL_MODULE_TAGS := optional
LOCAL_MODULE_DEBUG_ENABLE := true
LOCAL_MODULE_PATH := $(KERNEL_MODULES_OUT)
include $(DLKM_DIR)/AndroidKernelModule.mk
endif
###########################################################
include $(CLEAR_VARS)
LOCAL_MODULE := $(AUDIO_CHIPSET)_machine_$(TARGET).ko
LOCAL_MODULE_KBUILD_NAME := machine_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

161
asoc/Kbuild Normal file
View File

@@ -0,0 +1,161 @@
# 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)
############ ASoC Drivers ############
# for SDM6xx sound card driver
ifeq ($(CONFIG_SND_SOC_SDM670), m)
MACHINE_OBJS += sdm660-common.o
endif
# for SDM6xx sound card driver
ifeq ($(CONFIG_SND_SOC_INT_CODEC), m)
MACHINE_OBJS += sdm660-internal.o
endif
# for SDM6xx sound card driver
ifeq ($(CONFIG_SND_SOC_EXT_CODEC), m)
MACHINE_OBJS += sdm660-external.o
MACHINE_OBJS += sdm660-ext-dai-links.o
endif
# for SDM845 sound card driver
ifeq ($(CONFIG_SND_SOC_MACHINE_SDM845), m)
MACHINE_OBJS += sdm845.o
endif
ifeq ($(CONFIG_SND_SOC_CPE), m)
CPE_LSM_OBJS += msm-cpe-lsm.o
endif
ifeq ($(CONFIG_SND_SOC_QDSP6V2), m)
PLATFORM_OBJS += msm-audio-effects-q6-v2.o
PLATFORM_OBJS += msm-compress-q6-v2.o
PLATFORM_OBJS += msm-dai-fe.o
PLATFORM_OBJS += msm-dai-q6-hdmi-v2.o
PLATFORM_OBJS += msm-dai-q6-v2.o
PLATFORM_OBJS += msm-dai-slim.o
PLATFORM_OBJS += msm-dai-stub-v2.o
PLATFORM_OBJS += msm-ds2-dap-config.o
PLATFORM_OBJS += msm-lsm-client.o
PLATFORM_OBJS += msm-pcm-afe-v2.o
PLATFORM_OBJS += msm-pcm-dtmf-v2.o
PLATFORM_OBJS += msm-pcm-hostless.o
PLATFORM_OBJS += msm-pcm-host-voice-v2.o
PLATFORM_OBJS += msm-pcm-loopback-v2.o
PLATFORM_OBJS += msm-pcm-q6-noirq.o
PLATFORM_OBJS += msm-pcm-q6-v2.o
PLATFORM_OBJS += msm-pcm-routing-devdep.o
PLATFORM_OBJS += msm-pcm-routing-v2.o
PLATFORM_OBJS += msm-pcm-voice-v2.o
PLATFORM_OBJS += msm-pcm-voip-v2.o
PLATFORM_OBJS += msm-qti-pp-config.o
PLATFORM_OBJS += msm-transcode-loopback-q6-v2.o
PLATFORM_OBJS += platform_init.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/codecs/Module.symvers
KBUILD_EXTRA_SYMBOLS +=$(OUT)/obj/vendor/qcom/opensource/audio-kernel/asoc/codecs/wcd934x/Module.symvers
KBUILD_EXTRA_SYMBOLS +=$(OUT)/obj/vendor/qcom/opensource/audio-kernel/asoc/codecs/sdm660_cdc/Module.symvers
KBUILD_EXTRA_SYMBOLS +=$(OUT)/obj/vendor/qcom/opensource/audio-kernel/asoc/codecs/msm_sdw/Module.symvers
# Module information used by KBuild framework
obj-$(CONFIG_SND_SOC_QDSP6V2) += platform_dlkm.o
platform_dlkm-y := $(PLATFORM_OBJS)
obj-$(CONFIG_SND_SOC_MACHINE_SDM845) += machine_dlkm.o
machine_dlkm-y := $(MACHINE_OBJS)
obj-$(CONFIG_SND_SOC_EXT_CODEC) += machine_dlkm.o
machine_dlkm-y := $(MACHINE_OBJS)
obj-$(CONFIG_SND_SOC_INT_CODEC) += machine_dlkm.o
machine_dlkm-y := $(MACHINE_OBJS)
obj-$(CONFIG_SND_SOC_CPE) += cpe_lsm_dlkm.o
cpe_lsm_dlkm-y := $(CPE_LSM_OBJS)
# inject some build related information
DEFINES += -DBUILD_TIMESTAMP=\"$(shell date -u +'%Y-%m-%dT%H:%M:%SZ')\"

121
asoc/codecs/Android.mk Normal file
View File

@@ -0,0 +1,121 @@
# 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=wcd_core_dlkm
KBUILD_OPTIONS += BOARD_PLATFORM=$(TARGET_BOARD_PLATFORM)
KBUILD_OPTIONS += $(AUDIO_SELECT)
###########################################################
include $(CLEAR_VARS)
LOCAL_MODULE := $(AUDIO_CHIPSET)_wcd_core.ko
LOCAL_MODULE_KBUILD_NAME := wcd_core_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)_wcd9xxx.ko
LOCAL_MODULE_KBUILD_NAME := wcd9xxx_dlkm.ko
LOCAL_MODULE_TAGS := optional
LOCAL_MODULE_DEBUG_ENABLE := true
LOCAL_MODULE_PATH := $(KERNEL_MODULES_OUT)
include $(DLKM_DIR)/AndroidKernelModule.mk
###########################################################
ifeq ($(call is-board-platform,sdm670),true)
include $(CLEAR_VARS)
LOCAL_MODULE := $(AUDIO_CHIPSET)_wcd_cpe.ko
LOCAL_MODULE_KBUILD_NAME := wcd_cpe_dlkm.ko
LOCAL_MODULE_TAGS := optional
LOCAL_MODULE_DEBUG_ENABLE := true
LOCAL_MODULE_PATH := $(KERNEL_MODULES_OUT)
include $(DLKM_DIR)/AndroidKernelModule.mk
endif
###########################################################
include $(CLEAR_VARS)
LOCAL_MODULE := $(AUDIO_CHIPSET)_wcd_spi.ko
LOCAL_MODULE_KBUILD_NAME := wcd_spi_dlkm.ko
LOCAL_MODULE_TAGS := optional
LOCAL_MODULE_DEBUG_ENABLE := true
LOCAL_MODULE_PATH := $(KERNEL_MODULES_OUT)
include $(DLKM_DIR)/AndroidKernelModule.mk
###########################################################
ifeq ($(call is-board-platform,sdm670),true)
include $(CLEAR_VARS)
LOCAL_MODULE := $(AUDIO_CHIPSET)_wcd9335.ko
LOCAL_MODULE_KBUILD_NAME := wcd9335_dlkm.ko
LOCAL_MODULE_TAGS := optional
LOCAL_MODULE_DEBUG_ENABLE := true
LOCAL_MODULE_PATH := $(KERNEL_MODULES_OUT)
include $(DLKM_DIR)/AndroidKernelModule.mk
endif
###########################################################
include $(CLEAR_VARS)
LOCAL_MODULE := $(AUDIO_CHIPSET)_wsa881x.ko
LOCAL_MODULE_KBUILD_NAME := wsa881x_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)_stub.ko
LOCAL_MODULE_KBUILD_NAME := stub_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)_mbhc.ko
LOCAL_MODULE_KBUILD_NAME := mbhc_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)_hdmi.ko
LOCAL_MODULE_KBUILD_NAME := hdmi_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

181
asoc/codecs/Kbuild Normal file
View File

@@ -0,0 +1,181 @@
# 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)
############ ASoC Codecs ############
ifeq ($(CONFIG_WCD9XXX_CODEC_CORE), m)
CORE_OBJS += wcd9xxx-rst.o
CORE_OBJS += wcd9xxx-core-init.o
CORE_OBJS += wcd9xxx-core.o
CORE_OBJS += wcd9xxx-irq.o
CORE_OBJS += wcd9xxx-slimslave.o
CORE_OBJS += wcd9xxx-utils.o
CORE_OBJS += wcd9335-regmap.o
CORE_OBJS += wcd9335-tables.o
CORE_OBJS += msm-cdc-pinctrl.o
CORE_OBJS += msm-cdc-supply.o
CORE_OBJS += wcd934x/wcd934x-regmap.o
CORE_OBJS += wcd934x/wcd934x-tables.o
endif
ifeq ($(CONFIG_SND_SOC_WCD9XXX_V2), m)
WCD9XXX_OBJS += wcd9xxx-common-v2.o
WCD9XXX_OBJS += wcd9xxx-resmgr-v2.o
WCD9XXX_OBJS += wcdcal-hwdep.o
WCD9XXX_OBJS += wcd9xxx-soc-init.o
WCD9XXX_OBJS += wcd-dsp-utils.o
WCD9XXX_OBJS += wcd-dsp-mgr.o
WCD9XXX_OBJS += audio-ext-clk-up.o
endif
ifeq ($(CONFIG_SND_SOC_WCD9335), m)
WCD9335_OBJS += wcd9335.o
endif
ifeq ($(CONFIG_SND_SOC_WSA881X), m)
WSA881X_OBJS += wsa881x.o
WSA881X_OBJS += wsa881x-tables.o
WSA881X_OBJS += wsa881x-regmap.o
WSA881X_OBJS += wsa881x-temp-sensor.o
endif
ifeq ($(CONFIG_SND_SOC_MSM_STUB), m)
STUB_OBJS += msm_stub.o
endif
ifeq ($(CONFIG_SND_SOC_WCD_SPI), m)
SPI_OBJS += wcd-spi.o
endif
ifeq ($(CONFIG_SND_SOC_WCD_CPE), m)
WCD_CPE_OBJS += wcd_cpe_core.o
WCD_CPE_OBJS += wcd_cpe_services.o
endif
ifeq ($(CONFIG_SND_SOC_WCD_MBHC), m)
MBHC_OBJS += wcd-mbhc-v2.o
endif
ifeq ($(CONFIG_SND_SOC_WCD_MBHC_ADC), m)
MBHC_OBJS += wcd-mbhc-adc.o
endif
ifeq ($(CONFIG_SND_SOC_WCD_MBHC_LEGACY), m)
MBHC_OBJS += wcd-mbhc-legacy.o
endif
ifeq ($(CONFIG_SND_SOC_MSM_HDMI_CODEC_RX), m)
HDMICODEC_OBJS += msm_hdmi_codec_rx.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/soc/Module.symvers
# Module information used by KBuild framework
obj-$(CONFIG_WCD9XXX_CODEC_CORE) += wcd_core_dlkm.o
wcd_core_dlkm-y := $(CORE_OBJS)
obj-$(CONFIG_SND_SOC_WCD9XXX_V2) += wcd9xxx_dlkm.o
wcd9xxx_dlkm-y := $(WCD9XXX_OBJS)
obj-$(CONFIG_SND_SOC_WCD9335) += wcd9335_dlkm.o
wcd9335_dlkm-y := $(WCD9335_OBJS)
obj-$(CONFIG_SND_SOC_WSA881X) += wsa881x_dlkm.o
wsa881x_dlkm-y := $(WSA881X_OBJS)
obj-$(CONFIG_SND_SOC_MSM_STUB) += stub_dlkm.o
stub_dlkm-y := $(STUB_OBJS)
obj-$(CONFIG_SND_SOC_WCD_CPE) += wcd_cpe_dlkm.o
wcd_cpe_dlkm-y := $(WCD_CPE_OBJS)
obj-$(CONFIG_SND_SOC_WCD_SPI) += wcd_spi_dlkm.o
wcd_spi_dlkm-y := $(SPI_OBJS)
obj-$(CONFIG_SND_SOC_WCD_MBHC) += mbhc_dlkm.o
mbhc_dlkm-y := $(MBHC_OBJS)
obj-$(CONFIG_SND_SOC_MSM_HDMI_CODEC_RX) += hdmi_dlkm.o
hdmi_dlkm-y := $(HDMICODEC_OBJS)
# inject some build related information
DEFINES += -DBUILD_TIMESTAMP=\"$(shell date -u +'%Y-%m-%dT%H:%M:%SZ')\"

View File

@@ -173,7 +173,22 @@ struct wcd_cpe_lsm_ops {
struct cpe_lsm_session *session, void *data); struct cpe_lsm_session *session, void *data);
}; };
#if IS_ENABLED(CONFIG_SND_SOC_WCD_CPE)
int wcd_cpe_get_lsm_ops(struct wcd_cpe_lsm_ops *lsm_ops); int wcd_cpe_get_lsm_ops(struct wcd_cpe_lsm_ops *lsm_ops);
int wcd_cpe_get_afe_ops(struct wcd_cpe_afe_ops *afe_ops); int wcd_cpe_get_afe_ops(struct wcd_cpe_afe_ops *afe_ops);
void *wcd_cpe_get_core_handle(struct snd_soc_codec *codec); void *wcd_cpe_get_core_handle(struct snd_soc_codec *codec);
#else /* CONFIG_SND_SOC_WCD_CPE */
static inline int wcd_cpe_get_lsm_ops(struct wcd_cpe_lsm_ops *lsm_ops)
{
return 0;
}
static inline int wcd_cpe_get_afe_ops(struct wcd_cpe_afe_ops *afe_ops)
{
return 0;
}
static inline void *wcd_cpe_get_core_handle(struct snd_soc_codec *codec)
{
return NULL;
}
#endif /* CONFIG_SND_SOC_WCD_CPE */
#endif #endif

View File

@@ -0,0 +1,46 @@
# Android makefile for audio kernel modules
# Assume no targets will be supported
AUDIO_CHIPSET := audio
# Build/Package only in case of supported target
ifeq ($(call is-board-platform,sdm670),true)
AUDIO_SELECT := CONFIG_SND_SOC_SDM670=m
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=msm_sdw_dlkm
KBUILD_OPTIONS += BOARD_PLATFORM=$(TARGET_BOARD_PLATFORM)
KBUILD_OPTIONS += $(AUDIO_SELECT)
###########################################################
include $(CLEAR_VARS)
LOCAL_MODULE := $(AUDIO_CHIPSET)_msm_sdw.ko
LOCAL_MODULE_KBUILD_NAME := msm_sdw_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

104
asoc/codecs/msm_sdw/Kbuild Normal file
View File

@@ -0,0 +1,104 @@
# 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)
############ MSM Soundwire ############
# for MSM Soundwire Codec
ifeq ($(CONFIG_SND_SOC_MSM_SDW), m)
MSM_SDW_OBJS += msm_sdw_cdc.o
MSM_SDW_OBJS += msm_sdw_regmap.o
MSM_SDW_OBJS += msm-sdw-tables.o
MSM_SDW_OBJS += msm_sdw_cdc_utils.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/ipc/Module.symvers
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
KBUILD_EXTRA_SYMBOLS +=$(OUT)/obj/vendor/qcom/opensource/audio-kernel/asoc/codecs/Module.symvers
KBUILD_EXTRA_SYMBOLS +=$(OUT)/obj/vendor/qcom/opensource/audio-kernel/soc/Module.symvers
# Module information used by KBuild framework
obj-$(CONFIG_SND_SOC_MSM_SDW) += msm_sdw_dlkm.o
msm_sdw_dlkm-y := $(MSM_SDW_OBJS)
# inject some build related information
DEFINES += -DBUILD_TIMESTAMP=\"$(shell date -u +'%Y-%m-%dT%H:%M:%SZ')\"

View File

@@ -156,6 +156,7 @@ struct msm_sdw_priv {
struct snd_info_entry *version_entry; struct snd_info_entry *version_entry;
}; };
#if IS_ENABLED(CONFIG_SND_SOC_MSM_SDW)
extern int msm_sdw_set_spkr_mode(struct snd_soc_codec *codec, int mode); extern int msm_sdw_set_spkr_mode(struct snd_soc_codec *codec, int mode);
extern int msm_sdw_set_spkr_gain_offset(struct snd_soc_codec *codec, extern int msm_sdw_set_spkr_gain_offset(struct snd_soc_codec *codec,
int offset); int offset);
@@ -167,4 +168,32 @@ extern struct regmap *msm_sdw_regmap_init(struct device *dev,
extern int msm_sdw_codec_info_create_codec_entry( extern int msm_sdw_codec_info_create_codec_entry(
struct snd_info_entry *codec_root, struct snd_info_entry *codec_root,
struct snd_soc_codec *codec); struct snd_soc_codec *codec);
#else /* CONFIG_SND_SOC_MSM_SDW */
static inline int msm_sdw_set_spkr_mode(struct snd_soc_codec *codec, int mode)
{
return 0;
}
static inline int msm_sdw_set_spkr_gain_offset(struct snd_soc_codec *codec,
int offset);
{
return 0;
}
static inline void msm_sdw_gpio_cb(
int (*sdw_cdc_gpio_fn)(bool enable, struct snd_soc_codec *codec),
struct snd_soc_codec *codec);
{
}
static inline struct regmap *msm_sdw_regmap_init(struct device *dev,
const struct regmap_config *config);
{
return NULL;
}
static inline int msm_sdw_codec_info_create_codec_entry(
struct snd_info_entry *codec_root,
struct snd_soc_codec *codec)
{
return 0;
}
#endif /* CONFIG_SND_SOC_MSM_SDW */
#endif #endif

View File

@@ -0,0 +1,53 @@
# Android makefile for audio kernel modules
# Assume no targets will be supported
AUDIO_CHIPSET := audio
# Build/Package only in case of supported target
ifeq ($(call is-board-platform,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=analog_cdc_dlkm
KBUILD_OPTIONS += BOARD_PLATFORM=$(TARGET_BOARD_PLATFORM)
KBUILD_OPTIONS += $(AUDIO_SELECT)
###########################################################
include $(CLEAR_VARS)
LOCAL_MODULE := $(AUDIO_CHIPSET)_analog_cdc.ko
LOCAL_MODULE_KBUILD_NAME := analog_cdc_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)_digital_cdc.ko
LOCAL_MODULE_KBUILD_NAME := digital_cdc_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

View File

@@ -0,0 +1,110 @@
# 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)
############ SDM660_CDC ############
# for SDM660_CDC Codec
ifeq ($(CONFIG_SND_SOC_ANALOG_CDC), m)
ANALOG_CDC_OBJS += msm-analog-cdc.o
ANALOG_CDC_OBJS += sdm660-cdc-irq.o
endif
ifeq ($(CONFIG_SND_SOC_DIGITAL_CDC), m)
DIGITAL_CDC_OBJS += msm-digital-cdc.o
DIGITAL_CDC_OBJS += msm-digital-cdc-regmap.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/ipc/Module.symvers
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
KBUILD_EXTRA_SYMBOLS +=$(OUT)/obj/vendor/qcom/opensource/audio-kernel/asoc/codecs/Module.symvers
KBUILD_EXTRA_SYMBOLS +=$(OUT)/obj/vendor/qcom/opensource/audio-kernel/soc/Module.symvers
# Module information used by KBuild framework
obj-$(CONFIG_SND_SOC_ANALOG_CDC) += analog_cdc_dlkm.o
analog_cdc_dlkm-y := $(ANALOG_CDC_OBJS)
obj-$(CONFIG_SND_SOC_DIGITAL_CDC) += digital_cdc_dlkm.o
digital_cdc_dlkm-y := $(DIGITAL_CDC_OBJS)
# inject some build related information
DEFINES += -DBUILD_TIMESTAMP=\"$(shell date -u +'%Y-%m-%dT%H:%M:%SZ')\"

View File

@@ -221,20 +221,48 @@ struct sdm660_cdc_pdata {
struct sdm660_cdc_regulator regulator[MAX_REGULATOR]; struct sdm660_cdc_regulator regulator[MAX_REGULATOR];
}; };
#if IS_ENABLED(CONFIG_SND_SOC_ANALOG_CDC)
extern int msm_anlg_cdc_mclk_enable(struct snd_soc_codec *codec, extern int msm_anlg_cdc_mclk_enable(struct snd_soc_codec *codec,
int mclk_enable, bool dapm); int mclk_enable, bool dapm);
extern int msm_anlg_cdc_hs_detect(struct snd_soc_codec *codec, extern int msm_anlg_cdc_hs_detect(struct snd_soc_codec *codec,
struct wcd_mbhc_config *mbhc_cfg); struct wcd_mbhc_config *mbhc_cfg);
extern void msm_anlg_cdc_hs_detect_exit(struct snd_soc_codec *codec); extern void msm_anlg_cdc_hs_detect_exit(struct snd_soc_codec *codec);
extern void sdm660_cdc_update_int_spk_boost(bool enable); extern void sdm660_cdc_update_int_spk_boost(bool enable);
extern void msm_anlg_cdc_spk_ext_pa_cb( extern void msm_anlg_cdc_spk_ext_pa_cb(
int (*codec_spk_ext_pa)(struct snd_soc_codec *codec, int (*codec_spk_ext_pa)(struct snd_soc_codec *codec,
int enable), struct snd_soc_codec *codec); int enable), struct snd_soc_codec *codec);
int msm_anlg_codec_info_create_codec_entry(struct snd_info_entry *codec_root, int msm_anlg_codec_info_create_codec_entry(struct snd_info_entry *codec_root,
struct snd_soc_codec *codec); struct snd_soc_codec *codec);
#else /* CONFIG_SND_SOC_ANALOG_CDC */
static inline int msm_anlg_cdc_mclk_enable(struct snd_soc_codec *codec,
int mclk_enable, bool dapm)
{
return 0;
}
static inline int msm_anlg_cdc_hs_detect(struct snd_soc_codec *codec,
struct wcd_mbhc_config *mbhc_cfg)
{
return 0;
}
static inline void msm_anlg_cdc_hs_detect_exit(struct snd_soc_codec *codec)
{
}
static inline void sdm660_cdc_update_int_spk_boost(bool enable)
{
}
static inline void msm_anlg_cdc_spk_ext_pa_cb(
int (*codec_spk_ext_pa)(struct snd_soc_codec *codec,
int enable), struct snd_soc_codec *codec)
{
}
static inline int msm_anlg_codec_info_create_codec_entry(
struct snd_info_entry *codec_root,
struct snd_soc_codec *codec)
{
return 0;
}
#endif /* CONFIG_SND_SOC_ANALOG_CDC */
#endif #endif

View File

@@ -89,10 +89,26 @@ enum {
BAND_MAX, BAND_MAX,
}; };
#if IS_ENABLED(CONFIG_SND_SOC_DIGITAL_CDC)
extern void msm_dig_cdc_hph_comp_cb( extern void msm_dig_cdc_hph_comp_cb(
int (*codec_hph_comp_gpio)( int (*codec_hph_comp_gpio)(
bool enable, struct snd_soc_codec *codec), bool enable, struct snd_soc_codec *codec),
struct snd_soc_codec *codec); struct snd_soc_codec *codec);
int msm_dig_codec_info_create_codec_entry(struct snd_info_entry *codec_root, int msm_dig_codec_info_create_codec_entry(struct snd_info_entry *codec_root,
struct snd_soc_codec *codec); struct snd_soc_codec *codec);
#else /* CONFIG_SND_SOC_DIGITAL_CDC */
static inline void msm_dig_cdc_hph_comp_cb(
int (*codec_hph_comp_gpio)(
bool enable, struct snd_soc_codec *codec),
struct snd_soc_codec *codec)
{
}
static inline int msm_dig_codec_info_create_codec_entry(
struct snd_info_entry *codec_root,
struct snd_soc_codec *codec)
{
return 0;
}
#endif /* CONFIG_SND_SOC_DIGITAL_CDC */
#endif #endif

View File

@@ -15,7 +15,7 @@
#include "wcdcal-hwdep.h" #include "wcdcal-hwdep.h"
#include "wcd-mbhc-v2.h" #include "wcd-mbhc-v2.h"
#ifdef CONFIG_SND_SOC_WCD_MBHC_LEGACY #if IS_ENABLED(CONFIG_SND_SOC_WCD_MBHC_LEGACY)
void wcd_mbhc_legacy_init(struct wcd_mbhc *mbhc); void wcd_mbhc_legacy_init(struct wcd_mbhc *mbhc);
#else #else
static inline void wcd_mbhc_legacy_init(struct wcd_mbhc *mbhc) static inline void wcd_mbhc_legacy_init(struct wcd_mbhc *mbhc)

View File

@@ -2121,5 +2121,17 @@ void wcd_mbhc_deinit(struct wcd_mbhc *mbhc)
} }
EXPORT_SYMBOL(wcd_mbhc_deinit); EXPORT_SYMBOL(wcd_mbhc_deinit);
static int __init mbhc_init(void)
{
return 0;
}
static void __exit mbhc_exit(void)
{
}
module_init(mbhc_init);
module_exit(mbhc_exit);
MODULE_DESCRIPTION("wcd MBHC v2 module"); MODULE_DESCRIPTION("wcd MBHC v2 module");
MODULE_LICENSE("GPL v2"); MODULE_LICENSE("GPL v2");

View File

@@ -137,6 +137,7 @@ enum {
RX_GAIN_OFFSET_0_DB, RX_GAIN_OFFSET_0_DB,
}; };
#if IS_ENABLED(CONFIG_SND_SOC_WCD9335)
extern void *tasha_get_afe_config(struct snd_soc_codec *codec, extern void *tasha_get_afe_config(struct snd_soc_codec *codec,
enum afe_config_type config_type); enum afe_config_type config_type);
extern int tasha_cdc_mclk_enable(struct snd_soc_codec *codec, int enable, extern int tasha_cdc_mclk_enable(struct snd_soc_codec *codec, int enable,
@@ -163,4 +164,75 @@ extern int tasha_codec_enable_standalone_micbias(struct snd_soc_codec *codec,
extern int tasha_set_spkr_mode(struct snd_soc_codec *codec, int mode); extern int tasha_set_spkr_mode(struct snd_soc_codec *codec, int mode);
extern int tasha_set_spkr_gain_offset(struct snd_soc_codec *codec, int offset); extern int tasha_set_spkr_gain_offset(struct snd_soc_codec *codec, int offset);
extern enum codec_variant tasha_codec_ver(void); extern enum codec_variant tasha_codec_ver(void);
#else /* CONFIG_SND_SOC_WCD9335 */
static inline void *tasha_get_afe_config(struct snd_soc_codec *codec,
enum afe_config_type config_type)
{
return NULL;
}
static inline int tasha_cdc_mclk_enable(struct snd_soc_codec *codec,
int enable,
bool dapm)
{
return 0;
}
static inline int tasha_cdc_mclk_tx_enable(struct snd_soc_codec *codec,
int enable,
bool dapm)
{
return 0;
}
static inline int tasha_enable_efuse_sensing(struct snd_soc_codec *codec)
{
return 0;
}
static inline int tasha_mbhc_hs_detect(struct snd_soc_codec *codec,
struct wcd_mbhc_config *mbhc_cfg)
{
return 0;
}
static inline void tasha_mbhc_hs_detect_exit(struct snd_soc_codec *codec)
{
}
static inline void tasha_mbhc_zdet_gpio_ctrl(
int (*zdet_gpio_cb)(struct snd_soc_codec *codec, bool high),
struct snd_soc_codec *codec)
{
}
static inline int tasha_codec_info_create_codec_entry(
struct snd_info_entry *codec_root,
struct snd_soc_codec *codec)
{
return 0;
}
static inline void tasha_event_register(
int (*machine_event_cb)(struct snd_soc_codec *codec,
enum wcd9335_codec_event),
struct snd_soc_codec *codec)
{
}
static inline int tasha_codec_enable_standalone_micbias(
struct snd_soc_codec *codec,
int micb_num,
bool enable)
{
return 0;
}
static inline int tasha_set_spkr_mode(struct snd_soc_codec *codec, int mode)
{
return 0;
}
static inline int tasha_set_spkr_gain_offset(struct snd_soc_codec *codec,
int offset)
{
return 0;
}
static inline enum codec_variant tasha_codec_ver(void)
{
return 0;
}
#endif /* CONFIG_SND_SOC_WCD9335 */
#endif #endif

View File

@@ -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=wcd934x_dlkm
KBUILD_OPTIONS += BOARD_PLATFORM=$(TARGET_BOARD_PLATFORM)
KBUILD_OPTIONS += $(AUDIO_SELECT)
###########################################################
include $(CLEAR_VARS)
LOCAL_MODULE := $(AUDIO_CHIPSET)_wcd934x.ko
LOCAL_MODULE_KBUILD_NAME := wcd934x_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

105
asoc/codecs/wcd934x/Kbuild Normal file
View File

@@ -0,0 +1,105 @@
# 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)
############ WCD934X ############
# for WCD934X Codec
ifeq ($(CONFIG_SND_SOC_WCD934X), m)
WCD934X_OBJS += wcd934x.o
WCD934X_OBJS += wcd934x-dsp-cntl.o
WCD934X_OBJS += wcd934x-mbhc.o
WCD934X_OBJS += wcd934x-dsd.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/ipc/Module.symvers
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
KBUILD_EXTRA_SYMBOLS +=$(OUT)/obj/vendor/qcom/opensource/audio-kernel/asoc/codecs/Module.symvers
KBUILD_EXTRA_SYMBOLS +=$(OUT)/obj/vendor/qcom/opensource/audio-kernel/soc/Module.symvers
# Module information used by KBuild framework
obj-$(CONFIG_SND_SOC_WCD934X) += wcd934x_dlkm.o
wcd934x_dlkm-y := $(WCD934X_OBJS)
# inject some build related information
DEFINES += -DBUILD_TIMESTAMP=\"$(shell date -u +'%Y-%m-%dT%H:%M:%SZ')\"

View File

@@ -37,6 +37,11 @@ do { \
} while (0) } while (0)
/**
* msm_audio_effects_is_effmodule_supp_in_top -
* Checks if given topology and module in effects
*
*/
bool msm_audio_effects_is_effmodule_supp_in_top(int effect_module, bool msm_audio_effects_is_effmodule_supp_in_top(int effect_module,
int topology) int topology)
{ {
@@ -56,6 +61,7 @@ bool msm_audio_effects_is_effmodule_supp_in_top(int effect_module,
return false; return false;
} }
} }
EXPORT_SYMBOL(msm_audio_effects_is_effmodule_supp_in_top);
int msm_audio_effects_enable_extn(struct audio_client *ac, int msm_audio_effects_enable_extn(struct audio_client *ac,
struct msm_nt_eff_all_config *effects, struct msm_nt_eff_all_config *effects,
@@ -102,6 +108,16 @@ int msm_audio_effects_enable_extn(struct audio_client *ac,
return rc; return rc;
} }
/**
* msm_audio_effects_virtualizer_handler -
* Audio effects handler for virtualizer
*
* @ac: audio client handle
* @pbe: virtualizer params
* @values: values to be updated
*
* Return 0 on success or error on failure
*/
int msm_audio_effects_virtualizer_handler(struct audio_client *ac, int msm_audio_effects_virtualizer_handler(struct audio_client *ac,
struct virtualizer_params *virtualizer, struct virtualizer_params *virtualizer,
long *values) long *values)
@@ -263,7 +279,18 @@ invalid_config:
kfree(params); kfree(params);
return rc; return rc;
} }
EXPORT_SYMBOL(msm_audio_effects_virtualizer_handler);
/**
* msm_audio_effects_reverb_handler -
* Audio effects handler for reverb
*
* @ac: audio client handle
* @pbe: reverb params
* @values: values to be updated
*
* Return 0 on success or error on failure
*/
int msm_audio_effects_reverb_handler(struct audio_client *ac, int msm_audio_effects_reverb_handler(struct audio_client *ac,
struct reverb_params *reverb, struct reverb_params *reverb,
long *values) long *values)
@@ -733,7 +760,18 @@ invalid_config:
kfree(params); kfree(params);
return rc; return rc;
} }
EXPORT_SYMBOL(msm_audio_effects_reverb_handler);
/**
* msm_audio_effects_bass_boost_handler -
* Audio effects handler for bass_boost
*
* @ac: audio client handle
* @bass_boost: bass_boost params
* @values: values to be updated
*
* Return 0 on success or error on failure
*/
int msm_audio_effects_bass_boost_handler(struct audio_client *ac, int msm_audio_effects_bass_boost_handler(struct audio_client *ac,
struct bass_boost_params *bass_boost, struct bass_boost_params *bass_boost,
long *values) long *values)
@@ -868,7 +906,18 @@ invalid_config:
kfree(params); kfree(params);
return rc; return rc;
} }
EXPORT_SYMBOL(msm_audio_effects_bass_boost_handler);
/**
* msm_audio_effects_pbe_handler -
* Audio effects handler for pbe
*
* @ac: audio client handle
* @pbe: pbe params
* @values: values to be updated
*
* Return 0 on success or error on failure
*/
int msm_audio_effects_pbe_handler(struct audio_client *ac, int msm_audio_effects_pbe_handler(struct audio_client *ac,
struct pbe_params *pbe, struct pbe_params *pbe,
long *values) long *values)
@@ -975,7 +1024,18 @@ invalid_config:
kfree(params); kfree(params);
return rc; return rc;
} }
EXPORT_SYMBOL(msm_audio_effects_pbe_handler);
/**
* msm_audio_effects_popless_eq_handler -
* Audio effects handler for popless equalizer
*
* @ac: audio client handle
* @eq: equalizer params
* @values: values to be updated
*
* Return 0 on success or error on failure
*/
int msm_audio_effects_popless_eq_handler(struct audio_client *ac, int msm_audio_effects_popless_eq_handler(struct audio_client *ac,
struct eq_params *eq, struct eq_params *eq,
long *values) long *values)
@@ -1207,6 +1267,7 @@ invalid_config:
kfree(params); kfree(params);
return rc; return rc;
} }
EXPORT_SYMBOL(msm_audio_effects_popless_eq_handler);
static int __msm_audio_effects_volume_handler(struct audio_client *ac, static int __msm_audio_effects_volume_handler(struct audio_client *ac,
struct soft_volume_params *vol, struct soft_volume_params *vol,
@@ -1370,9 +1431,21 @@ int msm_audio_effects_volume_handler(struct audio_client *ac,
SOFT_VOLUME_INSTANCE_1); SOFT_VOLUME_INSTANCE_1);
} }
/**
* msm_audio_effects_volume_handler_v2 -
* Audio effects handler for volume
*
* @ac: audio client handle
* @vol: volume params
* @values: values to be updated
* @instance: instance to update
*
* Return 0 on success or error on failure
*/
int msm_audio_effects_volume_handler_v2(struct audio_client *ac, int msm_audio_effects_volume_handler_v2(struct audio_client *ac,
struct soft_volume_params *vol, struct soft_volume_params *vol,
long *values, int instance) long *values, int instance)
{ {
return __msm_audio_effects_volume_handler(ac, vol, values, instance); return __msm_audio_effects_volume_handler(ac, vol, values, instance);
} }
EXPORT_SYMBOL(msm_audio_effects_volume_handler_v2);

View File

@@ -4541,17 +4541,15 @@ static struct platform_driver msm_compr_driver = {
.remove = msm_compr_remove, .remove = msm_compr_remove,
}; };
static int __init msm_soc_platform_init(void) int __init msm_compress_dsp_init(void)
{ {
return platform_driver_register(&msm_compr_driver); return platform_driver_register(&msm_compr_driver);
} }
module_init(msm_soc_platform_init);
static void __exit msm_soc_platform_exit(void) void __exit msm_compress_dsp_exit(void)
{ {
platform_driver_unregister(&msm_compr_driver); platform_driver_unregister(&msm_compr_driver);
} }
module_exit(msm_soc_platform_exit);
MODULE_DESCRIPTION("Compress Offload platform driver"); MODULE_DESCRIPTION("Compress Offload platform driver");
MODULE_LICENSE("GPL v2"); MODULE_LICENSE("GPL v2");

View File

@@ -3335,8 +3335,19 @@ static struct platform_driver msm_cpe_lsm_driver = {
.probe = msm_cpe_lsm_probe, .probe = msm_cpe_lsm_probe,
.remove = msm_cpe_lsm_remove, .remove = msm_cpe_lsm_remove,
}; };
module_platform_driver(msm_cpe_lsm_driver);
int __init msm_cpe_lsm_init(void)
{
return platform_driver_register(&msm_cpe_lsm_driver);
}
void __exit msm_cpe_lsm_exit(void)
{
platform_driver_unregister(&msm_cpe_lsm_driver);
}
module_init(msm_cpe_lsm_init);
module_exit(msm_cpe_lsm_exit);
MODULE_DESCRIPTION("CPE LSM platform driver"); MODULE_DESCRIPTION("CPE LSM platform driver");
MODULE_DEVICE_TABLE(of, msm_cpe_lsm_dt_match); MODULE_DEVICE_TABLE(of, msm_cpe_lsm_dt_match);
MODULE_LICENSE("GPL v2"); MODULE_LICENSE("GPL v2");

View File

@@ -2698,17 +2698,15 @@ static struct platform_driver msm_fe_dai_driver = {
}, },
}; };
static int __init msm_fe_dai_init(void) int __init msm_fe_dai_init(void)
{ {
return platform_driver_register(&msm_fe_dai_driver); return platform_driver_register(&msm_fe_dai_driver);
} }
module_init(msm_fe_dai_init);
static void __exit msm_fe_dai_exit(void) void __exit msm_fe_dai_exit(void)
{ {
platform_driver_unregister(&msm_fe_dai_driver); platform_driver_unregister(&msm_fe_dai_driver);
} }
module_exit(msm_fe_dai_exit);
/* Module information */ /* Module information */
MODULE_DESCRIPTION("MSM Frontend DAI driver"); MODULE_DESCRIPTION("MSM Frontend DAI driver");

View File

@@ -538,17 +538,15 @@ static struct platform_driver msm_dai_q6_hdmi_driver = {
}, },
}; };
static int __init msm_dai_q6_hdmi_init(void) int __init msm_dai_q6_hdmi_init(void)
{ {
return platform_driver_register(&msm_dai_q6_hdmi_driver); return platform_driver_register(&msm_dai_q6_hdmi_driver);
} }
module_init(msm_dai_q6_hdmi_init);
static void __exit msm_dai_q6_hdmi_exit(void) void __exit msm_dai_q6_hdmi_exit(void)
{ {
platform_driver_unregister(&msm_dai_q6_hdmi_driver); platform_driver_unregister(&msm_dai_q6_hdmi_driver);
} }
module_exit(msm_dai_q6_hdmi_exit);
/* Module information */ /* Module information */
MODULE_DESCRIPTION("MSM DSP HDMI DAI driver"); MODULE_DESCRIPTION("MSM DSP HDMI DAI driver");

View File

@@ -8857,7 +8857,7 @@ static struct platform_driver msm_dai_q6_tdm_driver = {
}, },
}; };
static int __init msm_dai_q6_init(void) int __init msm_dai_q6_init(void)
{ {
int rc; int rc;
@@ -8927,16 +8927,17 @@ dai_q6_fail:
fail: fail:
return rc; return rc;
} }
module_init(msm_dai_q6_init);
static void __exit msm_dai_q6_exit(void) void __exit msm_dai_q6_exit(void)
{ {
platform_driver_unregister(&msm_dai_q6_tdm_driver);
platform_driver_unregister(&msm_dai_q6_spdif_driver);
platform_driver_unregister(&msm_dai_mi2s_q6);
platform_driver_unregister(&msm_dai_q6_mi2s_driver);
platform_driver_unregister(&msm_dai_q6_dev); platform_driver_unregister(&msm_dai_q6_dev);
platform_driver_unregister(&msm_dai_q6); platform_driver_unregister(&msm_dai_q6);
platform_driver_unregister(&msm_auxpcm_dev_driver); platform_driver_unregister(&msm_auxpcm_dev_driver);
platform_driver_unregister(&msm_dai_q6_spdif_driver);
} }
module_exit(msm_dai_q6_exit);
/* Module information */ /* Module information */
MODULE_DESCRIPTION("MSM DSP DAI driver"); MODULE_DESCRIPTION("MSM DSP DAI driver");

View File

@@ -642,7 +642,7 @@ static struct slim_driver msm_dai_slim_driver = {
.id_table = msm_dai_slim_dt_match, .id_table = msm_dai_slim_dt_match,
}; };
static int __init msm_dai_slim_init(void) int __init msm_dai_slim_init(void)
{ {
int rc; int rc;
@@ -652,12 +652,11 @@ static int __init msm_dai_slim_init(void)
__func__, rc); __func__, rc);
return rc; return rc;
} }
module_init(msm_dai_slim_init);
static void __exit msm_dai_slim_exit(void) void __exit msm_dai_slim_exit(void)
{ {
slim_driver_unregister(&msm_dai_slim_driver);
} }
module_exit(msm_dai_slim_exit);
/* Module information */ /* Module information */
MODULE_DESCRIPTION("Slimbus apps-owned channel handling driver"); MODULE_DESCRIPTION("Slimbus apps-owned channel handling driver");

View File

@@ -354,7 +354,7 @@ static struct platform_driver msm_dai_stub_driver = {
}, },
}; };
static int __init msm_dai_stub_init(void) int __init msm_dai_stub_init(void)
{ {
int rc = 0; int rc = 0;
@@ -378,16 +378,14 @@ dai_stub_dev_fail:
fail: fail:
return rc; return rc;
} }
module_init(msm_dai_stub_init);
static void __exit msm_dai_stub_exit(void) void __exit msm_dai_stub_exit(void)
{ {
pr_debug("%s:\n", __func__); pr_debug("%s:\n", __func__);
platform_driver_unregister(&msm_dai_stub_dev); platform_driver_unregister(&msm_dai_stub_dev);
platform_driver_unregister(&msm_dai_stub_driver); platform_driver_unregister(&msm_dai_stub_driver);
} }
module_exit(msm_dai_stub_exit);
/* Module information */ /* Module information */
MODULE_DESCRIPTION("MSM Stub DSP DAI driver"); MODULE_DESCRIPTION("MSM Stub DSP DAI driver");

View File

@@ -2269,7 +2269,7 @@ static int msm_ds2_dap_param_visualizer_control_get(
static int msm_ds2_dap_set_security_control(u32 cmd, void *arg) static int msm_ds2_dap_set_security_control(u32 cmd, void *arg)
{ {
return 0 return 0;
} }
static int msm_ds2_dap_update_dev_map_port_id(int32_t device_id, int port_id) static int msm_ds2_dap_update_dev_map_port_id(int32_t device_id, int port_id)

View File

@@ -2401,17 +2401,15 @@ static struct platform_driver msm_lsm_driver = {
.remove = msm_lsm_remove, .remove = msm_lsm_remove,
}; };
static int __init msm_soc_platform_init(void) int __init msm_lsm_client_init(void)
{ {
return platform_driver_register(&msm_lsm_driver); return platform_driver_register(&msm_lsm_driver);
} }
module_init(msm_soc_platform_init);
static void __exit msm_soc_platform_exit(void) void __exit msm_lsm_client_exit(void)
{ {
platform_driver_unregister(&msm_lsm_driver); platform_driver_unregister(&msm_lsm_driver);
} }
module_exit(msm_soc_platform_exit);
MODULE_DESCRIPTION("LSM client platform driver"); MODULE_DESCRIPTION("LSM client platform driver");
MODULE_DEVICE_TABLE(of, msm_lsm_client_dt_match); MODULE_DEVICE_TABLE(of, msm_lsm_client_dt_match);

View File

@@ -904,19 +904,17 @@ static struct platform_driver msm_afe_driver = {
.remove = msm_afe_remove, .remove = msm_afe_remove,
}; };
static int __init msm_soc_platform_init(void) int __init msm_pcm_afe_init(void)
{ {
pr_debug("%s\n", __func__); pr_debug("%s\n", __func__);
return platform_driver_register(&msm_afe_driver); return platform_driver_register(&msm_afe_driver);
} }
module_init(msm_soc_platform_init);
static void __exit msm_soc_platform_exit(void) void __exit msm_pcm_afe_exit(void)
{ {
pr_debug("%s\n", __func__); pr_debug("%s\n", __func__);
platform_driver_unregister(&msm_afe_driver); platform_driver_unregister(&msm_afe_driver);
} }
module_exit(msm_soc_platform_exit);
MODULE_DESCRIPTION("AFE PCM module platform driver"); MODULE_DESCRIPTION("AFE PCM module platform driver");
MODULE_LICENSE("GPL v2"); MODULE_LICENSE("GPL v2");

View File

@@ -580,17 +580,15 @@ static struct platform_driver msm_pcm_driver = {
.remove = msm_pcm_remove, .remove = msm_pcm_remove,
}; };
static int __init msm_soc_platform_init(void) int __init msm_pcm_dtmf_init(void)
{ {
return platform_driver_register(&msm_pcm_driver); return platform_driver_register(&msm_pcm_driver);
} }
module_init(msm_soc_platform_init);
static void __exit msm_soc_platform_exit(void) void __exit msm_pcm_dtmf_exit(void)
{ {
platform_driver_unregister(&msm_pcm_driver); platform_driver_unregister(&msm_pcm_driver);
} }
module_exit(msm_soc_platform_exit);
MODULE_DESCRIPTION("DTMF platform driver"); MODULE_DESCRIPTION("DTMF platform driver");
MODULE_LICENSE("GPL v2"); MODULE_LICENSE("GPL v2");

View File

@@ -1504,7 +1504,7 @@ static struct platform_driver msm_pcm_driver = {
.remove = msm_pcm_remove, .remove = msm_pcm_remove,
}; };
static int __init msm_soc_platform_init(void) int __init msm_voice_host_init(void)
{ {
int i = 0; int i = 0;
struct session *s = NULL; struct session *s = NULL;
@@ -1541,13 +1541,11 @@ static int __init msm_soc_platform_init(void)
return platform_driver_register(&msm_pcm_driver); return platform_driver_register(&msm_pcm_driver);
} }
module_init(msm_soc_platform_init);
static void __exit msm_soc_platform_exit(void) void __exit msm_voice_host_exit(void)
{ {
platform_driver_unregister(&msm_pcm_driver); platform_driver_unregister(&msm_pcm_driver);
} }
module_exit(msm_soc_platform_exit);
MODULE_DESCRIPTION("PCM module platform driver"); MODULE_DESCRIPTION("PCM module platform driver");
MODULE_LICENSE("GPL v2"); MODULE_LICENSE("GPL v2");

View File

@@ -66,17 +66,15 @@ static struct platform_driver msm_pcm_hostless_driver = {
.remove = msm_pcm_hostless_remove, .remove = msm_pcm_hostless_remove,
}; };
static int __init msm_soc_platform_init(void) int __init msm_pcm_hostless_init(void)
{ {
return platform_driver_register(&msm_pcm_hostless_driver); return platform_driver_register(&msm_pcm_hostless_driver);
} }
module_init(msm_soc_platform_init);
static void __exit msm_soc_platform_exit(void) void __exit msm_pcm_hostless_exit(void)
{ {
platform_driver_unregister(&msm_pcm_hostless_driver); platform_driver_unregister(&msm_pcm_hostless_driver);
} }
module_exit(msm_soc_platform_exit);
MODULE_DESCRIPTION("Hostless platform driver"); MODULE_DESCRIPTION("Hostless platform driver");
MODULE_LICENSE("GPL v2"); MODULE_LICENSE("GPL v2");

View File

@@ -785,17 +785,15 @@ static struct platform_driver msm_pcm_driver = {
.remove = msm_pcm_remove, .remove = msm_pcm_remove,
}; };
static int __init msm_soc_platform_init(void) int __init msm_pcm_loopback_init(void)
{ {
return platform_driver_register(&msm_pcm_driver); return platform_driver_register(&msm_pcm_driver);
} }
module_init(msm_soc_platform_init);
static void __exit msm_soc_platform_exit(void) void __exit msm_pcm_loopback_exit(void)
{ {
platform_driver_unregister(&msm_pcm_driver); platform_driver_unregister(&msm_pcm_driver);
} }
module_exit(msm_soc_platform_exit);
MODULE_DESCRIPTION("PCM loopback platform driver"); MODULE_DESCRIPTION("PCM loopback platform driver");
MODULE_LICENSE("GPL v2"); MODULE_LICENSE("GPL v2");

View File

@@ -1252,33 +1252,31 @@ static int msm_pcm_remove(struct platform_device *pdev)
snd_soc_unregister_platform(&pdev->dev); snd_soc_unregister_platform(&pdev->dev);
return 0; return 0;
} }
static const struct of_device_id msm_pcm_dt_match[] = { static const struct of_device_id msm_pcm_noirq_dt_match[] = {
{.compatible = "qcom,msm-pcm-dsp-noirq"}, {.compatible = "qcom,msm-pcm-dsp-noirq"},
{} {}
}; };
MODULE_DEVICE_TABLE(of, msm_pcm_dt_match); MODULE_DEVICE_TABLE(of, msm_pcm_noirq_dt_match);
static struct platform_driver msm_pcm_driver_noirq = { static struct platform_driver msm_pcm_driver_noirq = {
.driver = { .driver = {
.name = "msm-pcm-dsp-noirq", .name = "msm-pcm-dsp-noirq",
.owner = THIS_MODULE, .owner = THIS_MODULE,
.of_match_table = msm_pcm_dt_match, .of_match_table = msm_pcm_noirq_dt_match,
}, },
.probe = msm_pcm_probe, .probe = msm_pcm_probe,
.remove = msm_pcm_remove, .remove = msm_pcm_remove,
}; };
static int __init msm_soc_platform_init(void) int __init msm_pcm_noirq_init(void)
{ {
return platform_driver_register(&msm_pcm_driver_noirq); return platform_driver_register(&msm_pcm_driver_noirq);
} }
module_init(msm_soc_platform_init);
static void __exit msm_soc_platform_exit(void) void __exit msm_pcm_noirq_exit(void)
{ {
platform_driver_unregister(&msm_pcm_driver_noirq); platform_driver_unregister(&msm_pcm_driver_noirq);
} }
module_exit(msm_soc_platform_exit);
MODULE_DESCRIPTION("PCM NOIRQ module platform driver"); MODULE_DESCRIPTION("PCM NOIRQ module platform driver");
MODULE_LICENSE("GPL v2"); MODULE_LICENSE("GPL v2");

View File

@@ -1863,7 +1863,7 @@ static struct platform_driver msm_pcm_driver = {
.remove = msm_pcm_remove, .remove = msm_pcm_remove,
}; };
static int __init msm_soc_platform_init(void) int __init msm_pcm_dsp_init(void)
{ {
init_waitqueue_head(&the_locks.enable_wait); init_waitqueue_head(&the_locks.enable_wait);
init_waitqueue_head(&the_locks.eos_wait); init_waitqueue_head(&the_locks.eos_wait);
@@ -1872,13 +1872,11 @@ static int __init msm_soc_platform_init(void)
return platform_driver_register(&msm_pcm_driver); return platform_driver_register(&msm_pcm_driver);
} }
module_init(msm_soc_platform_init);
static void __exit msm_soc_platform_exit(void) void __exit msm_pcm_dsp_exit(void)
{ {
platform_driver_unregister(&msm_pcm_driver); platform_driver_unregister(&msm_pcm_driver);
} }
module_exit(msm_soc_platform_exit);
MODULE_DESCRIPTION("PCM module platform driver"); MODULE_DESCRIPTION("PCM module platform driver");
MODULE_LICENSE("GPL v2"); MODULE_LICENSE("GPL v2");

View File

@@ -30,7 +30,7 @@
#include <sound/pcm_params.h> #include <sound/pcm_params.h>
#include <sound/hwdep.h> #include <sound/hwdep.h>
#include <sound/audio_effects.h> #include <sound/audio_effects.h>
#include <asoc/msm-dts-srs-tm-config.h> #include <dsp/msm-dts-srs-tm-config.h>
#include <dsp/q6voice.h> #include <dsp/q6voice.h>
#include <dsp/q6adm-v2.h> #include <dsp/q6adm-v2.h>
#include <dsp/q6asm-v2.h> #include <dsp/q6asm-v2.h>
@@ -17781,7 +17781,7 @@ err:
return ret; return ret;
} }
static int __init msm_soc_routing_platform_init(void) int __init msm_soc_routing_platform_init(void)
{ {
mutex_init(&routing_lock); mutex_init(&routing_lock);
if (msm_routing_init_cal_data()) if (msm_routing_init_cal_data())
@@ -17795,16 +17795,14 @@ static int __init msm_soc_routing_platform_init(void)
return platform_driver_register(&msm_routing_pcm_driver); return platform_driver_register(&msm_routing_pcm_driver);
} }
module_init(msm_soc_routing_platform_init);
static void __exit msm_soc_routing_platform_exit(void) void __exit msm_soc_routing_platform_exit(void)
{ {
msm_routing_delete_cal_data(); msm_routing_delete_cal_data();
memset(&be_dai_name_table, 0, sizeof(be_dai_name_table)); memset(&be_dai_name_table, 0, sizeof(be_dai_name_table));
mutex_destroy(&routing_lock); mutex_destroy(&routing_lock);
platform_driver_unregister(&msm_routing_pcm_driver); platform_driver_unregister(&msm_routing_pcm_driver);
} }
module_exit(msm_soc_routing_platform_exit);
MODULE_DESCRIPTION("MSM routing platform driver"); MODULE_DESCRIPTION("MSM routing platform driver");
MODULE_LICENSE("GPL v2"); MODULE_LICENSE("GPL v2");

View File

@@ -758,7 +758,7 @@ static struct platform_driver msm_pcm_driver = {
.remove = msm_pcm_remove, .remove = msm_pcm_remove,
}; };
static int __init msm_soc_platform_init(void) int __init msm_pcm_voice_init(void)
{ {
int i = 0; int i = 0;
@@ -769,13 +769,11 @@ static int __init msm_soc_platform_init(void)
return platform_driver_register(&msm_pcm_driver); return platform_driver_register(&msm_pcm_driver);
} }
module_init(msm_soc_platform_init);
static void __exit msm_soc_platform_exit(void) void __exit msm_pcm_voice_exit(void)
{ {
platform_driver_unregister(&msm_pcm_driver); platform_driver_unregister(&msm_pcm_driver);
} }
module_exit(msm_soc_platform_exit);
MODULE_DESCRIPTION("Voice PCM module platform driver"); MODULE_DESCRIPTION("Voice PCM module platform driver");
MODULE_LICENSE("GPL v2"); MODULE_LICENSE("GPL v2");

View File

@@ -1684,7 +1684,7 @@ static struct platform_driver msm_pcm_driver = {
.remove = msm_pcm_remove, .remove = msm_pcm_remove,
}; };
static int __init msm_soc_platform_init(void) int __init msm_pcm_voip_init(void)
{ {
memset(&voip_info, 0, sizeof(voip_info)); memset(&voip_info, 0, sizeof(voip_info));
voip_info.mode = MODE_PCM; voip_info.mode = MODE_PCM;
@@ -1703,13 +1703,11 @@ static int __init msm_soc_platform_init(void)
return platform_driver_register(&msm_pcm_driver); return platform_driver_register(&msm_pcm_driver);
} }
module_init(msm_soc_platform_init);
static void __exit msm_soc_platform_exit(void) void __exit msm_pcm_voip_exit(void)
{ {
platform_driver_unregister(&msm_pcm_driver); platform_driver_unregister(&msm_pcm_driver);
} }
module_exit(msm_soc_platform_exit);
MODULE_DESCRIPTION("PCM module platform driver"); MODULE_DESCRIPTION("PCM module platform driver");
MODULE_LICENSE("GPL v2"); MODULE_LICENSE("GPL v2");

View File

@@ -951,20 +951,18 @@ static struct platform_driver msm_transcode_loopback_driver = {
.remove = msm_transcode_remove, .remove = msm_transcode_remove,
}; };
static int __init msm_soc_platform_init(void) int __init msm_transcode_loopback_init(void)
{ {
memset(&transcode_info, 0, sizeof(struct msm_transcode_loopback)); memset(&transcode_info, 0, sizeof(struct msm_transcode_loopback));
mutex_init(&transcode_info.lock); mutex_init(&transcode_info.lock);
return platform_driver_register(&msm_transcode_loopback_driver); return platform_driver_register(&msm_transcode_loopback_driver);
} }
module_init(msm_soc_platform_init);
static void __exit msm_soc_platform_exit(void) void __exit msm_transcode_loopback_exit(void)
{ {
mutex_destroy(&transcode_info.lock); mutex_destroy(&transcode_info.lock);
platform_driver_unregister(&msm_transcode_loopback_driver); platform_driver_unregister(&msm_transcode_loopback_driver);
} }
module_exit(msm_soc_platform_exit);
MODULE_DESCRIPTION("Transcode loopback platform driver"); MODULE_DESCRIPTION("Transcode loopback platform driver");
MODULE_LICENSE("GPL v2"); MODULE_LICENSE("GPL v2");

69
asoc/platform_init.c Normal file
View File

@@ -0,0 +1,69 @@
/*
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 "platform_init.h"
static int __init audio_platform_init(void)
{
msm_compress_dsp_init();
msm_fe_dai_init();
msm_dai_q6_hdmi_init();
msm_dai_q6_init();
msm_dai_slim_init();
msm_dai_stub_init();
msm_lsm_client_init();
msm_pcm_afe_init();
msm_pcm_dtmf_init();
msm_pcm_hostless_init();
msm_voice_host_init();
msm_pcm_loopback_init();
msm_pcm_noirq_init();
msm_pcm_dsp_init();
msm_soc_routing_platform_init();
msm_pcm_voice_init();
msm_pcm_voip_init();
msm_transcode_loopback_init();
return 0;
}
static void audio_platform_exit(void)
{
msm_transcode_loopback_exit();
msm_pcm_voip_exit();
msm_pcm_voice_exit();
msm_soc_routing_platform_exit();
msm_pcm_dsp_exit();
msm_pcm_noirq_exit();
msm_pcm_loopback_exit();
msm_voice_host_exit();
msm_pcm_hostless_exit();
msm_pcm_dtmf_exit();
msm_pcm_afe_exit();
msm_lsm_client_exit();
msm_dai_stub_exit();
msm_dai_slim_exit();
msm_dai_q6_exit();
msm_dai_q6_hdmi_exit();
msm_fe_dai_exit();
msm_compress_dsp_exit();
}
module_init(audio_platform_init);
module_exit(audio_platform_exit);
MODULE_DESCRIPTION("Audio Platform driver");
MODULE_LICENSE("GPL v2");

58
asoc/platform_init.h Normal file
View File

@@ -0,0 +1,58 @@
/*
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 __PLATFORM_INIT_H__
#define __PLATFORM_INIT_H__
int msm_compress_dsp_init(void);
int msm_fe_dai_init(void);
int msm_dai_q6_hdmi_init(void);
int msm_dai_q6_init(void);
int msm_dai_slim_init(void);
int msm_dai_stub_init(void);
int msm_lsm_client_init(void);
int msm_pcm_afe_init(void);
int msm_pcm_dtmf_init(void);
int msm_pcm_hostless_init(void);
int msm_voice_host_init(void);
int msm_pcm_loopback_init(void);
int msm_pcm_noirq_init(void);
int msm_pcm_dsp_init(void);
int msm_soc_routing_platform_init(void);
int msm_pcm_voice_init(void);
int msm_pcm_voip_init(void);
int msm_transcode_loopback_init(void);
int msm_cpe_lsm_init(void);
void msm_cpe_lsm_exit(void);
void msm_transcode_loopback_exit(void);
void msm_pcm_voip_exit(void);
void msm_pcm_voice_exit(void);
void msm_soc_routing_platform_exit(void);
void msm_pcm_dsp_exit(void);
void msm_pcm_noirq_exit(void);
void msm_pcm_loopback_exit(void);
void msm_voice_host_exit(void);
void msm_pcm_hostless_exit(void);
void msm_pcm_dtmf_exit(void);
void msm_pcm_afe_exit(void);
void msm_lsm_client_exit(void);
void msm_dai_stub_exit(void);
void msm_dai_slim_exit(void);
void msm_dai_q6_exit(void);
void msm_dai_q6_hdmi_exit(void);
void msm_fe_dai_exit(void);
void msm_compress_dsp_exit(void);
#endif

View File

@@ -1,49 +1,50 @@
CONFIG_PINCTRL_LPI=y CONFIG_PINCTRL_LPI=m
CONFIG_PINCTRL_WCD=y CONFIG_PINCTRL_WCD=m
CONFIG_AUDIO_EXT_CLK=y CONFIG_AUDIO_EXT_CLK=m
CONFIG_SND_SOC_WCD9XXX_V2=y CONFIG_SND_SOC_WCD9XXX_V2=m
CONFIG_SND_SOC_WCD_MBHC=y CONFIG_SND_SOC_WCD_MBHC=m
CONFIG_SND_SOC_WSA881X=y CONFIG_SND_SOC_WSA881X=m
CONFIG_SND_SOC_WCD_DSP_MGR=y CONFIG_SND_SOC_WCD_DSP_MGR=m
CONFIG_SND_SOC_WCD_SPI=y CONFIG_SND_SOC_WCD_SPI=m
CONFIG_SND_SOC_WCD_CPE=y CONFIG_SND_SOC_WCD_CPE=m
CONFIG_SND_SOC_WCD9335=y CONFIG_SND_SOC_CPE=m
CONFIG_SND_SOC_WCD934X=y CONFIG_SND_SOC_WCD9335=m
CONFIG_SND_SOC_WCD934X_MBHC=y CONFIG_SND_SOC_WCD934X=m
CONFIG_SND_SOC_WCD934X_DSD=y CONFIG_SND_SOC_WCD934X_MBHC=m
CONFIG_MSM_QDSP6V2_CODECS=y CONFIG_SND_SOC_WCD934X_DSD=m
CONFIG_MSM_ULTRASOUND=y CONFIG_MSM_QDSP6V2_CODECS=m
CONFIG_MSM_QDSP6_APRV2_GLINK=y CONFIG_MSM_ULTRASOUND=m
CONFIG_MSM_ADSP_LOADER=y CONFIG_MSM_QDSP6_APRV2_GLINK=m
CONFIG_REGMAP_SWR=y CONFIG_MSM_ADSP_LOADER=m
CONFIG_MSM_QDSP6_SSR=y CONFIG_REGMAP_SWR=m
CONFIG_MSM_QDSP6_PDR=y CONFIG_MSM_QDSP6_SSR=m
CONFIG_MSM_QDSP6_NOTIFIER=y CONFIG_MSM_QDSP6_PDR=m
CONFIG_SND_SOC_MSM_HOSTLESS_PCM=y CONFIG_MSM_QDSP6_NOTIFIER=m
CONFIG_SND_SOC_MSM_QDSP6V2_INTF=y CONFIG_SND_SOC_MSM_HOSTLESS_PCM=m
CONFIG_SND_SOC_SDM670=y CONFIG_SND_SOC_MSM_QDSP6V2_INTF=m
CONFIG_MSM_GLINK_SPI_XPRT=y CONFIG_SND_SOC_SDM670=m
CONFIG_SOUNDWIRE=y CONFIG_MSM_GLINK_SPI_XPRT=m
CONFIG_SOUNDWIRE_WCD_CTRL=y CONFIG_SOUNDWIRE=m
CONFIG_SND_SOC_QDSP6V2=y CONFIG_SOUNDWIRE_WCD_CTRL=m
CONFIG_SND_SOC_MSM_QDSP6V2_INTF=y CONFIG_SND_SOC_QDSP6V2=m
CONFIG_WCD9XXX_CODEC_CORE=y CONFIG_SND_SOC_MSM_QDSP6V2_INTF=m
CONFIG_MSM_CDC_PINCTRL=y CONFIG_WCD9XXX_CODEC_CORE=m
CONFIG_SND_SOC_WCD_MBHC_ADC=y CONFIG_MSM_CDC_PINCTRL=m
CONFIG_SND_SOC_WCD_MBHC_LEGACY=y CONFIG_SND_SOC_WCD_MBHC_ADC=m
CONFIG_QTI_PP=y CONFIG_SND_SOC_WCD_MBHC_LEGACY=m
CONFIG_SND_HWDEP=y CONFIG_QTI_PP=m
CONFIG_DTS_EAGLE=y CONFIG_SND_HWDEP=m
CONFIG_DOLBY_DS2=y CONFIG_DTS_EAGLE=m
CONFIG_DOLBY_LICENSE=y CONFIG_DOLBY_DS2=m
CONFIG_DTS_SRS_TM=y CONFIG_DOLBY_LICENSE=m
CONFIG_SND_SOC_EXT_CODEC=y CONFIG_DTS_SRS_TM=m
CONFIG_SND_SOC_INT_CODEC=y CONFIG_SND_SOC_EXT_CODEC=m
CONFIG_SND_SOC_MSM_STUB=y CONFIG_SND_SOC_INT_CODEC=m
CONFIG_WCD_DSP_GLINK=y CONFIG_SND_SOC_MSM_STUB=m
CONFIG_MSM_AVTIMER=y CONFIG_WCD_DSP_GLINK=m
CONFIG_SND_SOC_SDM660_CDC=y CONFIG_MSM_AVTIMER=m
CONFIG_SND_SOC_ANALOG_CDC=y CONFIG_SND_SOC_SDM660_CDC=m
CONFIG_SND_SOC_DIGITAL_CDC=y CONFIG_SND_SOC_ANALOG_CDC=m
CONFIG_SND_SOC_MSM_SDW=y CONFIG_SND_SOC_DIGITAL_CDC=m
CONFIG_SND_SOC_MSM_HDMI_CODEC_RX=y CONFIG_SND_SOC_MSM_SDW=m
CONFIG_SND_SOC_MSM_HDMI_CODEC_RX=m

View File

@@ -55,6 +55,7 @@
#define CONFIG_MSM_AVTIMER 1 #define CONFIG_MSM_AVTIMER 1
#define CONFIG_SND_SOC_EXT_CODEC 1 #define CONFIG_SND_SOC_EXT_CODEC 1
#define CONFIG_SND_SOC_INT_CODEC 1 #define CONFIG_SND_SOC_INT_CODEC 1
#define CONFIG_SND_SOC_CPE 1
#define CONFIG_SND_SOC_SDM660_CDC 1 #define CONFIG_SND_SOC_SDM660_CDC 1
#define CONFIG_SND_SOC_ANALOG_CDC 1 #define CONFIG_SND_SOC_ANALOG_CDC 1
#define CONFIG_SND_SOC_DIGITAL_CDC 1 #define CONFIG_SND_SOC_DIGITAL_CDC 1

86
dsp/Android.mk Normal file
View File

@@ -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

149
dsp/Kbuild Normal file
View File

@@ -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')\"

View File

@@ -63,7 +63,7 @@
/* Unexpected error code. */ /* Unexpected error code. */
#define ADSP_ERR_MAX_STR "ADSP_ERR_MAX" #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; static bool adsp_err_panic;
#ifdef CONFIG_DEBUG_FS #ifdef CONFIG_DEBUG_FS
@@ -123,7 +123,7 @@ static struct adsp_err_code adsp_err_code_info[ADSP_ERR_MAX+1] = {
{ -EADV, ADSP_ERR_MAX_STR}, { -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) static inline void adsp_err_check_panic(u32 adsp_error)
{ {
if (adsp_err_panic && adsp_error != ADSP_EALREADY) if (adsp_err_panic && adsp_error != ADSP_EALREADY)
@@ -151,8 +151,8 @@ char *adsp_err_get_err_str(u32 adsp_error)
return adsp_err_code_info[adsp_error].adsp_err_str; return adsp_err_code_info[adsp_error].adsp_err_str;
} }
#if defined(CONFIG_SND_SOC_QDSP_DEBUG) && defined(CONFIG_DEBUG_FS) #if IS_ENABLED(CONFIG_SND_SOC_QDSP_DEBUG) && defined(CONFIG_DEBUG_FS)
static int __init adsp_err_init(void) int __init adsp_err_init(void)
{ {
@@ -162,6 +162,12 @@ static int __init adsp_err_init(void)
return 0; return 0;
} }
#else
int __init adsp_err_init(void) { return 0; }
device_initcall(adsp_err_init);
#endif #endif
void __exit adsp_err_exit(void)
{
return;
}

View File

@@ -481,6 +481,14 @@ done:
return; 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, void cal_utils_destroy_cal_types(int num_cal_types,
struct cal_type_data **cal_type) struct cal_type_data **cal_type)
{ {
@@ -506,6 +514,7 @@ void cal_utils_destroy_cal_types(int num_cal_types,
done: done:
return; return;
} }
EXPORT_SYMBOL(cal_utils_destroy_cal_types);
/** /**
* cal_utils_get_only_cal_block * cal_utils_get_only_cal_block

View File

@@ -593,7 +593,7 @@ struct miscdevice audio_cal_misc = {
.fops = &audio_cal_fops, .fops = &audio_cal_fops,
}; };
static int __init audio_cal_init(void) int __init audio_cal_init(void)
{ {
int i = 0; int i = 0;
@@ -609,7 +609,7 @@ static int __init audio_cal_init(void)
return misc_register(&audio_cal_misc); return misc_register(&audio_cal_misc);
} }
static void __exit audio_cal_exit(void) void __exit audio_cal_exit(void)
{ {
int i = 0; int i = 0;
struct list_head *ptr, *next; struct list_head *ptr, *next;
@@ -627,10 +627,9 @@ static void __exit audio_cal_exit(void)
client_info_node = NULL; 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_DESCRIPTION("SoC QDSP6v2 Audio Calibration driver");
MODULE_LICENSE("GPL v2"); MODULE_LICENSE("GPL v2");

View File

@@ -12,7 +12,6 @@
#include <linux/module.h> #include <linux/module.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <soc/qcom/scm.h>
#include <soc/qcom/subsystem_notif.h> #include <soc/qcom/subsystem_notif.h>
#include <soc/qcom/service-notifier.h> #include <soc/qcom/service-notifier.h>
#include <dsp/audio_notifier.h> #include <dsp/audio_notifier.h>
@@ -489,9 +488,6 @@ static int audio_notifer_pdr_adsp_cb(struct notifier_block *this,
static int audio_notifer_ssr_adsp_cb(struct notifier_block *this, static int audio_notifer_ssr_adsp_cb(struct notifier_block *this,
unsigned long opcode, void *data) unsigned long opcode, void *data)
{ {
if (opcode == SUBSYS_BEFORE_SHUTDOWN)
audio_ssr_send_nmi(data);
return audio_notifer_service_cb(opcode, return audio_notifer_service_cb(opcode,
AUDIO_NOTIFIER_SSR_SERVICE, AUDIO_NOTIFIER_SSR_SERVICE,
AUDIO_NOTIFIER_ADSP_DOMAIN); AUDIO_NOTIFIER_ADSP_DOMAIN);
@@ -602,23 +598,6 @@ static int __init audio_notifier_subsys_init(void)
return 0; 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) static int __init audio_notifier_late_init(void)
{ {
@@ -633,4 +612,32 @@ static int __init audio_notifier_late_init(void)
mutex_unlock(&notifier_mutex); mutex_unlock(&notifier_mutex);
return 0; 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");

View File

@@ -63,6 +63,14 @@ static struct notifier_block audio_pdr_locator_nb = {
.priority = 0, .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) int audio_pdr_register(struct notifier_block *nb)
{ {
if (nb == NULL) { if (nb == NULL) {
@@ -73,6 +81,24 @@ int audio_pdr_register(struct notifier_block *nb)
} }
EXPORT_SYMBOL(audio_pdr_register); 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, void *audio_pdr_service_register(int domain_id,
struct notifier_block *nb, int *curr_state) struct notifier_block *nb, int *curr_state)
{ {
@@ -125,12 +151,13 @@ static int __init audio_pdr_subsys_init(void)
srcu_init_notifier_head(&audio_pdr_cb_list); srcu_init_notifier_head(&audio_pdr_cb_list);
return 0; return 0;
} }
subsys_initcall(audio_pdr_subsys_init);
static int __init audio_pdr_late_init(void) static int __init audio_pdr_late_init(void)
{ {
int ret; int ret;
audio_pdr_subsys_init();
ret = get_service_location( ret = get_service_location(
audio_pdr_services[AUDIO_PDR_DOMAIN_ADSP].client_name, audio_pdr_services[AUDIO_PDR_DOMAIN_ADSP].client_name,
audio_pdr_services[AUDIO_PDR_DOMAIN_ADSP].service_name, audio_pdr_services[AUDIO_PDR_DOMAIN_ADSP].service_name,
@@ -144,4 +171,12 @@ static int __init audio_pdr_late_init(void)
return ret; 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");

View File

@@ -41,6 +41,7 @@ enum {
* Failure: Error code * Failure: Error code
*/ */
int audio_pdr_register(struct notifier_block *nb); 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 * Use audio_pdr_service_register to register with a PDR service

View File

@@ -160,17 +160,15 @@ static struct slim_driver audio_slimslave_driver = {
.suspend = audio_slimslave_suspend, .suspend = audio_slimslave_suspend,
}; };
static int __init audio_slimslave_init(void) int __init audio_slimslave_init(void)
{ {
return slim_driver_register(&audio_slimslave_driver); 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 information */
MODULE_DESCRIPTION("Audio side Slimbus slave driver"); MODULE_DESCRIPTION("Audio side Slimbus slave driver");

View File

@@ -11,18 +11,24 @@
*/ */
#include <linux/module.h> #include <linux/module.h>
#include <soc/qcom/scm.h>
#include <soc/qcom/subsystem_restart.h> #include <soc/qcom/subsystem_restart.h>
#include <soc/qcom/subsystem_notif.h> #include <soc/qcom/subsystem_notif.h>
#include "audio_ssr.h" #include "audio_ssr.h"
#define SCM_Q6_NMI_CMD 0x1
static char *audio_ssr_domains[] = { static char *audio_ssr_domains[] = {
"adsp", "adsp",
"modem" "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) void *audio_ssr_register(int domain_id, struct notifier_block *nb)
{ {
if ((domain_id < 0) || if ((domain_id < 0) ||
@@ -36,31 +42,18 @@ void *audio_ssr_register(int domain_id, struct notifier_block *nb)
} }
EXPORT_SYMBOL(audio_ssr_register); 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) int audio_ssr_deregister(void *handle, struct notifier_block *nb)
{ {
return subsys_notif_unregister_notifier(handle, nb); return subsys_notif_unregister_notifier(handle, nb);
} }
EXPORT_SYMBOL(audio_ssr_deregister); 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);

View File

@@ -517,7 +517,7 @@ static struct platform_driver dev_avtimer_driver = {
}, },
}; };
static int __init avtimer_init(void) int __init avtimer_init(void)
{ {
s32 rc; s32 rc;
@@ -535,14 +535,10 @@ error_platform_driver:
return rc; 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); platform_driver_unregister(&dev_avtimer_driver);
} }
module_init(avtimer_init);
module_exit(avtimer_exit);
MODULE_DESCRIPTION("avtimer driver"); MODULE_DESCRIPTION("avtimer driver");
MODULE_LICENSE("GPL v2"); MODULE_LICENSE("GPL v2");

54
dsp/codecs/Android.mk Normal file
View File

@@ -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

133
dsp/codecs/Kbuild Normal file
View File

@@ -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')\"

View File

@@ -702,8 +702,12 @@ struct miscdevice audio_aac_in_misc = {
.fops = &audio_in_fops, .fops = &audio_in_fops,
}; };
static int __init aac_in_init(void) int __init aac_in_init(void)
{ {
return misc_register(&audio_aac_in_misc); return misc_register(&audio_aac_in_misc);
} }
device_initcall(aac_in_init);
void __exit aac_in_exit(void)
{
misc_deregister(&audio_aac_in_misc);
}

View File

@@ -394,9 +394,12 @@ struct miscdevice audio_amrnb_in_misc = {
.fops = &audio_in_fops, .fops = &audio_in_fops,
}; };
static int __init amrnb_in_init(void) int __init amrnb_in_init(void)
{ {
return misc_register(&audio_amrnb_in_misc); return misc_register(&audio_amrnb_in_misc);
} }
device_initcall(amrnb_in_init); void __exit amrnb_in_exit(void)
{
misc_deregister(&audio_amrnb_in_misc);
}

View File

@@ -392,9 +392,12 @@ struct miscdevice audio_amrwb_in_misc = {
.fops = &audio_in_fops, .fops = &audio_in_fops,
}; };
static int __init amrwb_in_init(void) int __init amrwb_in_init(void)
{ {
return misc_register(&audio_amrwb_in_misc); return misc_register(&audio_amrwb_in_misc);
} }
device_initcall(amrwb_in_init); void __exit amrwb_in_exit(void)
{
misc_deregister(&audio_amrwb_in_misc);
}

View File

@@ -461,7 +461,7 @@ static struct miscdevice audio_aac_misc = {
.fops = &audio_aac_fops, .fops = &audio_aac_fops,
}; };
static int __init audio_aac_init(void) int __init audio_aac_init(void)
{ {
int ret = misc_register(&audio_aac_misc); int ret = misc_register(&audio_aac_misc);
@@ -473,4 +473,8 @@ static int __init audio_aac_init(void)
return ret; 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);
}

View File

@@ -420,7 +420,7 @@ static struct miscdevice audio_alac_misc = {
.fops = &audio_alac_fops, .fops = &audio_alac_fops,
}; };
static int __init audio_alac_init(void) int __init audio_alac_init(void)
{ {
int ret = misc_register(&audio_alac_misc); int ret = misc_register(&audio_alac_misc);
@@ -432,4 +432,8 @@ static int __init audio_alac_init(void)
return ret; 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);
}

View File

@@ -211,7 +211,7 @@ static struct miscdevice audio_amrnb_misc = {
.fops = &audio_amrnb_fops, .fops = &audio_amrnb_fops,
}; };
static int __init audio_amrnb_init(void) int __init audio_amrnb_init(void)
{ {
int ret = misc_register(&audio_amrnb_misc); int ret = misc_register(&audio_amrnb_misc);
@@ -223,4 +223,8 @@ static int __init audio_amrnb_init(void)
return ret; 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);
}

View File

@@ -216,7 +216,7 @@ static struct miscdevice audio_amrwb_misc = {
.fops = &audio_amrwb_fops, .fops = &audio_amrwb_fops,
}; };
static int __init audio_amrwb_init(void) int __init audio_amrwb_init(void)
{ {
int ret = misc_register(&audio_amrwb_misc); int ret = misc_register(&audio_amrwb_misc);
@@ -228,4 +228,8 @@ static int __init audio_amrwb_init(void)
return ret; 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);
}

View File

@@ -382,7 +382,7 @@ static struct miscdevice audio_amrwbplus_misc = {
.fops = &audio_amrwbplus_fops, .fops = &audio_amrwbplus_fops,
}; };
static int __init audio_amrwbplus_init(void) int __init audio_amrwbplus_init(void)
{ {
int ret = misc_register(&audio_amrwbplus_misc); int ret = misc_register(&audio_amrwbplus_misc);
@@ -394,4 +394,8 @@ static int __init audio_amrwbplus_init(void)
return ret; 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);
}

View File

@@ -344,7 +344,7 @@ static struct miscdevice audio_ape_misc = {
.fops = &audio_ape_fops, .fops = &audio_ape_fops,
}; };
static int __init audio_ape_init(void) int __init audio_ape_init(void)
{ {
int ret = misc_register(&audio_ape_misc); int ret = misc_register(&audio_ape_misc);
@@ -356,4 +356,8 @@ static int __init audio_ape_init(void)
return ret; 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);
}

View File

@@ -169,7 +169,7 @@ static struct miscdevice audio_evrc_misc = {
.fops = &audio_evrc_fops, .fops = &audio_evrc_fops,
}; };
static int __init audio_evrc_init(void) int __init audio_evrc_init(void)
{ {
int ret = misc_register(&audio_evrc_misc); int ret = misc_register(&audio_evrc_misc);
@@ -181,4 +181,8 @@ static int __init audio_evrc_init(void)
return ret; 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);
}

View File

@@ -375,7 +375,7 @@ static struct miscdevice audio_g711alaw_misc = {
.fops = &audio_g711_fops, .fops = &audio_g711_fops,
}; };
static int __init audio_g711alaw_init(void) int __init audio_g711alaw_init(void)
{ {
int ret = misc_register(&audio_g711alaw_misc); int ret = misc_register(&audio_g711alaw_misc);
@@ -386,11 +386,9 @@ static int __init audio_g711alaw_init(void)
return ret; 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); void __exit audio_g711alaw_exit(void)
__exitcall(audio_g711alaw_exit); {
mutex_destroy(&audio_g711_ws_mgr.ws_lock);
misc_deregister(&audio_g711alaw_misc);
}

View File

@@ -374,7 +374,7 @@ static struct miscdevice audio_g711mlaw_misc = {
.fops = &audio_g711_fops, .fops = &audio_g711_fops,
}; };
static int __init audio_g711mlaw_init(void) int __init audio_g711mlaw_init(void)
{ {
int ret = misc_register(&audio_g711mlaw_misc); int ret = misc_register(&audio_g711mlaw_misc);
@@ -386,11 +386,9 @@ static int __init audio_g711mlaw_init(void)
return ret; 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); mutex_destroy(&audio_g711_ws_mgr.ws_lock);
misc_deregister(&audio_g711mlaw_misc);
} }
device_initcall(audio_g711mlaw_init);
__exitcall(audio_g711mlaw_exit);

View File

@@ -768,11 +768,15 @@ struct miscdevice audio_effects_misc = {
.fops = &audio_effects_fops, .fops = &audio_effects_fops,
}; };
static int __init audio_effects_init(void) int __init audio_effects_init(void)
{ {
return misc_register(&audio_effects_misc); 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_DESCRIPTION("Audio hardware accelerated effects driver");
MODULE_LICENSE("GPL v2"); MODULE_LICENSE("GPL v2");

View File

@@ -173,7 +173,7 @@ static struct miscdevice audio_mp3_misc = {
.fops = &audio_mp3_fops, .fops = &audio_mp3_fops,
}; };
static int __init audio_mp3_init(void) int __init audio_mp3_init(void)
{ {
int ret = misc_register(&audio_mp3_misc); int ret = misc_register(&audio_mp3_misc);
@@ -185,4 +185,8 @@ static int __init audio_mp3_init(void)
return ret; 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);
}

View File

@@ -508,7 +508,7 @@ static struct miscdevice audio_multiaac_misc = {
.fops = &audio_aac_fops, .fops = &audio_aac_fops,
}; };
static int __init audio_aac_init(void) int __init audio_multiaac_init(void)
{ {
int ret = misc_register(&audio_multiaac_misc); int ret = misc_register(&audio_multiaac_misc);
@@ -520,4 +520,8 @@ static int __init audio_aac_init(void)
return ret; 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);
}

75
dsp/codecs/audio_native.c Normal file
View File

@@ -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");

View File

@@ -176,7 +176,7 @@ static struct miscdevice audio_qcelp_misc = {
.fops = &audio_qcelp_fops, .fops = &audio_qcelp_fops,
}; };
static int __init audio_qcelp_init(void) int audio_qcelp_init(void)
{ {
int ret = misc_register(&audio_qcelp_misc); int ret = misc_register(&audio_qcelp_misc);
@@ -188,4 +188,8 @@ static int __init audio_qcelp_init(void)
return ret; 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);
}

View File

@@ -112,3 +112,47 @@ ssize_t audio_in_write(struct file *file, const char __user *buf,
size_t count, loff_t *pos); size_t count, loff_t *pos);
int audio_in_release(struct inode *inode, struct file *file); int audio_in_release(struct inode *inode, struct file *file);
int audio_in_set_config(struct file *file, struct msm_audio_config *cfg); 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);

View File

@@ -330,7 +330,7 @@ static struct miscdevice audio_wma_misc = {
.fops = &audio_wma_fops, .fops = &audio_wma_fops,
}; };
static int __init audio_wma_init(void) int __init audio_wma_init(void)
{ {
int ret = misc_register(&audio_wma_misc); int ret = misc_register(&audio_wma_misc);
@@ -342,4 +342,8 @@ static int __init audio_wma_init(void)
return ret; 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);
}

View File

@@ -403,7 +403,7 @@ static struct miscdevice audio_wmapro_misc = {
.fops = &audio_wmapro_fops, .fops = &audio_wmapro_fops,
}; };
static int __init audio_wmapro_init(void) int __init audio_wmapro_init(void)
{ {
int ret = misc_register(&audio_wmapro_misc); int ret = misc_register(&audio_wmapro_misc);
@@ -415,4 +415,8 @@ static int __init audio_wmapro_init(void)
return ret; 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);
}

View File

@@ -402,9 +402,12 @@ struct miscdevice audio_evrc_in_misc = {
.fops = &audio_in_fops, .fops = &audio_in_fops,
}; };
static int __init evrc_in_init(void) int __init evrc_in_init(void)
{ {
return misc_register(&audio_evrc_in_misc); return misc_register(&audio_evrc_in_misc);
} }
device_initcall(evrc_in_init); void __exit evrc_in_exit(void)
{
misc_deregister(&audio_evrc_in_misc);
}

View File

@@ -374,9 +374,12 @@ struct miscdevice audio_g711alaw_in_misc = {
.fops = &audio_in_fops, .fops = &audio_in_fops,
}; };
static int __init g711alaw_in_init(void) int __init g711alaw_in_init(void)
{ {
return misc_register(&audio_g711alaw_in_misc); return misc_register(&audio_g711alaw_in_misc);
} }
device_initcall(g711alaw_in_init); void __exit g711alaw_in_exit(void)
{
misc_deregister(&audio_g711alaw_in_misc);
}

View File

@@ -377,9 +377,12 @@ struct miscdevice audio_g711mlaw_in_misc = {
.fops = &audio_in_fops, .fops = &audio_in_fops,
}; };
static int __init g711mlaw_in_init(void) int __init g711mlaw_in_init(void)
{ {
return misc_register(&audio_g711mlaw_in_misc); return misc_register(&audio_g711mlaw_in_misc);
} }
device_initcall(g711mlaw_in_init); void __exit g711mlaw_in_exit(void)
{
misc_deregister(&audio_g711mlaw_in_misc);
}

View File

@@ -402,9 +402,12 @@ struct miscdevice audio_qcelp_in_misc = {
.fops = &audio_in_fops, .fops = &audio_in_fops,
}; };
static int __init qcelp_in_init(void) int __init qcelp_in_init(void)
{ {
return misc_register(&audio_qcelp_in_misc); return misc_register(&audio_qcelp_in_misc);
} }
device_initcall(qcelp_in_init); void __exit qcelp_in_exit(void)
{
misc_deregister(&audio_qcelp_in_misc);
}

View File

@@ -18,10 +18,9 @@
#include <linux/atomic.h> #include <linux/atomic.h>
#include <sound/asound.h> #include <sound/asound.h>
#include <sound/control.h> #include <sound/control.h>
#include <asoc/msm-dts-srs-tm-config.h>
#include <dsp/msm_audio_ion.h> #include <dsp/msm_audio_ion.h>
#include <dsp/q6adm-v2.h> #include <dsp/q6adm-v2.h>
#include "msm-pcm-routing-v2.h" #include <dsp/msm-dts-srs-tm-config.h>
static int srs_port_id[AFE_MAX_PORTS] = {-1}; static int srs_port_id[AFE_MAX_PORTS] = {-1};
static int srs_copp_idx[AFE_MAX_PORTS] = {-1}; static int srs_copp_idx[AFE_MAX_PORTS] = {-1};
@@ -142,10 +141,10 @@ static int msm_dts_srs_trumedia_control_set(struct snd_kcontrol *kcontrol,
int ret, port_id; int ret, port_id;
pr_debug("SRS control normal called\n"); pr_debug("SRS control normal called\n");
msm_pcm_routing_acquire_lock(); msm_dts_srs_acquire_lock();
port_id = SLIMBUS_0_RX; port_id = SLIMBUS_0_RX;
ret = msm_dts_srs_trumedia_control_set_(port_id, kcontrol, ucontrol); ret = msm_dts_srs_trumedia_control_set_(port_id, kcontrol, ucontrol);
msm_pcm_routing_release_lock(); msm_dts_srs_release_lock();
return ret; return ret;
} }
@@ -155,10 +154,10 @@ static int msm_dts_srs_trumedia_control_i2s_set(struct snd_kcontrol *kcontrol,
int ret, port_id; int ret, port_id;
pr_debug("SRS control I2S called\n"); pr_debug("SRS control I2S called\n");
msm_pcm_routing_acquire_lock(); msm_dts_srs_acquire_lock();
port_id = PRIMARY_I2S_RX; port_id = PRIMARY_I2S_RX;
ret = msm_dts_srs_trumedia_control_set_(port_id, kcontrol, ucontrol); ret = msm_dts_srs_trumedia_control_set_(port_id, kcontrol, ucontrol);
msm_pcm_routing_release_lock(); msm_dts_srs_release_lock();
return ret; return ret;
} }
@@ -168,10 +167,10 @@ static int msm_dts_srs_trumedia_control_mi2s_set(struct snd_kcontrol *kcontrol,
int ret, port_id; int ret, port_id;
pr_debug("SRS control MI2S called\n"); pr_debug("SRS control MI2S called\n");
msm_pcm_routing_acquire_lock(); msm_dts_srs_acquire_lock();
port_id = AFE_PORT_ID_PRIMARY_MI2S_RX; port_id = AFE_PORT_ID_PRIMARY_MI2S_RX;
ret = msm_dts_srs_trumedia_control_set_(port_id, kcontrol, ucontrol); ret = msm_dts_srs_trumedia_control_set_(port_id, kcontrol, ucontrol);
msm_pcm_routing_release_lock(); msm_dts_srs_release_lock();
return ret; return ret;
} }
@@ -181,10 +180,10 @@ static int msm_dts_srs_trumedia_control_hdmi_set(struct snd_kcontrol *kcontrol,
int ret, port_id; int ret, port_id;
pr_debug("SRS control HDMI called\n"); pr_debug("SRS control HDMI called\n");
msm_pcm_routing_acquire_lock(); msm_dts_srs_acquire_lock();
port_id = HDMI_RX; port_id = HDMI_RX;
ret = msm_dts_srs_trumedia_control_set_(port_id, kcontrol, ucontrol); ret = msm_dts_srs_trumedia_control_set_(port_id, kcontrol, ucontrol);
msm_pcm_routing_release_lock(); msm_dts_srs_release_lock();
return ret; return ret;
} }
@@ -270,6 +269,13 @@ static const struct snd_kcontrol_new lpa_srs_trumedia_controls_mi2s[] = {
} }
}; };
/**
* 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) void msm_dts_srs_tm_add_controls(struct snd_soc_platform *platform)
{ {
snd_soc_add_platform_controls(platform, snd_soc_add_platform_controls(platform,
@@ -287,6 +293,7 @@ void msm_dts_srs_tm_add_controls(struct snd_soc_platform *platform)
lpa_srs_trumedia_controls_mi2s, lpa_srs_trumedia_controls_mi2s,
ARRAY_SIZE(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) static int reg_ion_mem(void)
{ {
@@ -322,6 +329,13 @@ static void unreg_ion_mem(void)
po.size = 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) void msm_dts_srs_tm_deinit(int port_id)
{ {
set_port_id(port_id, -1); set_port_id(port_id, -1);
@@ -333,7 +347,16 @@ void msm_dts_srs_tm_deinit(int port_id)
} }
} }
} }
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) void msm_dts_srs_tm_init(int port_id, int copp_idx)
{ {
int cur_ref_cnt = 0; int cur_ref_cnt = 0;
@@ -355,3 +378,4 @@ void msm_dts_srs_tm_init(int port_id, int copp_idx)
} }
msm_dts_srs_tm_send_params(port_id, 1); msm_dts_srs_tm_send_params(port_id, 1);
} }
EXPORT_SYMBOL(msm_dts_srs_tm_init);

View File

@@ -89,6 +89,20 @@ static void msm_audio_ion_add_allocation(
mutex_unlock(&(msm_audio_ion_data->list_mutex)); 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, int msm_audio_ion_alloc(const char *name, struct ion_client **client,
struct ion_handle **handle, size_t bufsz, struct ion_handle **handle, size_t bufsz,
ion_phys_addr_t *paddr, size_t *pa_len, void **vaddr) ion_phys_addr_t *paddr, size_t *pa_len, void **vaddr)
@@ -243,6 +257,15 @@ err:
return rc; 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) int msm_audio_ion_free(struct ion_client *client, struct ion_handle *handle)
{ {
if (!client || !handle) { if (!client || !handle) {
@@ -260,6 +283,15 @@ int msm_audio_ion_free(struct ion_client *client, struct ion_handle *handle)
} }
EXPORT_SYMBOL(msm_audio_ion_free); 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, int msm_audio_ion_mmap(struct audio_buffer *ab,
struct vm_area_struct *vma) struct vm_area_struct *vma)
{ {
@@ -351,6 +383,7 @@ int msm_audio_ion_mmap(struct audio_buffer *ab,
} }
return 0; return 0;
} }
EXPORT_SYMBOL(msm_audio_ion_mmap);
bool msm_audio_ion_is_smmu_available(void) bool msm_audio_ion_is_smmu_available(void)
@@ -366,8 +399,15 @@ struct ion_client *msm_audio_ion_client_create(const char *name)
pclient = msm_ion_client_create(name); pclient = msm_ion_client_create(name);
return pclient; 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) void msm_audio_ion_client_destroy(struct ion_client *client)
{ {
pr_debug("%s: client = %pK smmu_enabled = %d\n", __func__, pr_debug("%s: client = %pK smmu_enabled = %d\n", __func__,
@@ -375,7 +415,24 @@ void msm_audio_ion_client_destroy(struct ion_client *client)
ion_client_destroy(client); 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, int msm_audio_ion_import_legacy(const char *name, struct ion_client *client,
struct ion_handle **handle, int fd, struct ion_handle **handle, int fd,
unsigned long *ionflag, size_t bufsz, unsigned long *ionflag, size_t bufsz,
@@ -438,7 +495,16 @@ err_ion_handle:
err: err:
return rc; 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, int msm_audio_ion_free_legacy(struct ion_client *client,
struct ion_handle *handle) struct ion_handle *handle)
{ {
@@ -451,6 +517,7 @@ int msm_audio_ion_free_legacy(struct ion_client *client,
/* no client_destrody in legacy*/ /* no client_destrody in legacy*/
return 0; return 0;
} }
EXPORT_SYMBOL(msm_audio_ion_free_legacy);
int msm_audio_ion_cache_operations(struct audio_buffer *abuff, int cache_op) int msm_audio_ion_cache_operations(struct audio_buffer *abuff, int cache_op)
{ {
@@ -710,6 +777,13 @@ u32 msm_audio_ion_get_smmu_sid_mode32(void)
return 0; 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) u32 msm_audio_populate_upper_32_bits(ion_phys_addr_t pa)
{ {
if (sizeof(ion_phys_addr_t) == sizeof(u32)) if (sizeof(ion_phys_addr_t) == sizeof(u32))
@@ -717,6 +791,7 @@ u32 msm_audio_populate_upper_32_bits(ion_phys_addr_t pa)
else else
return upper_32_bits(pa); return upper_32_bits(pa);
} }
EXPORT_SYMBOL(msm_audio_populate_upper_32_bits);
static int msm_audio_ion_probe(struct platform_device *pdev) static int msm_audio_ion_probe(struct platform_device *pdev)
{ {
@@ -837,17 +912,15 @@ static struct platform_driver msm_audio_ion_driver = {
.remove = msm_audio_ion_remove, .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); 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); platform_driver_unregister(&msm_audio_ion_driver);
} }
module_exit(msm_audio_ion_exit);
MODULE_DESCRIPTION("MSM Audio ION module"); MODULE_DESCRIPTION("MSM Audio ION module");
MODULE_LICENSE("GPL v2"); MODULE_LICENSE("GPL v2");

55
dsp/q6_init.c Normal file
View File

@@ -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");

43
dsp/q6_init.h Normal file
View File

@@ -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

View File

@@ -18,7 +18,7 @@
#include <linux/atomic.h> #include <linux/atomic.h>
#include <linux/wait.h> #include <linux/wait.h>
#include <sound/asound.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/apr_audio-v2.h>
#include <dsp/q6adm-v2.h> #include <dsp/q6adm-v2.h>
#include <dsp/q6audio-v2.h> #include <dsp/q6audio-v2.h>
@@ -127,7 +127,26 @@ static struct adm_multi_ch_map multi_ch_maps[2] = {
static int adm_get_parameters[MAX_COPPS_PER_PORT * ADM_GET_PARAMETER_LENGTH]; static int adm_get_parameters[MAX_COPPS_PER_PORT * ADM_GET_PARAMETER_LENGTH];
static int adm_module_topo_list[ static int adm_module_topo_list[
MAX_COPPS_PER_PORT * ADM_GET_TOPO_MODULE_LIST_LENGTH]; 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 adm_validate_and_get_port_index(int port_id)
{ {
int index; int index;
@@ -150,7 +169,16 @@ int adm_validate_and_get_port_index(int port_id)
pr_debug("%s: port_idx- %d\n", __func__, index); pr_debug("%s: port_idx- %d\n", __func__, index);
return 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 adm_get_default_copp_idx(int port_id)
{ {
int port_idx = adm_validate_and_get_port_index(port_id), idx; int port_idx = adm_validate_and_get_port_index(port_id), idx;
@@ -167,6 +195,7 @@ int adm_get_default_copp_idx(int port_id)
} }
return -EINVAL; return -EINVAL;
} }
EXPORT_SYMBOL(adm_get_default_copp_idx);
int adm_get_topology_for_port_from_copp_id(int port_id, int copp_id) int adm_get_topology_for_port_from_copp_id(int port_id, int copp_id)
{ {
@@ -185,6 +214,15 @@ int adm_get_topology_for_port_from_copp_id(int port_id, int copp_id)
return 0; 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 adm_get_topology_for_port_copp_idx(int port_id, int copp_idx)
{ {
int port_idx = adm_validate_and_get_port_index(port_id); int port_idx = adm_validate_and_get_port_index(port_id);
@@ -196,6 +234,7 @@ int adm_get_topology_for_port_copp_idx(int port_id, int copp_idx)
} }
return atomic_read(&this_adm.copp.topology[port_idx][copp_idx]); 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) int adm_get_indexes_from_copp_id(int copp_id, int *copp_idx, int *port_idx)
{ {
@@ -264,6 +303,17 @@ static int adm_get_next_available_copp(int port_idx)
return idx; 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, int srs_trumedia_open(int port_id, int copp_idx, __s32 srs_tech_id,
void *srs_params) void *srs_params)
{ {
@@ -529,6 +579,7 @@ fail_cmd:
kfree(adm_params); kfree(adm_params);
return ret; return ret;
} }
EXPORT_SYMBOL(srs_trumedia_open);
static int adm_populate_channel_weight(u16 *ptr, static int adm_populate_channel_weight(u16 *ptr,
struct msm_pcm_channel_mixer *ch_mixer, struct msm_pcm_channel_mixer *ch_mixer,
@@ -790,7 +841,20 @@ fail_cmd:
return ret; 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, int adm_set_stereo_to_custom_stereo(int port_id, int copp_idx,
unsigned int session_id, char *params, unsigned int session_id, char *params,
uint32_t params_length) uint32_t params_length)
@@ -876,7 +940,19 @@ set_stereo_to_custom_stereo_return:
kfree(adm_params); kfree(adm_params);
return rc; 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, int adm_dolby_dap_send_params(int port_id, int copp_idx, char *params,
uint32_t params_length) uint32_t params_length)
{ {
@@ -951,7 +1027,19 @@ dolby_dap_send_param_return:
kfree(adm_params); kfree(adm_params);
return rc; 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, int adm_send_params_v5(int port_id, int copp_idx, char *params,
uint32_t params_length) uint32_t params_length)
{ {
@@ -1026,6 +1114,7 @@ send_param_return:
kfree(adm_params); kfree(adm_params);
return rc; return rc;
} }
EXPORT_SYMBOL(adm_send_params_v5);
int adm_get_params_v2(int port_id, int copp_idx, uint32_t module_id, int adm_get_params_v2(int port_id, int copp_idx, uint32_t module_id,
uint32_t param_id, uint32_t params_length, uint32_t param_id, uint32_t params_length,
@@ -1142,13 +1231,38 @@ adm_get_param_return:
return rc; 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, int adm_get_params(int port_id, int copp_idx, uint32_t module_id,
uint32_t param_id, uint32_t params_length, char *params) uint32_t param_id, uint32_t params_length, char *params)
{ {
return adm_get_params_v2(port_id, copp_idx, module_id, param_id, return adm_get_params_v2(port_id, copp_idx, module_id, param_id,
params_length, params, 0); 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, int adm_get_pp_topo_module_list(int port_id, int copp_idx, int32_t param_length,
char *params) char *params)
{ {
@@ -1245,6 +1359,8 @@ adm_pp_module_list_l:
pr_debug("%s : rc = %d ", __func__, rc); pr_debug("%s : rc = %d ", __func__, rc);
return rc; return rc;
} }
EXPORT_SYMBOL(adm_get_pp_topo_module_list);
static void adm_callback_debug_print(struct apr_client_data *data) static void adm_callback_debug_print(struct apr_client_data *data)
{ {
uint32_t *payload; uint32_t *payload;
@@ -1264,6 +1380,15 @@ static void adm_callback_debug_print(struct apr_client_data *data)
__func__, data->opcode, data->payload_size); __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 adm_set_multi_ch_map(char *channel_map, int path)
{ {
int idx; int idx;
@@ -1283,7 +1408,17 @@ int adm_set_multi_ch_map(char *channel_map, int path)
return 0; 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 adm_get_multi_ch_map(char *channel_map, int path)
{ {
int idx; int idx;
@@ -1304,6 +1439,7 @@ int adm_get_multi_ch_map(char *channel_map, int path)
return 0; return 0;
} }
EXPORT_SYMBOL(adm_get_multi_ch_map);
static int32_t adm_callback(struct apr_client_data *data, void *priv) static int32_t adm_callback(struct apr_client_data *data, void *priv)
{ {
@@ -2170,6 +2306,16 @@ static void send_adm_cal(int port_id, int copp_idx, int path, int perf_mode,
app_type, acdb_id, sample_rate); 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) int adm_connect_afe_port(int mode, int session_id, int port_id)
{ {
struct adm_cmd_connect_afe_port_v5 cmd; struct adm_cmd_connect_afe_port_v5 cmd;
@@ -2249,6 +2395,7 @@ fail_cmd:
return ret; return ret;
} }
EXPORT_SYMBOL(adm_connect_afe_port);
int adm_arrange_mch_map(struct adm_cmd_device_open_v5 *open, int path, int adm_arrange_mch_map(struct adm_cmd_device_open_v5 *open, int path,
int channel_mode) int channel_mode)
@@ -2382,6 +2529,22 @@ int adm_arrange_mch_ep2_map(struct adm_cmd_device_open_v6 *open_v6,
return rc; 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 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) int perf_mode, uint16_t bit_width, int app_type, int acdb_id)
{ {
@@ -2621,7 +2784,17 @@ int adm_open(int port_id, int path, int rate, int channel_mode, int topology,
atomic_inc(&this_adm.copp.cnt[port_idx][copp_idx]); atomic_inc(&this_adm.copp.cnt[port_idx][copp_idx]);
return 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) void adm_copp_mfc_cfg(int port_id, int copp_idx, int dst_sample_rate)
{ {
struct audproc_mfc_output_media_fmt mfc_cfg; struct audproc_mfc_output_media_fmt mfc_cfg;
@@ -2723,6 +2896,7 @@ void adm_copp_mfc_cfg(int port_id, int copp_idx, int dst_sample_rate)
fail_cmd: fail_cmd:
return; return;
} }
EXPORT_SYMBOL(adm_copp_mfc_cfg);
static void route_set_opcode_matrix_id( static void route_set_opcode_matrix_id(
struct adm_cmd_matrix_map_routings_v5 **route_addr, struct adm_cmd_matrix_map_routings_v5 **route_addr,
@@ -2763,6 +2937,17 @@ static void route_set_opcode_matrix_id(
__func__, route->hdr.opcode, route->matrix_id); __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, int adm_matrix_map(int path, struct route_payload payload_map, int perf_mode,
uint32_t passthr_mode) uint32_t passthr_mode)
{ {
@@ -2892,34 +3077,69 @@ fail_cmd:
kfree(matrix_map); kfree(matrix_map);
return ret; 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) void adm_ec_ref_rx_id(int port_id)
{ {
this_adm.ec_ref_rx = port_id; this_adm.ec_ref_rx = port_id;
pr_debug("%s: ec_ref_rx:%d\n", __func__, this_adm.ec_ref_rx); 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) void adm_num_ec_ref_rx_chans(int num_chans)
{ {
this_adm.num_ec_ref_rx_chans = num_chans; this_adm.num_ec_ref_rx_chans = num_chans;
pr_debug("%s: num_ec_ref_rx_chans:%d\n", pr_debug("%s: num_ec_ref_rx_chans:%d\n",
__func__, this_adm.num_ec_ref_rx_chans); __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) void adm_ec_ref_rx_bit_width(int bit_width)
{ {
this_adm.ec_ref_rx_bit_width = bit_width; this_adm.ec_ref_rx_bit_width = bit_width;
pr_debug("%s: ec_ref_rx_bit_width:%d\n", pr_debug("%s: ec_ref_rx_bit_width:%d\n",
__func__, this_adm.ec_ref_rx_bit_width); __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) void adm_ec_ref_rx_sampling_rate(int sampling_rate)
{ {
this_adm.ec_ref_rx_sampling_rate = sampling_rate; this_adm.ec_ref_rx_sampling_rate = sampling_rate;
pr_debug("%s: ec_ref_rx_sampling_rate:%d\n", pr_debug("%s: ec_ref_rx_sampling_rate:%d\n",
__func__, this_adm.ec_ref_rx_sampling_rate); __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) int adm_close(int port_id, int perf_mode, int copp_idx)
{ {
struct apr_hdr close; struct apr_hdr close;
@@ -3053,6 +3273,7 @@ int adm_close(int port_id, int perf_mode, int copp_idx)
} }
return 0; return 0;
} }
EXPORT_SYMBOL(adm_close);
int send_rtac_audvol_cal(void) int send_rtac_audvol_cal(void)
{ {
@@ -3474,6 +3695,16 @@ err:
return ret; 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) int adm_set_volume(int port_id, int copp_idx, int volume)
{ {
struct audproc_volume_ctrl_master_gain audproc_vol; struct audproc_volume_ctrl_master_gain audproc_vol;
@@ -3552,7 +3783,18 @@ int adm_set_volume(int port_id, int copp_idx, int volume)
fail_cmd: fail_cmd:
return rc; 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, int adm_set_softvolume(int port_id, int copp_idx,
struct audproc_softvolume_params *softvol_param) struct audproc_softvolume_params *softvol_param)
{ {
@@ -3644,7 +3886,18 @@ int adm_set_softvolume(int port_id, int copp_idx,
fail_cmd: fail_cmd:
return rc; 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) int adm_set_mic_gain(int port_id, int copp_idx, int volume)
{ {
struct adm_set_mic_gain_params mic_gain_params; struct adm_set_mic_gain_params mic_gain_params;
@@ -3722,7 +3975,18 @@ int adm_set_mic_gain(int port_id, int copp_idx, int volume)
fail_cmd: fail_cmd:
return rc; 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 adm_send_set_multichannel_ec_primary_mic_ch(int port_id, int copp_idx,
int primary_mic_ch) int primary_mic_ch)
{ {
@@ -3810,7 +4074,19 @@ int adm_send_set_multichannel_ec_primary_mic_ch(int port_id, int copp_idx,
fail_cmd: fail_cmd:
return rc; 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) int adm_param_enable(int port_id, int copp_idx, int module_id, int enable)
{ {
struct audproc_enable_param_t adm_mod_enable; struct audproc_enable_param_t adm_mod_enable;
@@ -3896,7 +4172,22 @@ fail_cmd:
return rc; 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 adm_send_calibration(int port_id, int copp_idx, int path, int perf_mode,
int cal_type, char *params, int size) int cal_type, char *params, int size)
{ {
@@ -3988,6 +4279,7 @@ end:
kfree(adm_params); kfree(adm_params);
return rc; return rc;
} }
EXPORT_SYMBOL(adm_send_calibration);
/* /*
* adm_update_wait_parameters must be called with routing driver locks. * adm_update_wait_parameters must be called with routing driver locks.
@@ -4024,7 +4316,17 @@ end:
return ret; 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 adm_reset_wait_parameters(int port_id, int copp_idx)
{ {
int ret = 0, port_idx; int ret = 0, port_idx;
@@ -4050,7 +4352,18 @@ int adm_reset_wait_parameters(int port_id, int copp_idx)
end: end:
return ret; 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 adm_wait_timeout(int port_id, int copp_idx, int wait_time)
{ {
int ret = 0, port_idx; int ret = 0, port_idx;
@@ -4081,7 +4394,22 @@ end:
pr_debug("%s: return %d--\n", __func__, ret); pr_debug("%s: return %d--\n", __func__, ret);
return 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 adm_store_cal_data(int port_id, int copp_idx, int path, int perf_mode,
int cal_index, char *params, int *size) int cal_index, char *params, int *size)
{ {
@@ -4165,7 +4493,18 @@ unlock:
end: end:
return rc; 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) int adm_send_compressed_device_mute(int port_id, int copp_idx, bool mute_on)
{ {
struct adm_set_compressed_device_mute mute_params; struct adm_set_compressed_device_mute mute_params;
@@ -4242,7 +4581,18 @@ int adm_send_compressed_device_mute(int port_id, int copp_idx, bool mute_on)
end: end:
return ret; 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) int adm_send_compressed_device_latency(int port_id, int copp_idx, int latency)
{ {
struct adm_set_compressed_device_latency latency_params; struct adm_set_compressed_device_latency latency_params;
@@ -4319,6 +4669,7 @@ int adm_send_compressed_device_latency(int port_id, int copp_idx, int latency)
end: end:
return ret; return ret;
} }
EXPORT_SYMBOL(adm_send_compressed_device_latency);
/** /**
* adm_swap_speaker_channels * adm_swap_speaker_channels
@@ -4450,6 +4801,16 @@ done:
} }
EXPORT_SYMBOL(adm_swap_speaker_channels); 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, int adm_set_sound_focus(int port_id, int copp_idx,
struct sound_focus_param soundFocusData) struct sound_focus_param soundFocusData)
{ {
@@ -4559,7 +4920,18 @@ done:
return ret; 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, int adm_get_sound_focus(int port_id, int copp_idx,
struct sound_focus_param *soundFocusData) struct sound_focus_param *soundFocusData)
{ {
@@ -4623,6 +4995,7 @@ done:
return ret; return ret;
} }
EXPORT_SYMBOL(adm_get_sound_focus);
static int adm_source_tracking_alloc_map_memory(void) static int adm_source_tracking_alloc_map_memory(void)
{ {
@@ -4682,6 +5055,16 @@ done:
return ret; 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, int adm_get_source_tracking(int port_id, int copp_idx,
struct source_tracking_param *sourceTrackingData) struct source_tracking_param *sourceTrackingData)
{ {
@@ -4808,8 +5191,9 @@ done:
return ret; return ret;
} }
EXPORT_SYMBOL(adm_get_source_tracking);
static int __init adm_init(void) int __init adm_init(void)
{ {
int i = 0, j; int i = 0, j;
@@ -4857,14 +5241,13 @@ static int __init adm_init(void)
this_adm.sourceTrackingData.apr_cmd_status = -1; this_adm.sourceTrackingData.apr_cmd_status = -1;
atomic_set(&this_adm.mem_map_handles[ADM_MEM_MAP_INDEX_SOURCE_TRACKING], atomic_set(&this_adm.mem_map_handles[ADM_MEM_MAP_INDEX_SOURCE_TRACKING],
0); 0);
mutex_init(&dts_srs_lock);
return 0; return 0;
} }
static void __exit adm_exit(void) void __exit adm_exit(void)
{ {
mutex_destroy(&dts_srs_lock);
adm_delete_cal_data(); adm_delete_cal_data();
} }
device_initcall(adm_init);
module_exit(adm_exit);

View File

@@ -157,6 +157,13 @@ done:
return topology; 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) void afe_set_aanc_info(struct aanc_data *q6_aanc_info)
{ {
this_afe.aanc_info.aanc_active = q6_aanc_info->aanc_active; this_afe.aanc_info.aanc_active = q6_aanc_info->aanc_active;
@@ -169,6 +176,7 @@ void afe_set_aanc_info(struct aanc_data *q6_aanc_info)
this_afe.aanc_info.aanc_rx_port, this_afe.aanc_info.aanc_rx_port,
this_afe.aanc_info.aanc_tx_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) static void afe_callback_debug_print(struct apr_client_data *data)
{ {
@@ -457,6 +465,14 @@ static int32_t afe_callback(struct apr_client_data *data, void *priv)
return 0; 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 afe_get_port_type(u16 port_id)
{ {
int ret; int ret;
@@ -635,6 +651,7 @@ int afe_get_port_type(u16 port_id)
return ret; return ret;
} }
EXPORT_SYMBOL(afe_get_port_type);
int afe_sizeof_cfg_cmd(u16 port_id) int afe_sizeof_cfg_cmd(u16 port_id)
{ {
@@ -712,6 +729,12 @@ int afe_sizeof_cfg_cmd(u16 port_id)
return ret_size; 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 afe_q6_interface_prepare(void)
{ {
int ret = 0; int ret = 0;
@@ -729,6 +752,7 @@ int afe_q6_interface_prepare(void)
} }
return ret; return ret;
} }
EXPORT_SYMBOL(afe_q6_interface_prepare);
/* /*
* afe_apr_send_pkt : returns 0 on success, negative otherwise. * afe_apr_send_pkt : returns 0 on success, negative otherwise.
@@ -2059,6 +2083,15 @@ int afe_send_aanc_version(
return ret; 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 afe_port_set_mad_type(u16 port_id, enum afe_mad_type mad_type)
{ {
int i; int i;
@@ -2077,7 +2110,16 @@ int afe_port_set_mad_type(u16 port_id, enum afe_mad_type mad_type)
atomic_set(&afe_ports_mad_type[i], mad_type); atomic_set(&afe_ports_mad_type[i], mad_type);
return 0; 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) enum afe_mad_type afe_port_get_mad_type(u16 port_id)
{ {
int i; int i;
@@ -2093,7 +2135,19 @@ enum afe_mad_type afe_port_get_mad_type(u16 port_id)
} }
return (enum afe_mad_type) atomic_read(&afe_ports_mad_type[i]); 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 afe_set_config(enum afe_config_type config_type, void *config_data, int arg)
{ {
int ret; int ret;
@@ -2247,6 +2301,16 @@ fail_cmd:
return ret; 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 int afe_send_spdif_ch_status_cfg(struct afe_param_id_spdif_ch_status_cfg
*ch_status_cfg, u16 port_id) *ch_status_cfg, u16 port_id)
{ {
@@ -2326,6 +2390,7 @@ int afe_send_spdif_ch_status_cfg(struct afe_param_id_spdif_ch_status_cfg
fail_cmd: fail_cmd:
return ret; return ret;
} }
EXPORT_SYMBOL(afe_send_spdif_ch_status_cfg);
static int afe_send_cmd_port_start(u16 port_id) static int afe_send_cmd_port_start(u16 port_id)
{ {
@@ -2388,6 +2453,16 @@ fail_cmd:
return ret; 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, int afe_spdif_port_start(u16 port_id, struct afe_spdif_port_config *spdif_port,
u32 rate) u32 rate)
{ {
@@ -2463,6 +2538,7 @@ int afe_spdif_port_start(u16 port_id, struct afe_spdif_port_config *spdif_port,
fail_cmd: fail_cmd:
return ret; return ret;
} }
EXPORT_SYMBOL(afe_spdif_port_start);
int afe_send_slot_mapping_cfg( int afe_send_slot_mapping_cfg(
struct afe_param_id_slot_mapping_cfg *slot_mapping_cfg, struct afe_param_id_slot_mapping_cfg *slot_mapping_cfg,
@@ -2622,6 +2698,17 @@ fail_cmd:
return ret; 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, int afe_tdm_port_start(u16 port_id, struct afe_tdm_port_config *tdm_port,
u32 rate, u16 num_groups) u32 rate, u16 num_groups)
{ {
@@ -2749,7 +2836,16 @@ int afe_tdm_port_start(u16 port_id, struct afe_tdm_port_config *tdm_port,
fail_cmd: fail_cmd:
return ret; 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) void afe_set_cal_mode(u16 port_id, enum afe_cal_mode afe_cal_mode)
{ {
uint16_t port_index; uint16_t port_index;
@@ -2757,11 +2853,20 @@ void afe_set_cal_mode(u16 port_id, enum afe_cal_mode afe_cal_mode)
port_index = afe_get_port_index(port_id); port_index = afe_get_port_index(port_id);
this_afe.afe_cal_mode[port_index] = afe_cal_mode; 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) void afe_set_routing_callback(routing_cb cb)
{ {
this_afe.rt_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) int afe_port_send_usb_dev_param(u16 port_id, union afe_port_config *afe_config)
{ {
@@ -3590,6 +3695,16 @@ int afe_get_port_index(u16 port_id)
} }
} }
/**
* 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, int afe_open(u16 port_id,
union afe_port_config *afe_config, int rate) union afe_port_config *afe_config, int rate)
{ {
@@ -3767,7 +3882,18 @@ fail_cmd:
mutex_unlock(&this_afe.afe_cmd_lock); mutex_unlock(&this_afe.afe_cmd_lock);
return ret; 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) int afe_loopback(u16 enable, u16 rx_port, u16 tx_port)
{ {
struct afe_loopback_cfg_v1 lb_cmd; struct afe_loopback_cfg_v1 lb_cmd;
@@ -3825,7 +3951,17 @@ int afe_loopback(u16 enable, u16 rx_port, u16 tx_port)
pr_err("%s: AFE loopback failed %d\n", __func__, ret); pr_err("%s: AFE loopback failed %d\n", __func__, ret);
return 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) int afe_loopback_gain(u16 port_id, u16 volume)
{ {
struct afe_loopback_gain_per_path_param set_param; struct afe_loopback_gain_per_path_param set_param;
@@ -3908,6 +4044,7 @@ int afe_loopback_gain(u16 port_id, u16 volume)
fail_cmd: fail_cmd:
return ret; return ret;
} }
EXPORT_SYMBOL(afe_loopback_gain);
int afe_pseudo_port_start_nowait(u16 port_id) int afe_pseudo_port_start_nowait(u16 port_id)
{ {
@@ -4094,6 +4231,16 @@ int afe_port_group_set_param(u16 group_id,
return ret; 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, int afe_port_group_enable(u16 group_id,
union afe_port_group_config *afe_group_config, union afe_port_group_config *afe_group_config,
u16 enable) u16 enable)
@@ -4146,6 +4293,7 @@ int afe_port_group_enable(u16 group_id,
return ret; return ret;
} }
EXPORT_SYMBOL(afe_port_group_enable);
int afe_stop_pseudo_port(u16 port_id) int afe_stop_pseudo_port(u16 port_id)
{ {
@@ -4191,11 +4339,28 @@ int afe_stop_pseudo_port(u16 port_id)
return ret; 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) uint32_t afe_req_mmap_handle(struct afe_audio_client *ac)
{ {
return ac->mem_map_handle; 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 *q6afe_audio_client_alloc(void *priv)
{ {
struct afe_audio_client *ac; struct afe_audio_client *ac;
@@ -4220,7 +4385,19 @@ struct afe_audio_client *q6afe_audio_client_alloc(void *priv)
return ac; 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, int q6afe_audio_client_buf_alloc_contiguous(unsigned int dir,
struct afe_audio_client *ac, struct afe_audio_client *ac,
unsigned int bufsz, unsigned int bufsz,
@@ -4299,7 +4476,18 @@ fail:
q6afe_audio_client_buf_free_contiguous(dir, ac); q6afe_audio_client_buf_free_contiguous(dir, ac);
return -EINVAL; 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, int afe_memory_map(phys_addr_t dma_addr_p, u32 dma_buf_sz,
struct afe_audio_client *ac) struct afe_audio_client *ac)
{ {
@@ -4320,6 +4508,7 @@ int afe_memory_map(phys_addr_t dma_addr_p, u32 dma_buf_sz,
return ret; return ret;
} }
EXPORT_SYMBOL(afe_memory_map);
int afe_cmd_memory_map(phys_addr_t dma_addr_p, u32 dma_buf_sz) int afe_cmd_memory_map(phys_addr_t dma_addr_p, u32 dma_buf_sz)
{ {
@@ -4494,6 +4683,15 @@ int afe_cmd_memory_map_nowait(int port_id, phys_addr_t dma_addr_p,
kfree(mmap_region_cmd); kfree(mmap_region_cmd);
return ret; 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, int q6afe_audio_client_buf_free_contiguous(unsigned int dir,
struct afe_audio_client *ac) struct afe_audio_client *ac)
{ {
@@ -4533,7 +4731,15 @@ int q6afe_audio_client_buf_free_contiguous(unsigned int dir,
mutex_unlock(&ac->cmd_lock); mutex_unlock(&ac->cmd_lock);
return 0; 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) void q6afe_audio_client_free(struct afe_audio_client *ac)
{ {
int loopcnt; int loopcnt;
@@ -4552,7 +4758,16 @@ void q6afe_audio_client_free(struct afe_audio_client *ac)
} }
kfree(ac); 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 afe_cmd_memory_unmap(u32 mem_map_handle)
{ {
int ret = 0; int ret = 0;
@@ -4593,6 +4808,7 @@ int afe_cmd_memory_unmap(u32 mem_map_handle)
return ret; return ret;
} }
EXPORT_SYMBOL(afe_cmd_memory_unmap);
int afe_cmd_memory_unmap_nowait(u32 mem_map_handle) int afe_cmd_memory_unmap_nowait(u32 mem_map_handle)
{ {
@@ -4629,6 +4845,16 @@ int afe_cmd_memory_unmap_nowait(u32 mem_map_handle)
return ret; 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, int afe_register_get_events(u16 port_id,
void (*cb)(uint32_t opcode, void (*cb)(uint32_t opcode,
uint32_t token, uint32_t *payload, void *priv), uint32_t token, uint32_t *payload, void *priv),
@@ -4681,7 +4907,16 @@ int afe_register_get_events(u16 port_id,
__func__, ret); __func__, ret);
return 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 afe_unregister_get_events(u16 port_id)
{ {
int ret = 0; int ret = 0;
@@ -4748,7 +4983,19 @@ int afe_unregister_get_events(u16 port_id)
__func__, ret); __func__, ret);
return 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, int afe_rt_proxy_port_write(phys_addr_t buf_addr_p,
u32 mem_map_handle, int bytes) u32 mem_map_handle, int bytes)
{ {
@@ -4785,7 +5032,18 @@ int afe_rt_proxy_port_write(phys_addr_t buf_addr_p,
return ret; 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, int afe_rt_proxy_port_read(phys_addr_t buf_addr_p,
u32 mem_map_handle, int bytes) u32 mem_map_handle, int bytes)
{ {
@@ -4820,6 +5078,7 @@ int afe_rt_proxy_port_read(phys_addr_t buf_addr_p,
__func__, afecmd_rd.port_id, ret); __func__, afecmd_rd.port_id, ret);
return ret; return ret;
} }
EXPORT_SYMBOL(afe_rt_proxy_port_read);
#ifdef CONFIG_DEBUG_FS #ifdef CONFIG_DEBUG_FS
static struct dentry *debugfs_afelb; static struct dentry *debugfs_afelb;
@@ -4985,6 +5244,14 @@ static void config_debug_fs_exit(void)
} }
#endif #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) void afe_set_dtmf_gen_rx_portid(u16 port_id, int set)
{ {
if (set) if (set)
@@ -4992,7 +5259,18 @@ void afe_set_dtmf_gen_rx_portid(u16 port_id, int set)
else if (this_afe.dtmf_gen_rx_portid == port_id) else if (this_afe.dtmf_gen_rx_portid == port_id)
this_afe.dtmf_gen_rx_portid = -1; 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, int afe_dtmf_generate_rx(int64_t duration_in_ms,
uint16_t high_freq, uint16_t high_freq,
uint16_t low_freq, uint16_t gain) uint16_t low_freq, uint16_t gain)
@@ -5079,6 +5357,7 @@ fail_cmd:
pr_err("%s: failed %d\n", __func__, ret); pr_err("%s: failed %d\n", __func__, ret);
return ret; return ret;
} }
EXPORT_SYMBOL(afe_dtmf_generate_rx);
static int afe_sidetone_iir(u16 tx_port_id) static int afe_sidetone_iir(u16 tx_port_id)
{ {
@@ -5556,6 +5835,13 @@ fail_cmd:
} }
/**
* 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) int afe_close(int port_id)
{ {
struct afe_port_cmd_device_stop stop; struct afe_port_cmd_device_stop stop;
@@ -5678,6 +5964,7 @@ int afe_close(int port_id)
fail_cmd: fail_cmd:
return ret; return ret;
} }
EXPORT_SYMBOL(afe_close);
int afe_set_digital_codec_core_clock(u16 port_id, int afe_set_digital_codec_core_clock(u16 port_id,
struct afe_digital_clk_cfg *cfg) struct afe_digital_clk_cfg *cfg)
@@ -5754,6 +6041,14 @@ fail_cmd:
return ret; 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) int afe_set_lpass_clock(u16 port_id, struct afe_clk_cfg *cfg)
{ {
struct afe_lpass_clk_config_command clk_cfg; struct afe_lpass_clk_config_command clk_cfg;
@@ -5844,6 +6139,7 @@ fail_cmd:
mutex_unlock(&this_afe.afe_cmd_lock); mutex_unlock(&this_afe.afe_cmd_lock);
return ret; return ret;
} }
EXPORT_SYMBOL(afe_set_lpass_clock);
/** /**
* afe_set_lpass_clk_cfg - Set AFE clk config * afe_set_lpass_clk_cfg - Set AFE clk config
@@ -6325,6 +6621,15 @@ done:
return ret; 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, int afe_get_av_dev_drift(struct afe_param_id_dev_timing_stats *timing_stats,
u16 port) u16 port)
{ {
@@ -6406,6 +6711,7 @@ int afe_get_av_dev_drift(struct afe_param_id_dev_timing_stats *timing_stats,
exit: exit:
return ret; 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) int afe_spk_prot_get_calib_data(struct afe_spkr_prot_get_vi_calib *calib_resp)
{ {
@@ -6486,6 +6792,18 @@ fail_cmd:
return ret; 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 afe_spk_prot_feed_back_cfg(int src_port, int dst_port,
int l_ch, int r_ch, u32 enable) int l_ch, int r_ch, u32 enable)
{ {
@@ -6531,6 +6849,7 @@ int afe_spk_prot_feed_back_cfg(int src_port, int dst_port,
fail_cmd: fail_cmd:
return ret; return ret;
} }
EXPORT_SYMBOL(afe_spk_prot_feed_back_cfg);
static int get_cal_type_index(int32_t cal_type) static int get_cal_type_index(int32_t cal_type)
{ {
@@ -7200,7 +7519,7 @@ done:
return result; return result;
} }
static int __init afe_init(void) int __init afe_init(void)
{ {
int i = 0, ret; int i = 0, ret;
@@ -7231,7 +7550,7 @@ static int __init afe_init(void)
return 0; return 0;
} }
static void __exit afe_exit(void) void __exit afe_exit(void)
{ {
afe_delete_cal_data(); afe_delete_cal_data();
@@ -7239,6 +7558,3 @@ static void __exit afe_exit(void)
mutex_destroy(&this_afe.afe_cmd_lock); mutex_destroy(&this_afe.afe_cmd_lock);
wakeup_source_trash(&wl.ws); wakeup_source_trash(&wl.ws);
} }
device_initcall(afe_init);
__exitcall(afe_exit);

File diff suppressed because it is too large Load Diff

View File

@@ -650,6 +650,14 @@ int q6audio_is_digital_pcm_interface(u16 port_id)
return ret; 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 q6audio_validate_port(u16 port_id)
{ {
int ret; int ret;
@@ -805,3 +813,4 @@ int q6audio_validate_port(u16 port_id)
return ret; return ret;
} }
EXPORT_SYMBOL(q6audio_validate_port);

View File

@@ -454,6 +454,15 @@ done:
} }
EXPORT_SYMBOL(q6core_get_fwk_version_size); 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) int32_t core_set_license(uint32_t key, uint32_t module_id)
{ {
struct avcs_cmd_set_license *cmd_setl = NULL; struct avcs_cmd_set_license *cmd_setl = NULL;
@@ -528,7 +537,16 @@ cmd_unlock:
return rc; 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) int32_t core_get_license_status(uint32_t module_id)
{ {
struct avcs_cmd_get_license_validation_result get_lvr_cmd; struct avcs_cmd_get_license_validation_result get_lvr_cmd;
@@ -586,7 +604,16 @@ fail_cmd:
__func__, ret, module_id); __func__, ret, module_id);
return ret; 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) uint32_t core_set_dolby_manufacturer_id(int manufacturer_id)
{ {
struct adsp_dolby_manufacturer_id payload; struct adsp_dolby_manufacturer_id payload;
@@ -617,6 +644,7 @@ uint32_t core_set_dolby_manufacturer_id(int manufacturer_id)
mutex_unlock(&(q6core_lcl.cmd_lock)); mutex_unlock(&(q6core_lcl.cmd_lock));
return rc; return rc;
} }
EXPORT_SYMBOL(core_set_dolby_manufacturer_id);
/** /**
* q6core_is_adsp_ready - check adsp ready status * q6core_is_adsp_ready - check adsp ready status
@@ -1062,7 +1090,7 @@ err:
return ret; return ret;
} }
static int __init core_init(void) int __init core_init(void)
{ {
memset(&q6core_lcl, 0, sizeof(struct q6core_str)); memset(&q6core_lcl, 0, sizeof(struct q6core_str));
init_waitqueue_head(&q6core_lcl.bus_bw_req_wait); init_waitqueue_head(&q6core_lcl.bus_bw_req_wait);
@@ -1076,14 +1104,12 @@ static int __init core_init(void)
return 0; 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.cmd_lock);
mutex_destroy(&q6core_lcl.ver_lock); mutex_destroy(&q6core_lcl.ver_lock);
q6core_delete_cal_data(); q6core_delete_cal_data();
} }
module_exit(core_exit);
MODULE_DESCRIPTION("ADSP core driver"); MODULE_DESCRIPTION("ADSP core driver");
MODULE_LICENSE("GPL v2"); MODULE_LICENSE("GPL v2");

View File

@@ -293,6 +293,15 @@ static int q6lsm_mmap_apr_dereg(void)
return 0; 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 *q6lsm_client_alloc(lsm_app_cb cb, void *priv)
{ {
struct lsm_client *client; struct lsm_client *client;
@@ -341,7 +350,15 @@ fail:
q6lsm_client_free(client); q6lsm_client_free(client);
return NULL; 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) void q6lsm_client_free(struct lsm_client *client)
{ {
if (!client) if (!client)
@@ -358,6 +375,7 @@ void q6lsm_client_free(struct lsm_client *client)
kfree(client); kfree(client);
client = NULL; client = NULL;
} }
EXPORT_SYMBOL(q6lsm_client_free);
/* /*
* q6lsm_apr_send_pkt : If wait == true, hold mutex to prevent from preempting * q6lsm_apr_send_pkt : If wait == true, hold mutex to prevent from preempting
@@ -593,6 +611,15 @@ done:
} }
/**
* 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, void q6lsm_sm_set_param_data(struct lsm_client *client,
struct lsm_params_info *p_info, struct lsm_params_info *p_info,
size_t *offset) size_t *offset)
@@ -606,7 +633,17 @@ void q6lsm_sm_set_param_data(struct lsm_client *client,
param->p_size.param_size = client->sound_model.size; param->p_size.param_size = client->sound_model.size;
*offset = sizeof(*param); *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 q6lsm_open(struct lsm_client *client, uint16_t app_id)
{ {
int rc = 0; int rc = 0;
@@ -654,6 +691,7 @@ done:
pr_debug("%s: leave %d\n", __func__, rc); pr_debug("%s: leave %d\n", __func__, rc);
return rc; return rc;
} }
EXPORT_SYMBOL(q6lsm_open);
static int q6lsm_send_confidence_levels( static int q6lsm_send_confidence_levels(
struct lsm_client *client, struct lsm_client *client,
@@ -760,16 +798,30 @@ static int q6lsm_send_param_opmode(struct lsm_client *client,
return rc; return rc;
} }
/**
* set_lsm_port -
* Update LSM AFE port
*
*/
void set_lsm_port(int lsm_port) void set_lsm_port(int lsm_port)
{ {
lsm_afe_port = lsm_port; lsm_afe_port = lsm_port;
} }
EXPORT_SYMBOL(set_lsm_port);
int get_lsm_port(void) int get_lsm_port(void)
{ {
return lsm_afe_port; 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 q6lsm_set_port_connected(struct lsm_client *client)
{ {
int rc; int rc;
@@ -819,6 +871,8 @@ int q6lsm_set_port_connected(struct lsm_client *client)
return rc; return rc;
} }
EXPORT_SYMBOL(q6lsm_set_port_connected);
static int q6lsm_send_param_polling_enable(struct lsm_client *client, static int q6lsm_send_param_polling_enable(struct lsm_client *client,
bool poll_en, bool poll_en,
struct lsm_module_param_ids *poll_enable_ids, struct lsm_module_param_ids *poll_enable_ids,
@@ -859,6 +913,15 @@ static int q6lsm_send_param_polling_enable(struct lsm_client *client,
return rc; 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, int q6lsm_set_fwk_mode_cfg(struct lsm_client *client,
uint32_t event_mode) uint32_t event_mode)
{ {
@@ -906,6 +969,7 @@ int q6lsm_set_fwk_mode_cfg(struct lsm_client *client,
__func__, msg_hdr->opcode, rc); __func__, msg_hdr->opcode, rc);
return rc; return rc;
} }
EXPORT_SYMBOL(q6lsm_set_fwk_mode_cfg);
static int q6lsm_arrange_mch_map(struct lsm_param_media_fmt *media_fmt, static int q6lsm_arrange_mch_map(struct lsm_param_media_fmt *media_fmt,
int channel_count) int channel_count)
@@ -941,6 +1005,14 @@ static int q6lsm_arrange_mch_map(struct lsm_param_media_fmt *media_fmt,
return rc; 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 q6lsm_set_media_fmt_params(struct lsm_client *client)
{ {
int rc = 0; int rc = 0;
@@ -998,7 +1070,18 @@ int q6lsm_set_media_fmt_params(struct lsm_client *client)
err_ret: err_ret:
return rc; 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, int q6lsm_set_data(struct lsm_client *client,
enum lsm_detection_mode mode, enum lsm_detection_mode mode,
bool detectfailure) bool detectfailure)
@@ -1061,7 +1144,16 @@ int q6lsm_set_data(struct lsm_client *client,
err_ret: err_ret:
return rc; 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, int q6lsm_register_sound_model(struct lsm_client *client,
enum lsm_detection_mode mode, enum lsm_detection_mode mode,
bool detectfailure) bool detectfailure)
@@ -1098,7 +1190,16 @@ int q6lsm_register_sound_model(struct lsm_client *client,
return rc; 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 q6lsm_deregister_sound_model(struct lsm_client *client)
{ {
int rc; int rc;
@@ -1134,6 +1235,7 @@ int q6lsm_deregister_sound_model(struct lsm_client *client)
return rc; return rc;
} }
EXPORT_SYMBOL(q6lsm_deregister_sound_model);
static void q6lsm_add_mmaphdr(struct lsm_client *client, struct apr_hdr *hdr, static void q6lsm_add_mmaphdr(struct lsm_client *client, struct apr_hdr *hdr,
u32 pkt_size, u32 cmd_flg, u32 token) u32 pkt_size, u32 cmd_flg, u32 token)
@@ -1285,7 +1387,14 @@ done:
return rc; 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 q6lsm_snd_model_buf_free(struct lsm_client *client)
{ {
int rc; int rc;
@@ -1316,6 +1425,7 @@ int q6lsm_snd_model_buf_free(struct lsm_client *client)
mutex_unlock(&client->cmd_lock); mutex_unlock(&client->cmd_lock);
return rc; return rc;
} }
EXPORT_SYMBOL(q6lsm_snd_model_buf_free);
static struct lsm_client *q6lsm_get_lsm_client(int session_id) static struct lsm_client *q6lsm_get_lsm_client(int session_id)
{ {
@@ -1420,6 +1530,16 @@ static int q6lsm_mmapcallback(struct apr_client_data *data, void *priv)
return 0; 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, int q6lsm_snd_model_buf_alloc(struct lsm_client *client, size_t len,
bool allocate_module_data) bool allocate_module_data)
{ {
@@ -1523,6 +1643,7 @@ exit:
q6lsm_snd_model_buf_free(client); q6lsm_snd_model_buf_free(client);
return rc; return rc;
} }
EXPORT_SYMBOL(q6lsm_snd_model_buf_alloc);
static int q6lsm_cmd(struct lsm_client *client, int opcode, bool wait) static int q6lsm_cmd(struct lsm_client *client, int opcode, bool wait)
{ {
@@ -1613,6 +1734,17 @@ static int q6lsm_send_param_gain(
return rc; 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, int q6lsm_set_one_param(struct lsm_client *client,
struct lsm_params_info *p_info, void *data, struct lsm_params_info *p_info, void *data,
uint32_t param_type) uint32_t param_type)
@@ -1798,23 +1930,60 @@ int q6lsm_set_one_param(struct lsm_client *client,
return rc; 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) int q6lsm_start(struct lsm_client *client, bool wait)
{ {
return q6lsm_cmd(client, LSM_SESSION_CMD_START, 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) int q6lsm_stop(struct lsm_client *client, bool wait)
{ {
return q6lsm_cmd(client, LSM_SESSION_CMD_STOP, 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) int q6lsm_close(struct lsm_client *client)
{ {
return q6lsm_cmd(client, LSM_SESSION_CMD_CLOSE_TX, true); 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 q6lsm_lab_control(struct lsm_client *client, u32 enable)
{ {
int rc = 0; int rc = 0;
@@ -1876,7 +2045,16 @@ int q6lsm_lab_control(struct lsm_client *client, u32 enable)
exit: exit:
return rc; 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 q6lsm_stop_lab(struct lsm_client *client)
{ {
int rc = 0; int rc = 0;
@@ -1890,7 +2068,17 @@ int q6lsm_stop_lab(struct lsm_client *client)
pr_err("%s: Lab stop failed %d\n", __func__, rc); pr_err("%s: Lab stop failed %d\n", __func__, rc);
return 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 q6lsm_read(struct lsm_client *client, struct lsm_cmd_read *read)
{ {
int rc = 0; int rc = 0;
@@ -1910,7 +2098,17 @@ int q6lsm_read(struct lsm_client *client, struct lsm_cmd_read *read)
pr_err("%s: read buffer call failed rc %d\n", __func__, rc); pr_err("%s: read buffer call failed rc %d\n", __func__, rc);
return 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 q6lsm_lab_buffer_alloc(struct lsm_client *client, bool alloc)
{ {
int ret = 0, i = 0; int ret = 0, i = 0;
@@ -2000,6 +2198,7 @@ int q6lsm_lab_buffer_alloc(struct lsm_client *client, bool alloc)
} }
return ret; return ret;
} }
EXPORT_SYMBOL(q6lsm_lab_buffer_alloc);
static int get_cal_type_index(int32_t cal_type) static int get_cal_type_index(int32_t cal_type)
{ {
@@ -2155,7 +2354,7 @@ err:
return ret; return ret;
} }
static int __init q6lsm_init(void) int __init q6lsm_init(void)
{ {
int i = 0; int i = 0;
@@ -2177,10 +2376,7 @@ static int __init q6lsm_init(void)
return 0; return 0;
} }
static void __exit q6lsm_exit(void) void __exit q6lsm_exit(void)
{ {
lsm_delete_cal_data(); lsm_delete_cal_data();
} }
device_initcall(q6lsm_init);
__exitcall(q6lsm_exit);

View File

@@ -1455,12 +1455,10 @@ int q6usm_get_us_stream_param(int dir, struct us_client *usc,
return rc; return rc;
} }
static int __init q6usm_init(void) int __init q6usm_init(void)
{ {
pr_debug("%s\n", __func__); pr_debug("%s\n", __func__);
init_waitqueue_head(&this_mmap.cmd_wait); init_waitqueue_head(&this_mmap.cmd_wait);
memset(session, 0, sizeof(session)); memset(session, 0, sizeof(session));
return 0; return 0;
} }
device_initcall(q6usm_init);

View File

@@ -126,5 +126,6 @@ int q6usm_set_us_stream_param(int dir, struct us_client *usc,
uint32_t module_id, uint32_t param_id, uint32_t buf_size); uint32_t module_id, uint32_t param_id, uint32_t buf_size);
int q6usm_get_us_stream_param(int dir, struct us_client *usc, int q6usm_get_us_stream_param(int dir, struct us_client *usc,
uint32_t module_id, uint32_t param_id, uint32_t buf_size); uint32_t module_id, uint32_t param_id, uint32_t buf_size);
int q6usm_init(void);
#endif /* __Q6_USM_H__ */ #endif /* __Q6_USM_H__ */

View File

@@ -292,6 +292,14 @@ char *voc_get_session_name(u32 session_id)
return session_name; 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) uint32_t voc_get_session_id(char *name)
{ {
u32 session_id = 0; u32 session_id = 0;
@@ -326,6 +334,7 @@ uint32_t voc_get_session_id(char *name)
return session_id; return session_id;
} }
EXPORT_SYMBOL(voc_get_session_id);
static struct voice_data *voice_get_session(u32 session_id) static struct voice_data *voice_get_session(u32 session_id)
{ {
@@ -1802,6 +1811,11 @@ static int voice_send_dtmf_rx_detection_cmd(struct voice_data *v,
return ret; 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) void voc_disable_dtmf_det_on_active_sessions(void)
{ {
struct voice_data *v = NULL; struct voice_data *v = NULL;
@@ -1818,7 +1832,17 @@ void voc_disable_dtmf_det_on_active_sessions(void)
} }
} }
} }
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) int voc_enable_dtmf_rx_detection(uint32_t session_id, uint32_t enable)
{ {
struct voice_data *v = voice_get_session(session_id); struct voice_data *v = voice_get_session(session_id);
@@ -1840,13 +1864,29 @@ int voc_enable_dtmf_rx_detection(uint32_t session_id, uint32_t enable)
return ret; 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) void voc_set_destroy_cvd_flag(bool is_destroy_cvd)
{ {
pr_debug("%s: %d\n", __func__, is_destroy_cvd); pr_debug("%s: %d\n", __func__, is_destroy_cvd);
common.is_destroy_cvd = 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 voc_alloc_cal_shared_memory(void)
{ {
int rc = 0; int rc = 0;
@@ -1867,7 +1907,14 @@ int voc_alloc_cal_shared_memory(void)
return rc; 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 voc_alloc_voip_shared_memory(void)
{ {
int rc = 0; int rc = 0;
@@ -1890,6 +1937,7 @@ int voc_alloc_voip_shared_memory(void)
return rc; return rc;
} }
EXPORT_SYMBOL(voc_alloc_voip_shared_memory);
static int is_cal_memory_allocated(void) static int is_cal_memory_allocated(void)
{ {
@@ -2218,6 +2266,14 @@ fail:
return ret; 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 voc_update_amr_vocoder_rate(uint32_t session_id)
{ {
int ret = 0; int ret = 0;
@@ -2242,6 +2298,7 @@ int voc_update_amr_vocoder_rate(uint32_t session_id)
done: done:
return ret; return ret;
} }
EXPORT_SYMBOL(voc_update_amr_vocoder_rate);
static int voice_send_start_voice_cmd(struct voice_data *v) static int voice_send_start_voice_cmd(struct voice_data *v)
{ {
@@ -5640,6 +5697,16 @@ fail:
return ret; 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 voc_start_record(uint32_t port_id, uint32_t set, uint32_t session_id)
{ {
int ret = 0; int ret = 0;
@@ -5774,6 +5841,7 @@ int voc_start_record(uint32_t port_id, uint32_t set, uint32_t session_id)
return ret; return ret;
} }
EXPORT_SYMBOL(voc_start_record);
static int voice_cvs_start_playback(struct voice_data *v) static int voice_cvs_start_playback(struct voice_data *v)
{ {
@@ -5962,6 +6030,15 @@ done:
return ret; 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) int voc_start_playback(uint32_t set, uint16_t port_id)
{ {
struct voice_data *v = NULL; struct voice_data *v = NULL;
@@ -6004,7 +6081,17 @@ int voc_start_playback(uint32_t set, uint16_t port_id)
return ret; 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) int voc_disable_topology(uint32_t session_id, uint32_t disable)
{ {
struct voice_data *v = voice_get_session(session_id); struct voice_data *v = voice_get_session(session_id);
@@ -6024,6 +6111,7 @@ int voc_disable_topology(uint32_t session_id, uint32_t disable)
return ret; return ret;
} }
EXPORT_SYMBOL(voc_disable_topology);
static int voice_set_packet_exchange_mode_and_config(uint32_t session_id, static int voice_set_packet_exchange_mode_and_config(uint32_t session_id,
uint32_t mode) uint32_t mode)
@@ -6057,6 +6145,17 @@ fail:
return -EINVAL; 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, int voc_set_tx_mute(uint32_t session_id, uint32_t dir, uint32_t mute,
uint32_t ramp_duration) uint32_t ramp_duration)
{ {
@@ -6089,7 +6188,19 @@ int voc_set_tx_mute(uint32_t session_id, uint32_t dir, uint32_t mute,
return ret; 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, int voc_set_device_mute(uint32_t session_id, uint32_t dir, uint32_t mute,
uint32_t ramp_duration) uint32_t ramp_duration)
{ {
@@ -6130,6 +6241,7 @@ int voc_set_device_mute(uint32_t session_id, uint32_t dir, uint32_t mute,
return ret; return ret;
} }
EXPORT_SYMBOL(voc_set_device_mute);
int voc_get_rx_device_mute(uint32_t session_id) int voc_get_rx_device_mute(uint32_t session_id)
{ {
@@ -6151,6 +6263,15 @@ int voc_get_rx_device_mute(uint32_t session_id)
return ret; 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) int voc_set_tty_mode(uint32_t session_id, uint8_t tty_mode)
{ {
struct voice_data *v = voice_get_session(session_id); struct voice_data *v = voice_get_session(session_id);
@@ -6170,7 +6291,16 @@ int voc_set_tty_mode(uint32_t session_id, uint8_t tty_mode)
return ret; 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) uint8_t voc_get_tty_mode(uint32_t session_id)
{ {
struct voice_data *v = voice_get_session(session_id); struct voice_data *v = voice_get_session(session_id);
@@ -6190,7 +6320,18 @@ uint8_t voc_get_tty_mode(uint32_t session_id)
return ret; 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) int voc_set_pp_enable(uint32_t session_id, uint32_t module_id, uint32_t enable)
{ {
struct voice_data *v = NULL; struct voice_data *v = NULL;
@@ -6225,7 +6366,17 @@ int voc_set_pp_enable(uint32_t session_id, uint32_t module_id, uint32_t enable)
return ret; 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) int voc_set_hd_enable(uint32_t session_id, uint32_t enable)
{ {
struct voice_data *v = NULL; struct voice_data *v = NULL;
@@ -6252,7 +6403,17 @@ int voc_set_hd_enable(uint32_t session_id, uint32_t enable)
return ret; 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) int voc_set_afe_sidetone(uint32_t session_id, bool sidetone_enable)
{ {
struct voice_data *v = NULL; struct voice_data *v = NULL;
@@ -6286,7 +6447,14 @@ int voc_set_afe_sidetone(uint32_t session_id, bool sidetone_enable)
} }
return ret; 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 voc_get_afe_sidetone(void)
{ {
bool ret; bool ret;
@@ -6294,6 +6462,7 @@ bool voc_get_afe_sidetone(void)
ret = common.sidetone_enable; ret = common.sidetone_enable;
return ret; return ret;
} }
EXPORT_SYMBOL(voc_get_afe_sidetone);
int voc_get_pp_enable(uint32_t session_id, uint32_t module_id) int voc_get_pp_enable(uint32_t session_id, uint32_t module_id)
{ {
@@ -6314,6 +6483,17 @@ int voc_get_pp_enable(uint32_t session_id, uint32_t module_id)
return ret; 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, int voc_set_rx_vol_step(uint32_t session_id, uint32_t dir, uint32_t vol_step,
uint32_t ramp_duration) uint32_t ramp_duration)
{ {
@@ -6344,7 +6524,18 @@ int voc_set_rx_vol_step(uint32_t session_id, uint32_t dir, uint32_t vol_step,
return ret; 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, int voc_set_device_config(uint32_t session_id, uint8_t path_dir,
struct media_format_info *finfo) struct media_format_info *finfo)
{ {
@@ -6387,7 +6578,15 @@ int voc_set_device_config(uint32_t session_id, uint8_t path_dir,
return 0; 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) int voc_set_ext_ec_ref_media_fmt_info(struct media_format_info *finfo)
{ {
mutex_lock(&common.common_lock); mutex_lock(&common.common_lock);
@@ -6404,7 +6603,18 @@ int voc_set_ext_ec_ref_media_fmt_info(struct media_format_info *finfo)
mutex_unlock(&common.common_lock); mutex_unlock(&common.common_lock);
return 0; 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) 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); struct voice_data *v = voice_get_session(session_id);
@@ -6428,7 +6638,17 @@ int voc_set_route_flag(uint32_t session_id, uint8_t path_dir, uint8_t set)
return 0; 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) uint8_t voc_get_route_flag(uint32_t session_id, uint8_t path_dir)
{ {
struct voice_data *v = voice_get_session(session_id); struct voice_data *v = voice_get_session(session_id);
@@ -6451,7 +6671,16 @@ uint8_t voc_get_route_flag(uint32_t session_id, uint8_t path_dir)
return ret; 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) int voc_end_voice_call(uint32_t session_id)
{ {
struct voice_data *v = voice_get_session(session_id); struct voice_data *v = voice_get_session(session_id);
@@ -6488,7 +6717,16 @@ int voc_end_voice_call(uint32_t session_id)
mutex_unlock(&v->lock); mutex_unlock(&v->lock);
return ret; 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) int voc_standby_voice_call(uint32_t session_id)
{ {
struct voice_data *v = voice_get_session(session_id); struct voice_data *v = voice_get_session(session_id);
@@ -6537,7 +6775,16 @@ int voc_standby_voice_call(uint32_t session_id)
fail: fail:
return ret; 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) int voc_disable_device(uint32_t session_id)
{ {
struct voice_data *v = voice_get_session(session_id); struct voice_data *v = voice_get_session(session_id);
@@ -6574,7 +6821,16 @@ done:
return ret; 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) int voc_enable_device(uint32_t session_id)
{ {
struct voice_data *v = voice_get_session(session_id); struct voice_data *v = voice_get_session(session_id);
@@ -6662,7 +6918,17 @@ done:
return ret; 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) int voc_set_lch(uint32_t session_id, enum voice_lch_mode lch_mode)
{ {
struct voice_data *v = voice_get_session(session_id); struct voice_data *v = voice_get_session(session_id);
@@ -6696,7 +6962,16 @@ int voc_set_lch(uint32_t session_id, enum voice_lch_mode lch_mode)
done: done:
return ret; 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) int voc_resume_voice_call(uint32_t session_id)
{ {
struct voice_data *v = voice_get_session(session_id); struct voice_data *v = voice_get_session(session_id);
@@ -6712,7 +6987,16 @@ int voc_resume_voice_call(uint32_t session_id)
fail: fail:
return -EINVAL; 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) int voc_start_voice_call(uint32_t session_id)
{ {
struct voice_data *v = voice_get_session(session_id); struct voice_data *v = voice_get_session(session_id);
@@ -6819,7 +7103,14 @@ fail:
mutex_unlock(&v->lock); mutex_unlock(&v->lock);
return ret; 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 voc_set_ext_ec_ref_port_id(uint16_t port_id, bool state)
{ {
int ret = 0; int ret = 0;
@@ -6841,7 +7132,15 @@ exit:
mutex_unlock(&common.common_lock); mutex_unlock(&common.common_lock);
return ret; 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) int voc_get_ext_ec_ref_port_id(void)
{ {
if (common.ec_ref_ext) if (common.ec_ref_ext)
@@ -6849,7 +7148,18 @@ int voc_get_ext_ec_ref_port_id(void)
else else
return AFE_PORT_INVALID; 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, void voc_register_mvs_cb(ul_cb_fn ul_cb,
dl_cb_fn dl_cb, dl_cb_fn dl_cb,
voip_ssr_cb ssr_cb, voip_ssr_cb ssr_cb,
@@ -6860,14 +7170,28 @@ void voc_register_mvs_cb(ul_cb_fn ul_cb,
common.mvs_info.ssr_cb = ssr_cb; common.mvs_info.ssr_cb = ssr_cb;
common.mvs_info.private_data = private_data; 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 voc_register_dtmf_rx_detection_cb(dtmf_rx_det_cb_fn dtmf_rx_ul_cb,
void *private_data) void *private_data)
{ {
common.dtmf_info.dtmf_rx_ul_cb = dtmf_rx_ul_cb; common.dtmf_info.dtmf_rx_ul_cb = dtmf_rx_ul_cb;
common.dtmf_info.private_data = private_data; 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, void voc_config_vocoder(uint32_t media_type,
uint32_t rate, uint32_t rate,
uint32_t network_type, uint32_t network_type,
@@ -6882,6 +7206,7 @@ void voc_config_vocoder(uint32_t media_type,
common.mvs_info.evrc_min_rate = evrc_min_rate; common.mvs_info.evrc_min_rate = evrc_min_rate;
common.mvs_info.evrc_max_rate = evrc_max_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) static int32_t qdsp_mvm_callback(struct apr_client_data *data, void *priv)
{ {
@@ -7753,6 +8078,14 @@ done:
return rc; 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, int voc_send_cvp_start_vocpcm(uint32_t session_id,
struct vss_ivpcm_tap_point *vpcm_tp, struct vss_ivpcm_tap_point *vpcm_tp,
uint32_t no_of_tp) uint32_t no_of_tp)
@@ -7831,7 +8164,16 @@ int voc_send_cvp_start_vocpcm(uint32_t session_id,
done: done:
return ret; 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) int voc_send_cvp_stop_vocpcm(uint32_t session_id)
{ {
struct cvp_command vpcm_stop_cmd; struct cvp_command vpcm_stop_cmd;
@@ -7892,7 +8234,19 @@ int voc_send_cvp_stop_vocpcm(uint32_t session_id)
done: done:
return ret; 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, int voc_send_cvp_map_vocpcm_memory(uint32_t session_id,
struct mem_map_table *tp_mem_table, struct mem_map_table *tp_mem_table,
phys_addr_t paddr, uint32_t bufsize) phys_addr_t paddr, uint32_t bufsize)
@@ -7902,7 +8256,16 @@ int voc_send_cvp_map_vocpcm_memory(uint32_t session_id,
(dma_addr_t) paddr, bufsize, (dma_addr_t) paddr, bufsize,
VOC_VOICE_HOST_PCM_MAP_TOKEN); 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 voc_send_cvp_unmap_vocpcm_memory(uint32_t session_id)
{ {
int ret = 0; int ret = 0;
@@ -7916,7 +8279,16 @@ int voc_send_cvp_unmap_vocpcm_memory(uint32_t session_id)
return ret; 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, int voc_send_cvp_vocpcm_push_buf_evt(uint32_t session_id,
struct vss_ivpcm_evt_push_buffer_v2_t *push_buff_evt) struct vss_ivpcm_evt_push_buffer_v2_t *push_buff_evt)
{ {
@@ -7979,20 +8351,41 @@ int voc_send_cvp_vocpcm_push_buf_evt(uint32_t session_id,
done: done:
return ret; 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 voc_register_hpcm_evt_cb(hostpcm_cb_fn hostpcm_cb,
void *private_data) void *private_data)
{ {
common.hostpcm_info.hostpcm_evt_cb = hostpcm_cb; common.hostpcm_info.hostpcm_evt_cb = hostpcm_cb;
common.hostpcm_info.private_data = private_data; 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) void voc_deregister_hpcm_evt_cb(void)
{ {
common.hostpcm_info.hostpcm_evt_cb = NULL; common.hostpcm_info.hostpcm_evt_cb = NULL;
common.hostpcm_info.private_data = 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 voc_get_cvd_version(char *cvd_version)
{ {
int ret = 0; int ret = 0;
@@ -8041,6 +8434,7 @@ done:
return ret; return ret;
} }
EXPORT_SYMBOL(voc_get_cvd_version);
static int voice_alloc_cal_mem_map_table(void) static int voice_alloc_cal_mem_map_table(void)
{ {
@@ -8598,6 +8992,13 @@ done:
return ret; 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) int voc_set_sound_focus(struct sound_focus_param soundFocusData)
{ {
struct voice_data *v = NULL; struct voice_data *v = NULL;
@@ -8629,6 +9030,7 @@ int voc_set_sound_focus(struct sound_focus_param soundFocusData)
return ret; return ret;
} }
EXPORT_SYMBOL(voc_set_sound_focus);
static int voice_send_get_sound_focus_cmd(struct voice_data *v, static int voice_send_get_sound_focus_cmd(struct voice_data *v,
struct sound_focus_param *soundFocusData) struct sound_focus_param *soundFocusData)
@@ -8727,6 +9129,13 @@ done:
return ret; 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) int voc_get_sound_focus(struct sound_focus_param *soundFocusData)
{ {
struct voice_data *v = NULL; struct voice_data *v = NULL;
@@ -8758,6 +9167,7 @@ int voc_get_sound_focus(struct sound_focus_param *soundFocusData)
return ret; return ret;
} }
EXPORT_SYMBOL(voc_get_sound_focus);
static int is_source_tracking_shared_memomry_allocated(void) static int is_source_tracking_shared_memomry_allocated(void)
{ {
@@ -9045,6 +9455,13 @@ done:
return ret; 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) int voc_get_source_tracking(struct source_tracking_param *sourceTrackingData)
{ {
struct voice_data *v = NULL; struct voice_data *v = NULL;
@@ -9077,13 +9494,21 @@ int voc_get_source_tracking(struct source_tracking_param *sourceTrackingData)
return ret; return ret;
} }
EXPORT_SYMBOL(voc_get_source_tracking);
/**
* is_voc_initialized:
*
* Returns voice module init status
*
*/
int is_voc_initialized(void) int is_voc_initialized(void)
{ {
return module_initialized; return module_initialized;
} }
EXPORT_SYMBOL(is_voc_initialized);
static int __init voice_init(void) int __init voice_init(void)
{ {
int rc = 0, i = 0; int rc = 0, i = 0;
@@ -9180,12 +9605,9 @@ static int __init voice_init(void)
return rc; return rc;
} }
device_initcall(voice_init);
static void __exit voice_exit(void) void __exit voice_exit(void)
{ {
voice_delete_cal_data(); voice_delete_cal_data();
free_cal_map_table(); free_cal_map_table();
} }
__exitcall(voice_exit);

View File

@@ -1875,7 +1875,7 @@ struct miscdevice rtac_misc = {
.fops = &rtac_fops, .fops = &rtac_fops,
}; };
static int __init rtac_init(void) int __init rtac_init(void)
{ {
int i = 0; int i = 0;
@@ -1949,7 +1949,13 @@ nomem:
return -ENOMEM; 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_DESCRIPTION("SoC QDSP6v2 Real-Time Audio Calibration driver");
MODULE_LICENSE("GPL v2"); MODULE_LICENSE("GPL v2");

View File

@@ -27,6 +27,7 @@
#include "q6usm.h" #include "q6usm.h"
#include "usf.h" #include "usf.h"
#include "usfcdev.h" #include "usfcdev.h"
#include "q6_init.h"
/* The driver version*/ /* The driver version*/
#define DRV_VERSION "1.7.1" #define DRV_VERSION "1.7.1"
@@ -2455,10 +2456,19 @@ static int __init usf_init(void)
break; break;
} }
} }
if (!rc) q6usm_init();
return rc; 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_DESCRIPTION("Ultrasound framework driver");
MODULE_LICENSE("GPL v2");

View File

@@ -217,7 +217,7 @@ static bool usfcdev_filter(struct input_handle *handle,
uint16_t ind = (uint16_t)handle->handler->minor; uint16_t ind = (uint16_t)handle->handler->minor;
bool rc = (s_usfcdev_events[ind].event_status != USFCDEV_EVENT_ENABLED); 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 */ /* Pass events from usfcdev driver */
rc = false; rc = false;
pr_debug("%s: event_type=%d; type=%d; code=%d; val=%d", pr_debug("%s: event_type=%d; type=%d; code=%d; val=%d",
@@ -395,7 +395,7 @@ bool usfcdev_set_filter(uint16_t event_type_ind, bool filter)
if (filter) { if (filter) {
s_usfcdev_events[event_type_ind].event_status = s_usfcdev_events[event_type_ind].event_status =
USFCDEV_EVENT_DISABLING; USFCDEV_EVENT_DISABLING;
s_usf_pid = sys_getpid(); s_usf_pid = current->pid;
usfcdev_clean_dev(event_type_ind); usfcdev_clean_dev(event_type_ind);
s_usfcdev_events[event_type_ind].event_status = s_usfcdev_events[event_type_ind].event_status =
USFCDEV_EVENT_DISABLED; USFCDEV_EVENT_DISABLED;
@@ -411,12 +411,3 @@ bool usfcdev_set_filter(uint16_t event_type_ind, bool filter)
return rc; return rc;
} }
static int __init usfcdev_init(void)
{
return 0;
}
device_initcall(usfcdev_init);
MODULE_DESCRIPTION("Handle of events from devices, conflicting with USF");

View File

@@ -43,7 +43,7 @@ struct audio_notifier_cb_data {
int domain; int domain;
}; };
#ifdef CONFIG_MSM_QDSP6_NOTIFIER #if IS_ENABLED(CONFIG_MSM_QDSP6_NOTIFIER)
/* /*
* Use audio_notifier_register to register any audio * Use audio_notifier_register to register any audio
@@ -100,6 +100,6 @@ static inline int audio_notifier_deregister(char *client_name)
return 0; return 0;
} }
#endif /* CONFIG_MSM_QDSP6_PDR */ #endif /* CONFIG_MSM_QDSP6_NOTIFIER */
#endif #endif

View File

@@ -184,4 +184,6 @@ int adm_programable_channel_mixer(int port_id, int copp_idx, int session_id,
int session_type, int session_type,
struct msm_pcm_channel_mixer *ch_mixer, struct msm_pcm_channel_mixer *ch_mixer,
int channel_index); int channel_index);
void msm_dts_srs_acquire_lock(void);
void msm_dts_srs_release_lock(void);
#endif /* __Q6_ADM_V2_H__ */ #endif /* __Q6_ADM_V2_H__ */

View File

@@ -174,6 +174,7 @@ int apr_send_pkt(void *handle, uint32_t *buf);
int apr_deregister(void *handle); int apr_deregister(void *handle);
void subsys_notif_register(char *client_name, int domain, void subsys_notif_register(char *client_name, int domain,
struct notifier_block *nb); struct notifier_block *nb);
void subsys_notif_deregister(char *client_name);
int apr_get_dest_id(char *dest); int apr_get_dest_id(char *dest);
uint16_t apr_get_data_src(struct apr_hdr *hdr); uint16_t apr_get_data_src(struct apr_hdr *hdr);
void change_q6_state(int state); void change_q6_state(int state);

Some files were not shown because too many files have changed in this diff Show More