diff --git a/Android.mk b/Android.mk new file mode 100644 index 0000000000..a7341e3300 --- /dev/null +++ b/Android.mk @@ -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 diff --git a/asoc/Android.mk b/asoc/Android.mk new file mode 100644 index 0000000000..9497ae9f08 --- /dev/null +++ b/asoc/Android.mk @@ -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 _audio.ko as LOCAL_MODULE. +# This means we need to rename the module to _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 diff --git a/asoc/Kbuild b/asoc/Kbuild new file mode 100644 index 0000000000..eb32e8841c --- /dev/null +++ b/asoc/Kbuild @@ -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')\" diff --git a/asoc/codecs/Android.mk b/asoc/codecs/Android.mk new file mode 100644 index 0000000000..863da5a597 --- /dev/null +++ b/asoc/codecs/Android.mk @@ -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 _audio.ko as LOCAL_MODULE. +# This means we need to rename the module to _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 diff --git a/asoc/codecs/Kbuild b/asoc/codecs/Kbuild new file mode 100644 index 0000000000..83d4da441d --- /dev/null +++ b/asoc/codecs/Kbuild @@ -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')\" diff --git a/asoc/codecs/cpe_core.h b/asoc/codecs/cpe_core.h index 9f7c2f31ff..99504c5c96 100644 --- a/asoc/codecs/cpe_core.h +++ b/asoc/codecs/cpe_core.h @@ -173,7 +173,22 @@ struct wcd_cpe_lsm_ops { 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_afe_ops(struct wcd_cpe_afe_ops *afe_ops); 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 diff --git a/asoc/codecs/msm_sdw/Android.mk b/asoc/codecs/msm_sdw/Android.mk new file mode 100644 index 0000000000..421420b848 --- /dev/null +++ b/asoc/codecs/msm_sdw/Android.mk @@ -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 _audio.ko as LOCAL_MODULE. +# This means we need to rename the module to _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 diff --git a/asoc/codecs/msm_sdw/Kbuild b/asoc/codecs/msm_sdw/Kbuild new file mode 100644 index 0000000000..a55948e214 --- /dev/null +++ b/asoc/codecs/msm_sdw/Kbuild @@ -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')\" diff --git a/asoc/codecs/msm_sdw/msm_sdw.h b/asoc/codecs/msm_sdw/msm_sdw.h index 3285f5f551..d4ac433333 100644 --- a/asoc/codecs/msm_sdw/msm_sdw.h +++ b/asoc/codecs/msm_sdw/msm_sdw.h @@ -156,6 +156,7 @@ struct msm_sdw_priv { 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_gain_offset(struct snd_soc_codec *codec, 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( struct snd_info_entry *codec_root, 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 diff --git a/asoc/codecs/sdm660_cdc/Android.mk b/asoc/codecs/sdm660_cdc/Android.mk new file mode 100644 index 0000000000..f322a65562 --- /dev/null +++ b/asoc/codecs/sdm660_cdc/Android.mk @@ -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 _audio.ko as LOCAL_MODULE. +# This means we need to rename the module to _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 diff --git a/asoc/codecs/sdm660_cdc/Kbuild b/asoc/codecs/sdm660_cdc/Kbuild new file mode 100644 index 0000000000..c1777ee533 --- /dev/null +++ b/asoc/codecs/sdm660_cdc/Kbuild @@ -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')\" diff --git a/asoc/codecs/sdm660_cdc/msm-analog-cdc.h b/asoc/codecs/sdm660_cdc/msm-analog-cdc.h index fffdf31562..9591487b57 100644 --- a/asoc/codecs/sdm660_cdc/msm-analog-cdc.h +++ b/asoc/codecs/sdm660_cdc/msm-analog-cdc.h @@ -221,20 +221,48 @@ struct sdm660_cdc_pdata { 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, int mclk_enable, bool dapm); - extern int msm_anlg_cdc_hs_detect(struct snd_soc_codec *codec, struct wcd_mbhc_config *mbhc_cfg); - 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 msm_anlg_cdc_spk_ext_pa_cb( int (*codec_spk_ext_pa)(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, 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 diff --git a/asoc/codecs/sdm660_cdc/msm-digital-cdc.h b/asoc/codecs/sdm660_cdc/msm-digital-cdc.h index 42c31d5089..cb6cfe2f53 100644 --- a/asoc/codecs/sdm660_cdc/msm-digital-cdc.h +++ b/asoc/codecs/sdm660_cdc/msm-digital-cdc.h @@ -89,10 +89,26 @@ enum { BAND_MAX, }; +#if IS_ENABLED(CONFIG_SND_SOC_DIGITAL_CDC) extern void msm_dig_cdc_hph_comp_cb( int (*codec_hph_comp_gpio)( bool enable, struct snd_soc_codec *codec), struct snd_soc_codec *codec); int msm_dig_codec_info_create_codec_entry(struct snd_info_entry *codec_root, 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 diff --git a/asoc/codecs/wcd-mbhc-legacy.h b/asoc/codecs/wcd-mbhc-legacy.h index 594393d478..af3a7dc6d0 100644 --- a/asoc/codecs/wcd-mbhc-legacy.h +++ b/asoc/codecs/wcd-mbhc-legacy.h @@ -15,7 +15,7 @@ #include "wcdcal-hwdep.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); #else static inline void wcd_mbhc_legacy_init(struct wcd_mbhc *mbhc) diff --git a/asoc/codecs/wcd-mbhc-v2.c b/asoc/codecs/wcd-mbhc-v2.c index d7c5921165..3c501b4900 100644 --- a/asoc/codecs/wcd-mbhc-v2.c +++ b/asoc/codecs/wcd-mbhc-v2.c @@ -2121,5 +2121,17 @@ void wcd_mbhc_deinit(struct wcd_mbhc *mbhc) } 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_LICENSE("GPL v2"); diff --git a/asoc/codecs/wcd9335.h b/asoc/codecs/wcd9335.h index 48826e668d..f5f103853b 100644 --- a/asoc/codecs/wcd9335.h +++ b/asoc/codecs/wcd9335.h @@ -137,6 +137,7 @@ enum { RX_GAIN_OFFSET_0_DB, }; +#if IS_ENABLED(CONFIG_SND_SOC_WCD9335) extern void *tasha_get_afe_config(struct snd_soc_codec *codec, enum afe_config_type config_type); 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_gain_offset(struct snd_soc_codec *codec, int offset); 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 diff --git a/asoc/codecs/wcd934x/Android.mk b/asoc/codecs/wcd934x/Android.mk new file mode 100644 index 0000000000..627d04f2cc --- /dev/null +++ b/asoc/codecs/wcd934x/Android.mk @@ -0,0 +1,54 @@ +# Android makefile for audio kernel modules + +# Assume no targets will be supported + +# Check if this driver needs be built for current target +ifeq ($(call is-board-platform,sdm845),true) +AUDIO_SELECT := CONFIG_SND_SOC_SDM845=m +endif + +ifeq ($(call is-board-platform,sdm670),true) +AUDIO_SELECT := CONFIG_SND_SOC_SDM670=m +endif + +AUDIO_CHIPSET := audio +# Build/Package only in case of supported target +ifeq ($(call is-board-platform-in-list,sdm845 sdm670),true) + +LOCAL_PATH := $(call my-dir) + +# This makefile is only for DLKM +ifneq ($(findstring vendor,$(LOCAL_PATH)),) + +ifneq ($(findstring opensource,$(LOCAL_PATH)),) + AUDIO_BLD_DIR := $(ANDROID_BUILD_TOP)/vendor/qcom/opensource/audio-kernel +endif # opensource + +DLKM_DIR := $(TOP)/device/qcom/common/dlkm + +# Build audio.ko as $(AUDIO_CHIPSET)_audio.ko +########################################################### +# This is set once per LOCAL_PATH, not per (kernel) module +KBUILD_OPTIONS := AUDIO_ROOT=$(AUDIO_BLD_DIR) + +# We are actually building audio.ko here, as per the +# requirement we are specifying _audio.ko as LOCAL_MODULE. +# This means we need to rename the module to _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 diff --git a/asoc/codecs/wcd934x/Kbuild b/asoc/codecs/wcd934x/Kbuild new file mode 100644 index 0000000000..6bc854c847 --- /dev/null +++ b/asoc/codecs/wcd934x/Kbuild @@ -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')\" diff --git a/asoc/msm-audio-effects-q6-v2.c b/asoc/msm-audio-effects-q6-v2.c index 2385bac36f..5bab856d22 100644 --- a/asoc/msm-audio-effects-q6-v2.c +++ b/asoc/msm-audio-effects-q6-v2.c @@ -37,6 +37,11 @@ do { \ } 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, int topology) { @@ -56,6 +61,7 @@ bool msm_audio_effects_is_effmodule_supp_in_top(int effect_module, return false; } } +EXPORT_SYMBOL(msm_audio_effects_is_effmodule_supp_in_top); int msm_audio_effects_enable_extn(struct audio_client *ac, struct msm_nt_eff_all_config *effects, @@ -102,6 +108,16 @@ int msm_audio_effects_enable_extn(struct audio_client *ac, 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, struct virtualizer_params *virtualizer, long *values) @@ -263,7 +279,18 @@ invalid_config: kfree(params); 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, struct reverb_params *reverb, long *values) @@ -733,7 +760,18 @@ invalid_config: kfree(params); 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, struct bass_boost_params *bass_boost, long *values) @@ -868,7 +906,18 @@ invalid_config: kfree(params); 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, struct pbe_params *pbe, long *values) @@ -975,7 +1024,18 @@ invalid_config: kfree(params); 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, struct eq_params *eq, long *values) @@ -1207,6 +1267,7 @@ invalid_config: kfree(params); return rc; } +EXPORT_SYMBOL(msm_audio_effects_popless_eq_handler); static int __msm_audio_effects_volume_handler(struct audio_client *ac, struct soft_volume_params *vol, @@ -1370,9 +1431,21 @@ int msm_audio_effects_volume_handler(struct audio_client *ac, 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, struct soft_volume_params *vol, long *values, int instance) { return __msm_audio_effects_volume_handler(ac, vol, values, instance); } +EXPORT_SYMBOL(msm_audio_effects_volume_handler_v2); diff --git a/asoc/msm-compress-q6-v2.c b/asoc/msm-compress-q6-v2.c index cd9c28195b..b30c42438a 100644 --- a/asoc/msm-compress-q6-v2.c +++ b/asoc/msm-compress-q6-v2.c @@ -4541,17 +4541,15 @@ static struct platform_driver msm_compr_driver = { .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); } -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); } -module_exit(msm_soc_platform_exit); MODULE_DESCRIPTION("Compress Offload platform driver"); MODULE_LICENSE("GPL v2"); diff --git a/asoc/msm-cpe-lsm.c b/asoc/msm-cpe-lsm.c index 87297ec051..637778491e 100644 --- a/asoc/msm-cpe-lsm.c +++ b/asoc/msm-cpe-lsm.c @@ -3335,8 +3335,19 @@ static struct platform_driver msm_cpe_lsm_driver = { .probe = msm_cpe_lsm_probe, .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_DEVICE_TABLE(of, msm_cpe_lsm_dt_match); MODULE_LICENSE("GPL v2"); diff --git a/asoc/msm-dai-fe.c b/asoc/msm-dai-fe.c index 89a9cc24a2..c988eeec2c 100644 --- a/asoc/msm-dai-fe.c +++ b/asoc/msm-dai-fe.c @@ -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); } -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); } -module_exit(msm_fe_dai_exit); /* Module information */ MODULE_DESCRIPTION("MSM Frontend DAI driver"); diff --git a/asoc/msm-dai-q6-hdmi-v2.c b/asoc/msm-dai-q6-hdmi-v2.c index 212c4e3274..eb9f5f5de8 100644 --- a/asoc/msm-dai-q6-hdmi-v2.c +++ b/asoc/msm-dai-q6-hdmi-v2.c @@ -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); } -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); } -module_exit(msm_dai_q6_hdmi_exit); /* Module information */ MODULE_DESCRIPTION("MSM DSP HDMI DAI driver"); diff --git a/asoc/msm-dai-q6-v2.c b/asoc/msm-dai-q6-v2.c index cfe47ed6fa..70fcadcdb3 100644 --- a/asoc/msm-dai-q6-v2.c +++ b/asoc/msm-dai-q6-v2.c @@ -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; @@ -8927,16 +8927,17 @@ dai_q6_fail: fail: 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); platform_driver_unregister(&msm_auxpcm_dev_driver); - platform_driver_unregister(&msm_dai_q6_spdif_driver); } -module_exit(msm_dai_q6_exit); /* Module information */ MODULE_DESCRIPTION("MSM DSP DAI driver"); diff --git a/asoc/msm-dai-slim.c b/asoc/msm-dai-slim.c index 0e7c7b1c48..427fd6ce8c 100644 --- a/asoc/msm-dai-slim.c +++ b/asoc/msm-dai-slim.c @@ -642,7 +642,7 @@ static struct slim_driver msm_dai_slim_driver = { .id_table = msm_dai_slim_dt_match, }; -static int __init msm_dai_slim_init(void) +int __init msm_dai_slim_init(void) { int rc; @@ -652,12 +652,11 @@ static int __init msm_dai_slim_init(void) __func__, 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_DESCRIPTION("Slimbus apps-owned channel handling driver"); diff --git a/asoc/msm-dai-stub-v2.c b/asoc/msm-dai-stub-v2.c index 3a2c3d3dbb..d4178c895c 100644 --- a/asoc/msm-dai-stub-v2.c +++ b/asoc/msm-dai-stub-v2.c @@ -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; @@ -378,16 +378,14 @@ dai_stub_dev_fail: fail: 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__); platform_driver_unregister(&msm_dai_stub_dev); platform_driver_unregister(&msm_dai_stub_driver); } -module_exit(msm_dai_stub_exit); /* Module information */ MODULE_DESCRIPTION("MSM Stub DSP DAI driver"); diff --git a/asoc/msm-ds2-dap-config.c b/asoc/msm-ds2-dap-config.c index 7381e5d8c3..419da8fa20 100644 --- a/asoc/msm-ds2-dap-config.c +++ b/asoc/msm-ds2-dap-config.c @@ -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) { - return 0 + return 0; } static int msm_ds2_dap_update_dev_map_port_id(int32_t device_id, int port_id) diff --git a/asoc/msm-lsm-client.c b/asoc/msm-lsm-client.c index 339125e2d7..15cdfb155f 100644 --- a/asoc/msm-lsm-client.c +++ b/asoc/msm-lsm-client.c @@ -2401,17 +2401,15 @@ static struct platform_driver msm_lsm_driver = { .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); } -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); } -module_exit(msm_soc_platform_exit); MODULE_DESCRIPTION("LSM client platform driver"); MODULE_DEVICE_TABLE(of, msm_lsm_client_dt_match); diff --git a/asoc/msm-pcm-afe-v2.c b/asoc/msm-pcm-afe-v2.c index 102fad8b32..f700f0bf8a 100644 --- a/asoc/msm-pcm-afe-v2.c +++ b/asoc/msm-pcm-afe-v2.c @@ -904,19 +904,17 @@ static struct platform_driver msm_afe_driver = { .remove = msm_afe_remove, }; -static int __init msm_soc_platform_init(void) +int __init msm_pcm_afe_init(void) { pr_debug("%s\n", __func__); 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__); platform_driver_unregister(&msm_afe_driver); } -module_exit(msm_soc_platform_exit); MODULE_DESCRIPTION("AFE PCM module platform driver"); MODULE_LICENSE("GPL v2"); diff --git a/asoc/msm-pcm-dtmf-v2.c b/asoc/msm-pcm-dtmf-v2.c index c387c7d0aa..7bc823bebf 100644 --- a/asoc/msm-pcm-dtmf-v2.c +++ b/asoc/msm-pcm-dtmf-v2.c @@ -580,17 +580,15 @@ static struct platform_driver msm_pcm_driver = { .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); } -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); } -module_exit(msm_soc_platform_exit); MODULE_DESCRIPTION("DTMF platform driver"); MODULE_LICENSE("GPL v2"); diff --git a/asoc/msm-pcm-host-voice-v2.c b/asoc/msm-pcm-host-voice-v2.c index 55b07bc758..0c47ec1133 100644 --- a/asoc/msm-pcm-host-voice-v2.c +++ b/asoc/msm-pcm-host-voice-v2.c @@ -1504,7 +1504,7 @@ static struct platform_driver msm_pcm_driver = { .remove = msm_pcm_remove, }; -static int __init msm_soc_platform_init(void) +int __init msm_voice_host_init(void) { int i = 0; struct session *s = NULL; @@ -1541,13 +1541,11 @@ static int __init msm_soc_platform_init(void) 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); } -module_exit(msm_soc_platform_exit); MODULE_DESCRIPTION("PCM module platform driver"); MODULE_LICENSE("GPL v2"); diff --git a/asoc/msm-pcm-hostless.c b/asoc/msm-pcm-hostless.c index 35766b4498..90d76b49f6 100644 --- a/asoc/msm-pcm-hostless.c +++ b/asoc/msm-pcm-hostless.c @@ -66,17 +66,15 @@ static struct platform_driver msm_pcm_hostless_driver = { .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); } -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); } -module_exit(msm_soc_platform_exit); MODULE_DESCRIPTION("Hostless platform driver"); MODULE_LICENSE("GPL v2"); diff --git a/asoc/msm-pcm-loopback-v2.c b/asoc/msm-pcm-loopback-v2.c index a6ac8ca006..e50a00575d 100644 --- a/asoc/msm-pcm-loopback-v2.c +++ b/asoc/msm-pcm-loopback-v2.c @@ -785,17 +785,15 @@ static struct platform_driver msm_pcm_driver = { .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); } -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); } -module_exit(msm_soc_platform_exit); MODULE_DESCRIPTION("PCM loopback platform driver"); MODULE_LICENSE("GPL v2"); diff --git a/asoc/msm-pcm-q6-noirq.c b/asoc/msm-pcm-q6-noirq.c index 3e03437abc..307e7a6fae 100644 --- a/asoc/msm-pcm-q6-noirq.c +++ b/asoc/msm-pcm-q6-noirq.c @@ -1252,33 +1252,31 @@ static int msm_pcm_remove(struct platform_device *pdev) snd_soc_unregister_platform(&pdev->dev); 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"}, {} }; -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 = { .driver = { .name = "msm-pcm-dsp-noirq", .owner = THIS_MODULE, - .of_match_table = msm_pcm_dt_match, + .of_match_table = msm_pcm_noirq_dt_match, }, .probe = msm_pcm_probe, .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); } -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); } -module_exit(msm_soc_platform_exit); MODULE_DESCRIPTION("PCM NOIRQ module platform driver"); MODULE_LICENSE("GPL v2"); diff --git a/asoc/msm-pcm-q6-v2.c b/asoc/msm-pcm-q6-v2.c index 4910decf6d..0a0e26d8b0 100644 --- a/asoc/msm-pcm-q6-v2.c +++ b/asoc/msm-pcm-q6-v2.c @@ -1863,7 +1863,7 @@ static struct platform_driver msm_pcm_driver = { .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.eos_wait); @@ -1872,13 +1872,11 @@ static int __init msm_soc_platform_init(void) 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); } -module_exit(msm_soc_platform_exit); MODULE_DESCRIPTION("PCM module platform driver"); MODULE_LICENSE("GPL v2"); diff --git a/asoc/msm-pcm-routing-v2.c b/asoc/msm-pcm-routing-v2.c index 3338ac6834..965518bdae 100644 --- a/asoc/msm-pcm-routing-v2.c +++ b/asoc/msm-pcm-routing-v2.c @@ -30,7 +30,7 @@ #include #include #include -#include +#include #include #include #include @@ -17781,7 +17781,7 @@ err: return ret; } -static int __init msm_soc_routing_platform_init(void) +int __init msm_soc_routing_platform_init(void) { mutex_init(&routing_lock); 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); } -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(); memset(&be_dai_name_table, 0, sizeof(be_dai_name_table)); mutex_destroy(&routing_lock); platform_driver_unregister(&msm_routing_pcm_driver); } -module_exit(msm_soc_routing_platform_exit); MODULE_DESCRIPTION("MSM routing platform driver"); MODULE_LICENSE("GPL v2"); diff --git a/asoc/msm-pcm-voice-v2.c b/asoc/msm-pcm-voice-v2.c index 9972132000..7b236b4f04 100644 --- a/asoc/msm-pcm-voice-v2.c +++ b/asoc/msm-pcm-voice-v2.c @@ -758,7 +758,7 @@ static struct platform_driver msm_pcm_driver = { .remove = msm_pcm_remove, }; -static int __init msm_soc_platform_init(void) +int __init msm_pcm_voice_init(void) { int i = 0; @@ -769,13 +769,11 @@ static int __init msm_soc_platform_init(void) 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); } -module_exit(msm_soc_platform_exit); MODULE_DESCRIPTION("Voice PCM module platform driver"); MODULE_LICENSE("GPL v2"); diff --git a/asoc/msm-pcm-voip-v2.c b/asoc/msm-pcm-voip-v2.c index 86dcacacba..58fc534f1c 100644 --- a/asoc/msm-pcm-voip-v2.c +++ b/asoc/msm-pcm-voip-v2.c @@ -1684,7 +1684,7 @@ static struct platform_driver msm_pcm_driver = { .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)); voip_info.mode = MODE_PCM; @@ -1703,13 +1703,11 @@ static int __init msm_soc_platform_init(void) 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); } -module_exit(msm_soc_platform_exit); MODULE_DESCRIPTION("PCM module platform driver"); MODULE_LICENSE("GPL v2"); diff --git a/asoc/msm-transcode-loopback-q6-v2.c b/asoc/msm-transcode-loopback-q6-v2.c index eaef498c49..94ebbf748a 100644 --- a/asoc/msm-transcode-loopback-q6-v2.c +++ b/asoc/msm-transcode-loopback-q6-v2.c @@ -951,20 +951,18 @@ static struct platform_driver msm_transcode_loopback_driver = { .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)); mutex_init(&transcode_info.lock); 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); platform_driver_unregister(&msm_transcode_loopback_driver); } -module_exit(msm_soc_platform_exit); MODULE_DESCRIPTION("Transcode loopback platform driver"); MODULE_LICENSE("GPL v2"); diff --git a/asoc/platform_init.c b/asoc/platform_init.c new file mode 100644 index 0000000000..79d0e41998 --- /dev/null +++ b/asoc/platform_init.c @@ -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 +#include +#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"); diff --git a/asoc/platform_init.h b/asoc/platform_init.h new file mode 100644 index 0000000000..db9b32d2ee --- /dev/null +++ b/asoc/platform_init.h @@ -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 + diff --git a/config/sdm670auto.conf b/config/sdm670auto.conf index ca30dd039e..07f195b28f 100644 --- a/config/sdm670auto.conf +++ b/config/sdm670auto.conf @@ -1,49 +1,50 @@ -CONFIG_PINCTRL_LPI=y -CONFIG_PINCTRL_WCD=y -CONFIG_AUDIO_EXT_CLK=y -CONFIG_SND_SOC_WCD9XXX_V2=y -CONFIG_SND_SOC_WCD_MBHC=y -CONFIG_SND_SOC_WSA881X=y -CONFIG_SND_SOC_WCD_DSP_MGR=y -CONFIG_SND_SOC_WCD_SPI=y -CONFIG_SND_SOC_WCD_CPE=y -CONFIG_SND_SOC_WCD9335=y -CONFIG_SND_SOC_WCD934X=y -CONFIG_SND_SOC_WCD934X_MBHC=y -CONFIG_SND_SOC_WCD934X_DSD=y -CONFIG_MSM_QDSP6V2_CODECS=y -CONFIG_MSM_ULTRASOUND=y -CONFIG_MSM_QDSP6_APRV2_GLINK=y -CONFIG_MSM_ADSP_LOADER=y -CONFIG_REGMAP_SWR=y -CONFIG_MSM_QDSP6_SSR=y -CONFIG_MSM_QDSP6_PDR=y -CONFIG_MSM_QDSP6_NOTIFIER=y -CONFIG_SND_SOC_MSM_HOSTLESS_PCM=y -CONFIG_SND_SOC_MSM_QDSP6V2_INTF=y -CONFIG_SND_SOC_SDM670=y -CONFIG_MSM_GLINK_SPI_XPRT=y -CONFIG_SOUNDWIRE=y -CONFIG_SOUNDWIRE_WCD_CTRL=y -CONFIG_SND_SOC_QDSP6V2=y -CONFIG_SND_SOC_MSM_QDSP6V2_INTF=y -CONFIG_WCD9XXX_CODEC_CORE=y -CONFIG_MSM_CDC_PINCTRL=y -CONFIG_SND_SOC_WCD_MBHC_ADC=y -CONFIG_SND_SOC_WCD_MBHC_LEGACY=y -CONFIG_QTI_PP=y -CONFIG_SND_HWDEP=y -CONFIG_DTS_EAGLE=y -CONFIG_DOLBY_DS2=y -CONFIG_DOLBY_LICENSE=y -CONFIG_DTS_SRS_TM=y -CONFIG_SND_SOC_EXT_CODEC=y -CONFIG_SND_SOC_INT_CODEC=y -CONFIG_SND_SOC_MSM_STUB=y -CONFIG_WCD_DSP_GLINK=y -CONFIG_MSM_AVTIMER=y -CONFIG_SND_SOC_SDM660_CDC=y -CONFIG_SND_SOC_ANALOG_CDC=y -CONFIG_SND_SOC_DIGITAL_CDC=y -CONFIG_SND_SOC_MSM_SDW=y -CONFIG_SND_SOC_MSM_HDMI_CODEC_RX=y +CONFIG_PINCTRL_LPI=m +CONFIG_PINCTRL_WCD=m +CONFIG_AUDIO_EXT_CLK=m +CONFIG_SND_SOC_WCD9XXX_V2=m +CONFIG_SND_SOC_WCD_MBHC=m +CONFIG_SND_SOC_WSA881X=m +CONFIG_SND_SOC_WCD_DSP_MGR=m +CONFIG_SND_SOC_WCD_SPI=m +CONFIG_SND_SOC_WCD_CPE=m +CONFIG_SND_SOC_CPE=m +CONFIG_SND_SOC_WCD9335=m +CONFIG_SND_SOC_WCD934X=m +CONFIG_SND_SOC_WCD934X_MBHC=m +CONFIG_SND_SOC_WCD934X_DSD=m +CONFIG_MSM_QDSP6V2_CODECS=m +CONFIG_MSM_ULTRASOUND=m +CONFIG_MSM_QDSP6_APRV2_GLINK=m +CONFIG_MSM_ADSP_LOADER=m +CONFIG_REGMAP_SWR=m +CONFIG_MSM_QDSP6_SSR=m +CONFIG_MSM_QDSP6_PDR=m +CONFIG_MSM_QDSP6_NOTIFIER=m +CONFIG_SND_SOC_MSM_HOSTLESS_PCM=m +CONFIG_SND_SOC_MSM_QDSP6V2_INTF=m +CONFIG_SND_SOC_SDM670=m +CONFIG_MSM_GLINK_SPI_XPRT=m +CONFIG_SOUNDWIRE=m +CONFIG_SOUNDWIRE_WCD_CTRL=m +CONFIG_SND_SOC_QDSP6V2=m +CONFIG_SND_SOC_MSM_QDSP6V2_INTF=m +CONFIG_WCD9XXX_CODEC_CORE=m +CONFIG_MSM_CDC_PINCTRL=m +CONFIG_SND_SOC_WCD_MBHC_ADC=m +CONFIG_SND_SOC_WCD_MBHC_LEGACY=m +CONFIG_QTI_PP=m +CONFIG_SND_HWDEP=m +CONFIG_DTS_EAGLE=m +CONFIG_DOLBY_DS2=m +CONFIG_DOLBY_LICENSE=m +CONFIG_DTS_SRS_TM=m +CONFIG_SND_SOC_EXT_CODEC=m +CONFIG_SND_SOC_INT_CODEC=m +CONFIG_SND_SOC_MSM_STUB=m +CONFIG_WCD_DSP_GLINK=m +CONFIG_MSM_AVTIMER=m +CONFIG_SND_SOC_SDM660_CDC=m +CONFIG_SND_SOC_ANALOG_CDC=m +CONFIG_SND_SOC_DIGITAL_CDC=m +CONFIG_SND_SOC_MSM_SDW=m +CONFIG_SND_SOC_MSM_HDMI_CODEC_RX=m diff --git a/config/sdm670autoconf.h b/config/sdm670autoconf.h index 6aba91d63f..462862f31c 100644 --- a/config/sdm670autoconf.h +++ b/config/sdm670autoconf.h @@ -55,6 +55,7 @@ #define CONFIG_MSM_AVTIMER 1 #define CONFIG_SND_SOC_EXT_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_ANALOG_CDC 1 #define CONFIG_SND_SOC_DIGITAL_CDC 1 diff --git a/dsp/Android.mk b/dsp/Android.mk new file mode 100644 index 0000000000..428901cac7 --- /dev/null +++ b/dsp/Android.mk @@ -0,0 +1,86 @@ +# Android makefile for audio kernel modules + +# Assume no targets will be supported + +# Check if this driver needs be built for current target +ifeq ($(call is-board-platform,sdm845),true) +AUDIO_SELECT := CONFIG_SND_SOC_SDM845=m +endif + +ifeq ($(call is-board-platform,sdm670),true) +AUDIO_SELECT := CONFIG_SND_SOC_SDM670=m +endif + +AUDIO_CHIPSET := audio +# Build/Package only in case of supported target +ifeq ($(call is-board-platform-in-list,sdm845 sdm670),true) + +LOCAL_PATH := $(call my-dir) + +# This makefile is only for DLKM +ifneq ($(findstring vendor,$(LOCAL_PATH)),) + +ifneq ($(findstring opensource,$(LOCAL_PATH)),) + AUDIO_BLD_DIR := $(ANDROID_BUILD_TOP)/vendor/qcom/opensource/audio-kernel +endif # opensource + +DLKM_DIR := $(TOP)/device/qcom/common/dlkm + +# Build audio.ko as $(AUDIO_CHIPSET)_audio.ko +########################################################### +# This is set once per LOCAL_PATH, not per (kernel) module +KBUILD_OPTIONS := AUDIO_ROOT=$(AUDIO_BLD_DIR) + +# We are actually building audio.ko here, as per the +# requirement we are specifying _audio.ko as LOCAL_MODULE. +# This means we need to rename the module to _audio.ko +# after audio.ko is built. +KBUILD_OPTIONS += MODNAME=q6_dlkm +KBUILD_OPTIONS += BOARD_PLATFORM=$(TARGET_BOARD_PLATFORM) +KBUILD_OPTIONS += $(AUDIO_SELECT) + +########################################################### +include $(CLEAR_VARS) +LOCAL_MODULE := $(AUDIO_CHIPSET)_q6.ko +LOCAL_MODULE_KBUILD_NAME := q6_dlkm.ko +LOCAL_MODULE_TAGS := optional +LOCAL_MODULE_DEBUG_ENABLE := true +LOCAL_MODULE_PATH := $(KERNEL_MODULES_OUT) +include $(DLKM_DIR)/AndroidKernelModule.mk +########################################################### +include $(CLEAR_VARS) +LOCAL_MODULE := $(AUDIO_CHIPSET)_usf.ko +LOCAL_MODULE_KBUILD_NAME := usf_dlkm.ko +LOCAL_MODULE_TAGS := optional +LOCAL_MODULE_DEBUG_ENABLE := true +LOCAL_MODULE_PATH := $(KERNEL_MODULES_OUT) +include $(DLKM_DIR)/AndroidKernelModule.mk +########################################################### +include $(CLEAR_VARS) +LOCAL_MODULE := $(AUDIO_CHIPSET)_adsp_loader.ko +LOCAL_MODULE_KBUILD_NAME := adsp_loader_dlkm.ko +LOCAL_MODULE_TAGS := optional +LOCAL_MODULE_DEBUG_ENABLE := true +LOCAL_MODULE_PATH := $(KERNEL_MODULES_OUT) +include $(DLKM_DIR)/AndroidKernelModule.mk +########################################################### +include $(CLEAR_VARS) +LOCAL_MODULE := $(AUDIO_CHIPSET)_q6_notifier.ko +LOCAL_MODULE_KBUILD_NAME := q6_notifier_dlkm.ko +LOCAL_MODULE_TAGS := optional +LOCAL_MODULE_DEBUG_ENABLE := true +LOCAL_MODULE_PATH := $(KERNEL_MODULES_OUT) +include $(DLKM_DIR)/AndroidKernelModule.mk +########################################################### +include $(CLEAR_VARS) +LOCAL_MODULE := $(AUDIO_CHIPSET)_q6_pdr.ko +LOCAL_MODULE_KBUILD_NAME := q6_pdr_dlkm.ko +LOCAL_MODULE_TAGS := optional +LOCAL_MODULE_DEBUG_ENABLE := true +LOCAL_MODULE_PATH := $(KERNEL_MODULES_OUT) +include $(DLKM_DIR)/AndroidKernelModule.mk +########################################################### +########################################################### + +endif # DLKM check +endif # supported target check diff --git a/dsp/Kbuild b/dsp/Kbuild new file mode 100644 index 0000000000..8772085437 --- /dev/null +++ b/dsp/Kbuild @@ -0,0 +1,149 @@ +# We can build either as part of a standalone Kernel build or as +# an external module. Determine which mechanism is being used +KERNEL_BUILD := 0 + + +ifeq ($(KERNEL_BUILD), 0) + # These are configurable via Kconfig for kernel-based builds + # Need to explicitly configure for Android-based builds + ifeq ($(CONFIG_ARCH_SDM845), y) + include $(AUDIO_ROOT)/config/sdm845auto.conf + export + endif + ifeq ($(CONFIG_ARCH_SDM670), y) + include $(AUDIO_ROOT)/config/sdm670auto.conf + export + endif +endif + + +# As per target team, build is done as follows: +# Defconfig : build with default flags +# Slub : defconfig + CONFIG_SLUB_DEBUG := y + +# CONFIG_SLUB_DEBUG_ON := y + CONFIG_PAGE_POISONING := y +# Perf : Using appropriate msmXXXX-perf_defconfig +# +# Shipment builds (user variants) should not have any debug feature +# enabled. This is identified using 'TARGET_BUILD_VARIANT'. Slub builds +# are identified using the CONFIG_SLUB_DEBUG_ON configuration. Since +# there is no other way to identify defconfig builds, QTI internal +# representation of perf builds (identified using the string 'perf'), +# is used to identify if the build is a slub or defconfig one. This +# way no critical debug feature will be enabled for perf and shipment +# builds. Other OEMs are also protected using the TARGET_BUILD_VARIANT +# config. + +############ UAPI ############ +UAPI_DIR := uapi +UAPI_INC := -I$(AUDIO_ROOT)/include/$(UAPI_DIR) + +############ COMMON ############ +COMMON_DIR := include +COMMON_INC := -I$(AUDIO_ROOT)/$(COMMON_DIR) + +############ QDSP6V2 ############ + +ifeq ($(CONFIG_SND_SOC_MSM_QDSP6V2_INTF), m) + Q6_OBJS += audio_calibration.o + Q6_OBJS += audio_cal_utils.o + Q6_OBJS += msm-dts-srs-tm-config.o + Q6_OBJS += q6adm.o + Q6_OBJS += q6afe.o + Q6_OBJS += q6asm.o + Q6_OBJS += q6audio-v2.o + Q6_OBJS += q6voice.o + Q6_OBJS += q6core.o + Q6_OBJS += rtac.o + Q6_OBJS += q6lsm.o + Q6_OBJS += audio_slimslave.o + Q6_OBJS += adsp_err.o + Q6_OBJS += msm_audio_ion.o + Q6_OBJS += avtimer.o + Q6_OBJS += q6_init.o +endif +ifeq ($(CONFIG_MSM_ADSP_LOADER), m) +ADSP_LOADER_OBJS += adsp-loader.o +endif + +ifeq ($(CONFIG_MSM_QDSP6_NOTIFIER), m) +QDSP6_NOTIFIER_OBJS += audio_notifier.o audio_ssr.o +endif + +ifeq ($(CONFIG_MSM_QDSP6_PDR), m) +QDSP6_PDR_OBJS += audio_pdr.o +endif + +ifeq ($(CONFIG_MSM_ULTRASOUND), m) +USF_OBJS += usf.o usfcdev.o q6usm.o +endif + +LINUX_INC += -Iinclude/linux + +INCS := $(COMMON_INC) \ + $(UAPI_INC) + +ifeq ($(CONFIG_ARCH_SDM845), y) +INCS += -include $(AUDIO_ROOT)/config/sdm845autoconf.h +endif +ifeq ($(CONFIG_ARCH_SDM670), y) +INCS += -include $(AUDIO_ROOT)/config/sdm670autoconf.h +endif + +EXTRA_CFLAGS += $(INCS) + + +CDEFINES += -DANI_LITTLE_BYTE_ENDIAN \ + -DANI_LITTLE_BIT_ENDIAN \ + -DDOT11F_LITTLE_ENDIAN_HOST \ + -DANI_COMPILER_TYPE_GCC \ + -DANI_OS_TYPE_ANDROID=6 \ + -DPTT_SOCK_SVC_ENABLE \ + -Wall\ + -Werror\ + -D__linux__ + +KBUILD_CPPFLAGS += $(CDEFINES) + +# Currently, for versions of gcc which support it, the kernel Makefile +# is disabling the maybe-uninitialized warning. Re-enable it for the +# AUDIO driver. Note that we must use EXTRA_CFLAGS here so that it +# will override the kernel settings. +ifeq ($(call cc-option-yn, -Wmaybe-uninitialized),y) +EXTRA_CFLAGS += -Wmaybe-uninitialized +endif +#EXTRA_CFLAGS += -Wmissing-prototypes + +ifeq ($(call cc-option-yn, -Wheader-guard),y) +EXTRA_CFLAGS += -Wheader-guard +endif + +# If the module name is not "wlan", then the define MULTI_IF_NAME to be the +# same a the QCA CHIP name. The host driver will then append MULTI_IF_NAME to +# any string that must be unique for all instances of the driver on the system. +# This allows multiple instances of the driver with different module names. +# If the module name is wlan, leave MULTI_IF_NAME undefined and the code will +# treat the driver as the primary driver. +ifneq ($(MODNAME), qdsp6v2) +CHIP_NAME ?= $(MODNAME) +CDEFINES += -DMULTI_IF_NAME=\"$(CHIP_NAME)\" +endif + +KBUILD_EXTRA_SYMBOLS +=$(OUT)/obj/vendor/qcom/opensource/audio-kernel/ipc/Module.symvers + +obj-$(CONFIG_SND_SOC_MSM_QDSP6V2_INTF) += q6_dlkm.o +q6_dlkm-y := $(Q6_OBJS) + +obj-$(CONFIG_MSM_ULTRASOUND) += usf_dlkm.o +usf_dlkm-y := $(USF_OBJS) + +obj-$(CONFIG_MSM_ADSP_LOADER) += adsp_loader_dlkm.o +adsp_loader_dlkm-y := $(ADSP_LOADER_OBJS) + +obj-$(CONFIG_MSM_QDSP6_NOTIFIER) += q6_notifier_dlkm.o +q6_notifier_dlkm-y := $(QDSP6_NOTIFIER_OBJS) + +obj-$(CONFIG_MSM_QDSP6_PDR) += q6_pdr_dlkm.o +q6_pdr_dlkm-y := $(QDSP6_PDR_OBJS) + +# inject some build related information +DEFINES += -DBUILD_TIMESTAMP=\"$(shell date -u +'%Y-%m-%dT%H:%M:%SZ')\" diff --git a/dsp/adsp_err.c b/dsp/adsp_err.c index 319efc37cf..7ad80dc6ec 100644 --- a/dsp/adsp_err.c +++ b/dsp/adsp_err.c @@ -63,7 +63,7 @@ /* Unexpected error code. */ #define ADSP_ERR_MAX_STR "ADSP_ERR_MAX" -#ifdef CONFIG_SND_SOC_QDSP_DEBUG +#if IS_ENABLED(CONFIG_SND_SOC_QDSP_DEBUG) static bool adsp_err_panic; #ifdef CONFIG_DEBUG_FS @@ -123,7 +123,7 @@ static struct adsp_err_code adsp_err_code_info[ADSP_ERR_MAX+1] = { { -EADV, ADSP_ERR_MAX_STR}, }; -#ifdef CONFIG_SND_SOC_QDSP_DEBUG +#if IS_ENABLED(CONFIG_SND_SOC_QDSP_DEBUG) static inline void adsp_err_check_panic(u32 adsp_error) { if (adsp_err_panic && adsp_error != ADSP_EALREADY) @@ -151,8 +151,8 @@ char *adsp_err_get_err_str(u32 adsp_error) return adsp_err_code_info[adsp_error].adsp_err_str; } -#if defined(CONFIG_SND_SOC_QDSP_DEBUG) && defined(CONFIG_DEBUG_FS) -static int __init adsp_err_init(void) +#if IS_ENABLED(CONFIG_SND_SOC_QDSP_DEBUG) && defined(CONFIG_DEBUG_FS) +int __init adsp_err_init(void) { @@ -162,6 +162,12 @@ static int __init adsp_err_init(void) return 0; } +#else +int __init adsp_err_init(void) { return 0; } -device_initcall(adsp_err_init); #endif + +void __exit adsp_err_exit(void) +{ + return; +} diff --git a/dsp/audio_cal_utils.c b/dsp/audio_cal_utils.c index 9a9a96aade..ffd3929dd3 100644 --- a/dsp/audio_cal_utils.c +++ b/dsp/audio_cal_utils.c @@ -481,6 +481,14 @@ done: return; } +/** + * cal_utils_destroy_cal_types - + * Destroys cal types and deregister from cal info + * + * @num_cal_types: number of cal types + * @cal_type: cal type pointer with cal info + * + */ void cal_utils_destroy_cal_types(int num_cal_types, struct cal_type_data **cal_type) { @@ -506,6 +514,7 @@ void cal_utils_destroy_cal_types(int num_cal_types, done: return; } +EXPORT_SYMBOL(cal_utils_destroy_cal_types); /** * cal_utils_get_only_cal_block diff --git a/dsp/audio_calibration.c b/dsp/audio_calibration.c index 59fd464fe0..f812c98ab1 100644 --- a/dsp/audio_calibration.c +++ b/dsp/audio_calibration.c @@ -593,7 +593,7 @@ struct miscdevice audio_cal_misc = { .fops = &audio_cal_fops, }; -static int __init audio_cal_init(void) +int __init audio_cal_init(void) { int i = 0; @@ -609,7 +609,7 @@ static int __init audio_cal_init(void) return misc_register(&audio_cal_misc); } -static void __exit audio_cal_exit(void) +void __exit audio_cal_exit(void) { int i = 0; struct list_head *ptr, *next; @@ -627,10 +627,9 @@ static void __exit audio_cal_exit(void) client_info_node = NULL; } } + misc_deregister(&audio_cal_misc); } -subsys_initcall(audio_cal_init); -module_exit(audio_cal_exit); MODULE_DESCRIPTION("SoC QDSP6v2 Audio Calibration driver"); MODULE_LICENSE("GPL v2"); diff --git a/dsp/audio_notifier.c b/dsp/audio_notifier.c index a1b5d1e6f8..485c703d25 100644 --- a/dsp/audio_notifier.c +++ b/dsp/audio_notifier.c @@ -12,7 +12,6 @@ #include #include -#include #include #include #include @@ -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, unsigned long opcode, void *data) { - if (opcode == SUBSYS_BEFORE_SHUTDOWN) - audio_ssr_send_nmi(data); - return audio_notifer_service_cb(opcode, AUDIO_NOTIFIER_SSR_SERVICE, AUDIO_NOTIFIER_ADSP_DOMAIN); @@ -602,23 +598,6 @@ static int __init audio_notifier_subsys_init(void) return 0; } -subsys_initcall(audio_notifier_subsys_init); - -static int __init audio_notifier_init(void) -{ - int ret; - - ret = audio_pdr_register(&pdr_nb); - if (ret < 0) { - pr_debug("%s: PDR register failed, ret = %d, disable service\n", - __func__, ret); - audio_notifer_disable_service(AUDIO_NOTIFIER_PDR_SERVICE); - } - - /* Do not return error since PDR enablement is not critical */ - return 0; -} -module_init(audio_notifier_init); static int __init audio_notifier_late_init(void) { @@ -633,4 +612,32 @@ static int __init audio_notifier_late_init(void) mutex_unlock(¬ifier_mutex); return 0; } -late_initcall(audio_notifier_late_init); + +static int __init audio_notifier_init(void) +{ + int ret; + + audio_notifier_subsys_init(); + + ret = audio_pdr_register(&pdr_nb); + if (ret < 0) { + pr_err("%s: PDR register failed, ret = %d, disable service\n", + __func__, ret); + audio_notifer_disable_service(AUDIO_NOTIFIER_PDR_SERVICE); + } + + /* Do not return error since PDR enablement is not critical */ + audio_notifier_late_init(); + + return 0; +} +module_init(audio_notifier_init); + +static void __exit audio_notifier_exit(void) +{ + audio_pdr_deregister(&pdr_nb); +} +module_exit(audio_notifier_exit); + +MODULE_DESCRIPTION("Audio notifier driver"); +MODULE_LICENSE("GPL v2"); diff --git a/dsp/audio_pdr.c b/dsp/audio_pdr.c index 0edcf0233e..75f3bbb506 100644 --- a/dsp/audio_pdr.c +++ b/dsp/audio_pdr.c @@ -63,6 +63,14 @@ static struct notifier_block audio_pdr_locator_nb = { .priority = 0, }; +/** + * audio_pdr_register - + * register to PDR framework + * + * @nb: notifier block + * + * Returns 0 on success or error on failure + */ int audio_pdr_register(struct notifier_block *nb) { if (nb == NULL) { @@ -73,6 +81,24 @@ int audio_pdr_register(struct notifier_block *nb) } EXPORT_SYMBOL(audio_pdr_register); +/** + * audio_pdr_deregister - + * Deregister from PDR framework + * + * @nb: notifier block + * + * Returns 0 on success or error on failure + */ +int audio_pdr_deregister(struct notifier_block *nb) +{ + if (nb == NULL) { + pr_err("%s: Notifier block is NULL\n", __func__); + return -EINVAL; + } + return srcu_notifier_chain_unregister(&audio_pdr_cb_list, nb); +} +EXPORT_SYMBOL(audio_pdr_deregister); + void *audio_pdr_service_register(int domain_id, struct notifier_block *nb, int *curr_state) { @@ -125,12 +151,13 @@ static int __init audio_pdr_subsys_init(void) srcu_init_notifier_head(&audio_pdr_cb_list); return 0; } -subsys_initcall(audio_pdr_subsys_init); static int __init audio_pdr_late_init(void) { int ret; + audio_pdr_subsys_init(); + ret = get_service_location( audio_pdr_services[AUDIO_PDR_DOMAIN_ADSP].client_name, audio_pdr_services[AUDIO_PDR_DOMAIN_ADSP].service_name, @@ -144,4 +171,12 @@ static int __init audio_pdr_late_init(void) return ret; } -late_initcall(audio_pdr_late_init); +module_init(audio_pdr_late_init); + +static void __exit audio_pdr_late_exit(void) +{ +} +module_exit(audio_pdr_late_exit); + +MODULE_DESCRIPTION("PDR framework driver"); +MODULE_LICENSE("GPL v2"); diff --git a/dsp/audio_pdr.h b/dsp/audio_pdr.h index ebfd366b1e..2a45c6a61f 100644 --- a/dsp/audio_pdr.h +++ b/dsp/audio_pdr.h @@ -41,6 +41,7 @@ enum { * Failure: Error code */ int audio_pdr_register(struct notifier_block *nb); +int audio_pdr_deregister(struct notifier_block *nb); /* * Use audio_pdr_service_register to register with a PDR service diff --git a/dsp/audio_slimslave.c b/dsp/audio_slimslave.c index e9ecfd5b2e..f9e9cdc370 100644 --- a/dsp/audio_slimslave.c +++ b/dsp/audio_slimslave.c @@ -160,17 +160,15 @@ static struct slim_driver audio_slimslave_driver = { .suspend = audio_slimslave_suspend, }; -static int __init audio_slimslave_init(void) +int __init audio_slimslave_init(void) { return slim_driver_register(&audio_slimslave_driver); } -module_init(audio_slimslave_init); -static void __exit audio_slimslave_exit(void) +void __exit audio_slimslave_exit(void) { } -module_exit(audio_slimslave_exit); /* Module information */ MODULE_DESCRIPTION("Audio side Slimbus slave driver"); diff --git a/dsp/audio_ssr.c b/dsp/audio_ssr.c index d3880c912c..b1acb918e0 100644 --- a/dsp/audio_ssr.c +++ b/dsp/audio_ssr.c @@ -11,18 +11,24 @@ */ #include -#include #include #include #include "audio_ssr.h" -#define SCM_Q6_NMI_CMD 0x1 - static char *audio_ssr_domains[] = { "adsp", "modem" }; +/** + * audio_ssr_register - + * register to SSR framework + * + * @domain_id: Domain ID to register with + * @nb: notifier block + * + * Returns handle pointer on success or error PTR on failure + */ void *audio_ssr_register(int domain_id, struct notifier_block *nb) { if ((domain_id < 0) || @@ -36,31 +42,18 @@ void *audio_ssr_register(int domain_id, struct notifier_block *nb) } EXPORT_SYMBOL(audio_ssr_register); +/** + * audio_ssr_deregister - + * Deregister handle from SSR framework + * + * @handle: SSR handle + * @nb: notifier block + * + * Returns 0 on success or error on failure + */ int audio_ssr_deregister(void *handle, struct notifier_block *nb) { return subsys_notif_unregister_notifier(handle, nb); } EXPORT_SYMBOL(audio_ssr_deregister); -void audio_ssr_send_nmi(void *ssr_cb_data) -{ - struct notif_data *data = (struct notif_data *)ssr_cb_data; - struct scm_desc desc; - - if (data && data->crashed) { - /* Send NMI to QDSP6 via an SCM call. */ - if (!is_scm_armv8()) { - scm_call_atomic1(SCM_SVC_UTIL, - SCM_Q6_NMI_CMD, 0x1); - } else { - desc.args[0] = 0x1; - desc.arginfo = SCM_ARGS(1); - scm_call2_atomic(SCM_SIP_FNID(SCM_SVC_UTIL, - SCM_Q6_NMI_CMD), &desc); - } - /* The write should go through before q6 is shutdown */ - mb(); - pr_debug("%s: Q6 NMI was sent.\n", __func__); - } -} -EXPORT_SYMBOL(audio_ssr_send_nmi); diff --git a/dsp/avtimer.c b/dsp/avtimer.c index 63044db6e4..184e0e9370 100644 --- a/dsp/avtimer.c +++ b/dsp/avtimer.c @@ -517,7 +517,7 @@ static struct platform_driver dev_avtimer_driver = { }, }; -static int __init avtimer_init(void) +int __init avtimer_init(void) { s32 rc; @@ -535,14 +535,10 @@ error_platform_driver: return rc; } -static void __exit avtimer_exit(void) +void __exit avtimer_exit(void) { - pr_debug("%s: avtimer_exit\n", __func__); platform_driver_unregister(&dev_avtimer_driver); } -module_init(avtimer_init); -module_exit(avtimer_exit); - MODULE_DESCRIPTION("avtimer driver"); MODULE_LICENSE("GPL v2"); diff --git a/dsp/codecs/Android.mk b/dsp/codecs/Android.mk new file mode 100644 index 0000000000..865ace12cb --- /dev/null +++ b/dsp/codecs/Android.mk @@ -0,0 +1,54 @@ +# Android makefile for audio kernel modules + +# Assume no targets will be supported + +# Check if this driver needs be built for current target +ifeq ($(call is-board-platform,sdm845),true) +AUDIO_SELECT := CONFIG_SND_SOC_SDM845=m +endif + +ifeq ($(call is-board-platform,sdm670),true) +AUDIO_SELECT := CONFIG_SND_SOC_SDM670=m +endif + +AUDIO_CHIPSET := audio +# Build/Package only in case of supported target +ifeq ($(call is-board-platform-in-list,sdm845 sdm670),true) + +LOCAL_PATH := $(call my-dir) + +# This makefile is only for DLKM +ifneq ($(findstring vendor,$(LOCAL_PATH)),) + +ifneq ($(findstring opensource,$(LOCAL_PATH)),) + AUDIO_BLD_DIR := $(ANDROID_BUILD_TOP)/vendor/qcom/opensource/audio-kernel +endif # opensource + +DLKM_DIR := $(TOP)/device/qcom/common/dlkm + +# Build audio.ko as $(AUDIO_CHIPSET)_audio.ko +########################################################### +# This is set once per LOCAL_PATH, not per (kernel) module +KBUILD_OPTIONS := AUDIO_ROOT=$(AUDIO_BLD_DIR) + +# We are actually building audio.ko here, as per the +# requirement we are specifying _audio.ko as LOCAL_MODULE. +# This means we need to rename the module to _audio.ko +# after audio.ko is built. +KBUILD_OPTIONS += MODNAME=native_dlkm +KBUILD_OPTIONS += BOARD_PLATFORM=$(TARGET_BOARD_PLATFORM) +KBUILD_OPTIONS += $(AUDIO_SELECT) + +########################################################### +include $(CLEAR_VARS) +LOCAL_MODULE := $(AUDIO_CHIPSET)_native.ko +LOCAL_MODULE_KBUILD_NAME := native_dlkm.ko +LOCAL_MODULE_TAGS := optional +LOCAL_MODULE_DEBUG_ENABLE := true +LOCAL_MODULE_PATH := $(KERNEL_MODULES_OUT) +include $(DLKM_DIR)/AndroidKernelModule.mk +########################################################### +########################################################### + +endif # DLKM check +endif # supported target check diff --git a/dsp/codecs/Kbuild b/dsp/codecs/Kbuild new file mode 100644 index 0000000000..683f5997bd --- /dev/null +++ b/dsp/codecs/Kbuild @@ -0,0 +1,133 @@ +# We can build either as part of a standalone Kernel build or as +# an external module. Determine which mechanism is being used +KERNEL_BUILD := 0 + + +ifeq ($(KERNEL_BUILD), 0) + # These are configurable via Kconfig for kernel-based builds + # Need to explicitly configure for Android-based builds + ifeq ($(CONFIG_ARCH_SDM845), y) + include $(AUDIO_ROOT)/config/sdm845auto.conf + export + endif + ifeq ($(CONFIG_ARCH_SDM670), y) + include $(AUDIO_ROOT)/config/sdm670auto.conf + export + endif +endif + + +# As per target team, build is done as follows: +# Defconfig : build with default flags +# Slub : defconfig + CONFIG_SLUB_DEBUG := y + +# CONFIG_SLUB_DEBUG_ON := y + CONFIG_PAGE_POISONING := y +# Perf : Using appropriate msmXXXX-perf_defconfig +# +# Shipment builds (user variants) should not have any debug feature +# enabled. This is identified using 'TARGET_BUILD_VARIANT'. Slub builds +# are identified using the CONFIG_SLUB_DEBUG_ON configuration. Since +# there is no other way to identify defconfig builds, QTI internal +# representation of perf builds (identified using the string 'perf'), +# is used to identify if the build is a slub or defconfig one. This +# way no critical debug feature will be enabled for perf and shipment +# builds. Other OEMs are also protected using the TARGET_BUILD_VARIANT +# config. + +############ UAPI ############ +UAPI_DIR := uapi +UAPI_INC := -I$(AUDIO_ROOT)/include/$(UAPI_DIR) + +############ COMMON ############ +COMMON_DIR := include +COMMON_INC := -I$(AUDIO_ROOT)/$(COMMON_DIR) + +############ Native Enc/Dec ############ + +ifeq ($(CONFIG_MSM_QDSP6V2_CODECS), m) + NATIVE_OBJS += q6audio_v2.o q6audio_v2_aio.o + NATIVE_OBJS += audio_utils_aio.o + NATIVE_OBJS += audio_utils.o + NATIVE_OBJS += audio_native.o + NATIVE_OBJS += aac_in.o + NATIVE_OBJS += amrnb_in.o + NATIVE_OBJS += amrwb_in.o + NATIVE_OBJS += audio_aac.o + NATIVE_OBJS += audio_alac.o + NATIVE_OBJS += audio_amrnb.o + NATIVE_OBJS += audio_amrwb.o + NATIVE_OBJS += audio_amrwbplus.o + NATIVE_OBJS += audio_ape.o + NATIVE_OBJS += audio_evrc.o + NATIVE_OBJS += audio_g711alaw.o + NATIVE_OBJS += audio_g711mlaw.o + NATIVE_OBJS += audio_hwacc_effects.o + NATIVE_OBJS += audio_mp3.o + NATIVE_OBJS += audio_multi_aac.o + NATIVE_OBJS += audio_qcelp.o + NATIVE_OBJS += audio_wma.o + NATIVE_OBJS += audio_wmapro.o + NATIVE_OBJS += evrc_in.o + NATIVE_OBJS += g711alaw_in.o + NATIVE_OBJS += g711mlaw_in.o + NATIVE_OBJS += qcelp_in.o +endif + +LINUX_INC += -Iinclude/linux + +INCS := $(COMMON_INC) \ + $(UAPI_INC) + +ifeq ($(CONFIG_ARCH_SDM845), y) +INCS += -include $(AUDIO_ROOT)/config/sdm845autoconf.h +endif +ifeq ($(CONFIG_ARCH_SDM670), y) +INCS += -include $(AUDIO_ROOT)/config/sdm670autoconf.h +endif + +EXTRA_CFLAGS += $(INCS) + + +CDEFINES += -DANI_LITTLE_BYTE_ENDIAN \ + -DANI_LITTLE_BIT_ENDIAN \ + -DDOT11F_LITTLE_ENDIAN_HOST \ + -DANI_COMPILER_TYPE_GCC \ + -DANI_OS_TYPE_ANDROID=6 \ + -DPTT_SOCK_SVC_ENABLE \ + -Wall\ + -Werror\ + -D__linux__ + +KBUILD_CPPFLAGS += $(CDEFINES) + +# Currently, for versions of gcc which support it, the kernel Makefile +# is disabling the maybe-uninitialized warning. Re-enable it for the +# AUDIO driver. Note that we must use EXTRA_CFLAGS here so that it +# will override the kernel settings. +ifeq ($(call cc-option-yn, -Wmaybe-uninitialized),y) +EXTRA_CFLAGS += -Wmaybe-uninitialized +endif +#EXTRA_CFLAGS += -Wmissing-prototypes + +ifeq ($(call cc-option-yn, -Wheader-guard),y) +EXTRA_CFLAGS += -Wheader-guard +endif + +KBUILD_EXTRA_SYMBOLS +=$(OUT)/obj/vendor/qcom/opensource/audio-kernel/dsp/Module.symvers +KBUILD_EXTRA_SYMBOLS +=$(OUT)/obj/vendor/qcom/opensource/audio-kernel/asoc/Module.symvers +# If the module name is not "wlan", then the define MULTI_IF_NAME to be the +# same a the QCA CHIP name. The host driver will then append MULTI_IF_NAME to +# any string that must be unique for all instances of the driver on the system. +# This allows multiple instances of the driver with different module names. +# If the module name is wlan, leave MULTI_IF_NAME undefined and the code will +# treat the driver as the primary driver. +ifneq ($(MODNAME), qdsp6v2) +CHIP_NAME ?= $(MODNAME) +CDEFINES += -DMULTI_IF_NAME=\"$(CHIP_NAME)\" +endif + +# Module information used by KBuild framework +obj-$(CONFIG_MSM_QDSP6V2_CODECS) += native_dlkm.o +native_dlkm-y := $(NATIVE_OBJS) + +# inject some build related information +DEFINES += -DBUILD_TIMESTAMP=\"$(shell date -u +'%Y-%m-%dT%H:%M:%SZ')\" diff --git a/dsp/codecs/aac_in.c b/dsp/codecs/aac_in.c index c0828dc6d1..5c07141655 100644 --- a/dsp/codecs/aac_in.c +++ b/dsp/codecs/aac_in.c @@ -702,8 +702,12 @@ struct miscdevice audio_aac_in_misc = { .fops = &audio_in_fops, }; -static int __init aac_in_init(void) +int __init aac_in_init(void) { return misc_register(&audio_aac_in_misc); } -device_initcall(aac_in_init); + +void __exit aac_in_exit(void) +{ + misc_deregister(&audio_aac_in_misc); +} diff --git a/dsp/codecs/amrnb_in.c b/dsp/codecs/amrnb_in.c index b24764cf95..d9a019de91 100644 --- a/dsp/codecs/amrnb_in.c +++ b/dsp/codecs/amrnb_in.c @@ -394,9 +394,12 @@ struct miscdevice audio_amrnb_in_misc = { .fops = &audio_in_fops, }; -static int __init amrnb_in_init(void) +int __init amrnb_in_init(void) { return misc_register(&audio_amrnb_in_misc); } -device_initcall(amrnb_in_init); +void __exit amrnb_in_exit(void) +{ + misc_deregister(&audio_amrnb_in_misc); +} diff --git a/dsp/codecs/amrwb_in.c b/dsp/codecs/amrwb_in.c index 77b4be54f1..d1d4ab71b8 100644 --- a/dsp/codecs/amrwb_in.c +++ b/dsp/codecs/amrwb_in.c @@ -392,9 +392,12 @@ struct miscdevice audio_amrwb_in_misc = { .fops = &audio_in_fops, }; -static int __init amrwb_in_init(void) +int __init amrwb_in_init(void) { return misc_register(&audio_amrwb_in_misc); } -device_initcall(amrwb_in_init); +void __exit amrwb_in_exit(void) +{ + misc_deregister(&audio_amrwb_in_misc); +} diff --git a/dsp/codecs/audio_aac.c b/dsp/codecs/audio_aac.c index 006b21c679..ea7506fbe6 100644 --- a/dsp/codecs/audio_aac.c +++ b/dsp/codecs/audio_aac.c @@ -461,7 +461,7 @@ static struct miscdevice audio_aac_misc = { .fops = &audio_aac_fops, }; -static int __init audio_aac_init(void) +int __init audio_aac_init(void) { int ret = misc_register(&audio_aac_misc); @@ -473,4 +473,8 @@ static int __init audio_aac_init(void) return ret; } -device_initcall(audio_aac_init); +void __exit audio_aac_exit(void) +{ + mutex_destroy(&audio_aac_ws_mgr.ws_lock); + misc_deregister(&audio_aac_misc); +} diff --git a/dsp/codecs/audio_alac.c b/dsp/codecs/audio_alac.c index d0b86c6848..50a0bf7e34 100644 --- a/dsp/codecs/audio_alac.c +++ b/dsp/codecs/audio_alac.c @@ -420,7 +420,7 @@ static struct miscdevice audio_alac_misc = { .fops = &audio_alac_fops, }; -static int __init audio_alac_init(void) +int __init audio_alac_init(void) { int ret = misc_register(&audio_alac_misc); @@ -432,4 +432,8 @@ static int __init audio_alac_init(void) return ret; } -device_initcall(audio_alac_init); +void __exit audio_alac_exit(void) +{ + mutex_destroy(&audio_alac_ws_mgr.ws_lock); + misc_deregister(&audio_alac_misc); +} diff --git a/dsp/codecs/audio_amrnb.c b/dsp/codecs/audio_amrnb.c index 950098be9b..041774259a 100644 --- a/dsp/codecs/audio_amrnb.c +++ b/dsp/codecs/audio_amrnb.c @@ -211,7 +211,7 @@ static struct miscdevice audio_amrnb_misc = { .fops = &audio_amrnb_fops, }; -static int __init audio_amrnb_init(void) +int __init audio_amrnb_init(void) { int ret = misc_register(&audio_amrnb_misc); @@ -223,4 +223,8 @@ static int __init audio_amrnb_init(void) return ret; } -device_initcall(audio_amrnb_init); +void __exit audio_amrnb_exit(void) +{ + mutex_destroy(&audio_amrnb_ws_mgr.ws_lock); + misc_deregister(&audio_amrnb_misc); +} diff --git a/dsp/codecs/audio_amrwb.c b/dsp/codecs/audio_amrwb.c index cb5db0d61e..091bee4d3f 100644 --- a/dsp/codecs/audio_amrwb.c +++ b/dsp/codecs/audio_amrwb.c @@ -216,7 +216,7 @@ static struct miscdevice audio_amrwb_misc = { .fops = &audio_amrwb_fops, }; -static int __init audio_amrwb_init(void) +int __init audio_amrwb_init(void) { int ret = misc_register(&audio_amrwb_misc); @@ -228,4 +228,8 @@ static int __init audio_amrwb_init(void) return ret; } -device_initcall(audio_amrwb_init); +void __exit audio_amrwb_exit(void) +{ + mutex_destroy(&audio_amrwb_ws_mgr.ws_lock); + misc_deregister(&audio_amrwb_misc); +} diff --git a/dsp/codecs/audio_amrwbplus.c b/dsp/codecs/audio_amrwbplus.c index 458a80c4c5..566aee735e 100644 --- a/dsp/codecs/audio_amrwbplus.c +++ b/dsp/codecs/audio_amrwbplus.c @@ -382,7 +382,7 @@ static struct miscdevice audio_amrwbplus_misc = { .fops = &audio_amrwbplus_fops, }; -static int __init audio_amrwbplus_init(void) +int __init audio_amrwbplus_init(void) { int ret = misc_register(&audio_amrwbplus_misc); @@ -394,4 +394,8 @@ static int __init audio_amrwbplus_init(void) return ret; } -device_initcall(audio_amrwbplus_init); +void __exit audio_amrwbplus_exit(void) +{ + mutex_destroy(&audio_amrwbplus_ws_mgr.ws_lock); + misc_deregister(&audio_amrwbplus_misc); +} diff --git a/dsp/codecs/audio_ape.c b/dsp/codecs/audio_ape.c index d7dc0648ae..b11f83ef56 100644 --- a/dsp/codecs/audio_ape.c +++ b/dsp/codecs/audio_ape.c @@ -344,7 +344,7 @@ static struct miscdevice audio_ape_misc = { .fops = &audio_ape_fops, }; -static int __init audio_ape_init(void) +int __init audio_ape_init(void) { int ret = misc_register(&audio_ape_misc); @@ -356,4 +356,8 @@ static int __init audio_ape_init(void) return ret; } -device_initcall(audio_ape_init); +void __exit audio_ape_exit(void) +{ + mutex_destroy(&audio_ape_ws_mgr.ws_lock); + misc_deregister(&audio_ape_misc); +} diff --git a/dsp/codecs/audio_evrc.c b/dsp/codecs/audio_evrc.c index 87762319b0..78bbde6486 100644 --- a/dsp/codecs/audio_evrc.c +++ b/dsp/codecs/audio_evrc.c @@ -169,7 +169,7 @@ static struct miscdevice audio_evrc_misc = { .fops = &audio_evrc_fops, }; -static int __init audio_evrc_init(void) +int __init audio_evrc_init(void) { int ret = misc_register(&audio_evrc_misc); @@ -181,4 +181,8 @@ static int __init audio_evrc_init(void) return ret; } -device_initcall(audio_evrc_init); +void __exit audio_evrc_exit(void) +{ + mutex_destroy(&audio_evrc_ws_mgr.ws_lock); + misc_deregister(&audio_evrc_misc); +} diff --git a/dsp/codecs/audio_g711alaw.c b/dsp/codecs/audio_g711alaw.c index 24f87e4bd1..a6e0a6e624 100644 --- a/dsp/codecs/audio_g711alaw.c +++ b/dsp/codecs/audio_g711alaw.c @@ -375,7 +375,7 @@ static struct miscdevice audio_g711alaw_misc = { .fops = &audio_g711_fops, }; -static int __init audio_g711alaw_init(void) +int __init audio_g711alaw_init(void) { int ret = misc_register(&audio_g711alaw_misc); @@ -386,11 +386,9 @@ static int __init audio_g711alaw_init(void) return ret; } -static void __exit audio_g711alaw_exit(void) -{ - misc_deregister(&audio_g711alaw_misc); - mutex_destroy(&audio_g711_ws_mgr.ws_lock); -} -device_initcall(audio_g711alaw_init); -__exitcall(audio_g711alaw_exit); +void __exit audio_g711alaw_exit(void) +{ + mutex_destroy(&audio_g711_ws_mgr.ws_lock); + misc_deregister(&audio_g711alaw_misc); +} diff --git a/dsp/codecs/audio_g711mlaw.c b/dsp/codecs/audio_g711mlaw.c index 10d3680119..2a2598c708 100644 --- a/dsp/codecs/audio_g711mlaw.c +++ b/dsp/codecs/audio_g711mlaw.c @@ -374,7 +374,7 @@ static struct miscdevice audio_g711mlaw_misc = { .fops = &audio_g711_fops, }; -static int __init audio_g711mlaw_init(void) +int __init audio_g711mlaw_init(void) { int ret = misc_register(&audio_g711mlaw_misc); @@ -386,11 +386,9 @@ static int __init audio_g711mlaw_init(void) return ret; } -static void __exit audio_g711mlaw_exit(void) +void __exit audio_g711mlaw_exit(void) { - misc_deregister(&audio_g711mlaw_misc); mutex_destroy(&audio_g711_ws_mgr.ws_lock); + misc_deregister(&audio_g711mlaw_misc); } -device_initcall(audio_g711mlaw_init); -__exitcall(audio_g711mlaw_exit); diff --git a/dsp/codecs/audio_hwacc_effects.c b/dsp/codecs/audio_hwacc_effects.c index 9444aa7c62..c285511d3b 100644 --- a/dsp/codecs/audio_hwacc_effects.c +++ b/dsp/codecs/audio_hwacc_effects.c @@ -768,11 +768,15 @@ struct miscdevice audio_effects_misc = { .fops = &audio_effects_fops, }; -static int __init audio_effects_init(void) +int __init audio_effects_init(void) { return misc_register(&audio_effects_misc); } -device_initcall(audio_effects_init); +void __exit audio_effects_exit(void) +{ + misc_deregister(&audio_effects_misc); +} + MODULE_DESCRIPTION("Audio hardware accelerated effects driver"); MODULE_LICENSE("GPL v2"); diff --git a/dsp/codecs/audio_mp3.c b/dsp/codecs/audio_mp3.c index 0b10c7a836..81e8486ada 100644 --- a/dsp/codecs/audio_mp3.c +++ b/dsp/codecs/audio_mp3.c @@ -173,7 +173,7 @@ static struct miscdevice audio_mp3_misc = { .fops = &audio_mp3_fops, }; -static int __init audio_mp3_init(void) +int __init audio_mp3_init(void) { int ret = misc_register(&audio_mp3_misc); @@ -185,4 +185,8 @@ static int __init audio_mp3_init(void) return ret; } -device_initcall(audio_mp3_init); +void __exit audio_mp3_exit(void) +{ + mutex_destroy(&audio_mp3_ws_mgr.ws_lock); + misc_deregister(&audio_mp3_misc); +} diff --git a/dsp/codecs/audio_multi_aac.c b/dsp/codecs/audio_multi_aac.c index 5d407e0c5e..c3e616aef4 100644 --- a/dsp/codecs/audio_multi_aac.c +++ b/dsp/codecs/audio_multi_aac.c @@ -508,7 +508,7 @@ static struct miscdevice audio_multiaac_misc = { .fops = &audio_aac_fops, }; -static int __init audio_aac_init(void) +int __init audio_multiaac_init(void) { int ret = misc_register(&audio_multiaac_misc); @@ -520,4 +520,8 @@ static int __init audio_aac_init(void) return ret; } -device_initcall(audio_aac_init); +void __exit audio_multiaac_exit(void) +{ + mutex_destroy(&audio_multiaac_ws_mgr.ws_lock); + misc_deregister(&audio_multiaac_misc); +} diff --git a/dsp/codecs/audio_native.c b/dsp/codecs/audio_native.c new file mode 100644 index 0000000000..8f21cc74f0 --- /dev/null +++ b/dsp/codecs/audio_native.c @@ -0,0 +1,75 @@ +/* +Copyright (c) 2017, The Linux Foundation. All rights reserved. + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License version 2 and +only version 2 as published by the Free Software Foundation. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. +* +*/ + +#include +#include +#include "audio_utils.h" + +static int __init audio_native_init(void) +{ + aac_in_init(); + amrnb_in_init(); + amrwb_in_init(); + audio_aac_init(); + audio_alac_init(); + audio_amrnb_init(); + audio_amrwb_init(); + audio_amrwbplus_init(); + audio_ape_init(); + audio_evrc_init(); + audio_g711alaw_init(); + audio_g711mlaw_init(); + audio_effects_init(); + audio_mp3_init(); + audio_multiaac_init(); + audio_qcelp_init(); + audio_wma_init(); + audio_wmapro_init(); + evrc_in_init(); + g711alaw_in_init(); + g711mlaw_in_init(); + qcelp_in_init(); + return 0; +} + +static void __exit audio_native_exit(void) +{ + aac_in_exit(); + amrnb_in_exit(); + amrwb_in_exit(); + audio_aac_exit(); + audio_alac_exit(); + audio_amrnb_exit(); + audio_amrwb_exit(); + audio_amrwbplus_exit(); + audio_ape_exit(); + audio_evrc_exit(); + audio_g711alaw_exit(); + audio_g711mlaw_exit(); + audio_effects_exit(); + audio_mp3_exit(); + audio_multiaac_exit(); + audio_qcelp_exit(); + audio_wma_exit(); + audio_wmapro_exit(); + evrc_in_exit(); + g711alaw_in_exit(); + g711mlaw_in_exit(); + qcelp_in_exit(); +} + +module_init(audio_native_init); +module_exit(audio_native_exit); +MODULE_LICENSE("GPL v2"); +MODULE_DESCRIPTION("Native Encoder/Decoder module"); diff --git a/dsp/codecs/audio_qcelp.c b/dsp/codecs/audio_qcelp.c index 8f2511c40b..86902948dd 100644 --- a/dsp/codecs/audio_qcelp.c +++ b/dsp/codecs/audio_qcelp.c @@ -176,7 +176,7 @@ static struct miscdevice audio_qcelp_misc = { .fops = &audio_qcelp_fops, }; -static int __init audio_qcelp_init(void) +int audio_qcelp_init(void) { int ret = misc_register(&audio_qcelp_misc); @@ -188,4 +188,8 @@ static int __init audio_qcelp_init(void) return ret; } -device_initcall(audio_qcelp_init); +void __exit audio_qcelp_exit(void) +{ + mutex_destroy(&audio_qcelp_ws_mgr.ws_lock); + misc_deregister(&audio_qcelp_misc); +} diff --git a/dsp/codecs/audio_utils.h b/dsp/codecs/audio_utils.h index f5517d8336..3ad6903b33 100644 --- a/dsp/codecs/audio_utils.h +++ b/dsp/codecs/audio_utils.h @@ -112,3 +112,47 @@ ssize_t audio_in_write(struct file *file, const char __user *buf, size_t count, loff_t *pos); int audio_in_release(struct inode *inode, struct file *file); int audio_in_set_config(struct file *file, struct msm_audio_config *cfg); +int aac_in_init(void); +int amrnb_in_init(void); +int amrwb_in_init(void); +int audio_aac_init(void); +int audio_alac_init(void); +int audio_amrnb_init(void); +int audio_amrwb_init(void); +int audio_amrwbplus_init(void); +int audio_ape_init(void); +int audio_evrc_init(void); +int audio_g711alaw_init(void); +int audio_g711mlaw_init(void); +int audio_effects_init(void); +int audio_mp3_init(void); +int audio_multiaac_init(void); +int audio_qcelp_init(void); +int audio_wma_init(void); +int audio_wmapro_init(void); +int evrc_in_init(void); +int g711alaw_in_init(void); +int g711mlaw_in_init(void); +int qcelp_in_init(void); +void aac_in_exit(void); +void amrnb_in_exit(void); +void amrwb_in_exit(void); +void audio_aac_exit(void); +void audio_alac_exit(void); +void audio_amrnb_exit(void); +void audio_amrwb_exit(void); +void audio_amrwbplus_exit(void); +void audio_ape_exit(void); +void audio_evrc_exit(void); +void audio_g711alaw_exit(void); +void audio_g711mlaw_exit(void); +void audio_effects_exit(void); +void audio_mp3_exit(void); +void audio_multiaac_exit(void); +void audio_qcelp_exit(void); +void audio_wma_exit(void); +void audio_wmapro_exit(void); +void evrc_in_exit(void); +void g711alaw_in_exit(void); +void g711mlaw_in_exit(void); +void qcelp_in_exit(void); diff --git a/dsp/codecs/audio_wma.c b/dsp/codecs/audio_wma.c index e35334a331..975dc0b01c 100644 --- a/dsp/codecs/audio_wma.c +++ b/dsp/codecs/audio_wma.c @@ -330,7 +330,7 @@ static struct miscdevice audio_wma_misc = { .fops = &audio_wma_fops, }; -static int __init audio_wma_init(void) +int __init audio_wma_init(void) { int ret = misc_register(&audio_wma_misc); @@ -342,4 +342,8 @@ static int __init audio_wma_init(void) return ret; } -device_initcall(audio_wma_init); +void __exit audio_wma_exit(void) +{ + mutex_destroy(&audio_wma_ws_mgr.ws_lock); + misc_deregister(&audio_wma_misc); +} diff --git a/dsp/codecs/audio_wmapro.c b/dsp/codecs/audio_wmapro.c index 3cb9db15f8..3ce4cdc86e 100644 --- a/dsp/codecs/audio_wmapro.c +++ b/dsp/codecs/audio_wmapro.c @@ -403,7 +403,7 @@ static struct miscdevice audio_wmapro_misc = { .fops = &audio_wmapro_fops, }; -static int __init audio_wmapro_init(void) +int __init audio_wmapro_init(void) { int ret = misc_register(&audio_wmapro_misc); @@ -415,4 +415,8 @@ static int __init audio_wmapro_init(void) return ret; } -device_initcall(audio_wmapro_init); +void __exit audio_wmapro_exit(void) +{ + mutex_destroy(&audio_wmapro_ws_mgr.ws_lock); + misc_deregister(&audio_wmapro_misc); +} diff --git a/dsp/codecs/evrc_in.c b/dsp/codecs/evrc_in.c index e30271dd81..158ff6f08c 100644 --- a/dsp/codecs/evrc_in.c +++ b/dsp/codecs/evrc_in.c @@ -402,9 +402,12 @@ struct miscdevice audio_evrc_in_misc = { .fops = &audio_in_fops, }; -static int __init evrc_in_init(void) +int __init evrc_in_init(void) { return misc_register(&audio_evrc_in_misc); } -device_initcall(evrc_in_init); +void __exit evrc_in_exit(void) +{ + misc_deregister(&audio_evrc_in_misc); +} diff --git a/dsp/codecs/g711alaw_in.c b/dsp/codecs/g711alaw_in.c index bc8c0a36a8..bd49bc9ab7 100644 --- a/dsp/codecs/g711alaw_in.c +++ b/dsp/codecs/g711alaw_in.c @@ -374,9 +374,12 @@ struct miscdevice audio_g711alaw_in_misc = { .fops = &audio_in_fops, }; -static int __init g711alaw_in_init(void) +int __init g711alaw_in_init(void) { return misc_register(&audio_g711alaw_in_misc); } -device_initcall(g711alaw_in_init); +void __exit g711alaw_in_exit(void) +{ + misc_deregister(&audio_g711alaw_in_misc); +} diff --git a/dsp/codecs/g711mlaw_in.c b/dsp/codecs/g711mlaw_in.c index b92c449573..d646bd1330 100644 --- a/dsp/codecs/g711mlaw_in.c +++ b/dsp/codecs/g711mlaw_in.c @@ -377,9 +377,12 @@ struct miscdevice audio_g711mlaw_in_misc = { .fops = &audio_in_fops, }; -static int __init g711mlaw_in_init(void) +int __init g711mlaw_in_init(void) { return misc_register(&audio_g711mlaw_in_misc); } -device_initcall(g711mlaw_in_init); +void __exit g711mlaw_in_exit(void) +{ + misc_deregister(&audio_g711mlaw_in_misc); +} diff --git a/dsp/codecs/qcelp_in.c b/dsp/codecs/qcelp_in.c index da5520f75a..050c95f389 100644 --- a/dsp/codecs/qcelp_in.c +++ b/dsp/codecs/qcelp_in.c @@ -402,9 +402,12 @@ struct miscdevice audio_qcelp_in_misc = { .fops = &audio_in_fops, }; -static int __init qcelp_in_init(void) +int __init qcelp_in_init(void) { return misc_register(&audio_qcelp_in_misc); } -device_initcall(qcelp_in_init); +void __exit qcelp_in_exit(void) +{ + misc_deregister(&audio_qcelp_in_misc); +} diff --git a/asoc/msm-dts-srs-tm-config.c b/dsp/msm-dts-srs-tm-config.c similarity index 92% rename from asoc/msm-dts-srs-tm-config.c rename to dsp/msm-dts-srs-tm-config.c index 78174afb9b..cd3da4d642 100644 --- a/asoc/msm-dts-srs-tm-config.c +++ b/dsp/msm-dts-srs-tm-config.c @@ -18,10 +18,9 @@ #include #include #include -#include #include #include -#include "msm-pcm-routing-v2.h" +#include static int srs_port_id[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; pr_debug("SRS control normal called\n"); - msm_pcm_routing_acquire_lock(); + msm_dts_srs_acquire_lock(); port_id = SLIMBUS_0_RX; ret = msm_dts_srs_trumedia_control_set_(port_id, kcontrol, ucontrol); - msm_pcm_routing_release_lock(); + msm_dts_srs_release_lock(); return ret; } @@ -155,10 +154,10 @@ static int msm_dts_srs_trumedia_control_i2s_set(struct snd_kcontrol *kcontrol, int ret, port_id; pr_debug("SRS control I2S called\n"); - msm_pcm_routing_acquire_lock(); + msm_dts_srs_acquire_lock(); port_id = PRIMARY_I2S_RX; ret = msm_dts_srs_trumedia_control_set_(port_id, kcontrol, ucontrol); - msm_pcm_routing_release_lock(); + msm_dts_srs_release_lock(); return ret; } @@ -168,10 +167,10 @@ static int msm_dts_srs_trumedia_control_mi2s_set(struct snd_kcontrol *kcontrol, int ret, port_id; 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; ret = msm_dts_srs_trumedia_control_set_(port_id, kcontrol, ucontrol); - msm_pcm_routing_release_lock(); + msm_dts_srs_release_lock(); return ret; } @@ -181,10 +180,10 @@ static int msm_dts_srs_trumedia_control_hdmi_set(struct snd_kcontrol *kcontrol, int ret, port_id; pr_debug("SRS control HDMI called\n"); - msm_pcm_routing_acquire_lock(); + msm_dts_srs_acquire_lock(); port_id = HDMI_RX; ret = msm_dts_srs_trumedia_control_set_(port_id, kcontrol, ucontrol); - msm_pcm_routing_release_lock(); + msm_dts_srs_release_lock(); 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) { 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, ARRAY_SIZE(lpa_srs_trumedia_controls_mi2s)); } +EXPORT_SYMBOL(msm_dts_srs_tm_add_controls); static int reg_ion_mem(void) { @@ -322,6 +329,13 @@ static void unreg_ion_mem(void) po.size = 0; } +/** + * msm_dts_srs_tm_deinit - + * De-Initializes DTS SRS module + * + * @port_id: Port ID number + * + */ void msm_dts_srs_tm_deinit(int port_id) { set_port_id(port_id, -1); @@ -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) { 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); } +EXPORT_SYMBOL(msm_dts_srs_tm_init); diff --git a/dsp/msm_audio_ion.c b/dsp/msm_audio_ion.c index 24df1aa067..0baca8dd54 100644 --- a/dsp/msm_audio_ion.c +++ b/dsp/msm_audio_ion.c @@ -89,6 +89,20 @@ static void msm_audio_ion_add_allocation( mutex_unlock(&(msm_audio_ion_data->list_mutex)); } +/** + * msm_audio_ion_alloc - + * Allocs ION memory for given client name + * + * @name: Name of audio ION client + * @client: ION client to be assigned + * @handle: ION handle to be assigned + * @bufsz: buffer size + * @paddr: Physical address to be assigned with allocated region + * @pa_len: length of allocated region to be assigned + * vaddr: virtual address to be assigned + * + * Returns 0 on success or error on failure + */ int msm_audio_ion_alloc(const char *name, struct ion_client **client, struct ion_handle **handle, size_t bufsz, ion_phys_addr_t *paddr, size_t *pa_len, void **vaddr) @@ -243,6 +257,15 @@ err: return rc; } +/** + * msm_audio_ion_free - + * fress ION memory for given client and handle + * + * @client: ION client + * @handle: ION handle + * + * Returns 0 on success or error on failure + */ int msm_audio_ion_free(struct ion_client *client, struct ion_handle *handle) { if (!client || !handle) { @@ -260,6 +283,15 @@ int msm_audio_ion_free(struct ion_client *client, struct ion_handle *handle) } EXPORT_SYMBOL(msm_audio_ion_free); +/** + * msm_audio_ion_mmap - + * Audio ION memory map + * + * @ab: audio buf pointer + * @vma: virtual mem area + * + * Returns 0 on success or error on failure + */ int msm_audio_ion_mmap(struct audio_buffer *ab, struct vm_area_struct *vma) { @@ -351,6 +383,7 @@ int msm_audio_ion_mmap(struct audio_buffer *ab, } return 0; } +EXPORT_SYMBOL(msm_audio_ion_mmap); 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); return pclient; } +EXPORT_SYMBOL(msm_audio_ion_client_create); - +/** + * msm_audio_ion_client_destroy - + * Removes ION client handle + * + * @client: ION client + * + */ void msm_audio_ion_client_destroy(struct ion_client *client) { pr_debug("%s: client = %pK smmu_enabled = %d\n", __func__, @@ -375,7 +415,24 @@ void msm_audio_ion_client_destroy(struct ion_client *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, struct ion_handle **handle, int fd, unsigned long *ionflag, size_t bufsz, @@ -438,7 +495,16 @@ err_ion_handle: err: return rc; } +EXPORT_SYMBOL(msm_audio_ion_import_legacy); +/** + * msm_audio_ion_free_legacy - + * Frees ION memory for given handle + * + * @client: ION client + * @handle: ION handle + * + */ int msm_audio_ion_free_legacy(struct ion_client *client, struct ion_handle *handle) { @@ -451,6 +517,7 @@ int msm_audio_ion_free_legacy(struct ion_client *client, /* no client_destrody in legacy*/ return 0; } +EXPORT_SYMBOL(msm_audio_ion_free_legacy); int msm_audio_ion_cache_operations(struct audio_buffer *abuff, int cache_op) { @@ -710,6 +777,13 @@ u32 msm_audio_ion_get_smmu_sid_mode32(void) return 0; } +/** + * msm_audio_populate_upper_32_bits - + * retrieve upper 32bits of 64bit address + * + * @pa: 64bit physical address + * + */ u32 msm_audio_populate_upper_32_bits(ion_phys_addr_t pa) { if (sizeof(ion_phys_addr_t) == sizeof(u32)) @@ -717,6 +791,7 @@ u32 msm_audio_populate_upper_32_bits(ion_phys_addr_t pa) else return upper_32_bits(pa); } +EXPORT_SYMBOL(msm_audio_populate_upper_32_bits); static int msm_audio_ion_probe(struct platform_device *pdev) { @@ -837,17 +912,15 @@ static struct platform_driver msm_audio_ion_driver = { .remove = msm_audio_ion_remove, }; -static int __init msm_audio_ion_init(void) +int __init msm_audio_ion_init(void) { return platform_driver_register(&msm_audio_ion_driver); } -module_init(msm_audio_ion_init); -static void __exit msm_audio_ion_exit(void) +void __exit msm_audio_ion_exit(void) { platform_driver_unregister(&msm_audio_ion_driver); } -module_exit(msm_audio_ion_exit); MODULE_DESCRIPTION("MSM Audio ION module"); MODULE_LICENSE("GPL v2"); diff --git a/dsp/q6_init.c b/dsp/q6_init.c new file mode 100644 index 0000000000..3b885dcb90 --- /dev/null +++ b/dsp/q6_init.c @@ -0,0 +1,55 @@ +/* +Copyright (c) 2017, The Linux Foundation. All rights reserved. + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License version 2 and +only version 2 as published by the Free Software Foundation. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. +* +*/ + +#include +#include +#include "q6_init.h" + +static int __init audio_q6_init(void) +{ + adsp_err_init(); + audio_cal_init(); + rtac_init(); + adm_init(); + afe_init(); + q6asm_init(); + q6lsm_init(); + voice_init(); + core_init(); + msm_audio_ion_init(); + audio_slimslave_init(); + avtimer_init(); + return 0; +} + +static void __exit audio_q6_exit(void) +{ + avtimer_exit(); + audio_slimslave_exit(); + msm_audio_ion_exit(); + core_exit(); + voice_exit(); + q6lsm_exit(); + q6asm_exit(); + afe_exit(); + adm_exit(); + rtac_exit(); + audio_cal_exit(); + adsp_err_exit(); +} + +module_init(audio_q6_init); +module_exit(audio_q6_exit); +MODULE_DESCRIPTION("Q6 module"); +MODULE_LICENSE("GPL v2"); diff --git a/dsp/q6_init.h b/dsp/q6_init.h new file mode 100644 index 0000000000..971e9b29e1 --- /dev/null +++ b/dsp/q6_init.h @@ -0,0 +1,43 @@ +/* +Copyright (c) 2017, The Linux Foundation. All rights reserved. + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License version 2 and +only version 2 as published by the Free Software Foundation. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. +* +*/ + +#ifndef __Q6_INIT_H__ +#define __Q6_INIT_H__ +int adsp_err_init(void); +int adm_init(void); +int afe_init(void); +int q6asm_init(void); +int q6lsm_init(void); +int voice_init(void); +int audio_cal_init(void); +int core_init(void); +int rtac_init(void); +int msm_audio_ion_init(void); +int audio_slimslave_init(void); +int avtimer_init(void); + +void avtimer_exit(void); +void audio_slimslave_exit(void); +void msm_audio_ion_exit(void); +void rtac_exit(void); +void core_exit(void); +void audio_cal_exit(void); +void voice_exit(void); +void q6lsm_exit(void); +void q6asm_exit(void); +void afe_exit(void); +void adm_exit(void); +void adsp_err_exit(void); +#endif + diff --git a/dsp/q6adm.c b/dsp/q6adm.c index 461e155d41..77c28976e3 100644 --- a/dsp/q6adm.c +++ b/dsp/q6adm.c @@ -18,7 +18,7 @@ #include #include #include -#include +#include #include #include #include @@ -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_module_topo_list[ MAX_COPPS_PER_PORT * ADM_GET_TOPO_MODULE_LIST_LENGTH]; +static struct mutex dts_srs_lock; +void msm_dts_srs_acquire_lock(void) +{ + mutex_lock(&dts_srs_lock); +} + +void msm_dts_srs_release_lock(void) +{ + mutex_unlock(&dts_srs_lock); +} + +/** + * adm_validate_and_get_port_index - + * validate given port id + * + * @port_id: Port ID number + * + * Returns valid index on success or error on failure + */ int adm_validate_and_get_port_index(int port_id) { int index; @@ -150,7 +169,16 @@ int adm_validate_and_get_port_index(int port_id) pr_debug("%s: port_idx- %d\n", __func__, index); return index; } +EXPORT_SYMBOL(adm_validate_and_get_port_index); +/** + * adm_get_default_copp_idx - + * retrieve default copp_idx for given port + * + * @port_id: Port ID number + * + * Returns valid value on success or error on failure + */ int adm_get_default_copp_idx(int port_id) { int port_idx = adm_validate_and_get_port_index(port_id), idx; @@ -167,6 +195,7 @@ int adm_get_default_copp_idx(int port_id) } return -EINVAL; } +EXPORT_SYMBOL(adm_get_default_copp_idx); int adm_get_topology_for_port_from_copp_id(int port_id, int copp_id) { @@ -185,6 +214,15 @@ int adm_get_topology_for_port_from_copp_id(int port_id, int copp_id) return 0; } +/** + * adm_get_topology_for_port_copp_idx - + * retrieve topology of given port/copp_idx + * + * @port_id: Port ID number + * @copp_idx: copp index of ADM copp + * + * Returns valid value on success or 0 on failure + */ int adm_get_topology_for_port_copp_idx(int port_id, int copp_idx) { int port_idx = adm_validate_and_get_port_index(port_id); @@ -196,6 +234,7 @@ 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]); } +EXPORT_SYMBOL(adm_get_topology_for_port_copp_idx); int adm_get_indexes_from_copp_id(int copp_id, int *copp_idx, int *port_idx) { @@ -264,6 +303,17 @@ static int adm_get_next_available_copp(int port_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, void *srs_params) { @@ -529,6 +579,7 @@ fail_cmd: kfree(adm_params); return ret; } +EXPORT_SYMBOL(srs_trumedia_open); static int adm_populate_channel_weight(u16 *ptr, struct msm_pcm_channel_mixer *ch_mixer, @@ -790,7 +841,20 @@ fail_cmd: return ret; } +EXPORT_SYMBOL(adm_programable_channel_mixer); +/** + * adm_set_stereo_to_custom_stereo - + * command to update custom stereo + * + * @port_id: Port ID number + * @copp_idx: copp index of ADM copp + * @session_id: session id to be updated + * @params: params pointer + * @param_length: length of params + * + * Returns 0 on success or error on failure + */ int adm_set_stereo_to_custom_stereo(int port_id, int copp_idx, unsigned int session_id, char *params, uint32_t params_length) @@ -876,7 +940,19 @@ set_stereo_to_custom_stereo_return: kfree(adm_params); return rc; } +EXPORT_SYMBOL(adm_set_stereo_to_custom_stereo); +/** + * adm_dolby_dap_send_params - + * command to send dolby dap params + * + * @port_id: Port ID number + * @copp_idx: copp index of ADM copp + * @params: params pointer + * @param_length: length of params + * + * Returns 0 on success or error on failure + */ int adm_dolby_dap_send_params(int port_id, int copp_idx, char *params, uint32_t params_length) { @@ -951,7 +1027,19 @@ dolby_dap_send_param_return: kfree(adm_params); return rc; } +EXPORT_SYMBOL(adm_dolby_dap_send_params); +/** + * adm_get_params_v5 - + * command to retrieve ADM params for given module + * + * @port_id: Port ID number + * @copp_idx: copp index of ADM copp + * @params: params pointer + * @param_length: length of params + * + * Returns 0 on success or error on failure + */ int adm_send_params_v5(int port_id, int copp_idx, char *params, uint32_t params_length) { @@ -1026,6 +1114,7 @@ send_param_return: kfree(adm_params); return rc; } +EXPORT_SYMBOL(adm_send_params_v5); int adm_get_params_v2(int port_id, int copp_idx, uint32_t module_id, uint32_t param_id, uint32_t params_length, @@ -1142,13 +1231,38 @@ adm_get_param_return: return rc; } +/** + * adm_get_params - + * command to retrieve ADM params for given module + * + * @port_id: Port ID number + * @copp_idx: copp index of ADM copp + * @module_id: module ID + * @param_id: Param index + * @param_length: length of params + * @params: params pointer + * + * Returns 0 on success or error on failure + */ int adm_get_params(int port_id, int copp_idx, uint32_t module_id, uint32_t param_id, uint32_t params_length, char *params) { return adm_get_params_v2(port_id, copp_idx, module_id, param_id, params_length, params, 0); } +EXPORT_SYMBOL(adm_get_params); +/** + * adm_get_pp_topo_module_list - + * command to update PP top module list + * + * @port_id: Port ID number + * @copp_idx: copp index of ADM copp + * @param_length: length of params + * @params: pointer with PP top module params + * + * Returns 0 on success or error on failure + */ int adm_get_pp_topo_module_list(int port_id, int copp_idx, int32_t param_length, char *params) { @@ -1245,6 +1359,8 @@ adm_pp_module_list_l: pr_debug("%s : rc = %d ", __func__, rc); return rc; } +EXPORT_SYMBOL(adm_get_pp_topo_module_list); + static void adm_callback_debug_print(struct apr_client_data *data) { uint32_t *payload; @@ -1264,6 +1380,15 @@ static void adm_callback_debug_print(struct apr_client_data *data) __func__, data->opcode, data->payload_size); } +/** + * adm_set_multi_ch_map - + * Update multi channel map info + * + * @channel_map: pointer with channel map info + * @path: direction or ADM path type + * + * Returns 0 on success or error on failure + */ int adm_set_multi_ch_map(char *channel_map, int path) { int idx; @@ -1283,7 +1408,17 @@ int adm_set_multi_ch_map(char *channel_map, int path) return 0; } +EXPORT_SYMBOL(adm_set_multi_ch_map); +/** + * adm_get_multi_ch_map - + * Retrieves multi channel map info + * + * @channel_map: pointer to be updated with channel map + * @path: direction or ADM path type + * + * Returns 0 on success or error on failure + */ int adm_get_multi_ch_map(char *channel_map, int path) { int idx; @@ -1304,6 +1439,7 @@ int adm_get_multi_ch_map(char *channel_map, int path) return 0; } +EXPORT_SYMBOL(adm_get_multi_ch_map); static int32_t adm_callback(struct apr_client_data *data, void *priv) { @@ -2170,6 +2306,16 @@ static void send_adm_cal(int port_id, int copp_idx, int path, int perf_mode, app_type, acdb_id, sample_rate); } +/** + * adm_connect_afe_port - + * command to send ADM connect AFE port + * + * @mode: value of mode for ADM connect AFE + * @session_id: session active to connect + * @port_id: Port ID number + * + * Returns 0 on success or error on failure + */ int adm_connect_afe_port(int mode, int session_id, int port_id) { struct adm_cmd_connect_afe_port_v5 cmd; @@ -2249,6 +2395,7 @@ fail_cmd: return ret; } +EXPORT_SYMBOL(adm_connect_afe_port); int adm_arrange_mch_map(struct adm_cmd_device_open_v5 *open, int path, int channel_mode) @@ -2382,6 +2529,22 @@ int adm_arrange_mch_ep2_map(struct adm_cmd_device_open_v6 *open_v6, return rc; } +/** + * adm_open - + * command to send ADM open + * + * @port_id: port id number + * @path: direction or ADM path type + * @rate: sample rate of session + * @channel_mode: number of channels set + * @topology: topology active for this session + * @perf_mode: performance mode like LL/ULL/.. + * @bit_width: bit width to set for copp + * @app_type: App type used for this session + * @acdb_id: ACDB ID of this device + * + * Returns 0 on success or error on failure + */ int adm_open(int port_id, int path, int rate, int channel_mode, int topology, int perf_mode, uint16_t bit_width, int app_type, int acdb_id) { @@ -2621,7 +2784,17 @@ 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]); return copp_idx; } +EXPORT_SYMBOL(adm_open); +/** + * adm_copp_mfc_cfg - + * command to send ADM MFC config + * + * @port_id: Port ID number + * @copp_idx: copp index assigned + * @dst_sample_rate: sink sample rate + * + */ void adm_copp_mfc_cfg(int port_id, int copp_idx, int dst_sample_rate) { struct audproc_mfc_output_media_fmt mfc_cfg; @@ -2723,6 +2896,7 @@ void adm_copp_mfc_cfg(int port_id, int copp_idx, int dst_sample_rate) fail_cmd: return; } +EXPORT_SYMBOL(adm_copp_mfc_cfg); static void route_set_opcode_matrix_id( struct adm_cmd_matrix_map_routings_v5 **route_addr, @@ -2763,6 +2937,17 @@ static void route_set_opcode_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, uint32_t passthr_mode) { @@ -2892,34 +3077,69 @@ fail_cmd: kfree(matrix_map); return ret; } +EXPORT_SYMBOL(adm_matrix_map); +/** + * adm_ec_ref_rx_id - + * Update EC ref port ID + * + */ void adm_ec_ref_rx_id(int port_id) { this_adm.ec_ref_rx = port_id; pr_debug("%s: ec_ref_rx:%d\n", __func__, this_adm.ec_ref_rx); } +EXPORT_SYMBOL(adm_ec_ref_rx_id); +/** + * adm_num_ec_ref_rx_chans - + * Update EC ref number of channels + * + */ void adm_num_ec_ref_rx_chans(int num_chans) { this_adm.num_ec_ref_rx_chans = num_chans; pr_debug("%s: num_ec_ref_rx_chans:%d\n", __func__, this_adm.num_ec_ref_rx_chans); } +EXPORT_SYMBOL(adm_num_ec_ref_rx_chans); +/** + * adm_ec_ref_rx_bit_width - + * Update EC ref bit_width + * + */ void adm_ec_ref_rx_bit_width(int bit_width) { this_adm.ec_ref_rx_bit_width = bit_width; pr_debug("%s: ec_ref_rx_bit_width:%d\n", __func__, this_adm.ec_ref_rx_bit_width); } +EXPORT_SYMBOL(adm_ec_ref_rx_bit_width); +/** + * adm_ec_ref_rx_sampling_rate - + * Update EC ref sample rate + * + */ void adm_ec_ref_rx_sampling_rate(int sampling_rate) { this_adm.ec_ref_rx_sampling_rate = sampling_rate; pr_debug("%s: ec_ref_rx_sampling_rate:%d\n", __func__, this_adm.ec_ref_rx_sampling_rate); } +EXPORT_SYMBOL(adm_ec_ref_rx_sampling_rate); +/** + * adm_close - + * command to close ADM copp + * + * @port_id: Port ID number + * @perf_mode: performance mode like LL/ULL/.. + * @copp_idx: copp index assigned + * + * Returns 0 on success or error on failure + */ int adm_close(int port_id, int perf_mode, int copp_idx) { struct apr_hdr close; @@ -3053,6 +3273,7 @@ int adm_close(int port_id, int perf_mode, int copp_idx) } return 0; } +EXPORT_SYMBOL(adm_close); int send_rtac_audvol_cal(void) { @@ -3474,6 +3695,16 @@ err: return ret; } +/** + * adm_set_volume - + * command to set volume on ADM copp + * + * @port_id: Port ID number + * @copp_idx: copp index assigned + * @volume: gain value to set + * + * Returns 0 on success or error on failure + */ int adm_set_volume(int port_id, int copp_idx, int volume) { struct audproc_volume_ctrl_master_gain audproc_vol; @@ -3552,7 +3783,18 @@ int adm_set_volume(int port_id, int copp_idx, int volume) fail_cmd: return rc; } +EXPORT_SYMBOL(adm_set_volume); +/** + * adm_set_softvolume - + * command to set softvolume + * + * @port_id: Port ID number + * @copp_idx: copp index assigned + * @softvol_param: Params to set for softvolume + * + * Returns 0 on success or error on failure + */ int adm_set_softvolume(int port_id, int copp_idx, struct audproc_softvolume_params *softvol_param) { @@ -3644,7 +3886,18 @@ int adm_set_softvolume(int port_id, int copp_idx, fail_cmd: return rc; } +EXPORT_SYMBOL(adm_set_softvolume); +/** + * adm_set_mic_gain - + * command to set MIC gain + * + * @port_id: Port ID number + * @copp_idx: copp index assigned + * @volume: gain value to set + * + * Returns 0 on success or error on failure + */ int adm_set_mic_gain(int port_id, int copp_idx, int volume) { struct adm_set_mic_gain_params mic_gain_params; @@ -3722,7 +3975,18 @@ int adm_set_mic_gain(int port_id, int copp_idx, int volume) fail_cmd: return rc; } +EXPORT_SYMBOL(adm_set_mic_gain); +/** + * adm_send_set_multichannel_ec_primary_mic_ch - + * command to set multi-ch EC primary mic + * + * @port_id: Port ID number + * @copp_idx: copp index assigned + * @primary_mic_ch: channel number of primary mic + * + * Returns 0 on success or error on failure + */ int adm_send_set_multichannel_ec_primary_mic_ch(int port_id, int copp_idx, int primary_mic_ch) { @@ -3810,7 +4074,19 @@ int adm_send_set_multichannel_ec_primary_mic_ch(int port_id, int copp_idx, fail_cmd: return rc; } +EXPORT_SYMBOL(adm_send_set_multichannel_ec_primary_mic_ch); +/** + * adm_param_enable - + * command to send params to ADM for given module + * + * @port_id: Port ID number + * @copp_idx: copp index assigned + * @module_id: ADM module + * @enable: flag to enable or disable module + * + * Returns 0 on success or error on failure + */ int adm_param_enable(int port_id, int copp_idx, int module_id, int enable) { struct audproc_enable_param_t adm_mod_enable; @@ -3896,7 +4172,22 @@ fail_cmd: return rc; } +EXPORT_SYMBOL(adm_param_enable); +/** + * adm_send_calibration - + * send ADM calibration to DSP + * + * @port_id: Port ID number + * @copp_idx: copp index assigned + * @path: direction or ADM path type + * @perf_mode: performance mode like LL/ULL/.. + * @cal_type: calibration type to use + * @params: pointer with cal data + * @size: cal size + * + * Returns 0 on success or error on failure + */ int adm_send_calibration(int port_id, int copp_idx, int path, int perf_mode, int cal_type, char *params, int size) { @@ -3988,6 +4279,7 @@ end: kfree(adm_params); return rc; } +EXPORT_SYMBOL(adm_send_calibration); /* * adm_update_wait_parameters must be called with routing driver locks. @@ -4024,7 +4316,17 @@ end: return ret; } +EXPORT_SYMBOL(adm_set_wait_parameters); +/** + * adm_reset_wait_parameters - + * reset wait parameters or ADM delay value + * + * @port_id: Port ID number + * @copp_idx: copp index assigned + * + * Returns 0 on success or error on failure + */ int adm_reset_wait_parameters(int port_id, int copp_idx) { int ret = 0, port_idx; @@ -4050,7 +4352,18 @@ int adm_reset_wait_parameters(int port_id, int copp_idx) end: return ret; } +EXPORT_SYMBOL(adm_reset_wait_parameters); +/** + * adm_wait_timeout - + * ADM wait command after command send to DSP + * + * @port_id: Port ID number + * @copp_idx: copp index assigned + * @wait_time: value in ms for command timeout + * + * Returns 0 on success or error on failure + */ int adm_wait_timeout(int port_id, int copp_idx, int wait_time) { int ret = 0, port_idx; @@ -4081,7 +4394,22 @@ end: pr_debug("%s: return %d--\n", __func__, ret); return ret; } +EXPORT_SYMBOL(adm_wait_timeout); +/** + * adm_store_cal_data - + * Retrieve calibration data for ADM copp device + * + * @port_id: Port ID number + * @copp_idx: copp index assigned + * @path: direction or copp type + * @perf_mode: performance mode like LL/ULL/.. + * @cal_index: calibration index to use + * @params: pointer to store cal data + * @size: pointer to fill with cal size + * + * Returns 0 on success or error on failure + */ int adm_store_cal_data(int port_id, int copp_idx, int path, int perf_mode, int cal_index, char *params, int *size) { @@ -4165,7 +4493,18 @@ unlock: end: return rc; } +EXPORT_SYMBOL(adm_store_cal_data); +/** + * adm_send_compressed_device_mute - + * command to send mute for compressed device + * + * @port_id: Port ID number + * @copp_idx: copp index assigned + * @mute_on: flag to indicate mute or unmute + * + * Returns 0 on success or error on failure + */ int adm_send_compressed_device_mute(int port_id, int copp_idx, bool mute_on) { struct adm_set_compressed_device_mute mute_params; @@ -4242,7 +4581,18 @@ int adm_send_compressed_device_mute(int port_id, int copp_idx, bool mute_on) end: return ret; } +EXPORT_SYMBOL(adm_send_compressed_device_mute); +/** + * adm_send_compressed_device_latency - + * command to send latency for compressed device + * + * @port_id: Port ID number + * @copp_idx: copp index assigned + * @latency: latency value to pass + * + * Returns 0 on success or error on failure + */ int adm_send_compressed_device_latency(int port_id, int copp_idx, int latency) { struct adm_set_compressed_device_latency latency_params; @@ -4319,6 +4669,7 @@ int adm_send_compressed_device_latency(int port_id, int copp_idx, int latency) end: return ret; } +EXPORT_SYMBOL(adm_send_compressed_device_latency); /** * adm_swap_speaker_channels @@ -4450,6 +4801,16 @@ done: } EXPORT_SYMBOL(adm_swap_speaker_channels); +/** + * adm_set_sound_focus - + * Update sound focus info + * + * @port_id: Port ID number + * @copp_idx: copp index assigned + * @soundFocusData: sound focus data to pass + * + * Returns 0 on success or error on failure + */ int adm_set_sound_focus(int port_id, int copp_idx, struct sound_focus_param soundFocusData) { @@ -4559,7 +4920,18 @@ done: return ret; } +EXPORT_SYMBOL(adm_set_sound_focus); +/** + * adm_get_sound_focus - + * Retrieve sound focus info + * + * @port_id: Port ID number + * @copp_idx: copp index assigned + * @soundFocusData: pointer for sound focus data to be updated with + * + * Returns 0 on success or error on failure + */ int adm_get_sound_focus(int port_id, int copp_idx, struct sound_focus_param *soundFocusData) { @@ -4623,6 +4995,7 @@ done: return ret; } +EXPORT_SYMBOL(adm_get_sound_focus); static int adm_source_tracking_alloc_map_memory(void) { @@ -4682,6 +5055,16 @@ done: return ret; } +/** + * adm_get_source_tracking - + * Retrieve source tracking info + * + * @port_id: Port ID number + * @copp_idx: copp index assigned + * @sourceTrackingData: pointer for source track data to be updated with + * + * Returns 0 on success or error on failure + */ int adm_get_source_tracking(int port_id, int copp_idx, struct source_tracking_param *sourceTrackingData) { @@ -4808,8 +5191,9 @@ done: return ret; } +EXPORT_SYMBOL(adm_get_source_tracking); -static int __init adm_init(void) +int __init adm_init(void) { int i = 0, j; @@ -4857,14 +5241,13 @@ static int __init adm_init(void) this_adm.sourceTrackingData.apr_cmd_status = -1; atomic_set(&this_adm.mem_map_handles[ADM_MEM_MAP_INDEX_SOURCE_TRACKING], 0); + mutex_init(&dts_srs_lock); return 0; } -static void __exit adm_exit(void) +void __exit adm_exit(void) { + mutex_destroy(&dts_srs_lock); adm_delete_cal_data(); } - -device_initcall(adm_init); -module_exit(adm_exit); diff --git a/dsp/q6afe.c b/dsp/q6afe.c index b6a7aa3294..631a123246 100644 --- a/dsp/q6afe.c +++ b/dsp/q6afe.c @@ -157,6 +157,13 @@ done: return topology; } +/** + * afe_set_aanc_info - + * Update AFE AANC info + * + * @q6_aanc_info: AFE AANC info params + * + */ void afe_set_aanc_info(struct aanc_data *q6_aanc_info) { this_afe.aanc_info.aanc_active = q6_aanc_info->aanc_active; @@ -169,6 +176,7 @@ void afe_set_aanc_info(struct aanc_data *q6_aanc_info) this_afe.aanc_info.aanc_rx_port, this_afe.aanc_info.aanc_tx_port); } +EXPORT_SYMBOL(afe_set_aanc_info); static void afe_callback_debug_print(struct apr_client_data *data) { @@ -457,6 +465,14 @@ static int32_t afe_callback(struct apr_client_data *data, void *priv) return 0; } +/** + * afe_get_port_type - + * Retrieve AFE port type whether RX or TX + * + * @port_id: AFE Port ID number + * + * Returns RX/TX type on success or -EINVAL on failure. + */ int afe_get_port_type(u16 port_id) { int ret; @@ -635,6 +651,7 @@ int afe_get_port_type(u16 port_id) return ret; } +EXPORT_SYMBOL(afe_get_port_type); int afe_sizeof_cfg_cmd(u16 port_id) { @@ -712,6 +729,12 @@ int afe_sizeof_cfg_cmd(u16 port_id) return ret_size; } +/** + * afe_q6_interface_prepare - + * wrapper API to check Q6 AFE registered to APR otherwise registers + * + * Returns 0 on success or error on failure. + */ int afe_q6_interface_prepare(void) { int ret = 0; @@ -729,6 +752,7 @@ int afe_q6_interface_prepare(void) } return ret; } +EXPORT_SYMBOL(afe_q6_interface_prepare); /* * afe_apr_send_pkt : returns 0 on success, negative otherwise. @@ -2059,6 +2083,15 @@ int afe_send_aanc_version( return ret; } +/** + * afe_port_set_mad_type - + * to update mad type + * + * @port_id: AFE port id number + * @mad_type: MAD type enum value + * + * Returns 0 on success or error on failure. + */ int afe_port_set_mad_type(u16 port_id, enum afe_mad_type mad_type) { int i; @@ -2077,7 +2110,16 @@ int afe_port_set_mad_type(u16 port_id, enum afe_mad_type mad_type) atomic_set(&afe_ports_mad_type[i], mad_type); return 0; } +EXPORT_SYMBOL(afe_port_set_mad_type); +/** + * afe_port_get_mad_type - + * to retrieve mad type + * + * @port_id: AFE port id number + * + * Returns valid enum value on success or MAD_HW_NONE on failure. + */ enum afe_mad_type afe_port_get_mad_type(u16 port_id) { int i; @@ -2093,7 +2135,19 @@ enum afe_mad_type afe_port_get_mad_type(u16 port_id) } return (enum afe_mad_type) atomic_read(&afe_ports_mad_type[i]); } +EXPORT_SYMBOL(afe_port_get_mad_type); +/** + * afe_set_config - + * to configure AFE session with + * specified configuration for given config type + * + * @config_type: config type + * @config_data: configuration to pass to AFE session + * @arg: argument used in specific config types + * + * Returns 0 on success or error value on port start failure. + */ int afe_set_config(enum afe_config_type config_type, void *config_data, int arg) { int ret; @@ -2247,6 +2301,16 @@ fail_cmd: return ret; } +/** + * afe_send_spdif_ch_status_cfg - + * to configure AFE session with + * specified channel status configuration + * + * @ch_status_cfg: channel status configutation + * @port_id: AFE port id number + * + * Returns 0 on success or error value on port start failure. + */ int afe_send_spdif_ch_status_cfg(struct afe_param_id_spdif_ch_status_cfg *ch_status_cfg, u16 port_id) { @@ -2326,6 +2390,7 @@ int afe_send_spdif_ch_status_cfg(struct afe_param_id_spdif_ch_status_cfg fail_cmd: return ret; } +EXPORT_SYMBOL(afe_send_spdif_ch_status_cfg); static int afe_send_cmd_port_start(u16 port_id) { @@ -2388,6 +2453,16 @@ fail_cmd: return ret; } +/** + * afe_spdif_port_start - to configure AFE session with + * specified port configuration + * + * @port_id: AFE port id number + * @spdif_port: spdif port configutation + * @rate: sampling rate of port + * + * Returns 0 on success or error value on port start failure. + */ int afe_spdif_port_start(u16 port_id, struct afe_spdif_port_config *spdif_port, u32 rate) { @@ -2463,6 +2538,7 @@ int afe_spdif_port_start(u16 port_id, struct afe_spdif_port_config *spdif_port, fail_cmd: return ret; } +EXPORT_SYMBOL(afe_spdif_port_start); int afe_send_slot_mapping_cfg( struct afe_param_id_slot_mapping_cfg *slot_mapping_cfg, @@ -2622,6 +2698,17 @@ fail_cmd: return ret; } +/** + * afe_tdm_port_start - to configure AFE session with + * specified port configuration + * + * @port_id: AFE port id number + * @tdm_port: TDM port configutation + * @rate: sampling rate of port + * @num_groups: number of TDM groups + * + * Returns 0 on success or error value on port start failure. + */ int afe_tdm_port_start(u16 port_id, struct afe_tdm_port_config *tdm_port, u32 rate, u16 num_groups) { @@ -2749,7 +2836,16 @@ int afe_tdm_port_start(u16 port_id, struct afe_tdm_port_config *tdm_port, fail_cmd: return ret; } +EXPORT_SYMBOL(afe_tdm_port_start); +/** + * afe_set_cal_mode - + * set cal mode for AFE calibration + * + * @port_id: AFE port id number + * @afe_cal_mode: AFE calib mode + * + */ void afe_set_cal_mode(u16 port_id, enum afe_cal_mode afe_cal_mode) { uint16_t port_index; @@ -2757,11 +2853,20 @@ void afe_set_cal_mode(u16 port_id, enum afe_cal_mode afe_cal_mode) port_index = afe_get_port_index(port_id); this_afe.afe_cal_mode[port_index] = afe_cal_mode; } +EXPORT_SYMBOL(afe_set_cal_mode); +/** + * afe_set_routing_callback - + * Update callback function for routing + * + * @cb: callback function to update with + * + */ void afe_set_routing_callback(routing_cb cb) { this_afe.rt_cb = cb; } +EXPORT_SYMBOL(afe_set_routing_callback); int afe_port_send_usb_dev_param(u16 port_id, union afe_port_config *afe_config) { @@ -3590,6 +3695,16 @@ 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, union afe_port_config *afe_config, int rate) { @@ -3767,7 +3882,18 @@ fail_cmd: mutex_unlock(&this_afe.afe_cmd_lock); return ret; } +EXPORT_SYMBOL(afe_open); +/** + * afe_loopback - + * command to set loopback between AFE ports + * + * @enable: enable or disable loopback + * @rx_port: AFE RX port ID + * @tx_port: AFE TX port ID + * + * Returns 0 on success or error on failure + */ int afe_loopback(u16 enable, u16 rx_port, u16 tx_port) { struct afe_loopback_cfg_v1 lb_cmd; @@ -3825,7 +3951,17 @@ int afe_loopback(u16 enable, u16 rx_port, u16 tx_port) pr_err("%s: AFE loopback failed %d\n", __func__, ret); return ret; } +EXPORT_SYMBOL(afe_loopback); +/** + * afe_loopback_gain - + * command to set gain for AFE loopback + * + * @port_id: AFE port id + * @volume: gain value to set + * + * Returns 0 on success or error on failure + */ int afe_loopback_gain(u16 port_id, u16 volume) { struct afe_loopback_gain_per_path_param set_param; @@ -3908,6 +4044,7 @@ int afe_loopback_gain(u16 port_id, u16 volume) fail_cmd: return ret; } +EXPORT_SYMBOL(afe_loopback_gain); int afe_pseudo_port_start_nowait(u16 port_id) { @@ -4094,6 +4231,16 @@ int afe_port_group_set_param(u16 group_id, return ret; } +/** + * afe_port_group_enable - + * command to enable AFE port group + * + * @group_id: group ID for AFE port group + * @afe_group_config: config for AFE group + * @enable: flag to indicate enable or disable + * + * Returns 0 on success or error on failure + */ int afe_port_group_enable(u16 group_id, union afe_port_group_config *afe_group_config, u16 enable) @@ -4146,6 +4293,7 @@ int afe_port_group_enable(u16 group_id, return ret; } +EXPORT_SYMBOL(afe_port_group_enable); int afe_stop_pseudo_port(u16 port_id) { @@ -4191,11 +4339,28 @@ int afe_stop_pseudo_port(u16 port_id) return ret; } +/** + * afe_req_mmap_handle - + * Retrieve AFE memory map handle + * + * @ac: AFE audio client + * + * Returns memory map handle + */ uint32_t afe_req_mmap_handle(struct afe_audio_client *ac) { return ac->mem_map_handle; } +EXPORT_SYMBOL(afe_req_mmap_handle); +/** + * q6afe_audio_client_alloc - + * Assign new AFE audio client + * + * @priv: privata data to hold for audio client + * + * Returns ac pointer on success or NULL on failure + */ struct afe_audio_client *q6afe_audio_client_alloc(void *priv) { struct afe_audio_client *ac; @@ -4220,7 +4385,19 @@ struct afe_audio_client *q6afe_audio_client_alloc(void *priv) return ac; } +EXPORT_SYMBOL(q6afe_audio_client_alloc); +/** + * q6afe_audio_client_buf_alloc_contiguous - + * Allocate contiguous shared buffers + * + * @dir: RX or TX direction of AFE port + * @ac: AFE audio client handle + * @bufsz: size of each shared buffer + * @bufcnt: number of buffers + * + * Returns 0 on success or error on failure + */ int q6afe_audio_client_buf_alloc_contiguous(unsigned int dir, struct afe_audio_client *ac, unsigned int bufsz, @@ -4299,7 +4476,18 @@ fail: q6afe_audio_client_buf_free_contiguous(dir, ac); return -EINVAL; } +EXPORT_SYMBOL(q6afe_audio_client_buf_alloc_contiguous); +/** + * afe_memory_map - + * command to map shared buffers to AFE + * + * @dma_addr_p: DMA physical address + * @dma_buf_sz: shared DMA buffer size + * @ac: AFE audio client handle + * + * Returns 0 on success or error on failure + */ int afe_memory_map(phys_addr_t dma_addr_p, u32 dma_buf_sz, struct afe_audio_client *ac) { @@ -4320,6 +4508,7 @@ int afe_memory_map(phys_addr_t dma_addr_p, u32 dma_buf_sz, return ret; } +EXPORT_SYMBOL(afe_memory_map); int afe_cmd_memory_map(phys_addr_t dma_addr_p, u32 dma_buf_sz) { @@ -4494,6 +4683,15 @@ int afe_cmd_memory_map_nowait(int port_id, phys_addr_t dma_addr_p, kfree(mmap_region_cmd); return ret; } + +/** + * q6afe_audio_client_buf_free_contiguous - + * frees the shared contiguous memory + * + * @dir: RX or TX direction of port + * @ac: AFE audio client handle + * + */ int q6afe_audio_client_buf_free_contiguous(unsigned int dir, struct afe_audio_client *ac) { @@ -4533,7 +4731,15 @@ int q6afe_audio_client_buf_free_contiguous(unsigned int dir, mutex_unlock(&ac->cmd_lock); return 0; } +EXPORT_SYMBOL(q6afe_audio_client_buf_free_contiguous); +/** + * q6afe_audio_client_free - + * frees the audio client from AFE + * + * @ac: AFE audio client handle + * + */ void q6afe_audio_client_free(struct afe_audio_client *ac) { int loopcnt; @@ -4552,7 +4758,16 @@ void q6afe_audio_client_free(struct afe_audio_client *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 ret = 0; @@ -4593,6 +4808,7 @@ int afe_cmd_memory_unmap(u32 mem_map_handle) return ret; } +EXPORT_SYMBOL(afe_cmd_memory_unmap); 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; } +/** + * afe_register_get_events - + * register for events from proxy port + * + * @port_id: Port ID to register events + * @cb: callback function to invoke for events from proxy port + * @private_data: private data to sent back in callback fn + * + * Returns 0 on success or error on failure + */ int afe_register_get_events(u16 port_id, void (*cb)(uint32_t opcode, uint32_t token, uint32_t *payload, void *priv), @@ -4681,7 +4907,16 @@ int afe_register_get_events(u16 port_id, __func__, ret); return ret; } +EXPORT_SYMBOL(afe_register_get_events); +/** + * afe_unregister_get_events - + * unregister for events from proxy port + * + * @port_id: Port ID to unregister events + * + * Returns 0 on success or error on failure + */ int afe_unregister_get_events(u16 port_id) { int ret = 0; @@ -4748,7 +4983,19 @@ int afe_unregister_get_events(u16 port_id) __func__, ret); return ret; } +EXPORT_SYMBOL(afe_unregister_get_events); +/** + * afe_rt_proxy_port_write - + * command for AFE RT proxy port write + * + * @buf_addr_p: Physical buffer address with + * playback data to proxy port + * @mem_map_handle: memory map handle of write buffer + * @bytes: number of bytes to write + * + * Returns 0 on success or error on failure + */ int afe_rt_proxy_port_write(phys_addr_t buf_addr_p, u32 mem_map_handle, int bytes) { @@ -4785,7 +5032,18 @@ int afe_rt_proxy_port_write(phys_addr_t buf_addr_p, return ret; } +EXPORT_SYMBOL(afe_rt_proxy_port_write); +/** + * afe_rt_proxy_port_read - + * command for AFE RT proxy port read + * + * @buf_addr_p: Physical buffer address to fill read data + * @mem_map_handle: memory map handle for buffer read + * @bytes: number of bytes to read + * + * Returns 0 on success or error on failure + */ int afe_rt_proxy_port_read(phys_addr_t buf_addr_p, u32 mem_map_handle, int bytes) { @@ -4820,6 +5078,7 @@ int afe_rt_proxy_port_read(phys_addr_t buf_addr_p, __func__, afecmd_rd.port_id, ret); return ret; } +EXPORT_SYMBOL(afe_rt_proxy_port_read); #ifdef CONFIG_DEBUG_FS static struct dentry *debugfs_afelb; @@ -4985,6 +5244,14 @@ static void config_debug_fs_exit(void) } #endif +/** + * afe_set_dtmf_gen_rx_portid - + * Set port_id for DTMF tone generation + * + * @port_id: AFE port id + * @set: set or reset port id value for dtmf gen + * + */ void afe_set_dtmf_gen_rx_portid(u16 port_id, int set) { if (set) @@ -4992,7 +5259,18 @@ void afe_set_dtmf_gen_rx_portid(u16 port_id, int set) else if (this_afe.dtmf_gen_rx_portid == port_id) this_afe.dtmf_gen_rx_portid = -1; } +EXPORT_SYMBOL(afe_set_dtmf_gen_rx_portid); +/** + * afe_dtmf_generate_rx - command to generate AFE DTMF RX + * + * @duration_in_ms: Duration in ms for dtmf tone + * @high_freq: Higher frequency for dtmf + * @low_freq: lower frequency for dtmf + * @gain: Gain value for DTMF tone + * + * Returns 0 on success, appropriate error code otherwise + */ int afe_dtmf_generate_rx(int64_t duration_in_ms, uint16_t high_freq, uint16_t low_freq, uint16_t gain) @@ -5079,6 +5357,7 @@ fail_cmd: pr_err("%s: failed %d\n", __func__, ret); return ret; } +EXPORT_SYMBOL(afe_dtmf_generate_rx); static int afe_sidetone_iir(u16 tx_port_id) { @@ -5556,6 +5835,13 @@ 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) { struct afe_port_cmd_device_stop stop; @@ -5678,6 +5964,7 @@ int afe_close(int port_id) fail_cmd: return ret; } +EXPORT_SYMBOL(afe_close); int afe_set_digital_codec_core_clock(u16 port_id, struct afe_digital_clk_cfg *cfg) @@ -5754,6 +6041,14 @@ fail_cmd: return ret; } +/** + * afe_set_lpass_clock - Enable AFE lpass clock + * + * @port_id: AFE port id + * @cfg: pointer to clk set struct + * + * Returns 0 on success, appropriate error code otherwise + */ int afe_set_lpass_clock(u16 port_id, struct afe_clk_cfg *cfg) { struct afe_lpass_clk_config_command clk_cfg; @@ -5844,6 +6139,7 @@ fail_cmd: mutex_unlock(&this_afe.afe_cmd_lock); return ret; } +EXPORT_SYMBOL(afe_set_lpass_clock); /** * afe_set_lpass_clk_cfg - Set AFE clk config @@ -6325,6 +6621,15 @@ done: return ret; } +/** + * afe_get_av_dev_drift - + * command to retrieve AV drift + * + * @timing_stats: timing stats to be updated with AV drift values + * @port: AFE port ID + * + * Returns 0 on success or error on failure + */ int afe_get_av_dev_drift(struct afe_param_id_dev_timing_stats *timing_stats, u16 port) { @@ -6406,6 +6711,7 @@ int afe_get_av_dev_drift(struct afe_param_id_dev_timing_stats *timing_stats, exit: return ret; } +EXPORT_SYMBOL(afe_get_av_dev_drift); int afe_spk_prot_get_calib_data(struct afe_spkr_prot_get_vi_calib *calib_resp) { @@ -6486,6 +6792,18 @@ fail_cmd: return ret; } +/** + * afe_spk_prot_feed_back_cfg - + * command to setup spk protection feedback config + * + * @src_port: source port id + * @dst_port: destination port id + * @l_ch: left speaker active or not + * @r_ch: right speaker active or not + * @enable: flag to enable or disable + * + * Returns 0 on success or error on failure + */ int afe_spk_prot_feed_back_cfg(int src_port, int dst_port, int l_ch, int r_ch, u32 enable) { @@ -6531,6 +6849,7 @@ int afe_spk_prot_feed_back_cfg(int src_port, int dst_port, fail_cmd: return ret; } +EXPORT_SYMBOL(afe_spk_prot_feed_back_cfg); static int get_cal_type_index(int32_t cal_type) { @@ -7200,7 +7519,7 @@ done: return result; } -static int __init afe_init(void) +int __init afe_init(void) { int i = 0, ret; @@ -7231,7 +7550,7 @@ static int __init afe_init(void) return 0; } -static void __exit afe_exit(void) +void __exit afe_exit(void) { afe_delete_cal_data(); @@ -7239,6 +7558,3 @@ static void __exit afe_exit(void) mutex_destroy(&this_afe.afe_cmd_lock); wakeup_source_trash(&wl.ws); } - -device_initcall(afe_init); -__exitcall(afe_exit); diff --git a/dsp/q6asm.c b/dsp/q6asm.c index 0a4216a0e2..4e988ee489 100644 --- a/dsp/q6asm.c +++ b/dsp/q6asm.c @@ -981,6 +981,15 @@ int q6asm_audio_client_buf_free(unsigned int dir, return 0; } +/** + * q6asm_audio_client_buf_free_contiguous - + * frees the memory buffers for ASM + * + * @dir: RX or TX direction + * @ac: audio client handle + * + * Returns 0 on success or error on failure + */ int q6asm_audio_client_buf_free_contiguous(unsigned int dir, struct audio_client *ac) { @@ -1030,7 +1039,15 @@ int q6asm_audio_client_buf_free_contiguous(unsigned int dir, mutex_unlock(&ac->cmd_lock); return 0; } +EXPORT_SYMBOL(q6asm_audio_client_buf_free_contiguous); +/** + * q6asm_audio_client_free - + * frees the audio client for ASM + * + * @ac: audio client handle + * + */ void q6asm_audio_client_free(struct audio_client *ac) { int loopcnt; @@ -1075,7 +1092,17 @@ void q6asm_audio_client_free(struct audio_client *ac) ac = NULL; mutex_unlock(&session_lock); } +EXPORT_SYMBOL(q6asm_audio_client_free); +/** + * q6asm_set_io_mode - + * Update IO mode for ASM + * + * @ac: audio client handle + * @mode1: IO mode to update + * + * Returns 0 on success or error on failure + */ int q6asm_set_io_mode(struct audio_client *ac, uint32_t mode1) { uint32_t mode; @@ -1102,6 +1129,7 @@ int q6asm_set_io_mode(struct audio_client *ac, uint32_t mode1) return ret; } +EXPORT_SYMBOL(q6asm_set_io_mode); void *q6asm_mmap_apr_reg(void) { @@ -1123,6 +1151,15 @@ fail: return NULL; } +/** + * q6asm_send_stream_cmd - + * command to send for ASM stream + * + * @ac: audio client handle + * @data: event data + * + * Returns 0 on success or error on failure + */ int q6asm_send_stream_cmd(struct audio_client *ac, struct msm_adsp_event_data *data) { @@ -1188,7 +1225,17 @@ fail_send_param: done: return rc; } +EXPORT_SYMBOL(q6asm_send_stream_cmd); +/** + * q6asm_audio_client_alloc - + * Alloc audio client for ASM + * + * @cb: callback fn + * @priv: private data + * + * Returns ac pointer on success or NULL on failure + */ struct audio_client *q6asm_audio_client_alloc(app_cb cb, void *priv) { struct audio_client *ac; @@ -1284,7 +1331,16 @@ fail_session: kfree(ac); return NULL; } +EXPORT_SYMBOL(q6asm_audio_client_alloc); +/** + * q6asm_get_audio_client - + * Retrieve audio client for ASM + * + * @session_id: ASM session id + * + * Returns valid pointer on success or NULL on failure + */ struct audio_client *q6asm_get_audio_client(int session_id) { if (session_id == ASM_CONTROL_SESSION) @@ -1303,7 +1359,19 @@ struct audio_client *q6asm_get_audio_client(int session_id) err: return NULL; } +EXPORT_SYMBOL(q6asm_get_audio_client); +/** + * q6asm_audio_client_buf_alloc - + * Allocs memory from ION for ASM + * + * @dir: RX or TX direction + * @ac: Audio client handle + * @bufsz: size of each buffer + * @bufcnt: number of buffers to alloc + * + * Returns 0 on success or error on failure + */ int q6asm_audio_client_buf_alloc(unsigned int dir, struct audio_client *ac, unsigned int bufsz, @@ -1393,7 +1461,19 @@ fail: q6asm_audio_client_buf_free(dir, ac); return -EINVAL; } +EXPORT_SYMBOL(q6asm_audio_client_buf_alloc); +/** + * q6asm_audio_client_buf_alloc_contiguous - + * Alloc contiguous memory from ION for ASM + * + * @dir: RX or TX direction + * @ac: Audio client handle + * @bufsz: size of each buffer + * @bufcnt: number of buffers to alloc + * + * Returns 0 on success or error on failure + */ int q6asm_audio_client_buf_alloc_contiguous(unsigned int dir, struct audio_client *ac, unsigned int bufsz, @@ -1496,6 +1576,7 @@ fail: q6asm_audio_client_buf_free_contiguous(dir, ac); return -EINVAL; } +EXPORT_SYMBOL(q6asm_audio_client_buf_alloc_contiguous); static int32_t q6asm_srvc_callback(struct apr_client_data *data, void *priv) { @@ -2134,6 +2215,18 @@ static int32_t q6asm_callback(struct apr_client_data *data, void *priv) return 0; } +/** + * q6asm_is_cpu_buf_avail - + * retrieve next CPU buf avail + * + * @dir: RX or TX direction + * @ac: Audio client handle + * @size: size pointer to be updated with size of buffer + * @index: index pointer to be updated with + * CPU buffer index available + * + * Returns buffer pointer on success or NULL on failure + */ void *q6asm_is_cpu_buf_avail(int dir, struct audio_client *ac, uint32_t *size, uint32_t *index) { @@ -2188,7 +2281,17 @@ void *q6asm_is_cpu_buf_avail(int dir, struct audio_client *ac, uint32_t *size, } return NULL; } +EXPORT_SYMBOL(q6asm_is_cpu_buf_avail); +/** + * q6asm_cpu_buf_release - + * releases cpu buffer for ASM + * + * @dir: RX or TX direction + * @ac: Audio client handle + * + * Returns 0 on success or error on failure + */ int q6asm_cpu_buf_release(int dir, struct audio_client *ac) { struct audio_port_data *port; @@ -2222,7 +2325,20 @@ int q6asm_cpu_buf_release(int dir, struct audio_client *ac) exit: return ret; } +EXPORT_SYMBOL(q6asm_cpu_buf_release); +/** + * q6asm_is_cpu_buf_avail_nolock - + * retrieve next CPU buf avail without lock acquire + * + * @dir: RX or TX direction + * @ac: Audio client handle + * @size: size pointer to be updated with size of buffer + * @index: index pointer to be updated with + * CPU buffer index available + * + * Returns buffer pointer on success or NULL on failure + */ void *q6asm_is_cpu_buf_avail_nolock(int dir, struct audio_client *ac, uint32_t *size, uint32_t *index) { @@ -2271,6 +2387,7 @@ void *q6asm_is_cpu_buf_avail_nolock(int dir, struct audio_client *ac, port->max_buf_cnt); return data; } +EXPORT_SYMBOL(q6asm_is_cpu_buf_avail_nolock); int q6asm_is_dsp_buf_avail(int dir, struct audio_client *ac) { @@ -2559,6 +2676,15 @@ fail_cmd: return rc; } +/** + * q6asm_open_read - + * command to open ASM in read mode + * + * @ac: Audio client handle + * @format: capture format for ASM + * + * Returns 0 on success or error on failure + */ int q6asm_open_read(struct audio_client *ac, uint32_t format) { @@ -2566,6 +2692,7 @@ int q6asm_open_read(struct audio_client *ac, PCM_MEDIA_FORMAT_V2 /*media fmt block ver*/, false/*ts_mode*/); } +EXPORT_SYMBOL(q6asm_open_read); int q6asm_open_read_v2(struct audio_client *ac, uint32_t format, uint16_t bits_per_sample) @@ -2608,6 +2735,16 @@ int q6asm_open_read_v4(struct audio_client *ac, uint32_t format, } EXPORT_SYMBOL(q6asm_open_read_v4); +/** + * q6asm_open_write_compressed - + * command to open ASM in compressed write mode + * + * @ac: Audio client handle + * @format: playback format for ASM + * @passthrough_flag: flag to indicate passthrough option + * + * Returns 0 on success or error on failure + */ int q6asm_open_write_compressed(struct audio_client *ac, uint32_t format, uint32_t passthrough_flag) { @@ -2711,6 +2848,7 @@ int q6asm_open_write_compressed(struct audio_client *ac, uint32_t format, fail_cmd: return rc; } +EXPORT_SYMBOL(q6asm_open_write_compressed); static int __q6asm_open_write(struct audio_client *ac, uint32_t format, uint16_t bits_per_sample, uint32_t stream_id, @@ -2871,6 +3009,7 @@ int q6asm_open_write(struct audio_client *ac, uint32_t format) false /*gapless*/, PCM_MEDIA_FORMAT_V2 /*pcm_format_block_ver*/); } +EXPORT_SYMBOL(q6asm_open_write); int q6asm_open_write_v2(struct audio_client *ac, uint32_t format, uint16_t bits_per_sample) @@ -3128,6 +3267,16 @@ fail_cmd: return rc; } +/** + * q6asm_open_read_write - + * command to open ASM in read/write mode + * + * @ac: Audio client handle + * @rd_format: capture format for ASM + * @wr_format: playback format for ASM + * + * Returns 0 on success or error on failure + */ int q6asm_open_read_write(struct audio_client *ac, uint32_t rd_format, uint32_t wr_format) { @@ -3136,7 +3285,22 @@ int q6asm_open_read_write(struct audio_client *ac, uint32_t rd_format, 16 /*bits_per_sample*/, false /*overwrite_topology*/, 0); } +EXPORT_SYMBOL(q6asm_open_read_write); +/** + * q6asm_open_read_write_v2 - + * command to open ASM in bi-directional read/write mode + * + * @ac: Audio client handle + * @rd_format: capture format for ASM + * @wr_format: playback format for ASM + * @is_meta_data_mode: mode to indicate if meta data present + * @bits_per_sample: number of bits per sample + * @overwrite_topology: topology to be overwritten flag + * @topology: Topology for ASM + * + * Returns 0 on success or error on failure + */ int q6asm_open_read_write_v2(struct audio_client *ac, uint32_t rd_format, uint32_t wr_format, bool is_meta_data_mode, uint32_t bits_per_sample, bool overwrite_topology, @@ -3146,7 +3310,17 @@ int q6asm_open_read_write_v2(struct audio_client *ac, uint32_t rd_format, is_meta_data_mode, bits_per_sample, overwrite_topology, topology); } +EXPORT_SYMBOL(q6asm_open_read_write_v2); +/** + * q6asm_open_loopback_v2 - + * command to open ASM in loopback mode + * + * @ac: Audio client handle + * @bits_per_sample: number of bits per sample + * + * Returns 0 on success or error on failure + */ int q6asm_open_loopback_v2(struct audio_client *ac, uint16_t bits_per_sample) { int rc = 0x00; @@ -3243,8 +3417,19 @@ int q6asm_open_loopback_v2(struct audio_client *ac, uint16_t bits_per_sample) fail_cmd: return rc; } +EXPORT_SYMBOL(q6asm_open_loopback_v2); - +/** + * q6asm_open_transcode_loopback - + * command to open ASM in transcode loopback mode + * + * @ac: Audio client handle + * @bits_per_sample: number of bits per sample + * @source_format: Format of clip + * @sink_format: end device supported format + * + * Returns 0 on success or error on failure + */ int q6asm_open_transcode_loopback(struct audio_client *ac, uint16_t bits_per_sample, uint32_t source_format, uint32_t sink_format) @@ -3339,6 +3524,7 @@ int q6asm_open_transcode_loopback(struct audio_client *ac, fail_cmd: return rc; } +EXPORT_SYMBOL(q6asm_open_transcode_loopback); static int q6asm_set_shared_circ_buff(struct audio_client *ac, @@ -3719,7 +3905,19 @@ int q6asm_get_shared_pos(struct audio_client *ac, uint32_t *read_index, __func__); return -EAGAIN; } +EXPORT_SYMBOL(q6asm_get_shared_pos); +/** + * q6asm_run - + * command to set ASM to run state + * + * @ac: Audio client handle + * @flags: Flags for session + * @msw_ts: upper 32bits timestamp + * @lsw_ts: lower 32bits timestamp + * + * Returns 0 on success or error on failure + */ int q6asm_run(struct audio_client *ac, uint32_t flags, uint32_t msw_ts, uint32_t lsw_ts) { @@ -3775,6 +3973,7 @@ int q6asm_run(struct audio_client *ac, uint32_t flags, fail_cmd: return rc; } +EXPORT_SYMBOL(q6asm_run); static int __q6asm_run_nowait(struct audio_client *ac, uint32_t flags, uint32_t msw_ts, uint32_t lsw_ts, uint32_t stream_id) @@ -3807,11 +4006,23 @@ static int __q6asm_run_nowait(struct audio_client *ac, uint32_t flags, return 0; } +/** + * q6asm_run_nowait - + * command to set ASM to run state with no wait for ack + * + * @ac: Audio client handle + * @flags: Flags for session + * @msw_ts: upper 32bits timestamp + * @lsw_ts: lower 32bits timestamp + * + * Returns 0 on success or error on failure + */ int q6asm_run_nowait(struct audio_client *ac, uint32_t flags, uint32_t msw_ts, uint32_t lsw_ts) { return __q6asm_run_nowait(ac, flags, msw_ts, lsw_ts, ac->stream_id); } +EXPORT_SYMBOL(q6asm_run_nowait); int q6asm_stream_run_nowait(struct audio_client *ac, uint32_t flags, uint32_t msw_ts, uint32_t lsw_ts, uint32_t stream_id) @@ -3819,6 +4030,20 @@ int q6asm_stream_run_nowait(struct audio_client *ac, uint32_t flags, return __q6asm_run_nowait(ac, flags, msw_ts, lsw_ts, stream_id); } +/** + * q6asm_enc_cfg_blk_aac - + * command to set encode cfg block for aac + * + * @ac: Audio client handle + * @frames_per_buf: number of frames per buffer + * @sample_rate: Sample rate + * @channels: number of ASM channels + * @bit_rate: Bit rate info + * @mode: mode of AAC stream encode + * @format: aac format flag + * + * Returns 0 on success or error on failure + */ int q6asm_enc_cfg_blk_aac(struct audio_client *ac, uint32_t frames_per_buf, uint32_t sample_rate, uint32_t channels, @@ -3874,7 +4099,18 @@ int q6asm_enc_cfg_blk_aac(struct audio_client *ac, fail_cmd: return rc; } +EXPORT_SYMBOL(q6asm_enc_cfg_blk_aac); +/** + * q6asm_enc_cfg_blk_g711 - + * command to set encode cfg block for g711 + * + * @ac: Audio client handle + * @frames_per_buf: number of frames per buffer + * @sample_rate: Sample rate + * + * Returns 0 on success or error on failure + */ int q6asm_enc_cfg_blk_g711(struct audio_client *ac, uint32_t frames_per_buf, uint32_t sample_rate) @@ -3925,7 +4161,17 @@ int q6asm_enc_cfg_blk_g711(struct audio_client *ac, fail_cmd: return rc; } +EXPORT_SYMBOL(q6asm_enc_cfg_blk_g711); +/** + * q6asm_set_encdec_chan_map - + * command to set encdec channel map + * + * @ac: Audio client handle + * @channels: number of channels + * + * Returns 0 on success or error on failure + */ int q6asm_set_encdec_chan_map(struct audio_client *ac, uint32_t num_channels) { @@ -3978,6 +4224,7 @@ int q6asm_set_encdec_chan_map(struct audio_client *ac, fail_cmd: return rc; } +EXPORT_SYMBOL(q6asm_set_encdec_chan_map); /* * q6asm_enc_cfg_blk_pcm_v4 - sends encoder configuration parameters @@ -4178,6 +4425,20 @@ fail_cmd: } EXPORT_SYMBOL(q6asm_enc_cfg_blk_pcm_v3); +/** + * q6asm_enc_cfg_blk_pcm_v2 - + * command to set encode config block for pcm_v2 + * + * @ac: Audio client handle + * @rate: sample rate + * @channels: number of channels + * @bits_per_sample: number of bits per sample + * @use_default_chmap: Flag indicating to use default ch_map or not + * @use_back_flavor: back flavor flag + * @channel_map: Custom channel map settings + * + * Returns 0 on success or error on failure + */ int q6asm_enc_cfg_blk_pcm_v2(struct audio_client *ac, uint32_t rate, uint32_t channels, uint16_t bits_per_sample, bool use_default_chmap, bool use_back_flavor, u8 *channel_map) @@ -4256,6 +4517,7 @@ int q6asm_enc_cfg_blk_pcm_v2(struct audio_client *ac, fail_cmd: return rc; } +EXPORT_SYMBOL(q6asm_enc_cfg_blk_pcm_v2); static int __q6asm_enc_cfg_blk_pcm_v4(struct audio_client *ac, uint32_t rate, uint32_t channels, @@ -4286,11 +4548,22 @@ static int __q6asm_enc_cfg_blk_pcm(struct audio_client *ac, bits_per_sample, true, false, NULL); } +/** + * q6asm_enc_cfg_blk_pcm - + * command to set encode config block for pcm + * + * @ac: Audio client handle + * @rate: sample rate + * @channels: number of channels + * + * Returns 0 on success or error on failure + */ int q6asm_enc_cfg_blk_pcm(struct audio_client *ac, uint32_t rate, uint32_t channels) { return __q6asm_enc_cfg_blk_pcm(ac, rate, channels, 16); } +EXPORT_SYMBOL(q6asm_enc_cfg_blk_pcm); int q6asm_enc_cfg_blk_pcm_format_support(struct audio_client *ac, uint32_t rate, uint32_t channels, uint16_t bits_per_sample) @@ -4343,6 +4616,16 @@ int q6asm_enc_cfg_blk_pcm_format_support_v4(struct audio_client *ac, } EXPORT_SYMBOL(q6asm_enc_cfg_blk_pcm_format_support_v4); +/** + * q6asm_enc_cfg_blk_pcm_native - + * command to set encode config block for pcm_native + * + * @ac: Audio client handle + * @rate: sample rate + * @channels: number of channels + * + * Returns 0 on success or error on failure + */ int q6asm_enc_cfg_blk_pcm_native(struct audio_client *ac, uint32_t rate, uint32_t channels) { @@ -4405,6 +4688,7 @@ int q6asm_enc_cfg_blk_pcm_native(struct audio_client *ac, fail_cmd: return rc; } +EXPORT_SYMBOL(q6asm_enc_cfg_blk_pcm_native); static int q6asm_map_channels(u8 *channel_mapping, uint32_t channels, bool use_back_flavor) @@ -4477,6 +4761,15 @@ static int q6asm_map_channels(u8 *channel_mapping, uint32_t channels, return 0; } +/** + * q6asm_enable_sbrps - + * command to enable sbrps for ASM + * + * @ac: Audio client handle + * @sbr_ps_enable: flag for sbr_ps enable or disable + * + * Returns 0 on success or error on failure + */ int q6asm_enable_sbrps(struct audio_client *ac, uint32_t sbr_ps_enable) { @@ -4528,7 +4821,18 @@ int q6asm_enable_sbrps(struct audio_client *ac, fail_cmd: return rc; } +EXPORT_SYMBOL(q6asm_enable_sbrps); +/** + * q6asm_cfg_dual_mono_aac - + * command to set config for dual mono aac + * + * @ac: Audio client handle + * @sce_left: left sce val + * @sce_right: right sce val + * + * Returns 0 on success or error on failure + */ int q6asm_cfg_dual_mono_aac(struct audio_client *ac, uint16_t sce_left, uint16_t sce_right) { @@ -4577,6 +4881,7 @@ int q6asm_cfg_dual_mono_aac(struct audio_client *ac, fail_cmd: return rc; } +EXPORT_SYMBOL(q6asm_cfg_dual_mono_aac); /* Support for selecting stereo mixing coefficients for B family not done */ int q6asm_cfg_aac_sel_mix_coef(struct audio_client *ac, uint32_t mix_coeff) @@ -4622,7 +4927,21 @@ int q6asm_cfg_aac_sel_mix_coef(struct audio_client *ac, uint32_t mix_coeff) fail_cmd: return rc; } +EXPORT_SYMBOL(q6asm_cfg_aac_sel_mix_coef); +/** + * q6asm_enc_cfg_blk_qcelp - + * command to set encode config block for QCELP + * + * @ac: Audio client handle + * @frames_per_buf: Number of frames per buffer + * @min_rate: Minimum Enc rate + * @max_rate: Maximum Enc rate + * reduced_rate_level: Reduced rate level + * @rate_modulation_cmd: rate modulation command + * + * Returns 0 on success or error on failure + */ int q6asm_enc_cfg_blk_qcelp(struct audio_client *ac, uint32_t frames_per_buf, uint16_t min_rate, uint16_t max_rate, uint16_t reduced_rate_level, uint16_t rate_modulation_cmd) @@ -4677,7 +4996,20 @@ int q6asm_enc_cfg_blk_qcelp(struct audio_client *ac, uint32_t frames_per_buf, fail_cmd: return rc; } +EXPORT_SYMBOL(q6asm_enc_cfg_blk_qcelp); +/** + * q6asm_enc_cfg_blk_evrc - + * command to set encode config block for EVRC + * + * @ac: Audio client handle + * @frames_per_buf: Number of frames per buffer + * @min_rate: Minimum Enc rate + * @max_rate: Maximum Enc rate + * @rate_modulation_cmd: rate modulation command + * + * Returns 0 on success or error on failure + */ int q6asm_enc_cfg_blk_evrc(struct audio_client *ac, uint32_t frames_per_buf, uint16_t min_rate, uint16_t max_rate, uint16_t rate_modulation_cmd) @@ -4730,7 +5062,19 @@ int q6asm_enc_cfg_blk_evrc(struct audio_client *ac, uint32_t frames_per_buf, fail_cmd: return rc; } +EXPORT_SYMBOL(q6asm_enc_cfg_blk_evrc); +/** + * q6asm_enc_cfg_blk_amrnb - + * command to set encode config block for AMRNB + * + * @ac: Audio client handle + * @frames_per_buf: Number of frames per buffer + * @band_mode: Band mode used + * @dtx_enable: DTX en flag + * + * Returns 0 on success or error on failure + */ int q6asm_enc_cfg_blk_amrnb(struct audio_client *ac, uint32_t frames_per_buf, uint16_t band_mode, uint16_t dtx_enable) { @@ -4779,7 +5123,19 @@ int q6asm_enc_cfg_blk_amrnb(struct audio_client *ac, uint32_t frames_per_buf, fail_cmd: return rc; } +EXPORT_SYMBOL(q6asm_enc_cfg_blk_amrnb); +/** + * q6asm_enc_cfg_blk_amrwb - + * command to set encode config block for AMRWB + * + * @ac: Audio client handle + * @frames_per_buf: Number of frames per buffer + * @band_mode: Band mode used + * @dtx_enable: DTX en flag + * + * Returns 0 on success or error on failure + */ int q6asm_enc_cfg_blk_amrwb(struct audio_client *ac, uint32_t frames_per_buf, uint16_t band_mode, uint16_t dtx_enable) { @@ -4828,6 +5184,7 @@ int q6asm_enc_cfg_blk_amrwb(struct audio_client *ac, uint32_t frames_per_buf, fail_cmd: return rc; } +EXPORT_SYMBOL(q6asm_enc_cfg_blk_amrwb); static int __q6asm_media_format_block_pcm(struct audio_client *ac, @@ -5075,6 +5432,16 @@ fail_cmd: return rc; } +/** + * q6asm_media_format_block_pcm - + * command to set mediafmt block for PCM on ASM stream + * + * @ac: Audio client handle + * @rate: sample rate + * @channels: number of ASM channels + * + * Returns 0 on success or error on failure + */ int q6asm_media_format_block_pcm(struct audio_client *ac, uint32_t rate, uint32_t channels) { @@ -5082,7 +5449,19 @@ int q6asm_media_format_block_pcm(struct audio_client *ac, channels, 16, ac->stream_id, true, NULL); } +EXPORT_SYMBOL(q6asm_media_format_block_pcm); +/** + * q6asm_media_format_block_pcm_format_support - + * command to set mediafmt block for PCM format support + * + * @ac: Audio client handle + * @rate: sample rate + * @channels: number of ASM channels + * @bits_per_sample: number of bits per sample + * + * Returns 0 on success or error on failure + */ int q6asm_media_format_block_pcm_format_support(struct audio_client *ac, uint32_t rate, uint32_t channels, uint16_t bits_per_sample) @@ -5091,6 +5470,7 @@ int q6asm_media_format_block_pcm_format_support(struct audio_client *ac, channels, bits_per_sample, ac->stream_id, true, NULL); } +EXPORT_SYMBOL(q6asm_media_format_block_pcm_format_support); int q6asm_media_format_block_pcm_format_support_v2(struct audio_client *ac, uint32_t rate, uint32_t channels, @@ -5668,24 +6048,65 @@ fail_cmd: return rc; } +/** + * q6asm_media_format_block_multi_aac - + * command to set mediafmt block for multi_aac on ASM stream + * + * @ac: Audio client handle + * @cfg: multi_aac config + * + * Returns 0 on success or error on failure + */ int q6asm_media_format_block_multi_aac(struct audio_client *ac, struct asm_aac_cfg *cfg) { return __q6asm_media_format_block_multi_aac(ac, cfg, ac->stream_id); } +EXPORT_SYMBOL(q6asm_media_format_block_multi_aac); +/** + * q6asm_media_format_block_aac - + * command to set mediafmt block for aac on ASM + * + * @ac: Audio client handle + * @cfg: aac config + * + * Returns 0 on success or error on failure + */ int q6asm_media_format_block_aac(struct audio_client *ac, struct asm_aac_cfg *cfg) { return __q6asm_media_format_block_multi_aac(ac, cfg, ac->stream_id); } +EXPORT_SYMBOL(q6asm_media_format_block_aac); +/** + * q6asm_stream_media_format_block_aac - + * command to set mediafmt block for aac on ASM stream + * + * @ac: Audio client handle + * @cfg: aac config + * @stream_id: stream ID info + * + * Returns 0 on success or error on failure + */ int q6asm_stream_media_format_block_aac(struct audio_client *ac, struct asm_aac_cfg *cfg, int stream_id) { return __q6asm_media_format_block_multi_aac(ac, cfg, stream_id); } +EXPORT_SYMBOL(q6asm_stream_media_format_block_aac); +/** + * q6asm_media_format_block_wma - + * command to set mediafmt block for wma on ASM stream + * + * @ac: Audio client handle + * @cfg: wma config + * @stream_id: stream ID info + * + * Returns 0 on success or error on failure + */ int q6asm_media_format_block_wma(struct audio_client *ac, void *cfg, int stream_id) { @@ -5740,7 +6161,18 @@ int q6asm_media_format_block_wma(struct audio_client *ac, fail_cmd: return rc; } +EXPORT_SYMBOL(q6asm_media_format_block_wma); +/** + * q6asm_media_format_block_wmapro - + * command to set mediafmt block for wmapro on ASM stream + * + * @ac: Audio client handle + * @cfg: wmapro config + * @stream_id: stream ID info + * + * Returns 0 on success or error on failure + */ int q6asm_media_format_block_wmapro(struct audio_client *ac, void *cfg, int stream_id) { @@ -5800,7 +6232,18 @@ int q6asm_media_format_block_wmapro(struct audio_client *ac, fail_cmd: return rc; } +EXPORT_SYMBOL(q6asm_media_format_block_wmapro); +/** + * q6asm_media_format_block_amrwbplus - + * command to set mediafmt block for amrwbplus on ASM stream + * + * @ac: Audio client handle + * @cfg: amrwbplus config + * @stream_id: stream ID info + * + * Returns 0 on success or error on failure + */ int q6asm_media_format_block_amrwbplus(struct audio_client *ac, struct asm_amrwbplus_cfg *cfg) { @@ -5848,7 +6291,18 @@ int q6asm_media_format_block_amrwbplus(struct audio_client *ac, fail_cmd: return rc; } +EXPORT_SYMBOL(q6asm_media_format_block_amrwbplus); +/** + * q6asm_stream_media_format_block_flac - + * command to set mediafmt block for flac on ASM stream + * + * @ac: Audio client handle + * @cfg: FLAC config + * @stream_id: stream ID info + * + * Returns 0 on success or error on failure + */ int q6asm_stream_media_format_block_flac(struct audio_client *ac, struct asm_flac_cfg *cfg, int stream_id) { @@ -5901,7 +6355,18 @@ int q6asm_stream_media_format_block_flac(struct audio_client *ac, fail_cmd: return rc; } +EXPORT_SYMBOL(q6asm_stream_media_format_block_flac); +/** + * q6asm_media_format_block_alac - + * command to set mediafmt block for alac on ASM stream + * + * @ac: Audio client handle + * @cfg: ALAC config + * @stream_id: stream ID info + * + * Returns 0 on success or error on failure + */ int q6asm_media_format_block_alac(struct audio_client *ac, struct asm_alac_cfg *cfg, int stream_id) { @@ -5957,6 +6422,7 @@ int q6asm_media_format_block_alac(struct audio_client *ac, fail_cmd: return rc; } +EXPORT_SYMBOL(q6asm_media_format_block_alac); /* * q6asm_media_format_block_g711 - sends g711 decoder configuration @@ -6027,6 +6493,16 @@ fail_cmd: } EXPORT_SYMBOL(q6asm_media_format_block_g711); +/** + * q6asm_stream_media_format_block_vorbis - + * command to set mediafmt block for vorbis on ASM stream + * + * @ac: Audio client handle + * @cfg: vorbis config + * @stream_id: stream ID info + * + * Returns 0 on success or error on failure + */ int q6asm_stream_media_format_block_vorbis(struct audio_client *ac, struct asm_vorbis_cfg *cfg, int stream_id) { @@ -6071,7 +6547,18 @@ int q6asm_stream_media_format_block_vorbis(struct audio_client *ac, fail_cmd: return rc; } +EXPORT_SYMBOL(q6asm_stream_media_format_block_vorbis); +/** + * q6asm_media_format_block_ape - + * command to set mediafmt block for APE on ASM stream + * + * @ac: Audio client handle + * @cfg: APE config + * @stream_id: stream ID info + * + * Returns 0 on success or error on failure + */ int q6asm_media_format_block_ape(struct audio_client *ac, struct asm_ape_cfg *cfg, int stream_id) { @@ -6125,6 +6612,7 @@ int q6asm_media_format_block_ape(struct audio_client *ac, fail_cmd: return rc; } +EXPORT_SYMBOL(q6asm_media_format_block_ape); /* * q6asm_media_format_block_dsd- Sends DSD Decoder @@ -6186,6 +6674,16 @@ done: } EXPORT_SYMBOL(q6asm_media_format_block_dsd); +/** + * q6asm_stream_media_format_block_aptx_dec - + * command to set mediafmt block for APTX dec on ASM stream + * + * @ac: Audio client handle + * @srate: sample rate + * @stream_id: stream ID info + * + * Returns 0 on success or error on failure + */ int q6asm_stream_media_format_block_aptx_dec(struct audio_client *ac, uint32_t srate, int stream_id) { @@ -6236,6 +6734,7 @@ int q6asm_stream_media_format_block_aptx_dec(struct audio_client *ac, fail_cmd: return rc; } +EXPORT_SYMBOL(q6asm_stream_media_format_block_aptx_dec); static int __q6asm_ds1_set_endp_params(struct audio_client *ac, int param_id, int param_value, int stream_id) @@ -6294,6 +6793,16 @@ fail_cmd: return rc; } +/** + * q6asm_ds1_set_endp_params - + * command to set DS1 params for ASM + * + * @ac: Audio client handle + * @param_id: param id + * @param_value: value of param + * + * Returns 0 on success or error on failure + */ int q6asm_ds1_set_endp_params(struct audio_client *ac, int param_id, int param_value) { @@ -6301,6 +6810,17 @@ int q6asm_ds1_set_endp_params(struct audio_client *ac, ac->stream_id); } +/** + * q6asm_ds1_set_stream_endp_params - + * command to set DS1 params for ASM stream + * + * @ac: Audio client handle + * @param_id: param id + * @param_value: value of param + * @stream_id: stream ID info + * + * Returns 0 on success or error on failure + */ int q6asm_ds1_set_stream_endp_params(struct audio_client *ac, int param_id, int param_value, int stream_id) @@ -6308,7 +6828,20 @@ int q6asm_ds1_set_stream_endp_params(struct audio_client *ac, return __q6asm_ds1_set_endp_params(ac, param_id, param_value, stream_id); } +EXPORT_SYMBOL(q6asm_ds1_set_stream_endp_params); +/** + * q6asm_memory_map - + * command to send memory map for ASM + * + * @ac: Audio client handle + * @buf_add: buffer address to map + * @dir: RX or TX session + * @bufsz: size of each buffer + * @bufcnt: buffer count + * + * Returns 0 on success or error on failure + */ int q6asm_memory_map(struct audio_client *ac, phys_addr_t buf_add, int dir, uint32_t bufsz, uint32_t bufcnt) { @@ -6402,7 +6935,18 @@ fail_cmd: kfree(mmap_region_cmd); return rc; } +EXPORT_SYMBOL(q6asm_memory_map); +/** + * q6asm_memory_unmap - + * command to send memory unmap for ASM + * + * @ac: Audio client handle + * @buf_add: buffer address to unmap + * @dir: RX or TX session + * + * Returns 0 on success or error on failure + */ int q6asm_memory_unmap(struct audio_client *ac, phys_addr_t buf_add, int dir) { struct avs_cmd_shared_mem_unmap_regions mem_unmap; @@ -6487,8 +7031,20 @@ fail_cmd: } return rc; } +EXPORT_SYMBOL(q6asm_memory_unmap); - +/** + * q6asm_memory_map_regions - + * command to send memory map regions for ASM + * + * @ac: Audio client handle + * @dir: RX or TX session + * @bufsz: size of each buffer + * @bufcnt: buffer count + * @is_contiguous: alloc contiguous mem or not + * + * Returns 0 on success or error on failure + */ static int q6asm_memory_map_regions(struct audio_client *ac, int dir, uint32_t bufsz, uint32_t bufcnt, bool is_contiguous) @@ -6628,7 +7184,17 @@ fail_cmd: kfree(mmap_region_cmd); return rc; } +EXPORT_SYMBOL(q6asm_memory_map_regions); +/** + * q6asm_memory_unmap_regions - + * command to send memory unmap regions for ASM + * + * @ac: Audio client handle + * @dir: RX or TX session + * + * Returns 0 on success or error on failure + */ static int q6asm_memory_unmap_regions(struct audio_client *ac, int dir) { struct avs_cmd_shared_mem_unmap_regions mem_unmap; @@ -6715,6 +7281,7 @@ fail_cmd: } return rc; } +EXPORT_SYMBOL(q6asm_memory_unmap_regions); int q6asm_set_lrgain(struct audio_client *ac, int left_gain, int right_gain) { @@ -6886,7 +7453,17 @@ int q6asm_set_multich_gain(struct audio_client *ac, uint32_t channels, done: return rc; } +EXPORT_SYMBOL(q6asm_set_multich_gain); +/** + * q6asm_set_mute - + * command to set mute for ASM + * + * @ac: Audio client handle + * @muteflag: mute value + * + * Returns 0 on success or error on failure + */ int q6asm_set_mute(struct audio_client *ac, int muteflag) { struct asm_volume_ctrl_mute_config mute; @@ -6948,6 +7525,7 @@ int q6asm_set_mute(struct audio_client *ac, int muteflag) fail_cmd: return rc; } +EXPORT_SYMBOL(q6asm_set_mute); static int __q6asm_set_volume(struct audio_client *ac, int volume, int instance) { @@ -7023,16 +7601,35 @@ fail_cmd: return rc; } +/** + * q6asm_set_volume - + * command to set volume for ASM + * + * @ac: Audio client handle + * @volume: volume level + * + * Returns 0 on success or error on failure + */ int q6asm_set_volume(struct audio_client *ac, int volume) { return __q6asm_set_volume(ac, volume, SOFT_VOLUME_INSTANCE_1); } +EXPORT_SYMBOL(q6asm_set_volume); int q6asm_set_volume_v2(struct audio_client *ac, int volume, int instance) { return __q6asm_set_volume(ac, volume, instance); } +/** + * q6asm_set_aptx_dec_bt_addr - + * command to aptx decoder BT addr for ASM + * + * @ac: Audio client handle + * @cfg: APTX decoder bt addr config + * + * Returns 0 on success or error on failure + */ int q6asm_set_aptx_dec_bt_addr(struct audio_client *ac, struct aptx_dec_bt_addr_cfg *cfg) { @@ -7095,7 +7692,17 @@ int q6asm_set_aptx_dec_bt_addr(struct audio_client *ac, fail_cmd: return rc; } +EXPORT_SYMBOL(q6asm_set_aptx_dec_bt_addr); +/** + * q6asm_send_ion_fd - + * command to send ION memory map for ASM + * + * @ac: Audio client handle + * @fd: ION file desc + * + * Returns 0 on success or error on failure + */ int q6asm_send_ion_fd(struct audio_client *ac, int fd) { struct ion_client *client; @@ -7181,7 +7788,18 @@ int q6asm_send_ion_fd(struct audio_client *ac, int fd) fail_cmd: return ret; } +EXPORT_SYMBOL(q6asm_send_ion_fd); +/** + * q6asm_send_rtic_event_ack - + * command to send RTIC event ack + * + * @ac: Audio client handle + * @param: params for event ack + * @params_length: length of params + * + * Returns 0 on success or error on failure + */ int q6asm_send_rtic_event_ack(struct audio_client *ac, void *param, uint32_t params_length) { @@ -7245,7 +7863,17 @@ fail_send_param: done: return rc; } +EXPORT_SYMBOL(q6asm_send_rtic_event_ack); +/** + * q6asm_set_softpause - + * command to set pause for ASM + * + * @ac: Audio client handle + * @pause_param: params for pause + * + * Returns 0 on success or error on failure + */ int q6asm_set_softpause(struct audio_client *ac, struct asm_softpause_params *pause_param) { @@ -7313,6 +7941,7 @@ int q6asm_set_softpause(struct audio_client *ac, fail_cmd: return rc; } +EXPORT_SYMBOL(q6asm_set_softpause); static int __q6asm_set_softvolume(struct audio_client *ac, struct asm_softvolume_params *softvol_param, @@ -7392,20 +8021,50 @@ fail_cmd: return rc; } +/** + * q6asm_set_softvolume - + * command to set softvolume for ASM + * + * @ac: Audio client handle + * @softvol_param: params for softvol + * + * Returns 0 on success or error on failure + */ int q6asm_set_softvolume(struct audio_client *ac, struct asm_softvolume_params *softvol_param) { return __q6asm_set_softvolume(ac, softvol_param, SOFT_VOLUME_INSTANCE_1); } +EXPORT_SYMBOL(q6asm_set_softvolume); +/** + * q6asm_set_softvolume_v2 - + * command to set softvolume V2 for ASM + * + * @ac: Audio client handle + * @softvol_param: params for softvol + * @instance: instance to apply softvol + * + * Returns 0 on success or error on failure + */ int q6asm_set_softvolume_v2(struct audio_client *ac, struct asm_softvolume_params *softvol_param, int instance) { return __q6asm_set_softvolume(ac, softvol_param, instance); } +EXPORT_SYMBOL(q6asm_set_softvolume_v2); +/** + * q6asm_equalizer - + * command to set equalizer for ASM + * + * @ac: Audio client handle + * @eq_p: Equalizer params + * + * Returns 0 on success or error on failure + */ int q6asm_equalizer(struct audio_client *ac, void *eq_p) { struct asm_eq_params eq; @@ -7498,6 +8157,7 @@ int q6asm_equalizer(struct audio_client *ac, void *eq_p) fail_cmd: return rc; } +EXPORT_SYMBOL(q6asm_equalizer); static int __q6asm_read(struct audio_client *ac, bool is_custom_len_reqd, int len) @@ -7580,15 +8240,45 @@ fail_cmd: return -EINVAL; } +/** + * q6asm_read - + * command to read buffer data from DSP + * + * @ac: Audio client handle + * + * Returns 0 on success or error on failure + */ int q6asm_read(struct audio_client *ac) { return __q6asm_read(ac, false/*is_custom_len_reqd*/, 0); } +EXPORT_SYMBOL(q6asm_read); + + +/** + * q6asm_read_v2 - + * command to read buffer data from DSP + * + * @ac: Audio client handle + * @len: buffer size to read + * + * Returns 0 on success or error on failure + */ int q6asm_read_v2(struct audio_client *ac, uint32_t len) { return __q6asm_read(ac, true /*is_custom_len_reqd*/, len); } +EXPORT_SYMBOL(q6asm_read_v2); +/** + * q6asm_read_nolock - + * command to read buffer data from DSP + * with no wait for ack. + * + * @ac: Audio client handle + * + * Returns 0 on success or error on failure + */ int q6asm_read_nolock(struct audio_client *ac) { struct asm_data_cmd_read_v2 read; @@ -7662,7 +8352,17 @@ int q6asm_read_nolock(struct audio_client *ac) fail_cmd: return -EINVAL; } +EXPORT_SYMBOL(q6asm_read_nolock); +/** + * q6asm_async_write - + * command to write DSP buffer + * + * @ac: Audio client handle + * @param: params for async write + * + * Returns 0 on success or error on failure + */ int q6asm_async_write(struct audio_client *ac, struct audio_aio_write_param *param) { @@ -7747,7 +8447,17 @@ int q6asm_async_write(struct audio_client *ac, fail_cmd: return -EINVAL; } +EXPORT_SYMBOL(q6asm_async_write); +/** + * q6asm_async_read - + * command to read DSP buffer + * + * @ac: Audio client handle + * @param: params for async read + * + * Returns 0 on success or error on failure + */ int q6asm_async_read(struct audio_client *ac, struct audio_aio_read_param *param) { @@ -7815,7 +8525,20 @@ int q6asm_async_read(struct audio_client *ac, fail_cmd: return -EINVAL; } +EXPORT_SYMBOL(q6asm_async_read); +/** + * q6asm_write - + * command to write buffer data to DSP + * + * @ac: Audio client handle + * @len: buffer size + * @msw_ts: upper 32bits of timestamp + * @lsw_ts: lower 32bits of timestamp + * @flags: Flags for timestamp mode + * + * Returns 0 on success or error on failure + */ int q6asm_write(struct audio_client *ac, uint32_t len, uint32_t msw_ts, uint32_t lsw_ts, uint32_t flags) { @@ -7895,7 +8618,21 @@ int q6asm_write(struct audio_client *ac, uint32_t len, uint32_t msw_ts, fail_cmd: return -EINVAL; } +EXPORT_SYMBOL(q6asm_write); +/** + * q6asm_write_nolock - + * command to write buffer data to DSP + * with no wait for ack. + * + * @ac: Audio client handle + * @len: buffer size + * @msw_ts: upper 32bits of timestamp + * @lsw_ts: lower 32bits of timestamp + * @flags: Flags for timestamp mode + * + * Returns 0 on success or error on failure + */ int q6asm_write_nolock(struct audio_client *ac, uint32_t len, uint32_t msw_ts, uint32_t lsw_ts, uint32_t flags) { @@ -7972,7 +8709,17 @@ int q6asm_write_nolock(struct audio_client *ac, uint32_t len, uint32_t msw_ts, fail_cmd: return -EINVAL; } +EXPORT_SYMBOL(q6asm_write_nolock); +/** + * q6asm_get_session_time - + * command to retrieve timestamp info + * + * @ac: Audio client handle + * @tstamp: pointer to fill with timestamp info + * + * Returns 0 on success or error on failure + */ int q6asm_get_session_time(struct audio_client *ac, uint64_t *tstamp) { struct asm_mtmx_strtr_get_params mtmx_params; @@ -8029,7 +8776,17 @@ int q6asm_get_session_time(struct audio_client *ac, uint64_t *tstamp) fail_cmd: return -EINVAL; } +EXPORT_SYMBOL(q6asm_get_session_time); +/** + * q6asm_get_session_time_legacy - + * command to retrieve timestamp info + * + * @ac: Audio client handle + * @tstamp: pointer to fill with timestamp info + * + * Returns 0 on success or error on failure + */ int q6asm_get_session_time_legacy(struct audio_client *ac, uint64_t *tstamp) { struct apr_hdr hdr; @@ -8075,8 +8832,18 @@ int q6asm_get_session_time_legacy(struct audio_client *ac, uint64_t *tstamp) fail_cmd: return -EINVAL; } +EXPORT_SYMBOL(q6asm_get_session_time_legacy); - +/** + * q6asm_send_audio_effects_params - + * command to send audio effects params + * + * @ac: Audio client handle + * @params: audio effects params + * @params_length: size of params + * + * Returns 0 on success or error on failure + */ int q6asm_send_audio_effects_params(struct audio_client *ac, char *params, uint32_t params_length) { @@ -8148,7 +8915,18 @@ fail_send_param: kfree(asm_params); return rc; } +EXPORT_SYMBOL(q6asm_send_audio_effects_params); +/** + * q6asm_send_mtmx_strtr_window - + * command to send matrix for window params + * + * @ac: Audio client handle + * @window_param: window params + * @param_id: param id for window + * + * Returns 0 on success or error on failure + */ int q6asm_send_mtmx_strtr_window(struct audio_client *ac, struct asm_session_mtmx_strtr_param_window_v2_t *window_param, uint32_t param_id) @@ -8222,7 +9000,17 @@ int q6asm_send_mtmx_strtr_window(struct audio_client *ac, fail_cmd: return rc; } +EXPORT_SYMBOL(q6asm_send_mtmx_strtr_window); +/** + * q6asm_send_mtmx_strtr_render_mode - + * command to send matrix for render mode + * + * @ac: Audio client handle + * @render_mode: rendering mode + * + * Returns 0 on success or error on failure + */ int q6asm_send_mtmx_strtr_render_mode(struct audio_client *ac, uint32_t render_mode) { @@ -8307,7 +9095,17 @@ int q6asm_send_mtmx_strtr_render_mode(struct audio_client *ac, exit: return rc; } +EXPORT_SYMBOL(q6asm_send_mtmx_strtr_render_mode); +/** + * q6asm_send_mtmx_strtr_clk_rec_mode - + * command to send matrix for clock rec + * + * @ac: Audio client handle + * @clk_rec_mode: mode for clock rec + * + * Returns 0 on success or error on failure + */ int q6asm_send_mtmx_strtr_clk_rec_mode(struct audio_client *ac, uint32_t clk_rec_mode) { @@ -8392,7 +9190,17 @@ int q6asm_send_mtmx_strtr_clk_rec_mode(struct audio_client *ac, exit: return rc; } +EXPORT_SYMBOL(q6asm_send_mtmx_strtr_clk_rec_mode); +/** + * q6asm_send_mtmx_strtr_enable_adjust_session_clock - + * command to send matrix for adjust time + * + * @ac: Audio client handle + * @enable: flag to adjust time or not + * + * Returns 0 on success or error on failure + */ int q6asm_send_mtmx_strtr_enable_adjust_session_clock(struct audio_client *ac, bool enable) { @@ -8465,6 +9273,7 @@ int q6asm_send_mtmx_strtr_enable_adjust_session_clock(struct audio_client *ac, exit: return rc; } +EXPORT_SYMBOL(q6asm_send_mtmx_strtr_enable_adjust_session_clock); static int __q6asm_cmd(struct audio_client *ac, int cmd, uint32_t stream_id) @@ -8588,16 +9397,50 @@ fail_cmd: return rc; } +/** + * q6asm_cmd - + * Function used to send commands for + * ASM with wait for ack. + * + * @ac: Audio client handle + * @cmd: command to send + * + * Returns 0 on success or error on failure + */ int q6asm_cmd(struct audio_client *ac, int cmd) { return __q6asm_cmd(ac, cmd, ac->stream_id); } +EXPORT_SYMBOL(q6asm_cmd); +/** + * q6asm_stream_cmd - + * Function used to send commands for + * ASM stream with wait for ack. + * + * @ac: Audio client handle + * @cmd: command to send + * @stream_id: Stream ID + * + * Returns 0 on success or error on failure + */ int q6asm_stream_cmd(struct audio_client *ac, int cmd, uint32_t stream_id) { return __q6asm_cmd(ac, cmd, stream_id); } +EXPORT_SYMBOL(q6asm_stream_cmd); +/** + * q6asm_cmd_nowait - + * Function used to send commands for + * ASM stream without wait for ack. + * + * @ac: Audio client handle + * @cmd: command to send + * @stream_id: Stream ID + * + * Returns 0 on success or error on failure + */ static int __q6asm_cmd_nowait(struct audio_client *ac, int cmd, uint32_t stream_id) { @@ -8666,13 +9509,26 @@ int q6asm_cmd_nowait(struct audio_client *ac, int cmd) pr_debug("%s: stream_id: %d\n", __func__, ac->stream_id); return __q6asm_cmd_nowait(ac, cmd, ac->stream_id); } +EXPORT_SYMBOL(q6asm_cmd_nowait); +/** + * q6asm_stream_cmd_nowait - + * Function used to send commands for + * ASM stream without wait for ack. + * + * @ac: Audio client handle + * @cmd: command to send + * @stream_id: Stream ID + * + * Returns 0 on success or error on failure + */ int q6asm_stream_cmd_nowait(struct audio_client *ac, int cmd, uint32_t stream_id) { pr_debug("%s: stream_id: %d\n", __func__, stream_id); return __q6asm_cmd_nowait(ac, cmd, stream_id); } +EXPORT_SYMBOL(q6asm_stream_cmd_nowait); int __q6asm_send_meta_data(struct audio_client *ac, uint32_t stream_id, uint32_t initial_samples, uint32_t trailing_samples) @@ -8732,12 +9588,24 @@ fail_cmd: return -EINVAL; } +/** + * q6asm_stream_send_meta_data - + * command to send meta data for stream + * + * @ac: Audio client handle + * @stream_id: Stream ID + * @initial_samples: Initial samples of stream + * @trailing_samples: Trailing samples of stream + * + * Returns 0 on success or error on failure + */ int q6asm_stream_send_meta_data(struct audio_client *ac, uint32_t stream_id, uint32_t initial_samples, uint32_t trailing_samples) { return __q6asm_send_meta_data(ac, stream_id, initial_samples, trailing_samples); } +EXPORT_SYMBOL(q6asm_stream_send_meta_data); int q6asm_send_meta_data(struct audio_client *ac, uint32_t initial_samples, uint32_t trailing_samples) @@ -8772,6 +9640,15 @@ static void q6asm_reset_buf_state(struct audio_client *ac) } } +/** + * q6asm_reg_tx_overflow - + * command to register for TX overflow events + * + * @ac: Audio client handle + * @enable: flag to enable or disable events + * + * Returns 0 on success or error on failure + */ int q6asm_reg_tx_overflow(struct audio_client *ac, uint16_t enable) { struct asm_session_cmd_regx_overflow tx_overflow; @@ -8822,6 +9699,7 @@ int q6asm_reg_tx_overflow(struct audio_client *ac, uint16_t enable) fail_cmd: return rc; } +EXPORT_SYMBOL(q6asm_reg_tx_overflow); int q6asm_reg_rx_underflow(struct audio_client *ac, uint16_t enable) { @@ -8856,6 +9734,16 @@ fail_cmd: return -EINVAL; } +/** + * q6asm_adjust_session_clock - + * command to adjust session clock + * + * @ac: Audio client handle + * @adjust_time_lsw: lower 32bits + * @adjust_time_msw: upper 32bits + * + * Returns 0 on success or error on failure + */ int q6asm_adjust_session_clock(struct audio_client *ac, uint32_t adjust_time_lsw, uint32_t adjust_time_msw) @@ -8917,6 +9805,7 @@ int q6asm_adjust_session_clock(struct audio_client *ac, fail_cmd: return rc; } +EXPORT_SYMBOL(q6asm_adjust_session_clock); /* * q6asm_get_path_delay() - get the path delay for an audio session @@ -8966,6 +9855,7 @@ int q6asm_get_path_delay(struct audio_client *ac) return 0; } +EXPORT_SYMBOL(q6asm_get_path_delay); int q6asm_get_apr_service_id(int session_id) { @@ -9062,6 +9952,14 @@ done: return app_type; } +/** + * q6asm_send_cal - + * command to send ASM calibration + * + * @ac: Audio client handle + * + * Returns 0 on success or error on failure + */ int q6asm_send_cal(struct audio_client *ac) { struct cal_block_data *cal_block = NULL; @@ -9176,6 +10074,7 @@ unlock: done: return rc; } +EXPORT_SYMBOL(q6asm_send_cal); static int get_cal_type_index(int32_t cal_type) { @@ -9350,7 +10249,7 @@ static int q6asm_is_valid_session(struct apr_client_data *data, void *priv) return 0; } -static int __init q6asm_init(void) +int __init q6asm_init(void) { int lcnt, ret; @@ -9387,10 +10286,7 @@ static int __init q6asm_init(void) return 0; } -static void __exit q6asm_exit(void) +void __exit q6asm_exit(void) { q6asm_delete_cal_data(); } - -device_initcall(q6asm_init); -__exitcall(q6asm_exit); diff --git a/dsp/q6audio-v2.c b/dsp/q6audio-v2.c index 6e31c366c7..55e7244741 100644 --- a/dsp/q6audio-v2.c +++ b/dsp/q6audio-v2.c @@ -650,6 +650,14 @@ int q6audio_is_digital_pcm_interface(u16 port_id) return ret; } +/** + * q6audio_validate_port - + * validates port id + * + * @port_id: port id to validate + * + * Returns 0 on success or error on invalid port + */ int q6audio_validate_port(u16 port_id) { int ret; @@ -805,3 +813,4 @@ int q6audio_validate_port(u16 port_id) return ret; } +EXPORT_SYMBOL(q6audio_validate_port); diff --git a/dsp/q6core.c b/dsp/q6core.c index 9f1d9e411e..b80786209b 100644 --- a/dsp/q6core.c +++ b/dsp/q6core.c @@ -454,6 +454,15 @@ done: } EXPORT_SYMBOL(q6core_get_fwk_version_size); +/** + * core_set_license - + * command to set license for module + * + * @key: license key hash + * @module_id: DSP Module ID + * + * Returns 0 on success or error on failure + */ int32_t core_set_license(uint32_t key, uint32_t module_id) { struct avcs_cmd_set_license *cmd_setl = NULL; @@ -528,7 +537,16 @@ cmd_unlock: return rc; } +EXPORT_SYMBOL(core_set_license); +/** + * core_get_license_status - + * command to retrieve license status for module + * + * @module_id: DSP Module ID + * + * Returns 0 on success or error on failure + */ int32_t core_get_license_status(uint32_t module_id) { struct avcs_cmd_get_license_validation_result get_lvr_cmd; @@ -586,7 +604,16 @@ fail_cmd: __func__, ret, module_id); return ret; } +EXPORT_SYMBOL(core_get_license_status); +/** + * core_set_dolby_manufacturer_id - + * command to set dolby manufacturer id + * + * @manufacturer_id: Dolby manufacturer id + * + * Returns 0 on success or error on failure + */ uint32_t core_set_dolby_manufacturer_id(int manufacturer_id) { struct adsp_dolby_manufacturer_id payload; @@ -617,6 +644,7 @@ uint32_t core_set_dolby_manufacturer_id(int manufacturer_id) mutex_unlock(&(q6core_lcl.cmd_lock)); return rc; } +EXPORT_SYMBOL(core_set_dolby_manufacturer_id); /** * q6core_is_adsp_ready - check adsp ready status @@ -1062,7 +1090,7 @@ err: return ret; } -static int __init core_init(void) +int __init core_init(void) { memset(&q6core_lcl, 0, sizeof(struct q6core_str)); init_waitqueue_head(&q6core_lcl.bus_bw_req_wait); @@ -1076,14 +1104,12 @@ static int __init core_init(void) return 0; } -module_init(core_init); -static void __exit core_exit(void) +void __exit core_exit(void) { mutex_destroy(&q6core_lcl.cmd_lock); mutex_destroy(&q6core_lcl.ver_lock); q6core_delete_cal_data(); } -module_exit(core_exit); MODULE_DESCRIPTION("ADSP core driver"); MODULE_LICENSE("GPL v2"); diff --git a/dsp/q6lsm.c b/dsp/q6lsm.c index 848f2cd938..e34bff9732 100644 --- a/dsp/q6lsm.c +++ b/dsp/q6lsm.c @@ -293,6 +293,15 @@ static int q6lsm_mmap_apr_dereg(void) return 0; } +/** + * q6lsm_client_alloc - + * Allocate session for LSM client + * + * @cb: callback fn + * @priv: private data + * + * Returns LSM client handle on success or NULL on failure + */ struct lsm_client *q6lsm_client_alloc(lsm_app_cb cb, void *priv) { struct lsm_client *client; @@ -341,7 +350,15 @@ fail: q6lsm_client_free(client); return NULL; } +EXPORT_SYMBOL(q6lsm_client_alloc); +/** + * q6lsm_client_free - + * Performs LSM client free + * + * @client: LSM client handle + * + */ void q6lsm_client_free(struct lsm_client *client) { if (!client) @@ -358,6 +375,7 @@ void q6lsm_client_free(struct lsm_client *client) kfree(client); client = NULL; } +EXPORT_SYMBOL(q6lsm_client_free); /* * q6lsm_apr_send_pkt : If wait == true, hold mutex to prevent from preempting @@ -593,6 +611,15 @@ 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, struct lsm_params_info *p_info, 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; *offset = sizeof(*param); } +EXPORT_SYMBOL(q6lsm_sm_set_param_data); +/** + * q6lsm_open - + * command to open LSM session + * + * @client: LSM client handle + * @app_id: App ID for LSM + * + * Returns 0 on success or error on failure + */ int q6lsm_open(struct lsm_client *client, uint16_t app_id) { int rc = 0; @@ -654,6 +691,7 @@ done: pr_debug("%s: leave %d\n", __func__, rc); return rc; } +EXPORT_SYMBOL(q6lsm_open); static int q6lsm_send_confidence_levels( struct lsm_client *client, @@ -760,16 +798,30 @@ static int q6lsm_send_param_opmode(struct lsm_client *client, return rc; } +/** + * set_lsm_port - + * Update LSM AFE port + * + */ void set_lsm_port(int lsm_port) { lsm_afe_port = lsm_port; } +EXPORT_SYMBOL(set_lsm_port); int get_lsm_port(void) { return lsm_afe_port; } +/** + * q6lsm_set_port_connected - + * command to set LSM port connected + * + * @client: LSM client handle + * + * Returns 0 on success or error on failure + */ int q6lsm_set_port_connected(struct lsm_client *client) { int rc; @@ -819,6 +871,8 @@ int q6lsm_set_port_connected(struct lsm_client *client) return rc; } +EXPORT_SYMBOL(q6lsm_set_port_connected); + static int q6lsm_send_param_polling_enable(struct lsm_client *client, bool poll_en, struct lsm_module_param_ids *poll_enable_ids, @@ -859,6 +913,15 @@ static int q6lsm_send_param_polling_enable(struct lsm_client *client, return rc; } +/** + * q6lsm_set_fwk_mode_cfg - + * command to set LSM fwk mode cfg + * + * @client: LSM client handle + * @event_mode: mode for fwk cfg + * + * Returns 0 on success or error on failure + */ int q6lsm_set_fwk_mode_cfg(struct lsm_client *client, uint32_t event_mode) { @@ -906,6 +969,7 @@ int q6lsm_set_fwk_mode_cfg(struct lsm_client *client, __func__, msg_hdr->opcode, rc); return rc; } +EXPORT_SYMBOL(q6lsm_set_fwk_mode_cfg); static int q6lsm_arrange_mch_map(struct lsm_param_media_fmt *media_fmt, int channel_count) @@ -941,6 +1005,14 @@ static int q6lsm_arrange_mch_map(struct lsm_param_media_fmt *media_fmt, return rc; } +/** + * q6lsm_set_media_fmt_params - + * command to set LSM media fmt params + * + * @client: LSM client handle + * + * Returns 0 on success or error on failure + */ int q6lsm_set_media_fmt_params(struct lsm_client *client) { int rc = 0; @@ -998,7 +1070,18 @@ int q6lsm_set_media_fmt_params(struct lsm_client *client) err_ret: return rc; } +EXPORT_SYMBOL(q6lsm_set_media_fmt_params); +/** + * q6lsm_set_data - + * Command to set LSM data + * + * @client: LSM client handle + * @mode: LSM detection mode value + * @detectfailure: flag for detect failure + * + * Returns 0 on success or error on failure + */ int q6lsm_set_data(struct lsm_client *client, enum lsm_detection_mode mode, bool detectfailure) @@ -1061,7 +1144,16 @@ int q6lsm_set_data(struct lsm_client *client, err_ret: return rc; } +EXPORT_SYMBOL(q6lsm_set_data); +/** + * q6lsm_register_sound_model - + * Register LSM snd model + * + * @client: LSM client handle + * + * Returns 0 on success or error on failure + */ int q6lsm_register_sound_model(struct lsm_client *client, enum lsm_detection_mode mode, bool detectfailure) @@ -1098,7 +1190,16 @@ int q6lsm_register_sound_model(struct lsm_client *client, return rc; } +EXPORT_SYMBOL(q6lsm_register_sound_model); +/** + * q6lsm_deregister_sound_model - + * De-register LSM snd model + * + * @client: LSM client handle + * + * Returns 0 on success or error on failure + */ int q6lsm_deregister_sound_model(struct lsm_client *client) { int rc; @@ -1134,6 +1235,7 @@ int q6lsm_deregister_sound_model(struct lsm_client *client) return rc; } +EXPORT_SYMBOL(q6lsm_deregister_sound_model); static void q6lsm_add_mmaphdr(struct lsm_client *client, struct apr_hdr *hdr, u32 pkt_size, u32 cmd_flg, u32 token) @@ -1285,7 +1387,14 @@ done: return rc; } - +/** + * q6lsm_snd_model_buf_free - + * Free memory for LSM snd model + * + * @client: LSM client handle + * + * Returns 0 on success or error on failure + */ int q6lsm_snd_model_buf_free(struct lsm_client *client) { int rc; @@ -1316,6 +1425,7 @@ int q6lsm_snd_model_buf_free(struct lsm_client *client) mutex_unlock(&client->cmd_lock); return rc; } +EXPORT_SYMBOL(q6lsm_snd_model_buf_free); static struct lsm_client *q6lsm_get_lsm_client(int session_id) { @@ -1420,6 +1530,16 @@ static int q6lsm_mmapcallback(struct apr_client_data *data, void *priv) return 0; } +/** + * q6lsm_snd_model_buf_alloc - + * Allocate memory for LSM snd model + * + * @client: LSM client handle + * @len: size of sound model + * @allocate_module_data: flag to allocate for set_param payload + * + * Returns 0 on success or error on failure + */ int q6lsm_snd_model_buf_alloc(struct lsm_client *client, size_t len, bool allocate_module_data) { @@ -1523,6 +1643,7 @@ exit: q6lsm_snd_model_buf_free(client); return rc; } +EXPORT_SYMBOL(q6lsm_snd_model_buf_alloc); static int q6lsm_cmd(struct lsm_client *client, int opcode, bool wait) { @@ -1613,6 +1734,17 @@ static int q6lsm_send_param_gain( return rc; } +/** + * q6lsm_set_one_param - + * command for LSM set params + * + * @client: LSM client handle + * p_info: Params info + * data: payload based on param type + * param_type: LSM param type + * + * Returns 0 on success or error on failure + */ int q6lsm_set_one_param(struct lsm_client *client, struct lsm_params_info *p_info, void *data, uint32_t param_type) @@ -1798,23 +1930,60 @@ int q6lsm_set_one_param(struct lsm_client *client, return rc; } +EXPORT_SYMBOL(q6lsm_set_one_param); +/** + * q6lsm_start - + * command for LSM start + * + * @client: LSM client handle + * + * Returns 0 on success or error on failure + */ int q6lsm_start(struct lsm_client *client, bool wait) { return q6lsm_cmd(client, LSM_SESSION_CMD_START, wait); } +EXPORT_SYMBOL(q6lsm_start); +/** + * q6lsm_stop - + * command for LSM stop + * + * @client: LSM client handle + * + * Returns 0 on success or error on failure + */ int q6lsm_stop(struct lsm_client *client, bool wait) { return q6lsm_cmd(client, LSM_SESSION_CMD_STOP, wait); } +EXPORT_SYMBOL(q6lsm_stop); +/** + * q6lsm_close - + * command for LSM close + * + * @client: LSM client handle + * + * Returns 0 on success or error on failure + */ int q6lsm_close(struct lsm_client *client) { return q6lsm_cmd(client, LSM_SESSION_CMD_CLOSE_TX, true); } +EXPORT_SYMBOL(q6lsm_close); +/** + * q6lsm_lab_control - + * command to set LSM LAB control params + * + * @client: LSM client handle + * @enable: bool flag to enable or disable LAB on DSP + * + * Returns 0 on success or error on failure + */ int q6lsm_lab_control(struct lsm_client *client, u32 enable) { int rc = 0; @@ -1876,7 +2045,16 @@ int q6lsm_lab_control(struct lsm_client *client, u32 enable) exit: return rc; } +EXPORT_SYMBOL(q6lsm_lab_control); +/** + * q6lsm_stop_lab - + * command to stop LSM LAB + * + * @client: LSM client handle + * + * Returns 0 on success or error on failure + */ int q6lsm_stop_lab(struct lsm_client *client) { int rc = 0; @@ -1890,7 +2068,17 @@ int q6lsm_stop_lab(struct lsm_client *client) pr_err("%s: Lab stop failed %d\n", __func__, rc); return rc; } +EXPORT_SYMBOL(q6lsm_stop_lab); +/** + * q6lsm_read - + * command for LSM read + * + * @client: LSM client handle + * @lsm_cmd_read: LSM read command + * + * Returns 0 on success or error on failure + */ int q6lsm_read(struct lsm_client *client, struct lsm_cmd_read *read) { int rc = 0; @@ -1910,7 +2098,17 @@ int q6lsm_read(struct lsm_client *client, struct lsm_cmd_read *read) pr_err("%s: read buffer call failed rc %d\n", __func__, rc); return rc; } +EXPORT_SYMBOL(q6lsm_read); +/** + * q6lsm_lab_buffer_alloc - + * Lab buffer allocation or de-alloc + * + * @client: LSM client handle + * @alloc: Allocate or free ion memory + * + * Returns 0 on success or error on failure + */ int q6lsm_lab_buffer_alloc(struct lsm_client *client, bool alloc) { int ret = 0, i = 0; @@ -2000,6 +2198,7 @@ int q6lsm_lab_buffer_alloc(struct lsm_client *client, bool alloc) } return ret; } +EXPORT_SYMBOL(q6lsm_lab_buffer_alloc); static int get_cal_type_index(int32_t cal_type) { @@ -2155,7 +2354,7 @@ err: return ret; } -static int __init q6lsm_init(void) +int __init q6lsm_init(void) { int i = 0; @@ -2177,10 +2376,7 @@ static int __init q6lsm_init(void) return 0; } -static void __exit q6lsm_exit(void) +void __exit q6lsm_exit(void) { lsm_delete_cal_data(); } - -device_initcall(q6lsm_init); -__exitcall(q6lsm_exit); diff --git a/dsp/q6usm.c b/dsp/q6usm.c index 5b822ae993..1ed74a9c2b 100644 --- a/dsp/q6usm.c +++ b/dsp/q6usm.c @@ -1455,12 +1455,10 @@ int q6usm_get_us_stream_param(int dir, struct us_client *usc, return rc; } -static int __init q6usm_init(void) +int __init q6usm_init(void) { pr_debug("%s\n", __func__); init_waitqueue_head(&this_mmap.cmd_wait); memset(session, 0, sizeof(session)); return 0; } - -device_initcall(q6usm_init); diff --git a/dsp/q6usm.h b/dsp/q6usm.h index 2e9d7c9bdb..fa2cd627c9 100644 --- a/dsp/q6usm.h +++ b/dsp/q6usm.h @@ -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); int q6usm_get_us_stream_param(int dir, struct us_client *usc, uint32_t module_id, uint32_t param_id, uint32_t buf_size); +int q6usm_init(void); #endif /* __Q6_USM_H__ */ diff --git a/dsp/q6voice.c b/dsp/q6voice.c index 983e0a2388..985e959ab8 100644 --- a/dsp/q6voice.c +++ b/dsp/q6voice.c @@ -292,6 +292,14 @@ char *voc_get_session_name(u32 session_id) return session_name; } +/** + * voc_get_session_id - + * Get session ID of given voice session name + * + * @name: voice session name + * + * Returns session id for valid session or 0 if invalid. + */ uint32_t voc_get_session_id(char *name) { u32 session_id = 0; @@ -326,6 +334,7 @@ uint32_t voc_get_session_id(char *name) return session_id; } +EXPORT_SYMBOL(voc_get_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; } +/** + * voc_disable_dtmf_det_on_active_sessions - + * command to disable DTMF detection for voice sessions + * + */ void voc_disable_dtmf_det_on_active_sessions(void) { struct voice_data *v = NULL; @@ -1818,7 +1832,17 @@ 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) { 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; } +EXPORT_SYMBOL(voc_enable_dtmf_rx_detection); +/** + * voc_set_destroy_cvd_flag - + * set flag for destroy CVD session + * + * @is_destroy_cvd: bool value used to indicate + * destroy CVD session or not. + * + */ void voc_set_destroy_cvd_flag(bool is_destroy_cvd) { pr_debug("%s: %d\n", __func__, is_destroy_cvd); common.is_destroy_cvd = is_destroy_cvd; } +EXPORT_SYMBOL(voc_set_destroy_cvd_flag); +/** + * voc_alloc_cal_shared_memory - + * Alloc mem map table for calibration + * + * Returns 0 on success or error on failure + */ int voc_alloc_cal_shared_memory(void) { int rc = 0; @@ -1867,7 +1907,14 @@ int voc_alloc_cal_shared_memory(void) return rc; } +EXPORT_SYMBOL(voc_alloc_cal_shared_memory); +/** + * voc_alloc_voip_shared_memory - + * Alloc mem map table for OOB + * + * Returns 0 on success or error on failure + */ int voc_alloc_voip_shared_memory(void) { int rc = 0; @@ -1890,6 +1937,7 @@ int voc_alloc_voip_shared_memory(void) return rc; } +EXPORT_SYMBOL(voc_alloc_voip_shared_memory); static int is_cal_memory_allocated(void) { @@ -2218,6 +2266,14 @@ fail: return ret; } +/** + * voc_update_amr_vocoder_rate - + * command to update AMR rate for voice session + * + * @session_id: voice session ID to send this command + * + * Returns 0 on success or error on failure + */ int voc_update_amr_vocoder_rate(uint32_t session_id) { int ret = 0; @@ -2242,6 +2298,7 @@ int voc_update_amr_vocoder_rate(uint32_t session_id) done: return ret; } +EXPORT_SYMBOL(voc_update_amr_vocoder_rate); static int voice_send_start_voice_cmd(struct voice_data *v) { @@ -5640,6 +5697,16 @@ fail: return ret; } +/** + * voc_start_record - + * command to set record for voice session + * + * @port_id: Pseudo Port ID for record data + * @set: Enable or Disable for record start/stop + * @session_id: voice session ID to send this command + * + * Returns 0 on success or error on failure + */ int voc_start_record(uint32_t port_id, uint32_t set, uint32_t session_id) { int ret = 0; @@ -5774,6 +5841,7 @@ int voc_start_record(uint32_t port_id, uint32_t set, uint32_t session_id) return ret; } +EXPORT_SYMBOL(voc_start_record); static int voice_cvs_start_playback(struct voice_data *v) { @@ -5962,6 +6030,15 @@ done: return ret; } +/** + * voc_start_playback - + * command to set playback for voice session + * + * @set: Enable or Disable for playback start/stop + * @port_id: Pseudo Port ID for playback data + * + * Returns 0 on success or error on failure + */ int voc_start_playback(uint32_t set, uint16_t port_id) { struct voice_data *v = NULL; @@ -6004,7 +6081,17 @@ int voc_start_playback(uint32_t set, uint16_t port_id) return ret; } +EXPORT_SYMBOL(voc_start_playback); +/** + * voc_disable_topology - + * disable topology for voice session + * + * @session_id: voice session ID to send this command + * @disable: disable value + * + * Returns 0 on success or error on failure + */ int voc_disable_topology(uint32_t session_id, uint32_t disable) { struct voice_data *v = voice_get_session(session_id); @@ -6024,6 +6111,7 @@ int voc_disable_topology(uint32_t session_id, uint32_t disable) return ret; } +EXPORT_SYMBOL(voc_disable_topology); static int voice_set_packet_exchange_mode_and_config(uint32_t session_id, uint32_t mode) @@ -6057,6 +6145,17 @@ fail: return -EINVAL; } +/** + * voc_set_tx_mute - + * command to send TX mute for voice session + * + * @session_id: voice session ID to send this command + * @dir: RX or TX + * @mute: TX mute value + * @ramp_duration: Ramp duration in ms + * + * Returns 0 on success or error on failure + */ int voc_set_tx_mute(uint32_t session_id, uint32_t dir, uint32_t mute, uint32_t ramp_duration) { @@ -6089,7 +6188,19 @@ int voc_set_tx_mute(uint32_t session_id, uint32_t dir, uint32_t mute, return ret; } +EXPORT_SYMBOL(voc_set_tx_mute); +/** + * voc_set_device_mute - + * command to set device mute for voice session + * + * @session_id: voice session ID to send this command + * @dir: RX or TX + * @mute: mute value + * @ramp_duration: Ramp duration in ms + * + * Returns 0 on success or error on failure + */ int voc_set_device_mute(uint32_t session_id, uint32_t dir, uint32_t mute, uint32_t ramp_duration) { @@ -6130,6 +6241,7 @@ int voc_set_device_mute(uint32_t session_id, uint32_t dir, uint32_t mute, return ret; } +EXPORT_SYMBOL(voc_set_device_mute); 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; } +/** + * voc_set_tty_mode - + * Update tty mode for voice session + * + * @session_id: voice session ID + * @tty_mode: TTY mode value + * + * Returns 0 on success or error on failure + */ int voc_set_tty_mode(uint32_t session_id, uint8_t tty_mode) { struct voice_data *v = voice_get_session(session_id); @@ -6170,7 +6291,16 @@ int voc_set_tty_mode(uint32_t session_id, uint8_t tty_mode) return ret; } +EXPORT_SYMBOL(voc_set_tty_mode); +/** + * voc_get_tty_mode - + * Retrieve tty mode for voice session + * + * @session_id: voice session ID + * + * Returns 0 on success or error on failure + */ uint8_t voc_get_tty_mode(uint32_t session_id) { struct voice_data *v = voice_get_session(session_id); @@ -6190,7 +6320,18 @@ uint8_t voc_get_tty_mode(uint32_t session_id) return ret; } +EXPORT_SYMBOL(voc_get_tty_mode); +/** + * voc_set_pp_enable - + * Command to set PP for voice module + * + * @session_id: voice session ID to send this command + * @module_id: voice module id + * @enable: enable/disable flag + * + * Returns 0 on success or error on failure + */ int voc_set_pp_enable(uint32_t session_id, uint32_t module_id, uint32_t enable) { struct voice_data *v = NULL; @@ -6225,7 +6366,17 @@ int voc_set_pp_enable(uint32_t session_id, uint32_t module_id, uint32_t enable) return ret; } +EXPORT_SYMBOL(voc_set_pp_enable); +/** + * voc_set_hd_enable - + * Command to set HD for voice session + * + * @session_id: voice session ID to send this command + * @enable: enable/disable flag + * + * Returns 0 on success or error on failure + */ int voc_set_hd_enable(uint32_t session_id, uint32_t enable) { struct voice_data *v = NULL; @@ -6252,7 +6403,17 @@ int voc_set_hd_enable(uint32_t session_id, uint32_t enable) return ret; } +EXPORT_SYMBOL(voc_set_hd_enable); +/** + * voc_set_afe_sidetone - + * Command to set sidetone at AFE + * + * @session_id: voice session ID to send this command + * @sidetone_enable: enable/disable flag for sidetone + * + * Returns 0 on success or error on failure + */ int voc_set_afe_sidetone(uint32_t session_id, bool sidetone_enable) { struct voice_data *v = NULL; @@ -6286,7 +6447,14 @@ int voc_set_afe_sidetone(uint32_t session_id, bool sidetone_enable) } return ret; } +EXPORT_SYMBOL(voc_set_afe_sidetone); +/** + * voc_get_afe_sidetone - + * Retrieve sidetone status at AFE + * + * Returns sidetone enable status + */ bool voc_get_afe_sidetone(void) { bool ret; @@ -6294,6 +6462,7 @@ bool voc_get_afe_sidetone(void) ret = common.sidetone_enable; return ret; } +EXPORT_SYMBOL(voc_get_afe_sidetone); int voc_get_pp_enable(uint32_t session_id, uint32_t module_id) { @@ -6314,6 +6483,17 @@ int voc_get_pp_enable(uint32_t session_id, uint32_t module_id) return ret; } +/** + * voc_set_rx_vol_step - + * command to send voice RX volume in step value + * + * @session_id: voice session ID + * @dir: direction RX or TX + * @vol_step: Volume step value + * @ramp_duration: Ramp duration in ms + * + * Returns 0 on success or -EINVAL on failure + */ int voc_set_rx_vol_step(uint32_t session_id, uint32_t dir, uint32_t vol_step, uint32_t ramp_duration) { @@ -6344,7 +6524,18 @@ int voc_set_rx_vol_step(uint32_t session_id, uint32_t dir, uint32_t vol_step, return ret; } +EXPORT_SYMBOL(voc_set_rx_vol_step); +/** + * voc_set_device_config - + * Set voice path config for RX or TX + * + * @session_id: voice session ID + * @path_dir: direction RX or TX + * @finfo: format config info + * + * Returns 0 on success or -EINVAL on failure + */ int voc_set_device_config(uint32_t session_id, uint8_t path_dir, struct media_format_info *finfo) { @@ -6387,7 +6578,15 @@ int voc_set_device_config(uint32_t session_id, uint8_t path_dir, return 0; } +EXPORT_SYMBOL(voc_set_device_config); +/** + * voc_set_ext_ec_ref_media_fmt_info - + * Update voice EC media format info + * + * @finfo: media format info + * + */ int voc_set_ext_ec_ref_media_fmt_info(struct media_format_info *finfo) { mutex_lock(&common.common_lock); @@ -6404,7 +6603,18 @@ int voc_set_ext_ec_ref_media_fmt_info(struct media_format_info *finfo) mutex_unlock(&common.common_lock); return 0; } +EXPORT_SYMBOL(voc_set_ext_ec_ref_media_fmt_info); +/** + * voc_set_route_flag - + * Set voice route state for RX or TX + * + * @session_id: voice session ID + * @path_dir: direction RX or TX + * @set: Value of route state to set + * + * Returns 0 on success or -EINVAL on failure + */ int voc_set_route_flag(uint32_t session_id, uint8_t path_dir, uint8_t set) { struct voice_data *v = voice_get_session(session_id); @@ -6428,7 +6638,17 @@ int voc_set_route_flag(uint32_t session_id, uint8_t path_dir, uint8_t set) return 0; } +EXPORT_SYMBOL(voc_set_route_flag); +/** + * voc_get_route_flag - + * Retrieve voice route state for RX or TX + * + * @session_id: voice session ID + * @path_dir: direction RX or TX + * + * Returns route state on success or 0 on failure + */ uint8_t voc_get_route_flag(uint32_t session_id, uint8_t path_dir) { struct voice_data *v = voice_get_session(session_id); @@ -6451,7 +6671,16 @@ uint8_t voc_get_route_flag(uint32_t session_id, uint8_t path_dir) return ret; } +EXPORT_SYMBOL(voc_get_route_flag); +/** + * voc_end_voice_call - + * command to end voice call + * + * @session_id: voice session ID to send this command + * + * Returns 0 on success or error on failure + */ int voc_end_voice_call(uint32_t session_id) { struct voice_data *v = voice_get_session(session_id); @@ -6488,7 +6717,16 @@ int voc_end_voice_call(uint32_t session_id) mutex_unlock(&v->lock); return ret; } +EXPORT_SYMBOL(voc_end_voice_call); +/** + * voc_standby_voice_call - + * command to standy voice call + * + * @session_id: voice session ID to send this command + * + * Returns 0 on success or error on failure + */ int voc_standby_voice_call(uint32_t session_id) { struct voice_data *v = voice_get_session(session_id); @@ -6537,7 +6775,16 @@ int voc_standby_voice_call(uint32_t session_id) fail: return ret; } +EXPORT_SYMBOL(voc_standby_voice_call); +/** + * voc_disable_device - + * command to pause call and disable voice path + * + * @session_id: voice session ID to send this command + * + * Returns 0 on success or error on failure + */ int voc_disable_device(uint32_t session_id) { struct voice_data *v = voice_get_session(session_id); @@ -6574,7 +6821,16 @@ done: return ret; } +EXPORT_SYMBOL(voc_disable_device); +/** + * voc_enable_device - + * command to enable voice path and start call + * + * @session_id: voice session ID to send this command + * + * Returns 0 on success or error on failure + */ int voc_enable_device(uint32_t session_id) { struct voice_data *v = voice_get_session(session_id); @@ -6662,7 +6918,17 @@ done: return ret; } +EXPORT_SYMBOL(voc_enable_device); +/** + * voc_set_lch - + * command to set hold/unhold call state + * + * @session_id: voice session ID to send this command + * @lch_mode: LCH mode to set + * + * Returns 0 on success or error on failure + */ int voc_set_lch(uint32_t session_id, enum voice_lch_mode lch_mode) { struct voice_data *v = voice_get_session(session_id); @@ -6696,7 +6962,16 @@ int voc_set_lch(uint32_t session_id, enum voice_lch_mode lch_mode) done: return ret; } +EXPORT_SYMBOL(voc_set_lch); +/** + * voc_resume_voice_call - + * command to resume voice call + * + * @session_id: voice session ID to send this command + * + * Returns 0 on success or error on failure + */ int voc_resume_voice_call(uint32_t session_id) { struct voice_data *v = voice_get_session(session_id); @@ -6712,7 +6987,16 @@ int voc_resume_voice_call(uint32_t session_id) fail: return -EINVAL; } +EXPORT_SYMBOL(voc_resume_voice_call); +/** + * voc_start_voice_call - + * command to start voice call + * + * @session_id: voice session ID to send this command + * + * Returns 0 on success or error on failure + */ int voc_start_voice_call(uint32_t session_id) { struct voice_data *v = voice_get_session(session_id); @@ -6819,7 +7103,14 @@ fail: mutex_unlock(&v->lock); return ret; } +EXPORT_SYMBOL(voc_start_voice_call); +/** + * voc_set_ext_ec_ref_port_id - + * Set EC ref port id + * + * Returns 0 on success or -EINVAL on failure + */ int voc_set_ext_ec_ref_port_id(uint16_t port_id, bool state) { int ret = 0; @@ -6841,7 +7132,15 @@ exit: mutex_unlock(&common.common_lock); return ret; } +EXPORT_SYMBOL(voc_set_ext_ec_ref_port_id); +/** + * voc_get_ext_ec_ref_port_id - + * Retrieve EC ref port id + * + * Returns EC Ref port id if present + * otherwise AFE_PORT_INVALID + */ int voc_get_ext_ec_ref_port_id(void) { if (common.ec_ref_ext) @@ -6849,7 +7148,18 @@ int voc_get_ext_ec_ref_port_id(void) else return AFE_PORT_INVALID; } +EXPORT_SYMBOL(voc_get_ext_ec_ref_port_id); +/** + * voc_register_mvs_cb - + * Update callback info for mvs + * + * @ul_cb: Uplink callback fn + * @dl_cb: downlink callback fn + * ssr_cb: SSR callback fn + * @private_data: private data of mvs + * + */ void voc_register_mvs_cb(ul_cb_fn ul_cb, dl_cb_fn dl_cb, voip_ssr_cb ssr_cb, @@ -6860,14 +7170,28 @@ void voc_register_mvs_cb(ul_cb_fn ul_cb, common.mvs_info.ssr_cb = ssr_cb; common.mvs_info.private_data = private_data; } +EXPORT_SYMBOL(voc_register_mvs_cb); +/** + * voc_register_dtmf_rx_detection_cb - + * Update callback info for dtmf + * + * @dtmf_rx_ul_cb: DTMF uplink RX callback fn + * @private_data: private data of dtmf info + * + */ void voc_register_dtmf_rx_detection_cb(dtmf_rx_det_cb_fn dtmf_rx_ul_cb, void *private_data) { common.dtmf_info.dtmf_rx_ul_cb = dtmf_rx_ul_cb; common.dtmf_info.private_data = private_data; } +EXPORT_SYMBOL(voc_register_dtmf_rx_detection_cb); +/** + * voc_config_vocoder - + * Update config for mvs params. + */ void voc_config_vocoder(uint32_t media_type, uint32_t rate, uint32_t network_type, @@ -6882,6 +7206,7 @@ void voc_config_vocoder(uint32_t media_type, common.mvs_info.evrc_min_rate = evrc_min_rate; common.mvs_info.evrc_max_rate = evrc_max_rate; } +EXPORT_SYMBOL(voc_config_vocoder); static int32_t qdsp_mvm_callback(struct apr_client_data *data, void *priv) { @@ -7753,6 +8078,14 @@ done: return rc; } +/** + * voc_send_cvp_start_vocpcm - + * command to start voice hpcm + * + * @session_id: voice session ID to send this command + * + * Returns 0 on success or error on failure + */ int voc_send_cvp_start_vocpcm(uint32_t session_id, struct vss_ivpcm_tap_point *vpcm_tp, uint32_t no_of_tp) @@ -7831,7 +8164,16 @@ int voc_send_cvp_start_vocpcm(uint32_t session_id, done: return ret; } +EXPORT_SYMBOL(voc_send_cvp_start_vocpcm); +/** + * voc_send_cvp_stop_vocpcm - + * command to stop voice hpcm + * + * @session_id: voice session ID to send this command + * + * Returns 0 on success or error on failure + */ int voc_send_cvp_stop_vocpcm(uint32_t session_id) { struct cvp_command vpcm_stop_cmd; @@ -7892,7 +8234,19 @@ int voc_send_cvp_stop_vocpcm(uint32_t session_id) done: return ret; } +EXPORT_SYMBOL(voc_send_cvp_stop_vocpcm); +/** + * voc_send_cvp_map_vocpcm_memory - + * command to map memory for voice hpcm + * + * @session_id: voice session ID to send this command + * @tp_mem_table: tap point memory table of hpcm + * paddr: Physical address of hpcm memory mapped area. + * bufsize: Buffer size of memory mapped area + * + * Returns 0 on success or error on failure + */ int voc_send_cvp_map_vocpcm_memory(uint32_t session_id, struct mem_map_table *tp_mem_table, phys_addr_t paddr, uint32_t bufsize) @@ -7902,7 +8256,16 @@ int voc_send_cvp_map_vocpcm_memory(uint32_t session_id, (dma_addr_t) paddr, bufsize, VOC_VOICE_HOST_PCM_MAP_TOKEN); } +EXPORT_SYMBOL(voc_send_cvp_map_vocpcm_memory); +/** + * voc_send_cvp_unmap_vocpcm_memory - + * command to unmap memory for voice hpcm + * + * @session_id: voice session ID to send this command + * + * Returns 0 on success or error on failure + */ int voc_send_cvp_unmap_vocpcm_memory(uint32_t session_id) { int ret = 0; @@ -7916,7 +8279,16 @@ int voc_send_cvp_unmap_vocpcm_memory(uint32_t session_id) return ret; } +EXPORT_SYMBOL(voc_send_cvp_unmap_vocpcm_memory); +/** + * voc_send_cvp_vocpcm_push_buf_evt - Send buf event command + * + * @session_id: voice session ID to send this command + * @push_buff_evt: pointer with buffer event details + * + * Returns 0 on success or error on failure + */ int voc_send_cvp_vocpcm_push_buf_evt(uint32_t session_id, struct vss_ivpcm_evt_push_buffer_v2_t *push_buff_evt) { @@ -7979,20 +8351,41 @@ int voc_send_cvp_vocpcm_push_buf_evt(uint32_t session_id, done: return ret; } +EXPORT_SYMBOL(voc_send_cvp_vocpcm_push_buf_evt); +/** + * voc_register_hpcm_evt_cb - Updates hostpcm info. + * + * @hostpcm_cb: callback function for hostpcm event + * @private_data: private data for hostpcm + * + */ void voc_register_hpcm_evt_cb(hostpcm_cb_fn hostpcm_cb, void *private_data) { common.hostpcm_info.hostpcm_evt_cb = hostpcm_cb; common.hostpcm_info.private_data = private_data; } +EXPORT_SYMBOL(voc_register_hpcm_evt_cb); +/** + * voc_deregister_hpcm_evt_cb - resets hostpcm info. + * + */ void voc_deregister_hpcm_evt_cb(void) { common.hostpcm_info.hostpcm_evt_cb = NULL; common.hostpcm_info.private_data = NULL; } +EXPORT_SYMBOL(voc_deregister_hpcm_evt_cb); +/** + * voc_get_cvd_version - retrieve CVD version. + * + * @cvd_version: pointer to be updated with CVD version info. + * + * Returns 0 on success or error on failure + */ int voc_get_cvd_version(char *cvd_version) { int ret = 0; @@ -8041,6 +8434,7 @@ done: return ret; } +EXPORT_SYMBOL(voc_get_cvd_version); static int voice_alloc_cal_mem_map_table(void) { @@ -8598,6 +8992,13 @@ done: return ret; } +/** + * voc_set_sound_focus - sends sound focus data. + * + * @soundFocusData: sound focus data. + * + * Returns 0 on success or error on failure + */ int voc_set_sound_focus(struct sound_focus_param soundFocusData) { struct voice_data *v = NULL; @@ -8629,6 +9030,7 @@ int voc_set_sound_focus(struct sound_focus_param soundFocusData) return ret; } +EXPORT_SYMBOL(voc_set_sound_focus); static int voice_send_get_sound_focus_cmd(struct voice_data *v, struct sound_focus_param *soundFocusData) @@ -8727,6 +9129,13 @@ done: return ret; } +/** + * voc_get_sound_focus - retrieves sound focus data. + * + * @soundFocusData: pointer to be updated with sound focus data. + * + * Returns 0 on success or error on failure + */ int voc_get_sound_focus(struct sound_focus_param *soundFocusData) { struct voice_data *v = NULL; @@ -8758,6 +9167,7 @@ int voc_get_sound_focus(struct sound_focus_param *soundFocusData) return ret; } +EXPORT_SYMBOL(voc_get_sound_focus); static int is_source_tracking_shared_memomry_allocated(void) { @@ -9045,6 +9455,13 @@ done: return ret; } +/** + * voc_get_source_tracking - retrieves source track data. + * + * @sourceTrackingData: pointer to be updated with source track data. + * + * Returns 0 on success or error on failure + */ int voc_get_source_tracking(struct source_tracking_param *sourceTrackingData) { struct voice_data *v = NULL; @@ -9077,13 +9494,21 @@ int voc_get_source_tracking(struct source_tracking_param *sourceTrackingData) return ret; } +EXPORT_SYMBOL(voc_get_source_tracking); +/** + * is_voc_initialized: + * + * Returns voice module init status + * + */ int is_voc_initialized(void) { return module_initialized; } +EXPORT_SYMBOL(is_voc_initialized); -static int __init voice_init(void) +int __init voice_init(void) { int rc = 0, i = 0; @@ -9180,12 +9605,9 @@ static int __init voice_init(void) return rc; } -device_initcall(voice_init); -static void __exit voice_exit(void) +void __exit voice_exit(void) { voice_delete_cal_data(); free_cal_map_table(); } - -__exitcall(voice_exit); diff --git a/dsp/rtac.c b/dsp/rtac.c index 84ef8355a1..806bbc5fb1 100644 --- a/dsp/rtac.c +++ b/dsp/rtac.c @@ -1875,7 +1875,7 @@ struct miscdevice rtac_misc = { .fops = &rtac_fops, }; -static int __init rtac_init(void) +int __init rtac_init(void) { int i = 0; @@ -1949,7 +1949,13 @@ nomem: return -ENOMEM; } -module_init(rtac_init); +void __exit rtac_exit(void) +{ + kzfree(rtac_adm_buffer); + kzfree(rtac_asm_buffer); + kzfree(rtac_afe_buffer); + misc_deregister(&rtac_misc); +} MODULE_DESCRIPTION("SoC QDSP6v2 Real-Time Audio Calibration driver"); MODULE_LICENSE("GPL v2"); diff --git a/dsp/usf.c b/dsp/usf.c index f75439de4e..263ba1f8b0 100644 --- a/dsp/usf.c +++ b/dsp/usf.c @@ -27,6 +27,7 @@ #include "q6usm.h" #include "usf.h" #include "usfcdev.h" +#include "q6_init.h" /* The driver version*/ #define DRV_VERSION "1.7.1" @@ -2455,10 +2456,19 @@ static int __init usf_init(void) break; } } + if (!rc) q6usm_init(); return rc; } +module_init(usf_init); -device_initcall(usf_init); +static void __exit usf_exit(void) +{ + uint16_t ind = 0; + for (ind = 0; ind < MAX_DEVS_NUMBER; ++ind) + misc_deregister(&usf_misc[ind]); +} +module_exit(usf_exit); MODULE_DESCRIPTION("Ultrasound framework driver"); +MODULE_LICENSE("GPL v2"); diff --git a/dsp/usfcdev.c b/dsp/usfcdev.c index 6b8aae01ec..289616669f 100644 --- a/dsp/usfcdev.c +++ b/dsp/usfcdev.c @@ -217,7 +217,7 @@ static bool usfcdev_filter(struct input_handle *handle, uint16_t ind = (uint16_t)handle->handler->minor; bool rc = (s_usfcdev_events[ind].event_status != USFCDEV_EVENT_ENABLED); - if (s_usf_pid == sys_getpid()) { + if (s_usf_pid == current->pid) { /* Pass events from usfcdev driver */ rc = false; pr_debug("%s: event_type=%d; type=%d; code=%d; val=%d", @@ -395,7 +395,7 @@ bool usfcdev_set_filter(uint16_t event_type_ind, bool filter) if (filter) { s_usfcdev_events[event_type_ind].event_status = USFCDEV_EVENT_DISABLING; - s_usf_pid = sys_getpid(); + s_usf_pid = current->pid; usfcdev_clean_dev(event_type_ind); s_usfcdev_events[event_type_ind].event_status = USFCDEV_EVENT_DISABLED; @@ -411,12 +411,3 @@ bool usfcdev_set_filter(uint16_t event_type_ind, bool filter) return rc; } - -static int __init usfcdev_init(void) -{ - return 0; -} - -device_initcall(usfcdev_init); - -MODULE_DESCRIPTION("Handle of events from devices, conflicting with USF"); diff --git a/include/dsp/audio_notifier.h b/include/dsp/audio_notifier.h index 3587b49a05..c7794ac602 100644 --- a/include/dsp/audio_notifier.h +++ b/include/dsp/audio_notifier.h @@ -43,7 +43,7 @@ struct audio_notifier_cb_data { int domain; }; -#ifdef CONFIG_MSM_QDSP6_NOTIFIER +#if IS_ENABLED(CONFIG_MSM_QDSP6_NOTIFIER) /* * Use audio_notifier_register to register any audio @@ -100,6 +100,6 @@ static inline int audio_notifier_deregister(char *client_name) return 0; } -#endif /* CONFIG_MSM_QDSP6_PDR */ +#endif /* CONFIG_MSM_QDSP6_NOTIFIER */ #endif diff --git a/include/asoc/msm-dts-srs-tm-config.h b/include/dsp/msm-dts-srs-tm-config.h similarity index 100% rename from include/asoc/msm-dts-srs-tm-config.h rename to include/dsp/msm-dts-srs-tm-config.h diff --git a/include/dsp/q6adm-v2.h b/include/dsp/q6adm-v2.h index 013d5229cf..6a6d3b23f1 100644 --- a/include/dsp/q6adm-v2.h +++ b/include/dsp/q6adm-v2.h @@ -184,4 +184,6 @@ int adm_programable_channel_mixer(int port_id, int copp_idx, int session_id, int session_type, struct msm_pcm_channel_mixer *ch_mixer, int channel_index); +void msm_dts_srs_acquire_lock(void); +void msm_dts_srs_release_lock(void); #endif /* __Q6_ADM_V2_H__ */ diff --git a/include/ipc/apr.h b/include/ipc/apr.h index 29deb3ca5a..4e5e3d8630 100644 --- a/include/ipc/apr.h +++ b/include/ipc/apr.h @@ -174,6 +174,7 @@ int apr_send_pkt(void *handle, uint32_t *buf); int apr_deregister(void *handle); void subsys_notif_register(char *client_name, int domain, struct notifier_block *nb); +void subsys_notif_deregister(char *client_name); int apr_get_dest_id(char *dest); uint16_t apr_get_data_src(struct apr_hdr *hdr); void change_q6_state(int state); diff --git a/include/ipc/apr_tal.h b/include/ipc/apr_tal.h index 26d1a4c56e..fc1471d4f0 100644 --- a/include/ipc/apr_tal.h +++ b/include/ipc/apr_tal.h @@ -73,6 +73,7 @@ int apr_tal_write(struct apr_svc_ch_dev *apr_ch, void *data, int apr_tal_close(struct apr_svc_ch_dev *apr_ch); int apr_tal_rx_intents_config(struct apr_svc_ch_dev *apr_ch, int num_of_intents, uint32_t size); +int apr_tal_init(void); struct apr_svc_ch_dev { diff --git a/include/soc/internal.h b/include/soc/internal.h index 2bc065526d..452d9d2686 120000 --- a/include/soc/internal.h +++ b/include/soc/internal.h @@ -1 +1 @@ -../../../../drivers/base/regmap/internal.h \ No newline at end of file +../../../../../../kernel/msm-4.9/drivers/base/regmap/internal.h \ No newline at end of file diff --git a/ipc/Android.mk b/ipc/Android.mk new file mode 100644 index 0000000000..8032374311 --- /dev/null +++ b/ipc/Android.mk @@ -0,0 +1,61 @@ +# 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 _audio.ko as LOCAL_MODULE. +# This means we need to rename the module to _audio.ko +# after audio.ko is built. +KBUILD_OPTIONS += MODNAME=apr_dlkm +KBUILD_OPTIONS += BOARD_PLATFORM=$(TARGET_BOARD_PLATFORM) +KBUILD_OPTIONS += $(AUDIO_SELECT) + +########################################################### +include $(CLEAR_VARS) +LOCAL_MODULE := $(AUDIO_CHIPSET)_apr.ko +LOCAL_MODULE_KBUILD_NAME := apr_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)_wglink.ko +LOCAL_MODULE_KBUILD_NAME := wglink_dlkm.ko +LOCAL_MODULE_TAGS := optional +LOCAL_MODULE_DEBUG_ENABLE := true +LOCAL_MODULE_PATH := $(KERNEL_MODULES_OUT) +include $(DLKM_DIR)/AndroidKernelModule.mk +########################################################### + +endif # DLKM check +endif # supported target check diff --git a/ipc/Kbuild b/ipc/Kbuild new file mode 100644 index 0000000000..b729f90318 --- /dev/null +++ b/ipc/Kbuild @@ -0,0 +1,153 @@ +# 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 + +TARGET_KERNEL_VERSION := 4.4 + +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 + TARGET_KERNEL_VERSION := 4.9 + endif + ifeq ($(CONFIG_ARCH_SDM670), y) + include $(AUDIO_ROOT)/config/sdm670auto.conf + export + TARGET_KERNEL_VERSION := 4.9 + 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) + +############ IPC ############ + +ifeq ($(CONFIG_MSM_QDSP6_APRV2_GLINK), m) +APRV_GLINK += apr.o +APRV_GLINK += apr_v2.o +APRV_GLINK += apr_tal_glink.o +endif + +ifeq ($(CONFIG_MSM_QDSP6_APRV3_GLINK), m) +APRV_GLINK += apr.o +APRV_GLINK += apr_v3.o +APRV_GLINK += apr_tal_glink.o +endif + +ifeq ($(CONFIG_WCD_DSP_GLINK), m) +WDSP_GLINK += wcd-dsp-glink.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) + +HEADER_INSTALL_DIR := $(TOP)/kernel/msm-$(TARGET_KERNEL_VERSION)/scripts +UAPI_OUT := $(OUT)/obj/vendor/qcom/opensource/audio-kernel/include +$(shell $(HEADER_INSTALL_DIR)/headers_install.sh $(UAPI_OUT)/linux/ $(AUDIO_ROOT)/include/uapi/linux/ avtimer.h;) +$(shell $(HEADER_INSTALL_DIR)/headers_install.sh $(UAPI_OUT)/linux/ $(AUDIO_ROOT)/include/uapi/linux/ msm_audio.h;) +$(shell $(HEADER_INSTALL_DIR)/headers_install.sh $(UAPI_OUT)/linux/ $(AUDIO_ROOT)/include/uapi/linux/ msm_audio_aac.h;) +$(shell $(HEADER_INSTALL_DIR)/headers_install.sh $(UAPI_OUT)/linux/ $(AUDIO_ROOT)/include/uapi/linux/ msm_audio_ac3.h;) +$(shell $(HEADER_INSTALL_DIR)/headers_install.sh $(UAPI_OUT)/linux/ $(AUDIO_ROOT)/include/uapi/linux/ msm_audio_alac.h;) +$(shell $(HEADER_INSTALL_DIR)/headers_install.sh $(UAPI_OUT)/linux/ $(AUDIO_ROOT)/include/uapi/linux/ msm_audio_amrnb.h;) +$(shell $(HEADER_INSTALL_DIR)/headers_install.sh $(UAPI_OUT)/linux/ $(AUDIO_ROOT)/include/uapi/linux/ msm_audio_amrwb.h;) +$(shell $(HEADER_INSTALL_DIR)/headers_install.sh $(UAPI_OUT)/linux/ $(AUDIO_ROOT)/include/uapi/linux/ msm_audio_amrwbplus.h;) +$(shell $(HEADER_INSTALL_DIR)/headers_install.sh $(UAPI_OUT)/linux/ $(AUDIO_ROOT)/include/uapi/linux/ msm_audio_ape.h;) +$(shell $(HEADER_INSTALL_DIR)/headers_install.sh $(UAPI_OUT)/linux/ $(AUDIO_ROOT)/include/uapi/linux/ msm_audio_calibration.h;) +$(shell $(HEADER_INSTALL_DIR)/headers_install.sh $(UAPI_OUT)/linux/ $(AUDIO_ROOT)/include/uapi/linux/ msm_audio_g711_dec.h;) +$(shell $(HEADER_INSTALL_DIR)/headers_install.sh $(UAPI_OUT)/linux/ $(AUDIO_ROOT)/include/uapi/linux/ msm_audio_g711.h;) +$(shell $(HEADER_INSTALL_DIR)/headers_install.sh $(UAPI_OUT)/linux/ $(AUDIO_ROOT)/include/uapi/linux/ msm_audio_mvs.h;) +$(shell $(HEADER_INSTALL_DIR)/headers_install.sh $(UAPI_OUT)/linux/ $(AUDIO_ROOT)/include/uapi/linux/ msm_audio_qcp.h;) +$(shell $(HEADER_INSTALL_DIR)/headers_install.sh $(UAPI_OUT)/linux/ $(AUDIO_ROOT)/include/uapi/linux/ msm_audio_sbc.h;) +$(shell $(HEADER_INSTALL_DIR)/headers_install.sh $(UAPI_OUT)/linux/ $(AUDIO_ROOT)/include/uapi/linux/ msm_audio_voicememo.h;) +$(shell $(HEADER_INSTALL_DIR)/headers_install.sh $(UAPI_OUT)/linux/ $(AUDIO_ROOT)/include/uapi/linux/ msm_audio_wma.h;) +$(shell $(HEADER_INSTALL_DIR)/headers_install.sh $(UAPI_OUT)/linux/ $(AUDIO_ROOT)/include/uapi/linux/ msm_audio_wmapro.h;) + +$(shell $(HEADER_INSTALL_DIR)/headers_install.sh $(UAPI_OUT)/sound/ $(AUDIO_ROOT)/include/uapi/sound/ audio_effects.h;) +$(shell $(HEADER_INSTALL_DIR)/headers_install.sh $(UAPI_OUT)/sound/ $(AUDIO_ROOT)/include/uapi/sound/ audio_slimslave.h;) +$(shell $(HEADER_INSTALL_DIR)/headers_install.sh $(UAPI_OUT)/sound/ $(AUDIO_ROOT)/include/uapi/sound/ devdep_params.h;) +$(shell $(HEADER_INSTALL_DIR)/headers_install.sh $(UAPI_OUT)/sound/ $(AUDIO_ROOT)/include/uapi/sound/ lsm_params.h;) +$(shell $(HEADER_INSTALL_DIR)/headers_install.sh $(UAPI_OUT)/sound/ $(AUDIO_ROOT)/include/uapi/sound/ msmcal-hwdep.h;) +$(shell $(HEADER_INSTALL_DIR)/headers_install.sh $(UAPI_OUT)/sound/ $(AUDIO_ROOT)/include/uapi/sound/ voice_params.h;) +$(shell $(HEADER_INSTALL_DIR)/headers_install.sh $(UAPI_OUT)/sound/ $(AUDIO_ROOT)/include/uapi/sound/ wcd-dsp-glink.h;) + +# 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/dsp/Module.symvers +# Module information used by KBuild framework +obj-$(CONFIG_MSM_QDSP6_APRV2_GLINK) += apr_dlkm.o +apr_dlkm-y := $(APRV_GLINK) + +obj-$(CONFIG_WCD_DSP_GLINK) += wglink_dlkm.o +wglink_dlkm-y := $(WDSP_GLINK) + +# inject some build related information +CDEFINES += -DBUILD_TIMESTAMP=\"$(shell date -u +'%Y-%m-%dT%H:%M:%SZ')\" diff --git a/ipc/apr.c b/ipc/apr.c index 8fc62f406c..dd2a63bd70 100644 --- a/ipc/apr.c +++ b/ipc/apr.c @@ -207,15 +207,29 @@ static struct apr_svc_table svc_tbl_voice[] = { }, }; +/** + * apr_get_modem_state: + * + * Returns current modem load status + * + */ enum apr_subsys_state apr_get_modem_state(void) { return atomic_read(&q6.modem_state); } +EXPORT_SYMBOL(apr_get_modem_state); +/** + * apr_set_modem_state - Update modem load status. + * + * @state: State to update modem load status + * + */ void apr_set_modem_state(enum apr_subsys_state state) { atomic_set(&q6.modem_state, state); } +EXPORT_SYMBOL(apr_set_modem_state); enum apr_subsys_state apr_cmpxchg_modem_state(enum apr_subsys_state prev, enum apr_subsys_state new) @@ -318,6 +332,15 @@ struct apr_client *apr_get_client(int dest_id, int client_id) return &client[dest_id][client_id]; } +/** + * apr_send_pkt - Clients call to send packet + * to destination processor. + * + * @handle: APR service handle + * @buf: payload to send to destination processor. + * + * Returns Bytes(>0)pkt_size on success or error on failure. + */ int apr_send_pkt(void *handle, uint32_t *buf) { struct apr_svc *svc = handle; @@ -391,6 +414,7 @@ int apr_send_pkt(void *handle, uint32_t *buf) return rc; } +EXPORT_SYMBOL(apr_send_pkt); int apr_pkt_config(void *handle, struct apr_pkt_cfg *cfg) { @@ -418,6 +442,19 @@ int apr_pkt_config(void *handle, struct apr_pkt_cfg *cfg) cfg->intents.num_of_intents, cfg->intents.size); } +/** + * apr_register - Clients call to register + * to APR. + * + * @dest: destination processor + * @svc_name: name of service to register as + * @svc_fn: callback function to trigger when response + * ack or packets received from destination processor. + * @src_port: Port number within a service + * @priv: private data of client, passed back in cb fn. + * + * Returns apr_svc handle on success or NULL on failure. + */ struct apr_svc *apr_register(char *dest, char *svc_name, apr_fn svc_fn, uint32_t src_port, void *priv) { @@ -534,6 +571,7 @@ struct apr_svc *apr_register(char *dest, char *svc_name, apr_fn svc_fn, done: return svc; } +EXPORT_SYMBOL(apr_register); void apr_cb_func(void *buf, int len, void *priv) @@ -735,6 +773,14 @@ static void apr_reset_deregister(struct work_struct *work) kfree(apr_reset); } +/** + * apr_deregister - Clients call to de-register + * from APR. + * + * @handle: APR service handle to de-register + * + * Returns 0 on success or -EINVAL on error. + */ int apr_deregister(void *handle) { struct apr_svc *svc = handle; @@ -784,7 +830,15 @@ int apr_deregister(void *handle) return 0; } +EXPORT_SYMBOL(apr_deregister); +/** + * apr_reset - sets up workqueue to de-register + * the given APR service handle. + * + * @handle: APR service handle + * + */ void apr_reset(void *handle) { struct apr_reset_work *apr_reset_worker = NULL; @@ -810,6 +864,7 @@ void apr_reset(void *handle) INIT_WORK(&apr_reset_worker->work, apr_reset_deregister); queue_work(apr_reset_workqueue, &apr_reset_worker->work); } +EXPORT_SYMBOL(apr_reset); /* Dispatch the Reset events to Modem and audio clients */ static void dispatch_event(unsigned long code, uint16_t proc) @@ -920,10 +975,28 @@ static struct notifier_block modem_service_nb = { .priority = 0, }; +#ifdef CONFIG_DEBUG_FS +static int __init apr_debug_init(void) +{ + debugfs_apr_debug = debugfs_create_file("msm_apr_debug", + S_IFREG | 0444, NULL, NULL, + &apr_debug_ops); + return 0; +} +#else +static int __init apr_debug_init(void) +( + return 0; +) +#endif + static int __init apr_init(void) { int i, j, k; + init_waitqueue_head(&dsp_wait); + init_waitqueue_head(&modem_wait); + for (i = 0; i < APR_DEST_MAX; i++) for (j = 0; j < APR_CLIENT_MAX; j++) { mutex_init(&client[i][j].m_lock); @@ -949,28 +1022,16 @@ static int __init apr_init(void) subsys_notif_register("apr_modem", AUDIO_NOTIFIER_MODEM_DOMAIN, &modem_service_nb); - return 0; + apr_tal_init(); + return apr_debug_init(); } -device_initcall(apr_init); +module_init(apr_init); -static int __init apr_late_init(void) +void __exit apr_exit(void) { - int ret = 0; - - init_waitqueue_head(&dsp_wait); - init_waitqueue_head(&modem_wait); - - return ret; + subsys_notif_deregister("apr_modem"); + subsys_notif_deregister("apr_adsp"); } -late_initcall(apr_late_init); - -#ifdef CONFIG_DEBUG_FS -static int __init apr_debug_init(void) -{ - debugfs_apr_debug = debugfs_create_file("msm_apr_debug", - S_IFREG | 0444, NULL, NULL, - &apr_debug_ops); - return 0; -} -device_initcall(apr_debug_init); -#endif +module_exit(apr_exit); +MODULE_DESCRIPTION("APR module"); +MODULE_LICENSE("GPL v2"); diff --git a/ipc/apr_tal_glink.c b/ipc/apr_tal_glink.c index 7de7ddafdb..3803dcb1ea 100644 --- a/ipc/apr_tal_glink.c +++ b/ipc/apr_tal_glink.c @@ -416,7 +416,7 @@ static struct glink_link_info lpass_link_info = { .glink_link_state_notif_cb = apr_tal_link_state_cb, }; -static int __init apr_tal_init(void) +int apr_tal_init(void) { int i, j, k; @@ -448,4 +448,3 @@ static int __init apr_tal_init(void) return 0; } -device_initcall(apr_tal_init); diff --git a/ipc/apr_v2.c b/ipc/apr_v2.c index 7e63310094..e85173cd21 100644 --- a/ipc/apr_v2.c +++ b/ipc/apr_v2.c @@ -66,6 +66,16 @@ void subsys_notif_register(char *client_name, int domain, __func__, domain, ret); } +void subsys_notif_deregister(char *client_name) +{ + int ret; + + ret = audio_notifier_deregister(client_name); + if (ret < 0) + pr_err("%s: Audio notifier de-register failed for client %s\n", + __func__, client_name); +} + uint16_t apr_get_reset_domain(uint16_t proc) { return proc; diff --git a/ipc/apr_v3.c b/ipc/apr_v3.c index 5a4ef53bb7..fa68daf55e 100644 --- a/ipc/apr_v3.c +++ b/ipc/apr_v3.c @@ -58,6 +58,16 @@ void subsys_notif_register(char *client_name, int domain, __func__, domain, ret); } +void subsys_notif_deregister(char *client_name) +{ + int ret; + + ret = audio_notifier_deregister(client_name); + if (ret < 0) + pr_err("%s: Audio notifier de-register failed for client %s\n", + __func__, client_name); +} + uint16_t apr_get_reset_domain(uint16_t proc) { return APR_DEST_QDSP6; diff --git a/ipc/wcd-dsp-glink.c b/ipc/wcd-dsp-glink.c index cab7c3b7c4..400fd06173 100644 --- a/ipc/wcd-dsp-glink.c +++ b/ipc/wcd-dsp-glink.c @@ -1212,7 +1212,17 @@ static struct platform_driver wdsp_glink_driver = { }, }; -module_platform_driver(wdsp_glink_driver); +static int __init wdsp_glink_init(void) +{ + return platform_driver_register(&wdsp_glink_driver); +} +static void __exit wdsp_glink_exit(void) +{ + platform_driver_unregister(&wdsp_glink_driver); +} + +module_init(wdsp_glink_init); +module_exit(wdsp_glink_exit); MODULE_DESCRIPTION("SoC WCD_DSP GLINK Driver"); MODULE_LICENSE("GPL v2"); diff --git a/soc/Android.mk b/soc/Android.mk new file mode 100644 index 0000000000..e5ec9aa222 --- /dev/null +++ b/soc/Android.mk @@ -0,0 +1,79 @@ +# 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 _audio.ko as LOCAL_MODULE. +# This means we need to rename the module to _audio.ko +# after audio.ko is built. +KBUILD_OPTIONS += MODNAME=soc_dlkm +KBUILD_OPTIONS += BOARD_PLATFORM=$(TARGET_BOARD_PLATFORM) +KBUILD_OPTIONS += $(AUDIO_SELECT) + +########################################################### +ifeq ($(call is-board-platform,sdm670),true) +include $(CLEAR_VARS) +LOCAL_MODULE := $(AUDIO_CHIPSET)_pinctrl_lpi.ko +LOCAL_MODULE_KBUILD_NAME := pinctrl_lpi_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)_pinctrl_wcd.ko +LOCAL_MODULE_KBUILD_NAME := pinctrl_wcd_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)_swr.ko +LOCAL_MODULE_KBUILD_NAME := swr_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)_swr_ctrl.ko +LOCAL_MODULE_KBUILD_NAME := swr_ctrl_dlkm.ko +LOCAL_MODULE_TAGS := optional +LOCAL_MODULE_DEBUG_ENABLE := true +LOCAL_MODULE_PATH := $(KERNEL_MODULES_OUT) +include $(DLKM_DIR)/AndroidKernelModule.mk +########################################################### + +endif # DLKM check +endif # supported target check diff --git a/soc/Kbuild b/soc/Kbuild new file mode 100644 index 0000000000..45b77e9ce1 --- /dev/null +++ b/soc/Kbuild @@ -0,0 +1,121 @@ +# 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) + +############ SoC Modules ############ + +# for pinctrl WCD driver +ifeq ($(CONFIG_PINCTRL_WCD), m) + PINCTRL_WCD_OBJS += pinctrl-wcd.o +endif + +# for pinctrl LPI driver +ifeq ($(CONFIG_PINCTRL_LPI), m) + PINCTRL_LPI_OBJS += pinctrl-lpi.o +endif + +# for soundwire driver +ifeq ($(CONFIG_SOUNDWIRE_WCD_CTRL), m) + SWR_CTRL_OBJS += swr-wcd-ctrl.o +endif + +ifeq ($(CONFIG_SOUNDWIRE), m) + SWR_OBJS += regmap-swr.o + SWR_OBJS += soundwire.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) + +KBUILD_EXTRA_SYMBOLS +=$(OUT)/obj/vendor/qcom/opensource/audio-kernel/dsp/Module.symvers +# 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 + +# Module information used by KBuild framework +obj-$(CONFIG_PINCTRL_WCD) += pinctrl_wcd_dlkm.o +pinctrl_wcd_dlkm-y := $(PINCTRL_WCD_OBJS) + +obj-$(CONFIG_PINCTRL_LPI) += pinctrl_lpi_dlkm.o +pinctrl_lpi_dlkm-y := $(PINCTRL_LPI_OBJS) + +obj-$(CONFIG_SOUNDWIRE) += swr_dlkm.o +swr_dlkm-y := $(SWR_OBJS) + +obj-$(CONFIG_SOUNDWIRE_WCD_CTRL) += swr_ctrl_dlkm.o +swr_ctrl_dlkm-y := $(SWR_CTRL_OBJS) + +# inject some build related information +DEFINES += -DBUILD_TIMESTAMP=\"$(shell date -u +'%Y-%m-%dT%H:%M:%SZ')\" diff --git a/soc/core.h b/soc/core.h index 8a2fa90df8..451c69610e 120000 --- a/soc/core.h +++ b/soc/core.h @@ -1 +1 @@ -../../../drivers/pinctrl/core.h \ No newline at end of file +../../../../../kernel/msm-4.9/drivers/pinctrl/core.h \ No newline at end of file diff --git a/soc/pinctrl-utils.h b/soc/pinctrl-utils.h index 9aab5f24bd..2ea9d23df5 120000 --- a/soc/pinctrl-utils.h +++ b/soc/pinctrl-utils.h @@ -1 +1 @@ -../../../drivers/pinctrl/pinctrl-utils.h \ No newline at end of file +../../../../../kernel/msm-4.9/drivers/pinctrl/pinctrl-utils.h \ No newline at end of file diff --git a/soc/soundwire.c b/soc/soundwire.c index 6095c0a82e..cda4789d8d 100644 --- a/soc/soundwire.c +++ b/soc/soundwire.c @@ -1026,7 +1026,7 @@ static int __init soundwire_init(void) return retval; } -postcore_initcall(soundwire_init); +module_init(soundwire_init); module_exit(soundwire_exit); diff --git a/soc/swr-wcd-ctrl.c b/soc/swr-wcd-ctrl.c index bb78372aa9..dc1f7866d4 100644 --- a/soc/swr-wcd-ctrl.c +++ b/soc/swr-wcd-ctrl.c @@ -1878,7 +1878,7 @@ static int __init swrm_init(void) { return platform_driver_register(&swr_mstr_driver); } -subsys_initcall(swrm_init); +module_init(swrm_init); static void __exit swrm_exit(void) { @@ -1886,7 +1886,6 @@ static void __exit swrm_exit(void) } module_exit(swrm_exit); - MODULE_LICENSE("GPL v2"); MODULE_DESCRIPTION("WCD SoundWire Controller"); MODULE_ALIAS("platform:swr-wcd");