Laxminath Kasam | 8b1366a | 2017-10-05 01:44:16 +0530 | [diff] [blame] | 1 | # We can build either as part of a standalone Kernel build or as |
| 2 | # an external module. Determine which mechanism is being used |
Asish Bhattacharya | 5faacb3 | 2017-12-04 17:23:15 +0530 | [diff] [blame] | 3 | ifeq ($(MODNAME),) |
| 4 | KERNEL_BUILD := 1 |
| 5 | else |
| 6 | KERNEL_BUILD := 0 |
| 7 | endif |
Laxminath Kasam | 8b1366a | 2017-10-05 01:44:16 +0530 | [diff] [blame] | 8 | |
Asish Bhattacharya | 5faacb3 | 2017-12-04 17:23:15 +0530 | [diff] [blame] | 9 | ifeq ($(KERNEL_BUILD), 1) |
Laxminath Kasam | 8b1366a | 2017-10-05 01:44:16 +0530 | [diff] [blame] | 10 | # These are configurable via Kconfig for kernel-based builds |
| 11 | # Need to explicitly configure for Android-based builds |
Piyush Balwani | 677fa73 | 2018-11-30 19:13:42 +0530 | [diff] [blame] | 12 | AUDIO_BLD_DIR := $(shell pwd)/kernel/msm-4.9 |
Asish Bhattacharya | 5faacb3 | 2017-12-04 17:23:15 +0530 | [diff] [blame] | 13 | AUDIO_ROOT := $(AUDIO_BLD_DIR)/techpack/audio |
| 14 | endif |
| 15 | |
| 16 | ifeq ($(KERNEL_BUILD), 0) |
Laxminath Kasam | 8b1366a | 2017-10-05 01:44:16 +0530 | [diff] [blame] | 17 | ifeq ($(CONFIG_ARCH_SDM845), y) |
| 18 | include $(AUDIO_ROOT)/config/sdm845auto.conf |
| 19 | export |
Asish Bhattacharya | 5faacb3 | 2017-12-04 17:23:15 +0530 | [diff] [blame] | 20 | INCS += -include $(AUDIO_ROOT)/config/sdm845autoconf.h |
Laxminath Kasam | 8b1366a | 2017-10-05 01:44:16 +0530 | [diff] [blame] | 21 | endif |
| 22 | ifeq ($(CONFIG_ARCH_SDM670), y) |
Aditya Bavanari | 68d3ed8 | 2018-04-08 14:34:47 +0530 | [diff] [blame] | 23 | include $(AUDIO_ROOT)/config/sdm710auto.conf |
Laxminath Kasam | 8b1366a | 2017-10-05 01:44:16 +0530 | [diff] [blame] | 24 | export |
Aditya Bavanari | 68d3ed8 | 2018-04-08 14:34:47 +0530 | [diff] [blame] | 25 | INCS += -include $(AUDIO_ROOT)/config/sdm710autoconf.h |
Laxminath Kasam | 8b1366a | 2017-10-05 01:44:16 +0530 | [diff] [blame] | 26 | endif |
Laxminath Kasam | 942d1c6 | 2017-12-29 11:02:22 +0530 | [diff] [blame] | 27 | ifeq ($(CONFIG_ARCH_SDM450), y) |
Soumya Managoli | eaff662 | 2018-02-23 12:00:54 +0530 | [diff] [blame] | 28 | include $(AUDIO_ROOT)/config/sdm450auto.conf |
Laxminath Kasam | 942d1c6 | 2017-12-29 11:02:22 +0530 | [diff] [blame] | 29 | export |
Soumya Managoli | eaff662 | 2018-02-23 12:00:54 +0530 | [diff] [blame] | 30 | INCS += -include $(AUDIO_ROOT)/config/sdm450autoconf.h |
Laxminath Kasam | 942d1c6 | 2017-12-29 11:02:22 +0530 | [diff] [blame] | 31 | endif |
Vaishnavi Kommaraju | 59562a1 | 2018-04-25 19:33:46 +0530 | [diff] [blame] | 32 | 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 Vinayagam | 3983833 | 2018-05-23 12:04:25 +0530 | [diff] [blame] | 37 | ifeq ($(CONFIG_ARCH_MSM8909), y) |
| 38 | include $(AUDIO_ROOT)/config/msm8909auto.conf |
| 39 | export |
| 40 | INCS += -include $(AUDIO_ROOT)/config/msm8909autoconf.h |
| 41 | endif |
Soumya Managoli | d63fb8e | 2018-05-08 17:28:01 +0530 | [diff] [blame] | 42 | ifeq ($(CONFIG_ARCH_MSM8917), y) |
| 43 | include $(AUDIO_ROOT)/config/sdm450auto.conf |
| 44 | export |
| 45 | INCS += -include $(AUDIO_ROOT)/config/sdm450autoconf.h |
| 46 | endif |
Laxminath Kasam | 8b1366a | 2017-10-05 01:44:16 +0530 | [diff] [blame] | 47 | endif |
| 48 | |
Laxminath Kasam | 8b1366a | 2017-10-05 01:44:16 +0530 | [diff] [blame] | 49 | # As per target team, build is done as follows: |
| 50 | # Defconfig : build with default flags |
| 51 | # Slub : defconfig + CONFIG_SLUB_DEBUG := y + |
| 52 | # CONFIG_SLUB_DEBUG_ON := y + CONFIG_PAGE_POISONING := y |
| 53 | # Perf : Using appropriate msmXXXX-perf_defconfig |
| 54 | # |
| 55 | # Shipment builds (user variants) should not have any debug feature |
| 56 | # enabled. This is identified using 'TARGET_BUILD_VARIANT'. Slub builds |
| 57 | # are identified using the CONFIG_SLUB_DEBUG_ON configuration. Since |
| 58 | # there is no other way to identify defconfig builds, QTI internal |
| 59 | # representation of perf builds (identified using the string 'perf'), |
| 60 | # is used to identify if the build is a slub or defconfig one. This |
| 61 | # way no critical debug feature will be enabled for perf and shipment |
| 62 | # builds. Other OEMs are also protected using the TARGET_BUILD_VARIANT |
| 63 | # config. |
| 64 | |
| 65 | ############ UAPI ############ |
| 66 | UAPI_DIR := uapi |
| 67 | UAPI_INC := -I$(AUDIO_ROOT)/include/$(UAPI_DIR) |
| 68 | |
| 69 | ############ COMMON ############ |
| 70 | COMMON_DIR := include |
| 71 | COMMON_INC := -I$(AUDIO_ROOT)/$(COMMON_DIR) |
| 72 | |
| 73 | ############ ASoC Codecs ############ |
Asish Bhattacharya | 5faacb3 | 2017-12-04 17:23:15 +0530 | [diff] [blame] | 74 | ifdef CONFIG_WCD9XXX_CODEC_CORE |
Laxminath Kasam | 8b1366a | 2017-10-05 01:44:16 +0530 | [diff] [blame] | 75 | CORE_OBJS += wcd9xxx-rst.o |
| 76 | CORE_OBJS += wcd9xxx-core-init.o |
| 77 | CORE_OBJS += wcd9xxx-core.o |
| 78 | CORE_OBJS += wcd9xxx-irq.o |
| 79 | CORE_OBJS += wcd9xxx-slimslave.o |
| 80 | CORE_OBJS += wcd9xxx-utils.o |
| 81 | CORE_OBJS += wcd9335-regmap.o |
| 82 | CORE_OBJS += wcd9335-tables.o |
| 83 | CORE_OBJS += msm-cdc-pinctrl.o |
| 84 | CORE_OBJS += msm-cdc-supply.o |
| 85 | CORE_OBJS += wcd934x/wcd934x-regmap.o |
| 86 | CORE_OBJS += wcd934x/wcd934x-tables.o |
| 87 | endif |
| 88 | |
Asish Bhattacharya | 5faacb3 | 2017-12-04 17:23:15 +0530 | [diff] [blame] | 89 | ifdef CONFIG_SND_SOC_WCD9XXX_V2 |
Laxminath Kasam | 8b1366a | 2017-10-05 01:44:16 +0530 | [diff] [blame] | 90 | WCD9XXX_OBJS += wcd9xxx-common-v2.o |
| 91 | WCD9XXX_OBJS += wcd9xxx-resmgr-v2.o |
| 92 | WCD9XXX_OBJS += wcdcal-hwdep.o |
| 93 | WCD9XXX_OBJS += wcd9xxx-soc-init.o |
| 94 | WCD9XXX_OBJS += wcd-dsp-utils.o |
| 95 | WCD9XXX_OBJS += wcd-dsp-mgr.o |
Soumya Managoli | eaff662 | 2018-02-23 12:00:54 +0530 | [diff] [blame] | 96 | endif |
| 97 | |
| 98 | ifdef CONFIG_COMMON_CLK_QCOM |
Laxminath Kasam | 8b1366a | 2017-10-05 01:44:16 +0530 | [diff] [blame] | 99 | WCD9XXX_OBJS += audio-ext-clk-up.o |
| 100 | endif |
| 101 | |
Soumya Managoli | 91b8c3f | 2018-02-24 18:36:15 +0530 | [diff] [blame] | 102 | ifdef CONFIG_COMMON_CLK_MSM |
| 103 | WCD9XXX_OBJS += audio-ext-clk.o |
| 104 | endif |
| 105 | |
Asish Bhattacharya | 5faacb3 | 2017-12-04 17:23:15 +0530 | [diff] [blame] | 106 | ifdef CONFIG_SND_SOC_WCD9335 |
Laxminath Kasam | 8b1366a | 2017-10-05 01:44:16 +0530 | [diff] [blame] | 107 | WCD9335_OBJS += wcd9335.o |
| 108 | endif |
| 109 | |
Asish Bhattacharya | 5faacb3 | 2017-12-04 17:23:15 +0530 | [diff] [blame] | 110 | ifdef CONFIG_SND_SOC_WSA881X |
Laxminath Kasam | 8b1366a | 2017-10-05 01:44:16 +0530 | [diff] [blame] | 111 | WSA881X_OBJS += wsa881x.o |
| 112 | WSA881X_OBJS += wsa881x-tables.o |
| 113 | WSA881X_OBJS += wsa881x-regmap.o |
| 114 | WSA881X_OBJS += wsa881x-temp-sensor.o |
| 115 | endif |
| 116 | |
Soumya Managoli | eaff662 | 2018-02-23 12:00:54 +0530 | [diff] [blame] | 117 | ifdef CONFIG_SND_SOC_WSA881X_ANALOG |
| 118 | WSA881X_ANALOG_OBJS += wsa881x-analog.o |
| 119 | WSA881X_ANALOG_OBJS += wsa881x-tables-analog.o |
| 120 | WSA881X_ANALOG_OBJS += wsa881x-regmap-analog.o |
| 121 | endif |
| 122 | |
Asish Bhattacharya | 5faacb3 | 2017-12-04 17:23:15 +0530 | [diff] [blame] | 123 | ifdef CONFIG_SND_SOC_MSM_STUB |
Laxminath Kasam | 8b1366a | 2017-10-05 01:44:16 +0530 | [diff] [blame] | 124 | STUB_OBJS += msm_stub.o |
| 125 | endif |
Asish Bhattacharya | 5faacb3 | 2017-12-04 17:23:15 +0530 | [diff] [blame] | 126 | ifdef CONFIG_SND_SOC_WCD_SPI |
Laxminath Kasam | 8b1366a | 2017-10-05 01:44:16 +0530 | [diff] [blame] | 127 | SPI_OBJS += wcd-spi.o |
| 128 | endif |
| 129 | |
Asish Bhattacharya | 5faacb3 | 2017-12-04 17:23:15 +0530 | [diff] [blame] | 130 | ifdef CONFIG_SND_SOC_WCD_CPE |
Laxminath Kasam | 8b1366a | 2017-10-05 01:44:16 +0530 | [diff] [blame] | 131 | WCD_CPE_OBJS += wcd_cpe_core.o |
| 132 | WCD_CPE_OBJS += wcd_cpe_services.o |
| 133 | endif |
| 134 | |
Asish Bhattacharya | 5faacb3 | 2017-12-04 17:23:15 +0530 | [diff] [blame] | 135 | ifdef CONFIG_SND_SOC_WCD_MBHC |
Laxminath Kasam | 8b1366a | 2017-10-05 01:44:16 +0530 | [diff] [blame] | 136 | MBHC_OBJS += wcd-mbhc-v2.o |
| 137 | endif |
| 138 | |
Asish Bhattacharya | 5faacb3 | 2017-12-04 17:23:15 +0530 | [diff] [blame] | 139 | ifdef CONFIG_SND_SOC_WCD_MBHC_ADC |
Laxminath Kasam | 8b1366a | 2017-10-05 01:44:16 +0530 | [diff] [blame] | 140 | MBHC_OBJS += wcd-mbhc-adc.o |
| 141 | endif |
| 142 | |
Asish Bhattacharya | 5faacb3 | 2017-12-04 17:23:15 +0530 | [diff] [blame] | 143 | ifdef CONFIG_SND_SOC_WCD_MBHC_LEGACY |
Laxminath Kasam | 8b1366a | 2017-10-05 01:44:16 +0530 | [diff] [blame] | 144 | MBHC_OBJS += wcd-mbhc-legacy.o |
| 145 | endif |
| 146 | |
Asish Bhattacharya | 5faacb3 | 2017-12-04 17:23:15 +0530 | [diff] [blame] | 147 | ifdef CONFIG_SND_SOC_MSM_HDMI_CODEC_RX |
Laxminath Kasam | 8b1366a | 2017-10-05 01:44:16 +0530 | [diff] [blame] | 148 | HDMICODEC_OBJS += msm_hdmi_codec_rx.o |
| 149 | endif |
| 150 | |
| 151 | LINUX_INC += -Iinclude/linux |
| 152 | |
Asish Bhattacharya | 5faacb3 | 2017-12-04 17:23:15 +0530 | [diff] [blame] | 153 | INCS += $(COMMON_INC) \ |
Laxminath Kasam | 8b1366a | 2017-10-05 01:44:16 +0530 | [diff] [blame] | 154 | $(UAPI_INC) |
| 155 | |
Laxminath Kasam | 8b1366a | 2017-10-05 01:44:16 +0530 | [diff] [blame] | 156 | |
| 157 | EXTRA_CFLAGS += $(INCS) |
| 158 | |
| 159 | |
| 160 | CDEFINES += -DANI_LITTLE_BYTE_ENDIAN \ |
| 161 | -DANI_LITTLE_BIT_ENDIAN \ |
| 162 | -DDOT11F_LITTLE_ENDIAN_HOST \ |
| 163 | -DANI_COMPILER_TYPE_GCC \ |
| 164 | -DANI_OS_TYPE_ANDROID=6 \ |
| 165 | -DPTT_SOCK_SVC_ENABLE \ |
| 166 | -Wall\ |
| 167 | -Werror\ |
| 168 | -D__linux__ |
| 169 | |
| 170 | KBUILD_CPPFLAGS += $(CDEFINES) |
| 171 | |
| 172 | # Currently, for versions of gcc which support it, the kernel Makefile |
| 173 | # is disabling the maybe-uninitialized warning. Re-enable it for the |
| 174 | # AUDIO driver. Note that we must use EXTRA_CFLAGS here so that it |
| 175 | # will override the kernel settings. |
| 176 | ifeq ($(call cc-option-yn, -Wmaybe-uninitialized),y) |
| 177 | EXTRA_CFLAGS += -Wmaybe-uninitialized |
| 178 | endif |
| 179 | #EXTRA_CFLAGS += -Wmissing-prototypes |
| 180 | |
| 181 | ifeq ($(call cc-option-yn, -Wheader-guard),y) |
| 182 | EXTRA_CFLAGS += -Wheader-guard |
| 183 | endif |
| 184 | |
| 185 | |
Asish Bhattacharya | 5faacb3 | 2017-12-04 17:23:15 +0530 | [diff] [blame] | 186 | ifeq ($(KERNEL_BUILD), 0) |
Sundara Vinayagam | 3983833 | 2018-05-23 12:04:25 +0530 | [diff] [blame] | 187 | KBUILD_EXTRA_SYMBOLS +=$(OUT)/obj/vendor/qcom/opensource/audio-kernel/ipc/Module.symvers |
Laxminath Kasam | 8b1366a | 2017-10-05 01:44:16 +0530 | [diff] [blame] | 188 | KBUILD_EXTRA_SYMBOLS +=$(OUT)/obj/vendor/qcom/opensource/audio-kernel/dsp/Module.symvers |
| 189 | KBUILD_EXTRA_SYMBOLS +=$(OUT)/obj/vendor/qcom/opensource/audio-kernel/soc/Module.symvers |
Asish Bhattacharya | 5faacb3 | 2017-12-04 17:23:15 +0530 | [diff] [blame] | 190 | endif |
| 191 | |
| 192 | ifeq ($(KERNEL_BUILD), 1) |
| 193 | obj-y += wcd934x/ |
| 194 | obj-y += sdm660_cdc/ |
| 195 | obj-y += msm_sdw/ |
| 196 | endif |
Laxminath Kasam | 8b1366a | 2017-10-05 01:44:16 +0530 | [diff] [blame] | 197 | # Module information used by KBuild framework |
| 198 | obj-$(CONFIG_WCD9XXX_CODEC_CORE) += wcd_core_dlkm.o |
| 199 | wcd_core_dlkm-y := $(CORE_OBJS) |
| 200 | |
| 201 | obj-$(CONFIG_SND_SOC_WCD9XXX_V2) += wcd9xxx_dlkm.o |
| 202 | wcd9xxx_dlkm-y := $(WCD9XXX_OBJS) |
| 203 | |
| 204 | obj-$(CONFIG_SND_SOC_WCD9335) += wcd9335_dlkm.o |
| 205 | wcd9335_dlkm-y := $(WCD9335_OBJS) |
| 206 | |
| 207 | obj-$(CONFIG_SND_SOC_WSA881X) += wsa881x_dlkm.o |
| 208 | wsa881x_dlkm-y := $(WSA881X_OBJS) |
| 209 | |
Soumya Managoli | eaff662 | 2018-02-23 12:00:54 +0530 | [diff] [blame] | 210 | obj-$(CONFIG_SND_SOC_WSA881X_ANALOG) += wsa881x_analog_dlkm.o |
| 211 | wsa881x_analog_dlkm-y := $(WSA881X_ANALOG_OBJS) |
| 212 | |
Laxminath Kasam | 8b1366a | 2017-10-05 01:44:16 +0530 | [diff] [blame] | 213 | obj-$(CONFIG_SND_SOC_MSM_STUB) += stub_dlkm.o |
| 214 | stub_dlkm-y := $(STUB_OBJS) |
| 215 | |
| 216 | obj-$(CONFIG_SND_SOC_WCD_CPE) += wcd_cpe_dlkm.o |
| 217 | wcd_cpe_dlkm-y := $(WCD_CPE_OBJS) |
| 218 | |
| 219 | obj-$(CONFIG_SND_SOC_WCD_SPI) += wcd_spi_dlkm.o |
| 220 | wcd_spi_dlkm-y := $(SPI_OBJS) |
| 221 | |
| 222 | obj-$(CONFIG_SND_SOC_WCD_MBHC) += mbhc_dlkm.o |
| 223 | mbhc_dlkm-y := $(MBHC_OBJS) |
| 224 | |
| 225 | obj-$(CONFIG_SND_SOC_MSM_HDMI_CODEC_RX) += hdmi_dlkm.o |
| 226 | hdmi_dlkm-y := $(HDMICODEC_OBJS) |
| 227 | |
| 228 | # inject some build related information |
| 229 | DEFINES += -DBUILD_TIMESTAMP=\"$(shell date -u +'%Y-%m-%dT%H:%M:%SZ')\" |