1ifeq ($(strip $(BOARD_USES_ALSA_AUDIO)),true)
2
3LOCAL_PATH := $(call my-dir)
4
5include $(CLEAR_VARS)
6
7LOCAL_ARM_MODE := arm
8
9AUDIO_PLATFORM := $(TARGET_BOARD_PLATFORM)
10
11ifneq ($(filter msm8974 msm8226 msm8610 apq8084 msm8994,$(TARGET_BOARD_PLATFORM)),)
12  # B-family platform uses msm8974 code base
13  AUDIO_PLATFORM = msm8974
14  MULTIPLE_HW_VARIANTS_ENABLED := true
15ifneq ($(filter msm8610,$(TARGET_BOARD_PLATFORM)),)
16  LOCAL_CFLAGS := -DPLATFORM_MSM8610
17endif
18ifneq ($(filter msm8226,$(TARGET_BOARD_PLATFORM)),)
19  LOCAL_CFLAGS := -DPLATFORM_MSM8x26
20endif
21ifneq ($(filter apq8084,$(TARGET_BOARD_PLATFORM)),)
22  LOCAL_CFLAGS := -DPLATFORM_APQ8084
23endif
24ifneq ($(filter msm8994,$(TARGET_BOARD_PLATFORM)),)
25  LOCAL_CFLAGS := -DPLATFORM_MSM8994
26endif
27endif
28
29ifneq ($(filter msm8916 msm8909,$(TARGET_BOARD_PLATFORM)),)
30  AUDIO_PLATFORM = msm8916
31  MULTIPLE_HW_VARIANTS_ENABLED := true
32  LOCAL_CFLAGS := -DPLATFORM_MSM8916
33ifneq ($(filter msm8909,$(TARGET_BOARD_PLATFORM)),)
34  LOCAL_CFLAGS := -DPLATFORM_MSM8909
35endif
36endif
37
38LOCAL_SRC_FILES := \
39	audio_hw.c \
40	voice.c \
41	platform_info.c \
42	$(AUDIO_PLATFORM)/platform.c
43
44LOCAL_SRC_FILES += audio_extn/audio_extn.c \
45                   audio_extn/utils.c
46
47LOCAL_C_INCLUDES += $(BOARD_KERNEL_HEADER_DIR)
48LOCAL_ADDITIONAL_DEPENDENCIES += $(BOARD_KERNEL_HEADER_DEPENDENCIES)
49
50ifeq ($(strip $(AUDIO_FEATURE_ENABLED_ASM_LOOPBACK_RX)),true)
51  LOCAL_CFLAGS += -DASM_LOOPBACK_RX_ENABLED
52endif
53
54ifeq ($(strip $(AUDIO_FEATURE_ENABLED_PCM_OFFLOAD)),true)
55    LOCAL_CFLAGS += -DPCM_OFFLOAD_ENABLED
56endif
57
58ifeq ($(strip $(AUDIO_FEATURE_ENABLED_ANC_HEADSET)),true)
59    LOCAL_CFLAGS += -DANC_HEADSET_ENABLED
60endif
61
62ifeq ($(strip $(AUDIO_FEATURE_ENABLED_FLUENCE)),true)
63    LOCAL_CFLAGS += -DFLUENCE_ENABLED
64endif
65
66ifeq ($(strip $(AUDIO_FEATURE_ENABLED_PROXY_DEVICE)),true)
67    LOCAL_CFLAGS += -DAFE_PROXY_ENABLED
68endif
69
70ifeq ($(strip $(AUDIO_FEATURE_ENABLED_KPI_OPTIMIZE)),true)
71    LOCAL_CFLAGS += -DKPI_OPTIMIZE_ENABLED
72endif
73
74ifeq ($(strip $(AUDIO_FEATURE_ENABLED_FM_POWER_OPT)),true)
75    LOCAL_CFLAGS += -DFM_POWER_OPT
76    LOCAL_SRC_FILES += audio_extn/fm.c
77endif
78
79ifeq ($(strip $(AUDIO_FEATURE_ENABLED_USBAUDIO)),true)
80    LOCAL_CFLAGS += -DUSB_HEADSET_ENABLED
81    LOCAL_SRC_FILES += audio_extn/usb.c
82endif
83
84ifeq ($(strip $(AUDIO_FEATURE_ENABLED_HFP)),true)
85    LOCAL_CFLAGS += -DHFP_ENABLED
86    LOCAL_SRC_FILES += audio_extn/hfp.c
87endif
88
89ifeq ($(strip $(AUDIO_FEATURE_ENABLED_CUSTOMSTEREO)),true)
90    LOCAL_CFLAGS += -DCUSTOM_STEREO_ENABLED
91endif
92
93ifeq ($(strip $(AUDIO_FEATURE_ENABLED_SSR)),true)
94    LOCAL_CFLAGS += -DSSR_ENABLED
95    LOCAL_SRC_FILES += audio_extn/ssr.c
96    LOCAL_C_INCLUDES += $(TARGET_OUT_HEADERS)/mm-audio/surround_sound/
97    LOCAL_C_INCLUDES += $(TARGET_OUT_HEADERS)/common/inc/
98endif
99
100ifeq ($(strip $(AUDIO_FEATURE_ENABLED_MULTI_VOICE_SESSIONS)),true)
101    LOCAL_CFLAGS += -DMULTI_VOICE_SESSION_ENABLED
102    LOCAL_SRC_FILES += voice_extn/voice_extn.c
103
104ifeq ($(strip $(AUDIO_FEATURE_ENABLED_INCALL_MUSIC)),true)
105    LOCAL_CFLAGS += -DINCALL_MUSIC_ENABLED
106endif
107ifeq ($(strip $(AUDIO_FEATURE_ENABLED_COMPRESS_VOIP)),true)
108    LOCAL_CFLAGS += -DCOMPRESS_VOIP_ENABLED
109    LOCAL_SRC_FILES += voice_extn/compress_voip.c
110endif
111
112endif
113
114ifeq ($(strip $(AUDIO_FEATURE_ENABLED_EXTN_FORMATS)),true)
115LOCAL_CFLAGS += -DFORMATS_ENABLED
116endif
117
118ifeq ($(strip $(AUDIO_FEATURE_ENABLED_SPKR_PROTECTION)),true)
119    LOCAL_CFLAGS += -DSPKR_PROT_ENABLED
120    LOCAL_SRC_FILES += audio_extn/spkr_protection.c
121endif
122
123ifdef MULTIPLE_HW_VARIANTS_ENABLED
124  LOCAL_CFLAGS += -DHW_VARIANTS_ENABLED
125  LOCAL_SRC_FILES += $(AUDIO_PLATFORM)/hw_info.c
126endif
127
128ifeq ($(strip $(AUDIO_FEATURE_ENABLED_COMPRESS_CAPTURE)),true)
129    LOCAL_CFLAGS += -DCOMPRESS_CAPTURE_ENABLED
130    LOCAL_SRC_FILES += audio_extn/compress_capture.c
131endif
132
133ifeq ($(strip $(DOLBY_DDP)),true)
134    LOCAL_CFLAGS += -DDS1_DOLBY_DDP_ENABLED
135    LOCAL_SRC_FILES += audio_extn/dolby.c
136endif
137
138ifeq ($(strip $(DOLBY_DAP)),true)
139    LOCAL_CFLAGS += -DDS1_DOLBY_DAP_ENABLED
140ifneq ($(strip $(DOLBY_DDP)),true)
141    LOCAL_SRC_FILES += audio_extn/dolby.c
142endif
143endif
144
145ifeq ($(strip $(AUDIO_FEATURE_ENABLED_MULTIPLE_TUNNEL)), true)
146    LOCAL_CFLAGS += -DMULTIPLE_OFFLOAD_ENABLED
147endif
148
149ifeq ($(strip $(AUDIO_FEATURE_ENABLED_EXTN_FLAC_DECODER)),true)
150    LOCAL_CFLAGS += -DFLAC_OFFLOAD_ENABLED
151    LOCAL_CFLAGS += -DCOMPRESS_METADATA_NEEDED
152endif
153
154ifeq ($(strip $(AUDIO_FEATURE_ENABLED_VORBIS_OFFLOAD)),true)
155    LOCAL_CFLAGS += -DVORBIS_OFFLOAD_ENABLED
156    LOCAL_CFLAGS += -DCOMPRESS_METADATA_NEEDED
157
158endif
159
160ifeq ($(strip $(AUDIO_FEATURE_ENABLED_WMA_OFFLOAD)),true)
161    LOCAL_CFLAGS += -DWMA_OFFLOAD_ENABLED
162    LOCAL_CFLAGS += -DCOMPRESS_METADATA_NEEDED
163endif
164
165ifeq ($(strip $(AUDIO_FEATURE_ENABLED_ALAC_OFFLOAD)),true)
166    LOCAL_CFLAGS += -DALAC_OFFLOAD_ENABLED
167    LOCAL_CFLAGS += -DCOMPRESS_METADATA_NEEDED
168endif
169
170ifeq ($(strip $(AUDIO_FEATURE_ENABLED_APE_OFFLOAD)),true)
171    LOCAL_CFLAGS += -DAPE_OFFLOAD_ENABLED
172    LOCAL_CFLAGS += -DCOMPRESS_METADATA_NEEDED
173endif
174
175ifeq ($(strip $(AUDIO_FEATURE_ENABLED_DEV_ARBI)),true)
176    LOCAL_CFLAGS += -DDEV_ARBI_ENABLED
177    LOCAL_SRC_FILES += audio_extn/dev_arbi.c
178endif
179
180ifneq ($(TARGET_SUPPORTS_WEARABLES),true)
181ifeq ($(strip $(AUDIO_FEATURE_ENABLED_RECORD_PLAY_CONCURRENCY)),true)
182    LOCAL_CFLAGS += -DRECORD_PLAY_CONCURRENCY
183endif
184endif
185
186ifeq ($(strip $(AUDIO_FEATURE_ENABLED_ACDB_LICENSE)), true)
187    LOCAL_CFLAGS += -DDOLBY_ACDB_LICENSE
188endif
189
190ifeq ($(strip $(AUDIO_FEATURE_ENABLED_DS2_DOLBY_DAP)),true)
191    LOCAL_CFLAGS += -DDS2_DOLBY_DAP_ENABLED
192ifneq ($(strip $(DOLBY_DDP)),true)
193    ifneq ($(strip $(DOLBY_DAP)),true)
194        LOCAL_SRC_FILES += audio_extn/dolby.c
195    endif
196endif
197endif
198
199ifeq ($(strip $(AUDIO_FEATURE_ENABLED_SPLIT_A2DP)),true)
200    LOCAL_CFLAGS += -DSPLIT_A2DP_ENABLED
201    LOCAL_SRC_FILES += audio_extn/a2dp.c
202endif
203
204
205ifeq ($(strip $(AUDIO_FEATURE_ENABLED_SOURCE_TRACKING)),true)
206    LOCAL_CFLAGS += -DSOURCE_TRACKING_ENABLED
207    LOCAL_SRC_FILES += audio_extn/source_track.c
208endif
209
210ifeq ($(strip $(AUDIO_FEATURE_ENABLED_AUDIOSPHERE)),true)
211    LOCAL_CFLAGS += -DAUDIOSPHERE_ENABLED
212endif
213
214LOCAL_SHARED_LIBRARIES := \
215	liblog \
216	libcutils \
217	libtinyalsa \
218	libtinycompress \
219	libaudioroute \
220	libdl \
221	libhardware \
222	libexpat
223
224LOCAL_C_INCLUDES += \
225	external/tinyalsa/include \
226	external/tinycompress/include \
227	external/expat/lib \
228	$(call include-path-for, audio-route) \
229	$(call include-path-for, audio-effects) \
230	$(LOCAL_PATH)/$(AUDIO_PLATFORM) \
231	$(LOCAL_PATH)/audio_extn \
232	$(LOCAL_PATH)/voice_extn
233
234ifeq ($(strip $(AUDIO_FEATURE_ENABLED_LISTEN)),true)
235    LOCAL_CFLAGS += -DAUDIO_LISTEN_ENABLED
236    LOCAL_C_INCLUDES += $(TARGET_OUT_HEADERS)/mm-audio/audio-listen
237    LOCAL_SRC_FILES += audio_extn/listen.c
238endif
239
240ifeq ($(strip $(BOARD_SUPPORTS_SOUND_TRIGGER)),true)
241    LOCAL_CFLAGS += -DSOUND_TRIGGER_ENABLED
242    LOCAL_CFLAGS += -DSOUND_TRIGGER_PLATFORM_NAME=$(TARGET_BOARD_PLATFORM)
243    LOCAL_C_INCLUDES += $(TARGET_OUT_HEADERS)/mm-audio/sound_trigger
244    LOCAL_SRC_FILES += audio_extn/soundtrigger.c
245endif
246
247ifeq ($(strip $(AUDIO_FEATURE_ENABLED_AUXPCM_BT)),true)
248    LOCAL_CFLAGS += -DAUXPCM_BT_ENABLED
249endif
250
251ifeq ($(strip $(AUDIO_FEATURE_ENABLED_PM_SUPPORT)),true)
252    LOCAL_CFLAGS += -DPM_SUPPORT_ENABLED
253    LOCAL_SRC_FILES += audio_extn/pm.c
254    LOCAL_C_INCLUDES += $(TARGET_OUT_HEADERS)/libperipheralclient/inc
255    LOCAL_SHARED_LIBRARIES += libperipheral_client
256endif
257
258LOCAL_COPY_HEADERS_TO   := mm-audio
259LOCAL_COPY_HEADERS      := audio_extn/audio_defs.h
260
261LOCAL_MODULE := audio.primary.$(TARGET_BOARD_PLATFORM)
262
263LOCAL_MODULE_RELATIVE_PATH := hw
264
265LOCAL_MODULE_TAGS := optional
266
267include $(BUILD_SHARED_LIBRARY)
268
269endif
270