blob: 4fedbddcf460e35da8e2a90b4904274d36361e6f [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
Meng Wang19fa6de2018-12-20 11:25:47 +080012 AUDIO_BLD_DIR := $(shell pwd)/kernel/msm-4.19
Asish Bhattacharya5faacb32017-12-04 17:23:15 +053013 AUDIO_ROOT := $(AUDIO_BLD_DIR)/techpack/audio
14endif
15
16ifeq ($(KERNEL_BUILD), 0)
Banajit Goswamif58e5fc2018-04-11 14:10:09 -070017 ifeq ($(CONFIG_ARCH_SM8150), y)
Derek Chenc8940292019-03-14 10:26:41 -070018 ifdef CONFIG_SND_SOC_SA8155
19 include $(AUDIO_ROOT)/config/sa8155auto.conf
20 export
21 INCS += -include $(AUDIO_ROOT)/config/sa8155autoconf.h
22 else
23 include $(AUDIO_ROOT)/config/sm8150auto.conf
24 export
25 INCS += -include $(AUDIO_ROOT)/config/sm8150autoconf.h
26 endif
Meng Wang5fddb8d2018-01-23 16:56:56 +080027 endif
Meng Wangb0e04792018-09-27 18:46:44 +080028 ifeq ($(CONFIG_ARCH_KONA), y)
29 include $(AUDIO_ROOT)/config/konaauto.conf
Meng Wangb0e04792018-09-27 18:46:44 +080030 INCS += -include $(AUDIO_ROOT)/config/konaautoconf.h
31 endif
Vatsal Buchad284ff12019-04-01 15:34:50 +053032 ifeq ($(CONFIG_ARCH_LITO), y)
33 include $(AUDIO_ROOT)/config/litoauto.conf
34 export
35 INCS += -include $(AUDIO_ROOT)/config/litoautoconf.h
36 endif
Laxminath Kasamfdda2d82019-07-31 21:26:30 +053037 ifeq ($(CONFIG_ARCH_BENGAL), y)
Laxminath Kasam00f60ba2019-10-04 09:37:07 +053038 include $(AUDIO_ROOT)/config/bengalauto.conf
Laxminath Kasamfdda2d82019-07-31 21:26:30 +053039 export
Laxminath Kasam00f60ba2019-10-04 09:37:07 +053040 INCS += -include $(AUDIO_ROOT)/config/bengalautoconf.h
Laxminath Kasamfdda2d82019-07-31 21:26:30 +053041 endif
Salendarsingh Gaudad978892018-05-14 16:53:09 +053042 ifeq ($(CONFIG_ARCH_SM6150), y)
Erin Yan300664f2019-05-14 10:42:31 +080043 ifdef CONFIG_SND_SOC_SA6155
44 include $(AUDIO_ROOT)/config/sa6155auto.conf
45 export
46 INCS += -include $(AUDIO_ROOT)/config/sa6155autoconf.h
47 else
48 include $(AUDIO_ROOT)/config/sm6150auto.conf
49 export
50 INCS += -include $(AUDIO_ROOT)/config/sm6150autoconf.h
51 endif
Abhishek Arpure6d74b702018-04-05 13:50:25 +053052 endif
Hari Veerubhotladcab67c2018-10-14 17:08:35 +053053 ifeq ($(CONFIG_ARCH_TRINKET), y)
54 include $(AUDIO_ROOT)/config/sm6150auto.conf
55 export
56 INCS += -include $(AUDIO_ROOT)/config/sm6150autoconf.h
57 endif
Sudheer Papothie3842cf2018-03-31 02:27:42 +053058 ifeq ($(CONFIG_ARCH_SDMSHRIKE), y)
Derek Chen583e3bf2019-04-15 18:01:45 -070059 ifdef CONFIG_SND_SOC_SA8155
60 include $(AUDIO_ROOT)/config/sa8155auto.conf
61 export
62 INCS += -include $(AUDIO_ROOT)/config/sa8155autoconf.h
63 else
64 include $(AUDIO_ROOT)/config/sm8150auto.conf
65 export
66 INCS += -include $(AUDIO_ROOT)/config/sm8150autoconf.h
67 endif
Sudheer Papothie3842cf2018-03-31 02:27:42 +053068 endif
Mangesh Kunchamwar0bf1f572018-05-24 19:58:42 +053069 ifeq ($(CONFIG_ARCH_QCS405), y)
70 include $(AUDIO_ROOT)/config/qcs405auto.conf
71 export
72 INCS += -include $(AUDIO_ROOT)/config/qcs405autoconf.h
73 endif
Derek Chenc8940292019-03-14 10:26:41 -070074 ifeq ($(CONFIG_QTI_GVM), y)
75 include $(AUDIO_ROOT)/config/gvmauto.conf
76 export
77 INCS += -include $(AUDIO_ROOT)/config/gvmautoconf.h
78 endif
Soumya Managolia620a952020-06-11 12:14:46 +053079 ifeq ($(CONFIG_ARCH_SDM660), y)
80 include $(AUDIO_ROOT)/config/sdm660auto.conf
81 export
82 INCS += -include $(AUDIO_ROOT)/config/sdm660autoconf.h
83 endif
Laxminath Kasam8b1366a2017-10-05 01:44:16 +053084endif
85
Laxminath Kasam8b1366a2017-10-05 01:44:16 +053086# As per target team, build is done as follows:
87# Defconfig : build with default flags
88# Slub : defconfig + CONFIG_SLUB_DEBUG := y +
89# CONFIG_SLUB_DEBUG_ON := y + CONFIG_PAGE_POISONING := y
90# Perf : Using appropriate msmXXXX-perf_defconfig
91#
92# Shipment builds (user variants) should not have any debug feature
93# enabled. This is identified using 'TARGET_BUILD_VARIANT'. Slub builds
94# are identified using the CONFIG_SLUB_DEBUG_ON configuration. Since
95# there is no other way to identify defconfig builds, QTI internal
96# representation of perf builds (identified using the string 'perf'),
97# is used to identify if the build is a slub or defconfig one. This
98# way no critical debug feature will be enabled for perf and shipment
99# builds. Other OEMs are also protected using the TARGET_BUILD_VARIANT
100# config.
101
102############ UAPI ############
103UAPI_DIR := uapi
104UAPI_INC := -I$(AUDIO_ROOT)/include/$(UAPI_DIR)
105
106############ COMMON ############
107COMMON_DIR := include
108COMMON_INC := -I$(AUDIO_ROOT)/$(COMMON_DIR)
109
110############ SoC Modules ############
111
112# for pinctrl WCD driver
Asish Bhattacharya5faacb32017-12-04 17:23:15 +0530113ifdef CONFIG_PINCTRL_WCD
Laxminath Kasam8b1366a2017-10-05 01:44:16 +0530114 PINCTRL_WCD_OBJS += pinctrl-wcd.o
115endif
116
117# for pinctrl LPI driver
Asish Bhattacharya5faacb32017-12-04 17:23:15 +0530118ifdef CONFIG_PINCTRL_LPI
Laxminath Kasam8b1366a2017-10-05 01:44:16 +0530119 PINCTRL_LPI_OBJS += pinctrl-lpi.o
120endif
121
Soumya Managoli8d4f94c2020-07-01 17:05:03 +0530122# for pinctrl LPI legacy driver
123ifdef CONFIG_PINCTRL_LPI_LEGACY
124 PINCTRL_LPI_OBJS += pinctrl-lpi-legacy.o
125endif
126
Laxminath Kasam8b1366a2017-10-05 01:44:16 +0530127# for soundwire driver
Asish Bhattacharya5faacb32017-12-04 17:23:15 +0530128ifdef CONFIG_SOUNDWIRE_WCD_CTRL
Laxminath Kasam8b1366a2017-10-05 01:44:16 +0530129 SWR_CTRL_OBJS += swr-wcd-ctrl.o
130endif
131
Ramprasad Katkame80ab292018-06-13 07:00:59 +0530132# for new soundwire driver
133ifdef CONFIG_SOUNDWIRE_MSTR_CTRL
134 SWR_CTRL_OBJS += swr-mstr-ctrl.o
135endif
136
Asish Bhattacharya5faacb32017-12-04 17:23:15 +0530137ifdef CONFIG_SOUNDWIRE
Laxminath Kasam8b1366a2017-10-05 01:44:16 +0530138 SWR_OBJS += regmap-swr.o
139 SWR_OBJS += soundwire.o
140endif
141
Banajit Goswami06183682018-07-31 00:31:14 -0700142ifdef CONFIG_SND_EVENT
143 SND_EVENT_OBJS += snd_event.o
144endif
145
Bhalchandra Gajarec77b19f2018-03-09 17:22:33 -0800146ifdef CONFIG_WCD_SPI_AC
147 WCD_SPI_ACC_CTL_OBJS += wcd-spi-ac.o
148 WCD_SPI_ACC_CTL_OBJS += wcd_spi_ctl_v01.o
149endif
150
Laxminath Kasam8b1366a2017-10-05 01:44:16 +0530151LINUX_INC += -Iinclude/linux
152
Asish Bhattacharya5faacb32017-12-04 17:23:15 +0530153INCS += $(COMMON_INC) \
Laxminath Kasam8b1366a2017-10-05 01:44:16 +0530154 $(UAPI_INC)
155
Laxminath Kasam8b1366a2017-10-05 01:44:16 +0530156EXTRA_CFLAGS += $(INCS)
157
158
159CDEFINES += -DANI_LITTLE_BYTE_ENDIAN \
160 -DANI_LITTLE_BIT_ENDIAN \
161 -DDOT11F_LITTLE_ENDIAN_HOST \
162 -DANI_COMPILER_TYPE_GCC \
163 -DANI_OS_TYPE_ANDROID=6 \
164 -DPTT_SOCK_SVC_ENABLE \
165 -Wall\
166 -Werror\
167 -D__linux__
168
169KBUILD_CPPFLAGS += $(CDEFINES)
170
Asish Bhattacharya5faacb32017-12-04 17:23:15 +0530171ifeq ($(KERNEL_BUILD), 0)
Meng Wange61ddb02018-03-07 11:18:35 +0800172KBUILD_EXTRA_SYMBOLS +=$(OUT)/obj/vendor/qcom/opensource/audio-kernel/dsp/Module.symvers
Asish Bhattacharya5faacb32017-12-04 17:23:15 +0530173endif
174
Laxminath Kasam8b1366a2017-10-05 01:44:16 +0530175# Currently, for versions of gcc which support it, the kernel Makefile
176# is disabling the maybe-uninitialized warning. Re-enable it for the
177# AUDIO driver. Note that we must use EXTRA_CFLAGS here so that it
178# will override the kernel settings.
179ifeq ($(call cc-option-yn, -Wmaybe-uninitialized),y)
180EXTRA_CFLAGS += -Wmaybe-uninitialized
181endif
182#EXTRA_CFLAGS += -Wmissing-prototypes
183
184ifeq ($(call cc-option-yn, -Wheader-guard),y)
185EXTRA_CFLAGS += -Wheader-guard
186endif
187
Vatsal Buchad4b85ec2018-08-23 12:50:46 +0530188ifeq ($(CONFIG_SND_SOC_GCOV), y)
189GCOV_PROFILE := y
190endif
191
Laxminath Kasam8b1366a2017-10-05 01:44:16 +0530192# Module information used by KBuild framework
193obj-$(CONFIG_PINCTRL_WCD) += pinctrl_wcd_dlkm.o
194pinctrl_wcd_dlkm-y := $(PINCTRL_WCD_OBJS)
195
196obj-$(CONFIG_PINCTRL_LPI) += pinctrl_lpi_dlkm.o
197pinctrl_lpi_dlkm-y := $(PINCTRL_LPI_OBJS)
198
Soumya Managoli8d4f94c2020-07-01 17:05:03 +0530199obj-$(CONFIG_PINCTRL_LPI_LEGACY) += pinctrl_lpi_dlkm.o
200pinctrl_lpi_dlkm-y := $(PINCTRL_LPI_OBJS)
201
Laxminath Kasam8b1366a2017-10-05 01:44:16 +0530202obj-$(CONFIG_SOUNDWIRE) += swr_dlkm.o
203swr_dlkm-y := $(SWR_OBJS)
204
Banajit Goswami06183682018-07-31 00:31:14 -0700205obj-$(CONFIG_SND_EVENT) += snd_event_dlkm.o
206snd_event_dlkm-y := $(SND_EVENT_OBJS)
207
Laxminath Kasam8b1366a2017-10-05 01:44:16 +0530208obj-$(CONFIG_SOUNDWIRE_WCD_CTRL) += swr_ctrl_dlkm.o
Laxminath Kasamfbcaf322018-07-18 00:38:14 +0530209obj-$(CONFIG_SOUNDWIRE_MSTR_CTRL) += swr_ctrl_dlkm.o
Laxminath Kasam8b1366a2017-10-05 01:44:16 +0530210swr_ctrl_dlkm-y := $(SWR_CTRL_OBJS)
211
Bhalchandra Gajarec77b19f2018-03-09 17:22:33 -0800212obj-$(CONFIG_WCD_SPI_AC) += wcd_spi_acc_ctl_dlkm.o
213wcd_spi_acc_ctl_dlkm-y := $(WCD_SPI_ACC_CTL_OBJS)
214
Laxminath Kasam8b1366a2017-10-05 01:44:16 +0530215# inject some build related information
216DEFINES += -DBUILD_TIMESTAMP=\"$(shell date -u +'%Y-%m-%dT%H:%M:%SZ')\"