Merge tag 'LA.UM.9.12.r1-11300-SMxx50.0' of https://source.codeaurora.org/quic/la/platform/hardware/qcom/audio into HEAD
"LA.UM.9.12.r1-11300-SMxx50.0"
* tag 'LA.UM.9.12.r1-11300-SMxx50.0' of https://source.codeaurora.org/quic/la/platform/hardware/qcom/audio: (33 commits)
configs: sdm450: add support for VoIP over audio path
configs : sdm845 :enable incall music and add incall music profile
configs : add usb_surround_sound input profile for usb capture
audio-hal: fix a2dp mute issue
hal: sampling rate mismatch during a2dp+spk combo usecase.
hal: route use cases properly to SCO device when it arrives
hal: don't mute stream with combo device during a2dpsuspended
hal: switch to current active device when a2dp suspended
AHAL: raise the priority for configuration of voip usecase
hal: re-route VOIP TX path for enabling correct VOIP EC port
hal: deadlock with pause and SSR for compressed offload
hal: notify input/output streams of snd card status upon request
hal: mute stream and switch to speaker during a2dp suspend
hal: fix trailing sound heard during a2dp codec switch
AHAL: setting 4 channel mapping info for proxy device
HAL: Modified condition to avoid audio Tx path for legacy targets
hal: adsprpcd: Prevent fastrpc daemon from exiting during SSR
configs: add device speaker-and-usb-headphones for ULL path
configs: add device speaker-and-usb-headphones for ULL path
configs: Remove reset value for ADC MUX
...
Change-Id: I0463ace014c2d2940fed50fba786fd2dd6dbb986
diff --git a/Android.mk b/Android.mk
index 0bf32b7..ae4a5e1 100644
--- a/Android.mk
+++ b/Android.mk
@@ -1,3 +1,5 @@
+ifeq ($(call my-dir),$(call project-path-for,qcom-audio))
+
ifneq ($(AUDIO_USE_STUB_HAL), true)
ifneq ($(filter mpq8092 msm8960 msm8226 msm8x26 msm8610 msm8974 msm8x74 apq8084 msm8916 msm8994 msm8992 msm8909 msm8996 msm8952 msm8937 thorium msm8953 msmgold msm8998 sdm660 sdm845 sdm710 apq8098_latv qcs605 sdmshrike msmnile kona lahaina holi $(MSMSTEPPE) $(TRINKET) atoll lito bengal,$(TARGET_BOARD_PLATFORM)),)
@@ -26,3 +28,5 @@
endif
endif
+
+endif
diff --git a/adsprpcd/Android.bp b/adsprpcd/Android.bp
index 7e6a8e7..f91ad2f 100644
--- a/adsprpcd/Android.bp
+++ b/adsprpcd/Android.bp
@@ -3,8 +3,6 @@
srcs: ["adsprpcd.c"],
- header_libs: ["libfastrpcshippable_headers"],
-
shared_libs: [
"liblog",
"libdl",
diff --git a/adsprpcd/adsprpcd.c b/adsprpcd/adsprpcd.c
index a44c013..89004e7 100644
--- a/adsprpcd/adsprpcd.c
+++ b/adsprpcd/adsprpcd.c
@@ -31,17 +31,21 @@
#define VERIFY_PRINT_ERROR
#endif
+#define VERIFY_EPRINTF ALOGE
+#define VERIFY_IPRINTF ALOGI
+
#include <stdio.h>
#include <dlfcn.h>
#include <unistd.h>
-#include "verify.h"
-#include "AEEStdErr.h"
+#include <log/log.h>
#ifndef ADSP_DEFAULT_LISTENER_NAME
#define ADSP_DEFAULT_LISTENER_NAME "libadsp_default_listener.so"
#endif
+#define AEE_ECONNREFUSED 0x72
+
typedef int (*adsp_default_listener_start_t)(int argc, char *argv[]);
int main(int argc, char *argv[]) {
@@ -71,6 +75,5 @@
usleep(25000);
}
VERIFY_EPRINTF("audio adsp daemon exiting %x", nErr);
-bail:
return nErr;
}
diff --git a/hal/Android.mk b/hal/Android.mk
index 1bd1342..30a2059 100644
--- a/hal/Android.mk
+++ b/hal/Android.mk
@@ -359,11 +359,16 @@
LOCAL_SHARED_LIBRARIES += vendor.qti.hardware.audiohalext@1.0
endif
+ifeq ($(strip $(AUDIO_FEATURE_ENABLED_EXT_AMPLIFIER)),true)
+ LOCAL_CFLAGS += -DEXT_AMPLIFIER_ENABLED
+ LOCAL_SRC_FILES += audio_extn/audio_amplifier.c
+ LOCAL_SHARED_LIBRARIES += libhardware
+endif
+
LOCAL_CFLAGS += -D_GNU_SOURCE
LOCAL_CFLAGS += -Wall -Werror
-LOCAL_COPY_HEADERS_TO := mm-audio
-LOCAL_COPY_HEADERS := audio_extn/audio_defs.h
+LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)
ifeq ($(strip $(AUDIO_FEATURE_ENABLED_GCOV)),true)
LOCAL_CFLAGS += --coverage -fprofile-arcs -ftest-coverage
diff --git a/hal/audio_extn/Android.mk b/hal/audio_extn/Android.mk
index f4afdff..ee73d17 100644
--- a/hal/audio_extn/Android.mk
+++ b/hal/audio_extn/Android.mk
@@ -1,3 +1,5 @@
+ifneq ($(strip $(TARGET_PROVIDES_AUDIO_EXTNS)),true)
+
#--------------------------------------------
# Build SND_MONITOR LIB
#--------------------------------------------
@@ -36,7 +38,7 @@
system/media/audio_utils/include \
external/expat/lib \
$(call include-path-for, audio-route) \
- vendor/qcom/opensource/audio-hal/primary-hal/hal \
+ $(call project-path-for,qcom-audio)/hal \
$(call include-path-for, audio-effects)
LOCAL_C_INCLUDES += $(TARGET_OUT_INTERMEDIATES)/KERNEL_OBJ/usr/include
@@ -98,8 +100,8 @@
system/media/audio_utils/include \
external/expat/lib \
$(call include-path-for, audio-route) \
- vendor/qcom/opensource/audio-hal/primary-hal/hal \
- vendor/qcom/opensource/audio-hal/primary-hal/hal/$(AUDIO_PLATFORM) \
+ $(call project-path-for,qcom-audio)/hal \
+ $(call project-path-for,qcom-audio)/hal/$(AUDIO_PLATFORM) \
$(call include-path-for, audio-effects)
LOCAL_C_INCLUDES += $(TARGET_OUT_INTERMEDIATES)/KERNEL_OBJ/usr/include
@@ -128,6 +130,7 @@
LOCAL_MODULE := libssrec
LOCAL_VENDOR_MODULE := true
+PRIMARY_HAL_PATH := $(call project-path-for,qcom-audio)/hal
AUDIO_PLATFORM := $(TARGET_BOARD_PLATFORM)
ifneq ($(filter sdm845 sdm710 sdmshrike msmnile kona lahaina holi lito bengal atoll sdm660 msm8937 msm8953 msm8998 $(MSMSTEPPE) $(TRINKET),$(TARGET_BOARD_PLATFORM)),)
@@ -157,8 +160,8 @@
libprocessgroup
LOCAL_C_INCLUDES := \
- vendor/qcom/opensource/audio-hal/primary-hal/hal \
- vendor/qcom/opensource/audio-hal/primary-hal/hal/$(AUDIO_PLATFORM) \
+ $(PRIMARY_HAL_PATH) \
+ $(PRIMARY_HAL_PATH)/$(AUDIO_PLATFORM) \
external/tinyalsa/include \
external/tinycompress/include \
external/expat/lib \
@@ -194,7 +197,7 @@
LOCAL_MODULE_OWNER := third_party
LOCAL_VENDOR_MODULE := true
-PRIMARY_HAL_PATH := vendor/qcom/opensource/audio-hal/primary-hal/hal
+PRIMARY_HAL_PATH := $(call project-path-for,qcom-audio)/hal
AUDIO_PLATFORM := $(TARGET_BOARD_PLATFORM)
ifneq ($(filter sdm845 sdm710 sdmshrike msmnile kona lahaina holi lito bengal atoll sdm660 msm8937 msm8953 msm8998 $(MSMSTEPPE) $(TRINKET),$(TARGET_BOARD_PLATFORM)),)
@@ -253,6 +256,7 @@
#--------------------------------------------
include $(CLEAR_VARS)
+PRIMARY_HAL_PATH := $(call project-path-for,qcom-audio)/hal
ifneq ($(filter sdm845 sdm710 sdmshrike msmnile kona lahaina holi lito bengal atoll sdm660 msm8937 msm8953 msm8998 $(MSMSTEPPE) $(TRINKET),$(TARGET_BOARD_PLATFORM)),)
# B-family platform uses msm8974 code base
AUDIO_PLATFORM := msm8974
@@ -289,9 +293,9 @@
system/media/audio_utils/include \
external/expat/lib \
$(call include-path-for, audio-route) \
- vendor/qcom/opensource/audio-hal/primary-hal/hal \
- vendor/qcom/opensource/audio-hal/primary-hal/hal/audio_extn \
- vendor/qcom/opensource/audio-hal/primary-hal/hal/$(AUDIO_PLATFORM) \
+ $(PRIMARY_HAL_PATH) \
+ $(PRIMARY_HAL_PATH)/audio_extn \
+ $(PRIMARY_HAL_PATH)/$(AUDIO_PLATFORM) \
vendor/qcom/opensource/audio-kernel/include/uapi/ \
$(call include-path-for, audio-effects)
@@ -312,6 +316,7 @@
include $(CLEAR_VARS)
+PRIMARY_HAL_PATH := $(call project-path-for,qcom-audio)/hal
ifneq ($(filter sdm845 sdm710 sdmshrike msmnile kona lahaina holi lito bengal atoll sdm660 msm8937 msm8953 msm8998 $(MSMSTEPPE) $(TRINKET),$(TARGET_BOARD_PLATFORM)),)
# B-family platform uses msm8974 code base
AUDIO_PLATFORM := msm8974
@@ -348,9 +353,9 @@
system/media/audio_utils/include \
external/expat/lib \
$(call include-path-for, audio-route) \
- vendor/qcom/opensource/audio-hal/primary-hal/hal \
- vendor/qcom/opensource/audio-hal/primary-hal/hal/audio_extn \
- vendor/qcom/opensource/audio-hal/primary-hal/hal/$(AUDIO_PLATFORM) \
+ $(PRIMARY_HAL_PATH) \
+ $(PRIMARY_HAL_PATH)/audio_extn \
+ $(PRIMARY_HAL_PATH)/$(AUDIO_PLATFORM) \
vendor/qcom/opensource/audio-kernel/include/uapi/ \
$(call include-path-for, audio-effects)
@@ -374,7 +379,7 @@
LOCAL_MODULE := liba2dpoffload
LOCAL_VENDOR_MODULE := true
-PRIMARY_HAL_PATH := vendor/qcom/opensource/audio-hal/primary-hal/hal
+PRIMARY_HAL_PATH := $(call project-path-for,qcom-audio)/hal
AUDIO_PLATFORM := $(TARGET_BOARD_PLATFORM)
ifneq ($(filter sdm845 sdm710 sdmshrike msmnile kona lahaina holi lito bengal atoll sdm660 msm8937 msm8953 msm8998 $(MSMSTEPPE) $(TRINKET),$(TARGET_BOARD_PLATFORM)),)
@@ -439,7 +444,7 @@
LOCAL_VENDOR_MODULE := true
-PRIMARY_HAL_PATH := vendor/qcom/opensource/audio-hal/primary-hal/hal
+PRIMARY_HAL_PATH := $(call project-path-for,qcom-audio)/hal
AUDIO_PLATFORM := $(TARGET_BOARD_PLATFORM)
ifneq ($(filter sdm845 sdm710 sdmshrike msmnile kona lahaina holi lito bengal atoll sdm660 msm8937 msm8953 msm8998 $(MSMSTEPPE) $(TRINKET),$(TARGET_BOARD_PLATFORM)),)
@@ -502,7 +507,7 @@
LOCAL_MODULE := libhfp
LOCAL_VENDOR_MODULE := true
-PRIMARY_HAL_PATH := vendor/qcom/opensource/audio-hal/primary-hal/hal
+PRIMARY_HAL_PATH := $(call project-path-for,qcom-audio)/hal
AUDIO_PLATFORM := $(TARGET_BOARD_PLATFORM)
ifneq ($(filter sdm845 sdm710 sdmshrike msmnile kona lahaina holi lito bengal atoll sdm660 msm8937 msm8953 msm8998 $(MSMSTEPPE) $(TRINKET),$(TARGET_BOARD_PLATFORM)),)
@@ -565,12 +570,14 @@
#-------------------------------------------
# Build HDMI PASSTHROUGH
#-------------------------------------------
+ifneq ($(QCPATH),)
+
include $(CLEAR_VARS)
LOCAL_MODULE := libhdmipassthru
LOCAL_VENDOR_MODULE := true
-PRIMARY_HAL_PATH := vendor/qcom/opensource/audio-hal/primary-hal/hal
+PRIMARY_HAL_PATH := $(call project-path-for,qcom-audio)/hal
AUDIO_PLATFORM := $(TARGET_BOARD_PLATFORM)
ifneq ($(filter sdm845 sdm710 sdmshrike msmnile kona lahaina holi lito bengal atoll sdm660 msm8937 msm8953 msm8998 $(MSMSTEPPE) $(TRINKET),$(TARGET_BOARD_PLATFORM)),)
@@ -634,6 +641,8 @@
endif
include $(BUILD_SHARED_LIBRARY)
+endif
+
#-------------------------------------------
# Build BATTERY_LISTENER
#-------------------------------------------
@@ -642,7 +651,7 @@
LOCAL_MODULE := libbatterylistener
LOCAL_VENDOR_MODULE := true
-PRIMARY_HAL_PATH := vendor/qcom/opensource/audio-hal/primary-hal/hal
+PRIMARY_HAL_PATH := $(call project-path-for,qcom-audio)/hal
AUDIO_PLATFORM := $(TARGET_BOARD_PLATFORM)
ifneq ($(filter sdm845 sdm710 sdmshrike msmnile kona lahaina holi lito bengal atoll sdm660 msm8937 msm8953 msm8998 $(MSMSTEPPE) $(TRINKET),$(TARGET_BOARD_PLATFORM)),)
@@ -715,7 +724,7 @@
LOCAL_MODULE := libhwdepcal
LOCAL_VENDOR_MODULE := true
-PRIMARY_HAL_PATH := vendor/qcom/opensource/audio-hal/primary-hal/hal
+PRIMARY_HAL_PATH := $(call project-path-for,qcom-audio)/hal
AUDIO_PLATFORM := $(TARGET_BOARD_PLATFORM)
ifneq ($(filter sdm845 sdm710 sdmshrike msmnile kona lahaina holi lito bengal atoll sdm660 msm8937 msm8953 msm8998 $(MSMSTEPPE) $(TRINKET),$(TARGET_BOARD_PLATFORM)),)
@@ -778,7 +787,7 @@
LOCAL_MODULE:= libmaxxaudio
LOCAL_VENDOR_MODULE := true
-PRIMARY_HAL_PATH := vendor/qcom/opensource/audio-hal/primary-hal/hal
+PRIMARY_HAL_PATH := $(call project-path-for,qcom-audio)/hal
AUDIO_PLATFORM := $(TARGET_BOARD_PLATFORM)
ifneq ($(filter sdm845 sdm710 sdmshrike msmnile kona lahaina holi sdm660 msm8937 msm8953 $(MSMSTEPPE) $(TRINKET),$(TARGET_BOARD_PLATFORM)),)
@@ -840,7 +849,7 @@
LOCAL_MODULE:= libaudiozoom
LOCAL_VENDOR_MODULE := true
-PRIMARY_HAL_PATH := vendor/qcom/opensource/audio-hal/primary-hal/hal
+PRIMARY_HAL_PATH := $(call project-path-for,qcom-audio)/hal
AUDIO_PLATFORM := $(TARGET_BOARD_PLATFORM)
ifneq ($(filter sdm845 sdm710 sdmshrike msmnile kona lahaina holi sdm660 msm8937 msm8953 $(MSMSTEPPE) $(TRINKET),$(TARGET_BOARD_PLATFORM)),)
@@ -957,3 +966,4 @@
LOCAL_SANITIZE := integer_overflow
endif
include $(BUILD_SHARED_LIBRARY)
+endif
diff --git a/hal/audio_extn/audio_amplifier.c b/hal/audio_extn/audio_amplifier.c
new file mode 100644
index 0000000..043c10f
--- /dev/null
+++ b/hal/audio_extn/audio_amplifier.c
@@ -0,0 +1,143 @@
+/*
+ * Copyright (c) 2016 The CyanogenMod Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#define LOG_TAG "audio_amplifier"
+
+#include <log/log.h>
+#include <dlfcn.h>
+#include <stdbool.h>
+#include <stdlib.h>
+
+#include "audio_hw.h"
+#include "platform.h"
+
+struct amplifier_data {
+ struct audio_device* adev;
+ amplifier_device_t* hw;
+};
+
+struct amplifier_data amp;
+
+int amplifier_open(void* adev) {
+ int rc;
+ amplifier_module_t* module;
+ amp.adev = (struct audio_device*)adev;
+
+ rc = hw_get_module(AMPLIFIER_HARDWARE_MODULE_ID, (const hw_module_t**)&module);
+ if (rc) {
+ ALOGV("%s: Failed to obtain reference to amplifier module: %s\n", __func__, strerror(-rc));
+ return -ENODEV;
+ }
+
+ rc = amplifier_device_open((const hw_module_t*)module, &.hw);
+ if (rc) {
+ ALOGV("%s: Failed to open amplifier hardware device: %s\n", __func__, strerror(-rc));
+ amp.hw = NULL;
+
+ return -ENODEV;
+ }
+
+ return 0;
+}
+
+int amplifier_set_input_devices(uint32_t devices) {
+ if (amp.hw && amp.hw->set_input_devices) return amp.hw->set_input_devices(amp.hw, devices);
+
+ return 0;
+}
+
+int amplifier_set_output_devices(uint32_t devices) {
+ if (amp.hw && amp.hw->set_output_devices) return amp.hw->set_output_devices(amp.hw, devices);
+
+ return 0;
+}
+
+int amplifier_enable_devices(uint32_t devices, bool enable) {
+ bool is_output = devices < SND_DEVICE_OUT_END;
+
+ if (amp.hw && amp.hw->enable_output_devices && is_output)
+ return amp.hw->enable_output_devices(amp.hw, devices, enable);
+
+ if (amp.hw && amp.hw->enable_input_devices && !is_output)
+ return amp.hw->enable_input_devices(amp.hw, devices, enable);
+
+ return 0;
+}
+
+int amplifier_set_mode(audio_mode_t mode) {
+ if (amp.hw && amp.hw->set_mode) return amp.hw->set_mode(amp.hw, mode);
+
+ return 0;
+}
+
+int amplifier_output_stream_start(struct audio_stream_out* stream, bool offload) {
+ if (amp.hw && amp.hw->output_stream_start)
+ return amp.hw->output_stream_start(amp.hw, stream, offload);
+
+ return 0;
+}
+
+int amplifier_input_stream_start(struct audio_stream_in* stream) {
+ if (amp.hw && amp.hw->input_stream_start) return amp.hw->input_stream_start(amp.hw, stream);
+
+ return 0;
+}
+
+int amplifier_output_stream_standby(struct audio_stream_out* stream) {
+ if (amp.hw && amp.hw->output_stream_standby)
+ return amp.hw->output_stream_standby(amp.hw, stream);
+
+ return 0;
+}
+
+int amplifier_input_stream_standby(struct audio_stream_in* stream) {
+ if (amp.hw && amp.hw->input_stream_standby) return amp.hw->input_stream_standby(amp.hw, stream);
+
+ return 0;
+}
+
+int amplifier_set_parameters(struct str_parms* parms) {
+ if (amp.hw && amp.hw->set_parameters) return amp.hw->set_parameters(amp.hw, parms);
+
+ return 0;
+}
+
+int amplifier_out_set_parameters(struct str_parms* parms) {
+ if (amp.hw && amp.hw->out_set_parameters) return amp.hw->out_set_parameters(amp.hw, parms);
+
+ return 0;
+}
+
+int amplifier_in_set_parameters(struct str_parms* parms) {
+ if (amp.hw && amp.hw->in_set_parameters) return amp.hw->in_set_parameters(amp.hw, parms);
+
+ return 0;
+}
+
+int amplifier_set_feedback(void* adev, uint32_t devices, bool enable) {
+ amp.adev = (struct audio_device*)adev;
+ if (amp.hw && amp.hw->set_feedback)
+ return amp.hw->set_feedback(amp.hw, amp.adev, devices, enable);
+ return 0;
+}
+
+int amplifier_close(void) {
+ if (amp.hw) amplifier_device_close(amp.hw);
+
+ amp.hw = NULL;
+
+ return 0;
+}
diff --git a/hal/audio_extn/audio_amplifier.h b/hal/audio_extn/audio_amplifier.h
new file mode 100644
index 0000000..7607392
--- /dev/null
+++ b/hal/audio_extn/audio_amplifier.h
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 2016 The CyanogenMod Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef EXTN_AMPLIFIER_H
+#define EXTN_AMPLIFIER_H
+
+#ifndef EXT_AMPLIFIER_ENABLED
+#define amplifier_open(adev) (0)
+#define amplifier_set_input_devices(devices) (0)
+#define amplifier_set_output_devices(devices) (0)
+#define amplifier_enable_devices(devices, enable) (0)
+#define amplifier_set_mode(mode) (0)
+#define amplifier_output_stream_start(stream, offload) (0)
+#define amplifier_input_stream_start(stream) (0)
+#define amplifier_output_stream_standby(stream) (0)
+#define amplifier_input_stream_standby(stream) (0)
+#define amplifier_set_parameters(parms) (0)
+#define amplifier_out_set_parameters(parms) (0)
+#define amplifier_in_set_parameters(parms) (0)
+#define amplifier_set_feedback(adev, devices, enable) (0)
+#define amplifier_close() (0)
+#else
+
+int amplifier_open(void* adev);
+int amplifier_set_input_devices(uint32_t devices);
+int amplifier_set_output_devices(uint32_t devices);
+int amplifier_enable_devices(uint32_t devices, bool enable);
+int amplifier_set_mode(audio_mode_t mode);
+int amplifier_output_stream_start(struct audio_stream_out* stream, bool offload);
+int amplifier_input_stream_start(struct audio_stream_in* stream);
+int amplifier_output_stream_standby(struct audio_stream_out* stream);
+int amplifier_input_stream_standby(struct audio_stream_in* stream);
+int amplifier_set_parameters(struct str_parms* parms);
+int amplifier_out_set_parameters(struct str_parms* parms);
+int amplifier_in_set_parameters(struct str_parms* parms);
+int amplifier_set_feedback(void* adev, uint32_t devices, bool enable);
+int amplifier_close(void);
+#endif
+
+#endif
diff --git a/hal/audio_extn/gef.c b/hal/audio_extn/gef.c
index 69b1e41..dc70717 100644
--- a/hal/audio_extn/gef.c
+++ b/hal/audio_extn/gef.c
@@ -39,6 +39,7 @@
#include "audio_hw.h"
#include "platform.h"
#include "platform_api.h"
+#include <pthread.h>
#include <sys/stat.h>
#include <stdlib.h>
#include <dlfcn.h>
diff --git a/hal/audio_hw.c b/hal/audio_hw.c
index 9b29a21..0a9c8b4 100644
--- a/hal/audio_hw.c
+++ b/hal/audio_hw.c
@@ -85,6 +85,8 @@
#include "sound/asound.h"
+#include "audio_amplifier.h"
+
#ifdef DYNAMIC_LOG_ENABLED
#include <log_xml_parser.h>
#define LOG_MASK HAL_MOD_FILE_AUDIO_HW
@@ -1385,6 +1387,7 @@
goto err;
}
audio_extn_dev_arbi_acquire(snd_device);
+ amplifier_enable_devices(snd_device, true);
if (audio_extn_spkr_prot_start_processing(snd_device)) {
ALOGE("%s: spkr_start_processing failed", __func__);
audio_extn_dev_arbi_release(snd_device);
@@ -1450,6 +1453,7 @@
}
audio_extn_dev_arbi_acquire(snd_device);
audio_route_apply_and_update_path(adev->audio_route, device_name);
+ amplifier_set_feedback(adev, snd_device, true);
if (SND_DEVICE_OUT_HEADPHONES == snd_device &&
!adev->native_playback_enabled &&
@@ -1521,6 +1525,7 @@
platform_set_speaker_gain_in_combo(adev, snd_device, false);
} else {
audio_route_reset_and_update_path(adev->audio_route, device_name);
+ amplifier_enable_devices(snd_device, false);
}
if (snd_device == SND_DEVICE_OUT_BT_A2DP) {
@@ -1551,6 +1556,7 @@
}
audio_extn_utils_release_snd_device(snd_device);
+ amplifier_set_feedback(adev, snd_device, false);
} else {
if (platform_split_snd_device(adev->platform,
snd_device,
@@ -2921,6 +2927,10 @@
disable_snd_device(adev, usecase->in_snd_device);
}
+ /* Rely on amplifier_set_devices to distinguish between in/out devices */
+ amplifier_set_input_devices(in_snd_device);
+ amplifier_set_output_devices(out_snd_device);
+
/* Applicable only on the targets that has external modem.
* New device information should be sent to modem before enabling
* the devices to reduce in-call device switch time.
@@ -4535,6 +4545,9 @@
}
pthread_mutex_lock(&adev->lock);
+
+ amplifier_output_stream_standby((struct audio_stream_out *) stream);
+
out->standby = true;
if (out->usecase == USECASE_COMPRESS_VOIP_CALL) {
voice_extn_compress_voip_close_output_stream(stream);
@@ -5035,6 +5048,8 @@
if (!parms)
goto error;
+ amplifier_out_set_parameters(parms);
+
err = platform_get_controller_stream_from_params(parms, &ext_controller,
&ext_stream);
if (err == 0) {
@@ -5888,6 +5903,11 @@
ret = voice_extn_compress_voip_start_output_stream(out);
else
ret = start_output_stream(out);
+
+ if (ret == 0)
+ amplifier_output_stream_start(stream,
+ is_offload_usecase(out->usecase));
+
/* ToDo: If use case is compress offload should return 0 */
if (ret != 0) {
out->standby = true;
@@ -6789,6 +6809,8 @@
adev->adm_deregister_stream(adev->adm_data, in->capture_handle);
pthread_mutex_lock(&adev->lock);
+ amplifier_input_stream_standby((struct audio_stream_in *) stream);
+
in->standby = true;
if (in->usecase == USECASE_COMPRESS_VOIP_CALL) {
do_stop = false;
@@ -6973,6 +6995,9 @@
if (!parms)
goto error;
+
+ amplifier_in_set_parameters(parms);
+
lock_input_stream(in);
pthread_mutex_lock(&adev->lock);
@@ -7121,6 +7146,10 @@
if (adev->num_va_sessions < UINT_MAX)
adev->num_va_sessions++;
}
+
+ if (ret == 0)
+ amplifier_input_stream_start(stream);
+
pthread_mutex_unlock(&adev->lock);
if (ret != 0) {
goto exit;
@@ -9003,6 +9032,7 @@
}
}
+ amplifier_set_parameters(parms);
audio_extn_set_parameters(adev, parms);
done:
str_parms_destroy(parms);
@@ -9131,6 +9161,8 @@
if (adev->mode != mode) {
ALOGD("%s: mode %d , prev_mode %d \n", __func__, mode , adev->mode);
adev->prev_mode = adev->mode; /* prev_mode is kept to handle voip concurrency*/
+ if (amplifier_set_mode(mode) != 0)
+ ALOGE("Failed setting amplifier mode");
adev->mode = mode;
if (mode == AUDIO_MODE_CALL_SCREEN) {
adev->current_call_output = adev->primary_output;
@@ -10289,6 +10321,8 @@
if ((--audio_device_ref_count) == 0) {
if (audio_extn_spkr_prot_is_enabled())
audio_extn_spkr_prot_deinit();
+ if (amplifier_close() != 0)
+ ALOGE("Amplifier close failed");
audio_extn_battery_properties_listener_deinit();
audio_extn_snd_mon_unregister_listener(adev);
audio_extn_sound_trigger_deinit(adev);
@@ -10720,6 +10754,10 @@
adev->vr_audio_mode_enabled = false;
audio_extn_ds2_enable(adev);
+
+ if (amplifier_open(adev) != 0)
+ ALOGE("Amplifier initialization failed");
+
*device = &adev->device.common;
if (k_enable_extended_precision)
diff --git a/hal/audio_hw.h b/hal/audio_hw.h
index 32271bb..ff1f293 100644
--- a/hal/audio_hw.h
+++ b/hal/audio_hw.h
@@ -42,6 +42,7 @@
#include <cutils/str_parms.h>
#include <cutils/list.h>
#include <cutils/hashmap.h>
+#include <hardware/audio_amplifier.h>
#include <hardware/audio.h>
#include <tinyalsa/asoundlib.h>
#include <tinycompress/tinycompress.h>
@@ -746,6 +747,8 @@
Hashmap *io_streams_map;
bool a2dp_started;
bool ha_proxy_enable;
+
+ amplifier_device_t *amp;
};
struct audio_patch_record {
diff --git a/hal/audio_hw_extn_api.c b/hal/audio_hw_extn_api.c
index 4fece7e..6d8901d 100644
--- a/hal/audio_hw_extn_api.c
+++ b/hal/audio_hw_extn_api.c
@@ -42,6 +42,8 @@
#include "audio_extn.h"
#include "audio_hw_extn_api.h"
+#include <pthread.h>
+
#ifdef DYNAMIC_LOG_ENABLED
#include <log_xml_parser.h>
#define LOG_MASK HAL_MOD_FILE_AUDIO_HW_EXTN_API
diff --git a/hal/platform_info.c b/hal/platform_info.c
index 4ad5a5c..84f56a1 100644
--- a/hal/platform_info.c
+++ b/hal/platform_info.c
@@ -41,6 +41,7 @@
#include "platform_api.h"
#include "audio_extn.h"
#include <platform.h>
+#include <pthread.h>
#include <math.h>
#ifdef DYNAMIC_LOG_ENABLED
diff --git a/post_proc/Android.mk b/post_proc/Android.mk
index 774198d..862b81b 100644
--- a/post_proc/Android.mk
+++ b/post_proc/Android.mk
@@ -82,12 +82,12 @@
LOCAL_C_INCLUDES := \
external/tinyalsa/include \
- vendor/qcom/opensource/audio-hal/primary-hal/hal \
+ $(call project-path-for,qcom-audio)/hal \
$(TARGET_OUT_INTERMEDIATES)/KERNEL_OBJ/usr/include \
$(TARGET_OUT_INTERMEDIATES)/KERNEL_OBJ/usr/include/audio \
$(TARGET_OUT_INTERMEDIATES)/KERNEL_OBJ/usr/techpack/audio/include \
$(call include-path-for, audio-effects) \
- vendor/qcom/opensource/audio-hal/primary-hal/hal/audio_extn/
+ $(call project-path-for,qcom-audio)/hal/audio_extn/
ifeq ($(strip $(AUDIO_FEATURE_ENABLED_DLKM)),true)
LOCAL_HEADER_LIBRARIES += audio_kernel_headers
@@ -195,14 +195,14 @@
LOCAL_ADDITIONAL_DEPENDENCIES += $(TARGET_OUT_INTERMEDIATES)/KERNEL_OBJ/usr
LOCAL_C_INCLUDES := \
- vendor/qcom/opensource/audio-hal/primary-hal/hal \
+ $(call project-path-for,qcom-audio)/hal \
$(TARGET_OUT_INTERMEDIATES)/KERNEL_OBJ/usr/include \
$(TARGET_OUT_INTERMEDIATES)/KERNEL_OBJ/usr/include/audio \
$(TARGET_OUT_INTERMEDIATES)/KERNEL_OBJ/usr/techpack/audio/include \
external/tinyalsa/include \
$(call include-path-for, audio-effects) \
$(call include-path-for, audio-route) \
- vendor/qcom/opensource/audio-hal/primary-hal/hal/audio_extn \
+ $(call project-path-for,qcom-audio)/hal/audio_extn \
external/tinycompress/include \
system/media/audio_utils/include
diff --git a/qahw/Android.mk b/qahw/Android.mk
index decd4c6..7cd908a 100644
--- a/qahw/Android.mk
+++ b/qahw/Android.mk
@@ -5,11 +5,9 @@
include $(CLEAR_VARS)
-libqahw-inc := $(LOCAL_PATH)/inc
-
LOCAL_MODULE := libqahwwrapper
LOCAL_MODULE_TAGS := optional
-LOCAL_C_INCLUDES := $(libqahw-inc)
+LOCAL_C_INCLUDES := $(LOCAL_PATH)/inc
LOCAL_HEADER_LIBRARIES := libutils_headers \
libsystem_headers \
@@ -27,10 +25,6 @@
LOCAL_CFLAGS += -Wall -Werror
-LOCAL_COPY_HEADERS_TO := mm-audio/qahw/inc
-LOCAL_COPY_HEADERS := inc/qahw.h
-LOCAL_COPY_HEADERS += inc/qahw_effect_api.h
-
LOCAL_PROPRIETARY_MODULE := true
LOCAL_VENDOR_MODULE := true
@@ -39,5 +33,12 @@
endif
include $(BUILD_SHARED_LIBRARY)
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := libqahw_headers
+LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/inc
+LOCAL_PROPRIETARY_MODULE := true
+
+include $(BUILD_HEADER_LIBRARY)
endif
endif
diff --git a/qahw_api/Android.mk b/qahw_api/Android.mk
index 30c326f..5d1789c 100644
--- a/qahw_api/Android.mk
+++ b/qahw_api/Android.mk
@@ -4,12 +4,9 @@
include $(CLEAR_VARS)
-libqahwapi-inc := $(LOCAL_PATH)/inc
-
LOCAL_MODULE := libqahw
LOCAL_MODULE_TAGS := optional
-LOCAL_C_INCLUDES := $(libqahwapi-inc)
-LOCAL_C_INCLUDES += $(TARGET_OUT_HEADERS)/mm-audio/qahw/inc
+LOCAL_C_INCLUDES := $(LOCAL_PATH)/inc
LOCAL_SRC_FILES := \
src/qahw_api.cpp
@@ -20,6 +17,9 @@
LOCAL_STATIC_LIBRARIES += libprofile_rt
endif
+LOCAL_HEADER_LIBRARIES := \
+ libqahw_headers
+
LOCAL_SHARED_LIBRARIES := \
liblog \
libcutils \
@@ -30,17 +30,6 @@
LOCAL_CFLAGS += -Wall -Werror
-LOCAL_COPY_HEADERS_TO := mm-audio/qahw_api/inc
-LOCAL_COPY_HEADERS := inc/qahw_defs.h
-LOCAL_COPY_HEADERS += inc/qahw_api.h
-LOCAL_COPY_HEADERS += inc/qahw_effect_audiosphere.h
-LOCAL_COPY_HEADERS += inc/qahw_effect_bassboost.h
-LOCAL_COPY_HEADERS += inc/qahw_effect_environmentalreverb.h
-LOCAL_COPY_HEADERS += inc/qahw_effect_equalizer.h
-LOCAL_COPY_HEADERS += inc/qahw_effect_presetreverb.h
-LOCAL_COPY_HEADERS += inc/qahw_effect_virtualizer.h
-LOCAL_COPY_HEADERS += inc/qahw_effect_visualizer.h
-
LOCAL_VENDOR_MODULE := true
ifneq ($(filter kona lahaina holi,$(TARGET_BOARD_PLATFORM)),)
@@ -48,6 +37,14 @@
endif
include $(BUILD_SHARED_LIBRARY)
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := libqahwapi_headers
+LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/inc
+LOCAL_PROPRIETARY_MODULE := true
+
+include $(BUILD_HEADER_LIBRARY)
+
#test app compilation
include $(LOCAL_PATH)/test/Android.mk
diff --git a/qahw_api/test/Android.mk b/qahw_api/test/Android.mk
index 110a765..bc7690d 100644
--- a/qahw_api/test/Android.mk
+++ b/qahw_api/test/Android.mk
@@ -7,12 +7,14 @@
qahw_effect_test.c
LOCAL_MODULE := hal_play_test
-hal-play-inc = $(TARGET_OUT_HEADERS)/mm-audio/qahw_api/inc
-hal-play-inc += $(TARGET_OUT_HEADERS)/mm-audio/qahw/inc
hal-play-inc += external/tinyalsa/include
LOCAL_CFLAGS += -Wall -Werror -Wno-sign-compare
+LOCAL_HEADER_LIBRARIES := \
+ libqahw_headers \
+ libqahwapi_headers
+
LOCAL_SHARED_LIBRARIES := \
libaudioutils\
libqahw \
@@ -42,6 +44,10 @@
LOCAL_SRC_FILES := qahw_multi_record_test.c
LOCAL_MODULE := hal_rec_test
LOCAL_CFLAGS += -Wall -Werror -Wno-sign-compare
+
+LOCAL_HEADER_LIBRARIES := \
+ libqahwapi_headers
+
LOCAL_SHARED_LIBRARIES := \
libaudioutils \
libqahw \
@@ -49,9 +55,6 @@
LOCAL_32_BIT_ONLY := true
-hal-rec-inc = $(TARGET_OUT_HEADERS)/mm-audio/qahw_api/inc
-
-LOCAL_C_INCLUDES += $(hal-rec-inc)
LOCAL_VENDOR_MODULE := true
ifneq ($(filter kona lahaina holi,$(TARGET_BOARD_PLATFORM)),)