blob: 2d0c915128e03e58b93d9f8baea44708126d10aa [file] [log] [blame]
Laxminath Kasam8b1366a2017-10-05 01:44:16 +05301# We can build either as part of a standalone Kernel build or as
2# an external module. Determine which mechanism is being used
Asish Bhattacharya5faacb32017-12-04 17:23:15 +05303ifeq ($(MODNAME),)
4 KERNEL_BUILD := 1
5else
6 KERNEL_BUILD := 0
7endif
Laxminath Kasam8b1366a2017-10-05 01:44:16 +05308
Asish Bhattacharya5faacb32017-12-04 17:23:15 +05309TARGET_KERNEL_VERSION := 4.9
10
11# These are configurable via Kconfig for kernel-based builds
12# Need to explicitly configure for Android-based builds
13ifeq ($(CONFIG_ARCH_SDM845), y)
14 TARGET_KERNEL_VERSION := 4.9
15endif
16ifeq ($(CONFIG_ARCH_SDM670), y)
17 TARGET_KERNEL_VERSION := 4.9
18endif
Soumya Managolieaff6622018-02-23 12:00:54 +053019ifeq ($(CONFIG_ARCH_SDM450), y)
20 TARGET_KERNEL_VERSION := 4.9
21endif
Vaishnavi Kommaraju59562a12018-04-25 19:33:46 +053022ifeq ($(CONFIG_ARCH_SDM439), y)
23 TARGET_KERNEL_VERSION := 4.9
24endif
Sundara Vinayagam39838332018-05-23 12:04:25 +053025ifeq ($(CONFIG_ARCH_MSM8909), y)
26 TARGET_KERNEL_VERSION := 4.9
27endif
28
Soumya Managolid63fb8e2018-05-08 17:28:01 +053029ifeq ($(CONFIG_ARCH_MSM8917), y)
30 TARGET_KERNEL_VERSION := 4.9
31endif
Asish Bhattacharya5faacb32017-12-04 17:23:15 +053032KDIR := $(TOP)/kernel/msm-$(TARGET_KERNEL_VERSION)
33
34ifeq ($(KERNEL_BUILD), 1)
35 AUDIO_ROOT := $(KDIR)/techpack/audio
36endif
Laxminath Kasam8b1366a2017-10-05 01:44:16 +053037
38ifeq ($(KERNEL_BUILD), 0)
Laxminath Kasam8b1366a2017-10-05 01:44:16 +053039 ifeq ($(CONFIG_ARCH_SDM845), y)
40 include $(AUDIO_ROOT)/config/sdm845auto.conf
41 export
Asish Bhattacharya5faacb32017-12-04 17:23:15 +053042 INCS += -include $(AUDIO_ROOT)/config/sdm845autoconf.h
Laxminath Kasam8b1366a2017-10-05 01:44:16 +053043 endif
44 ifeq ($(CONFIG_ARCH_SDM670), y)
Aditya Bavanari68d3ed82018-04-08 14:34:47 +053045 include $(AUDIO_ROOT)/config/sdm710auto.conf
Laxminath Kasam8b1366a2017-10-05 01:44:16 +053046 export
Aditya Bavanari68d3ed82018-04-08 14:34:47 +053047 INCS += -include $(AUDIO_ROOT)/config/sdm710autoconf.h
Laxminath Kasam8b1366a2017-10-05 01:44:16 +053048 endif
Laxminath Kasam942d1c62017-12-29 11:02:22 +053049 ifeq ($(CONFIG_ARCH_SDM450), y)
Soumya Managolieaff6622018-02-23 12:00:54 +053050 include $(AUDIO_ROOT)/config/sdm450auto.conf
Laxminath Kasam942d1c62017-12-29 11:02:22 +053051 export
Soumya Managolieaff6622018-02-23 12:00:54 +053052 INCS += -include $(AUDIO_ROOT)/config/sdm450autoconf.h
Laxminath Kasam942d1c62017-12-29 11:02:22 +053053 endif
Vaishnavi Kommaraju59562a12018-04-25 19:33:46 +053054 ifeq ($(CONFIG_ARCH_SDM439), y)
55 include $(AUDIO_ROOT)/config/sdm450auto.conf
56 export
57 INCS += -include $(AUDIO_ROOT)/config/sdm450autoconf.h
58 endif
Sundara Vinayagam39838332018-05-23 12:04:25 +053059 ifeq ($(CONFIG_ARCH_MSM8909), y)
Manjunatha Madana58ebedb2020-02-19 17:39:05 +053060 ifeq ($(CONFIG_MSM_BGCOM), y)
61 include $(AUDIO_ROOT)/config/msm8909auto.conf
62 export
63 INCS += -include $(AUDIO_ROOT)/config/msm8909autoconf.h
64 endif
65 ifeq ($(CONFIG_MSM_8905), m)
66 include $(AUDIO_ROOT)/config/msm8905auto.conf
67 export
68 INCS += -include $(AUDIO_ROOT)/config/msm8905autoconf.h
69 endif
Sundara Vinayagam39838332018-05-23 12:04:25 +053070 endif
Soumya Managolid63fb8e2018-05-08 17:28:01 +053071 ifeq ($(CONFIG_ARCH_MSM8917), y)
72 include $(AUDIO_ROOT)/config/sdm450auto.conf
73 export
74 INCS += -include $(AUDIO_ROOT)/config/sdm450autoconf.h
75 endif
Laxminath Kasam8b1366a2017-10-05 01:44:16 +053076endif
77
Laxminath Kasam8b1366a2017-10-05 01:44:16 +053078# As per target team, build is done as follows:
79# Defconfig : build with default flags
80# Slub : defconfig + CONFIG_SLUB_DEBUG := y +
81# CONFIG_SLUB_DEBUG_ON := y + CONFIG_PAGE_POISONING := y
82# Perf : Using appropriate msmXXXX-perf_defconfig
83#
84# Shipment builds (user variants) should not have any debug feature
85# enabled. This is identified using 'TARGET_BUILD_VARIANT'. Slub builds
86# are identified using the CONFIG_SLUB_DEBUG_ON configuration. Since
87# there is no other way to identify defconfig builds, QTI internal
88# representation of perf builds (identified using the string 'perf'),
89# is used to identify if the build is a slub or defconfig one. This
90# way no critical debug feature will be enabled for perf and shipment
91# builds. Other OEMs are also protected using the TARGET_BUILD_VARIANT
92# config.
93
94############ UAPI ############
95UAPI_DIR := uapi
96UAPI_INC := -I$(AUDIO_ROOT)/include/$(UAPI_DIR)
97
98############ COMMON ############
99COMMON_DIR := include
100COMMON_INC := -I$(AUDIO_ROOT)/$(COMMON_DIR)
101
102############ IPC ############
Soumya Managolieaff6622018-02-23 12:00:54 +0530103ifdef CONFIG_MSM_QDSP6_APRV2
104APRV_GLINK += apr.o
105APRV_GLINK += apr_v2.o
106APRV_GLINK += apr_tal.o
Soumya Managoli5beccb82018-03-02 19:31:23 +0530107APRV_GLINK += apr_dummy.o
Soumya Managolieaff6622018-02-23 12:00:54 +0530108endif
Laxminath Kasam8b1366a2017-10-05 01:44:16 +0530109
Sundara Vinayagam39838332018-05-23 12:04:25 +0530110ifdef CONFIG_MSM_QDSP6_APRV3
111APRV_GLINK += apr.o
112APRV_GLINK += apr_v3.o
113APRV_GLINK += apr_tal.o
114APRV_GLINK += apr_dummy.o
115endif
116
Asish Bhattacharya5faacb32017-12-04 17:23:15 +0530117ifdef CONFIG_MSM_QDSP6_APRV2_GLINK
Laxminath Kasam8b1366a2017-10-05 01:44:16 +0530118APRV_GLINK += apr.o
119APRV_GLINK += apr_v2.o
120APRV_GLINK += apr_tal_glink.o
Laxminath Kasam31b26c52018-02-12 16:32:01 +0530121APRV_GLINK += apr_dummy.o
Laxminath Kasam8b1366a2017-10-05 01:44:16 +0530122endif
123
Asish Bhattacharya5faacb32017-12-04 17:23:15 +0530124ifdef CONFIG_MSM_QDSP6_APRV3_GLINK
Laxminath Kasam8b1366a2017-10-05 01:44:16 +0530125APRV_GLINK += apr.o
126APRV_GLINK += apr_v3.o
127APRV_GLINK += apr_tal_glink.o
Laxminath Kasam31b26c52018-02-12 16:32:01 +0530128APRV_GLINK += apr_dummy.o
Laxminath Kasam8b1366a2017-10-05 01:44:16 +0530129endif
130
Sundara Vinayagamc7d61572018-06-05 20:03:46 +0530131ifeq ($(CONFIG_ARCH_MSM8909), $(CONFIG_MSM_BGCOM))
132 ifdef CONFIG_MSM_BG_GLINK
133 BG_GLINK += bg_glink.o
134 endif
Sundara Vinayagama2356d22018-05-21 13:39:39 +0530135endif
136
Asish Bhattacharya5faacb32017-12-04 17:23:15 +0530137ifdef CONFIG_WCD_DSP_GLINK
Laxminath Kasam8b1366a2017-10-05 01:44:16 +0530138WDSP_GLINK += wcd-dsp-glink.o
139endif
140
141LINUX_INC += -Iinclude/linux
142
Asish Bhattacharya5faacb32017-12-04 17:23:15 +0530143INCS += $(COMMON_INC) \
Laxminath Kasam8b1366a2017-10-05 01:44:16 +0530144 $(UAPI_INC)
145
Laxminath Kasam8b1366a2017-10-05 01:44:16 +0530146EXTRA_CFLAGS += $(INCS)
147
148
149CDEFINES += -DANI_LITTLE_BYTE_ENDIAN \
150 -DANI_LITTLE_BIT_ENDIAN \
151 -DDOT11F_LITTLE_ENDIAN_HOST \
152 -DANI_COMPILER_TYPE_GCC \
153 -DANI_OS_TYPE_ANDROID=6 \
154 -DPTT_SOCK_SVC_ENABLE \
155 -Wall\
156 -Werror\
157 -D__linux__
158
159KBUILD_CPPFLAGS += $(CDEFINES)
160
Asish Bhattacharya5faacb32017-12-04 17:23:15 +0530161ifeq ($(KERNEL_BUILD), 0)
162
Laxminath Kasam8b1366a2017-10-05 01:44:16 +0530163HEADER_INSTALL_DIR := $(TOP)/kernel/msm-$(TARGET_KERNEL_VERSION)/scripts
164UAPI_OUT := $(OUT)/obj/vendor/qcom/opensource/audio-kernel/include
165$(shell $(HEADER_INSTALL_DIR)/headers_install.sh $(UAPI_OUT)/linux/ $(AUDIO_ROOT)/include/uapi/linux/ avtimer.h;)
166$(shell $(HEADER_INSTALL_DIR)/headers_install.sh $(UAPI_OUT)/linux/ $(AUDIO_ROOT)/include/uapi/linux/ msm_audio.h;)
167$(shell $(HEADER_INSTALL_DIR)/headers_install.sh $(UAPI_OUT)/linux/ $(AUDIO_ROOT)/include/uapi/linux/ msm_audio_aac.h;)
168$(shell $(HEADER_INSTALL_DIR)/headers_install.sh $(UAPI_OUT)/linux/ $(AUDIO_ROOT)/include/uapi/linux/ msm_audio_ac3.h;)
169$(shell $(HEADER_INSTALL_DIR)/headers_install.sh $(UAPI_OUT)/linux/ $(AUDIO_ROOT)/include/uapi/linux/ msm_audio_alac.h;)
170$(shell $(HEADER_INSTALL_DIR)/headers_install.sh $(UAPI_OUT)/linux/ $(AUDIO_ROOT)/include/uapi/linux/ msm_audio_amrnb.h;)
171$(shell $(HEADER_INSTALL_DIR)/headers_install.sh $(UAPI_OUT)/linux/ $(AUDIO_ROOT)/include/uapi/linux/ msm_audio_amrwb.h;)
172$(shell $(HEADER_INSTALL_DIR)/headers_install.sh $(UAPI_OUT)/linux/ $(AUDIO_ROOT)/include/uapi/linux/ msm_audio_amrwbplus.h;)
173$(shell $(HEADER_INSTALL_DIR)/headers_install.sh $(UAPI_OUT)/linux/ $(AUDIO_ROOT)/include/uapi/linux/ msm_audio_ape.h;)
174$(shell $(HEADER_INSTALL_DIR)/headers_install.sh $(UAPI_OUT)/linux/ $(AUDIO_ROOT)/include/uapi/linux/ msm_audio_calibration.h;)
175$(shell $(HEADER_INSTALL_DIR)/headers_install.sh $(UAPI_OUT)/linux/ $(AUDIO_ROOT)/include/uapi/linux/ msm_audio_g711_dec.h;)
176$(shell $(HEADER_INSTALL_DIR)/headers_install.sh $(UAPI_OUT)/linux/ $(AUDIO_ROOT)/include/uapi/linux/ msm_audio_g711.h;)
177$(shell $(HEADER_INSTALL_DIR)/headers_install.sh $(UAPI_OUT)/linux/ $(AUDIO_ROOT)/include/uapi/linux/ msm_audio_mvs.h;)
178$(shell $(HEADER_INSTALL_DIR)/headers_install.sh $(UAPI_OUT)/linux/ $(AUDIO_ROOT)/include/uapi/linux/ msm_audio_qcp.h;)
179$(shell $(HEADER_INSTALL_DIR)/headers_install.sh $(UAPI_OUT)/linux/ $(AUDIO_ROOT)/include/uapi/linux/ msm_audio_sbc.h;)
180$(shell $(HEADER_INSTALL_DIR)/headers_install.sh $(UAPI_OUT)/linux/ $(AUDIO_ROOT)/include/uapi/linux/ msm_audio_voicememo.h;)
181$(shell $(HEADER_INSTALL_DIR)/headers_install.sh $(UAPI_OUT)/linux/ $(AUDIO_ROOT)/include/uapi/linux/ msm_audio_wma.h;)
182$(shell $(HEADER_INSTALL_DIR)/headers_install.sh $(UAPI_OUT)/linux/ $(AUDIO_ROOT)/include/uapi/linux/ msm_audio_wmapro.h;)
183
184$(shell $(HEADER_INSTALL_DIR)/headers_install.sh $(UAPI_OUT)/sound/ $(AUDIO_ROOT)/include/uapi/sound/ audio_effects.h;)
185$(shell $(HEADER_INSTALL_DIR)/headers_install.sh $(UAPI_OUT)/sound/ $(AUDIO_ROOT)/include/uapi/sound/ audio_slimslave.h;)
186$(shell $(HEADER_INSTALL_DIR)/headers_install.sh $(UAPI_OUT)/sound/ $(AUDIO_ROOT)/include/uapi/sound/ devdep_params.h;)
187$(shell $(HEADER_INSTALL_DIR)/headers_install.sh $(UAPI_OUT)/sound/ $(AUDIO_ROOT)/include/uapi/sound/ lsm_params.h;)
188$(shell $(HEADER_INSTALL_DIR)/headers_install.sh $(UAPI_OUT)/sound/ $(AUDIO_ROOT)/include/uapi/sound/ msmcal-hwdep.h;)
189$(shell $(HEADER_INSTALL_DIR)/headers_install.sh $(UAPI_OUT)/sound/ $(AUDIO_ROOT)/include/uapi/sound/ voice_params.h;)
190$(shell $(HEADER_INSTALL_DIR)/headers_install.sh $(UAPI_OUT)/sound/ $(AUDIO_ROOT)/include/uapi/sound/ wcd-dsp-glink.h;)
191
Asish Bhattacharya5faacb32017-12-04 17:23:15 +0530192KBUILD_EXTRA_SYMBOLS +=$(OUT)/obj/vendor/qcom/opensource/audio-kernel/dsp/Module.symvers
193
194endif
195
Laxminath Kasam8b1366a2017-10-05 01:44:16 +0530196# Currently, for versions of gcc which support it, the kernel Makefile
197# is disabling the maybe-uninitialized warning. Re-enable it for the
198# AUDIO driver. Note that we must use EXTRA_CFLAGS here so that it
199# will override the kernel settings.
200ifeq ($(call cc-option-yn, -Wmaybe-uninitialized),y)
201EXTRA_CFLAGS += -Wmaybe-uninitialized
202endif
203#EXTRA_CFLAGS += -Wmissing-prototypes
204
205ifeq ($(call cc-option-yn, -Wheader-guard),y)
206EXTRA_CFLAGS += -Wheader-guard
207endif
208# If the module name is not "wlan", then the define MULTI_IF_NAME to be the
209# same a the QCA CHIP name. The host driver will then append MULTI_IF_NAME to
210# any string that must be unique for all instances of the driver on the system.
211# This allows multiple instances of the driver with different module names.
212# If the module name is wlan, leave MULTI_IF_NAME undefined and the code will
213# treat the driver as the primary driver.
214ifneq ($(MODNAME), qdsp6v2)
215CHIP_NAME ?= $(MODNAME)
216CDEFINES += -DMULTI_IF_NAME=\"$(CHIP_NAME)\"
217endif
218
Laxminath Kasam8b1366a2017-10-05 01:44:16 +0530219# Module information used by KBuild framework
Soumya Managolieaff6622018-02-23 12:00:54 +0530220obj-$(CONFIG_MSM_QDSP6_APRV2) += apr_dlkm.o
Sundara Vinayagam39838332018-05-23 12:04:25 +0530221obj-$(CONFIG_MSM_QDSP6_APRV3) += apr_dlkm.o
Laxminath Kasam8b1366a2017-10-05 01:44:16 +0530222obj-$(CONFIG_MSM_QDSP6_APRV2_GLINK) += apr_dlkm.o
Asish Bhattacharya5faacb32017-12-04 17:23:15 +0530223obj-$(CONFIG_MSM_QDSP6_APRV3_GLINK) += apr_dlkm.o
Laxminath Kasam8b1366a2017-10-05 01:44:16 +0530224apr_dlkm-y := $(APRV_GLINK)
225
Sundara Vinayagamc7d61572018-06-05 20:03:46 +0530226ifeq ($(CONFIG_ARCH_MSM8909), $(CONFIG_MSM_BGCOM))
227 obj-$(CONFIG_MSM_BG_GLINK) += bg_glink_dlkm.o
228 bg_glink_dlkm-y := $(BG_GLINK)
229endif
Sundara Vinayagama2356d22018-05-21 13:39:39 +0530230
Laxminath Kasam8b1366a2017-10-05 01:44:16 +0530231obj-$(CONFIG_WCD_DSP_GLINK) += wglink_dlkm.o
232wglink_dlkm-y := $(WDSP_GLINK)
233
234# inject some build related information
235CDEFINES += -DBUILD_TIMESTAMP=\"$(shell date -u +'%Y-%m-%dT%H:%M:%SZ')\"