AHAL: enable audio hal for linux platform
Change-Id: I7de481eb7b04985f232dfe833d76e80907081bdb
Signed-off-by: Hexuan Zhu <hexuzhu@codeaurora.org>
diff --git a/Makefile.am b/Makefile.am
old mode 100644
new mode 100755
index d4aef58..38e98ea
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,4 +1,4 @@
-SUBDIRS = hal post_proc
+SUBDIRS = hal hal/audio_extn
if QAHW_SUPPORT
SUBDIRS += qahw_api qahw_api/test
diff --git a/configs/msmnile_au/mixer_paths_adp.xml b/configs/msmnile_au/mixer_paths_adp.xml
old mode 100644
new mode 100755
index 8761181..50a4f99
--- a/configs/msmnile_au/mixer_paths_adp.xml
+++ b/configs/msmnile_au/mixer_paths_adp.xml
@@ -2955,11 +2955,6 @@
<path name="incall_music_uplink bt-a2dp">
<path name="incall_music_uplink" />
</path>
-
- <path name="incall_music_uplink afe-proxy">
- <path name="incall_music_uplink" />
- </path>
-
<path name="incall_music_uplink2">
<ctl name="Incall_Music_2 Audio Mixer MultiMedia9" value="1" />
</path>
@@ -3031,8 +3026,4 @@
<path name="incall_music_uplink2 bt-a2dp">
<path name="incall_music_uplink2" />
</path>
-
- <path name="incall_music_uplink2 afe-proxy">
- <path name="incall_music_uplink2" />
- </path>
</mixer>
diff --git a/configure.ac b/configure.ac
index 89326c0..8810f0b 100755
--- a/configure.ac
+++ b/configure.ac
@@ -42,6 +42,17 @@
AC_HELP_STRING([--with-glib],
[enable glib, Build against glib. Use this when building for HLOS systems which use glib]))
+AC_ARG_ENABLE(target,
+ [AS_HELP_STRING([--enable-target=TARGET_SUPPORT],
+ [Specify the target product to build])],
+ [AS_CASE([$enableval],
+ [qtiquingvm], [TARGET_SUPPORT=msmnile_au],
+ [sa81*], [TARGET_SUPPORT=msmnile_au],
+ [sa61*], [TARGET_SUPPORT=msmsteppe_au],
+ [TARGET_SUPPORT=none])],
+ [TARGET_SUPPORT=none]
+)
+
if (test "x${with_glib}" = "xyes"); then
PKG_CHECK_MODULES(GTHREAD, gthread-2.0 >= 2.16, dummy=yes,
AC_MSG_ERROR(GThread >= 2.16 is required))
@@ -93,6 +104,14 @@
AC_SUBST([TARGET_PLATFORM], ["msm8974"])
TARGET_CFLAGS="-DPLATFORM_MSMSTEPPE"
fi
+if (test x$TARGET_SUPPORT = xmsmnile_au); then
+ AC_SUBST([TARGET_PLATFORM], ["msm8974"])
+ TARGET_CFLAGS="-DPLATFORM_MSMNILE"
+fi
+if (test x$TARGET_SUPPORT = xmsmsteppe_au); then
+ AC_SUBST([TARGET_PLATFORM], ["msm8974"])
+ TARGET_CFLAGS="-DPLATFORM_MSMSTEPPE"
+fi
AC_SUBST([TARGET_CFLAGS])
AM_CONDITIONAL([QTI_AUDIO_SERVER_ENABLED],[test x$BOARD_SUPPORTS_QTI_AUDIO_SERVER = xtrue])
@@ -146,6 +165,7 @@
AC_CONFIG_FILES([ \
Makefile \
hal/Makefile \
+ hal/audio_extn/Makefile \
post_proc/Makefile \
qahw_api/Makefile \
qahw_api/test/Makefile \
diff --git a/hal/Makefile.am b/hal/Makefile.am
old mode 100644
new mode 100755
index bdf1b9a..b60e4d4
--- a/hal/Makefile.am
+++ b/hal/Makefile.am
@@ -1,24 +1,20 @@
-AM_CFLAGS = -I ${WORKSPACE}/external/tinyalsa/include \
- -I ${WORKSPACE}/system/media/audio_effects/include \
- -I ${WORKSPACE}/system/media/audio_utils/include \
- -I $(top_srcdir)/hal \
+AM_CFLAGS = -I $(top_srcdir)/hal \
-I $(top_srcdir)/hal/audio_extn \
-I $(top_srcdir)/hal/voice_extn \
-I $(PKG_CONFIG_SYSROOT_DIR)/usr/include/audio-kernel \
+ -I $(PKG_CONFIG_SYSROOT_DIR)/usr/include \
-I $(top_srcdir)/hal/${TARGET_PLATFORM}
c_sources = audio_hw.c \
- voice.c \
platform_info.c \
+ voice.c \
+ acdb.c \
${TARGET_PLATFORM}/platform.c \
- audio_extn/audio_extn.c \
audio_extn/utils.c \
- acdb.c
+ audio_extn/audio_extn.c \
+ audio_extn/device_utils.c \
+ audio_extn/audio_stub.c
-if HDMI_EDID
-AM_CFLAGS += -DHDMI_EDID
-c_sources += edid.c
-endif
if FM_POWER_OPT
AM_CFLAGS += -DFM_POWER_OPT
@@ -30,17 +26,6 @@
c_sources += audio_extn/usb.c
endif
-if HFP
-AM_CFLAGS += -DHFP_ENABLED
-c_sources += audio_extn/hfp.c
-endif
-
-if SSR
-AM_CFLAGS += -DSSR_ENABLED
-c_sources += audio_extn/ssr.c
-AM_CFLAGS += -I ${WORKSPACE}/audio/mm-audio-external-noship/surround_sound_3mic/libsurround_3mic_proc/surround_rec_interface/inc/
-endif
-
if MULTI_VOICE_SESSIONS
AM_CFLAGS += -DMULTI_VOICE_SESSION_ENABLED
c_sources += voice_extn/voice_extn.c
@@ -51,21 +36,15 @@
c_sources += voice_extn/compress_voip.c
endif
-if SPKR_PROTECTION
-AM_CFLAGS += -DSPKR_PROT_ENABLED
-c_sources += audio_extn/spkr_protection.c
-endif
+
+AM_CFLAGS += -DAUDIO_GKI_ENABLED
+
if HW_VARIANTS
AM_CFLAGS += -DHW_VARIANTS_ENABLED
c_sources += ${TARGET_PLATFORM}/hw_info.c
endif
-if COMPRESS_CAPTURE
-AM_CFLAGS += -DCOMPRESS_CAPTURE_ENABLED
-c_sources += audio_extn/compress_capture.c
-endif
-
if DTS_EAGLE
AM_CFLAGS += -DDTS_EAGLE
c_sources += audio_extn/dts_eagle.c
@@ -93,36 +72,34 @@
c_sources += audio_extn/source_track.c
endif
-#if LISTEN
-#AM_CFLAGS += -DAUDIO_LISTEN_ENABLED
-#AM_CFLAGS += -I ${WORKSPACE}/audio/mm-audio-external-noship/audio-listen
-#c_sources += audio_extn/listen.c
-#endif
+if LISTEN
+AM_CFLAGS += -DAUDIO_LISTEN_ENABLED
+c_sources += audio_extn/listen.c
+endif
if SOUND_TRIGGER
AM_CFLAGS += -DSOUND_TRIGGER_ENABLED
-AM_CFLAGS += -I ${WORKSPACE}/audio/mm-audio/sound_trigger/
c_sources += audio_extn/soundtrigger.c
endif
if FLAC_SUPPORT
AM_CFLAGS += -DFLAC_OFFLOAD_ENABLED
-AM_CFLAGS += -DCOMPRESS_METADATA_NEEDED
+AM_CFLAGS += -DCOMPRESS_METADATA_ENABLED
endif
if ALAC_SUPPORT
AM_CFLAGS += -DALAC_OFFLOAD_ENABLED
-AM_CFLAGS += -DCOMPRESS_METADATA_NEEDED
+AM_CFLAGS += -DCOMPRESS_METADATA_ENABLED
endif
if VORBIS_SUPPORT
AM_CFLAGS += -DVORBIS_OFFLOAD_ENABLED
-AM_CFLAGS += -DCOMPRESS_METADATA_NEEDED
+AM_CFLAGS += -DCOMPRESS_METADATA_ENABLED
endif
if WMA_SUPPORT
AM_CFLAGS += -DWMA_OFFLOAD_ENABLED
-AM_CFLAGS += -DCOMPRESS_METADATA_NEEDED
+AM_CFLAGS += -DCOMPRESS_METADATA_ENABLED
endif
if COMPRESS_INPUT
@@ -136,7 +113,6 @@
endif
if AUDIO_PARSER
-AM_CFLAGS += -I ${WORKSPACE}/audio/mm-audio/audio-parsers/inc/
if DTSHD_PARSER
AM_CFLAGS += -DDTSHD_PARSER_ENABLED
endif
@@ -170,11 +146,6 @@
c_sources += audio_extn/adsp_hdlr.c
endif
-if A2DP_OFFLOAD
-AM_CFLAGS += -DA2DP_OFFLOAD_ENABLED
-c_sources += audio_extn/a2dp.c
-endif
-
if AUDIO_IP_HDLR
AM_CFLAGS += -DAUDIO_EXTN_IP_HDLR_ENABLED
c_sources += audio_extn/ip_hdlr_intf.c
@@ -209,6 +180,10 @@
AM_CFLAGS += -DINSTANCE_ID_ENABLED
endif
+if HFP
+AM_CFLAGS += -DHFP_ENABLED
+endif
+
if LL_AS_PRIMARY_OUTPUT
AM_CFLAGS += -DUSE_LL_AS_PRIMARY_OUTPUT
endif
@@ -225,13 +200,16 @@
audio_primary_default_la_SOURCES = $(c_sources)
audio_primary_default_la_LIBADD = $(GLIB_LIBS) -llog -lcutils -ltinyalsa
audio_primary_default_la_LIBADD += -ltinycompress -laudioroute -ldl -lexpat -laudioutils
+audio_primary_default_la_LIBADD += -lm -lc -lresolv
if AUDIO_PARSER
audio_primary_default_la_LIBADD += -laudioparsers
endif
audio_primary_default_la_CFLAGS = $(AM_CFLAGS) $(GLIB_CFLAGS)
audio_primary_default_la_CFLAGS += -Dstrlcat=g_strlcat
-audio_primary_default_la_CFLAGS += -DINT_MAX=0x7fffffff
+audio_primary_default_la_CFLAGS += -DINT_MAX=0x7fffffff -Wno-error=deprecated-declarations -DPATH_MAX=1024 -DULONG_MAX=0xFFFFFFFFFFFFFFFFUL
audio_primary_default_la_CFLAGS += -D__unused=__attribute__\(\(__unused__\)\)
audio_primary_default_la_CFLAGS += -DLINUX_ENABLED $(TARGET_CFLAGS) -DAUDIO_EXTN_FORMATS_ENABLED
audio_primary_default_la_CFLAGS += -DNDEBUG
audio_primary_default_la_LDFLAGS = -module -shared -avoid-version
+audio_primary_default_la_CPPFLAGS = $(AM_CFLAGS) $(GLIB_CFLAGS)
+audio_primary_default_la_CPPFLAGS += -DLINUX_ENABLED
diff --git a/hal/audio_extn/Makefile.am b/hal/audio_extn/Makefile.am
new file mode 100755
index 0000000..b8068b0
--- /dev/null
+++ b/hal/audio_extn/Makefile.am
@@ -0,0 +1,234 @@
+AM_CFLAGS = -I $(top_srcdir)/hal \
+ -I $(top_srcdir)/hal/audio_extn \
+ -I $(top_srcdir)/hal/voice_extn \
+ -I $(PKG_CONFIG_SYSROOT_DIR)/usr/include/audio-kernel \
+ -I $(PKG_CONFIG_SYSROOT_DIR)/usr/include \
+ -I $(top_srcdir)/hal/${TARGET_PLATFORM}
+
+AM_CFLAGS += -DAUDIO_GKI_ENABLED
+c_sources = $(top_srcdir)/hal/audio_hw.c \
+ $(top_srcdir)/hal/platform_info.c \
+ $(top_srcdir)/hal/voice.c \
+ $(top_srcdir)/hal/acdb.c \
+ $(top_srcdir)/hal/${TARGET_PLATFORM}/platform.c \
+ utils.c \
+ audio_extn.c \
+ device_utils.c \
+ audio_stub.c
+
+
+if FM_POWER_OPT
+AM_CFLAGS += -DFM_POWER_OPT
+c_sources += fm.c
+endif
+
+if USBAUDIO
+AM_CFLAGS += -DUSB_TUNNEL_ENABLED
+c_sources += usb.c
+endif
+
+if SSR
+AM_CFLAGS += -DSSR_ENABLED
+c_sources += ssr.c
+endif
+
+if MULTI_VOICE_SESSIONS
+AM_CFLAGS += -DMULTI_VOICE_SESSION_ENABLED
+c_sources += $(top_srcdir)/hal/voice_extn/voice_extn.c
+endif
+
+if COMPRESS_VOIP
+AM_CFLAGS += -DCOMPRESS_VOIP_ENABLED
+c_sources += $(top_srcdir)/hal/voice_extn/compress_voip.c
+endif
+
+if SPKR_PROTECTION
+AM_CFLAGS += -DSPKR_PROT_ENABLED
+c_sources += spkr_protection.c
+endif
+
+if HW_VARIANTS
+AM_CFLAGS += -DHW_VARIANTS_ENABLED
+c_sources += $(top_srcdir)/hal/${TARGET_PLATFORM}/hw_info.c
+endif
+
+if COMPRESS_CAPTURE
+AM_CFLAGS += -DCOMPRESS_CAPTURE_ENABLED
+c_sources += compress_capture.c
+endif
+
+if DTS_EAGLE
+AM_CFLAGS += -DDTS_EAGLE
+c_sources += dts_eagle.c
+endif
+
+if DOLBY_DDP
+AM_CFLAGS += -DDS1_DOLBY_DDP_ENABLED
+c_sources += dolby.c
+endif
+
+if DS1_DOLBY_DAP
+AM_CFLAGS += -DDS1_DOLBY_DAP_ENABLED
+if DOLBY_DDP
+c_sources += dolby.c
+endif
+endif
+
+if DEV_ARBI
+AM_CFLAGS += -DDEV_ARBI_ENABLED
+c_sources += dev_arbi.c
+endif
+
+if SOURCE_TRACKING
+AM_CFLAGS += -DSOURCE_TRACKING_ENABLED
+c_sources += source_track.c
+endif
+
+if LISTEN
+AM_CFLAGS += -DAUDIO_LISTEN_ENABLED
+c_sources += listen.c
+endif
+
+if SOUND_TRIGGER
+AM_CFLAGS += -DSOUND_TRIGGER_ENABLED
+c_sources += soundtrigger.c
+endif
+
+if FLAC_SUPPORT
+AM_CFLAGS += -DFLAC_OFFLOAD_ENABLED
+AM_CFLAGS += -DCOMPRESS_METADATA_ENABLED
+endif
+
+if ALAC_SUPPORT
+AM_CFLAGS += -DALAC_OFFLOAD_ENABLED
+AM_CFLAGS += -DCOMPRESS_METADATA_ENABLED
+endif
+
+if VORBIS_SUPPORT
+AM_CFLAGS += -DVORBIS_OFFLOAD_ENABLED
+AM_CFLAGS += -DCOMPRESS_METADATA_ENABLED
+endif
+
+if WMA_SUPPORT
+AM_CFLAGS += -DWMA_OFFLOAD_ENABLED
+AM_CFLAGS += -DCOMPRESS_METADATA_ENABLED
+endif
+
+if COMPRESS_INPUT
+AM_CFLAGS += -DCOMPRESS_INPUT_ENABLED
+c_sources += compress_in.c
+endif
+
+if COMPRESS_PASSTHROUGH
+AM_CFLAGS += -DHDMI_PASSTHROUGH_ENABLED
+c_sources += passthru.c
+endif
+
+if AUDIO_PARSER
+if DTSHD_PARSER
+AM_CFLAGS += -DDTSHD_PARSER_ENABLED
+endif
+endif
+
+if KEEP_ALIVE
+AM_CFLAGS += -DKEEP_ALIVE_ENABLED
+c_sources += keep_alive.c
+endif
+
+if AUDIO_HW_EXTN_API
+AM_CFLAGS += -DAUDIO_HW_EXTN_API_ENABLED
+c_sources += $(top_srcdir)/hal/audio_hw_extn_api.c
+endif
+
+if GEF
+AM_CFLAGS += -DAUDIO_GENERIC_EFFECT_FRAMEWORK_ENABLED
+c_sources += gef.c
+endif
+
+if APTX_DECODER
+AM_CFLAGS += -DAPTX_DECODER_ENABLED
+endif
+
+if AFE_PROXY
+AM_CFLAGS += -DAFE_PROXY_ENABLED
+endif
+
+if ADSP_HDLR
+AM_CFLAGS += -DAUDIO_EXTN_ADSP_HDLR_ENABLED
+c_sources += adsp_hdlr.c
+endif
+
+if AUDIO_IP_HDLR
+AM_CFLAGS += -DAUDIO_EXTN_IP_HDLR_ENABLED
+c_sources += ip_hdlr_intf.c
+endif
+
+if QAF_SUPPORT
+AM_CFLAGS += -DQAF_EXTN_ENABLED
+c_sources += qaf.c
+endif
+
+if AUDIO_HW_LOOPBACK
+AM_CFLAGS += -DAUDIO_HW_LOOPBACK_ENABLED
+AM_CFLAGS += -DCOMPRESS_METADATA_NEEDED
+c_sources += hw_loopback.c
+endif
+
+if RUN_KEEP_ALIVE_IN_ARM_FFV
+AM_CFLAGS += -DRUN_KEEP_ALIVE_IN_ARM_FFV
+endif
+
+if AUDIO_HW_FFV
+AM_CFLAGS += -DFFV_ENABLED \
+ -I $(PKG_CONFIG_SYSROOT_DIR)/usr/include/ffv/
+c_sources += ffv.c
+endif
+
+if CUSTOM_STEREO
+AM_CFLAGS += -DCUSTOM_STEREO_ENABLED
+endif
+
+if INSTANCE_ID
+AM_CFLAGS += -DINSTANCE_ID_ENABLED
+endif
+
+if LL_AS_PRIMARY_OUTPUT
+AM_CFLAGS += -DUSE_LL_AS_PRIMARY_OUTPUT
+endif
+
+lib_LTLIBRARIES = libautohal.la
+c_sources += auto_hal.c
+libautohal_la_SOURCES = $(c_sources)
+libautohal_la_LIBADD = $(GLIB_LIBS) -llog -lcutils -ltinyalsa
+libautohal_la_LIBADD += -ltinycompress -laudioroute -ldl -lexpat -laudioutils
+libautohal_la_LIBADD += -lm -lc -lresolv
+libautohal_la_CFLAGS = $(AM_CFLAGS) $(GLIB_CFLAGS)
+libautohal_la_CFLAGS += -Dstrlcat=g_strlcat
+libautohal_la_CFLAGS += -DINT_MAX=0x7fffffff -Wno-error=deprecated-declarations -DPATH_MAX=1024 -DULONG_MAX=0xFFFFFFFFFFFFFFFFUL
+libautohal_la_CFLAGS += -D__unused=__attribute__\(\(__unused__\)\)
+libautohal_la_CFLAGS += -DLINUX_ENABLED $(TARGET_CFLAGS) -DAUDIO_EXTN_FORMATS_ENABLED
+libautohal_la_CFLAGS += -DNDEBUG
+libautohal_la_LDFLAGS = -module -shared -avoid-version
+libautohal_la_CPPFLAGS = $(AM_CFLAGS) $(GLIB_CFLAGS)
+libautohal_la_CPPFLAGS += -DLINUX_ENABLED
+
+if HFP
+AM_CFLAGS += -DHFP_ENABLED
+c_sources += hfp.c
+lib_LTLIBRARIES += libhfp.la
+libhfp_la_SOURCES = $(c_sources)
+libhfp_la_LIBADD = $(GLIB_LIBS) -llog -lcutils -ltinyalsa
+libhfp_la_LIBADD += -ltinycompress -laudioroute -ldl -lexpat -laudioutils
+libhfp_la_LIBADD += -lm -lc -lresolv
+
+libhfp_la_CFLAGS = $(AM_CFLAGS) $(GLIB_CFLAGS)
+libhfp_la_CFLAGS += -Dstrlcat=g_strlcat
+libhfp_la_CFLAGS += -DINT_MAX=0x7fffffff
+libhfp_la_CFLAGS += -DULONG_MAX=\(__LONG_MAX__*2UL+1UL\)
+libhfp_la_CFLAGS += -DPATH_MAX=4096
+libhfp_la_CFLAGS += -D__unused=__attribute__\(\(__unused__\)\)
+libhfp_la_CFLAGS += -DLINUX_ENABLED $(TARGET_CFLAGS) -DAUDIO_EXTN_FORMATS_ENABLED
+libhfp_la_CFLAGS += -DNDEBUG
+libhfp_la_CFLAGS += -D_GNU_SOURCE
+libhfp_la_LDFLAGS = -module -shared -avoid-version
+endif
diff --git a/hal/audio_extn/audio_extn.c b/hal/audio_extn/audio_extn.c
index c24d28f..56731b9 100755
--- a/hal/audio_extn/audio_extn.c
+++ b/hal/audio_extn/audio_extn.c
@@ -67,6 +67,10 @@
#include <log_utils.h>
#endif
+#ifdef LINUX_ENABLED
+#include "audio_stub.h"
+#endif
+
#define MAX_SLEEP_RETRY 100
#define WIFI_INIT_WAIT_SLEEP 50
#define MAX_NUM_CHANNELS 8
@@ -4871,10 +4875,18 @@
// START: HFP ======================================================================
#ifdef __LP64__
+#ifdef LINUX_ENABLED
+#define HFP_LIB_PATH "/usr/lib64/libhfp.so"
+#else
#define HFP_LIB_PATH "/vendor/lib64/libhfp.so"
+#endif
+#else
+#ifdef LINUX_ENABLED
+#define HFP_LIB_PATH "/usr/lib/libhfp.so"
#else
#define HFP_LIB_PATH "/vendor/lib/libhfp.so"
#endif
+#endif
static void *hfp_lib_handle = NULL;
@@ -4965,7 +4977,6 @@
hfp_set_mic_mute = NULL;
hfp_set_mic_mute2 = NULL;
hfp_set_parameters = NULL;
-
ALOGW(":: %s: ---- Feature HFP is disabled ----", __func__);
return -ENOSYS;
}
@@ -6066,11 +6077,19 @@
// END: MAXX_AUDIO =====================================================================
// START: AUTO_HAL ===================================================================
+#ifdef LINUX_ENABLED
+#ifdef __LP64__
+#define AUTO_HAL_LIB_PATH "/usr/lib64/libautohal.so"
+#else
+#define AUTO_HAL_LIB_PATH "/usr/lib/libautohal.so"
+#endif
+#else
#ifdef __LP64__
#define AUTO_HAL_LIB_PATH "/vendor/lib64/libautohal.so"
#else
#define AUTO_HAL_LIB_PATH "/vendor/lib/libautohal.so"
#endif
+#endif
static void *auto_hal_lib_handle = NULL;
@@ -6147,6 +6166,11 @@
{
ALOGD("%s: Called with feature %s", __func__,
is_feature_enabled ? "Enabled" : "NOT Enabled");
+
+#ifdef LINUX_ENABLED
+ is_feature_enabled = true;
+#endif
+
if (is_feature_enabled) {
// dlopen lib
auto_hal_lib_handle = dlopen(AUTO_HAL_LIB_PATH, RTLD_NOW);
@@ -6543,7 +6567,6 @@
void audio_extn_feature_init()
{
vendor_enhanced_info = audio_extn_utils_get_vendor_enhanced_info();
-
// register feature init functions here
// each feature needs a vendor property
// default value added is for GSI (non vendor modified images)
@@ -6628,9 +6651,17 @@
hwdep_cal_feature_init(
property_get_bool("vendor.audio.feature.hwdep_cal.enable",
false));
+ #ifdef LINUX_ENABLED
+ #ifdef HFP_ENABLED
+ hfp_feature_init(true);
+ #else
+ hfp_feature_init(false);
+ #endif
+ #else
hfp_feature_init(
property_get_bool("vendor.audio.feature.hfp.enable",
- false));
+ false));
+ #endif
icc_feature_init(
property_get_bool("vendor.audio.feature.icc.enable",
false));
diff --git a/hal/audio_extn/audio_stub.c b/hal/audio_extn/audio_stub.c
new file mode 100755
index 0000000..c9ec1bf
--- /dev/null
+++ b/hal/audio_extn/audio_stub.c
@@ -0,0 +1,70 @@
+/*
+* Copyright (c) 2021 The Linux Foundation. All rights reserved.
+* Redistribution and use in source and binary forms, with or without
+* modification, are permitted provided that the following conditions are
+* met:
+* * Redistributions of source code must retain the above copyright
+* notice, this list of conditions and the following disclaimer.
+* * Redistributions in binary form must reproduce the above
+* copyright notice, this list of conditions and the following
+* disclaimer in the documentation and/or other materials provided
+* with the distribution.
+* * Neither the name of The Linux Foundation nor the names of its
+* contributors may be used to endorse or promote products derived
+* from this software without specific prior written permission.
+* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#ifdef LINUX_ENABLED
+#include <sys/types.h>
+#include <sys/param.h>
+#include <sys/socket.h>
+
+#include <netinet/in.h>
+#include <arpa/inet.h>
+#include <arpa/nameser.h>
+
+#include <ctype.h>
+#include <resolv.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+int32_t property_get_int32(const char *key, int32_t default_value) {
+ return 0;
+}
+
+int64_t property_get_int64(const char *key, int64_t default_value) {
+ return 0;
+}
+
+int audio_extn_hidl_init() {
+ return 0;
+}
+
+int audio_streaming_hint_start() {
+ return 0;
+}
+
+int audio_streaming_hint_end() {
+ return 0;
+}
+
+int audio_low_latency_hint_start() {
+ return 0;
+}
+
+int audio_low_latency_hint_end() {
+ return 0;
+}
+#endif
diff --git a/hal/audio_extn/audio_stub.h b/hal/audio_extn/audio_stub.h
new file mode 100755
index 0000000..01137ca
--- /dev/null
+++ b/hal/audio_extn/audio_stub.h
@@ -0,0 +1,42 @@
+/*
+* Copyright (c) 2021 The Linux Foundation. All rights reserved.
+* Redistribution and use in source and binary forms, with or without
+* modification, are permitted provided that the following conditions are
+* met:
+* * Redistributions of source code must retain the above copyright
+* notice, this list of conditions and the following disclaimer.
+* * Redistributions in binary form must reproduce the above
+* copyright notice, this list of conditions and the following
+* disclaimer in the documentation and/or other materials provided
+* with the distribution.
+* * Neither the name of The Linux Foundation nor the names of its
+* contributors may be used to endorse or promote products derived
+* from this software without specific prior written permission.
+* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+#ifdef LINUX_ENABLED
+
+#ifndef _AUDIO_STUB_H_
+#define _AUDIO_STUB_H_
+
+#ifdef __LP64__
+#define CPU_SETSIZE 1024
+#else
+#define CPU_SETSIZE 32
+#endif
+
+#define CPU_ZERO(cpusetp) \
+ memset((cpusetp), 0, sizeof(cpu_set_t))
+
+#endif
+#endif
diff --git a/hal/platform_info.c b/hal/platform_info.c
old mode 100644
new mode 100755
index 4ad5a5c..e55b91d
--- a/hal/platform_info.c
+++ b/hal/platform_info.c
@@ -42,6 +42,9 @@
#include "audio_extn.h"
#include <platform.h>
#include <math.h>
+#ifdef LINUX_ENABLED
+#include <float.h>
+#endif
#ifdef DYNAMIC_LOG_ENABLED
#include <log_xml_parser.h>
diff --git a/qahw_api/test/qahw_playback_test.c b/qahw_api/test/qahw_playback_test.c
old mode 100644
new mode 100755
index 12be83d..b52b647
--- a/qahw_api/test/qahw_playback_test.c
+++ b/qahw_api/test/qahw_playback_test.c
@@ -2117,6 +2117,7 @@
{"ec-ref", no_argument, 0, 'L'},
{"help", no_argument, 0, 'h'},
{"bt-wbs", no_argument, 0, 'z'},
+ {"HFP-call", no_argument, 0, 'H'},
{0, 0, 0, 0}
};
@@ -2139,13 +2140,67 @@
while ((opt = getopt_long(argc,
argv,
- "-f:r:c:b:d:s:v:V:l:t:a:w:k:PD:KF:Ee:A:u:m:S:C:p::x:y:qQzLh:i:h:g:O:",
+ "-f:r:c:b:d:s:v:V:l:t:a:w:k:PD:KF:Ee:A:u:m:S:C:p::x:y:qQzLh:i:h:g:H:O:",
long_options,
&option_index)) != -1) {
fprintf(log_file, "for argument %c, value is %s\n", opt, optarg);
switch (opt) {
+ case 'H':
+ {
+ int hfp_test_rc;
+ qahw_module_handle_t* qap_out_hal_handle = NULL;
+ qahw_stream_handle_t* out_handle;
+ const char* hfp_set_sampling_rate = "hfp_set_sampling_rate=16000";
+ const char* hfp_volume = "hfp_volume=15";
+ const char* hfp_enable = "hfp_enable=true";
+ const char* hfp_disable = "hfp_enable=false";
+ audio_config_t config;
+ config.sample_rate = 48000;
+ config.channel_mask = 0x3;
+ config.format = 1;
+ config.frame_count = 0;
+ config.offload_info.version = AUDIO_OFFLOAD_INFO_VERSION_CURRENT;
+ config.offload_info.size = sizeof(audio_offload_info_t);
+
+ wakelock_acquired = request_wake_lock(wakelock_acquired, true);
+
+ qap_out_hal_handle = load_hal(AUDIO_DEVICE_NONE);
+
+ hfp_test_rc = qahw_open_output_stream(qap_out_hal_handle,
+ 0x999,
+ AUDIO_DEVICE_OUT_BUS,
+ AUDIO_OUTPUT_FLAG_PRIMARY,
+ &config,
+ &out_handle,
+ "BUS00_MEDIA");
+ fprintf(stderr, "hfp_test: qahw_open_output_stream result %d\n", hfp_test_rc);
+
+ hfp_test_rc = qahw_set_parameters(qap_out_hal_handle, hfp_set_sampling_rate);
+ fprintf(stderr, "hfp_test: hfp_set_sampling_rate result %d\n", hfp_test_rc);
+
+ hfp_test_rc = qahw_set_parameters(qap_out_hal_handle, hfp_volume);
+ fprintf(stderr, "hfp_test: hfp_volume result %d\n", hfp_test_rc);
+
+ hfp_test_rc = qahw_set_parameters(qap_out_hal_handle, hfp_enable);
+ fprintf(stderr, "hfp_test: hfp_enable result %d\n", hfp_test_rc);
+
+ sleep(10);
+
+ hfp_test_rc = qahw_set_parameters(qap_out_hal_handle, hfp_disable);
+ fprintf(stderr, "hfp_test: hfp_disable result %d\n", hfp_test_rc);
+
+ hfp_test_rc = qahw_close_output_stream(out_handle);
+
+ unload_hals();
+
+ wakelock_acquired = request_wake_lock(wakelock_acquired, false);
+
+ fprintf(stderr, "\nADL: BYE BYE\n");
+
+ return 0;
+ }
case 'f':
stream_param[i].filename = optarg;
break;