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)
10ifneq ($(filter msm8960,$(TARGET_BOARD_PLATFORM)),)
11  LOCAL_CFLAGS += -DMAX_TARGET_SPECIFIC_CHANNEL_CNT="2"
12endif
13ifneq ($(filter msm8974 msm8226 msm8084 msm8992 msm8994 msm8996 msm8998 sdm845 sdm710 msmnile,$(TARGET_BOARD_PLATFORM)),)
14  # B-family platform uses msm8974 code base
15  AUDIO_PLATFORM = msm8974
16ifneq ($(filter msm8974,$(TARGET_BOARD_PLATFORM)),)
17  LOCAL_CFLAGS := -DPLATFORM_MSM8974
18  LOCAL_CFLAGS += -DMAX_TARGET_SPECIFIC_CHANNEL_CNT="2"
19endif
20ifneq ($(filter msm8226,$(TARGET_BOARD_PLATFORM)),)
21  LOCAL_CFLAGS := -DPLATFORM_MSM8x26
22  LOCAL_CFLAGS += -DMAX_TARGET_SPECIFIC_CHANNEL_CNT="2"
23endif
24ifneq ($(filter msm8084,$(TARGET_BOARD_PLATFORM)),)
25  LOCAL_CFLAGS := -DPLATFORM_MSM8084
26  LOCAL_CFLAGS += -DMAX_TARGET_SPECIFIC_CHANNEL_CNT="2"
27endif
28ifneq ($(filter msm8992,$(TARGET_BOARD_PLATFORM)),)
29  LOCAL_CFLAGS := -DPLATFORM_MSM8994
30  LOCAL_CFLAGS += -DMAX_TARGET_SPECIFIC_CHANNEL_CNT="4"
31  LOCAL_CFLAGS += -DKPI_OPTIMIZE_ENABLED
32endif
33ifneq ($(filter msm8994,$(TARGET_BOARD_PLATFORM)),)
34  LOCAL_CFLAGS := -DPLATFORM_MSM8994
35  LOCAL_CFLAGS += -DMAX_TARGET_SPECIFIC_CHANNEL_CNT="4"
36  LOCAL_CFLAGS += -DKPI_OPTIMIZE_ENABLED
37endif
38ifneq ($(filter msm8996,$(TARGET_BOARD_PLATFORM)),)
39  LOCAL_CFLAGS := -DPLATFORM_MSM8996
40  LOCAL_CFLAGS += -DMAX_TARGET_SPECIFIC_CHANNEL_CNT="4"
41  LOCAL_CFLAGS += -DKPI_OPTIMIZE_ENABLED
42  LOCAL_CFLAGS += -DINCALL_MUSIC_ENABLED
43  MULTIPLE_HW_VARIANTS_ENABLED := true
44endif
45ifneq ($(filter msm8998,$(TARGET_BOARD_PLATFORM)),)
46  LOCAL_CFLAGS := -DPLATFORM_MSM8998
47  LOCAL_CFLAGS += -DMAX_TARGET_SPECIFIC_CHANNEL_CNT="4"
48  LOCAL_CFLAGS += -DINCALL_MUSIC_ENABLED
49  MULTIPLE_HW_VARIANTS_ENABLED := true
50endif
51ifneq ($(filter sdm845,$(TARGET_BOARD_PLATFORM)),)
52  LOCAL_CFLAGS := -DPLATFORM_SDM845
53  LOCAL_CFLAGS += -DMAX_TARGET_SPECIFIC_CHANNEL_CNT="4"
54  LOCAL_CFLAGS += -DINCALL_MUSIC_ENABLED
55  LOCAL_CFLAGS += -DINCALL_STEREO_CAPTURE_ENABLED
56  MULTIPLE_HW_VARIANTS_ENABLED := true
57endif
58ifneq ($(filter sdm710,$(TARGET_BOARD_PLATFORM)),)
59  LOCAL_CFLAGS := -DPLATFORM_SDM710
60  LOCAL_CFLAGS += -DMAX_TARGET_SPECIFIC_CHANNEL_CNT="4"
61  LOCAL_CFLAGS += -DINCALL_MUSIC_ENABLED
62  LOCAL_CFLAGS += -DINCALL_STEREO_CAPTURE_ENABLED
63  MULTIPLE_HW_VARIANTS_ENABLED := true
64endif
65ifneq ($(filter msmnile,$(TARGET_BOARD_PLATFORM)),)
66  LOCAL_CFLAGS := -DPLATFORM_SM8150
67  LOCAL_CFLAGS += -DMAX_TARGET_SPECIFIC_CHANNEL_CNT="4"
68  LOCAL_CFLAGS += -DINCALL_MUSIC_ENABLED
69  LOCAL_CFLAGS += -DINCALL_STEREO_CAPTURE_ENABLED
70  MULTIPLE_HW_VARIANTS_ENABLED := true
71endif
72endif
73
74ifneq ($(filter msm8916 msm8909 msm8952,$(TARGET_BOARD_PLATFORM)),)
75  AUDIO_PLATFORM = msm8916
76  LOCAL_CFLAGS := -DPLATFORM_MSM8916
77ifneq ($(filter msm8909,$(TARGET_BOARD_PLATFORM)),)
78  LOCAL_CFLAGS := -DPLATFORM_MSM8909
79endif
80  LOCAL_CFLAGS += -DMAX_TARGET_SPECIFIC_CHANNEL_CNT="2"
81  LOCAL_CFLAGS += -DKPI_OPTIMIZE_ENABLED
82  MULTIPLE_HW_VARIANTS_ENABLED := true
83endif
84
85LOCAL_SRC_FILES := \
86	audio_hw.c \
87	voice.c \
88	platform_info.c \
89	audio_extn/ext_speaker.c \
90	audio_extn/audio_extn.c \
91	audio_extn/utils.c \
92	$(AUDIO_PLATFORM)/platform.c \
93        acdb.c
94
95ifdef MULTIPLE_HW_VARIANTS_ENABLED
96  LOCAL_CFLAGS += -DHW_VARIANTS_ENABLED
97  LOCAL_SRC_FILES +=  $(AUDIO_PLATFORM)/hw_info.c
98endif
99
100ifeq ($(strip $(AUDIO_FEATURE_ENABLED_USB_TUNNEL)),true)
101    LOCAL_CFLAGS += -DUSB_TUNNEL_ENABLED
102    LOCAL_SRC_FILES += audio_extn/usb.c
103endif
104
105ifeq ($(strip $(AUDIO_FEATURE_ENABLED_USB_SIDETONE_VOLUME)),true)
106    LOCAL_CFLAGS += -DUSB_SIDETONE_VOLUME
107endif
108
109LOCAL_SHARED_LIBRARIES := \
110	libaudioutils \
111	liblog \
112	libcutils \
113	libprocessgroup \
114	libtinyalsa \
115	libtinycompress \
116	libaudioroute \
117	libdl \
118	libexpat
119
120LOCAL_C_INCLUDES += \
121	external/tinyalsa/include \
122	external/tinycompress/include \
123	$(call include-path-for, audio-route) \
124	$(call include-path-for, audio-effects) \
125	$(LOCAL_PATH)/$(AUDIO_PLATFORM) \
126	$(LOCAL_PATH)/audio_extn \
127	$(LOCAL_PATH)/voice_extn \
128	external/expat/lib
129
130ifeq ($(strip $(AUDIO_FEATURE_ENABLED_SMART_PA_TFA_98XX)),true)
131    LOCAL_SHARED_LIBRARIES += libexTfa98xx
132    LOCAL_CFLAGS += -DSMART_PA_TFA_98XX_SUPPORTED
133    LOCAL_SRC_FILES += audio_extn/tfa_98xx.c
134endif
135
136ifeq ($(strip $(AUDIO_FEATURE_ENABLED_MULTI_VOICE_SESSIONS)),true)
137    LOCAL_CFLAGS += -DMULTI_VOICE_SESSION_ENABLED
138    LOCAL_SRC_FILES += voice_extn/voice_extn.c
139endif
140
141ifeq ($(strip $(AUDIO_FEATURE_ENABLED_HFP)),true)
142    LOCAL_CFLAGS += -DHFP_ENABLED
143    LOCAL_SRC_FILES += audio_extn/hfp.c
144endif
145
146ifeq ($(strip $(AUDIO_FEATURE_SUPPORTED_EXTERNAL_BT)),true)
147    LOCAL_CFLAGS += -DEXTERNAL_BT_SUPPORTED
148endif
149
150ifeq ($(strip $(AUDIO_FEATURE_FLICKER_SENSOR_INPUT)),true)
151    LOCAL_CFLAGS += -DFLICKER_SENSOR_INPUT
152endif
153
154ifeq ($(strip $(AUDIO_FEATURE_NO_AUDIO_OUT)),true)
155    LOCAL_CFLAGS += -DNO_AUDIO_OUT
156endif
157
158ifeq ($(strip $(BOARD_SUPPORTS_SOUND_TRIGGER)),true)
159    LOCAL_CFLAGS += -DSOUND_TRIGGER_ENABLED
160    LOCAL_CFLAGS += -DSOUND_TRIGGER_PLATFORM_NAME=$(TARGET_BOARD_PLATFORM)
161    LOCAL_C_INCLUDES += $(TARGET_OUT_HEADERS)/mm-audio/sound_trigger
162    LOCAL_SRC_FILES += audio_extn/soundtrigger.c
163ifneq ($(filter msm8996,$(TARGET_BOARD_PLATFORM)),)
164LOCAL_HEADER_LIBRARIES := sound_trigger.primary_headers
165endif
166
167endif
168
169ifeq ($(strip $(AUDIO_FEATURE_ENABLED_SPKR_PROTECTION)),true)
170    LOCAL_CFLAGS += -DSPKR_PROT_ENABLED
171    LOCAL_SRC_FILES += audio_extn/spkr_protection.c
172endif
173
174ifeq ($(strip $(AUDIO_FEATURE_ENABLED_CIRRUS_SPKR_PROTECTION)),true)
175    LOCAL_CFLAGS += -DSPKR_PROT_ENABLED
176    LOCAL_SRC_FILES += audio_extn/cirrus_playback.c
177endif
178
179ifeq ($(strip $(AUDIO_FEATURE_ENABLED_DSM_FEEDBACK)),true)
180    LOCAL_CFLAGS += -DDSM_FEEDBACK_ENABLED
181    LOCAL_SRC_FILES += audio_extn/dsm_feedback.c
182endif
183
184ifeq ($(strip $(AUDIO_FEATURE_ENABLED_A2DP_OFFLOAD)),true)
185    LOCAL_CFLAGS += -DA2DP_OFFLOAD_ENABLED
186    LOCAL_SRC_FILES += audio_extn/a2dp.c
187endif
188
189ifneq ($(filter msm8992 msm8994 msm8996 msm8998 sdm845 sdm710,$(TARGET_BOARD_PLATFORM)),)
190  # push codec/mad calibration to HW dep node
191  # applicable to msm8992/8994 or newer platforms
192  LOCAL_CFLAGS += -DHWDEP_CAL_ENABLED
193  LOCAL_SRC_FILES += audio_extn/hwdep_cal.c
194endif
195
196ifeq ($(strip $(AUDIO_FEATURE_ENABLED_SND_MONITOR)), true)
197    LOCAL_CFLAGS += -DSND_MONITOR_ENABLED
198    LOCAL_SRC_FILES += audio_extn/sndmonitor.c
199endif
200
201ifeq ($(strip $(AUDIO_FEATURE_ENABLED_USB_SERVICE_INTERVAL)), true)
202    LOCAL_CFLAGS += -DUSB_SERVICE_INTERVAL_ENABLED
203endif
204
205ifeq ($(strip $(AUDIO_FEATURE_ENABLED_MAXX_AUDIO)), true)
206    LOCAL_CFLAGS += -DMAXXAUDIO_QDSP_ENABLED
207    LOCAL_SRC_FILES += audio_extn/maxxaudio.c
208endif
209
210ifeq ($(strip $(AUDIO_FEATURE_ENABLED_AUDIO_ZOOM)), true)
211    LOCAL_CFLAGS += -DAUDIOZOOM_QDSP_ENABLED
212    LOCAL_SRC_FILES += audio_extn/audiozoom.c
213endif
214
215ifeq ($(strip $(AUDIO_FEATURE_ENABLED_24BITS_CAMCORDER)), true)
216    LOCAL_CFLAGS += -DENABLED_24BITS_CAMCORDER
217endif
218
219ifeq ($(strip $(AUDIO_FEATURE_ENABLED_BG_CAL)),true)
220    LOCAL_CFLAGS += -DBG_CODEC_CAL
221endif
222
223ifeq ($(strip $(AUDIO_FEATURE_ENABLED_DYNAMIC_ECNS)),true)
224    LOCAL_CFLAGS += -DDYNAMIC_ECNS_ENABLED
225endif
226
227LOCAL_SHARED_LIBRARIES += libbase libhidlbase libutils android.hardware.power@1.2 liblog
228
229LOCAL_SHARED_LIBRARIES += android.hardware.power-V1-ndk_platform
230LOCAL_SHARED_LIBRARIES += libbinder_ndk
231
232LOCAL_SRC_FILES += audio_perf.cpp
233
234LOCAL_HEADER_LIBRARIES += libhardware_headers
235
236LOCAL_MODULE := audio.primary.$(TARGET_BOARD_PLATFORM)
237LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0
238LOCAL_LICENSE_CONDITIONS := notice
239
240LOCAL_MODULE_RELATIVE_PATH := hw
241
242LOCAL_MODULE_TAGS := optional
243
244LOCAL_MODULE_OWNER := qcom
245
246LOCAL_PROPRIETARY_MODULE := true
247
248LOCAL_CFLAGS += -Werror
249
250include $(BUILD_SHARED_LIBRARY)
251
252endif
253