blob: 548bab18e66339242ff04fc511292c986d649462 [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 +05309ifeq ($(KERNEL_BUILD), 1)
Laxminath Kasam8b1366a2017-10-05 01:44:16 +053010 # These are configurable via Kconfig for kernel-based builds
11 # Need to explicitly configure for Android-based builds
Piyush Balwanif9d9d1e2018-11-30 19:13:42 +053012 AUDIO_BLD_DIR := $(shell pwd)/kernel/msm-4.9
Asish Bhattacharya5faacb32017-12-04 17:23:15 +053013 AUDIO_ROOT := $(AUDIO_BLD_DIR)/techpack/audio
14endif
15
16ifeq ($(KERNEL_BUILD), 0)
Laxminath Kasam8b1366a2017-10-05 01:44:16 +053017 ifeq ($(CONFIG_ARCH_SDM845), y)
18 include $(AUDIO_ROOT)/config/sdm845auto.conf
19 export
Asish Bhattacharya5faacb32017-12-04 17:23:15 +053020 INCS += -include $(AUDIO_ROOT)/config/sdm845autoconf.h
Laxminath Kasam8b1366a2017-10-05 01:44:16 +053021 endif
22 ifeq ($(CONFIG_ARCH_SDM670), y)
Aditya Bavanari68d3ed82018-04-08 14:34:47 +053023 include $(AUDIO_ROOT)/config/sdm710auto.conf
Laxminath Kasam8b1366a2017-10-05 01:44:16 +053024 export
Aditya Bavanari68d3ed82018-04-08 14:34:47 +053025 INCS += -include $(AUDIO_ROOT)/config/sdm710autoconf.h
Laxminath Kasam8b1366a2017-10-05 01:44:16 +053026 endif
Laxminath Kasam942d1c62017-12-29 11:02:22 +053027 ifeq ($(CONFIG_ARCH_SDM450), y)
Soumya Managolieaff6622018-02-23 12:00:54 +053028 include $(AUDIO_ROOT)/config/sdm450auto.conf
Laxminath Kasam942d1c62017-12-29 11:02:22 +053029 export
Soumya Managolieaff6622018-02-23 12:00:54 +053030 INCS += -include $(AUDIO_ROOT)/config/sdm450autoconf.h
Laxminath Kasam942d1c62017-12-29 11:02:22 +053031 endif
Vaishnavi Kommaraju59562a12018-04-25 19:33:46 +053032 ifeq ($(CONFIG_ARCH_SDM439), y)
33 include $(AUDIO_ROOT)/config/sdm450auto.conf
34 export
35 INCS += -include $(AUDIO_ROOT)/config/sdm450autoconf.h
36 endif
Sundara Vinayagam39838332018-05-23 12:04:25 +053037 ifeq ($(CONFIG_ARCH_MSM8909), y)
Manjunatha Madana58ebedb2020-02-19 17:39:05 +053038 ifeq ($(CONFIG_MSM_BGCOM), y)
39 include $(AUDIO_ROOT)/config/msm8909auto.conf
40 export
41 INCS += -include $(AUDIO_ROOT)/config/msm8909autoconf.h
42 endif
43 ifeq ($(CONFIG_MSM_8905), m)
44 include $(AUDIO_ROOT)/config/msm8905auto.conf
45 export
46 INCS += -include $(AUDIO_ROOT)/config/msm8905autoconf.h
47 endif
Sundara Vinayagam39838332018-05-23 12:04:25 +053048 endif
Soumya Managolid63fb8e2018-05-08 17:28:01 +053049 ifeq ($(CONFIG_ARCH_MSM8917), y)
50 include $(AUDIO_ROOT)/config/sdm450auto.conf
51 export
52 INCS += -include $(AUDIO_ROOT)/config/sdm450autoconf.h
53 endif
Laxminath Kasam8b1366a2017-10-05 01:44:16 +053054endif
55
Laxminath Kasam8b1366a2017-10-05 01:44:16 +053056# As per target team, build is done as follows:
57# Defconfig : build with default flags
58# Slub : defconfig + CONFIG_SLUB_DEBUG := y +
59# CONFIG_SLUB_DEBUG_ON := y + CONFIG_PAGE_POISONING := y
60# Perf : Using appropriate msmXXXX-perf_defconfig
61#
62# Shipment builds (user variants) should not have any debug feature
63# enabled. This is identified using 'TARGET_BUILD_VARIANT'. Slub builds
64# are identified using the CONFIG_SLUB_DEBUG_ON configuration. Since
65# there is no other way to identify defconfig builds, QTI internal
66# representation of perf builds (identified using the string 'perf'),
67# is used to identify if the build is a slub or defconfig one. This
68# way no critical debug feature will be enabled for perf and shipment
69# builds. Other OEMs are also protected using the TARGET_BUILD_VARIANT
70# config.
71
72############ UAPI ############
73UAPI_DIR := uapi
74UAPI_INC := -I$(AUDIO_ROOT)/include/$(UAPI_DIR)
75
76############ COMMON ############
77COMMON_DIR := include
78COMMON_INC := -I$(AUDIO_ROOT)/$(COMMON_DIR)
79
80############ ASoC Codecs ############
Asish Bhattacharya5faacb32017-12-04 17:23:15 +053081ifdef CONFIG_WCD9XXX_CODEC_CORE
Laxminath Kasam8b1366a2017-10-05 01:44:16 +053082 CORE_OBJS += wcd9xxx-rst.o
83 CORE_OBJS += wcd9xxx-core-init.o
84 CORE_OBJS += wcd9xxx-core.o
85 CORE_OBJS += wcd9xxx-irq.o
86 CORE_OBJS += wcd9xxx-slimslave.o
87 CORE_OBJS += wcd9xxx-utils.o
88 CORE_OBJS += wcd9335-regmap.o
89 CORE_OBJS += wcd9335-tables.o
90 CORE_OBJS += msm-cdc-pinctrl.o
91 CORE_OBJS += msm-cdc-supply.o
92 CORE_OBJS += wcd934x/wcd934x-regmap.o
93 CORE_OBJS += wcd934x/wcd934x-tables.o
94endif
95
Asish Bhattacharya5faacb32017-12-04 17:23:15 +053096ifdef CONFIG_SND_SOC_WCD9XXX_V2
Laxminath Kasam8b1366a2017-10-05 01:44:16 +053097 WCD9XXX_OBJS += wcd9xxx-common-v2.o
98 WCD9XXX_OBJS += wcd9xxx-resmgr-v2.o
99 WCD9XXX_OBJS += wcdcal-hwdep.o
100 WCD9XXX_OBJS += wcd9xxx-soc-init.o
101 WCD9XXX_OBJS += wcd-dsp-utils.o
102 WCD9XXX_OBJS += wcd-dsp-mgr.o
Soumya Managolieaff6622018-02-23 12:00:54 +0530103endif
104
105ifdef CONFIG_COMMON_CLK_QCOM
Laxminath Kasam8b1366a2017-10-05 01:44:16 +0530106 WCD9XXX_OBJS += audio-ext-clk-up.o
107endif
108
Soumya Managoli91b8c3f2018-02-24 18:36:15 +0530109ifdef CONFIG_COMMON_CLK_MSM
110 WCD9XXX_OBJS += audio-ext-clk.o
111endif
112
Asish Bhattacharya5faacb32017-12-04 17:23:15 +0530113ifdef CONFIG_SND_SOC_WCD9335
Laxminath Kasam8b1366a2017-10-05 01:44:16 +0530114 WCD9335_OBJS += wcd9335.o
115endif
116
Asish Bhattacharya5faacb32017-12-04 17:23:15 +0530117ifdef CONFIG_SND_SOC_WSA881X
Laxminath Kasam8b1366a2017-10-05 01:44:16 +0530118 WSA881X_OBJS += wsa881x.o
119 WSA881X_OBJS += wsa881x-tables.o
120 WSA881X_OBJS += wsa881x-regmap.o
121 WSA881X_OBJS += wsa881x-temp-sensor.o
122endif
123
Soumya Managolieaff6622018-02-23 12:00:54 +0530124ifdef CONFIG_SND_SOC_WSA881X_ANALOG
125 WSA881X_ANALOG_OBJS += wsa881x-analog.o
126 WSA881X_ANALOG_OBJS += wsa881x-tables-analog.o
127 WSA881X_ANALOG_OBJS += wsa881x-regmap-analog.o
128endif
129
Asish Bhattacharya5faacb32017-12-04 17:23:15 +0530130ifdef CONFIG_SND_SOC_MSM_STUB
Laxminath Kasam8b1366a2017-10-05 01:44:16 +0530131 STUB_OBJS += msm_stub.o
132endif
Asish Bhattacharya5faacb32017-12-04 17:23:15 +0530133ifdef CONFIG_SND_SOC_WCD_SPI
Laxminath Kasam8b1366a2017-10-05 01:44:16 +0530134 SPI_OBJS += wcd-spi.o
135endif
136
Asish Bhattacharya5faacb32017-12-04 17:23:15 +0530137ifdef CONFIG_SND_SOC_WCD_CPE
Laxminath Kasam8b1366a2017-10-05 01:44:16 +0530138 WCD_CPE_OBJS += wcd_cpe_core.o
139 WCD_CPE_OBJS += wcd_cpe_services.o
140endif
141
Asish Bhattacharya5faacb32017-12-04 17:23:15 +0530142ifdef CONFIG_SND_SOC_WCD_MBHC
Laxminath Kasam8b1366a2017-10-05 01:44:16 +0530143 MBHC_OBJS += wcd-mbhc-v2.o
144endif
145
Asish Bhattacharya5faacb32017-12-04 17:23:15 +0530146ifdef CONFIG_SND_SOC_WCD_MBHC_ADC
Laxminath Kasam8b1366a2017-10-05 01:44:16 +0530147 MBHC_OBJS += wcd-mbhc-adc.o
148endif
149
Asish Bhattacharya5faacb32017-12-04 17:23:15 +0530150ifdef CONFIG_SND_SOC_WCD_MBHC_LEGACY
Laxminath Kasam8b1366a2017-10-05 01:44:16 +0530151 MBHC_OBJS += wcd-mbhc-legacy.o
152endif
153
Asish Bhattacharya5faacb32017-12-04 17:23:15 +0530154ifdef CONFIG_SND_SOC_MSM_HDMI_CODEC_RX
Laxminath Kasam8b1366a2017-10-05 01:44:16 +0530155 HDMICODEC_OBJS += msm_hdmi_codec_rx.o
156endif
157
158LINUX_INC += -Iinclude/linux
159
Asish Bhattacharya5faacb32017-12-04 17:23:15 +0530160INCS += $(COMMON_INC) \
Laxminath Kasam8b1366a2017-10-05 01:44:16 +0530161 $(UAPI_INC)
162
Laxminath Kasam8b1366a2017-10-05 01:44:16 +0530163
164EXTRA_CFLAGS += $(INCS)
165
166
167CDEFINES += -DANI_LITTLE_BYTE_ENDIAN \
168 -DANI_LITTLE_BIT_ENDIAN \
169 -DDOT11F_LITTLE_ENDIAN_HOST \
170 -DANI_COMPILER_TYPE_GCC \
171 -DANI_OS_TYPE_ANDROID=6 \
172 -DPTT_SOCK_SVC_ENABLE \
173 -Wall\
174 -Werror\
175 -D__linux__
176
177KBUILD_CPPFLAGS += $(CDEFINES)
178
179# Currently, for versions of gcc which support it, the kernel Makefile
180# is disabling the maybe-uninitialized warning. Re-enable it for the
181# AUDIO driver. Note that we must use EXTRA_CFLAGS here so that it
182# will override the kernel settings.
183ifeq ($(call cc-option-yn, -Wmaybe-uninitialized),y)
184EXTRA_CFLAGS += -Wmaybe-uninitialized
185endif
186#EXTRA_CFLAGS += -Wmissing-prototypes
187
188ifeq ($(call cc-option-yn, -Wheader-guard),y)
189EXTRA_CFLAGS += -Wheader-guard
190endif
191
192
Asish Bhattacharya5faacb32017-12-04 17:23:15 +0530193ifeq ($(KERNEL_BUILD), 0)
Sundara Vinayagam39838332018-05-23 12:04:25 +0530194KBUILD_EXTRA_SYMBOLS +=$(OUT)/obj/vendor/qcom/opensource/audio-kernel/ipc/Module.symvers
Laxminath Kasam8b1366a2017-10-05 01:44:16 +0530195KBUILD_EXTRA_SYMBOLS +=$(OUT)/obj/vendor/qcom/opensource/audio-kernel/dsp/Module.symvers
196KBUILD_EXTRA_SYMBOLS +=$(OUT)/obj/vendor/qcom/opensource/audio-kernel/soc/Module.symvers
Asish Bhattacharya5faacb32017-12-04 17:23:15 +0530197endif
198
199ifeq ($(KERNEL_BUILD), 1)
200 obj-y += wcd934x/
201 obj-y += sdm660_cdc/
202 obj-y += msm_sdw/
203endif
Laxminath Kasam8b1366a2017-10-05 01:44:16 +0530204# Module information used by KBuild framework
205obj-$(CONFIG_WCD9XXX_CODEC_CORE) += wcd_core_dlkm.o
206wcd_core_dlkm-y := $(CORE_OBJS)
207
208obj-$(CONFIG_SND_SOC_WCD9XXX_V2) += wcd9xxx_dlkm.o
209wcd9xxx_dlkm-y := $(WCD9XXX_OBJS)
210
211obj-$(CONFIG_SND_SOC_WCD9335) += wcd9335_dlkm.o
212wcd9335_dlkm-y := $(WCD9335_OBJS)
213
214obj-$(CONFIG_SND_SOC_WSA881X) += wsa881x_dlkm.o
215wsa881x_dlkm-y := $(WSA881X_OBJS)
216
Soumya Managolieaff6622018-02-23 12:00:54 +0530217obj-$(CONFIG_SND_SOC_WSA881X_ANALOG) += wsa881x_analog_dlkm.o
218wsa881x_analog_dlkm-y := $(WSA881X_ANALOG_OBJS)
219
Laxminath Kasam8b1366a2017-10-05 01:44:16 +0530220obj-$(CONFIG_SND_SOC_MSM_STUB) += stub_dlkm.o
221stub_dlkm-y := $(STUB_OBJS)
222
223obj-$(CONFIG_SND_SOC_WCD_CPE) += wcd_cpe_dlkm.o
224wcd_cpe_dlkm-y := $(WCD_CPE_OBJS)
225
226obj-$(CONFIG_SND_SOC_WCD_SPI) += wcd_spi_dlkm.o
227wcd_spi_dlkm-y := $(SPI_OBJS)
228
229obj-$(CONFIG_SND_SOC_WCD_MBHC) += mbhc_dlkm.o
230mbhc_dlkm-y := $(MBHC_OBJS)
231
232obj-$(CONFIG_SND_SOC_MSM_HDMI_CODEC_RX) += hdmi_dlkm.o
233hdmi_dlkm-y := $(HDMICODEC_OBJS)
234
235# inject some build related information
236DEFINES += -DBUILD_TIMESTAMP=\"$(shell date -u +'%Y-%m-%dT%H:%M:%SZ')\"