blob: 6a9f4e593671d519423f8e0619b6eaf428c44304 [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
Derek Chenc8940292019-03-14 10:26:41 -070020 INCS += -include $(AUDIO_ROOT)/config/sa8155autoconf.h
21 else
22 include $(AUDIO_ROOT)/config/sm8150auto.conf
Derek Chenc8940292019-03-14 10:26:41 -070023 INCS += -include $(AUDIO_ROOT)/config/sm8150autoconf.h
24 endif
Meng Wang5fddb8d2018-01-23 16:56:56 +080025 endif
Meng Wangb0e04792018-09-27 18:46:44 +080026 ifeq ($(CONFIG_ARCH_KONA), y)
27 include $(AUDIO_ROOT)/config/konaauto.conf
Meng Wangb0e04792018-09-27 18:46:44 +080028 INCS += -include $(AUDIO_ROOT)/config/konaautoconf.h
29 endif
Vatsal Buchad284ff12019-04-01 15:34:50 +053030 ifeq ($(CONFIG_ARCH_LITO), y)
31 include $(AUDIO_ROOT)/config/litoauto.conf
Vatsal Buchad284ff12019-04-01 15:34:50 +053032 INCS += -include $(AUDIO_ROOT)/config/litoautoconf.h
33 endif
Laxminath Kasamfdda2d82019-07-31 21:26:30 +053034 ifeq ($(CONFIG_ARCH_BENGAL), y)
Laxminath Kasam00f60ba2019-10-04 09:37:07 +053035 include $(AUDIO_ROOT)/config/bengalauto.conf
Laxminath Kasam00f60ba2019-10-04 09:37:07 +053036 INCS += -include $(AUDIO_ROOT)/config/bengalautoconf.h
Laxminath Kasamfdda2d82019-07-31 21:26:30 +053037 endif
Salendarsingh Gaudad978892018-05-14 16:53:09 +053038 ifeq ($(CONFIG_ARCH_SM6150), y)
Erin Yan300664f2019-05-14 10:42:31 +080039 ifdef CONFIG_SND_SOC_SA6155
40 include $(AUDIO_ROOT)/config/sa6155auto.conf
Erin Yan300664f2019-05-14 10:42:31 +080041 INCS += -include $(AUDIO_ROOT)/config/sa6155autoconf.h
42 else
43 include $(AUDIO_ROOT)/config/sm6150auto.conf
Erin Yan300664f2019-05-14 10:42:31 +080044 INCS += -include $(AUDIO_ROOT)/config/sm6150autoconf.h
45 endif
Abhishek Arpure6d74b702018-04-05 13:50:25 +053046 endif
Hari Veerubhotladcab67c2018-10-14 17:08:35 +053047 ifeq ($(CONFIG_ARCH_TRINKET), y)
48 include $(AUDIO_ROOT)/config/sm6150auto.conf
Hari Veerubhotladcab67c2018-10-14 17:08:35 +053049 INCS += -include $(AUDIO_ROOT)/config/sm6150autoconf.h
50 endif
Sudheer Papothie3842cf2018-03-31 02:27:42 +053051 ifeq ($(CONFIG_ARCH_SDMSHRIKE), y)
Derek Chen583e3bf2019-04-15 18:01:45 -070052 ifdef CONFIG_SND_SOC_SA8155
53 include $(AUDIO_ROOT)/config/sa8155auto.conf
Derek Chen583e3bf2019-04-15 18:01:45 -070054 INCS += -include $(AUDIO_ROOT)/config/sa8155autoconf.h
55 else
56 include $(AUDIO_ROOT)/config/sm8150auto.conf
Derek Chen583e3bf2019-04-15 18:01:45 -070057 INCS += -include $(AUDIO_ROOT)/config/sm8150autoconf.h
58 endif
Sudheer Papothie3842cf2018-03-31 02:27:42 +053059 endif
Mangesh Kunchamwar0bf1f572018-05-24 19:58:42 +053060 ifeq ($(CONFIG_ARCH_QCS405), y)
61 include $(AUDIO_ROOT)/config/qcs405auto.conf
Mangesh Kunchamwar0bf1f572018-05-24 19:58:42 +053062 INCS += -include $(AUDIO_ROOT)/config/qcs405autoconf.h
63 endif
Derek Chenc8940292019-03-14 10:26:41 -070064 ifeq ($(CONFIG_QTI_GVM), y)
65 include $(AUDIO_ROOT)/config/gvmauto.conf
Derek Chenc8940292019-03-14 10:26:41 -070066 INCS += -include $(AUDIO_ROOT)/config/gvmautoconf.h
67 endif
Soumya Managolia620a952020-06-11 12:14:46 +053068 ifeq ($(CONFIG_ARCH_SDM660), y)
69 include $(AUDIO_ROOT)/config/sdm660auto.conf
Soumya Managolia620a952020-06-11 12:14:46 +053070 INCS += -include $(AUDIO_ROOT)/config/sdm660autoconf.h
71 endif
Laxminath Kasam8b1366a2017-10-05 01:44:16 +053072endif
73
Laxminath Kasam8b1366a2017-10-05 01:44:16 +053074# As per target team, build is done as follows:
75# Defconfig : build with default flags
76# Slub : defconfig + CONFIG_SLUB_DEBUG := y +
77# CONFIG_SLUB_DEBUG_ON := y + CONFIG_PAGE_POISONING := y
78# Perf : Using appropriate msmXXXX-perf_defconfig
79#
80# Shipment builds (user variants) should not have any debug feature
81# enabled. This is identified using 'TARGET_BUILD_VARIANT'. Slub builds
82# are identified using the CONFIG_SLUB_DEBUG_ON configuration. Since
83# there is no other way to identify defconfig builds, QTI internal
84# representation of perf builds (identified using the string 'perf'),
85# is used to identify if the build is a slub or defconfig one. This
86# way no critical debug feature will be enabled for perf and shipment
87# builds. Other OEMs are also protected using the TARGET_BUILD_VARIANT
88# config.
89
90############ UAPI ############
91UAPI_DIR := uapi
92UAPI_INC := -I$(AUDIO_ROOT)/include/$(UAPI_DIR)
93
94############ COMMON ############
95COMMON_DIR := include
96COMMON_INC := -I$(AUDIO_ROOT)/$(COMMON_DIR)
97
98############ SoC Modules ############
99
100# for pinctrl WCD driver
Asish Bhattacharya5faacb32017-12-04 17:23:15 +0530101ifdef CONFIG_PINCTRL_WCD
Laxminath Kasam8b1366a2017-10-05 01:44:16 +0530102 PINCTRL_WCD_OBJS += pinctrl-wcd.o
103endif
104
105# for pinctrl LPI driver
Asish Bhattacharya5faacb32017-12-04 17:23:15 +0530106ifdef CONFIG_PINCTRL_LPI
Laxminath Kasam8b1366a2017-10-05 01:44:16 +0530107 PINCTRL_LPI_OBJS += pinctrl-lpi.o
108endif
109
Soumya Managoli8d4f94c2020-07-01 17:05:03 +0530110# for pinctrl LPI legacy driver
111ifdef CONFIG_PINCTRL_LPI_LEGACY
112 PINCTRL_LPI_OBJS += pinctrl-lpi-legacy.o
113endif
114
Laxminath Kasam8b1366a2017-10-05 01:44:16 +0530115# for soundwire driver
Asish Bhattacharya5faacb32017-12-04 17:23:15 +0530116ifdef CONFIG_SOUNDWIRE_WCD_CTRL
Laxminath Kasam8b1366a2017-10-05 01:44:16 +0530117 SWR_CTRL_OBJS += swr-wcd-ctrl.o
118endif
119
Ramprasad Katkame80ab292018-06-13 07:00:59 +0530120# for new soundwire driver
121ifdef CONFIG_SOUNDWIRE_MSTR_CTRL
122 SWR_CTRL_OBJS += swr-mstr-ctrl.o
123endif
124
Asish Bhattacharya5faacb32017-12-04 17:23:15 +0530125ifdef CONFIG_SOUNDWIRE
Laxminath Kasam8b1366a2017-10-05 01:44:16 +0530126 SWR_OBJS += regmap-swr.o
127 SWR_OBJS += soundwire.o
128endif
129
Banajit Goswami06183682018-07-31 00:31:14 -0700130ifdef CONFIG_SND_EVENT
131 SND_EVENT_OBJS += snd_event.o
132endif
133
Bhalchandra Gajarec77b19f2018-03-09 17:22:33 -0800134ifdef CONFIG_WCD_SPI_AC
135 WCD_SPI_ACC_CTL_OBJS += wcd-spi-ac.o
136 WCD_SPI_ACC_CTL_OBJS += wcd_spi_ctl_v01.o
137endif
138
Laxminath Kasam8b1366a2017-10-05 01:44:16 +0530139LINUX_INC += -Iinclude/linux
140
Asish Bhattacharya5faacb32017-12-04 17:23:15 +0530141INCS += $(COMMON_INC) \
Laxminath Kasam8b1366a2017-10-05 01:44:16 +0530142 $(UAPI_INC)
143
Laxminath Kasam8b1366a2017-10-05 01:44:16 +0530144EXTRA_CFLAGS += $(INCS)
145
146
147CDEFINES += -DANI_LITTLE_BYTE_ENDIAN \
148 -DANI_LITTLE_BIT_ENDIAN \
149 -DDOT11F_LITTLE_ENDIAN_HOST \
150 -DANI_COMPILER_TYPE_GCC \
151 -DANI_OS_TYPE_ANDROID=6 \
152 -DPTT_SOCK_SVC_ENABLE \
153 -Wall\
Laxminath Kasam8b1366a2017-10-05 01:44:16 +0530154 -D__linux__
155
156KBUILD_CPPFLAGS += $(CDEFINES)
157
Asish Bhattacharya5faacb32017-12-04 17:23:15 +0530158ifeq ($(KERNEL_BUILD), 0)
Meng Wange61ddb02018-03-07 11:18:35 +0800159KBUILD_EXTRA_SYMBOLS +=$(OUT)/obj/vendor/qcom/opensource/audio-kernel/dsp/Module.symvers
Asish Bhattacharya5faacb32017-12-04 17:23:15 +0530160endif
161
Laxminath Kasam8b1366a2017-10-05 01:44:16 +0530162# Currently, for versions of gcc which support it, the kernel Makefile
163# is disabling the maybe-uninitialized warning. Re-enable it for the
164# AUDIO driver. Note that we must use EXTRA_CFLAGS here so that it
165# will override the kernel settings.
166ifeq ($(call cc-option-yn, -Wmaybe-uninitialized),y)
167EXTRA_CFLAGS += -Wmaybe-uninitialized
168endif
169#EXTRA_CFLAGS += -Wmissing-prototypes
170
171ifeq ($(call cc-option-yn, -Wheader-guard),y)
172EXTRA_CFLAGS += -Wheader-guard
173endif
174
Vatsal Buchad4b85ec2018-08-23 12:50:46 +0530175ifeq ($(CONFIG_SND_SOC_GCOV), y)
176GCOV_PROFILE := y
177endif
178
Laxminath Kasam8b1366a2017-10-05 01:44:16 +0530179# Module information used by KBuild framework
180obj-$(CONFIG_PINCTRL_WCD) += pinctrl_wcd_dlkm.o
181pinctrl_wcd_dlkm-y := $(PINCTRL_WCD_OBJS)
182
183obj-$(CONFIG_PINCTRL_LPI) += pinctrl_lpi_dlkm.o
184pinctrl_lpi_dlkm-y := $(PINCTRL_LPI_OBJS)
185
Soumya Managoli8d4f94c2020-07-01 17:05:03 +0530186obj-$(CONFIG_PINCTRL_LPI_LEGACY) += pinctrl_lpi_dlkm.o
187pinctrl_lpi_dlkm-y := $(PINCTRL_LPI_OBJS)
188
Laxminath Kasam8b1366a2017-10-05 01:44:16 +0530189obj-$(CONFIG_SOUNDWIRE) += swr_dlkm.o
190swr_dlkm-y := $(SWR_OBJS)
191
Banajit Goswami06183682018-07-31 00:31:14 -0700192obj-$(CONFIG_SND_EVENT) += snd_event_dlkm.o
193snd_event_dlkm-y := $(SND_EVENT_OBJS)
194
Laxminath Kasam8b1366a2017-10-05 01:44:16 +0530195obj-$(CONFIG_SOUNDWIRE_WCD_CTRL) += swr_ctrl_dlkm.o
Laxminath Kasamfbcaf322018-07-18 00:38:14 +0530196obj-$(CONFIG_SOUNDWIRE_MSTR_CTRL) += swr_ctrl_dlkm.o
Laxminath Kasam8b1366a2017-10-05 01:44:16 +0530197swr_ctrl_dlkm-y := $(SWR_CTRL_OBJS)
198
Bhalchandra Gajarec77b19f2018-03-09 17:22:33 -0800199obj-$(CONFIG_WCD_SPI_AC) += wcd_spi_acc_ctl_dlkm.o
200wcd_spi_acc_ctl_dlkm-y := $(WCD_SPI_ACC_CTL_OBJS)