blob: 005a68cd4a9ec05f51d6d15a62c0041fd81b303a [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
Asish Bhattacharya5faacb32017-12-04 17:23:15 +053012 AUDIO_BLD_DIR := $(ANDROID_BUILD_TOP)/kernel/msm-4.9
13 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)
23 include $(AUDIO_ROOT)/config/sdm670auto.conf
24 export
Asish Bhattacharya5faacb32017-12-04 17:23:15 +053025 INCS += -include $(AUDIO_ROOT)/config/sdm670autoconf.h
Laxminath Kasam8b1366a2017-10-05 01:44:16 +053026 endif
Laxminath Kasam942d1c62017-12-29 11:02:22 +053027 ifeq ($(CONFIG_ARCH_SDM450), y)
28 include $(AUDIO_ROOT)/config/sdm670auto.conf
29 export
30 INCS += -include $(AUDIO_ROOT)/config/sdm670autoconf.h
31 endif
Laxminath Kasam8b1366a2017-10-05 01:44:16 +053032endif
33
Laxminath Kasam8b1366a2017-10-05 01:44:16 +053034# As per target team, build is done as follows:
35# Defconfig : build with default flags
36# Slub : defconfig + CONFIG_SLUB_DEBUG := y +
37# CONFIG_SLUB_DEBUG_ON := y + CONFIG_PAGE_POISONING := y
38# Perf : Using appropriate msmXXXX-perf_defconfig
39#
40# Shipment builds (user variants) should not have any debug feature
41# enabled. This is identified using 'TARGET_BUILD_VARIANT'. Slub builds
42# are identified using the CONFIG_SLUB_DEBUG_ON configuration. Since
43# there is no other way to identify defconfig builds, QTI internal
44# representation of perf builds (identified using the string 'perf'),
45# is used to identify if the build is a slub or defconfig one. This
46# way no critical debug feature will be enabled for perf and shipment
47# builds. Other OEMs are also protected using the TARGET_BUILD_VARIANT
48# config.
49
50############ UAPI ############
51UAPI_DIR := uapi
52UAPI_INC := -I$(AUDIO_ROOT)/include/$(UAPI_DIR)
53
54############ COMMON ############
55COMMON_DIR := include
56COMMON_INC := -I$(AUDIO_ROOT)/$(COMMON_DIR)
57
58############ ASoC Codecs ############
Asish Bhattacharya5faacb32017-12-04 17:23:15 +053059ifdef CONFIG_WCD9XXX_CODEC_CORE
Laxminath Kasam8b1366a2017-10-05 01:44:16 +053060 CORE_OBJS += wcd9xxx-rst.o
61 CORE_OBJS += wcd9xxx-core-init.o
62 CORE_OBJS += wcd9xxx-core.o
63 CORE_OBJS += wcd9xxx-irq.o
64 CORE_OBJS += wcd9xxx-slimslave.o
65 CORE_OBJS += wcd9xxx-utils.o
66 CORE_OBJS += wcd9335-regmap.o
67 CORE_OBJS += wcd9335-tables.o
68 CORE_OBJS += msm-cdc-pinctrl.o
69 CORE_OBJS += msm-cdc-supply.o
70 CORE_OBJS += wcd934x/wcd934x-regmap.o
71 CORE_OBJS += wcd934x/wcd934x-tables.o
72endif
73
Asish Bhattacharya5faacb32017-12-04 17:23:15 +053074ifdef CONFIG_SND_SOC_WCD9XXX_V2
Laxminath Kasam8b1366a2017-10-05 01:44:16 +053075 WCD9XXX_OBJS += wcd9xxx-common-v2.o
76 WCD9XXX_OBJS += wcd9xxx-resmgr-v2.o
77 WCD9XXX_OBJS += wcdcal-hwdep.o
78 WCD9XXX_OBJS += wcd9xxx-soc-init.o
79 WCD9XXX_OBJS += wcd-dsp-utils.o
80 WCD9XXX_OBJS += wcd-dsp-mgr.o
81 WCD9XXX_OBJS += audio-ext-clk-up.o
82endif
83
Asish Bhattacharya5faacb32017-12-04 17:23:15 +053084ifdef CONFIG_SND_SOC_WCD9335
Laxminath Kasam8b1366a2017-10-05 01:44:16 +053085 WCD9335_OBJS += wcd9335.o
86endif
87
Asish Bhattacharya5faacb32017-12-04 17:23:15 +053088ifdef CONFIG_SND_SOC_WSA881X
Laxminath Kasam8b1366a2017-10-05 01:44:16 +053089 WSA881X_OBJS += wsa881x.o
90 WSA881X_OBJS += wsa881x-tables.o
91 WSA881X_OBJS += wsa881x-regmap.o
92 WSA881X_OBJS += wsa881x-temp-sensor.o
93endif
94
Asish Bhattacharya5faacb32017-12-04 17:23:15 +053095ifdef CONFIG_SND_SOC_MSM_STUB
Laxminath Kasam8b1366a2017-10-05 01:44:16 +053096 STUB_OBJS += msm_stub.o
97endif
Asish Bhattacharya5faacb32017-12-04 17:23:15 +053098ifdef CONFIG_SND_SOC_WCD_SPI
Laxminath Kasam8b1366a2017-10-05 01:44:16 +053099 SPI_OBJS += wcd-spi.o
100endif
101
Asish Bhattacharya5faacb32017-12-04 17:23:15 +0530102ifdef CONFIG_SND_SOC_WCD_CPE
Laxminath Kasam8b1366a2017-10-05 01:44:16 +0530103 WCD_CPE_OBJS += wcd_cpe_core.o
104 WCD_CPE_OBJS += wcd_cpe_services.o
105endif
106
Asish Bhattacharya5faacb32017-12-04 17:23:15 +0530107ifdef CONFIG_SND_SOC_WCD_MBHC
Laxminath Kasam8b1366a2017-10-05 01:44:16 +0530108 MBHC_OBJS += wcd-mbhc-v2.o
109endif
110
Asish Bhattacharya5faacb32017-12-04 17:23:15 +0530111ifdef CONFIG_SND_SOC_WCD_MBHC_ADC
Laxminath Kasam8b1366a2017-10-05 01:44:16 +0530112 MBHC_OBJS += wcd-mbhc-adc.o
113endif
114
Asish Bhattacharya5faacb32017-12-04 17:23:15 +0530115ifdef CONFIG_SND_SOC_WCD_MBHC_LEGACY
Laxminath Kasam8b1366a2017-10-05 01:44:16 +0530116 MBHC_OBJS += wcd-mbhc-legacy.o
117endif
118
Asish Bhattacharya5faacb32017-12-04 17:23:15 +0530119ifdef CONFIG_SND_SOC_MSM_HDMI_CODEC_RX
Laxminath Kasam8b1366a2017-10-05 01:44:16 +0530120 HDMICODEC_OBJS += msm_hdmi_codec_rx.o
121endif
122
123LINUX_INC += -Iinclude/linux
124
Asish Bhattacharya5faacb32017-12-04 17:23:15 +0530125INCS += $(COMMON_INC) \
Laxminath Kasam8b1366a2017-10-05 01:44:16 +0530126 $(UAPI_INC)
127
Laxminath Kasam8b1366a2017-10-05 01:44:16 +0530128
129EXTRA_CFLAGS += $(INCS)
130
131
132CDEFINES += -DANI_LITTLE_BYTE_ENDIAN \
133 -DANI_LITTLE_BIT_ENDIAN \
134 -DDOT11F_LITTLE_ENDIAN_HOST \
135 -DANI_COMPILER_TYPE_GCC \
136 -DANI_OS_TYPE_ANDROID=6 \
137 -DPTT_SOCK_SVC_ENABLE \
138 -Wall\
139 -Werror\
140 -D__linux__
141
142KBUILD_CPPFLAGS += $(CDEFINES)
143
144# Currently, for versions of gcc which support it, the kernel Makefile
145# is disabling the maybe-uninitialized warning. Re-enable it for the
146# AUDIO driver. Note that we must use EXTRA_CFLAGS here so that it
147# will override the kernel settings.
148ifeq ($(call cc-option-yn, -Wmaybe-uninitialized),y)
149EXTRA_CFLAGS += -Wmaybe-uninitialized
150endif
151#EXTRA_CFLAGS += -Wmissing-prototypes
152
153ifeq ($(call cc-option-yn, -Wheader-guard),y)
154EXTRA_CFLAGS += -Wheader-guard
155endif
156
157
Asish Bhattacharya5faacb32017-12-04 17:23:15 +0530158ifeq ($(KERNEL_BUILD), 0)
Laxminath Kasam8b1366a2017-10-05 01:44:16 +0530159KBUILD_EXTRA_SYMBOLS +=$(OUT)/obj/vendor/qcom/opensource/audio-kernel/dsp/Module.symvers
160KBUILD_EXTRA_SYMBOLS +=$(OUT)/obj/vendor/qcom/opensource/audio-kernel/soc/Module.symvers
Asish Bhattacharya5faacb32017-12-04 17:23:15 +0530161endif
162
163ifeq ($(KERNEL_BUILD), 1)
164 obj-y += wcd934x/
165 obj-y += sdm660_cdc/
166 obj-y += msm_sdw/
167endif
Laxminath Kasam8b1366a2017-10-05 01:44:16 +0530168# Module information used by KBuild framework
169obj-$(CONFIG_WCD9XXX_CODEC_CORE) += wcd_core_dlkm.o
170wcd_core_dlkm-y := $(CORE_OBJS)
171
172obj-$(CONFIG_SND_SOC_WCD9XXX_V2) += wcd9xxx_dlkm.o
173wcd9xxx_dlkm-y := $(WCD9XXX_OBJS)
174
175obj-$(CONFIG_SND_SOC_WCD9335) += wcd9335_dlkm.o
176wcd9335_dlkm-y := $(WCD9335_OBJS)
177
178obj-$(CONFIG_SND_SOC_WSA881X) += wsa881x_dlkm.o
179wsa881x_dlkm-y := $(WSA881X_OBJS)
180
181obj-$(CONFIG_SND_SOC_MSM_STUB) += stub_dlkm.o
182stub_dlkm-y := $(STUB_OBJS)
183
184obj-$(CONFIG_SND_SOC_WCD_CPE) += wcd_cpe_dlkm.o
185wcd_cpe_dlkm-y := $(WCD_CPE_OBJS)
186
187obj-$(CONFIG_SND_SOC_WCD_SPI) += wcd_spi_dlkm.o
188wcd_spi_dlkm-y := $(SPI_OBJS)
189
190obj-$(CONFIG_SND_SOC_WCD_MBHC) += mbhc_dlkm.o
191mbhc_dlkm-y := $(MBHC_OBJS)
192
193obj-$(CONFIG_SND_SOC_MSM_HDMI_CODEC_RX) += hdmi_dlkm.o
194hdmi_dlkm-y := $(HDMICODEC_OBJS)
195
196# inject some build related information
197DEFINES += -DBUILD_TIMESTAMP=\"$(shell date -u +'%Y-%m-%dT%H:%M:%SZ')\"