summaryrefslogtreecommitdiff
path: root/asoc/codecs
diff options
context:
space:
mode:
authorLaxminath Kasam <lkasam@codeaurora.org>2017-10-05 01:44:16 +0530
committerLaxminath Kasam <lkasam@codeaurora.org>2017-11-02 13:42:09 +0530
commit8b1366a648d53416d16f94dee0c33d4249018f92 (patch)
tree55cab8d80e2cdd748ff0bc40bd3612f32a823fa9 /asoc/codecs
parent97c9da7a1efac2d70fbbdb700e9122c49f1bb2df (diff)
downloadmsm-extra-8b1366a648d53416d16f94dee0c33d4249018f92.tar.gz
Audio: DLKM support for all audio modules
Switch to DLKM for all audio kernel modules. Change-Id: I6a96023a21f655f873531af9ace81f2b01eb0f58 Signed-off-by: Laxminath Kasam <lkasam@codeaurora.org>
Diffstat (limited to 'asoc/codecs')
-rw-r--r--asoc/codecs/Android.mk121
-rw-r--r--asoc/codecs/Kbuild181
-rw-r--r--asoc/codecs/cpe_core.h15
-rw-r--r--asoc/codecs/msm_sdw/Android.mk46
-rw-r--r--asoc/codecs/msm_sdw/Kbuild104
-rw-r--r--asoc/codecs/msm_sdw/msm_sdw.h29
-rw-r--r--asoc/codecs/sdm660_cdc/Android.mk53
-rw-r--r--asoc/codecs/sdm660_cdc/Kbuild110
-rw-r--r--asoc/codecs/sdm660_cdc/msm-analog-cdc.h38
-rw-r--r--asoc/codecs/sdm660_cdc/msm-digital-cdc.h16
-rw-r--r--asoc/codecs/wcd-mbhc-legacy.h2
-rw-r--r--asoc/codecs/wcd-mbhc-v2.c12
-rw-r--r--asoc/codecs/wcd9335.h72
-rw-r--r--asoc/codecs/wcd934x/Android.mk54
-rw-r--r--asoc/codecs/wcd934x/Kbuild105
15 files changed, 952 insertions, 6 deletions
diff --git a/asoc/codecs/Android.mk b/asoc/codecs/Android.mk
new file mode 100644
index 00000000..863da5a5
--- /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 <chipset>_audio.ko as LOCAL_MODULE.
+# This means we need to rename the module to <chipset>_audio.ko
+# after audio.ko is built.
+KBUILD_OPTIONS += MODNAME=wcd_core_dlkm
+KBUILD_OPTIONS += BOARD_PLATFORM=$(TARGET_BOARD_PLATFORM)
+KBUILD_OPTIONS += $(AUDIO_SELECT)
+
+###########################################################
+include $(CLEAR_VARS)
+LOCAL_MODULE := $(AUDIO_CHIPSET)_wcd_core.ko
+LOCAL_MODULE_KBUILD_NAME := wcd_core_dlkm.ko
+LOCAL_MODULE_TAGS := optional
+LOCAL_MODULE_DEBUG_ENABLE := true
+LOCAL_MODULE_PATH := $(KERNEL_MODULES_OUT)
+include $(DLKM_DIR)/AndroidKernelModule.mk
+###########################################################
+include $(CLEAR_VARS)
+LOCAL_MODULE := $(AUDIO_CHIPSET)_wcd9xxx.ko
+LOCAL_MODULE_KBUILD_NAME := wcd9xxx_dlkm.ko
+LOCAL_MODULE_TAGS := optional
+LOCAL_MODULE_DEBUG_ENABLE := true
+LOCAL_MODULE_PATH := $(KERNEL_MODULES_OUT)
+include $(DLKM_DIR)/AndroidKernelModule.mk
+###########################################################
+ifeq ($(call is-board-platform,sdm670),true)
+include $(CLEAR_VARS)
+LOCAL_MODULE := $(AUDIO_CHIPSET)_wcd_cpe.ko
+LOCAL_MODULE_KBUILD_NAME := wcd_cpe_dlkm.ko
+LOCAL_MODULE_TAGS := optional
+LOCAL_MODULE_DEBUG_ENABLE := true
+LOCAL_MODULE_PATH := $(KERNEL_MODULES_OUT)
+include $(DLKM_DIR)/AndroidKernelModule.mk
+endif
+###########################################################
+include $(CLEAR_VARS)
+LOCAL_MODULE := $(AUDIO_CHIPSET)_wcd_spi.ko
+LOCAL_MODULE_KBUILD_NAME := wcd_spi_dlkm.ko
+LOCAL_MODULE_TAGS := optional
+LOCAL_MODULE_DEBUG_ENABLE := true
+LOCAL_MODULE_PATH := $(KERNEL_MODULES_OUT)
+include $(DLKM_DIR)/AndroidKernelModule.mk
+###########################################################
+ifeq ($(call is-board-platform,sdm670),true)
+include $(CLEAR_VARS)
+LOCAL_MODULE := $(AUDIO_CHIPSET)_wcd9335.ko
+LOCAL_MODULE_KBUILD_NAME := wcd9335_dlkm.ko
+LOCAL_MODULE_TAGS := optional
+LOCAL_MODULE_DEBUG_ENABLE := true
+LOCAL_MODULE_PATH := $(KERNEL_MODULES_OUT)
+include $(DLKM_DIR)/AndroidKernelModule.mk
+endif
+###########################################################
+include $(CLEAR_VARS)
+LOCAL_MODULE := $(AUDIO_CHIPSET)_wsa881x.ko
+LOCAL_MODULE_KBUILD_NAME := wsa881x_dlkm.ko
+LOCAL_MODULE_TAGS := optional
+LOCAL_MODULE_DEBUG_ENABLE := true
+LOCAL_MODULE_PATH := $(KERNEL_MODULES_OUT)
+include $(DLKM_DIR)/AndroidKernelModule.mk
+###########################################################
+include $(CLEAR_VARS)
+LOCAL_MODULE := $(AUDIO_CHIPSET)_stub.ko
+LOCAL_MODULE_KBUILD_NAME := stub_dlkm.ko
+LOCAL_MODULE_TAGS := optional
+LOCAL_MODULE_DEBUG_ENABLE := true
+LOCAL_MODULE_PATH := $(KERNEL_MODULES_OUT)
+include $(DLKM_DIR)/AndroidKernelModule.mk
+###########################################################
+include $(CLEAR_VARS)
+LOCAL_MODULE := $(AUDIO_CHIPSET)_mbhc.ko
+LOCAL_MODULE_KBUILD_NAME := mbhc_dlkm.ko
+LOCAL_MODULE_TAGS := optional
+LOCAL_MODULE_DEBUG_ENABLE := true
+LOCAL_MODULE_PATH := $(KERNEL_MODULES_OUT)
+include $(DLKM_DIR)/AndroidKernelModule.mk
+###########################################################
+include $(CLEAR_VARS)
+LOCAL_MODULE := $(AUDIO_CHIPSET)_hdmi.ko
+LOCAL_MODULE_KBUILD_NAME := hdmi_dlkm.ko
+LOCAL_MODULE_TAGS := optional
+LOCAL_MODULE_DEBUG_ENABLE := true
+LOCAL_MODULE_PATH := $(KERNEL_MODULES_OUT)
+include $(DLKM_DIR)/AndroidKernelModule.mk
+###########################################################
+
+endif # DLKM check
+endif # supported target check
diff --git a/asoc/codecs/Kbuild b/asoc/codecs/Kbuild
new file mode 100644
index 00000000..83d4da44
--- /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 9f7c2f31..99504c5c 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 00000000..421420b8
--- /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 <chipset>_audio.ko as LOCAL_MODULE.
+# This means we need to rename the module to <chipset>_audio.ko
+# after audio.ko is built.
+KBUILD_OPTIONS += MODNAME=msm_sdw_dlkm
+KBUILD_OPTIONS += BOARD_PLATFORM=$(TARGET_BOARD_PLATFORM)
+KBUILD_OPTIONS += $(AUDIO_SELECT)
+
+###########################################################
+include $(CLEAR_VARS)
+LOCAL_MODULE := $(AUDIO_CHIPSET)_msm_sdw.ko
+LOCAL_MODULE_KBUILD_NAME := msm_sdw_dlkm.ko
+LOCAL_MODULE_TAGS := optional
+LOCAL_MODULE_DEBUG_ENABLE := true
+LOCAL_MODULE_PATH := $(KERNEL_MODULES_OUT)
+include $(DLKM_DIR)/AndroidKernelModule.mk
+###########################################################
+###########################################################
+
+endif # DLKM check
+endif # supported target check
diff --git a/asoc/codecs/msm_sdw/Kbuild b/asoc/codecs/msm_sdw/Kbuild
new file mode 100644
index 00000000..a55948e2
--- /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 3285f5f5..d4ac4333 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 00000000..f322a655
--- /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 <chipset>_audio.ko as LOCAL_MODULE.
+# This means we need to rename the module to <chipset>_audio.ko
+# after audio.ko is built.
+KBUILD_OPTIONS += MODNAME=analog_cdc_dlkm
+KBUILD_OPTIONS += BOARD_PLATFORM=$(TARGET_BOARD_PLATFORM)
+KBUILD_OPTIONS += $(AUDIO_SELECT)
+
+###########################################################
+include $(CLEAR_VARS)
+LOCAL_MODULE := $(AUDIO_CHIPSET)_analog_cdc.ko
+LOCAL_MODULE_KBUILD_NAME := analog_cdc_dlkm.ko
+LOCAL_MODULE_TAGS := optional
+LOCAL_MODULE_DEBUG_ENABLE := true
+LOCAL_MODULE_PATH := $(KERNEL_MODULES_OUT)
+include $(DLKM_DIR)/AndroidKernelModule.mk
+###########################################################
+include $(CLEAR_VARS)
+LOCAL_MODULE := $(AUDIO_CHIPSET)_digital_cdc.ko
+LOCAL_MODULE_KBUILD_NAME := digital_cdc_dlkm.ko
+LOCAL_MODULE_TAGS := optional
+LOCAL_MODULE_DEBUG_ENABLE := true
+LOCAL_MODULE_PATH := $(KERNEL_MODULES_OUT)
+include $(DLKM_DIR)/AndroidKernelModule.mk
+###########################################################
+###########################################################
+
+endif # DLKM check
+endif # supported target check
diff --git a/asoc/codecs/sdm660_cdc/Kbuild b/asoc/codecs/sdm660_cdc/Kbuild
new file mode 100644
index 00000000..c1777ee5
--- /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 fffdf315..9591487b 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 42c31d50..cb6cfe2f 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 594393d4..af3a7dc6 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 d7c59211..3c501b49 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 48826e66..f5f10385 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 00000000..627d04f2
--- /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 <chipset>_audio.ko as LOCAL_MODULE.
+# This means we need to rename the module to <chipset>_audio.ko
+# after audio.ko is built.
+KBUILD_OPTIONS += MODNAME=wcd934x_dlkm
+KBUILD_OPTIONS += BOARD_PLATFORM=$(TARGET_BOARD_PLATFORM)
+KBUILD_OPTIONS += $(AUDIO_SELECT)
+
+###########################################################
+include $(CLEAR_VARS)
+LOCAL_MODULE := $(AUDIO_CHIPSET)_wcd934x.ko
+LOCAL_MODULE_KBUILD_NAME := wcd934x_dlkm.ko
+LOCAL_MODULE_TAGS := optional
+LOCAL_MODULE_DEBUG_ENABLE := true
+LOCAL_MODULE_PATH := $(KERNEL_MODULES_OUT)
+include $(DLKM_DIR)/AndroidKernelModule.mk
+###########################################################
+###########################################################
+
+endif # DLKM check
+endif # supported target check
diff --git a/asoc/codecs/wcd934x/Kbuild b/asoc/codecs/wcd934x/Kbuild
new file mode 100644
index 00000000..6bc854c8
--- /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')\"