ASoC: allow drivers to compile both static and dynamic
Based on where the code is synced the driver should allow
both static and dynamic linked compilation.
Also remove __exit for modules loaded from another common
init/exit functions.
Change-Id: Ib58f152002aba3af4446f9bbd9b82c279212bd0a
Signed-off-by: Asish Bhattacharya <asishb@codeaurora.org>
diff --git a/ipc/Kbuild b/ipc/Kbuild
index b729f90..92760fb 100644
--- a/ipc/Kbuild
+++ b/ipc/Kbuild
@@ -1,25 +1,41 @@
# 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 ($(MODNAME),)
+ KERNEL_BUILD := 1
+else
+ KERNEL_BUILD := 0
+endif
-TARGET_KERNEL_VERSION := 4.4
+TARGET_KERNEL_VERSION := 4.9
+
+# These are configurable via Kconfig for kernel-based builds
+# Need to explicitly configure for Android-based builds
+ifeq ($(CONFIG_ARCH_SDM845), y)
+ TARGET_KERNEL_VERSION := 4.9
+endif
+ifeq ($(CONFIG_ARCH_SDM670), y)
+ TARGET_KERNEL_VERSION := 4.9
+endif
+
+KDIR := $(TOP)/kernel/msm-$(TARGET_KERNEL_VERSION)
+
+ifeq ($(KERNEL_BUILD), 1)
+ AUDIO_ROOT := $(KDIR)/techpack/audio
+endif
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
+ INCS += -include $(AUDIO_ROOT)/config/sdm845autoconf.h
endif
ifeq ($(CONFIG_ARCH_SDM670), y)
include $(AUDIO_ROOT)/config/sdm670auto.conf
export
- TARGET_KERNEL_VERSION := 4.9
+ INCS += -include $(AUDIO_ROOT)/config/sdm670autoconf.h
endif
endif
-
# As per target team, build is done as follows:
# Defconfig : build with default flags
# Slub : defconfig + CONFIG_SLUB_DEBUG := y +
@@ -46,34 +62,27 @@
############ IPC ############
-ifeq ($(CONFIG_MSM_QDSP6_APRV2_GLINK), m)
+ifdef CONFIG_MSM_QDSP6_APRV2_GLINK
APRV_GLINK += apr.o
APRV_GLINK += apr_v2.o
APRV_GLINK += apr_tal_glink.o
endif
-ifeq ($(CONFIG_MSM_QDSP6_APRV3_GLINK), m)
+ifdef CONFIG_MSM_QDSP6_APRV3_GLINK
APRV_GLINK += apr.o
APRV_GLINK += apr_v3.o
APRV_GLINK += apr_tal_glink.o
endif
-ifeq ($(CONFIG_WCD_DSP_GLINK), m)
+ifdef CONFIG_WCD_DSP_GLINK
WDSP_GLINK += wcd-dsp-glink.o
endif
LINUX_INC += -Iinclude/linux
-INCS := $(COMMON_INC) \
+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)
@@ -89,6 +98,8 @@
KBUILD_CPPFLAGS += $(CDEFINES)
+ifeq ($(KERNEL_BUILD), 0)
+
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;)
@@ -118,6 +129,10 @@
$(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;)
+KBUILD_EXTRA_SYMBOLS +=$(OUT)/obj/vendor/qcom/opensource/audio-kernel/dsp/Module.symvers
+
+endif
+
# 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
@@ -141,9 +156,9 @@
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
+obj-$(CONFIG_MSM_QDSP6_APRV3_GLINK) += apr_dlkm.o
apr_dlkm-y := $(APRV_GLINK)
obj-$(CONFIG_WCD_DSP_GLINK) += wglink_dlkm.o